@c4a/extract 0.6.0-beta.8 → 0.6.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/LICENSE +21 -0
- package/README.md +8 -19
- package/index.js +229 -1976
- package/package.json +16 -2
- package/wasm/tree-sitter.wasm +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 context4ai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -2,20 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
Code extraction framework for Context. It owns the language-plugin protocol, repository runner, raw code snapshot contract, digest generation, and shared Tree-sitter parsing utilities.
|
|
4
4
|
|
|
5
|
-
## Role
|
|
5
|
+
## Package Role
|
|
6
6
|
|
|
7
7
|
`@c4a/extract` is the protocol and runner layer used by declared Context
|
|
8
|
-
project extraction phases such as `extractTs({ source, collection: "
|
|
8
|
+
project extraction phases such as `extractTs({ source, collection: "codegraph" })`.
|
|
9
9
|
|
|
10
10
|
- Language plugins implement `ExtractionPlugin` and return `ExtractionResult` v2.
|
|
11
|
-
- The runner loads one or more plugins, scans repository modules, emits progress/module-error/summary events, and can build an optional low-level code snapshot payload
|
|
12
|
-
- `@c4a/context-cli` invokes the runner from `context run extract:<source>:
|
|
11
|
+
- The runner loads one or more plugins, scans repository modules, emits progress/module-error/summary events, and can build an optional low-level code snapshot payload.
|
|
12
|
+
- `@c4a/context-cli` invokes the runner from `context run extract:<source>:codegraph` after the workspace declares an `extractTs` phase.
|
|
13
13
|
- The project flow stages review candidates under `unapproved/entities.jsonl` and keeps runtime candidate artifacts under `.tmp/context-runtime/extract/`; approved Markdown is written only by review/apply.
|
|
14
14
|
|
|
15
15
|
**Depends on:** `@c4a/core`, `web-tree-sitter`, `zod`
|
|
16
16
|
|
|
17
|
-
**Depended on by:** `@c4a/extract-ts`, `@c4a/context-cli`, `@c4a/daemon`, `@c4a/e2e`
|
|
18
|
-
|
|
19
17
|
## Protocol Layers
|
|
20
18
|
|
|
21
19
|
### 1. Language Plugin Protocol
|
|
@@ -70,7 +68,7 @@ Every plugin returns:
|
|
|
70
68
|
|
|
71
69
|
The package exposes `c4a-extract-code`, a low-level NDJSON runner. The current
|
|
72
70
|
Context project flow normally reaches it through a declared `extractTs` phase
|
|
73
|
-
and `context run extract:<source>:
|
|
71
|
+
and `context run extract:<source>:codegraph`; agents should not hand-build runner
|
|
74
72
|
input for normal workspace operation.
|
|
75
73
|
|
|
76
74
|
Input is JSON on stdin:
|
|
@@ -195,10 +193,10 @@ render approved knowledge itself.
|
|
|
195
193
|
|
|
196
194
|
- `context source add repo <name> --local <repo-or-subdir>` registers the code
|
|
197
195
|
source boundary.
|
|
198
|
-
- `src/index.ts` declares `extractTs({ source: source("<name>"), collection: "
|
|
199
|
-
- `context run extract:<name>:
|
|
196
|
+
- `src/index.ts` declares `extractTs({ source: source("<name>"), collection: "codegraph" })`.
|
|
197
|
+
- `context run extract:<name>:codegraph --dry-run` previews resolved modules,
|
|
200
198
|
candidate estimates, knowledge path examples, and module warnings.
|
|
201
|
-
- `context run extract:<name>:
|
|
199
|
+
- `context run extract:<name>:codegraph` writes draft candidates for review. It
|
|
202
200
|
uses `.tmp/context-runtime/extract/` for candidate snapshots, source
|
|
203
201
|
fingerprints, and symbol indexes; that scratch directory is not committed
|
|
204
202
|
state.
|
|
@@ -216,12 +214,3 @@ Approved codegraph Markdown localizes canonical refs as
|
|
|
216
214
|
`src-N#symbol:<file>:<symbol>:<kind>@<digest>`. The file segment is part of the
|
|
217
215
|
deterministic evidence identity used by verification; agents copy the complete
|
|
218
216
|
ref as an opaque token.
|
|
219
|
-
|
|
220
|
-
## Development
|
|
221
|
-
|
|
222
|
-
```bash
|
|
223
|
-
bun run --filter @c4a/extract build
|
|
224
|
-
bun run --filter @c4a/extract typecheck
|
|
225
|
-
bun run --filter @c4a/extract test
|
|
226
|
-
bun run --filter @c4a/extract lint
|
|
227
|
-
```
|