@c4a/extract-go 0.6.8 → 0.6.9
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 +51 -11
- package/README.zh-CN.md +44 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,18 +1,58 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Go Structure Extraction for Context
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
[简体中文](./README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
`@c4a/extract-go` provides deterministic Go structure facts for Context
|
|
6
|
+
knowledge projects. It extracts declarations, signatures, documentation,
|
|
7
|
+
imports, calls, and common HTTP route registrations without assigning
|
|
8
|
+
product-specific meaning.
|
|
9
|
+
|
|
10
|
+
This is an optional structural package. The Context runtime does not bundle it
|
|
11
|
+
or add a Go lifecycle phase automatically. A knowledge project opts in through
|
|
12
|
+
its own `extractCustom()` adapter, maps the returned facts to project-owned
|
|
13
|
+
candidates, and keeps review, evidence, freshness, close, and build under the
|
|
14
|
+
normal Context workflow.
|
|
15
|
+
|
|
16
|
+
## Place in the knowledge workflow
|
|
17
|
+
|
|
18
|
+
```text
|
|
19
|
+
confirmed Go repository boundary
|
|
20
|
+
↓
|
|
21
|
+
Go structural index
|
|
22
|
+
↓
|
|
23
|
+
project-owned extractCustom() mapping
|
|
24
|
+
↓
|
|
25
|
+
Context candidates → review → approved knowledge
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Public APIs
|
|
6
29
|
|
|
7
30
|
```ts
|
|
8
31
|
import { GoPlugin, indexGoRepository, indexGoSource } from "@c4a/extract-go";
|
|
9
32
|
```
|
|
10
33
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
excluded directories.
|
|
34
|
+
- `GoPlugin` implements the standard `@c4a/extract` plugin protocol.
|
|
35
|
+
- `indexGoSource()` parses one source unit when an adapter needs detailed facts
|
|
36
|
+
before producing candidates.
|
|
37
|
+
- `indexGoRepository()` indexes a repository tree with deterministic controls
|
|
38
|
+
for include roots, tests, generated files, and excluded directories.
|
|
16
39
|
|
|
17
|
-
|
|
18
|
-
|
|
40
|
+
The output remains code-grounded. Package naming, business categories,
|
|
41
|
+
knowledge paths, candidate summaries, and approval decisions belong to the
|
|
42
|
+
knowledge project and its Agent workflow.
|
|
43
|
+
|
|
44
|
+
## When to use it
|
|
45
|
+
|
|
46
|
+
Use this package when a Context workspace needs Go symbols or relationships and
|
|
47
|
+
the project can define how those structures should become knowledge. Do not add
|
|
48
|
+
a generic Go phase solely to avoid writing the project mapping: a language
|
|
49
|
+
parser cannot know the audience, product boundaries, or useful knowledge shape.
|
|
50
|
+
|
|
51
|
+
## Development
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
bun run --filter @c4a/extract-go build
|
|
55
|
+
bun run --filter @c4a/extract-go typecheck
|
|
56
|
+
bun run --filter @c4a/extract-go test
|
|
57
|
+
bun run --filter @c4a/extract-go lint
|
|
58
|
+
```
|
package/README.zh-CN.md
CHANGED
|
@@ -1,15 +1,51 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Context Go 结构提取
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
[English](./README.md)
|
|
4
|
+
|
|
5
|
+
`@c4a/extract-go` 为 Context 知识项目提供确定性的 Go 结构事实。它提取声明、签名、
|
|
6
|
+
源码文档、导入、调用关系和常见 HTTP 路由注册,但不赋予产品专属含义。
|
|
7
|
+
|
|
8
|
+
这是可选结构包。Context 运行时不会内置它,也不会自动增加 Go 生命周期阶段。知识
|
|
9
|
+
项目通过自己的 `extractCustom()` Adapter 显式使用,把结构事实映射成项目候选;
|
|
10
|
+
审核、证据、新鲜度、close 和构建继续由标准 Context 工作流负责。
|
|
11
|
+
|
|
12
|
+
## 在知识生产链中的位置
|
|
13
|
+
|
|
14
|
+
```text
|
|
15
|
+
已确认的 Go 仓库边界
|
|
16
|
+
↓
|
|
17
|
+
Go 结构索引
|
|
18
|
+
↓
|
|
19
|
+
项目自有 extractCustom() 映射
|
|
20
|
+
↓
|
|
21
|
+
Context 候选 → 审核 → 正式知识
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 公开 API
|
|
5
25
|
|
|
6
26
|
```ts
|
|
7
27
|
import { GoPlugin, indexGoRepository, indexGoSource } from "@c4a/extract-go";
|
|
8
28
|
```
|
|
9
29
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
30
|
+
- `GoPlugin` 实现标准 `@c4a/extract` 插件协议;
|
|
31
|
+
- `indexGoSource()` 解析一个源码单元,供 Adapter 在生成候选前读取细粒度事实;
|
|
32
|
+
- `indexGoRepository()` 索引仓库树,并通过确定性参数控制 include root、测试文件、
|
|
33
|
+
生成文件和排除目录。
|
|
13
34
|
|
|
14
|
-
|
|
15
|
-
|
|
35
|
+
输出始终由代码事实支撑。package 命名、业务分类、知识路径、候选摘要和审核决定属于
|
|
36
|
+
知识项目及其 Agent 工作流。
|
|
37
|
+
|
|
38
|
+
## 适用场景
|
|
39
|
+
|
|
40
|
+
当 Context 工作区需要 Go 符号或关系,并且项目能够说明这些结构应该如何转化为知识
|
|
41
|
+
时使用本包。不要仅为了省去项目映射就添加通用 Go phase:语言解析器无法知道目标
|
|
42
|
+
读者、产品边界或有价值的知识形态。
|
|
43
|
+
|
|
44
|
+
## 开发
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
bun run --filter @c4a/extract-go build
|
|
48
|
+
bun run --filter @c4a/extract-go typecheck
|
|
49
|
+
bun run --filter @c4a/extract-go test
|
|
50
|
+
bun run --filter @c4a/extract-go lint
|
|
51
|
+
```
|