Codebase Notebook (crosscodenotes) is a VS Code extension that lets developers take structured, markdown-based notes anchored to specific lines of code across a codebase. Notes are stored as JSON index + individual .md files.
- Publisher: SolenodonteLabs
- Repository: https://github.com/Kyonru/code-notes.git
- Engine: VS Code
^1.107.0 - Language: TypeScript (strict mode, ES2022 target)
npm run compile # tsc -p ./
npm run watch # tsc -watch -p ./ (use for development)
npm run lint # eslint src
npm run test # vscode-test (requires VS Code test runner)
npx tsc --noEmit # type-check without emittingThe compiled output goes to out/. Entry point is out/extension.js.
src/
extension.ts # Activation, registers all commands/providers
commands.ts # All command implementations (~2000+ lines)
storage.ts # NotesStorage class (CRUD, comments, references)
treeView.ts # TreeDataProvider + DragAndDropController
types.ts # NoteEntry, ReferenceEntry, ReferenceComment, NoteIndex
codelens.ts # CodeLensProvider for annotated lines
inlineCompletion.ts # InlineCompletionProvider
chat.ts # ChatParticipant (@notebook) with slash commands
utils.ts # Shared utilities
constants.ts # Constant values
migration.ts # Schema migration logic
test/
extension.test.ts # Tests (mocha)
- Storage: JSON index file (
notes.index.json) + one.mdfile per note. Storage location is configurable (global, custom dir, or.codenotes/in workspace). - TreeView: Hierarchical (notes → references). Context values:
note,note-archived,reference,reference-pinned,reference-commented,reference-pinned-commented. - AI Features: Uses VS Code Language Model API (
vscode.lm). Model selection is configurable viacrosscodenotes.modelFamilysetting with fallback QuickPick. SharedselectModel()helper in commands.ts. - Chat Participant:
@notebookwith commands:/annotate,/summarize,/relate,/diff,/suggest-note. - Graph View: WebviewPanel with HTML5 Canvas force-directed graph showing reference relationships.
| Setting | Purpose |
|---|---|
crosscodenotes.notesDirectory |
Custom storage directory |
crosscodenotes.useWorkspaceFolder |
Store in .codenotes/ (git-friendly) |
crosscodenotes.modelFamily |
Preferred AI model family |
NoteEntry { id, name, filePath, createdAt, updatedAt, tags?, archived? }
ReferenceEntry { id, noteId, file, line, annotation, codeSnippet, language, addedAt, pinned?, sortOrder?, comments? }
ReferenceComment { id, text, createdAt }
NoteIndex { schemaVersion, notes: Record<string, NoteEntry>, references: Record<string, ReferenceEntry> }- All commands are factory functions (
getXxxCommand) incommands.tsthat return the handler function. - Commands are registered in
extension.tsviavscode.commands.registerCommand. - Command IDs follow pattern:
crosscodenotes.commandName. - Tree item context values drive conditional menu visibility in
package.jsonwhenclauses. - ESLint config uses typescript-eslint with camelCase/PascalCase imports, curly braces, eqeqeq, no-throw-literal, semi.
- Always update README.md when adding new commands, settings, or features. The README contains a commands table and features list that must stay in sync.
- Always update package.json
contributes.commandsand relevant menus when adding new commands. - Always register commands in
extension.tsafter creating them incommands.ts. - Validate before committing: Run
npx tsc --noEmitto type-check and verifypackage.jsonis valid JSON. - Test contextValue changes: When modifying tree item context values, update all
whenclauses inpackage.jsonmenus.