@handsupmin/gc-tree 0.1.4 → 0.2.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.es.md +135 -119
- package/README.ja.md +136 -120
- package/README.ko.md +137 -121
- package/README.md +134 -118
- package/README.zh.md +140 -123
- package/dist/src/resolve.js +40 -6
- package/docs/concept.es.md +45 -33
- package/docs/concept.ja.md +41 -29
- package/docs/concept.ko.md +48 -36
- package/docs/concept.md +13 -1
- package/docs/concept.zh.md +48 -36
- package/docs/local-development.es.md +44 -22
- package/docs/local-development.ja.md +40 -18
- package/docs/local-development.ko.md +47 -25
- package/docs/local-development.md +27 -5
- package/docs/local-development.zh.md +27 -5
- package/docs/principles.es.md +39 -26
- package/docs/principles.ja.md +26 -13
- package/docs/principles.ko.md +40 -27
- package/docs/principles.md +15 -2
- package/docs/principles.zh.md +42 -29
- package/docs/usage.es.md +98 -50
- package/docs/usage.ja.md +71 -23
- package/docs/usage.ko.md +100 -52
- package/docs/usage.md +51 -3
- package/docs/usage.zh.md +95 -47
- package/package.json +11 -2
package/docs/usage.md
CHANGED
|
@@ -36,7 +36,33 @@ A standard `gctree` workflow looks like this: initialize gc-tree, choose a provi
|
|
|
36
36
|
| `gctree reset-gc-branch --branch <name> --yes` | Clear a gc-branch so it can be onboarded again. |
|
|
37
37
|
| `gctree update-global-context` | Launch a guided durable update for the active gc-branch. |
|
|
38
38
|
| `gctree update-gc` / `gctree ugc` | Aliases for `gctree update-global-context`. |
|
|
39
|
-
| `gctree scaffold --host <codex
|
|
39
|
+
| `gctree scaffold --host <codex\|claude-code>` | Install the provider-facing command surface in another environment. |
|
|
40
|
+
|
|
41
|
+
## What resolve returns
|
|
42
|
+
|
|
43
|
+
`gctree resolve` scores every document in the active gc-branch against your query and returns only the matching ones. Title matches count twice as much as body matches.
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
gctree resolve --query "auth token rotation policy"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"gc_branch": "main",
|
|
52
|
+
"query": "auth token rotation policy",
|
|
53
|
+
"matches": [
|
|
54
|
+
{
|
|
55
|
+
"title": "Auth & Session Conventions",
|
|
56
|
+
"path": "docs/auth.md",
|
|
57
|
+
"score": 4,
|
|
58
|
+
"summary": "JWT rotation on every request, refresh tokens in httpOnly cookies, 15-min access token TTL",
|
|
59
|
+
"excerpt": "## Auth Flow\nAccess token: 15-min TTL, rotated on every authenticated request..."
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The tool receives the summary and excerpt first. It reads the full document at `path` only when the summary is not enough. A query that matches nothing returns `"matches": []`.
|
|
40
66
|
|
|
41
67
|
## Example repo-scope flow
|
|
42
68
|
|
|
@@ -107,14 +133,36 @@ If a newly relevant repo should also become part of the durable context, the nat
|
|
|
107
133
|
|
|
108
134
|
### Codex CLI / Claude Code CLI
|
|
109
135
|
|
|
110
|
-
`gctree scaffold` installs provider-facing
|
|
111
|
-
Those commands should explicitly mention the current active gc-branch before they start gathering or applying durable context, and they should keep using the saved workflow language unless the user explicitly asks to switch.
|
|
136
|
+
`gctree scaffold` installs provider-facing command files into the target directory.
|
|
112
137
|
|
|
113
138
|
```bash
|
|
114
139
|
gctree scaffold --host codex --target /path/to/repo
|
|
115
140
|
gctree scaffold --host claude-code --target /path/to/repo
|
|
141
|
+
gctree scaffold --host both --target /path/to/repo
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Files written for `--host codex`:**
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
AGENTS.md ← gctree snippet appended to agent instructions
|
|
148
|
+
.codex/prompts/gctree-bootstrap.md ← bootstrap context for Codex sessions
|
|
149
|
+
.codex/skills/gc-resolve-context/SKILL.md ← resolve skill
|
|
150
|
+
.codex/skills/gc-onboard/SKILL.md ← onboarding skill
|
|
151
|
+
.codex/skills/gc-update-global-context/SKILL.md ← update skill
|
|
116
152
|
```
|
|
117
153
|
|
|
154
|
+
**Files written for `--host claude-code`:**
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
CLAUDE.md ← gctree snippet appended
|
|
158
|
+
.claude/hooks/gctree-session-start.md ← session-start hook
|
|
159
|
+
.claude/commands/gc-resolve-context.md ← resolve slash command
|
|
160
|
+
.claude/commands/gc-onboard.md ← onboard slash command
|
|
161
|
+
.claude/commands/gc-update-global-context.md ← update slash command
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Existing files are left untouched unless you pass `--force`.
|
|
165
|
+
|
|
118
166
|
### Runtime behavior
|
|
119
167
|
|
|
120
168
|
The active gc-branch is the one pointed to by `HEAD` inside `~/.gctree`, but repo mapping can override that fallback when a repository is explicitly bound to another gc-branch.
|
package/docs/usage.zh.md
CHANGED
|
@@ -1,48 +1,74 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 使用指南
|
|
2
2
|
|
|
3
3
|
[English](usage.md) | [한국어](usage.ko.md) | [简体中文](usage.zh.md) | [日本語](usage.ja.md) | [Español](usage.es.md)
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## 概述
|
|
6
6
|
|
|
7
|
-
标准的 `gctree`
|
|
7
|
+
标准的 `gctree` 工作流如下:初始化 gc-tree、选择提供商、对默认的 `main` gc-branch 执行 onboard、解析所需上下文、在工作需要独立空间时创建新的 gc-branch、将代码仓库映射到正确的 gc-branch,以及在后续使用有引导的更新流程进行持久化变更。
|
|
8
8
|
|
|
9
9
|
## 标准工作流
|
|
10
10
|
|
|
11
11
|
1. 运行 `gctree init`
|
|
12
|
-
2.
|
|
12
|
+
2. 选择首选的提供商模式(`claude-code`、`codex` 或 `both`)
|
|
13
13
|
3. 选择工作流语言(`English`、`Korean` 或自定义语言)
|
|
14
|
-
4.
|
|
15
|
-
5.
|
|
16
|
-
6.
|
|
17
|
-
7.
|
|
18
|
-
8. `gctree onboard`
|
|
19
|
-
9.
|
|
20
|
-
10.
|
|
14
|
+
4. 如果选择了 `both`,选择哪个提供商现在开始 onboarding
|
|
15
|
+
5. 对默认的 `main` gc-branch 完成有引导的 onboarding
|
|
16
|
+
6. 使用 `gctree resolve --query "..."` 解析相关上下文
|
|
17
|
+
7. 使用 `gctree checkout` 创建或切换 gc-branch
|
|
18
|
+
8. 仅对空的 gc-branch 运行 `gctree onboard`
|
|
19
|
+
9. 使用仓库作用范围映射,使 gc-branch 只在其适用的地方生效
|
|
20
|
+
10. 使用 `gctree update-global-context` 进行后续的持久化变更
|
|
21
21
|
|
|
22
22
|
## 核心命令
|
|
23
23
|
|
|
24
24
|
| 命令 | 用途 |
|
|
25
25
|
| --- | --- |
|
|
26
|
-
| `gctree init` | 创建 `~/.gctree
|
|
27
|
-
| `gctree checkout <branch>` |
|
|
28
|
-
| `gctree checkout -b <branch>` |
|
|
29
|
-
| `gctree branches` | 列出可用的 gc-branch
|
|
30
|
-
| `gctree status` |
|
|
31
|
-
| `gctree resolve --query TEXT` |
|
|
32
|
-
| `gctree repo-map` |
|
|
33
|
-
| `gctree set-repo-scope --branch <name> --include` |
|
|
34
|
-
| `gctree set-repo-scope --branch <name> --exclude` |
|
|
35
|
-
| `gctree onboard` |
|
|
36
|
-
| `gctree reset-gc-branch --branch <name> --yes` |
|
|
37
|
-
| `gctree update-global-context` |
|
|
38
|
-
| `gctree update-gc` / `gctree ugc` | `gctree update-global-context`
|
|
39
|
-
| `gctree scaffold --host <codex
|
|
40
|
-
|
|
41
|
-
##
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
26
|
+
| `gctree init` | 创建 `~/.gctree`,创建默认的 `main` gc-branch,保存提供商模式、onboarding 提供商及首选语言,scaffold 当前环境,并在 `main` 为空时启动有引导的 onboarding。 |
|
|
27
|
+
| `gctree checkout <branch>` | 切换活跃的 gc-branch。 |
|
|
28
|
+
| `gctree checkout -b <branch>` | 创建并切换到一个新的空 gc-branch。 |
|
|
29
|
+
| `gctree branches` | 列出可用的 gc-branch 并显示当前活跃的那个。 |
|
|
30
|
+
| `gctree status` | 显示活跃的 gc-branch、当前仓库、当前仓库的作用范围状态、警告信息及首选提供商。 |
|
|
31
|
+
| `gctree resolve --query TEXT` | 在相关的 gc-branch 中搜索上下文。如果当前仓库尚未映射,`gctree` 会询问该如何处理这个仓库。 |
|
|
32
|
+
| `gctree repo-map` | 显示 `branch-repo-map.json` 的当前内容。 |
|
|
33
|
+
| `gctree set-repo-scope --branch <name> --include` | 将当前仓库标记为该 gc-branch 的包含仓库。 |
|
|
34
|
+
| `gctree set-repo-scope --branch <name> --exclude` | 将当前仓库标记为该 gc-branch 的忽略仓库。 |
|
|
35
|
+
| `gctree onboard` | 为活跃的 gc-branch 启动有引导的 onboarding。仅当该 gc-branch 为空时有效。 |
|
|
36
|
+
| `gctree reset-gc-branch --branch <name> --yes` | 清空一个 gc-branch,使其可以重新 onboard。 |
|
|
37
|
+
| `gctree update-global-context` | 为活跃的 gc-branch 启动有引导的持久化更新。 |
|
|
38
|
+
| `gctree update-gc` / `gctree ugc` | `gctree update-global-context` 的别名。 |
|
|
39
|
+
| `gctree scaffold --host <codex\|claude-code>` | 在另一个环境中安装面向提供商的命令接口。 |
|
|
40
|
+
|
|
41
|
+
## resolve 返回的内容
|
|
42
|
+
|
|
43
|
+
`gctree resolve` 对活跃 gc-branch 中的每个文档与查询内容进行评分,只返回匹配的文档。标题匹配的权重是正文匹配的两倍。
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
gctree resolve --query "auth token rotation policy"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"gc_branch": "main",
|
|
52
|
+
"query": "auth token rotation policy",
|
|
53
|
+
"matches": [
|
|
54
|
+
{
|
|
55
|
+
"title": "Auth & Session Conventions",
|
|
56
|
+
"path": "docs/auth.md",
|
|
57
|
+
"score": 4,
|
|
58
|
+
"summary": "JWT rotation on every request, refresh tokens in httpOnly cookies, 15-min access token TTL",
|
|
59
|
+
"excerpt": "## Auth Flow\nAccess token: 15-min TTL, rotated on every authenticated request..."
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
工具首先接收摘要和摘录。只有在摘要不足以满足需求时,才会读取 `path` 指向的完整文档。如果查询没有任何匹配,则返回 `"matches": []`。
|
|
66
|
+
|
|
67
|
+
## 仓库作用范围示例流程
|
|
68
|
+
|
|
69
|
+
假设 gc-branch `A` 与代码仓库 `B`、`C` 和 `D` 相关,但与 `F` 无关。
|
|
70
|
+
|
|
71
|
+
可以通过以下方式管理:
|
|
46
72
|
|
|
47
73
|
```json
|
|
48
74
|
{
|
|
@@ -53,19 +79,19 @@
|
|
|
53
79
|
}
|
|
54
80
|
```
|
|
55
81
|
|
|
56
|
-
|
|
82
|
+
存储在:
|
|
57
83
|
|
|
58
84
|
```text
|
|
59
85
|
~/.gctree/branch-repo-map.json
|
|
60
86
|
```
|
|
61
87
|
|
|
62
|
-
|
|
88
|
+
当 `resolve` 在代码仓库 `E` 中运行,而分支 `A` 尚未在 `E` 中映射时,`gctree` 会询问:
|
|
63
89
|
|
|
64
|
-
1.
|
|
65
|
-
2.
|
|
90
|
+
1. 继续一次
|
|
91
|
+
2. 始终在 `E` 中使用 `A`
|
|
66
92
|
3. 在 `E` 中忽略 `A`
|
|
67
93
|
|
|
68
|
-
##
|
|
94
|
+
## 首次运行示例流程
|
|
69
95
|
|
|
70
96
|
```bash
|
|
71
97
|
gctree init
|
|
@@ -74,10 +100,10 @@ gctree init
|
|
|
74
100
|
然后:
|
|
75
101
|
|
|
76
102
|
1. 选择 `codex` 或 `claude-code`
|
|
77
|
-
2. 让 `gctree`
|
|
78
|
-
3.
|
|
103
|
+
2. 让 `gctree` scaffold 当前环境
|
|
104
|
+
3. 对 `main` gc-branch 完成有引导的 onboarding
|
|
79
105
|
|
|
80
|
-
##
|
|
106
|
+
## 多分支示例流程
|
|
81
107
|
|
|
82
108
|
```bash
|
|
83
109
|
gctree checkout -b client-b
|
|
@@ -85,7 +111,7 @@ gctree onboard
|
|
|
85
111
|
gctree resolve --query "billing retry policy"
|
|
86
112
|
```
|
|
87
113
|
|
|
88
|
-
##
|
|
114
|
+
## 更新示例流程
|
|
89
115
|
|
|
90
116
|
```bash
|
|
91
117
|
gctree update-global-context
|
|
@@ -98,24 +124,46 @@ gctree update-gc
|
|
|
98
124
|
gctree ugc
|
|
99
125
|
```
|
|
100
126
|
|
|
101
|
-
|
|
127
|
+
如果一个新相关的代码仓库也需要成为持久化上下文的一部分,自然的流程是:
|
|
102
128
|
|
|
103
|
-
1.
|
|
104
|
-
2.
|
|
129
|
+
1. 将该仓库映射到 gc-branch
|
|
130
|
+
2. 然后运行 `update-global-context`,添加关于该仓库用途及重要性的持久化知识
|
|
105
131
|
|
|
106
132
|
## 集成模式
|
|
107
133
|
|
|
108
134
|
### Codex CLI / Claude Code CLI
|
|
109
135
|
|
|
110
|
-
`gctree scaffold`
|
|
111
|
-
这些命令在开始收集或应用长期上下文之前,都应该明确说明当前激活的是哪条 gc-branch,并且除非用户明确要求切换,否则应继续使用已经保存的工作流语言。
|
|
136
|
+
`gctree scaffold` 将面向提供商的命令文件安装到目标目录中。
|
|
112
137
|
|
|
113
138
|
```bash
|
|
114
139
|
gctree scaffold --host codex --target /path/to/repo
|
|
115
140
|
gctree scaffold --host claude-code --target /path/to/repo
|
|
141
|
+
gctree scaffold --host both --target /path/to/repo
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**`--host codex` 写入的文件:**
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
AGENTS.md ← gctree 代码片段追加到 agent 指令中
|
|
148
|
+
.codex/prompts/gctree-bootstrap.md ← Codex 会话的引导上下文
|
|
149
|
+
.codex/skills/gc-resolve-context/SKILL.md ← resolve 技能
|
|
150
|
+
.codex/skills/gc-onboard/SKILL.md ← onboarding 技能
|
|
151
|
+
.codex/skills/gc-update-global-context/SKILL.md ← 更新技能
|
|
116
152
|
```
|
|
117
153
|
|
|
154
|
+
**`--host claude-code` 写入的文件:**
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
CLAUDE.md ← gctree 代码片段追加
|
|
158
|
+
.claude/hooks/gctree-session-start.md ← 会话启动钩子
|
|
159
|
+
.claude/commands/gc-resolve-context.md ← resolve 斜杠命令
|
|
160
|
+
.claude/commands/gc-onboard.md ← onboard 斜杠命令
|
|
161
|
+
.claude/commands/gc-update-global-context.md ← 更新斜杠命令
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
除非传入 `--force`,否则已有文件不会被修改。
|
|
165
|
+
|
|
118
166
|
### 运行时行为
|
|
119
167
|
|
|
120
|
-
|
|
121
|
-
这使得 gc-tree
|
|
168
|
+
活跃的 gc-branch 由 `~/.gctree` 内的 `HEAD` 指向,但当一个代码仓库被显式绑定到另一个 gc-branch 时,仓库映射可以覆盖这一后备设置。
|
|
169
|
+
这使得 gc-tree 对于同时保持大量无关会话的重度用户而言非常实用。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@handsupmin/gc-tree",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Global Context Tree, a lightweight branch-aware global context orchestrator for AI coding tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -18,7 +18,16 @@
|
|
|
18
18
|
"scripts": {
|
|
19
19
|
"build": "tsc -p tsconfig.json",
|
|
20
20
|
"test": "node --import tsx --test tests/*.test.ts",
|
|
21
|
-
"prepack": "npm run build"
|
|
21
|
+
"prepack": "npm run build",
|
|
22
|
+
"eval": "node --import tsx tests/eval/index.ts",
|
|
23
|
+
"eval:verbose": "node --import tsx tests/eval/index.ts --verbose",
|
|
24
|
+
"eval:multi-repo": "node --import tsx tests/eval/multi-repo.ts",
|
|
25
|
+
"eval:multi-repo:verbose": "node --import tsx tests/eval/multi-repo.ts --verbose",
|
|
26
|
+
"eval:autoresearch": "node --import tsx tests/eval/autoresearch.ts",
|
|
27
|
+
"eval:multilingual": "node --import tsx tests/eval/multilingual.ts",
|
|
28
|
+
"eval:multilingual:verbose": "node --import tsx tests/eval/multilingual.ts --verbose",
|
|
29
|
+
"eval:real-docs": "node --import tsx tests/eval/real-docs.ts",
|
|
30
|
+
"eval:real-docs:verbose": "node --import tsx tests/eval/real-docs.ts --verbose"
|
|
22
31
|
},
|
|
23
32
|
"engines": {
|
|
24
33
|
"node": ">=20"
|