@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/principles.zh.md
CHANGED
|
@@ -1,50 +1,63 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 设计原则
|
|
2
2
|
|
|
3
3
|
[English](principles.md) | [한국어](principles.ko.md) | [简体中文](principles.zh.md) | [日本語](principles.ja.md) | [Español](principles.es.md)
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## 概述
|
|
6
6
|
|
|
7
|
-
`gctree`
|
|
7
|
+
`gctree` 遵循一套简明的产品准则:保持上下文的分支感知、让源文档以摘要为先、保持索引精简、明确仓库作用范围、只注入相关内容,并支持任何能够运行 shell 命令的提供商。
|
|
8
8
|
|
|
9
|
-
## 1.
|
|
9
|
+
## 1. 保持上下文的分支感知
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
一台机器应该能够同时持有多个全局上下文树,且互不混淆。
|
|
12
|
+
这就是为什么 `gctree` 使用 `checkout` 和 `checkout -b` 这样类似 git 的语言,同时在面向用户的文案中将活跃分支称为 **gc-branch**。
|
|
13
13
|
|
|
14
|
-
## 2.
|
|
14
|
+
## 2. 明确仓库作用范围
|
|
15
15
|
|
|
16
|
-
gc-branch
|
|
17
|
-
`gctree`
|
|
16
|
+
gc-branch 不应该悄无声息地影响机器上的每一个代码仓库。
|
|
17
|
+
`gctree` 使用 `branch-repo-map.json` 来记录某个代码仓库的状态:
|
|
18
18
|
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
19
|
+
- 已包含在某个 gc-branch 中
|
|
20
|
+
- 已从某个 gc-branch 中排除
|
|
21
|
+
- 尚未映射
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
如果从未映射的代码仓库调用 `resolve`,用户可以决定是继续一次、始终在该仓库使用此 gc-branch,还是在该仓库忽略它。
|
|
24
24
|
|
|
25
|
-
## 3.
|
|
25
|
+
## 3. 保持 `index.md` 精简
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
顶层 `index.md` 是索引,而非内容转储。
|
|
28
|
+
它的职责是帮助工具和人员快速找到正确的源文档。
|
|
29
|
+
它应保持在 **2000 字符**以内,以链接为主,而不是将完整知识内联复制进来。
|
|
30
30
|
|
|
31
|
-
## 4.
|
|
31
|
+
## 4. 让源文档以摘要为先
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
每个作为可信来源的 Markdown 文档都应在靠近顶部的位置包含一个 `## Summary` 部分。
|
|
34
|
+
这为下游工具提供了一条快速路径:先读取简短版本,只有在真正需要更多细节时才展开阅读。
|
|
35
35
|
|
|
36
36
|
## 5. 让 onboarding 明确且有引导
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
`gctree init` 和 `gctree onboard`
|
|
38
|
+
用户不应该仅仅为了创建一个有用的上下文树而手动编写 onboarding JSON。
|
|
39
|
+
`gctree init` 和 `gctree onboard` 应该引导用户选择首选的提供商,并将生成的上下文写入活跃的 gc-branch。
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
Onboarding 仅适用于空的 gc-branch。
|
|
42
|
+
如果一个 gc-branch 已经包含上下文,正确的做法是:
|
|
43
43
|
|
|
44
|
-
-
|
|
45
|
-
-
|
|
44
|
+
- 重置该 gc-branch 并重新 onboard
|
|
45
|
+
- 或者执行一次有引导的持久化更新
|
|
46
46
|
|
|
47
|
-
## 6.
|
|
47
|
+
## 6. 让持久化更新保持刻意为之
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
持久化上下文不应该因意外或隐藏记忆而发生变更。
|
|
50
|
+
更新流程应该是显式的、由提供商驱动的,并与当前活跃的 gc-branch 绑定。
|
|
51
|
+
|
|
52
|
+
## 7. 只注入相关内容
|
|
53
|
+
|
|
54
|
+
工具会话不应收到整个知识库。
|
|
55
|
+
`gctree resolve` 对文档与查询进行评分,只返回匹配的文档——包含标题、摘要和摘录。只有在摘要不足时才读取完整文档。
|
|
56
|
+
|
|
57
|
+
实际上,每次查询注入的上下文约占总存储量的 4%。其余 96% 保留在磁盘上,不进入 token 窗口,直到真正需要时才读取。
|
|
58
|
+
|
|
59
|
+
## 8. 保持提供商无关性
|
|
60
|
+
|
|
61
|
+
`gctree` 将上下文存储在任何工具都能读取的纯 Markdown 文件中。
|
|
62
|
+
Claude Code 和 Codex 都通过 `gctree scaffold` 对接同一个底层存储。
|
|
63
|
+
添加对新提供商的支持,意味着编写一个新的 scaffold 模板——无需对核心存储或 resolve 逻辑做任何修改。
|
package/docs/usage.es.md
CHANGED
|
@@ -4,45 +4,71 @@
|
|
|
4
4
|
|
|
5
5
|
## Resumen
|
|
6
6
|
|
|
7
|
-
Un flujo estándar con `gctree`
|
|
7
|
+
Un flujo de trabajo estándar con `gctree` tiene este aspecto: inicializar gc-tree, elegir un proveedor, hacer onboarding de la gc-branch `main` predeterminada, hacer resolve del contexto que necesitas, crear nuevas gc-branches cuando el trabajo merece su propio carril, mapear los repositorios a las gc-branches correctas y usar actualizaciones guiadas para cambios duraderos más adelante.
|
|
8
8
|
|
|
9
|
-
## Flujo estándar
|
|
9
|
+
## Flujo de trabajo estándar
|
|
10
10
|
|
|
11
|
-
1.
|
|
12
|
-
2.
|
|
13
|
-
3.
|
|
14
|
-
4. si elegiste `both`,
|
|
15
|
-
5.
|
|
16
|
-
6.
|
|
17
|
-
7.
|
|
18
|
-
8.
|
|
19
|
-
9.
|
|
20
|
-
10.
|
|
11
|
+
1. ejecutar `gctree init`
|
|
12
|
+
2. elegir el modo de proveedor preferido (`claude-code`, `codex` o `both`)
|
|
13
|
+
3. elegir el idioma de trabajo (`English`, `Korean` o un idioma personalizado)
|
|
14
|
+
4. si elegiste `both`, elegir qué proveedor debe iniciar el onboarding ahora
|
|
15
|
+
5. completar el onboarding guiado para la gc-branch `main` predeterminada
|
|
16
|
+
6. hacer resolve del contexto relevante con `gctree resolve --query "..."`
|
|
17
|
+
7. crear o cambiar de gc-branch con `gctree checkout`
|
|
18
|
+
8. ejecutar `gctree onboard` solo para una gc-branch vacía
|
|
19
|
+
9. usar el mapeo de alcance del repositorio para que una gc-branch solo aplique donde corresponde
|
|
20
|
+
10. usar `gctree update-global-context` para cambios duraderos más adelante
|
|
21
21
|
|
|
22
|
-
## Comandos
|
|
22
|
+
## Comandos principales
|
|
23
23
|
|
|
24
24
|
| Comando | Propósito |
|
|
25
25
|
| --- | --- |
|
|
26
|
-
| `gctree init` |
|
|
27
|
-
| `gctree checkout <branch>` |
|
|
28
|
-
| `gctree checkout -b <branch>` |
|
|
29
|
-
| `gctree branches` |
|
|
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` | Alias
|
|
39
|
-
| `gctree scaffold --host <codex
|
|
40
|
-
|
|
41
|
-
##
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
26
|
+
| `gctree init` | Crear `~/.gctree`, crear la gc-branch `main` predeterminada, guardar el modo de proveedor, el proveedor de onboarding y el idioma preferido, hacer scaffold del entorno actual y comenzar el onboarding guiado cuando `main` está vacía. |
|
|
27
|
+
| `gctree checkout <branch>` | Cambiar la gc-branch activa. |
|
|
28
|
+
| `gctree checkout -b <branch>` | Crear y cambiar a una nueva gc-branch vacía. |
|
|
29
|
+
| `gctree branches` | Listar las gc-branches disponibles y mostrar la activa. |
|
|
30
|
+
| `gctree status` | Mostrar la gc-branch activa, el repositorio actual, el estado del alcance del repositorio actual, advertencias y el proveedor preferido. |
|
|
31
|
+
| `gctree resolve --query TEXT` | Buscar contexto en la gc-branch relevante. Si el repositorio actual no está mapeado, `gctree` puede preguntar cómo debe tratarse ese repositorio. |
|
|
32
|
+
| `gctree repo-map` | Mostrar el contenido actual de `branch-repo-map.json`. |
|
|
33
|
+
| `gctree set-repo-scope --branch <name> --include` | Marcar el repositorio actual como incluido para esa gc-branch. |
|
|
34
|
+
| `gctree set-repo-scope --branch <name> --exclude` | Marcar el repositorio actual como ignorado para esa gc-branch. |
|
|
35
|
+
| `gctree onboard` | Iniciar el onboarding guiado para la gc-branch activa. Solo funciona cuando esa gc-branch está vacía. |
|
|
36
|
+
| `gctree reset-gc-branch --branch <name> --yes` | Limpiar una gc-branch para poder hacer onboarding de nuevo. |
|
|
37
|
+
| `gctree update-global-context` | Iniciar una actualización duradera guiada para la gc-branch activa. |
|
|
38
|
+
| `gctree update-gc` / `gctree ugc` | Alias para `gctree update-global-context`. |
|
|
39
|
+
| `gctree scaffold --host <codex\|claude-code>` | Instalar la interfaz de comandos orientada al proveedor en otro entorno. |
|
|
40
|
+
|
|
41
|
+
## Qué devuelve resolve
|
|
42
|
+
|
|
43
|
+
`gctree resolve` puntúa cada documento de la gc-branch activa contra tu consulta y devuelve solo los que coinciden. Las coincidencias en el título cuentan el doble que las coincidencias en el cuerpo.
|
|
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
|
+
La herramienta recibe primero el resumen y el fragmento. Lee el documento completo en `path` solo cuando el resumen no es suficiente. Una consulta que no coincide con nada devuelve `"matches": []`.
|
|
66
|
+
|
|
67
|
+
## Ejemplo de flujo de alcance del repositorio
|
|
68
|
+
|
|
69
|
+
Supongamos que la gc-branch `A` es relevante para los repositorios `B`, `C` y `D`, pero no para `F`.
|
|
70
|
+
|
|
71
|
+
Puedes gestionarlo mediante:
|
|
46
72
|
|
|
47
73
|
```json
|
|
48
74
|
{
|
|
@@ -53,19 +79,19 @@ Puedes gestionarlo así:
|
|
|
53
79
|
}
|
|
54
80
|
```
|
|
55
81
|
|
|
56
|
-
|
|
82
|
+
almacenado en:
|
|
57
83
|
|
|
58
84
|
```text
|
|
59
85
|
~/.gctree/branch-repo-map.json
|
|
60
86
|
```
|
|
61
87
|
|
|
62
|
-
Cuando
|
|
88
|
+
Cuando `resolve` se ejecuta desde el repositorio `E` y la branch `A` todavía no está mapeada allí, `gctree` puede preguntar si:
|
|
63
89
|
|
|
64
|
-
1. continuar
|
|
90
|
+
1. continuar una vez
|
|
65
91
|
2. usar siempre `A` en `E`
|
|
66
92
|
3. ignorar `A` en `E`
|
|
67
93
|
|
|
68
|
-
## Ejemplo de primera ejecución
|
|
94
|
+
## Ejemplo de flujo en la primera ejecución
|
|
69
95
|
|
|
70
96
|
```bash
|
|
71
97
|
gctree init
|
|
@@ -73,11 +99,11 @@ gctree init
|
|
|
73
99
|
|
|
74
100
|
Luego:
|
|
75
101
|
|
|
76
|
-
1.
|
|
77
|
-
2.
|
|
78
|
-
3.
|
|
102
|
+
1. elegir `codex` o `claude-code`
|
|
103
|
+
2. dejar que `gctree` haga scaffold del entorno actual
|
|
104
|
+
3. completar el onboarding guiado para la gc-branch `main`
|
|
79
105
|
|
|
80
|
-
## Ejemplo con
|
|
106
|
+
## Ejemplo de flujo con múltiples branches
|
|
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
|
-
## Ejemplo de actualización
|
|
114
|
+
## Ejemplo de flujo de actualización
|
|
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
|
-
Si un
|
|
127
|
+
Si un repositorio recién relevante también debería pasar a formar parte del contexto duradero, el flujo natural es:
|
|
102
128
|
|
|
103
|
-
1.
|
|
104
|
-
2.
|
|
129
|
+
1. mapear ese repositorio a la gc-branch
|
|
130
|
+
2. luego ejecutar `update-global-context` para agregar conocimiento duradero sobre qué hace ese repositorio y por qué es importante
|
|
105
131
|
|
|
106
132
|
## Patrones de integración
|
|
107
133
|
|
|
108
134
|
### Codex CLI / Claude Code CLI
|
|
109
135
|
|
|
110
|
-
`gctree scaffold` instala
|
|
111
|
-
Esos comandos deberían mencionar de forma explícita cuál es el gc-branch activo antes de empezar a recopilar o aplicar contexto duradero, y también deberían seguir usando el idioma guardado salvo que la persona usuaria pida cambiarlo.
|
|
136
|
+
`gctree scaffold` instala archivos de comandos orientados al proveedor en el directorio de destino.
|
|
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
|
+
**Archivos escritos para `--host codex`:**
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
AGENTS.md ← fragmento de gctree añadido a las instrucciones del agente
|
|
148
|
+
.codex/hooks.json ← hooks de auto-resolve para SessionStart/UserPromptSubmit
|
|
149
|
+
.codex/prompts/gctree-bootstrap.md ← contexto de arranque para las sesiones de Codex
|
|
150
|
+
.codex/skills/gc-resolve-context/SKILL.md ← skill de resolve
|
|
151
|
+
.codex/skills/gc-onboard/SKILL.md ← skill de onboarding
|
|
152
|
+
.codex/skills/gc-update-global-context/SKILL.md ← skill de actualización
|
|
116
153
|
```
|
|
117
154
|
|
|
118
|
-
|
|
155
|
+
**Archivos escritos para `--host claude-code`:**
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
CLAUDE.md ← fragmento de gctree añadido
|
|
159
|
+
.claude/hooks/hooks.json ← hooks de auto-resolve para SessionStart/UserPromptSubmit
|
|
160
|
+
.claude/hooks/gctree-session-start.md ← nota fallback de inicio de sesión
|
|
161
|
+
.claude/commands/gc-resolve-context.md ← comando slash de resolve
|
|
162
|
+
.claude/commands/gc-onboard.md ← comando slash de onboard
|
|
163
|
+
.claude/commands/gc-update-global-context.md ← comando slash de actualización
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Los archivos existentes no se modifican a menos que pases `--force`.
|
|
167
|
+
|
|
168
|
+
### Comportamiento en tiempo de ejecución
|
|
119
169
|
|
|
120
|
-
|
|
121
|
-
|
|
170
|
+
La gc-branch activa es la apuntada por `HEAD` dentro de `~/.gctree`, pero el mapeo del repositorio puede anular ese valor predeterminado cuando un repositorio está vinculado explícitamente a otra gc-branch.
|
|
171
|
+
Esto hace que gc-tree sea práctico para usuarios avanzados que mantienen muchas sesiones no relacionadas abiertas al mismo tiempo.
|
package/docs/usage.ja.md
CHANGED
|
@@ -2,47 +2,73 @@
|
|
|
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` の流れはこうです。gc-tree
|
|
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.
|
|
12
|
+
2. 好みのプロバイダーモードを選ぶ(`claude-code`、`codex`、`both`)
|
|
13
13
|
3. ワークフロー言語を選ぶ(`English`、`Korean`、またはカスタム言語)
|
|
14
|
-
4. `both`
|
|
14
|
+
4. `both` を選んだ場合は、今回のオンボーディングをどちらのプロバイダーで始めるか選ぶ
|
|
15
15
|
5. デフォルトの `main` gc-branch に対するガイド付きオンボーディングを完了する
|
|
16
16
|
6. `gctree resolve --query "..."` で必要なコンテキストを取り出す
|
|
17
|
-
7. `gctree checkout` で gc-branch
|
|
17
|
+
7. `gctree checkout` で gc-branch を作成または切り替える
|
|
18
18
|
8. `gctree onboard` は空の gc-branch に対してだけ使う
|
|
19
|
-
9. repo scope を設定して gc-branch
|
|
20
|
-
10.
|
|
19
|
+
9. repo scope を設定して gc-branch が本来のリポジトリにだけ作用するようにする
|
|
20
|
+
10. 後からの永続的な変更には `gctree update-global-context` を使う
|
|
21
21
|
|
|
22
22
|
## 主要コマンド
|
|
23
23
|
|
|
24
24
|
| コマンド | 役割 |
|
|
25
25
|
| --- | --- |
|
|
26
|
-
| `gctree init` | `~/.gctree` を作成し、デフォルトの `main` gc-branch
|
|
26
|
+
| `gctree init` | `~/.gctree` を作成し、デフォルトの `main` gc-branch を作り、プロバイダーモード・オンボーディングプロバイダー・優先言語を保存し、現在の環境を scaffold し、`main` が空ならガイド付きオンボーディングまで開始します。 |
|
|
27
27
|
| `gctree checkout <branch>` | アクティブな gc-branch を切り替えます。 |
|
|
28
28
|
| `gctree checkout -b <branch>` | 新しい空の gc-branch を作成し、そのまま切り替えます。 |
|
|
29
29
|
| `gctree branches` | 利用可能な gc-branch 一覧と、現在アクティブなものを表示します。 |
|
|
30
|
-
| `gctree status` | アクティブな gc-branch、現在のリポジトリ、現在の repo-scope
|
|
30
|
+
| `gctree status` | アクティブな gc-branch、現在のリポジトリ、現在の repo-scope 状態、警告、優先プロバイダーを表示します。 |
|
|
31
31
|
| `gctree resolve --query TEXT` | 関係する gc-branch からコンテキストを検索します。現在のリポジトリが未マップなら、そのリポジトリをどう扱うかを尋ねる場合があります。 |
|
|
32
32
|
| `gctree repo-map` | 現在の `branch-repo-map.json` の内容を表示します。 |
|
|
33
33
|
| `gctree set-repo-scope --branch <name> --include` | 現在のリポジトリを、その gc-branch に含まれるものとして記録します。 |
|
|
34
34
|
| `gctree set-repo-scope --branch <name> --exclude` | 現在のリポジトリを、その gc-branch では無視するものとして記録します。 |
|
|
35
35
|
| `gctree onboard` | アクティブな gc-branch に対するガイド付きオンボーディングを開始します。空の gc-branch でのみ動作します。 |
|
|
36
|
-
| `gctree reset-gc-branch --branch <name> --yes` | gc-branch
|
|
37
|
-
| `gctree update-global-context` | アクティブな gc-branch
|
|
36
|
+
| `gctree reset-gc-branch --branch <name> --yes` | gc-branch を空にして再オンボード可能な状態にします。 |
|
|
37
|
+
| `gctree update-global-context` | アクティブな gc-branch に対するガイド付き永続的更新を開始します。 |
|
|
38
38
|
| `gctree update-gc` / `gctree ugc` | `gctree update-global-context` の別名です。 |
|
|
39
|
-
| `gctree scaffold --host <codex
|
|
39
|
+
| `gctree scaffold --host <codex\|claude-code>` | 別の環境にプロバイダー向けコマンド面をインストールします。 |
|
|
40
40
|
|
|
41
|
-
##
|
|
41
|
+
## resolve が返す内容
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
`gctree resolve` はアクティブな gc-branch 内のすべてのドキュメントをクエリに対してスコアリングし、マッチしたものだけを返します。タイトルの一致はボディの一致の 2 倍の重みを持ちます。
|
|
44
44
|
|
|
45
|
-
|
|
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
|
+
## repo scope の設定例
|
|
68
|
+
|
|
69
|
+
gc-branch `A` がリポジトリ `B`・`C`・`D` には関係し、`F` には関係しないとします。
|
|
70
|
+
|
|
71
|
+
その場合は次のように管理できます。
|
|
46
72
|
|
|
47
73
|
```json
|
|
48
74
|
{
|
|
@@ -59,7 +85,7 @@ gc-branch `A` が repo `B`、`C`、`D` には関係し、`F` には関係しな
|
|
|
59
85
|
~/.gctree/branch-repo-map.json
|
|
60
86
|
```
|
|
61
87
|
|
|
62
|
-
|
|
88
|
+
リポジトリ `E` から `resolve` を実行し、ブランチ `A` がまだそこにマップされていない場合、`gctree` は次のどれにするかを尋ねられます。
|
|
63
89
|
|
|
64
90
|
1. 今回だけ続ける
|
|
65
91
|
2. `E` では今後も常に `A` を使う
|
|
@@ -98,24 +124,48 @@ gctree update-gc
|
|
|
98
124
|
gctree ugc
|
|
99
125
|
```
|
|
100
126
|
|
|
101
|
-
|
|
127
|
+
新しく重要になったリポジトリを永続的なコンテキストにも組み込みたい場合、自然な流れは次のとおりです。
|
|
102
128
|
|
|
103
129
|
1. まずそのリポジトリを gc-branch にマップする
|
|
104
|
-
2. その後 `update-global-context`
|
|
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
|
|
|
118
|
-
|
|
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 ← セッション開始のフォールバックメモ
|
|
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
|
+
|
|
168
|
+
### ランタイムの動作
|
|
119
169
|
|
|
120
|
-
デフォルトのアクティブ gc-branch は `~/.gctree`
|
|
121
|
-
|
|
170
|
+
デフォルトのアクティブ gc-branch は `~/.gctree` 内の `HEAD` が指しているものですが、リポジトリが別の gc-branch に明示的に結び付けられている場合は、repo mapping がそのフォールバックを上書きできます。
|
|
171
|
+
これにより、互いに無関係なセッションを多数同時に開いているヘビーユーザーでも gc-tree を実用的に使えます。
|