@open-tomato/rafa 0.16.0 → 0.18.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.
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: ts-symbols
3
+ provenance: first-party
4
+ description: "Project-aware TypeScript symbol queries from the shell: definition, references, resolved type, outline."
5
+ prevents: a grep-based symbol sweep that misses re-exports and aliases while matching same-named strangers
6
+ signal: silent
7
+ when_to_use: "Use when tracing a TypeScript or JavaScript symbol from a shell — its definition, its references, its resolved type, or a file's exports — and the name is too overloaded, re-exported, or aliased for grep to answer. Prevents: a grep-based symbol sweep that misses re-exports and aliases while matching same-named strangers"
8
+ tags:
9
+ - ts
10
+ - symbols
11
+ - javascript
12
+ - shell
13
+ - typescript
14
+ stack:
15
+ - javascript
16
+ - shell
17
+ - typescript
18
+ ---
19
+
20
+ # ts-symbols: TypeScript symbol queries from the shell
21
+
22
+ CLI wrapper around the TypeScript language service. It locates the nearest
23
+ `tsconfig.json` above the target file and answers project-aware symbol queries —
24
+ what grep cannot do when a name has many same-named matches, is re-exported
25
+ (`export { x as y }`), or is imported via path aliases.
26
+
27
+ Invocation: `ts-symbols` (on PATH via `~/.local/bin`), or equivalently
28
+ `bun ~/.claude/tools/ts-symbols/cli.ts`. Positions are 1-based `<file>:<line>:<col>`,
29
+ where col points at the identifier itself (not the line start). `grep -n` gives
30
+ the line; get the column with `awk 'NR==60 {print index($0, "config")}' <file>`.
31
+
32
+ ## Commands
33
+
34
+ **outline** — exported + top-level symbols with kinds and lines. Use before
35
+ reading a big file end to end.
36
+
37
+ ```bash
38
+ ts-symbols outline packages/service/src/config.ts
39
+ # 58: export type Config
40
+ # 60: export const config
41
+ ```
42
+
43
+ **def** — jump from a usage to the declaration (follows imports, aliases, `.js`
44
+ NodeNext specifiers).
45
+
46
+ ```bash
47
+ ts-symbols def packages/service/src/index.ts:18:10
48
+ # packages/service/src/config.ts:60:14 const config — export const config: Config = ...
49
+ ```
50
+
51
+ **refs** — every reference across the tsconfig project, tagged `[def]`,
52
+ `[write]`, or `[use]` with the source line. Trust this over grep for impact
53
+ analysis: it sees re-export sites and skips same-named strangers.
54
+
55
+ ```bash
56
+ ts-symbols refs packages/service/src/config.ts:60:14
57
+ # packages/service/scripts/seed.ts:73:10 [write] import { config } from '../src/config.js';
58
+ # packages/service/src/index.ts:18:10 [write] import { config } from './config.js';
59
+ ```
60
+
61
+ **type** — resolved type at a position (what an IDE hover shows). `--full`
62
+ additionally expands type aliases without truncation.
63
+
64
+ ```bash
65
+ ts-symbols type packages/service/src/config.ts:60:14
66
+ # const config: { PORT: number; LOG_LEVEL: "fatal" | "error" | ...; }
67
+ ```
68
+
69
+ ## Notes
70
+
71
+ - `--json` on any command gives structured output.
72
+ - Exit codes: 0 results, 1 usage/error, 2 valid position but no results, 3 no
73
+ typescript under `<root>`: add it to the project.
74
+ - In monorepos the scope is the *nearest* tsconfig's project — refs from a
75
+ `packages/x` file cover that package, not sibling packages. For cross-package
76
+ impact, follow up with a grep for the module specifier (the package name as
77
+ imported).
78
+ - `--full` matters only when `type` prints a bare alias name; inline object
79
+ types are already fully shown.
80
+ - Files a tsconfig excludes (commonly `**/*.test.ts`) still work as targets.
81
+ - Grep is still right for strings, comments, non-TS files, and cheap
82
+ existence checks; reach for ts-symbols when identity matters.