Instructions for AI coding agents working on this project.
GitLess is a minimal VSCode extension for Git integration. It provides a dedicated Source Control panel section with views (Commits, Tags, Branches, Remotes, Stashes, Worktrees), an Inspect panel (File History, Line History, Search and Compare), and command palette commands for remote URLs, commit SHAs, remote links, repository selection, commit search, and ref comparison.
- Use pnpm for package management (not npm or yarn).
- Use Conventional Commits and Angular commit message conventions for all commit messages (e.g.
feat:,fix:,docs:). - Use Prettier for formatting with
"semi": false(no semicolons). - Use double quotes for strings.
- Use ASCII characters in written output, code comments, commit messages, and documentation, except for box-drawing characters (
├,└,│,─) in filesystem tree diagrams. - Do not create Git commits on
main; always work on a feature branch. - Do not Git push to
main; always push to a feature branch.
- Entry point:
src/extension.ts-activate()creates aContainerinstance. - DI container:
src/container.ts- Wires up theGitService, revision content provider, file decoration provider, commands, views, and configuration. - Git layer:
src/git/-models.ts(interfaces),shell.ts(subprocess execution),parsers.ts(output parsing),remoteUrls.ts(URL generation),gitService.ts(repository discovery, active repository selection, high-level Git API). - Commands:
src/commands/registerCommands.ts- All command handlers registered in one function. Command IDs defined insrc/constants.ts. - Views:
src/views/-groupedView.tsowns a singleTreeViewin the SCM panel and switches among sub-viewTreeDataProviders.fileHistoryView.ts,lineHistoryView.ts, andsearchAndCompareView.tsback the GitLess Inspect panel. Tree node classes are insrc/views/nodes.ts, andgitFileDecorationProvider.tsadds Git status badges to file nodes. - Configuration:
src/config.ts- Readsgitless.*settings.src/constants.tshas all command/view/context IDs.
When adding a new command:
- Add to
Commandsinsrc/constants.ts - Add handler in
src/commands/registerCommands.ts - Add to
contributes.commandsinpackage.json - Add menu entries and command palette exclusions in
package.jsonif needed
When adding a new grouped Source Control sub-view:
- Add the view type to
GroupedViewTypeinsrc/views/groupedView.ts - Create the view class in
src/views/ - Add it to the
subViewsmap and command registrations ingroupedView.ts - Add command IDs to
Commandsinsrc/constants.ts - Add command entries and
view/titletoggle buttons inpackage.json
When adding a new Inspect panel view:
- Add to
ViewIdsinsrc/constants.ts - Create view class in
src/views/ - Export from
src/views/index.ts - Instantiate in
src/container.ts - Declare in
package.jsonundercontributes.views
pnpm install # Install dependencies
pnpm run build # Production build (esbuild -> dist/extension.js)
pnpm run build:dev # Dev build with sourcemaps
pnpm run lint # Prettier check
pnpm run format # Prettier writeAt this time, agents should not automatically run pnpm run test (unit tests with Mocha in VS Code test host) or pnpm run test:e2e (Playwright). The VS Code test host and Playwright extension tests may not be able to run properly in agent sandboxes. Run them only when explicitly requested or when an unsandboxed local environment is available.
package.json- Extension manifest. All commands, views, menus, and configuration are declared here.src/constants.ts- Single source of truth for command IDs, view IDs, and context value strings.src/git/gitService.ts- Repository discovery, active repository selection, and high-level Git operations.src/git/parsers.ts- Git output parsing. Changes here should be accompanied by unit tests insrc/__tests__/parsers.test.ts.src/git/remoteUrls.ts- Remote URL generation for GitHub, GitLab, Forgejo/Codeberg, Azure DevOps, and Bitbucket. Tests insrc/__tests__/remoteUrls.test.ts.src/views/searchAndCompareView.ts- Search and Compare Inspect panel behavior. Tests are insrc/__tests__/searchAndCompareView.test.ts.
- Unit tests are in
src/__tests__/using MochatddUI (suite/test, notdescribe/it). - Prefer testing pure functions (parsers, URL generation) over VSCode API integration.
- Do not automatically run
pnpm run testorpnpm run test:e2ein agent sandboxes. - Run
pnpm run lintandpnpm run buildto verify before committing when those commands are relevant.