@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/docs/usage.es.md CHANGED
@@ -4,45 +4,71 @@
4
4
 
5
5
  ## Resumen
6
6
 
7
- Un flujo estándar con `gctree` suele ser así: inicializar gc-tree, elegir un provider, hacer onboarding del gc-branch `main`, resolver el contexto activo cuando haga falta, crear nuevos gc-branches cuando el trabajo lo pida, mapear cada repo al gc-branch correcto y usar actualizaciones guiadas para los cambios duraderos.
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. ejecuta `gctree init`
12
- 2. elige tu modo de provider preferido (`claude-code`, `codex` o `both`)
13
- 3. elige el idioma del flujo (`English`, `Korean` o un idioma personalizado)
14
- 4. si elegiste `both`, decide qué provider debe iniciar este onboarding
15
- 5. completa el onboarding guiado del gc-branch `main`
16
- 6. usa `gctree resolve --query "..."` para recuperar el contexto relevante
17
- 7. crea o cambia gc-branches con `gctree checkout`
18
- 8. usa `gctree onboard` solo en un gc-branch vacío
19
- 9. configura el repo scope para que cada gc-branch solo se aplique donde corresponde
20
- 10. usa `gctree update-global-context` para los cambios duraderos posteriores
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 clave
22
+ ## Comandos principales
23
23
 
24
24
  | Comando | Propósito |
25
25
  | --- | --- |
26
- | `gctree init` | Crea `~/.gctree`, crea el gc-branch `main`, guarda el modo de provider, el provider de onboarding y el idioma preferido, hace scaffold del entorno actual y arranca el onboarding guiado cuando `main` está vacío. |
27
- | `gctree checkout <branch>` | Cambia el gc-branch activo. |
28
- | `gctree checkout -b <branch>` | Crea un gc-branch vacío nuevo y cambia a él. |
29
- | `gctree branches` | Lista los gc-branches disponibles y marca cuál está activo. |
30
- | `gctree status` | Muestra el gc-branch activo, el repo actual, el estado actual de repo scope, advertencias y el provider preferido. |
31
- | `gctree resolve --query TEXT` | Busca contexto en el gc-branch relevante. Si el repo actual no está mapeado, `gctree` puede preguntar cómo debe tratarse ese repo. |
32
- | `gctree repo-map` | Muestra el contenido actual de `branch-repo-map.json`. |
33
- | `gctree set-repo-scope --branch <name> --include` | Marca el repo actual como incluido para ese gc-branch. |
34
- | `gctree set-repo-scope --branch <name> --exclude` | Marca el repo actual como ignorado para ese gc-branch. |
35
- | `gctree onboard` | Lanza el onboarding guiado para el gc-branch activo. Solo funciona si ese gc-branch está vacío. |
36
- | `gctree reset-gc-branch --branch <name> --yes` | Vacía un gc-branch para poder onboardearlo de nuevo. |
37
- | `gctree update-global-context` | Lanza una actualización duradera guiada para el gc-branch activo. |
38
- | `gctree update-gc` / `gctree ugc` | Alias de `gctree update-global-context`. |
39
- | `gctree scaffold --host <codex|claude-code>` | Instala la superficie de comandos del provider en otro entorno. |
40
-
41
- ## Ejemplo de repo scope
42
-
43
- Supón que el gc-branch `A` es relevante para los repos `B`, `C` y `D`, pero no para `F`.
44
-
45
- Puedes gestionarlo así:
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
- Guardado en:
82
+ almacenado en:
57
83
 
58
84
  ```text
59
85
  ~/.gctree/branch-repo-map.json
60
86
  ```
61
87
 
62
- Cuando ejecutas `resolve` desde el repo `E` y la rama `A` todavía no está mapeada allí, `gctree` puede preguntarte si quieres:
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 solo esta vez
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. elige `codex` o `claude-code`
77
- 2. deja que `gctree` haga scaffold del entorno actual
78
- 3. completa el onboarding guiado del gc-branch `main`
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 varias ramas
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,46 @@ gctree update-gc
98
124
  gctree ugc
99
125
  ```
100
126
 
101
- Si un repo recién relevante también debería formar parte del contexto duradero, el flujo natural es:
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. primero mapear ese repo al gc-branch
104
- 2. después ejecutar `update-global-context` para añadir conocimiento duradero sobre qué hace ese repo y por qué importa
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 la superficie de comandos orientada al provider, como el onboarding guiado y las actualizaciones guiadas.
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/prompts/gctree-bootstrap.md ← contexto de arranque para las sesiones de Codex
149
+ .codex/skills/gc-resolve-context/SKILL.md ← skill de resolve
150
+ .codex/skills/gc-onboard/SKILL.md ← skill de onboarding
151
+ .codex/skills/gc-update-global-context/SKILL.md ← skill de actualización
116
152
  ```
117
153
 
118
- ### Comportamiento en runtime
154
+ **Archivos escritos para `--host claude-code`:**
155
+
156
+ ```
157
+ CLAUDE.md ← fragmento de gctree añadido
158
+ .claude/hooks/gctree-session-start.md ← hook de inicio de sesión
159
+ .claude/commands/gc-resolve-context.md ← comando slash de resolve
160
+ .claude/commands/gc-onboard.md ← comando slash de onboard
161
+ .claude/commands/gc-update-global-context.md ← comando slash de actualización
162
+ ```
163
+
164
+ Los archivos existentes no se modifican a menos que pases `--force`.
165
+
166
+ ### Comportamiento en tiempo de ejecución
119
167
 
120
- Por defecto, el gc-branch activo es el que apunta `HEAD` dentro de `~/.gctree`, pero el repo mapping puede sobrescribir ese valor si un repositorio está ligado explícitamente a otro gc-branch.
121
- Eso hace que gc-tree sea práctico incluso para quienes mantienen muchas sesiones abiertas a la vez en repositorios que no tienen relación entre sí.
168
+ 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.
169
+ 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 を初期化し、provider を選び、デフォルトの `main` gc-branch をオンボードし、必要な文脈を resolve で引き、必要になったら新しい gc-branch を作り、各リポジトリを正しい gc-branch に結び付け、長期的な変更はガイド付き更新で反映していきます。
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. 好みの provider モードを選ぶ(`claude-code`、`codex`、`both`)
12
+ 2. 好みのプロバイダーモードを選ぶ(`claude-code`、`codex`、`both`)
13
13
  3. ワークフロー言語を選ぶ(`English`、`Korean`、またはカスタム言語)
14
- 4. `both` を選んだ場合は、今回のオンボーディングをどちらの provider で始めるか選ぶ
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. 後からの長期変更には `gctree update-global-context` を使う
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 を作り、provider モード / オンボーディング provider / 優先言語を保存し、現在の環境を scaffold し、`main` が空ならガイド付きオンボーディングまで開始します。 |
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 状態、警告、優先 provider を表示します。 |
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|claude-code>` | 別の環境に provider 向けコマンド面をインストールします。 |
39
+ | `gctree scaffold --host <codex\|claude-code>` | 別の環境にプロバイダー向けコマンド面をインストールします。 |
40
40
 
41
- ## repo scope の例
41
+ ## resolve が返す内容
42
42
 
43
- gc-branch `A` repo `B`、`C`、`D` には関係し、`F` には関係しないとします。
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
- repo `E` から `resolve` を実行し、branch `A` がまだそこにマップされていない場合、`gctree` は次のどれにするかを尋ねられます。
88
+ リポジトリ `E` から `resolve` を実行し、ブランチ `A` がまだそこにマップされていない場合、`gctree` は次のどれにするかを尋ねられます。
63
89
 
64
90
  1. 今回だけ続ける
65
91
  2. `E` では今後も常に `A` を使う
@@ -98,24 +124,46 @@ 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` は、ガイド付きオンボーディングやガイド付き更新などの provider 向けコマンド面をインストールします。
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/prompts/gctree-bootstrap.md ← Codex セッション向けのブートストラップコンテキスト
149
+ .codex/skills/gc-resolve-context/SKILL.md ← resolve スキル
150
+ .codex/skills/gc-onboard/SKILL.md ← オンボーディングスキル
151
+ .codex/skills/gc-update-global-context/SKILL.md ← 更新スキル
116
152
  ```
117
153
 
118
- ### ランタイムの振る舞い
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
+
166
+ ### ランタイムの動作
119
167
 
120
- デフォルトのアクティブ gc-branch は `~/.gctree` `HEAD` が指しているものですが、特定のリポジトリが別の gc-branch に明示的に結び付けられている場合は、repo mapping がその既定値を上書きできます。
121
- このおかげで、互いに無関係なセッションをたくさん同時に開いているヘビーユーザーでも gc-tree を実用的に使えます。
168
+ デフォルトのアクティブ gc-branch は `~/.gctree` 内の `HEAD` が指しているものですが、リポジトリが別の gc-branch に明示的に結び付けられている場合は、repo mapping がそのフォールバックを上書きできます。
169
+ これにより、互いに無関係なセッションを多数同時に開いているヘビーユーザーでも gc-tree を実用的に使えます。
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
- 표준적인 `gctree` 흐름은 이렇습니다. gc-tree 초기화하고, provider를 고르고, 기본 `main` gc-branch 온보딩하고, 필요한 컨텍스트를 resolve 불러오고, 필요할 때 새 gc-branch 만들고, 레포를 맞는 gc-branch에 매핑하고, 나중에는 가이드형 업데이트로 장기 컨텍스트를 유지합니다.
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. 선호하는 provider 모드 선택 (`claude-code`, `codex`, `both`)
13
- 3. 워크플로 언어 선택 (`English`, `Korean`, 또는 커스텀 언어)
14
- 4. `both`를 골랐다면 이번 온보딩을 어느 provider로 시작할지 선택
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`는 비어 있는 gc-branch에서만 실행
19
- 9. repo scope 매핑으로 gc-branch가 자기 레포에서만 적용되게 유지
20
- 10. 장기 변경은 나중에 `gctree update-global-context`로 반영
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`를 만들고, 기본 `main` gc-branch 만들고, provider 모드/온보딩 provider/선호 언어를 저장하고, 현재 환경을 스캐폴딩하고, `main`이 비어 있으면 가이드형 온보딩까지 시작합니다. |
27
- | `gctree checkout <branch>` | 활성 gc-branch 전환합니다. |
28
- | `gctree checkout -b <branch>` | 새로운 빈 gc-branch를 만들고 바로 전환합니다. |
29
- | `gctree branches` | 사용 가능한 gc-branch 목록과 현재 활성 브랜치를 보여줍니다. |
30
- | `gctree status` | 활성 gc-branch, 현재 레포, 현재 repo-scope 상태, 경고, 선호 provider를 보여줍니다. |
31
- | `gctree resolve --query TEXT` | 관련 gc-branch에서 컨텍스트를 찾습니다. 현재 레포가 아직 매핑되지 않았다면, 레포를 어떻게 다룰지 물어볼 수 있습니다. |
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>` | 다른 환경에도 provider용 명령 표면을 설치합니다. |
40
-
41
- ## repo scope 예시 흐름
42
-
43
- gc-branch `A`가 `B`, `C`, `D` 레포에는 관련 있고 `F`에는 관련이 없다고 가정해봅시다.
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` 레포에서 `resolve`를 실행했는데 branch `A`가 아직 거기에 매핑되지 않았다면, `gctree`는 다음 중 무엇을 할지 물어볼 수 있습니다.
88
+ 저장소 `E`에서 `resolve`를 실행할 브랜치 `A`가 아직 매핑되지 않은 경우, `gctree`가 다음 중 하나를 선택하도록 물어볼 수 있습니다:
63
89
 
64
- 1. 이번만 계속하기
65
- 2. `E`에서는 앞으로도 항상 `A` 사용하기
66
- 3. `E`에서는 `A` 무시하기
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,59 @@ 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. 먼저 레포를 gc-branch에 매핑하고
104
- 2. 그다음 `update-global-context`를 실행해서 레포가 무엇을 하는지,중요한지 같은 장기 지식을 추가하기
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`는 가이드형 온보딩, 가이드형 업데이트 같은 provider 명령 표면을 설치합니다.
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/prompts/gctree-bootstrap.md ← Codex 세션의 부트스트랩 컨텍스트
149
+ .codex/skills/gc-resolve-context/SKILL.md ← resolve 스킬
150
+ .codex/skills/gc-onboard/SKILL.md ← 온보딩 스킬
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
- 기본적으로 활성 gc-branch는 `~/.gctree` 안의 `HEAD`가 가리키는 브랜치입니다. 다만 특정 레포가 다른 gc-branch에 명시적으로 묶여 있다면 repo mapping이 기본값을 덮어쓸 수 있습니다.
121
- 덕분에 서로 무관한 세션을 많이 동시에 띄워두는 사용자에게도 gc-tree가 실용적으로 동작합니다.
168
+ 활성 gc-branch는 `~/.gctree` 내의 `HEAD`가 가리키는 브랜치이지만, 저장소가 다른 gc-branch에 명시적으로 바인딩된 경우 저장소 매핑이 해당 폴백을 재정의할 수 있습니다.
169
+ 이를 통해 관련 없는 여러 세션을 동시에 열어두는 헤비 유저에게도 gc-tree가 실용적으로 동작합니다.