@cesarandreslopez/occ 0.12.0 → 0.13.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/README.md +20 -5
- package/dist/src/code/command.js +134 -3
- package/dist/src/code/command.js.map +1 -1
- package/dist/src/code/diff.d.ts +2 -2
- package/dist/src/code/hash.d.ts +19 -0
- package/dist/src/code/hash.js +85 -0
- package/dist/src/code/hash.js.map +1 -0
- package/dist/src/code/output.d.ts +4 -1
- package/dist/src/code/output.js +67 -0
- package/dist/src/code/output.js.map +1 -1
- package/dist/src/code/query.d.ts +6 -0
- package/dist/src/code/query.js +0 -0
- package/dist/src/code/query.js.map +1 -1
- package/dist/src/code/seams.d.ts +39 -0
- package/dist/src/code/seams.js +154 -0
- package/dist/src/code/seams.js.map +1 -0
- package/dist/src/code/session.d.ts +5 -1
- package/dist/src/code/session.js +11 -0
- package/dist/src/code/session.js.map +1 -1
- package/dist/src/code/source.d.ts +10 -11
- package/dist/src/code/source.js +8 -2
- package/dist/src/code/source.js.map +1 -1
- package/dist/src/code/types.d.ts +311 -0
- package/dist/src/code/types.js +101 -0
- package/dist/src/code/types.js.map +1 -1
- package/dist/src/git/api.d.ts +9 -0
- package/dist/src/git/api.js +13 -3
- package/dist/src/git/api.js.map +1 -1
- package/dist/src/git/client.d.ts +6 -0
- package/dist/src/git/client.js +12 -0
- package/dist/src/git/client.js.map +1 -1
- package/dist/src/git/command.js +20 -0
- package/dist/src/git/command.js.map +1 -1
- package/dist/src/git/types.d.ts +15 -0
- package/dist/src/git/types.js +1 -0
- package/dist/src/git/types.js.map +1 -1
- package/dist/src/health.js +3 -0
- package/dist/src/health.js.map +1 -1
- package/dist/src/index.d.ts +8 -2
- package/dist/src/index.js +6 -1
- package/dist/src/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/occ/SKILL.md +5 -1
- package/skills/occ/reference/code.md +52 -0
- package/skills/occ/reference/commands.md +4 -0
- package/skills/occ/reference/git.md +12 -6
|
@@ -77,6 +77,25 @@ node: `<type>:<absolute-path>:<name>:<line>[:<containerName>]`. The line number
|
|
|
77
77
|
is part of the address, so ids can change after edits; re-run `code map` or
|
|
78
78
|
`code find name` after moving a symbol.
|
|
79
79
|
|
|
80
|
+
## Symbol drift — `occ code symbol-hash`
|
|
81
|
+
|
|
82
|
+
Hash symbol bodies by a stable, line-independent key
|
|
83
|
+
(`{relativePath, name, kind?, containerName?}`). Node ids embed the line, so
|
|
84
|
+
they churn on any edit above the symbol; symbol keys do not. Persist the
|
|
85
|
+
returned `bodyHash` (frozen contract: full 64-hex sha256 of the exact source
|
|
86
|
+
span) and rerun the same query later — a different hash means the body changed.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
occ code symbol-hash --path . --file src/main.ts --name bootstrap --format json
|
|
90
|
+
occ code symbol-hash --path . --queries-json queries.json --format json # batch; - reads stdin
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Per-query statuses: `resolved` / `not_found` / `ambiguous` (with candidates —
|
|
94
|
+
add `--kind` or `--container` to disambiguate) / `error`. Batch entries are
|
|
95
|
+
independent; results align positionally with the queries. Any non-resolved
|
|
96
|
+
result exits nonzero. `spanExact: false` means the parser only gave a
|
|
97
|
+
declaration line (regex-fallback languages) — fall back to file-level hashing.
|
|
98
|
+
|
|
80
99
|
## Syntax checks — `occ code check`
|
|
81
100
|
|
|
82
101
|
Use `check` as a lightweight post-edit parse gate before wider tests. It supports
|
|
@@ -103,6 +122,26 @@ occ code check src/App.vue --format json
|
|
|
103
122
|
`calls`/`callers`/`tree` accept `--file <path>` to disambiguate. Relationships
|
|
104
123
|
report `resolved` / `ambiguous` / `unresolved` status explicitly.
|
|
105
124
|
|
|
125
|
+
## Seams — `occ code seams`
|
|
126
|
+
|
|
127
|
+
Enumerate cross-module seams: import/call edges between directory-modules,
|
|
128
|
+
optionally weighted by git co-change. Use it to find the strongest ungoverned
|
|
129
|
+
relationships in a repo and to durably reference one.
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
occ code seams --path . --since "90 days ago" --limit 20 --format json
|
|
133
|
+
occ code seams --path . --resolve "seam:src::src/code" --format json
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Each seam carries `seamKey` (`seam:` + both modules sorted, `::`-joined),
|
|
137
|
+
`importEdgeCount`, `callEdgeCount`, optional `cochange {count, lift,
|
|
138
|
+
lastCochangedAt}`, and `rank`. `--since` aggregates co-change over full HEAD
|
|
139
|
+
history bounded by the window and works with `--path` below the git toplevel.
|
|
140
|
+
`--min-lift <n>` filters by lift (needs `--since`); `--resolve` answers
|
|
141
|
+
`resolved`/`missing` per key and exits nonzero when anything is missing. A
|
|
142
|
+
directory rename changes the key by design — treat `missing` as drift, never
|
|
143
|
+
as clean.
|
|
144
|
+
|
|
106
145
|
## Change-aware — `occ code diff` / `occ code history`
|
|
107
146
|
|
|
108
147
|
```bash
|
|
@@ -147,6 +186,19 @@ in-process equivalents for the verbs above, plus a few probes with no CLI:
|
|
|
147
186
|
/ `createOcc().code.directoryTree(index, options)` — bounded directory tree
|
|
148
187
|
over indexed files, with `compact`/`verbose`/`map` modes and
|
|
149
188
|
`truncatedPaths` drill-in hints.
|
|
189
|
+
- **`hashCodeSymbols(index, queries, options?)`** / `session.hashSymbols(...)`
|
|
190
|
+
— the batch body-hash primitive behind `occ code symbol-hash`. Facade:
|
|
191
|
+
`createOcc().code.symbolHash`. Gate on
|
|
192
|
+
`health.features?.['code.symbol.bodyHash'] === true`.
|
|
193
|
+
- **`listCodeSeams(index, { cochange?, minLift?, limit? })`** /
|
|
194
|
+
`resolveCodeSeams(index, seamKeys, options?)` / `session.seams(...)` /
|
|
195
|
+
`session.resolveSeams(...)` — seam enumeration and freshness checks. Pure:
|
|
196
|
+
pass a `GitCochangeSummary` from `getGitCochange` to attach co-change (use
|
|
197
|
+
`scope: 'history'` with `since` for a windowed history join, and
|
|
198
|
+
`rebaseCochangeToIndexRoot(summary, prefix)` when the index root sits below
|
|
199
|
+
the git toplevel — git paths are toplevel-relative). Facade:
|
|
200
|
+
`createOcc().code.seams` / `.resolveSeams`; `seamKeyFor(moduleA, moduleB)` is
|
|
201
|
+
exported for key construction. Gate on `health.features?.['code.seams']`.
|
|
150
202
|
- **`store.peekMetadata()` / `store.isFresh()`** — probe a persisted
|
|
151
203
|
`CodeIndexStore` without deserializing or parsing. `peekMetadata()` returns the
|
|
152
204
|
on-disk metadata (available before the first `getSession()` of a process);
|
|
@@ -39,7 +39,9 @@ tabular|json`, `-o <file>`, and `--ci`.
|
|
|
39
39
|
- `occ code pack` — Token-budgeted, importance-ranked pack (file content, optionally compressed).
|
|
40
40
|
- `occ code index` — Build the full codebase index (files, symbols, edges, capabilities).
|
|
41
41
|
- `occ code source <name>` — Read one symbol body by node id (`--node-id`) or disambiguated name.
|
|
42
|
+
- `occ code symbol-hash` — Hash symbol bodies by stable line-independent key (sha256 of the exact source span).
|
|
42
43
|
- `occ code check <file>` — Check a file's syntax without a language server (exits nonzero only when invalid).
|
|
44
|
+
- `occ code dirtree` — Render a bounded directory tree from the built code index.
|
|
43
45
|
- `occ code find name <name>` — Find code elements by exact name.
|
|
44
46
|
- `occ code find pattern <pattern>` — Find code elements by substring pattern.
|
|
45
47
|
- `occ code find type <nodeType>` — List all nodes of a given type.
|
|
@@ -51,6 +53,7 @@ tabular|json`, `-o <file>`, and `--ci`.
|
|
|
51
53
|
- `occ code analyze deps <target>` — Show module/file import relationships.
|
|
52
54
|
- `occ code analyze coupling <target>` — Show module-level coupling metrics.
|
|
53
55
|
- `occ code analyze tree <className>` — Show class/interface inheritance relationships.
|
|
56
|
+
- `occ code seams` — Enumerate cross-module seams (`--since` joins co-change, `--resolve` re-checks keys).
|
|
54
57
|
- `occ code diff` — Show changed symbols for a git diff range.
|
|
55
58
|
- `occ code history <symbol>` — Show git line history for a symbol.
|
|
56
59
|
|
|
@@ -60,6 +63,7 @@ tabular|json`, `-o <file>`, and `--ci`.
|
|
|
60
63
|
- `occ git diff` — Summarize or render the resolved diff (`--patch` for a bounded raw patch).
|
|
61
64
|
- `occ git history [file]` — Show commit history for a range or file.
|
|
62
65
|
- `occ git churn` — Rank changed files by churn.
|
|
66
|
+
- `occ git cochange` — Rank file pairs that historically change together (count + lift).
|
|
63
67
|
|
|
64
68
|
## `occ skills` — Install and inspect the Agent Skills bundled with occ
|
|
65
69
|
|
|
@@ -35,8 +35,11 @@ occ git history src/cli.ts --limit 10
|
|
|
35
35
|
occ git history --since 2025-01-01 --format json
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
Flags: `--limit <n>` (default 50), `--since <date>`, `--
|
|
39
|
-
|
|
38
|
+
Flags: `--limit <n>` (default 50), `--since <date>`, `--scope range|history`
|
|
39
|
+
(default range; `history` logs full HEAD history — the default diff range is
|
|
40
|
+
empty on a clean tree sitting on its base branch), `--follow` (track renames),
|
|
41
|
+
`--line-start <n>` / `--line-end <n>` (for `git log -L` line history). Per-file
|
|
42
|
+
history always logs full HEAD history.
|
|
40
43
|
|
|
41
44
|
## `occ git churn`
|
|
42
45
|
|
|
@@ -47,7 +50,8 @@ occ git churn --sort churn --limit 20 --format json
|
|
|
47
50
|
```
|
|
48
51
|
|
|
49
52
|
Flags: `--sort churn|commits|added|deleted|net` (default churn), `--limit <n>`,
|
|
50
|
-
`--since <date
|
|
53
|
+
`--since <date>`, `--scope range|history` (pair `history` with `--since` for a
|
|
54
|
+
windowed hotspot ranking over full HEAD history).
|
|
51
55
|
|
|
52
56
|
## `occ git cochange`
|
|
53
57
|
|
|
@@ -60,10 +64,12 @@ occ git cochange --target src/cli.ts --format json
|
|
|
60
64
|
occ git cochange --since 2025-01-01 --max-commit-files 30
|
|
61
65
|
```
|
|
62
66
|
|
|
63
|
-
Flags: `--limit <n>`, `--since <date>`, `--
|
|
64
|
-
`--
|
|
67
|
+
Flags: `--limit <n>`, `--since <date>`, `--scope range|history` (pair `history`
|
|
68
|
+
with `--since` for co-change over a real history window), `--target <path>`,
|
|
69
|
+
and `--max-commit-files <n>` (default 50). JSON pairs include `fileA`, `fileB`,
|
|
65
70
|
`count`, `lift`, and `lastCochangedAt`. Co-change is file-level only; use
|
|
66
|
-
`occ code diff` for symbol-level changed-code context.
|
|
71
|
+
`occ code diff` for symbol-level changed-code context. `--scope history`
|
|
72
|
+
rejects `--base`/`--head`/`--staged` (same rule on history/churn).
|
|
67
73
|
|
|
68
74
|
## Symbol-level changes
|
|
69
75
|
|