@cesarandreslopez/occ 0.9.3 → 0.11.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.
- package/README.md +35 -6
- package/dist/src/cli.d.ts +16 -0
- package/dist/src/cli.js +46 -4
- package/dist/src/cli.js.map +1 -1
- package/dist/src/code/build.d.ts +22 -0
- package/dist/src/code/build.js +47 -13
- package/dist/src/code/build.js.map +1 -1
- package/dist/src/code/cache.js +30 -1
- package/dist/src/code/cache.js.map +1 -1
- package/dist/src/code/check.d.ts +39 -0
- package/dist/src/code/check.js +282 -0
- package/dist/src/code/check.js.map +1 -0
- package/dist/src/code/command.js +156 -64
- package/dist/src/code/command.js.map +1 -1
- package/dist/src/code/context.d.ts +54 -0
- package/dist/src/code/context.js +67 -0
- package/dist/src/code/context.js.map +1 -0
- package/dist/src/code/diff.d.ts +12 -2
- package/dist/src/code/diff.js +15 -3
- package/dist/src/code/diff.js.map +1 -1
- package/dist/src/code/discover.d.ts +2 -2
- package/dist/src/code/discover.js +8 -10
- package/dist/src/code/discover.js.map +1 -1
- package/dist/src/code/focus.js +34 -26
- package/dist/src/code/focus.js.map +1 -1
- package/dist/src/code/incremental.js +1 -1
- package/dist/src/code/incremental.js.map +1 -1
- package/dist/src/code/index-io.js +10 -2
- package/dist/src/code/index-io.js.map +1 -1
- package/dist/src/code/isolated-chunk-runner.js +17 -2
- package/dist/src/code/isolated-chunk-runner.js.map +1 -1
- package/dist/src/code/isolated-runner.js +17 -3
- package/dist/src/code/isolated-runner.js.map +1 -1
- package/dist/src/code/isolated.js +32 -6
- package/dist/src/code/isolated.js.map +1 -1
- package/dist/src/code/languages.d.ts +13 -0
- package/dist/src/code/languages.js +138 -5
- package/dist/src/code/languages.js.map +1 -1
- package/dist/src/code/map.d.ts +56 -0
- package/dist/src/code/map.js +161 -12
- package/dist/src/code/map.js.map +1 -1
- package/dist/src/code/parsers.js +367 -26
- package/dist/src/code/parsers.js.map +1 -1
- package/dist/src/code/preview.js +24 -22
- package/dist/src/code/preview.js.map +1 -1
- package/dist/src/code/query.js +0 -0
- package/dist/src/code/query.js.map +1 -1
- package/dist/src/code/search.d.ts +39 -0
- package/dist/src/code/search.js +154 -0
- package/dist/src/code/search.js.map +1 -0
- package/dist/src/code/session.d.ts +8 -2
- package/dist/src/code/session.js +16 -4
- package/dist/src/code/session.js.map +1 -1
- package/dist/src/code/slim.d.ts +2 -0
- package/dist/src/code/slim.js +16 -1
- package/dist/src/code/slim.js.map +1 -1
- package/dist/src/code/source.d.ts +44 -0
- package/dist/src/code/source.js +102 -0
- package/dist/src/code/source.js.map +1 -0
- package/dist/src/code/store.d.ts +23 -0
- package/dist/src/code/store.js +61 -6
- package/dist/src/code/store.js.map +1 -1
- package/dist/src/code/tree-sitter.d.ts +21 -0
- package/dist/src/code/tree-sitter.js +128 -0
- package/dist/src/code/tree-sitter.js.map +1 -0
- package/dist/src/code/types.d.ts +3 -0
- package/dist/src/code/types.js +2 -0
- package/dist/src/code/types.js.map +1 -1
- package/dist/src/doc/batch.d.ts +2 -0
- package/dist/src/doc/batch.js +3 -1
- package/dist/src/doc/batch.js.map +1 -1
- package/dist/src/doc/discover.js +2 -2
- package/dist/src/doc/discover.js.map +1 -1
- package/dist/src/doc/inspect-odt.js +3 -1
- package/dist/src/doc/inspect-odt.js.map +1 -1
- package/dist/src/doc/inspect-pdf.d.ts +6 -0
- package/dist/src/doc/inspect-pdf.js +11 -1
- package/dist/src/doc/inspect-pdf.js.map +1 -1
- package/dist/src/doc/inspect.js +2 -2
- package/dist/src/doc/inspect.js.map +1 -1
- package/dist/src/doc/types.d.ts +1 -0
- package/dist/src/doc/types.js +7 -0
- package/dist/src/doc/types.js.map +1 -1
- package/dist/src/git/api.d.ts +2 -1
- package/dist/src/git/api.js +15 -9
- package/dist/src/git/api.js.map +1 -1
- package/dist/src/git/client.js +5 -1
- package/dist/src/git/client.js.map +1 -1
- package/dist/src/git/output.js +2 -1
- package/dist/src/git/output.js.map +1 -1
- package/dist/src/git/parse.js +131 -2
- package/dist/src/git/parse.js.map +1 -1
- package/dist/src/git/types.d.ts +5 -5
- package/dist/src/health.d.ts +8 -0
- package/dist/src/health.js +12 -0
- package/dist/src/health.js.map +1 -1
- package/dist/src/index.d.ts +20 -6
- package/dist/src/index.js +13 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/inspect/xlsx-cells.js +4 -2
- package/dist/src/inspect/xlsx-cells.js.map +1 -1
- package/dist/src/markdown/convert.d.ts +9 -0
- package/dist/src/markdown/convert.js +23 -1
- package/dist/src/markdown/convert.js.map +1 -1
- package/dist/src/parsers/odf.js +4 -2
- package/dist/src/parsers/odf.js.map +1 -1
- package/dist/src/skills/command.d.ts +6 -0
- package/dist/src/skills/command.js +18 -3
- package/dist/src/skills/command.js.map +1 -1
- package/dist/src/slide/inspect-odp.js +3 -2
- package/dist/src/slide/inspect-odp.js.map +1 -1
- package/dist/src/slide/inspect-pptx.js +4 -3
- package/dist/src/slide/inspect-pptx.js.map +1 -1
- package/dist/src/stats.js +3 -1
- package/dist/src/stats.js.map +1 -1
- package/dist/src/structure/extract.js +16 -3
- package/dist/src/structure/extract.js.map +1 -1
- package/dist/src/utils.d.ts +7 -0
- package/dist/src/utils.js +19 -0
- package/dist/src/utils.js.map +1 -1
- package/dist/src/walker.js +15 -3
- package/dist/src/walker.js.map +1 -1
- package/dist/src/workspace/analyze.d.ts +3 -0
- package/dist/src/workspace/analyze.js +26 -15
- package/dist/src/workspace/analyze.js.map +1 -1
- package/dist/src/workspace/bundle.js +11 -3
- package/dist/src/workspace/bundle.js.map +1 -1
- package/dist/src/workspace/command.d.ts +6 -0
- package/dist/src/workspace/command.js +73 -44
- package/dist/src/workspace/command.js.map +1 -1
- package/dist/src/workspace/describe.js +22 -13
- package/dist/src/workspace/describe.js.map +1 -1
- package/dist/src/workspace/documents.d.ts +3 -0
- package/dist/src/workspace/documents.js +25 -14
- package/dist/src/workspace/documents.js.map +1 -1
- package/dist/src/workspace/prepare.js +3 -1
- package/dist/src/workspace/prepare.js.map +1 -1
- package/package.json +28 -12
- package/skills/occ/SKILL.md +17 -5
- package/skills/occ/reference/code.md +76 -3
- package/skills/occ/reference/commands.md +3 -1
- package/vendor/tree-sitter/c/grammar.wasm +0 -0
- package/vendor/tree-sitter/c/tags.scm +4 -0
- package/vendor/tree-sitter/c-sharp/grammar.wasm +0 -0
- package/vendor/tree-sitter/c-sharp/tags.scm +6 -0
- package/vendor/tree-sitter/cpp/grammar.wasm +0 -0
- package/vendor/tree-sitter/cpp/tags.scm +5 -0
- package/vendor/tree-sitter/go/grammar.wasm +0 -0
- package/vendor/tree-sitter/go/tags.scm +4 -0
- package/vendor/tree-sitter/java/grammar.wasm +0 -0
- package/vendor/tree-sitter/java/tags.scm +7 -0
- package/vendor/tree-sitter/kotlin/grammar.wasm +0 -0
- package/vendor/tree-sitter/kotlin/tags.scm +4 -0
- package/vendor/tree-sitter/php/grammar.wasm +0 -0
- package/vendor/tree-sitter/php/tags.scm +8 -0
- package/vendor/tree-sitter/python/grammar.wasm +0 -0
- package/vendor/tree-sitter/python/tags.scm +3 -0
- package/vendor/tree-sitter/ruby/grammar.wasm +0 -0
- package/vendor/tree-sitter/ruby/tags.scm +5 -0
- package/vendor/tree-sitter/rust/grammar.wasm +0 -0
- package/vendor/tree-sitter/rust/tags.scm +5 -0
- package/vendor/tree-sitter/scala/grammar.wasm +0 -0
- package/vendor/tree-sitter/scala/tags.scm +5 -0
- package/vendor/tree-sitter/swift/grammar.wasm +0 -0
- package/vendor/tree-sitter/swift/tags.scm +4 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# Code exploration for agents
|
|
2
2
|
|
|
3
|
-
`occ code` builds an in-memory code graph (no database, no daemon) for JS/TS
|
|
4
|
-
Vue SFC
|
|
3
|
+
`occ code` builds an in-memory code graph (no database, no daemon) for JS/TS
|
|
4
|
+
and Vue SFC (type-accurate) plus Python, Go, Rust, Java, C/C++, C#, Kotlin,
|
|
5
|
+
Scala, Swift, Ruby, and PHP (tree-sitter). Shared flags on every `code` subcommand: `--path
|
|
5
6
|
<repo-root>` (default cwd), `--format json`, `-o <file>`, `--exclude-dir`,
|
|
6
7
|
`--no-gitignore`, `--content-mode none|excerpt|full`, `--max-file-size-bytes
|
|
7
8
|
<n>`, `--max-lines <n>`.
|
|
@@ -41,6 +42,38 @@ occ code map --path . --changed-from main --map-tokens 4096 # diff-focused map
|
|
|
41
42
|
|
|
42
43
|
All accept `--limit <n>` (default 50) and `--format json`.
|
|
43
44
|
|
|
45
|
+
## Source reads — `occ code source`
|
|
46
|
+
|
|
47
|
+
Use `source` when you already know the symbol and need its exact body without
|
|
48
|
+
reading the whole file. Prefer this for named symbols; use `rg`/shell reads for
|
|
49
|
+
text, config, and quick facts.
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
occ code map --path . --map-format json --map-tokens 4096 -o map.json
|
|
53
|
+
occ code source --path . --node-id "<nodeId>" --format json
|
|
54
|
+
occ code source bootstrap --path . --file src/main.ts --type function --format json
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
JSON repo-map symbols include `nodeId`, `endLine`, and `containerName`. The
|
|
58
|
+
current node-id contract is OCC's existing graph id derived from the indexed
|
|
59
|
+
node: `<type>:<absolute-path>:<name>:<line>[:<containerName>]`. The line number
|
|
60
|
+
is part of the address, so ids can change after edits; re-run `code map` or
|
|
61
|
+
`code find name` after moving a symbol.
|
|
62
|
+
|
|
63
|
+
## Syntax checks — `occ code check`
|
|
64
|
+
|
|
65
|
+
Use `check` as a lightweight post-edit parse gate before wider tests. It supports
|
|
66
|
+
TS/JS, Vue SFCs, Python, and the vendored tree-sitter languages (Go, Rust, Java,
|
|
67
|
+
C/C++, C#, Kotlin, Scala, Swift, Ruby, PHP); unsupported files exit 0 with
|
|
68
|
+
`status: "unsupported"` so they do not fail CI accidentally.
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
occ code check src/main.ts --format json
|
|
72
|
+
occ code check src/App.vue --format json
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`occ code check` exits nonzero only when `valid` is `false`.
|
|
76
|
+
|
|
44
77
|
## Relationships — `occ code analyze <kind>`
|
|
45
78
|
|
|
46
79
|
- `occ code analyze calls <fn>` — what a function calls (outgoing).
|
|
@@ -66,4 +99,44 @@ occ code history buildRepoMap --format json # git line history f
|
|
|
66
99
|
## Full index — `occ code index`
|
|
67
100
|
|
|
68
101
|
Build/dump the full codebase index (files, symbols, edges, capabilities). Heavy;
|
|
69
|
-
prefer `map`/`find`/`analyze` for targeted questions.
|
|
102
|
+
prefer `map`/`find`/`analyze` for targeted questions. Each `files[].symbols[]`
|
|
103
|
+
entry carries a `nodeId`, so a consumer can jump from a file symbol straight to
|
|
104
|
+
its graph node (and to `occ code source --node-id <id>`) without scanning
|
|
105
|
+
`nodes`.
|
|
106
|
+
|
|
107
|
+
## Programmatic surface — for long-running hosts
|
|
108
|
+
|
|
109
|
+
Editor/agent integrations that embed `occ` — holding an index or a
|
|
110
|
+
`CodeQuerySession` across turns instead of shelling out per call — have
|
|
111
|
+
in-process equivalents for the verbs above, plus a few probes with no CLI:
|
|
112
|
+
|
|
113
|
+
- **`searchSymbols(index, query, { limit, kinds, pathFilter })`** /
|
|
114
|
+
`session.searchSymbols(...)` — fuzzy symbol search across name,
|
|
115
|
+
container-qualified name, and file path. Each result carries a `score`, the
|
|
116
|
+
matched `positions`/`span` (for highlighting), and a `nodeId` for a follow-up
|
|
117
|
+
source read. The corpus is memoized per index, so repeated queries in a
|
|
118
|
+
long-lived host pay the build once. Facade: `createOcc().code.searchSymbols`.
|
|
119
|
+
From the shell, reach for `occ code find` instead.
|
|
120
|
+
- **`buildCodeContext(index)`** / `session.projectContext()` — project a full or
|
|
121
|
+
slim index down to per-file exported symbols, a deduplicated local import
|
|
122
|
+
graph, and external dependency roots. Pure and synchronous; the shape hosts
|
|
123
|
+
hand to a model or a graph view. Facade: `createOcc().code.context`.
|
|
124
|
+
- **`buildChangedRepoMap(index, { changed: { base, head } | { staged: true }, ...mapOptions })`**
|
|
125
|
+
— the `--changed-from` map on the API: changed files join the focus set and
|
|
126
|
+
admitted entries carry `changed`/`churn`. `toRepoMapChangeContext` /
|
|
127
|
+
`stampRepoMapChanges` are exported for callers that already hold a diff
|
|
128
|
+
summary. Facade: `createOcc().code.mapChanged`.
|
|
129
|
+
- **`store.peekMetadata()` / `store.isFresh()`** — probe a persisted
|
|
130
|
+
`CodeIndexStore` without deserializing or parsing. `peekMetadata()` returns the
|
|
131
|
+
on-disk metadata (available before the first `getSession()` of a process);
|
|
132
|
+
`isFresh()` stat-diffs the working tree against the persisted manifest
|
|
133
|
+
(`added`/`modified`/`deleted` counts). Both validate the cache entry belongs to
|
|
134
|
+
this repo, options, and occ version — use them to decide whether to rebuild
|
|
135
|
+
before serving a session.
|
|
136
|
+
- **`health().features`** — a map of stable feature identifiers (e.g.
|
|
137
|
+
`code.searchSymbols`, `store.isFresh`, `code.map.changed`). Feature-detect
|
|
138
|
+
against it (`health.features?.['store.isFresh'] === true`) instead of
|
|
139
|
+
`typeof`-probing when a host must support multiple occ versions.
|
|
140
|
+
|
|
141
|
+
`createCodeQuerySession(options, onProgress?, signal?)` and
|
|
142
|
+
`session.refresh(onProgress?, signal?)` accept an `AbortSignal` for cancellation.
|
|
@@ -33,11 +33,13 @@ tabular|json`, `-o <file>`, and `--ci`.
|
|
|
33
33
|
|
|
34
34
|
- `occ table inspect <file>` — Extract structured table data from DOCX, XLSX, PPTX, ODT, or ODP documents.
|
|
35
35
|
|
|
36
|
-
## `occ code` — Explore code structure
|
|
36
|
+
## `occ code` — Explore code structure (type-accurate JS/TS + Vue SFC, tree-sitter for 12 more languages)
|
|
37
37
|
|
|
38
38
|
- `occ code map` — Token-budgeted, importance-ranked repo map (top symbol signatures per file).
|
|
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
|
+
- `occ code source <name>` — Read one symbol body by node id (`--node-id`) or disambiguated name.
|
|
42
|
+
- `occ code check <file>` — Check a file's syntax without a language server (exits nonzero only when invalid).
|
|
41
43
|
- `occ code find name <name>` — Find code elements by exact name.
|
|
42
44
|
- `occ code find pattern <pattern>` — Find code elements by substring pattern.
|
|
43
45
|
- `occ code find type <nodeType>` — List all nodes of a given type.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
(method_declaration) @definition.method
|
|
2
|
+
(constructor_declaration) @definition.method
|
|
3
|
+
(class_declaration) @definition.class
|
|
4
|
+
(interface_declaration) @definition.interface
|
|
5
|
+
(enum_declaration) @definition.enum
|
|
6
|
+
(method_invocation) @reference.call
|
|
7
|
+
(object_creation_expression) @reference.call
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
(function_definition) @definition.function
|
|
2
|
+
(method_declaration) @definition.method
|
|
3
|
+
(class_declaration) @definition.class
|
|
4
|
+
(interface_declaration) @definition.interface
|
|
5
|
+
(trait_declaration) @definition.class
|
|
6
|
+
(function_call_expression) @reference.call
|
|
7
|
+
(member_call_expression) @reference.call
|
|
8
|
+
(scoped_call_expression) @reference.call
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|