Skip to content

plugin/typescript: index adapter and resolver rules for typescript, what the parser names differently and what the frontend must absorb #636

Closed

Description

@swapnilpaliwal-sd

Part of #634. Correct this language's entry in the adapter table (A[<lang>] in skills/axiomcode/scripts/axiomcode-index, header names, filters, kind mapping; data, not code) and add the resolver rules it needs in scripts/axiomcode and fill §5 of skills/axiomcode/DESIGN.md for this language. Acceptance: axiomcode find|uses|callers|impact answer the 20 names in the probe list on the first try; a nested member displays as Outer.Inner.member; every printed path is repo-relative; symbols.kind uses the fixed vocabulary (function|method|constructor|class|interface|enum|enum_member|type|namespace|const|variable|field|module).

Port bench/dogfood/tools/augment.py (TypeScript-only today) into the adapter; it already builds refs/literals/comments/variables/fields for this language.

What the IR gives (verified on bench/dogfood/work/_probe, the parser repo, 114k LOC)

  • references: all-typescript-expressions.csv kind IDENTIFIER_REFERENCE / PROPERTY_ACCESS, name = last segment of potentialQualifiedName, file via tsModuleLinkHash → all-typescript-modules.csv
  • string literals: kind LITERAL, literalType=STRING; comments: all-typescript-comments.csv
  • module consts: all-typescript-variables.csv scopeKind=MODULE_SCOPE, isConst, isExported; fields: all-typescript-fields.csv; enum members: all-typescript-enum-members.csv

What the resolver must absorb

  1. 2 154 methods are named <arrow> (of 7 798 client methods); 236 of the 238 variables with boundFunctionLinkHash point at an anonymous one. find foo for const foo = () => … must resolve through the variable to the method; callers foo likewise. Check whether class-property arrows (fields.initializerExpressionLinkHash) need the same.
  2. qualified_name is src/dir/file#Class.method; agents write Class.method, suffix match on the display name.
  3. symbols.kind='function' for owner_type_id IS NULL callables; the r1-sql view had every callable as method, which produced several of the empty queries in plugin: a query frontend agents can use without knowing the schema, find/uses/show/callers/callees/path/impact over one resolver, all languages #634.
  4. One language per run: .mjs/.js files are not in a typescript graph (src/test/javascript-gates/*.mjs cost several empty queries). Read skipped-typescript-files.csv into the index so find can say "exists, not indexed in this language" instead of nothing.
  5. Tiers ambient_terminal and intrinsic_terminal are RESOLVED in TypeScript (bundle note), the "sound" filter must not be a hardcoded (known_edge, multi_inferred).

Probe list (fill in): the 20 most-queried names from the r1 transcripts (work/*/r1-*/repo/.axiomcode/queries.jsonl), including the ones that came back empty.


Plugin, not a bare skill (2026-09-16). This work now lives in plugins/axiomcode/ on skill/query-frontend: an agent plugin, carrying the skill under skills/axiomcode/ and an MCP layer (.mcp.json -> mcp/server.py) that exposes the entry's subcommands as typed tools, axiomcode_index, axiomcode_path, axiomcode_impact and axiomcode_graph, each a thin shell-out to scripts/axiomcode, so an agent gets the CLI's verified output through a tool call instead of a Bash command it may never issue (in two harness runs a Bash-described tool was never called; loaded as a plugin, a Bash-less agent called axiomcode_path and answered for $0.23). Load it with the host CLI's --plugin-dir plugins/axiomcode; note that its --strict-mcp-config flag hides plugin MCP servers. The current surface is index · graph · path · impact; search/pack/brief/the gate hook were removed after the dogfood transcripts showed they added context instead of replacing it.

Activity

  1. added
    taskA piece of work to carry out — a merge, a release step, a migration
    skillAgent-facing query skill (skills/axiomcode)
    pluginthe axiomcode plugin: skill + MCP layer
    on Sep 15, 2026
  2. changed the title [-]skill/typescript: index adapter and resolver rules for typescript — what the parser names differently and what the frontend must absorb[/-] [+]plugin/typescript: index adapter and resolver rules for typescript — what the parser names differently and what the frontend must absorb[/+] on Sep 16, 2026
  3. added
    mcpthe MCP layer of the plugin
    and removed
    skillAgent-facing query skill (skills/axiomcode)
    on Sep 16, 2026
  4. swapnilpaliwal-sd commented on Sep 17, 2026

    @swapnilpaliwal-sd
    ContributorAuthor

    A measurement of what item 1 ("2,154 methods are named <arrow>") costs a by-name lookup, from #827.

    On a TypeScript subject of 9,669 methods / 38,889 call sites, only 372 methods have a real name. The rest are placeholders: <arrow> 8,306, <function-type> 482, <module> 311, <call-signature> 139, <constructor> 47, <function-expression> 10.

    The consequence is not just that find foo misses — a name that looks unique among recorded names frequently has a second, hidden declaration behind <arrow>, so a lookup keyed on methods.name silently answers with the wrong declaration. Classifying every site written with a unique name against what call_edges resolved:

    uniqueness keyed on addressable names sites covered wrong
    methods.name 209 1,128 41.5%
    symbols.name 793 4,243 0.7%

    Every disagreement I hand-checked was the engine being right: e.g. a call resolving to the local const createRequest = (…) => {…} in its own file, while the methods.name map pointed at a same-named createRequest(…) method in a different adapter, because the local one is recorded as <arrow>.

    The useful part: symbols already recovers the binding name. The declaration that methods.name calls <arrow> appears in symbols under its real name with kind='function' and a method_id back to the methods row. So a resolver that keys on symbols.name rather than methods.name gets 3.8x the coverage and drops the error rate by ~60x today, without waiting for the parser-side fix. That looks like the cheapest form of "resolve through the variable to the method" this issue asks for.

    (#638 is the JavaScript twin: same placeholders — 8,069 <arrow> + 2,204 <function-expression> of 20,790 methods — but re-keying on symbols does not rescue JavaScript there; it stays at ~6% wrong. See #829.)

  5. changed the title [-]plugin/typescript: index adapter and resolver rules for typescript — what the parser names differently and what the frontend must absorb[/-] [+]plugin/typescript: index adapter and resolver rules for typescript, what the parser names differently and what the frontend must absorb[/+] on Sep 18, 2026
  6. swapnilpaliwal-sd commented on Sep 29, 2026

    @swapnilpaliwal-sd
    ContributorAuthor

    Fixed by #1787 (merged into 0.1.9).

  7. swapnilpaliwal-sd commented on Sep 29, 2026

    @swapnilpaliwal-sd
    ContributorAuthor

    Fixed by #1787 (merged into 0.1.9).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

mcpthe MCP layer of the pluginpluginthe axiomcode plugin: skill + MCP layertaskA piece of work to carry out — a merge, a release step, a migrationtypescriptTypeScript

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions