Skip to content

Commit d363003

Browse files
committed
feat: symbolic editing and project memories (Serena-parity, static edition)
replace_symbol_body / insert_after_symbol / insert_before_symbol operate on AST line spans with the leader's exact contracts: verbatim indented bodies, blank-line separation preserved for definition-like kinds, unique name-path resolution that errors with the candidate list on ambiguity. write/read/ list/delete_memory persist named markdown notes under .codeindex/memories/ (topic subdirectories, path-traversal defense) — the cross-session project- knowledge layer. findSymbol substring matching now applies to the last path segment only (parents stay exact), matching the reference semantics. All exposed as MCP tools; 20 tools total.
1 parent 31595da commit d363003

10 files changed

Lines changed: 623 additions & 35 deletions

File tree

scripts/engine.d.mts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,22 @@ interface SymbolReferences {
346346
}
347347
declare function findReferences(scan: RepoScan, name: string): SymbolReferences;
348348

349+
interface EditResult {
350+
file: string;
351+
startLine: number;
352+
endLine: number;
353+
lines: number;
354+
}
355+
declare function resolveUniqueSymbol(scan: RepoScan, namePath: string, file?: string): CodeSymbol;
356+
declare function replaceSymbolBody(scan: RepoScan, namePath: string, body: string, file?: string): EditResult;
357+
declare function insertAfterSymbol(scan: RepoScan, namePath: string, body: string, file?: string): EditResult;
358+
declare function insertBeforeSymbol(scan: RepoScan, namePath: string, body: string, file?: string): EditResult;
359+
360+
declare function writeMemory(repo: string, name: string, content: string): string;
361+
declare function readMemory(repo: string, name: string): string | undefined;
362+
declare function deleteMemory(repo: string, name: string): boolean;
363+
declare function listMemories(repo: string): string[];
364+
349365
type WorkspaceKind = "npm" | "pnpm" | "lerna" | "nx" | "cargo" | "go" | "maven";
350366
interface WorkspacePackage {
351367
name: string;
@@ -517,4 +533,4 @@ declare function rrf<T>(lists: T[][], keyOf: (item: T) => string, k?: number): M
517533

518534
declare function runCli(argv: string[]): Promise<void>;
519535

520-
export { type BuildIndexOptions, type CallerEntry, type CallerIndex, type CallerSite, type ChangeCoupling, type CodeInfo, type CodeSymbol, type CouplingOptions, DEFAULT_MAX_FILES, type DiffFile, type DiffSpec, ENGINE_VERSION, EXTRACTOR_VERSION, type Edge, type EdgeKind, type FileCategory, type FileKind, type FileNode, type FileRecord, type FindSymbolOptions, type Graph, type GrepOptions, type Hotspot, type Hunk, type IgnoreRule, type IndexArtifacts, MARKDOWN_EXT, type MarkdownInfo, type ModuleInfo, type ModuleNode, type RawRef, type RepoMapOptions, type RepoScan, type Resolution, type ResolveContext, SCHEMA_VERSION, type ScanOptions, type SearchHit, type ShResult, type SurpriseEdge, type SymbolIndex, type SymbolMatch, type SymbolReferences, type TestMap, type Tier, type WalkOptions, type WalkResult, type WalkedFile, type WorkspaceInfo, type WorkspaceKind, type WorkspacePackage, allGrammarKeys, applyCentrality, betweennessOf, buildCallerIndex, buildGraph, buildIndexArtifacts, buildModules, buildResolveContext, buildSymbolIndex, byKey, byStr, categorize, changeCoupling, changedSince, classify, clip, clipInline, communityOf, compileGlobs, computeImportPairs, computeSurprises, computeSymbolRefs, computeTestMap, detectCommunities, detectWorkspaces, diffFiles, diffHunks, enclosingSymbol, ensureGrammars, escapeRegExp, extToLang, extractAst, extractCode, extractMarkdown, extractSymbols, findReferences, findSymbol, foldText, gitChurn, grammarKeyForExt, grammarReady, grepRepo, have, headCommit, isCode, isDoc, isGitWorktree, isIgnored, isSurprising, isTestFile, isTestPath, keywords, languageOf, pagerankOf, parseGitignore, rankHotspots, rankedKeywords, readText, renderGraphJson, renderRepoMap, renderSymbolsJson, resolveBaseRef, resolveCallEdges, resolveDocLink, resolveImport, rrf, runCli, runMcpServer, scanRepo, sh, sha1, shortHash, slugify, symbolsOverview, testsForModule, tierForPath, uniqueSymbolDefs, untestedModules, untrackedFiles, walk };
536+
export { type BuildIndexOptions, type CallerEntry, type CallerIndex, type CallerSite, type ChangeCoupling, type CodeInfo, type CodeSymbol, type CouplingOptions, DEFAULT_MAX_FILES, type DiffFile, type DiffSpec, ENGINE_VERSION, EXTRACTOR_VERSION, type Edge, type EdgeKind, type EditResult, type FileCategory, type FileKind, type FileNode, type FileRecord, type FindSymbolOptions, type Graph, type GrepOptions, type Hotspot, type Hunk, type IgnoreRule, type IndexArtifacts, MARKDOWN_EXT, type MarkdownInfo, type ModuleInfo, type ModuleNode, type RawRef, type RepoMapOptions, type RepoScan, type Resolution, type ResolveContext, SCHEMA_VERSION, type ScanOptions, type SearchHit, type ShResult, type SurpriseEdge, type SymbolIndex, type SymbolMatch, type SymbolReferences, type TestMap, type Tier, type WalkOptions, type WalkResult, type WalkedFile, type WorkspaceInfo, type WorkspaceKind, type WorkspacePackage, allGrammarKeys, applyCentrality, betweennessOf, buildCallerIndex, buildGraph, buildIndexArtifacts, buildModules, buildResolveContext, buildSymbolIndex, byKey, byStr, categorize, changeCoupling, changedSince, classify, clip, clipInline, communityOf, compileGlobs, computeImportPairs, computeSurprises, computeSymbolRefs, computeTestMap, deleteMemory, detectCommunities, detectWorkspaces, diffFiles, diffHunks, enclosingSymbol, ensureGrammars, escapeRegExp, extToLang, extractAst, extractCode, extractMarkdown, extractSymbols, findReferences, findSymbol, foldText, gitChurn, grammarKeyForExt, grammarReady, grepRepo, have, headCommit, insertAfterSymbol, insertBeforeSymbol, isCode, isDoc, isGitWorktree, isIgnored, isSurprising, isTestFile, isTestPath, keywords, languageOf, listMemories, pagerankOf, parseGitignore, rankHotspots, rankedKeywords, readMemory, readText, renderGraphJson, renderRepoMap, renderSymbolsJson, replaceSymbolBody, resolveBaseRef, resolveCallEdges, resolveDocLink, resolveImport, resolveUniqueSymbol, rrf, runCli, runMcpServer, scanRepo, sh, sha1, shortHash, slugify, symbolsOverview, testsForModule, tierForPath, uniqueSymbolDefs, untestedModules, untrackedFiles, walk, writeMemory };

0 commit comments

Comments
 (0)