ucn 5.2.2 → 5.3.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.
@@ -43,6 +43,10 @@ Persistent indexes live in a per-user, project-keyed cache rather than the analy
43
43
 
44
44
  Supported source families are JavaScript/TypeScript/TSX, Python, Go, Rust, Java, C, C++, C#, and HTML inline JavaScript/event handlers. C/C++ uses `compile_commands.json` when available to classify headers and resolve include paths. Recoverable preprocessor branches contribute AST-proven source facts, so a single selected configuration does not silently erase definitions or calls; disagreeing conditional macro identities stay visible as unverified. C++ resolution uses namespace ownership, static overload shape (including arrays), and macro-parameter requalification. C# resolution uses declared property/field receiver types plus overload and hiding discipline. This is portable AST analysis, not a compiler build; macros, templates, generated code, reflection, and external dependency semantics can remain unverified.
45
45
 
46
+ `repo` refines its HOT list exactly for up to 400 candidate definitions per
47
+ run; when a large repository exhausts that budget the HOT header says so and
48
+ the ranking is approximate. `repo --sections=stats --hot` is always exact.
49
+
46
50
  `repo` readiness is task-specific. Its headline is navigation readiness;
47
51
  refactor, deletion, semantic recall, and the sampled evidence mix are separate
48
52
  dimensions. The confirmed/unverified percentage is a classification profile,
@@ -65,6 +69,16 @@ identity; matching attribute syntax with an unresolved receiver stays
65
69
  unverified. These are change dependencies, not fabricated caller edges, so
66
70
  the caller `ACCOUNT` remains a call-shaped partition.
67
71
 
72
+ When the selected definition is a type, interface, enum, trait, or record,
73
+ `impact` adds a `TYPE REFERENCE SITES` band: annotation and reference sites
74
+ confirmed by an import link to the definition's file (or package scope in
75
+ Go/Java), the rest visible as unverified with a reason. `DEPENDENCY SITES`
76
+ counts them; `CALL SITES` stays call-shaped.
77
+
78
+ Target-less `impact` and `check` diff the working tree against `HEAD` AND
79
+ include untracked, non-ignored source files as whole-file additions, so new
80
+ modules are checked before `git add`. `--staged` keeps its index-only meaning.
81
+
68
82
  An observed-text zero is not semantic zero or safe-delete proof. Numeric evidence values are ordinal ranking weights, not probabilities.
69
83
 
70
84
  When a plain name selects more than one definition, action-oriented commands
@@ -95,6 +109,40 @@ definition as an implicit repository-wide target.
95
109
  | Generate review candidates | `ucn deadcode`; `ucn audit-async` |
96
110
  | Resolve runtime frames | `ucn stacktrace <text>` |
97
111
 
112
+ ## In a shell, next to grep
113
+
114
+ `ucn` is a Bash tool as much as an MCP tool. Two flags make it compose like
115
+ `grep -n` so a shell-first agent can keep its reflexes and still get symbol
116
+ answers:
117
+
118
+ ```bash
119
+ ucn find handleRequest --lines # path:line:signature # kind
120
+ ucn show handleRequest --lines # callers as path:line:text; unverified ones end in "\t# unverified: <reason>"
121
+ ucn show handleRequest --lines --sections=callees
122
+ ucn usages handleRequest --lines # every literal-name line; non-call kinds tagged "# import" / "# definition"
123
+ ucn search 'retry(' --lines # grep -n output, code-aware scope
124
+ ucn impact handleRequest --lines
125
+ ucn source handleRequest --raw # the code and nothing else, ready for an exact-string edit
126
+ ucn source src/server.js:40-80 --raw
127
+ ```
128
+
129
+ Records go to stdout; the `ACCOUNT` / `CONTRACT` lines, notes, and the
130
+ same-name disambiguation go to stderr prefixed `# ` (MCP keeps them in the one
131
+ text block, and `--raw` appends its note as one trailing `# ` line there).
132
+ `--lines` lists the whole band without default row/character caps, so pipe through
133
+ `grep -v '# unverified'` for the confirmed tier or `cut -d: -f1 | sort | uniq -c`
134
+ for callers per file. Nothing to list prints nothing and exits 1, grep's
135
+ contract; errors exit 2. Explicit `--top`/`--limit` still apply and disclose
136
+ omissions. `show --lines` accepts only callers/callees sections; target-less
137
+ `impact --lines` lists Git-diff callers with per-target accounting. Closing a
138
+ pipe with `head` is supported. `source --raw` extracts full large classes too;
139
+ `--max-lines` truncation is disclosed on stderr. An explicit `--max-chars`
140
+ fails before stdout if the complete shell output exceeds it. Unusual path
141
+ characters (backslash/tab/CR/LF) are escaped; use JSON for exact filenames.
142
+ `trace` and `tests` scripting uses `--json`. Use `grep` for literals, messages, configuration, and unsupported
143
+ languages; use `ucn ... --lines` when the question is a symbol, a caller, or a
144
+ definition, and `--raw` when the next step is an edit.
145
+
98
146
  ## Breaking-change protocol
99
147
 
100
148
  1. Pin the exact definition with `find`.
@@ -135,9 +183,17 @@ the old spelling. Read `changeSummary` and every review item. `plan` previews
135
183
  only: it does not modify files, run a compiler, or prove runtime compatibility.
136
184
 
137
185
  For `deps --cycles`, `eager` means every edge executes at module scope.
138
- `deferred` means at least one Python edge is function-local, so the chain is
139
- not an unconditional import-time cycle; it remains visible because invoking
140
- that function during initialization can still matter.
186
+ `deferred` means at least one edge does not: a function-local import (Python
187
+ `def`/`lambda` bodies; JS/TS `require()`/`import()` inside any function,
188
+ including `() => require()` thunks), a Python `if TYPE_CHECKING:` import, or a
189
+ TypeScript type-only import. Each deferred edge names its reason. A deferred
190
+ chain is not an unconditional import-time cycle; function-local chains stay
191
+ visible because invoking that function during initialization can still matter.
192
+ Cycles are enumerated completely and independently of build history (capped at
193
+ 500 with a disclosed truncation; groups above 2000 files skip enumeration);
194
+ `CYCLE GROUPS` and the files-in-cycles count remain complete even when the
195
+ enumerated cycle counts are lower bounds. `CYCLE GROUPS` lists each strongly connected
196
+ file set, the unit a refactor has to break.
141
197
 
142
198
  ## Efficient use
143
199
 
@@ -32,7 +32,7 @@ structural or code-only search.
32
32
  | Command | Purpose |
33
33
  |---|---|
34
34
  | `repo` | Repository orientation. Select `summary,files,stats,health` with `--sections`; `--deep` includes readiness evidence. Skipped unsupported source is listed with a grep/language-tool handoff. |
35
- | `deps <file>` | File dependency graph. Use `--direction=imports\|importers\|both`, `--detailed`, or `--cycles`. Python cycles are classified as eager or function-local/deferred without dropping either kind. |
35
+ | `deps <file>` | File dependency graph. Use `--direction=imports\|importers\|both`, `--detailed`, or `--cycles`. Cycles distinguish eager edges from function-local, Python typing-guarded, and TypeScript type-only edges. Complete cycle groups remain visible when enumeration is capped. |
36
36
  | `api [file]` | Static exported/public surface for a project or file. |
37
37
  | `entrypoints` | Framework, route, task, test, and runtime entry points. |
38
38
  | `endpoints` | Server/client HTTP surface; `--bridge` adds advisory matching. |
@@ -65,6 +65,8 @@ Symbol-listing commands emit handles such as `src/api.ts:42:handler`. Pass the f
65
65
  | `--compact` / `--no-compact` | Select token-efficient or full semantic output. |
66
66
  | `--range=N-M` | Extract an explicit line range with `source --file=<path>`. |
67
67
  | `--json` | Emit the stable CLI `{ meta, data }` envelope; `meta.contract` carries the truth boundary, decision safety, and next actions. |
68
+ | `--lines` | `find/usages/search/show/impact`: uncapped `path:line:text` listings, with tier tags after a tab. `show` accepts callers/callees sections; default callers. Accounting and notes go to stderr. Exit 0 for records, 1 for none, 2 for errors. Explicit row limits disclose omissions. |
69
+ | `--raw` | `source`: code only, including full large classes. Notes and explicit `--max-lines` truncation travel on stderr. In CLI shell modes, exceeding an explicit `--max-chars` fails before stdout instead of truncating it. |
68
70
  | `--expand-unverified` | Follow possible caller edges while preserving their unverified status. |
69
71
  | `--base=<ref>` / `--staged` | Scope Git-diff `impact` or target-less `check`. |
70
72
  | `--no-cache` / `--clear-cache` | Bypass or clear the current project's per-user cache. Set `UCN_CACHE_DIR` to override its root. |