ucn 4.2.3 → 5.0.2
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/.claude/skills/ucn/SKILL.md +89 -77
- package/.claude/skills/ucn/references/commands.md +62 -68
- package/.claude/skills/ucn/references/trust-contract.md +31 -6
- package/README.md +438 -305
- package/assets/demo.svg +31 -0
- package/cli/index.js +430 -1385
- package/core/account.js +144 -34
- package/core/analysis.js +182 -72
- package/core/ast-analysis.js +279 -0
- package/core/bridge.js +205 -24
- package/core/brief.js +27 -58
- package/core/build-worker.js +21 -140
- package/core/cache.js +513 -11
- package/core/callers.js +4920 -456
- package/core/check.js +13 -4
- package/core/command-contracts.js +402 -0
- package/core/compilation-database.js +276 -0
- package/core/confidence.js +4 -1
- package/core/deadcode.js +397 -19
- package/core/discovery.js +359 -46
- package/core/entrypoints.js +195 -41
- package/core/execute.js +887 -81
- package/core/graph-build.js +162 -7
- package/core/graph.js +53 -77
- package/core/imports.js +65 -6
- package/core/index-ir.js +138 -0
- package/core/ir.js +195 -0
- package/core/output/analysis.js +212 -22
- package/core/output/brief.js +23 -0
- package/core/output/check.js +4 -0
- package/core/output/doctor.js +37 -6
- package/core/output/endpoints.js +5 -2
- package/core/output/extraction.js +24 -12
- package/core/output/find.js +141 -36
- package/core/output/graph.js +11 -5
- package/core/output/public.js +462 -0
- package/core/output/refactoring.js +42 -10
- package/core/output/reporting.js +97 -20
- package/core/output/search.js +24 -16
- package/core/output/shared.js +22 -1
- package/core/output/tracing.js +30 -15
- package/core/output-budget.js +295 -0
- package/core/output.js +1 -0
- package/core/parallel-build.js +44 -11
- package/core/parser.js +3 -3
- package/core/project.js +384 -187
- package/core/public-command.js +47 -0
- package/core/registry.js +247 -117
- package/core/reporting.js +312 -290
- package/core/search.js +317 -185
- package/core/semantic-provider.js +110 -0
- package/core/stacktrace.js +25 -0
- package/core/tracing.js +101 -51
- package/core/trust-matrix.js +19 -40
- package/core/verify.js +534 -37
- package/languages/adapter.js +218 -0
- package/languages/c-family.js +2791 -0
- package/languages/c.js +3 -0
- package/languages/cpp.js +3 -0
- package/languages/csharp.js +1402 -0
- package/languages/go.js +60 -21
- package/languages/html.js +2 -2
- package/languages/index.js +85 -7
- package/languages/java.js +396 -13
- package/languages/javascript.js +199 -19
- package/languages/python.js +964 -22
- package/languages/rust.js +1317 -152
- package/languages/utils.js +40 -3
- package/mcp/server.js +254 -636
- package/package.json +39 -22
- package/eslint.config.js +0 -43
- package/jsconfig.json +0 -10
|
@@ -1,115 +1,127 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ucn
|
|
3
|
-
description: AST code intelligence for JavaScript/TypeScript, Python, Go, Rust, Java, and HTML. Use in repositories over roughly 500 LOC to orient, extract symbols, trace callers or callees, assess impact,
|
|
3
|
+
description: AST code intelligence for JavaScript/TypeScript, Python, Go, Rust, Java, C, C++, C#, and HTML. Use in repositories over roughly 500 LOC to orient, extract symbols, trace callers or callees, assess change impact, validate call sites, select tests, inspect dependencies, or investigate dead code. Prefer it over repeated grep-and-read cycles for semantic questions; use text search for literals, messages, configuration, and unsupported languages.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# UCN
|
|
7
7
|
|
|
8
8
|
Use UCN to gather compact, auditable code evidence before reading large files or changing a symbol.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Core workflow
|
|
11
11
|
|
|
12
|
-
1. Run `ucn
|
|
13
|
-
2. Pin
|
|
14
|
-
3. Run `ucn
|
|
15
|
-
4. Before a change, run `ucn impact <handle>` and `ucn
|
|
16
|
-
5. After a signature change, run `ucn
|
|
17
|
-
6. Read
|
|
12
|
+
1. Run `ucn repo` in an unfamiliar repository. Add `--deep` when readiness or index health matters. If it reports skipped unsupported source, use grep/ripgrep and a language-native analyzer for those files; never interpret an `UNSUPPORTED` or `PARTIAL` scope as a semantic zero.
|
|
13
|
+
2. Pin a symbol with `ucn find <name>`, then pass its `path:line:name` handle to later commands.
|
|
14
|
+
3. Run `ucn show <handle>` for the default summary, callers, and callees. Request extra projections with `--sections=source,tests,types,dependencies,example,related`.
|
|
15
|
+
4. Before a change, run `ucn impact <handle>` and `ucn tests <handle> --depth=3`.
|
|
16
|
+
5. After a signature change, run `ucn check <handle>`. Before committing, run target-less `ucn check`.
|
|
17
|
+
6. Read exact code with `ucn source <handle>` or `ucn source path/to/file:10-30` only when inspection is needed.
|
|
18
18
|
|
|
19
|
-
Prefer `--json`
|
|
19
|
+
Prefer `--json` for automation. Every CLI JSON response uses `{ meta, data }`;
|
|
20
|
+
`meta.command` uses the native surface spelling and may include the internal
|
|
21
|
+
`canonicalCommand`. MCP returns text through one `ucn` tool and keeps contract
|
|
22
|
+
metadata visible when truncating results.
|
|
20
23
|
|
|
21
|
-
##
|
|
24
|
+
## One contract across surfaces
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
CLI, MCP, and interactive mode resolve the same 18 public commands through one registry, execute the same handlers, and use the same public formatters. CLI spells multiword commands with hyphens; MCP uses snake case. For example, use `audit-async` in CLI and `audit_async` in MCP.
|
|
24
27
|
|
|
25
|
-
|
|
28
|
+
The release board independently cross-checks overlapping stable-handle answers from `find`, `show`, `source`, `impact`, `tests`, `check`, and caller `trace`. Target identity, source and direct-test projections, caller tiers, evidence reasons, totals, and accounting must agree exactly; a mismatch is a failing witness rather than an interpretation left to an agent.
|
|
26
29
|
|
|
27
|
-
-
|
|
28
|
-
- MCP defaults `about`, `context`, and `impact` to compact text. It uses a 10K character default for targeted commands, 3K for broad commands, and a 100K hard ceiling. Contract metadata is preserved when output is truncated.
|
|
29
|
-
- MCP uses snake_case command and parameter names. CLI uses hyphenated command and flag names.
|
|
30
|
-
- To compare text, align compact/full settings and result caps. Surface-specific retry hints may still use CLI or MCP spelling.
|
|
30
|
+
Publish-blocking semantic gates also compare stratified samples from pinned real repositories with independent language-native oracles: ts-morph, Pyright, gopls, rust-analyzer, JDT LS, clangd, and Roslyn. This validates the measured static evidence classes; it does not turn dynamic dispatch, generated code, reflection, or external dependencies into complete runtime knowledge.
|
|
31
31
|
|
|
32
|
-
MCP keeps
|
|
32
|
+
MCP keeps its process and project index warm across calls. CLI and MCP share
|
|
33
|
+
the same text budget: targeted commands default to 10K output characters,
|
|
34
|
+
broad commands to 3K, with a 100K hard ceiling. Use CLI `--max-chars`, MCP
|
|
35
|
+
`max_chars`, a narrower file/directory scope, or a smaller section projection
|
|
36
|
+
when necessary. Truncation must retain the accounting/contract lines needed to
|
|
37
|
+
interpret the answer, and the requested limit includes both the notice and the
|
|
38
|
+
preserved metadata.
|
|
33
39
|
|
|
34
|
-
|
|
40
|
+
Persistent indexes live in a per-user, project-keyed cache rather than the analyzed repository. Set `UCN_CACHE_DIR` to override the cache root; CLI `--no-cache` bypasses persistence and `--clear-cache` removes the current project's cache. Legacy `<project>/.ucn-cache` directories are migrated on first use.
|
|
35
41
|
|
|
36
|
-
|
|
42
|
+
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; UCN still cannot prove which branch a particular build activates. This is portable AST analysis, not a compiler build; macros, templates, generated code, reflection, and external dependency semantics can remain unverified.
|
|
37
43
|
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
`repo` readiness is task-specific. Its headline is navigation readiness;
|
|
45
|
+
refactor, deletion, semantic recall, and the sampled evidence mix are separate
|
|
46
|
+
dimensions. The confirmed/unverified percentage is a classification profile,
|
|
47
|
+
not an accuracy grade.
|
|
40
48
|
|
|
41
|
-
|
|
49
|
+
## Interpret evidence correctly
|
|
42
50
|
|
|
43
|
-
- `
|
|
44
|
-
- `CONTRACT` states whether that literal-name partition is complete. `observed-text zero` means no caller was found in that observed text set. It does not prove semantic zero and is never safe-delete proof.
|
|
45
|
-
- `WARNING` means parsing, reading, or indexing was incomplete. Inspect the named files with text search or the compiler.
|
|
46
|
-
- `FILTERED` means flags hid evidence from display. Remove the filters before a breaking change.
|
|
47
|
-
- `beyond-text callers` are alias- or binding-resolved edges that a literal grep would miss.
|
|
48
|
-
- Numeric evidence scores are ordinal ranking weights, not calibrated probabilities or accuracy percentages.
|
|
49
|
-
- Truncated MCP output preserves contract metadata when possible. If `contractMetadataComplete` is false, rerun with a larger output budget or narrower scope.
|
|
51
|
+
For caller-bearing `show`, `impact`, `trace`, `tests`, and `check` views:
|
|
50
52
|
|
|
51
|
-
|
|
53
|
+
- `CONFIRMED` has binding, receiver, import, or ownership evidence for the pinned target.
|
|
54
|
+
- `UNVERIFIED` is a possible target with insufficient identity evidence. Review it before a breaking change.
|
|
55
|
+
- `ACCOUNT` partitions observed literal-name lines into confirmed, unverified, non-call, excluded, and unresolved buckets. In mixed-language repositories it also counts occurrences in unsupported-language source files.
|
|
56
|
+
- `CONTRACT` states the scope and completeness of that observed-text partition. When unsupported-language files contain the name, it says so explicitly and the partition-complete claim is limited to supported languages.
|
|
57
|
+
- `WARNING` identifies unreadable, unparsed, or partially indexed files, and lists unsupported-language occurrence sites (file:line plus the line text) so nothing grep would show is hidden. `usages` and `tests` carry the same disclosure as a note.
|
|
58
|
+
- `FILTERED` means query options hid evidence.
|
|
52
59
|
|
|
53
|
-
|
|
60
|
+
An observed-text zero is not semantic zero or safe-delete proof. Numeric evidence values are ordinal ranking weights, not probabilities.
|
|
61
|
+
|
|
62
|
+
When a plain name selects more than one definition, action-oriented commands
|
|
63
|
+
(`impact`, `tests`, `check`, and `plan`) carry the same ambiguity warning as
|
|
64
|
+
`show`/`source`/`trace`. Prefer a stable handle; never treat the auto-selected
|
|
65
|
+
definition as an implicit repository-wide target.
|
|
66
|
+
|
|
67
|
+
## Choose a command
|
|
54
68
|
|
|
55
69
|
| Decision | Command |
|
|
56
70
|
|---|---|
|
|
57
|
-
|
|
|
58
|
-
|
|
|
59
|
-
|
|
|
60
|
-
|
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
|
|
|
64
|
-
|
|
|
65
|
-
|
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
| Orient or diagnose a repository | `ucn repo [--sections=files,stats,health] [--deep]` |
|
|
72
|
+
| Understand one symbol | `ucn show <handle> [--sections=...]` |
|
|
73
|
+
| Locate definitions or types | `ucn find <name> [--type=type]` |
|
|
74
|
+
| Inspect literal-name occurrence kinds | `ucn usages <name>` |
|
|
75
|
+
| Search literal text, explicit regex, or AST structure | `ucn search [term] [--regex] [--type=...]` |
|
|
76
|
+
| Extract exact source | `ucn source <handle\|file:range>` |
|
|
77
|
+
| Follow calls down or up | `ucn trace <handle> --direction=callees\|callers` |
|
|
78
|
+
| Find paths to roots | `ucn trace <handle> --direction=callers --to=entrypoints` |
|
|
79
|
+
| Assess direct or Git-diff impact | `ucn impact [handle]` |
|
|
80
|
+
| Select direct or transitive tests | `ucn tests <handle> [--depth=N]` |
|
|
81
|
+
| Validate a symbol or pending diff | `ucn check [handle]` |
|
|
82
|
+
| Preview a refactor | `ucn plan <handle> --rename-to=X` |
|
|
83
|
+
| Inspect file dependencies | `ucn deps <file> [--direction=...]` |
|
|
84
|
+
| Find circular imports | `ucn deps --cycles` (project-wide; no file target) |
|
|
85
|
+
| Inspect public surface | `ucn api [file]` |
|
|
86
|
+
| Review entry points or HTTP routes | `ucn entrypoints`; `ucn endpoints` |
|
|
87
|
+
| Generate review candidates | `ucn deadcode`; `ucn audit-async` |
|
|
88
|
+
| Resolve runtime frames | `ucn stacktrace <text>` |
|
|
71
89
|
|
|
72
90
|
## Breaking-change protocol
|
|
73
91
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
3. Run `blast` for transitive impact when behavior changes.
|
|
79
|
-
4. Run `affected-tests`; treat “uncovered” as a test-planning signal, not proof of no coverage.
|
|
92
|
+
1. Pin the exact definition with `find`.
|
|
93
|
+
2. Run `impact`; review every unverified, excluded, filtered, and warning entry.
|
|
94
|
+
3. Run `trace --direction=callers` for transitive behavioral impact.
|
|
95
|
+
4. Run `tests --depth=3`; treat paths without static test links as test-planning signals, not runtime coverage proof.
|
|
80
96
|
5. Make the change.
|
|
81
|
-
6. Run `
|
|
82
|
-
7. Run `
|
|
83
|
-
|
|
84
|
-
UCN augments the compiler and tests; it does not replace them.
|
|
97
|
+
6. Run `check <handle>`, the relevant compiler/type checker, and selected tests.
|
|
98
|
+
7. Run target-less `check` to reconcile the repository diff.
|
|
85
99
|
|
|
86
100
|
## Deletion protocol
|
|
87
101
|
|
|
88
|
-
Treat `deadcode` as a candidate generator. Before
|
|
89
|
-
|
|
90
|
-
1. Run `ucn deadcode`, then pin the candidate.
|
|
91
|
-
2. Run `ucn usages <name>` to inspect calls, imports, type references, and non-call references.
|
|
92
|
-
3. Run `ucn impact <handle>` and inspect `ACCOUNT`, `CONTRACT`, warnings, unverified sites, and beyond-text callers.
|
|
93
|
-
4. Run `ucn entrypoints` and consider framework registration, reflection, serialization, dependency injection, public API use, and external consumers.
|
|
94
|
-
5. Run `ucn doctor --deep`; inspect index health, evidence readiness, and the deletion review requirement.
|
|
95
|
-
6. Delete only with corroborating compiler/type-checker and test evidence.
|
|
102
|
+
Treat `deadcode` as a candidate generator. Before deletion, inspect `usages`, `impact`, `entrypoints`, `api`, and `repo --sections=health --deep`; then corroborate with the compiler/type checker and tests. Computed dispatch such as `handlers[key]()` is a reported blind spot; registry members reached by a modeled computed receiver are withheld. Unknown decorators/annotations and member-assigned event handlers are also withheld by default because they can be the registration itself. All remaining candidates are still review-only. Never delete solely from `deadcode` or an observed-text-zero result.
|
|
96
103
|
|
|
97
|
-
|
|
104
|
+
`usages` includes comment/string/docstring occurrences in an `OTHER TEXT` section unless
|
|
105
|
+
`--code-only` is set. This is a literal-name inventory, not exact target
|
|
106
|
+
binding. `search` treats its term literally by default; pass `--regex` only
|
|
107
|
+
when regular-expression semantics are intended. Ordinary regex patterns run
|
|
108
|
+
through an RE2-compatible linear-time engine; unsafe nested repetition is
|
|
109
|
+
rejected, and unsupported advanced syntax should be handed to ripgrep.
|
|
98
110
|
|
|
99
|
-
|
|
111
|
+
`find` activity counts are definition-pinned: confirmed plus visible unverified
|
|
112
|
+
call candidates. Calls proved to belong to another same-name target are
|
|
113
|
+
disclosed separately and excluded from the activity total.
|
|
100
114
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
- Tree trunks contain confirmed edges. Unverified edges are separate and are not expanded unless `--expand-unverified` is requested.
|
|
105
|
-
- Following an unverified edge produces a possible-impact chain, not a confirmed chain.
|
|
115
|
+
`plan` always includes the selected declaration plus indexed call/import/export
|
|
116
|
+
previews. Read `changeSummary`, and manually review any edit marked
|
|
117
|
+
`needsReview`; the command previews changes but does not apply or compile them.
|
|
106
118
|
|
|
107
|
-
## Efficient
|
|
119
|
+
## Efficient use
|
|
108
120
|
|
|
109
|
-
- Use `--
|
|
110
|
-
- Use `--
|
|
111
|
-
- Use `--
|
|
112
|
-
- Use `--
|
|
113
|
-
- Use `
|
|
121
|
+
- Prefer handles over plain names. Use `--class-name` or `--file` only when a handle is unavailable.
|
|
122
|
+
- Use `--sections` to request only the `show` or `repo` evidence needed.
|
|
123
|
+
- Use `--expand-unverified` only when deliberately exploring possible caller chains; those descendants remain possible, not confirmed.
|
|
124
|
+
- Use `--all` only when that command's output reports a supported cap; otherwise narrow the query or raise `--max-chars`.
|
|
125
|
+
- Use `search` or ordinary repository search for text, filenames, configuration, and unsupported syntax.
|
|
114
126
|
|
|
115
|
-
Read [references/commands.md](references/commands.md)
|
|
127
|
+
Read [references/commands.md](references/commands.md) for all public commands and flags. Read [references/trust-contract.md](references/trust-contract.md) before building automation that gates changes on UCN output.
|
|
@@ -1,93 +1,87 @@
|
|
|
1
1
|
# UCN command reference
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
UCN exposes exactly 18 task-oriented public commands. CLI uses hyphenated names; MCP uses snake case.
|
|
4
|
+
|
|
5
|
+
Use grep/ripgrep for simple literals, error messages, configuration, filenames,
|
|
6
|
+
Markdown, and unsupported languages. Use UCN for exact symbol identity,
|
|
7
|
+
callers/callees, change impact, test linkage, dependency/API questions, and AST
|
|
8
|
+
structural or code-only search.
|
|
9
|
+
|
|
10
|
+
## Understand and navigate
|
|
11
|
+
|
|
12
|
+
| Command | Purpose |
|
|
13
|
+
|---|---|
|
|
14
|
+
| `show <handle>` | Default symbol summary, callers, and callees. Select `summary,callers,callees,source,dependencies,tests,types,example,related` with `--sections`. |
|
|
15
|
+
| `find <name>` | Locate definitions and stable handles. Activity counts are pinned call candidates (confirmed + visible unverified); proved other-target calls are separate. Use `--type=type`, `--limit=N`, and `--with-source` as needed. |
|
|
16
|
+
| `usages <name>` | Inventory definitions, calls, imports, type references, and literal comment/string/docstring text. Those text sites appear under `OTHER TEXT` unless `--code-only`. |
|
|
17
|
+
| `search [pattern]` | Literal text search by default; add `--regex` for RE2-compatible linear-time regular expressions, or use structural filters such as `--type`, `--param`, `--receiver`, `--returns`, or `--decorator`. Unsafe nested repetition is rejected; use ripgrep for unsupported advanced syntax. |
|
|
18
|
+
| `source <handle\|file:range>` | Extract a function, class-like declaration, or exact line range. |
|
|
19
|
+
| `trace <handle>` | Traverse callees by default. Use `--direction=callers` for blast radius and add `--to=entrypoints` for paths to roots. |
|
|
20
|
+
|
|
21
|
+
## Change and validation
|
|
4
22
|
|
|
5
23
|
| Command | Purpose |
|
|
6
24
|
|---|---|
|
|
7
|
-
| `
|
|
8
|
-
| `
|
|
9
|
-
| `
|
|
10
|
-
| `
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
| `brief <handle>` | Signature, documentation sentence, effects, and complexity |
|
|
14
|
-
| `about <handle>` | Definition, callers, callees, tests, source, and contracts |
|
|
15
|
-
| `context <handle>` | Compact callers/callees without the full source body |
|
|
16
|
-
| `smart <handle>` | Symbol source plus directly used helpers |
|
|
17
|
-
| `example <handle>` | Best confirmed usage example; abstains when only unverified calls exist |
|
|
18
|
-
| `related <handle>` | Advisory sibling ranking from names, files, and shared dependencies |
|
|
19
|
-
| `expand <N>` | Expand a numbered item from a prior context result |
|
|
20
|
-
|
|
21
|
-
## Calls, impact, and refactoring
|
|
25
|
+
| `impact [handle]` | Show direct symbol impact when given a handle; without one, analyze the Git diff. |
|
|
26
|
+
| `tests <handle\|file>` | Find statically linked direct tests. Set `--depth=N` for transitive affected tests. Empty results are not runtime coverage proof. |
|
|
27
|
+
| `check [handle]` | Validate confirmed call-site arity for a symbol; without one, run the composed pre-commit diagnostic. |
|
|
28
|
+
| `plan <handle>` | Preview `--rename-to`, `--add-param`, or `--remove-param` edits, including the selected declaration and indexed call/import/export sites. Review `changeSummary` and `needsReview`. |
|
|
29
|
+
|
|
30
|
+
## Repository and architecture
|
|
22
31
|
|
|
23
32
|
| Command | Purpose |
|
|
24
33
|
|---|---|
|
|
25
|
-
| `
|
|
26
|
-
| `
|
|
27
|
-
| `
|
|
28
|
-
| `
|
|
29
|
-
| `
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
| `diff-impact [--base=REF]` | Changed symbols and caller impact from a Git diff |
|
|
33
|
-
| `check [--base=REF]` | Diff impact, signature checks, and affected tests |
|
|
34
|
-
|
|
35
|
-
## Search, graph, and maintenance
|
|
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`. |
|
|
36
|
+
| `api [file]` | Static exported/public surface for a project or file. |
|
|
37
|
+
| `entrypoints` | Framework, route, task, test, and runtime entry points. |
|
|
38
|
+
| `endpoints` | Server/client HTTP surface; `--bridge` adds advisory matching. |
|
|
39
|
+
|
|
40
|
+
## Focused audits and runtime evidence
|
|
36
41
|
|
|
37
42
|
| Command | Purpose |
|
|
38
43
|
|---|---|
|
|
39
|
-
| `
|
|
40
|
-
| `
|
|
41
|
-
| `
|
|
42
|
-
| `usages <name>` | Definitions, calls, imports, types, and other references |
|
|
43
|
-
| `typedef <name>` | Type, interface, enum, struct, trait, class, and record definitions |
|
|
44
|
-
| `tests <name>` | Test files and test functions associated with a symbol |
|
|
45
|
-
| `imports <file>` | Dependencies of a file |
|
|
46
|
-
| `exporters <file>` | Files depending on a file |
|
|
47
|
-
| `file-exports <file>` | Symbols exported by a file |
|
|
48
|
-
| `graph <file> --depth=N` | File dependency tree |
|
|
49
|
-
| `circular-deps` | Import cycles |
|
|
50
|
-
| `api` | Exported/public project surface |
|
|
51
|
-
| `stats` | Project counts; add `--hot` or `--functions` for deeper reporting |
|
|
52
|
-
| `entrypoints` | Framework, route, task, test, and runtime entry points |
|
|
53
|
-
| `endpoints --bridge` | Advisory server-route/client-request matching |
|
|
54
|
-
| `deadcode` | Unreferenced-symbol candidates |
|
|
55
|
-
| `audit-async` | Potential missing-await sites in JS/TS/Python |
|
|
56
|
-
| `stacktrace <text>` | Advisory stack-frame parsing and source lookup |
|
|
57
|
-
| `doctor --deep` | Index health, blind spots, evidence profile, and task readiness |
|
|
44
|
+
| `deadcode` | Conservative unreferenced-symbol candidates for review. Modeled computed-dispatch members, unknown decorated/annotated callables, and member-assigned event handlers are withheld by default. |
|
|
45
|
+
| `audit-async` | Potential missing-await sites in JavaScript/TypeScript/Python and C#. MCP spelling: `audit_async`. |
|
|
46
|
+
| `stacktrace <text>` | Advisory stack-frame parsing and source lookup. |
|
|
58
47
|
|
|
59
48
|
## Stable symbol identity
|
|
60
49
|
|
|
61
|
-
|
|
50
|
+
Symbol-listing commands emit handles such as `src/api.ts:42:handler`. Pass the full handle to symbol commands. `path:line` also works. Handles prevent same-named definitions from being silently combined.
|
|
62
51
|
|
|
63
52
|
## Common flags
|
|
64
53
|
|
|
65
54
|
| Flag | Meaning |
|
|
66
55
|
|---|---|
|
|
67
|
-
| `--
|
|
68
|
-
| `--
|
|
69
|
-
| `--
|
|
70
|
-
| `--
|
|
71
|
-
| `--
|
|
72
|
-
| `--
|
|
73
|
-
| `--
|
|
74
|
-
| `--
|
|
75
|
-
| `--
|
|
76
|
-
| `--
|
|
77
|
-
| `--
|
|
78
|
-
| `--
|
|
79
|
-
| `--
|
|
80
|
-
| `--
|
|
81
|
-
| `--
|
|
82
|
-
| `--
|
|
83
|
-
| `--
|
|
84
|
-
|
|
85
|
-
|
|
56
|
+
| `--sections=a,b` | Select `show` or `repo` projections. |
|
|
57
|
+
| `--file=<pattern>` | Scope or disambiguate by file. |
|
|
58
|
+
| `--class-name=<name>` | Scope a member when no handle is available. |
|
|
59
|
+
| `--in=<directory>` | Limit query scope to a directory. |
|
|
60
|
+
| `--exclude=<patterns>` | Exclude matching paths. |
|
|
61
|
+
| `--depth=N` | Set trace/dependency/test traversal depth. |
|
|
62
|
+
| `--direction=<value>` | Select trace or dependency direction. |
|
|
63
|
+
| `--all` | Lift result and formatter caps where supported. It is recommended only for commands that accept it. |
|
|
64
|
+
| `--max-chars=N` | Set the hard CLI text budget, including notices and preserved trust metadata (10K targeted / 3K broad by default; 100K ceiling). MCP spelling: `max_chars`. JSON is not transport-truncated. |
|
|
65
|
+
| `--compact` / `--no-compact` | Select token-efficient or full semantic output. |
|
|
66
|
+
| `--range=N-M` | Extract an explicit line range with `source --file=<path>`. |
|
|
67
|
+
| `--json` | Emit the stable CLI `{ meta, data }` envelope; `meta.contract` carries the truth boundary, decision safety, and next actions. |
|
|
68
|
+
| `--expand-unverified` | Follow possible caller edges while preserving their unverified status. |
|
|
69
|
+
| `--base=<ref>` / `--staged` | Scope Git-diff `impact` or target-less `check`. |
|
|
70
|
+
| `--no-cache` / `--clear-cache` | Bypass or clear the current project's per-user cache. Set `UCN_CACHE_DIR` to override its root. |
|
|
71
|
+
| `--workers=N` | Set build workers; `0` disables parallel build. |
|
|
72
|
+
| `--include-exported` | Include exported symbols in `deadcode`. |
|
|
73
|
+
| `--include-decorated` | Include decorated symbols in `deadcode`. |
|
|
74
|
+
| `--code-only` | Exclude comments and strings in `search`/`usages`. |
|
|
75
|
+
| `--regex` | Interpret a `search` term as a regular expression. Without it, the term is literal. |
|
|
86
76
|
|
|
87
77
|
## Target forms
|
|
88
78
|
|
|
89
79
|
```text
|
|
90
|
-
ucn [target] <command> [
|
|
80
|
+
ucn [target] <command> [argument] [flags]
|
|
91
81
|
```
|
|
92
82
|
|
|
93
|
-
Omit
|
|
83
|
+
Omit the target for the current project. A target may be a file, directory, or quoted glob such as `"src/**/*.py"`.
|
|
84
|
+
|
|
85
|
+
## Language notes
|
|
86
|
+
|
|
87
|
+
Supported source families are JavaScript/TypeScript/TSX, Python, Go, Rust, Java, C, C++, C#, and HTML inline JavaScript/event handlers. C/C++ consumes `compile_commands.json` when present for header-language and include-path context, and retains AST-proven facts across recoverable preprocessor branches. UCN remains portable AST analysis: it does not run a compiler, preprocessor, Roslyn, or an LSP during normal queries, and it does not assert which conditional branch a build activates.
|
|
@@ -8,9 +8,9 @@ Use this reference when an agent, CI job, or script will make decisions from UCN
|
|
|
8
8
|
|
|
9
9
|
`unverified` means a syntactic candidate could reach the target but identity could not be established. Preserve and expose these edges. Do not silently treat them as negatives.
|
|
10
10
|
|
|
11
|
-
`excluded` means the engine found evidence for a different definition, an incompatible receiver, an external package, an arity mismatch, or another stated reason. Inspect excluded reasons when investigating an accuracy issue.
|
|
11
|
+
`excluded` means the engine found evidence for a different definition, an incompatible receiver, an external package, an unrelated runtime-language boundary, an arity mismatch, or another stated reason. Inspect excluded reasons when investigating an accuracy issue.
|
|
12
12
|
|
|
13
|
-
`non-call` means the literal name occurred as a definition, import, type reference, property, comment/string, or other text. Use `usages` for the underlying sites
|
|
13
|
+
`non-call` means the literal name occurred as a definition, import, type reference, property, comment/string, or other text. Use `usages` for the underlying sites; comment/string occurrences appear under `OTHER TEXT` unless `codeOnly=true`.
|
|
14
14
|
|
|
15
15
|
`beyond-text` means semantic binding or alias evidence produced an edge that a literal-name ground set could not observe.
|
|
16
16
|
|
|
@@ -26,8 +26,10 @@ Required automation checks:
|
|
|
26
26
|
4. No contract metadata was lost to truncation.
|
|
27
27
|
5. Unverified and excluded reasons are retained for review.
|
|
28
28
|
6. Compiler/LSP evaluation reports keep configuration-unscored evidence below the release ceiling; a high-precision result from an undersized scored subset is not accepted.
|
|
29
|
+
7. The release review-burden board passes: true edges left unverified, zero-actionable-ambiguity target rate, actionable candidate p95, and effective unverified review items per oracle edge all remain within the published budget. Raw false candidates remain reported separately.
|
|
30
|
+
8. The deterministic cross-command board reports zero disagreements: overlapping `find`, `show`, `source`, `impact`, `tests`, `check`, and caller `trace` claims resolve the same stable handle to the same identity, projections, caller tiers, evidence reasons, totals, and caller account.
|
|
29
31
|
|
|
30
|
-
Even when all
|
|
32
|
+
Even when all eight hold, `account.contract.semanticComplete` remains false. Use compiler/type-checker, test, runtime, and framework evidence for semantic decisions.
|
|
31
33
|
|
|
32
34
|
`account.contract.observedTextZero` is safe only for the claim “the complete observed literal-name ground set contained no caller candidates or beyond-text edges.” It is explicitly not safe-delete proof.
|
|
33
35
|
|
|
@@ -35,9 +37,28 @@ Even when all five hold, `account.contract.semanticComplete` remains false. Use
|
|
|
35
37
|
|
|
36
38
|
`evidenceScore` (and the legacy `confidence` alias where present) is an ordinal weight used for ordering and thresholding evidence classes. `scoreKind` is `ordinal-evidence-not-probability`. Never display it as measured accuracy or use it as a probability in risk calculations.
|
|
37
39
|
|
|
40
|
+
## Unverified review burden
|
|
41
|
+
|
|
42
|
+
Semantic recall can be complete while the result is still impractical: a true edge may be present only in a large unverified set. Release evaluation therefore measures both placement and the amount of review an agent must perform.
|
|
43
|
+
|
|
44
|
+
- `trueEdgeUnverifiedRate` is the share of semantic oracle edges found only in the unverified tier.
|
|
45
|
+
- `zeroActionableUnverifiedTargetRate` is the share of reviewed targets with no actionable ambiguity.
|
|
46
|
+
- `actionableUnverifiedCandidatesP50`, `actionableUnverifiedCandidatesP95`, and `actionableUnverifiedCandidatesMax` measure actionable candidate-set size per target.
|
|
47
|
+
- `unverifiedReviewItemsPerOracleEdge` measures effective review work relative to the oracle workload. Actionable false candidates count individually; each named runtime-dispatch family counts once.
|
|
48
|
+
- `rawFalseUnverifiedPerOracleEdge` preserves the ungrouped false-candidate amplification for auditability.
|
|
49
|
+
- `unverifiedReasons` groups candidates by the engine reason that kept them out of the confirmed tier.
|
|
50
|
+
|
|
51
|
+
Configuration-gated candidates remain visible but are not labeled false when the compiler/LSP oracle did not score them. The raw JSON rollup is the source of truth for these fields; the Markdown report is generated from the same data.
|
|
52
|
+
|
|
53
|
+
The publish-blocking portable-AST ceilings are: at most 10% of exact true edges left unverified, at most 20% within any sufficiently sampled symbol kind, at least 80% of targets with zero actionable ambiguity, actionable-candidate p95 at most five, and at most 0.10 effective review items per oracle edge. The semantic gate separately requires 100% in-scope recall, at least 98% confirmed-tier precision, full conservation, and 100% public-command proof recall. Passing these sampled floors is release evidence, not runtime-completeness proof.
|
|
54
|
+
|
|
55
|
+
The performance gate runs each pinned repository in three independent processes with a fixed worker shape. Publish and PR gates require both CPU and wall-throughput floors on the median run, pin the expected file/LOC workload, and use the worst observed build/full-board peak RSS so memory failures cannot be averaged away. Exploratory one-process runs keep wall throughput diagnostic. Scoped reports are separate from the full release artifact; the dated rollup is release-qualified only when every required row came from a full release invocation. The composite release gate runs this stage first so verbose compiler-oracle output and report consumers cannot perturb its samples.
|
|
56
|
+
|
|
38
57
|
## Truncation
|
|
39
58
|
|
|
40
|
-
MCP
|
|
59
|
+
CLI and MCP text share the same 10K targeted / 3K broad default budgets and
|
|
60
|
+
100K ceiling. CLI truncation appends preserved contract lines directly. MCP
|
|
61
|
+
results may additionally include:
|
|
41
62
|
|
|
42
63
|
```json
|
|
43
64
|
{
|
|
@@ -57,7 +78,11 @@ Allow an automated change to proceed to compiler/tests only when:
|
|
|
57
78
|
- the account is conserved and text-complete;
|
|
58
79
|
- warnings and filtered counts are zero;
|
|
59
80
|
- unverified sites are either zero or explicitly reviewed;
|
|
60
|
-
-
|
|
81
|
+
- `ucn repo --sections=health --deep` reports no parse failure/recovery and its task-specific readiness has been reviewed;
|
|
82
|
+
- the repo health report lists no unsupported source handoff relevant to the change;
|
|
61
83
|
- the change is still validated by the language toolchain and relevant tests.
|
|
62
84
|
|
|
63
|
-
Never auto-delete from a UCN-only signal.
|
|
85
|
+
Never auto-delete from a UCN-only signal. Computed dispatch is reported as a
|
|
86
|
+
health blind spot, and modeled registry members are withheld from candidates,
|
|
87
|
+
but neither protection proves runtime reachability. Require usages, entry-point
|
|
88
|
+
review, public API review, and external validation.
|