@handsupmin/gc-tree 0.2.0 → 0.3.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.es.md +60 -59
- package/README.ja.md +60 -59
- package/README.ko.md +62 -61
- package/README.md +61 -60
- package/README.zh.md +62 -61
- package/dist/src/cli.js +25 -0
- package/dist/src/hook.js +209 -0
- package/dist/src/paths.js +6 -0
- package/dist/src/scaffold.js +67 -7
- 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 +100 -50
- package/docs/usage.ja.md +73 -23
- package/docs/usage.ko.md +102 -52
- package/docs/usage.md +53 -3
- package/docs/usage.zh.md +97 -47
- package/package.json +3 -1
package/docs/usage.ko.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
|
-
|
|
7
|
+
표준 `gctree` 워크플로우는 다음과 같습니다: gc-tree 초기화, 프로바이더 선택, 기본 `main` gc-branch 온보딩, 필요한 컨텍스트 resolve, 작업별로 새 gc-branch 생성, 저장소를 올바른 gc-branch에 매핑, 이후 지속 변경 시 안내된 업데이트 사용.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## 표준 워크플로우
|
|
10
10
|
|
|
11
11
|
1. `gctree init` 실행
|
|
12
|
-
2. 선호하는
|
|
13
|
-
3.
|
|
14
|
-
4. `both`를
|
|
15
|
-
5. 기본 `main` gc-branch
|
|
16
|
-
6. `gctree resolve --query "..."`로
|
|
12
|
+
2. 선호하는 프로바이더 모드 선택 (`claude-code`, `codex`, 또는 `both`)
|
|
13
|
+
3. 워크플로우 언어 선택 (`English`, `Korean`, 또는 커스텀 언어)
|
|
14
|
+
4. `both`를 선택한 경우, 지금 온보딩을 시작할 프로바이더 선택
|
|
15
|
+
5. 기본 `main` gc-branch의 안내된 온보딩 완료
|
|
16
|
+
6. `gctree resolve --query "..."`로 관련 컨텍스트 resolve
|
|
17
17
|
7. `gctree checkout`으로 gc-branch 생성 또는 전환
|
|
18
|
-
8. `gctree onboard
|
|
19
|
-
9.
|
|
20
|
-
10.
|
|
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>` | 활성 gc-branch
|
|
28
|
-
| `gctree checkout -b <branch>` |
|
|
29
|
-
| `gctree branches` | 사용 가능한 gc-branch
|
|
30
|
-
| `gctree status` | 활성 gc-branch, 현재
|
|
31
|
-
| `gctree resolve --query TEXT` | 관련 gc-branch에서
|
|
32
|
-
| `gctree repo-map` |
|
|
33
|
-
| `gctree set-repo-scope --branch <name> --include` | 현재
|
|
34
|
-
| `gctree set-repo-scope --branch <name> --exclude` | 현재
|
|
35
|
-
| `gctree onboard` | 활성 gc-branch
|
|
36
|
-
| `gctree reset-gc-branch --branch <name> --yes` | gc-branch를
|
|
37
|
-
| `gctree update-global-context` | 활성 gc-branch
|
|
38
|
-
| `gctree update-gc` / `gctree ugc` | `gctree update-global-context`의
|
|
39
|
-
| `gctree scaffold --host <codex
|
|
40
|
-
|
|
41
|
-
##
|
|
42
|
-
|
|
43
|
-
gc-branch
|
|
44
|
-
|
|
45
|
-
|
|
26
|
+
| `gctree init` | `~/.gctree` 생성, 기본 `main` gc-branch 생성, 프로바이더 모드·온보딩 프로바이더·선호 언어 저장, 현재 환경 scaffold, `main`이 비어 있으면 안내된 온보딩 시작. |
|
|
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의 안내된 온보딩 실행. 해당 gc-branch가 비어 있을 때만 동작. |
|
|
36
|
+
| `gctree reset-gc-branch --branch <name> --yes` | gc-branch를 초기화하여 다시 온보딩할 수 있게 함. |
|
|
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,31 +79,31 @@ gc-branch `A`가 `B`, `C`, `D` 레포에는 관련 있고 `F`에는 관련이
|
|
|
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
|
-
`E
|
|
88
|
+
저장소 `E`에서 `resolve`를 실행할 때 브랜치 `A`가 아직 매핑되지 않은 경우, `gctree`가 다음 중 하나를 선택하도록 물어볼 수 있습니다:
|
|
63
89
|
|
|
64
|
-
1.
|
|
65
|
-
2. `E
|
|
66
|
-
3. `E
|
|
90
|
+
1. 한 번만 계속 진행
|
|
91
|
+
2. `E`에서 항상 `A` 사용
|
|
92
|
+
3. `E`에서 `A` 무시
|
|
67
93
|
|
|
68
|
-
##
|
|
94
|
+
## 최초 실행 예시 흐름
|
|
69
95
|
|
|
70
96
|
```bash
|
|
71
97
|
gctree init
|
|
72
98
|
```
|
|
73
99
|
|
|
74
|
-
|
|
100
|
+
이후:
|
|
75
101
|
|
|
76
102
|
1. `codex` 또는 `claude-code` 선택
|
|
77
|
-
2. `gctree`가 현재 환경을
|
|
78
|
-
3. `main` gc-branch
|
|
103
|
+
2. `gctree`가 현재 환경을 scaffold하도록 허용
|
|
104
|
+
3. `main` gc-branch의 안내된 온보딩 완료
|
|
79
105
|
|
|
80
|
-
##
|
|
106
|
+
## 다중 브랜치 예시 흐름
|
|
81
107
|
|
|
82
108
|
```bash
|
|
83
109
|
gctree checkout -b client-b
|
|
@@ -85,37 +111,61 @@ 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
|
|
92
118
|
```
|
|
93
119
|
|
|
94
|
-
|
|
120
|
+
단축 별칭:
|
|
95
121
|
|
|
96
122
|
```bash
|
|
97
123
|
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 스니펫 추가
|
|
148
|
+
.codex/hooks.json ← SessionStart/UserPromptSubmit 자동 resolve 훅
|
|
149
|
+
.codex/prompts/gctree-bootstrap.md ← Codex 세션의 부트스트랩 컨텍스트
|
|
150
|
+
.codex/skills/gc-resolve-context/SKILL.md ← resolve 스킬
|
|
151
|
+
.codex/skills/gc-onboard/SKILL.md ← 온보딩 스킬
|
|
152
|
+
.codex/skills/gc-update-global-context/SKILL.md ← 업데이트 스킬
|
|
116
153
|
```
|
|
117
154
|
|
|
155
|
+
**`--host claude-code`로 작성되는 파일:**
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
CLAUDE.md ← gctree 스니펫 추가
|
|
159
|
+
.claude/hooks/hooks.json ← SessionStart/UserPromptSubmit 자동 resolve 훅
|
|
160
|
+
.claude/hooks/gctree-session-start.md ← 세션 시작 fallback 메모
|
|
161
|
+
.claude/commands/gc-resolve-context.md ← resolve 슬래시 명령
|
|
162
|
+
.claude/commands/gc-onboard.md ← onboard 슬래시 명령
|
|
163
|
+
.claude/commands/gc-update-global-context.md ← 업데이트 슬래시 명령
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
`--force`를 전달하지 않으면 기존 파일은 그대로 유지됩니다.
|
|
167
|
+
|
|
118
168
|
### 런타임 동작
|
|
119
169
|
|
|
120
|
-
|
|
121
|
-
|
|
170
|
+
활성 gc-branch는 `~/.gctree` 내의 `HEAD`가 가리키는 브랜치이지만, 저장소가 다른 gc-branch에 명시적으로 바인딩된 경우 저장소 매핑이 해당 폴백을 재정의할 수 있습니다.
|
|
171
|
+
이를 통해 관련 없는 여러 세션을 동시에 열어두는 헤비 유저에게도 gc-tree가 실용적으로 동작합니다.
|
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,38 @@ 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/hooks.json ← SessionStart/UserPromptSubmit auto-resolve hooks
|
|
149
|
+
.codex/prompts/gctree-bootstrap.md ← bootstrap context for Codex sessions
|
|
150
|
+
.codex/skills/gc-resolve-context/SKILL.md ← resolve skill
|
|
151
|
+
.codex/skills/gc-onboard/SKILL.md ← onboarding skill
|
|
152
|
+
.codex/skills/gc-update-global-context/SKILL.md ← update skill
|
|
116
153
|
```
|
|
117
154
|
|
|
155
|
+
**Files written for `--host claude-code`:**
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
CLAUDE.md ← gctree snippet appended
|
|
159
|
+
.claude/hooks/hooks.json ← SessionStart/UserPromptSubmit auto-resolve hooks
|
|
160
|
+
.claude/hooks/gctree-session-start.md ← session-start fallback note
|
|
161
|
+
.claude/commands/gc-resolve-context.md ← resolve slash command
|
|
162
|
+
.claude/commands/gc-onboard.md ← onboard slash command
|
|
163
|
+
.claude/commands/gc-update-global-context.md ← update slash command
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Existing files are left untouched unless you pass `--force`.
|
|
167
|
+
|
|
118
168
|
### Runtime behavior
|
|
119
169
|
|
|
120
170
|
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,48 @@ 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/hooks.json ← SessionStart / UserPromptSubmit 自动 resolve hook
|
|
149
|
+
.codex/prompts/gctree-bootstrap.md ← Codex 会话的引导上下文
|
|
150
|
+
.codex/skills/gc-resolve-context/SKILL.md ← resolve 技能
|
|
151
|
+
.codex/skills/gc-onboard/SKILL.md ← onboarding 技能
|
|
152
|
+
.codex/skills/gc-update-global-context/SKILL.md ← 更新技能
|
|
116
153
|
```
|
|
117
154
|
|
|
155
|
+
**`--host claude-code` 写入的文件:**
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
CLAUDE.md ← gctree 代码片段追加
|
|
159
|
+
.claude/hooks/hooks.json ← SessionStart / UserPromptSubmit 自动 resolve hook
|
|
160
|
+
.claude/hooks/gctree-session-start.md ← 会话启动 fallback 说明
|
|
161
|
+
.claude/commands/gc-resolve-context.md ← resolve 斜杠命令
|
|
162
|
+
.claude/commands/gc-onboard.md ← onboard 斜杠命令
|
|
163
|
+
.claude/commands/gc-update-global-context.md ← 更新斜杠命令
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
除非传入 `--force`,否则已有文件不会被修改。
|
|
167
|
+
|
|
118
168
|
### 运行时行为
|
|
119
169
|
|
|
120
|
-
|
|
121
|
-
这使得 gc-tree
|
|
170
|
+
活跃的 gc-branch 由 `~/.gctree` 内的 `HEAD` 指向,但当一个代码仓库被显式绑定到另一个 gc-branch 时,仓库映射可以覆盖这一后备设置。
|
|
171
|
+
这使得 gc-tree 对于同时保持大量无关会话的重度用户而言非常实用。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@handsupmin/gc-tree",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
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,
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
"eval:multi-repo": "node --import tsx tests/eval/multi-repo.ts",
|
|
25
25
|
"eval:multi-repo:verbose": "node --import tsx tests/eval/multi-repo.ts --verbose",
|
|
26
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",
|
|
27
29
|
"eval:real-docs": "node --import tsx tests/eval/real-docs.ts",
|
|
28
30
|
"eval:real-docs:verbose": "node --import tsx tests/eval/real-docs.ts --verbose"
|
|
29
31
|
},
|