Skip to content

Commit ab5723e

Browse files
tae2089claude
andauthored
chore: remove unreachable internal helper functions (#21)
Dead internal helpers with zero callers in production and tests, found via `deadcode` (scanned against both binaries) and confirmed with git grep: - incremental.WithResolveOptions — unused SyncerOption constructor - treesitter typescriptDeclaredTypeName + collectTypedMembersInto + typedNameAndType — a self-contained dead chain (no external caller) - ccgref.MustParse — unused - cli.namespaceRagIndexDir — unused - mcp.handlers.resolvedRagIndexPath — unused Test-only helpers (incremental.WithLogger, changes.Analyze and its risk helpers, ragindex.PruneTree/LoadIndex) are intentionally kept — their tests still exercise them. No behavior change; -96 lines. Independently reviewed. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent fb71f0d commit ab5723e

5 files changed

Lines changed: 0 additions & 96 deletions

File tree

internal/analysis/incremental/incremental.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,6 @@ func WithParsers(parsers map[string]Parser) SyncerOption {
119119
}
120120
}
121121

122-
// WithResolveOptions sets edge-resolution options for this syncer instance.
123-
// @intent keep call resolution behavior configurable without changing core interfaces.
124-
func WithResolveOptions(opts edgeresolve.ResolveOptions) SyncerOption {
125-
return func(s *Syncer) {
126-
s.opts = opts
127-
}
128-
}
129-
130122
// New creates an incremental syncer.
131123
// @intent wire storage, parser, and optional configuration into a sync coordinator
132124
// @ensures returned syncer always has a non-nil logger

internal/ccgref/ref.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,6 @@ func Parse(value string) (*Ref, error) {
7070
}, nil
7171
}
7272

73-
// MustParse is a test helper for constructing refs.
74-
// @intent keep tests concise while still using the production parser.
75-
func MustParse(value string) Ref {
76-
ref, err := Parse(value)
77-
if err != nil {
78-
panic(err)
79-
}
80-
return *ref
81-
}
82-
8373
// Display returns a compact human-readable form for UI labels and logs.
8474
// @intent shorten ccg refs while preserving namespace, path, and symbol identity.
8575
func (r Ref) Display() string {

internal/cli/docs.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,6 @@ func buildDocsWikiIndex(ctx context.Context, deps *Deps, opts docsWikiOptions) (
104104
return b.Build(ctx)
105105
}
106106

107-
// @intent align CLI RAG index output with MCP and Wiki server namespace lookup paths.
108-
func namespaceRagIndexDir(baseDir, namespace string) string {
109-
if ctxns.Normalize(namespace) == ctxns.DefaultNamespace {
110-
return baseDir
111-
}
112-
return filepath.Join(baseDir, namespace)
113-
}
114-
115107
// resolveRagIndexDir honors rag.index_dir when the CLI flag is left at its default.
116108
// @intent keep docs and rag-index commands aligned with config-based RAG output paths.
117109
func resolveRagIndexDir(flagValue string) string {

internal/mcp/handler_docs.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,6 @@ func safePathUnderRoot(root, relPath, field string, createRoot bool, allowMissin
7878
return target, nil
7979
}
8080

81-
// @intent derive the safe doc-index.json path for either the shared docs root or one namespace-specific subtree.
82-
func (h *handlers) resolvedRagIndexPath(namespace string) (string, error) {
83-
if ctxns.Normalize(namespace) == ctxns.DefaultNamespace {
84-
return safePathUnderRoot(h.ragIndexRoot(), "doc-index.json", "file_path", false, true)
85-
}
86-
if namespace != "" {
87-
if err := validateNamespacePath(namespace, ""); err != nil {
88-
return "", err
89-
}
90-
return safePathUnderRoot(h.ragIndexRoot(), filepath.Join(namespace, "doc-index.json"), "namespace", false, true)
91-
}
92-
return safePathUnderRoot(h.ragIndexRoot(), "doc-index.json", "file_path", false, true)
93-
}
94-
9581
// getDocContent reads a generated documentation file by relative path.
9682
// @intent Returns the content of a documentation file directly so agents can read detailed descriptions.
9783
// @param request file_path is the relative documentation path based on the working directory.

internal/parse/treesitter/semantics_js_ts.go

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -243,18 +243,6 @@ func collectTypeScriptMemberTypes(root *sitter.Node, content []byte) map[string]
243243
return members
244244
}
245245

246-
// typescriptDeclaredTypeName extracts the declared type name from a TypeScript node.
247-
// @intent normalize AST-derived type names before they participate in receiver rewriting.
248-
func typescriptDeclaredTypeName(n *sitter.Node, content []byte) string {
249-
if n == nil {
250-
return ""
251-
}
252-
if nameNode := n.ChildByFieldName("name"); nameNode != nil {
253-
return normalizeReceiverTypeName(nameNode.Content(content))
254-
}
255-
return ""
256-
}
257-
258246
// typescriptReceiverChain extracts the selector chain from a TypeScript call node.
259247
// @intent recover member-call hops directly from the AST when callee text is insufficient.
260248
func typescriptReceiverChain(callNode *sitter.Node, content []byte) []string {
@@ -312,50 +300,6 @@ func collectTypeScriptMembersFromText(src string) map[string]map[string]string {
312300
return members
313301
}
314302

315-
// collectTypedMembersInto walks an AST subtree and records typed members under one owner.
316-
// @intent support future AST-based member extraction without changing the receiver rewrite contract.
317-
func collectTypedMembersInto(owner string, n *sitter.Node, content []byte, dst map[string]map[string]string) {
318-
var walk func(*sitter.Node)
319-
walk = func(cur *sitter.Node) {
320-
if cur == nil {
321-
return
322-
}
323-
switch cur.Type() {
324-
case "property_signature", "public_field_definition":
325-
name, typeName, ok := typedNameAndType(cur, content)
326-
if ok && !isLooseReceiverType(typeName) {
327-
if dst[owner] == nil {
328-
dst[owner] = make(map[string]string)
329-
}
330-
dst[owner][name] = typeName
331-
}
332-
}
333-
for i := 0; i < int(cur.NamedChildCount()); i++ {
334-
walk(cur.NamedChild(i))
335-
}
336-
}
337-
walk(n)
338-
}
339-
340-
// typedNameAndType extracts a member name and type from one typed declaration node.
341-
// @intent share field-signature parsing between AST-backed member collectors.
342-
func typedNameAndType(n *sitter.Node, content []byte) (string, string, bool) {
343-
if n == nil {
344-
return "", "", false
345-
}
346-
nameNode := n.ChildByFieldName("name")
347-
typeNode := n.ChildByFieldName("type")
348-
if nameNode == nil || typeNode == nil {
349-
return "", "", false
350-
}
351-
name := strings.TrimSpace(nameNode.Content(content))
352-
typeName := normalizeReceiverTypeName(typeNode.Content(content))
353-
if name == "" || typeName == "" {
354-
return "", "", false
355-
}
356-
return name, typeName, true
357-
}
358-
359303
// memberChainFromNode extracts a dotted selector chain from one AST node.
360304
// @intent reuse AST-derived selector parsing when raw callee strings are incomplete.
361305
func memberChainFromNode(n *sitter.Node, content []byte) []string {

0 commit comments

Comments
 (0)