@wrongstack/tools 0.298.3 → 0.300.0

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.
Files changed (42) hide show
  1. package/dist/audit.js +6 -2
  2. package/dist/bash.js +20 -2
  3. package/dist/builtin.js +1901 -327
  4. package/dist/codebase-index/background-indexer.d.ts +6 -1
  5. package/dist/codebase-index/codebase-incoming-calls-tool.d.ts +34 -0
  6. package/dist/codebase-index/codebase-outgoing-calls-tool.d.ts +34 -0
  7. package/dist/codebase-index/import-extractor.d.ts +39 -0
  8. package/dist/codebase-index/index-service.d.ts +24 -2
  9. package/dist/codebase-index/index.d.ts +4 -2
  10. package/dist/codebase-index/index.js +1779 -256
  11. package/dist/codebase-index/languages.d.ts +24 -0
  12. package/dist/codebase-index/module-resolver.d.ts +78 -0
  13. package/dist/codebase-index/module-roots.d.ts +81 -0
  14. package/dist/codebase-index/parser-output.d.ts +29 -0
  15. package/dist/codebase-index/project-server.js +1556 -237
  16. package/dist/codebase-index/rs-parser.d.ts +22 -0
  17. package/dist/codebase-index/schema.d.ts +47 -1
  18. package/dist/codebase-index/worker-protocol.d.ts +14 -0
  19. package/dist/codebase-index/worker.js +1545 -238
  20. package/dist/codebase-index/writer-graph-helpers.d.ts +17 -5
  21. package/dist/codebase-index/writer-graph-reader.d.ts +24 -1
  22. package/dist/codebase-index/writer-ref-mapper.d.ts +3 -0
  23. package/dist/codebase-index/writer-schema.d.ts +15 -3
  24. package/dist/codebase-index/writer.d.ts +97 -4
  25. package/dist/exec.js +39 -2
  26. package/dist/format.js +6 -2
  27. package/dist/index.js +1901 -327
  28. package/dist/install.js +6 -2
  29. package/dist/json.js +51 -2
  30. package/dist/languages/index.js +6 -2
  31. package/dist/lint.js +6 -2
  32. package/dist/outdated.js +6 -2
  33. package/dist/pack.js +1899 -327
  34. package/dist/process-registry.d.ts +6 -0
  35. package/dist/process-registry.js +6 -2
  36. package/dist/ps-slash.js +10 -2
  37. package/dist/read.js +1551 -244
  38. package/dist/test.js +6 -2
  39. package/dist/tool-tier.js +1901 -327
  40. package/dist/typecheck.js +6 -2
  41. package/package.json +3 -3
  42. package/dist/codebase-index/refs-extractor.d.ts +0 -11
@@ -1,3 +1,25 @@
1
+ /**
2
+ * Rust source symbol extraction.
3
+ *
4
+ * Extracts fn, struct, enum, trait, impl, type, const, static and mod with
5
+ * line-anchored regexes. Dependency edges do not come from here — `use` and
6
+ * `mod` declarations are read by `import-extractor.ts` and resolved against the
7
+ * crate's `Cargo.toml` by `module-resolver.ts`.
8
+ *
9
+ * ### Why there is no native `syn` parser
10
+ *
11
+ * There used to be a path that shelled out to a cargo subproject for real AST
12
+ * parsing. It resolved that subproject relative to `process.cwd()` — the
13
+ * *indexed project*, not the wstack installation — and the crate has never
14
+ * existed in this repository. So the branch was unreachable except in the one
15
+ * case where it must never fire: an indexed repository that happens to contain
16
+ * `tools/Cargo.toml`, where indexing would have run `cargo run` inside the
17
+ * user's checkout and written to `tools/syn-parser/src/input.rs`.
18
+ *
19
+ * Indexing reads a repository; it does not execute its build or write to its
20
+ * working tree. Reinstating native parsing means shipping the crate inside the
21
+ * wstack installation and resolving it from there — never from the scan target.
22
+ */
1
23
  import type { FileSymbols, SymbolLang } from './schema.js';
2
24
  export declare function parseSymbols(opts: {
3
25
  file: string;
@@ -95,6 +95,52 @@ export interface Ref {
95
95
  toId?: number | undefined;
96
96
  callType: CallType;
97
97
  line: number;
98
+ /**
99
+ * Language of the *referencing* file. Name resolution (`toName` → `toId`) is
100
+ * scoped to the referencing language's family, because a global name match
101
+ * links unrelated declarations across languages: `New`/`Get`/`String` in Go,
102
+ * `main`/`__init__` in Python and TS all collide otherwise.
103
+ */
104
+ lang?: SymbolLang | undefined;
105
+ /**
106
+ * Module specifier for `import` refs, verbatim as written in the source
107
+ * (`./foo.js`, `github.com/org/repo/pkg`, `os.path`, `crate::parser`,
108
+ * `com.example.Thing`). `undefined` for every other ref kind.
109
+ *
110
+ * This is deliberately separate from {@link toName}: TS/JS import refs put
111
+ * the imported *symbol* name in `toName` so the dead-code BFS can traverse
112
+ * module boundaries, which means `toName` cannot also carry the module path.
113
+ */
114
+ module?: string | undefined;
115
+ /**
116
+ * Target file an `import` ref resolves to, filled by the post-index module
117
+ * resolution pass. Absolute path, or `undefined` for external/unresolvable
118
+ * modules (stdlib, third-party dependencies).
119
+ */
120
+ toFile?: string | undefined;
121
+ }
122
+ /**
123
+ * A call site — the enriched result of an incoming/outgoing calls query.
124
+ *
125
+ * Unlike the raw `Ref` type, this carries the full caller/callee symbol
126
+ * metadata (name, kind, file, line, signature) so the agent gets a
127
+ * self-contained answer without a second lookup.
128
+ */
129
+ export interface CallSite {
130
+ /** The symbol that makes or receives the call. */
131
+ symbol: {
132
+ id: number;
133
+ name: string;
134
+ kind: SymbolKind;
135
+ lang: SymbolLang;
136
+ file: string;
137
+ line: number;
138
+ signature: string;
139
+ };
140
+ /** Kind of reference: call, type_ref, inherit, implement, import. */
141
+ callType: CallType;
142
+ /** Source line where the reference occurs. */
143
+ line: number;
98
144
  }
99
145
  /** A node in the code-map dependency graph. */
100
146
  export interface GraphNode {
@@ -138,5 +184,5 @@ export interface CodeMapGraph {
138
184
  nodes: GraphNode[];
139
185
  edges: GraphEdge[];
140
186
  }
141
- export declare const SCHEMA_VERSION = 3;
187
+ export declare const SCHEMA_VERSION = 4;
142
188
  //# sourceMappingURL=schema.d.ts.map
@@ -5,6 +5,7 @@
5
5
  * Errors cross the boundary as strings and are re-wrapped by the host.
6
6
  */
7
7
  import type { CodeMapGraph, IndexResult, IndexStats, SearchResult } from './schema.js';
8
+ import type { IncomingCallsResult, OutgoingCallsResult } from './index-service.js';
8
9
  export interface IndexOpArgs {
9
10
  projectRoot: string;
10
11
  indexDir?: string | undefined;
@@ -33,6 +34,11 @@ export interface FileGraphOpArgs extends StatsOpArgs {
33
34
  export interface SymbolGraphOpArgs extends StatsOpArgs {
34
35
  fileFilter: string;
35
36
  }
37
+ export interface CallRefsOpArgs extends StatsOpArgs {
38
+ symbol: string;
39
+ file?: string | undefined;
40
+ limit?: number | undefined;
41
+ }
36
42
  export interface SearchOpResult {
37
43
  results: SearchResult[];
38
44
  total: number;
@@ -63,6 +69,14 @@ export interface OpShapes {
63
69
  args: SymbolGraphOpArgs;
64
70
  result: CodeMapGraph;
65
71
  };
72
+ incomingCalls: {
73
+ args: CallRefsOpArgs;
74
+ result: IncomingCallsResult;
75
+ };
76
+ outgoingCalls: {
77
+ args: CallRefsOpArgs;
78
+ result: OutgoingCallsResult;
79
+ };
66
80
  }
67
81
  export type OpName = keyof OpShapes;
68
82
  export type HostToWorker = {