@fabersep/atlas 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -0
- package/LICENSE +202 -0
- package/README.md +175 -2
- package/dist/packs/csharp/calls.d.ts +4 -0
- package/dist/packs/csharp/calls.js +167 -0
- package/dist/packs/csharp/declarations.d.ts +4 -0
- package/dist/packs/csharp/declarations.js +142 -0
- package/dist/packs/csharp/pack.d.ts +2 -0
- package/dist/packs/csharp/pack.js +39 -0
- package/dist/packs/csharp/resolve.d.ts +2 -0
- package/dist/packs/csharp/resolve.js +35 -0
- package/dist/packs/csharp/signals.d.ts +7 -0
- package/dist/packs/csharp/signals.js +143 -0
- package/dist/packs/dart/calls.d.ts +4 -0
- package/dist/packs/dart/calls.js +130 -0
- package/dist/packs/dart/declarations.d.ts +11 -0
- package/dist/packs/dart/declarations.js +79 -0
- package/dist/packs/dart/members.d.ts +4 -0
- package/dist/packs/dart/members.js +62 -0
- package/dist/packs/dart/pack.d.ts +2 -0
- package/dist/packs/dart/pack.js +37 -0
- package/dist/packs/dart/resolve.d.ts +2 -0
- package/dist/packs/dart/resolve.js +32 -0
- package/dist/packs/index.d.ts +3 -0
- package/dist/packs/index.js +8 -0
- package/dist/packs/json/pack.d.ts +2 -0
- package/dist/packs/json/pack.js +27 -0
- package/dist/packs/msbuild/pack.d.ts +2 -0
- package/dist/packs/msbuild/pack.js +75 -0
- package/dist/packs/msbuild/xml.d.ts +16 -0
- package/dist/packs/msbuild/xml.js +123 -0
- package/dist/packs/typescript/calls.d.ts +4 -0
- package/dist/packs/typescript/calls.js +208 -0
- package/dist/packs/typescript/declarations.d.ts +9 -0
- package/dist/packs/typescript/declarations.js +74 -0
- package/dist/packs/typescript/members.d.ts +4 -0
- package/dist/packs/typescript/members.js +92 -0
- package/dist/packs/typescript/pack.d.ts +2 -0
- package/dist/packs/typescript/pack.js +53 -0
- package/dist/packs/typescript/resolve.d.ts +2 -0
- package/dist/packs/typescript/resolve.js +68 -0
- package/dist/packs/typescript/signals.d.ts +7 -0
- package/dist/packs/typescript/signals.js +310 -0
- package/dist/packs/yaml/pack.d.ts +2 -0
- package/dist/packs/yaml/pack.js +35 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +477 -0
- package/dist/src/context/pre-grep.d.ts +15 -0
- package/dist/src/context/pre-grep.js +79 -0
- package/dist/src/context/pre-invoke.d.ts +20 -0
- package/dist/src/context/pre-invoke.js +127 -0
- package/dist/src/context/pre-prompt.d.ts +16 -0
- package/dist/src/context/pre-prompt.js +66 -0
- package/dist/src/context/session.d.ts +17 -0
- package/dist/src/context/session.js +57 -0
- package/dist/src/graph/build.d.ts +17 -0
- package/dist/src/graph/build.js +41 -0
- package/dist/src/graph/metrics.d.ts +12 -0
- package/dist/src/graph/metrics.js +75 -0
- package/dist/src/graph/topology.d.ts +5 -0
- package/dist/src/graph/topology.js +54 -0
- package/dist/src/health/compare.d.ts +2 -0
- package/dist/src/health/compare.js +38 -0
- package/dist/src/health/duplicates.d.ts +11 -0
- package/dist/src/health/duplicates.js +66 -0
- package/dist/src/health/health.d.ts +12 -0
- package/dist/src/health/health.js +94 -0
- package/dist/src/health/types.d.ts +101 -0
- package/dist/src/health/types.js +5 -0
- package/dist/src/index.d.ts +25 -0
- package/dist/src/index.js +22 -0
- package/dist/src/init/init.d.ts +104 -0
- package/dist/src/init/init.js +499 -0
- package/dist/src/init/scout.d.ts +45 -0
- package/dist/src/init/scout.js +217 -0
- package/dist/src/jsonc.d.ts +5 -0
- package/dist/src/jsonc.js +34 -0
- package/dist/src/mcp/server.d.ts +398 -0
- package/dist/src/mcp/server.js +543 -0
- package/dist/src/metrics/doctor.d.ts +15 -0
- package/dist/src/metrics/doctor.js +125 -0
- package/dist/src/metrics/log.d.ts +43 -0
- package/dist/src/metrics/log.js +101 -0
- package/dist/src/metrics/stats.d.ts +43 -0
- package/dist/src/metrics/stats.js +172 -0
- package/dist/src/model.d.ts +178 -0
- package/dist/src/model.js +2 -0
- package/dist/src/outputs.d.ts +16 -0
- package/dist/src/outputs.js +48 -0
- package/dist/src/packs/calls.d.ts +9 -0
- package/dist/src/packs/calls.js +119 -0
- package/dist/src/packs/dataShape.d.ts +6 -0
- package/dist/src/packs/dataShape.js +54 -0
- package/dist/src/packs/pack.d.ts +51 -0
- package/dist/src/packs/pack.js +3 -0
- package/dist/src/packs/packFiles.d.ts +5 -0
- package/dist/src/packs/packFiles.js +12 -0
- package/dist/src/packs/symbols.d.ts +39 -0
- package/dist/src/packs/symbols.js +98 -0
- package/dist/src/packs/treeSitter.d.ts +8 -0
- package/dist/src/packs/treeSitter.js +107 -0
- package/dist/src/queries/flow.d.ts +42 -0
- package/dist/src/queries/flow.js +398 -0
- package/dist/src/queries/investigate.d.ts +43 -0
- package/dist/src/queries/investigate.js +216 -0
- package/dist/src/queries/map.d.ts +28 -0
- package/dist/src/queries/map.js +102 -0
- package/dist/src/queries/neighborhood.d.ts +35 -0
- package/dist/src/queries/neighborhood.js +60 -0
- package/dist/src/queries/search.d.ts +37 -0
- package/dist/src/queries/search.js +279 -0
- package/dist/src/scan/audit.d.ts +2 -0
- package/dist/src/scan/audit.js +41 -0
- package/dist/src/scan/records.d.ts +12 -0
- package/dist/src/scan/records.js +42 -0
- package/dist/src/scan/resolveImports.d.ts +3 -0
- package/dist/src/scan/resolveImports.js +47 -0
- package/dist/src/scan/roles.d.ts +5 -0
- package/dist/src/scan/roles.js +87 -0
- package/dist/src/scan/scan.d.ts +24 -0
- package/dist/src/scan/scan.js +72 -0
- package/dist/src/text/briefs.d.ts +13 -0
- package/dist/src/text/briefs.js +43 -0
- package/dist/src/text/collapse.d.ts +10 -0
- package/dist/src/text/collapse.js +58 -0
- package/dist/src/text/declarations.d.ts +12 -0
- package/dist/src/text/declarations.js +120 -0
- package/dist/src/text/structure.d.ts +2 -0
- package/dist/src/text/structure.js +15 -0
- package/dist/src/text/tree.d.ts +20 -0
- package/dist/src/text/tree.js +49 -0
- package/dist/src/tokens.d.ts +4 -0
- package/dist/src/tokens.js +9 -0
- package/dist/src/version.d.ts +10 -0
- package/dist/src/version.js +11 -0
- package/dist/src/walk/ignoreRules.d.ts +17 -0
- package/dist/src/walk/ignoreRules.js +72 -0
- package/dist/src/walk/walk.d.ts +11 -0
- package/dist/src/walk/walk.js +29 -0
- package/grammars/LICENSE-tree-sitter-dart +20 -0
- package/grammars/README.md +11 -0
- package/grammars/tree-sitter-dart.wasm +0 -0
- package/package.json +68 -4
- package/packs/csharp/README.md +9 -0
- package/packs/csharp/imports.scm +3 -0
- package/packs/csharp/symbols.scm +17 -0
- package/packs/dart/imports.scm +5 -0
- package/packs/dart/symbols.scm +13 -0
- package/packs/msbuild/README.md +11 -0
- package/packs/typescript/exports.scm +16 -0
- package/packs/typescript/imports.scm +9 -0
- package/packs/typescript/symbols.scm +19 -0
- package/schema/ast_code_map.schema.json +144 -0
- package/schema/schema-lock.json +7 -0
- package/schema/topology.schema.json +87 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@fabersep/atlas`. Versions follow [Semantic Versioning](https://semver.org/).
|
|
4
|
+
|
|
5
|
+
## 0.1.1 (unreleased)
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- Structural `search` query (`faber-atlas search <query>` and MCP tool `search`) that locates symbols, files, HTTP routes, events, and jobs with signatures and call/event/job links in a single step.
|
|
9
|
+
- MCP `initialize` `instructions` and `anthropic/alwaysLoad` on `search`, `map`, `flow`, and `impact` so Claude Code keeps core Atlas tools loaded without a `ToolSearch` turn.
|
|
10
|
+
- Non-blocking Claude Code `PreToolUse` hook (`faber-atlas pre-grep`) installed by `init` (`--no-hooks` skips it, `--undo` removes it): whenever the model calls `Grep` on code, Atlas attaches matching structural symbols and call/event/job links as `additionalContext` without denying `Grep`. In a 6-question multi-turn Immich benchmark (Sonnet low), `search` + `enrich` raised Atlas adoption to 5–6/6 while cutting total tool calls by 45% (Reads 9→1), input tokens by 15%, output tokens by 30%, and latency by 21%.
|
|
11
|
+
- Non-blocking Antigravity `PreInvocation` hook (`faber-atlas pre-invoke`) installed by `init` into `~/.gemini/config/hooks.json` (`--no-hooks` skips it, `--undo` removes only Atlas's hook): injects Atlas structural matches once per new user prompt via `injectSteps`. Measured on a 288-file Flutter/Dart app (`-46%` total tokens on `gemini-3.8-flash-low`, `-34%` total tokens and `3/4 → 4/4` accuracy on `gemini-4-hydrogen-low`) and a 157-file TypeScript API (`-21%` total tokens on `gemini-4-hydrogen-low`).
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
- `README.md` benchmark section now reports full multi-turn totals (Claude Code and Antigravity) instead of primary-model-only Scout numbers, and documents `search` and the automatic enrich hooks.
|
|
15
|
+
|
|
16
|
+
- Claude Code Scout benchmark (`bench/run-claude-scout.py`, `bench/results/outline-227f85c-claude-scout/`): 48 fresh sessions on Outline and a private Flutter + TypeScript app. Sonnet low with a Haiku low Scout cost 37% less than Sonnet alone (45% less on questions) but took about twice as long; the README and the Scout guide say so.
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
- The Claude Code Scout (`~/.claude/agents/atlas-scout.md`) now has the `search` tool and starts with it; before, it could not use Atlas's one-step search.
|
|
20
|
+
- The Antigravity app starts MCP servers in `/`, where Atlas refused to work. Every MCP tool now takes an optional `root` (the project's absolute path), the refusal tells the agent to call again with it, the Antigravity Scout block says to always pass it, and the server asks the client for its workspace roots again when the first answer had none. Start folder and roots are logged to stderr.
|
|
21
|
+
- Claude Code almost never used Atlas on its own (0 of 4 measured questions): it shows MCP tools by name only. `init` now adds a short Atlas block to `~/.claude/CLAUDE.md` (when to use it, how to load its tools; 2 of 4 and 2 of 6 with it) and allows Atlas's read-only tools in `~/.claude/settings.json`, so they run without a prompt. `--no-rules` and `--no-allow` skip either. For Antigravity, `init` says to choose "Always allow" at the first prompt.
|
|
22
|
+
- After this update, run `npx @fabersep/atlas@latest init` once more so the new instructions and the permission rule are added.
|
|
23
|
+
|
|
24
|
+
## 0.1.0 (2026-11-28)
|
|
25
|
+
|
|
26
|
+
First release of FaberSEP Atlas, the successor of the private `code-intelligence` 0.8.0.
|
|
27
|
+
|
|
28
|
+
### Included
|
|
29
|
+
- Incremental Tree-sitter scanner with six language packs (TypeScript/JavaScript, Dart, C#, MSBuild, JSON, YAML), versioned JSON schemas and the `scan`, `map --zoom 0|1|2`, `brief`, `neighborhood`, `flow`, `impact`, `hubs`, `health` and `health-compare` commands.
|
|
30
|
+
- A stdio MCP server (`faber-atlas mcp`, 7 tools) that refreshes the index before each call.
|
|
31
|
+
- `faber-atlas init` for Claude Code, Antigravity, Cursor and Claude Desktop, with a default read-only Scout (Claude Code: `haiku`, `low` effort; Antigravity: `flash`), `--preview` and `--undo`; `faber-atlas scout` to change the Scout's model.
|
|
32
|
+
- `faber-atlas doctor`, and local-only `faber-atlas stats` / `stats --share` (no telemetry).
|
|
33
|
+
|
|
34
|
+
### Fixed before release (review of 2026-11-28)
|
|
35
|
+
- `init` wrote the MCP server into Claude Code's and Cursor's global settings with `--root` set to the project it ran in, so running it in a second project silently pointed every project at the second one. Entries no longer carry a project path (see "one-time setup" below).
|
|
36
|
+
- A settings file with comments or broken JSON was replaced by a file holding only Atlas's entry. It is now left untouched, and `init` prints the entry to add by hand.
|
|
37
|
+
- The `.bak` backup of `~/.claude.json` was readable by other users of the machine; it now keeps the original file's permissions.
|
|
38
|
+
- The `.faber-atlas/` index showed up in `git status`; it now ignores itself.
|
|
39
|
+
- `doctor` reported a failure right after a correct setup, because the index is only built on the first MCP call. A missing index is now a warning with a hint; an unreadable one is still a failure.
|
|
40
|
+
- The local metrics log stored any tool name an MCP client sent; unknown names are now logged as `unknown`.
|
|
41
|
+
|
|
42
|
+
### Changed (one-time setup)
|
|
43
|
+
- `init` runs once per computer instead of once per project. Each tool gets one global entry with no project pinned; the MCP server maps the project the tool has open (the workspace it reports through MCP `roots/list`, else the git root above the folder it started in) and refuses to map the whole home folder. The Scout moved to the user's folders (`~/.claude/agents/atlas-scout.md`, a block in `~/.gemini/GEMINI.md`), so `init` writes nothing into projects unless `--agents-md` is given. Per-project entries from the previous build are removed. Backups are named `<file>.faber-atlas.bak`.
|
|
44
|
+
|
|
45
|
+
### Added
|
|
46
|
+
- `faber-atlas --version`, this changelog, and a macOS job in CI.
|
|
47
|
+
|
|
48
|
+
### Changed
|
|
49
|
+
- The README is a plain-language, story-first introduction; commands and setup details are in `docs/cli-reference.md`.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,176 @@
|
|
|
1
|
-
#
|
|
1
|
+
# FaberSEP Atlas
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@fabersep/atlas)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](https://github.com/fabersep/atlas/actions/workflows/ci.yml)
|
|
6
|
+
|
|
7
|
+
**Your AI coding assistant spends much of its time, and your money, looking for code. FaberSEP Atlas gives it a map of your project, so it finds the right place in one step instead of twenty.**
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## The problem you already know
|
|
12
|
+
|
|
13
|
+
You ask your assistant: *"When a user changes their password, where do their other sessions get logged out?"*
|
|
14
|
+
|
|
15
|
+
It starts searching. It greps for `password`, opens five files, reads them top to bottom, greps again. Ten turns later it has an answer, and it is often incomplete: it missed the part where one service sends an event and another one, in a different folder, reacts to it. Meanwhile every file it read stays in the chat, making each next answer slower and more expensive.
|
|
16
|
+
|
|
17
|
+
On a bigger change it gets worse: it can invent a helper that doesn't exist, or forget the tests that call the code it just changed.
|
|
18
|
+
|
|
19
|
+
## What changes with FaberSEP Atlas
|
|
20
|
+
|
|
21
|
+
Atlas reads your project on your computer and keeps a map of it: every file, every class and function with its signature, who calls whom, and which events and background jobs connect them. When files change, it updates the map in milliseconds.
|
|
22
|
+
|
|
23
|
+
Your assistant asks the map instead of searching blindly:
|
|
24
|
+
|
|
25
|
+
1. **"Find where API keys or uploads are handled."** `search` locates matching symbols, files, HTTP routes, events, and jobs in one step — with exact line numbers, signatures, and what each method calls, emits, or queues.
|
|
26
|
+
2. **"What happens when `changePassword` runs?"** `flow` traces the whole chain in one answer, across calls, events, and background jobs:
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
AuthController.changePassword (src/controllers/auth.controller.ts:121) [POST /change-password]
|
|
30
|
+
──calls──▶ AuthService.changePassword (src/services/auth.service.ts:169)
|
|
31
|
+
──calls──▶ UserRepository.update (src/repositories/user.repository.ts:195)
|
|
32
|
+
──emits──▶ event:AuthChangePassword
|
|
33
|
+
──handles──▶ SessionService.onAuthChangePassword (src/services/session.service.ts:91)
|
|
34
|
+
──calls──▶ SessionRepository.invalidateAll (src/repositories/session.repository.ts:104)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
3. **"What breaks if I change this?"** `impact` lists every caller, every web route and job that reaches that code, and the tests to update.
|
|
38
|
+
4. **Automatic enrichment, zero friction.** `init` installs lightweight, non-blocking hooks: in **Claude Code**, whenever the assistant runs `Grep` on code, Atlas attaches matching structural symbols and call/event/job links alongside the result; in **Antigravity**, a `PreInvocation` hook injects a compact routing reminder when Scout is installed (or structural Atlas matches when Scout is disabled) before the first tool call. Nothing is blocked, and the assistant can skip reading whole files.
|
|
39
|
+
|
|
40
|
+
Atlas also sets up an optional **Scout** helper (`haiku` in Claude Code, `flash` in Antigravity): your main model hands it the looking-up and gets back only the files and lines that matter. In our Claude Code measurement it cut the cost of code questions by 45%, but the answer took about twice as long (below).
|
|
41
|
+
|
|
42
|
+
## Why you can trust it
|
|
43
|
+
|
|
44
|
+
- **Nothing leaves your computer.** No account, no server, no telemetry. Atlas never calls an AI model: the map comes from reading the code's structure, so the same code always gives the same map.
|
|
45
|
+
- **It only tells what it can see.** Every answer points at a real file and line. A file it cannot read is listed as such, not guessed.
|
|
46
|
+
- **Your projects stay clean.** The map lives in a `.faber-atlas/` folder that git ignores on its own.
|
|
47
|
+
- **Easy to undo.** Setup keeps a backup of every file it edits, never rewrites a settings file it cannot read safely, and `npx @fabersep/atlas init --undo` removes only what it added.
|
|
48
|
+
- **Works with the tools you already use:** Claude Code, Antigravity, Cursor and Claude Desktop.
|
|
49
|
+
- **Free and open source** (Apache-2.0).
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Get started (about 2 minutes)
|
|
54
|
+
|
|
55
|
+
You need **Node.js 20 or newer**. To check, run `node -v` in a terminal.
|
|
56
|
+
|
|
57
|
+
**1. Set it up**
|
|
58
|
+
|
|
59
|
+
Open a terminal and run:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npx @fabersep/atlas init
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
You do this **once per computer**, in any folder. It finds the AI tools on your computer, connects Atlas to each of them, adds the Scout helper, and prints what it changed. From then on Atlas works in every project you open: it sees which project your tool has open and maps that one. Want to see first? Add `--preview`: nothing is written.
|
|
66
|
+
|
|
67
|
+
**2. Check it**
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npx @fabersep/atlas doctor
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Run it inside a project. Right after setup it says the map is not built yet. That is expected: it is built the first time your assistant uses it in that project (or run `npx @fabersep/atlas scan .` now).
|
|
74
|
+
|
|
75
|
+
**3. Start a new chat in your AI tool and ask normally**
|
|
76
|
+
|
|
77
|
+
> *"Where do we send the order confirmation email, and what triggers it?"*
|
|
78
|
+
|
|
79
|
+
You don't need special commands: setup connects the MCP tools (`search`, `map`, `flow`, `impact`, `brief`, `neighborhood`, `hubs`, `health`), allows Atlas's read-only tools without asking in Claude Code (in Antigravity, choose "Always allow" the first time it asks), and adds non-blocking enrich hooks so Atlas matches show up automatically when your assistant searches code.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Measured on real projects
|
|
84
|
+
|
|
85
|
+
All numbers below count **total** tokens, time, and accuracy of the full multi-turn conversation (no hidden helper costs):
|
|
86
|
+
|
|
87
|
+
**Claude Code (`Sonnet`, low effort)** — [Immich](https://github.com/immich-app/immich) `server/` (778 TypeScript files), 6 consecutive code-navigation questions in one session (`--resume`):
|
|
88
|
+
|
|
89
|
+
| | Baseline (Grep + Read) | With Atlas (`search` + `PreToolUse` enrich) | Change |
|
|
90
|
+
| :--- | ---: | ---: | ---: |
|
|
91
|
+
| Tool calls (file reads) | 20 (9 reads) | **11 (1 read)** | **-45%** |
|
|
92
|
+
| Total input tokens | 697k | **594k** | **-15%** |
|
|
93
|
+
| Output tokens | 6,463 | **4,492** | **-30%** |
|
|
94
|
+
| Cache-neutral cost | $0.31 | **$0.25** | **-19%** |
|
|
95
|
+
| Time | 47 s | **37 s** | **-21%** |
|
|
96
|
+
| Correct | 6 of 6 | **6 of 6** | |
|
|
97
|
+
|
|
98
|
+
**Antigravity (`PreInvocation` enrich hook)** — 4 consecutive trace, impact, and edit-plan tasks in one conversation across two real production apps:
|
|
99
|
+
|
|
100
|
+
| Project | Model | Baseline total tokens | With Atlas enrich | Change | Correct |
|
|
101
|
+
| :--- | :--- | ---: | ---: | ---: | :---: |
|
|
102
|
+
| Flutter/Dart app (288 files) | `gemini-3.8-flash-low` | 3.86M | **2.10M** | **-46%** | 4/4 → 4/4 |
|
|
103
|
+
| Flutter/Dart app (288 files) | `gemini-4-hydrogen-low` | 743k | **488k** | **-34%** (-13% time) | **3/4 → 4/4** |
|
|
104
|
+
| TypeScript API (157 files) | `gemini-4-hydrogen-low` | 1.09M | **859k** | **-21%** | 4/4 → 4/4 |
|
|
105
|
+
|
|
106
|
+
**Claude Code Scout (`Sonnet` low + `Haiku` low Scout)**: [Outline](https://github.com/outline/outline) (2,662 files) and a private Flutter + TypeScript app (992 files). 3 trace or impact questions and 1 edit per repo, each run twice, every run a fresh session:
|
|
107
|
+
|
|
108
|
+
| | Sonnet alone (Grep + Read) | + Atlas | + Atlas + Haiku Scout | Scout vs alone |
|
|
109
|
+
| :--- | ---: | ---: | ---: | ---: |
|
|
110
|
+
| Total cost, Scout included | $2.14 | $2.28 | **$1.34** | **-37%** (questions -45%) |
|
|
111
|
+
| Wall time | **467 s** | 422 s | 926 s | +98% |
|
|
112
|
+
| Correct | 16/16 | 14/16 | 15/16 | |
|
|
113
|
+
|
|
114
|
+
The Scout makes code questions cheaper, not faster: Haiku searches step by step while Sonnet waits. Use it when cost matters more than waiting; on small edits it saves nothing. Setup and every Outline run: [benchmark summary](bench/results/outline-227f85c-claude-scout/SUMMARY.md).
|
|
115
|
+
|
|
116
|
+
**Suite 1.1 — Antigravity (`gemini-4-hydrogen-low`)** — [Immich](https://github.com/immich-app/immich) `v3.4.2` (`mobile/` Flutter/Dart), 10 fresh-session tasks across 5 categories (directional, 1 run per task; Setups B and D pending):
|
|
117
|
+
|
|
118
|
+
| Setup | Subagent model | Paths | Symbols | Facts | Edits (`flutter analyze`) | Routing | Main tok | Sub tok | Total tok | Wall time |
|
|
119
|
+
| :--- | :--- | ---: | ---: | ---: | :---: | :---: | ---: | ---: | ---: | ---: |
|
|
120
|
+
| **A** (Main model alone) | — | 18/20 | 37/40 | 29/33 | 2/2 passed | — | 272.3k | — | **272.3k** | **234 s** |
|
|
121
|
+
| **C** (`+ Atlas + flash_lite` Scout) | `gemini-3.5-flash-lite` | 18/20 | 36/40 | 29/33 | 2/2 passed | 10/10 | **235.3k** | 127.3k | 362.6k | 254 s |
|
|
122
|
+
|
|
123
|
+
Note: when the main model is already lightweight (`gemini-4-hydrogen-low`), delegating to a subagent lowers main-model context (`-14%`) while adding subagent tokens (`127.3k` on `gemini-3.5-flash-lite`). On current Antigravity builds, `Model: "flash"` resolves to `gemini-4-hydrogen-tiered-high` (higher accuracy `20/20` paths, `38/40` symbols, `30/33` facts, but `248.4k` subagent tokens and `392 s`). Suite harness: [bench/suite/README.md](bench/suite/README.md).
|
|
124
|
+
|
|
125
|
+
Savings are largest on multi-turn sessions and larger multi-layer codebases; on small repos or one-off single questions, gains are smaller because plain `Grep` is already fast. Use `npx @fabersep/atlas stats` to inspect compression and latency on your own project.
|
|
126
|
+
|
|
127
|
+
On a private app with a Flutter client, a TypeScript API and a React admin (848 files), the map is 83% smaller than the code it describes; the first scan takes 1.3 s and an update after a change 55 ms (Apple M4 Pro).
|
|
128
|
+
|
|
129
|
+
## Languages
|
|
130
|
+
|
|
131
|
+
TypeScript and JavaScript (including React), Dart and Flutter, C# and .NET, plus .NET project files (`.csproj`, `.sln`), JSON and YAML. Python is next. A new language is one folder: see [Contributing](CONTRIBUTING.md).
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Common questions
|
|
136
|
+
|
|
137
|
+
**Will it ask for permission every time?**
|
|
138
|
+
In Claude Code, no: setup allows Atlas's tools, which only read your code. In Antigravity, choose "Always allow" the first time it asks.
|
|
139
|
+
|
|
140
|
+
**Does it slow my assistant down or cost more?**
|
|
141
|
+
It is meant to do the opposite: one short answer from the map replaces many file reads. Its tool descriptions add about 1,200 tokens to a chat.
|
|
142
|
+
|
|
143
|
+
**What does it put in my project?**
|
|
144
|
+
Only a `.faber-atlas/` folder with the map, which git ignores. The setup itself lives in your user folder (your AI tools' settings and the Scout), not in your projects.
|
|
145
|
+
|
|
146
|
+
**I use it in several projects. Do I set it up in each one?**
|
|
147
|
+
No. One `init` covers all of them: each time you open a project in your AI tool, Atlas maps that project and keeps its map in that project's `.faber-atlas/` folder. If you open the tool in your home folder, outside any project, Atlas says so instead of mapping your whole disk. (Claude Desktop has no project folder; there you pick one with `init --engine claude-desktop --root <folder>`.)
|
|
148
|
+
|
|
149
|
+
**Can I pick a different Scout model?**
|
|
150
|
+
Yes: `npx @fabersep/atlas scout` shows the choices. See the [Scout guide](docs/scout-guide.md).
|
|
151
|
+
|
|
152
|
+
**How do I see what it saves me?**
|
|
153
|
+
`npx @fabersep/atlas stats`. Add `--share` for a card with numbers only (no names, paths or code) that you can post.
|
|
154
|
+
|
|
155
|
+
**How do I remove it?**
|
|
156
|
+
Run `npx @fabersep/atlas init --undo`, then delete the `.faber-atlas/` folders in your projects.
|
|
157
|
+
|
|
158
|
+
**Something went wrong.**
|
|
159
|
+
Run `npx @fabersep/atlas doctor` first, then [open an issue](https://github.com/fabersep/atlas/issues).
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Going further
|
|
164
|
+
|
|
165
|
+
- **[CLI, MCP and library reference](docs/cli-reference.md):** every command and flag, where `init` writes for each tool, manual setup, the MCP tools.
|
|
166
|
+
- **[Scout guide](docs/scout-guide.md):** how the Scout works, choosing its model, the full benchmark.
|
|
167
|
+
- **[How this project is specified](docs/features/README.md):** [Master PRD](docs/master-prd.md), [architecture](docs/architecture.md) and feature specs.
|
|
168
|
+
- **[Roadmap](ROADMAP.md)**, **[Contributing](CONTRIBUTING.md)** and **[Changelog](CHANGELOG.md)**.
|
|
169
|
+
|
|
170
|
+
Works well with **[FaberSEP Spec](https://github.com/fabersep/spec)** (your assistant writes down what you mean before it builds) and **[FaberSEP Memory](https://github.com/fabersep/memory)** (it remembers the rules you approve, across tools). Each one also works on its own.
|
|
171
|
+
|
|
172
|
+
FaberSEP Atlas is part of [FaberSEP](https://github.com/fabersep), open-source tools that help AI coding assistants work with more discipline.
|
|
173
|
+
|
|
174
|
+
## License
|
|
175
|
+
|
|
176
|
+
[Apache-2.0](LICENSE)
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { cleanTypeName, dedupeCalls, detectBoundary, isNoiseCall } from '../../src/packs/calls.js';
|
|
2
|
+
import { CONTAINER_KINDS, FUNCTION_KINDS } from '../../src/packs/symbols.js';
|
|
3
|
+
/** Static call and MediatR/async wiring extraction for C#. */
|
|
4
|
+
const MEDIATR_METHODS = new Set(['Send', 'Publish']);
|
|
5
|
+
const QUEUE_METHODS = new Set(['Enqueue', 'Schedule', 'QueueBackgroundWorkItem', 'SendMessageAsync']);
|
|
6
|
+
function extractPrimaryConstructorTypes(root, containers) {
|
|
7
|
+
const result = new Map();
|
|
8
|
+
for (const c of containers)
|
|
9
|
+
result.set(`${c.start}:${c.end}`, new Map());
|
|
10
|
+
const walk = (node) => {
|
|
11
|
+
if (node.type === 'class_declaration' || node.type === 'struct_declaration' || node.type === 'record_declaration') {
|
|
12
|
+
const map = result.get(`${node.startIndex}:${node.endIndex}`);
|
|
13
|
+
const params = node.childForFieldName('parameters');
|
|
14
|
+
if (map && params) {
|
|
15
|
+
for (const p of params.namedChildren) {
|
|
16
|
+
if (p?.type !== 'parameter')
|
|
17
|
+
continue;
|
|
18
|
+
const name = p.childForFieldName('name')?.text;
|
|
19
|
+
const type = cleanTypeName(p.childForFieldName('type')?.text);
|
|
20
|
+
if (name && type)
|
|
21
|
+
map.set(name, type);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
for (const ch of node.children)
|
|
26
|
+
if (ch)
|
|
27
|
+
walk(ch);
|
|
28
|
+
};
|
|
29
|
+
walk(root);
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
function buildOwnerFieldTypes(items, root) {
|
|
33
|
+
const containers = items.filter((d) => CONTAINER_KINDS.has(d.kind));
|
|
34
|
+
const result = extractPrimaryConstructorTypes(root, containers);
|
|
35
|
+
for (const c of containers) {
|
|
36
|
+
const types = result.get(`${c.start}:${c.end}`) ?? new Map();
|
|
37
|
+
for (const m of items) {
|
|
38
|
+
if (m.start > c.start && m.end <= c.end && (m.kind === 'field' || m.kind === 'getter')) {
|
|
39
|
+
const t = cleanTypeName(m.type);
|
|
40
|
+
if (t)
|
|
41
|
+
types.set(m.name, t);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
result.set(`${c.start}:${c.end}`, types);
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
function enclosingContainer(item, containers) {
|
|
49
|
+
let best;
|
|
50
|
+
for (const c of containers) {
|
|
51
|
+
if (item.start > c.start && item.end <= c.end) {
|
|
52
|
+
if (!best || c.start > best.start)
|
|
53
|
+
best = c;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return best;
|
|
57
|
+
}
|
|
58
|
+
function firstNewObjectType(argsNode) {
|
|
59
|
+
const firstArg = argsNode?.namedChildren.find((c) => c?.type === 'argument');
|
|
60
|
+
const expr = firstArg?.namedChildren[firstArg.namedChildren.length - 1];
|
|
61
|
+
if (expr?.type === 'object_creation_expression') {
|
|
62
|
+
return cleanTypeName(expr.childForFieldName('type')?.text);
|
|
63
|
+
}
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
function extractCallsInRange(root, start, end, ownerName, fieldTypes) {
|
|
67
|
+
const sites = [];
|
|
68
|
+
const walk = (node) => {
|
|
69
|
+
if (node.endIndex <= start || node.startIndex >= end)
|
|
70
|
+
return;
|
|
71
|
+
if (node.type === 'invocation_expression' && node.startIndex >= start && node.endIndex <= end) {
|
|
72
|
+
const fn = node.childForFieldName('function');
|
|
73
|
+
const args = node.childForFieldName('arguments');
|
|
74
|
+
const line = node.startPosition.row + 1;
|
|
75
|
+
if (fn?.type === 'member_access_expression') {
|
|
76
|
+
const rawMethod = fn.childForFieldName('name')?.text ?? '';
|
|
77
|
+
const method = rawMethod.replace(/<.*$/s, '');
|
|
78
|
+
const expr = fn.childForFieldName('expression');
|
|
79
|
+
if (method && expr) {
|
|
80
|
+
let receiver;
|
|
81
|
+
let receiverType;
|
|
82
|
+
let isThisMember = false;
|
|
83
|
+
const callee = `${expr.text}.${method}`;
|
|
84
|
+
if (expr.type === 'this_expression' || expr.text === 'this') {
|
|
85
|
+
receiver = 'this';
|
|
86
|
+
receiverType = ownerName;
|
|
87
|
+
isThisMember = true;
|
|
88
|
+
}
|
|
89
|
+
else if (expr.type === 'member_access_expression' && (expr.childForFieldName('expression')?.text === 'this')) {
|
|
90
|
+
receiver = expr.childForFieldName('name')?.text;
|
|
91
|
+
receiverType = receiver ? fieldTypes.get(receiver) : undefined;
|
|
92
|
+
isThisMember = true;
|
|
93
|
+
}
|
|
94
|
+
else if (expr.type === 'identifier') {
|
|
95
|
+
receiver = expr.text;
|
|
96
|
+
receiverType = fieldTypes.get(receiver);
|
|
97
|
+
isThisMember = receiver.startsWith('_') || receiverType !== undefined;
|
|
98
|
+
}
|
|
99
|
+
else if (expr.type === 'member_access_expression') {
|
|
100
|
+
receiver = expr.childForFieldName('name')?.text;
|
|
101
|
+
receiverType = receiver ? fieldTypes.get(receiver) : undefined;
|
|
102
|
+
}
|
|
103
|
+
if (receiver && !isNoiseCall(receiver, receiverType, method, isThisMember)) {
|
|
104
|
+
let kind = 'calls';
|
|
105
|
+
let targetKey;
|
|
106
|
+
if (MEDIATR_METHODS.has(method) && /mediator|sender|publisher/i.test(receiverType ?? receiver)) {
|
|
107
|
+
const cmd = firstNewObjectType(args);
|
|
108
|
+
if (cmd) {
|
|
109
|
+
kind = 'sends';
|
|
110
|
+
targetKey = cmd;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
else if (QUEUE_METHODS.has(method)) {
|
|
114
|
+
const firstStr = args?.namedChildren[0]?.text.replace(/^@?"|"$/g, '');
|
|
115
|
+
if (firstStr && firstStr.length < 80) {
|
|
116
|
+
kind = 'queues';
|
|
117
|
+
targetKey = firstStr;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
const boundary = detectBoundary(kind, receiver, receiverType, method);
|
|
121
|
+
sites.push({
|
|
122
|
+
callee,
|
|
123
|
+
receiver,
|
|
124
|
+
...(receiverType ? { receiverType } : {}),
|
|
125
|
+
method,
|
|
126
|
+
line,
|
|
127
|
+
kind,
|
|
128
|
+
...(targetKey ? { targetKey } : {}),
|
|
129
|
+
...(boundary ? { boundary } : {}),
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else if (fn?.type === 'identifier' || fn?.type === 'generic_name') {
|
|
135
|
+
const method = fn.text.replace(/<.*$/s, '');
|
|
136
|
+
if (!isNoiseCall(undefined, undefined, method, false)) {
|
|
137
|
+
const boundary = detectBoundary('calls', undefined, undefined, method);
|
|
138
|
+
sites.push({
|
|
139
|
+
callee: method,
|
|
140
|
+
method,
|
|
141
|
+
line,
|
|
142
|
+
kind: 'calls',
|
|
143
|
+
...(boundary ? { boundary } : {}),
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
for (const c of node.children)
|
|
149
|
+
if (c)
|
|
150
|
+
walk(c);
|
|
151
|
+
};
|
|
152
|
+
walk(root);
|
|
153
|
+
return dedupeCalls(sites);
|
|
154
|
+
}
|
|
155
|
+
/** Attaches static `calls` sites to callable C# declarations. */
|
|
156
|
+
export function withCSharpCalls(items, root) {
|
|
157
|
+
const containers = items.filter((d) => CONTAINER_KINDS.has(d.kind));
|
|
158
|
+
const fieldTypeMaps = buildOwnerFieldTypes(items, root);
|
|
159
|
+
return items.map((item) => {
|
|
160
|
+
if (!FUNCTION_KINDS.has(item.kind))
|
|
161
|
+
return item;
|
|
162
|
+
const owner = enclosingContainer(item, containers);
|
|
163
|
+
const fieldTypes = owner ? (fieldTypeMaps.get(`${owner.start}:${owner.end}`) ?? new Map()) : new Map();
|
|
164
|
+
const calls = extractCallsInRange(root, item.start, item.end, owner?.name, fieldTypes);
|
|
165
|
+
return calls.length ? { ...item, calls } : item;
|
|
166
|
+
});
|
|
167
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Node } from 'web-tree-sitter';
|
|
2
|
+
import { type Declared } from '../../src/packs/symbols.js';
|
|
3
|
+
/** The declarations one captured node gives (a field declaration gives one per variable). */
|
|
4
|
+
export declare function describe(node: Node, source: string): Declared[];
|