@handsupmin/gc-tree 0.1.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.
Files changed (46) hide show
  1. package/LICENSE +21 -0
  2. package/README.es.md +166 -0
  3. package/README.ja.md +166 -0
  4. package/README.ko.md +166 -0
  5. package/README.md +166 -0
  6. package/README.zh.md +166 -0
  7. package/dist/src/cli.js +360 -0
  8. package/dist/src/markdown.js +81 -0
  9. package/dist/src/onboard.js +36 -0
  10. package/dist/src/onboarding-protocol.js +38 -0
  11. package/dist/src/paths.js +28 -0
  12. package/dist/src/proposals.js +73 -0
  13. package/dist/src/provider.js +121 -0
  14. package/dist/src/repo-map.js +149 -0
  15. package/dist/src/resolve.js +38 -0
  16. package/dist/src/scaffold.js +199 -0
  17. package/dist/src/settings.js +30 -0
  18. package/dist/src/store.js +149 -0
  19. package/dist/src/types.js +1 -0
  20. package/dist/src/update.js +26 -0
  21. package/docs/concept.es.md +81 -0
  22. package/docs/concept.ja.md +81 -0
  23. package/docs/concept.ko.md +81 -0
  24. package/docs/concept.md +81 -0
  25. package/docs/concept.zh.md +81 -0
  26. package/docs/local-development.es.md +83 -0
  27. package/docs/local-development.ja.md +83 -0
  28. package/docs/local-development.ko.md +83 -0
  29. package/docs/local-development.md +83 -0
  30. package/docs/local-development.zh.md +83 -0
  31. package/docs/principles.es.md +49 -0
  32. package/docs/principles.ja.md +49 -0
  33. package/docs/principles.ko.md +49 -0
  34. package/docs/principles.md +50 -0
  35. package/docs/principles.zh.md +49 -0
  36. package/docs/usage.es.md +119 -0
  37. package/docs/usage.ja.md +119 -0
  38. package/docs/usage.ko.md +119 -0
  39. package/docs/usage.md +121 -0
  40. package/docs/usage.zh.md +119 -0
  41. package/package.json +32 -0
  42. package/skills/checkout/SKILL.md +17 -0
  43. package/skills/onboard/SKILL.md +74 -0
  44. package/skills/reset-gc-branch/SKILL.md +14 -0
  45. package/skills/resolve-context/SKILL.md +21 -0
  46. package/skills/update-global-context/SKILL.md +21 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 handsupmin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.es.md ADDED
@@ -0,0 +1,166 @@
1
+ # gc-tree
2
+
3
+ Una capa de contexto global con ramas para herramientas de programación con IA.
4
+
5
+ [English](README.md) | [한국어](README.ko.md) | [简体中文](README.zh.md) | [日本語](README.ja.md) | [Español](README.es.md)
6
+
7
+ ## Introducción
8
+
9
+ `gctree` es un **Global Context Tree** ligero para herramientas de programación con IA.
10
+ Le da al contexto duradero un hogar reutilizable, basado en archivos y separado por ramas, sin obligarte a adoptar una plataforma completa de orquestación.
11
+
12
+ Cuando un solo `AGENTS.md`, `CLAUDE.md` o fragmento de prompt ya no alcanza, `gctree` te ayuda a:
13
+
14
+ - separar el contexto por producto, cliente o línea de trabajo
15
+ - conservar el conocimiento fuente en markdown en lugar de depender de memoria oculta
16
+ - resolver el contexto activo rápidamente con un índice liviano y documentos summary-first
17
+ - hacer onboarding y actualizaciones duraderas desde tu CLI LLM preferida
18
+ - hacer que un gc-branch solo se use en los repos realmente relacionados
19
+
20
+ ## Características rápidas
21
+
22
+ - **Onboarding guiado por provider**
23
+ `gctree init` primero te pregunta qué modo de provider quieres usar (`claude-code`, `codex` o `both`), luego qué idioma deben usar las respuestas, guarda esas decisiones, prepara la superficie de comandos adecuada y arranca el onboarding del gc-branch `main` por defecto.
24
+ - **gc-branches con alcance por repositorio**
25
+ Con `~/.gctree/branch-repo-map.json` puedes asociar un gc-branch solo a ciertos repositorios. Por ejemplo, hacer que A aplique a B/C/D y se ignore en F.
26
+ - **Protección interactiva de alcance**
27
+ Si `gctree resolve` detecta que el repositorio actual todavía no está asociado a ese gc-branch, puede preguntarte si quieres continuar una vez, usarlo siempre aquí o ignorarlo aquí.
28
+ - **Documentación summary-first**
29
+ Las herramientas pueden leer primero un resumen corto y abrir el documento completo solo cuando hace falta.
30
+ - **Actualizaciones duraderas guiadas**
31
+ Puedes actualizar el contexto global con el mismo flujo del provider, sin escribir JSON a mano.
32
+
33
+ ## Instalación y guía rápida
34
+
35
+ ### Instalar desde npm
36
+
37
+ ```bash
38
+ npm install -g @handsupmin/gc-tree
39
+ ```
40
+
41
+ Si solo quieres ejecutarlo una vez sin instalación global:
42
+
43
+ ```bash
44
+ npx @handsupmin/gc-tree init
45
+ ```
46
+
47
+ - **Nombre del paquete:** `@handsupmin/gc-tree`
48
+ - **Comando CLI:** `gctree`
49
+ - **Requisito:** Node.js 20+
50
+ Para desarrollo desde el código fuente, consulta [docs/local-development.md](docs/local-development.md).
51
+
52
+ ### Inicio rápido
53
+
54
+ #### 1) Inicializa gc-tree
55
+
56
+ ```bash
57
+ gctree init
58
+ ```
59
+
60
+ Este comando:
61
+
62
+ - crea `~/.gctree`
63
+ - crea el gc-branch `main` por defecto
64
+ - te pide elegir un modo de provider (`claude-code`, `codex` o `both`)
65
+ - si eliges `both`, te pregunta qué provider debe iniciar este onboarding
66
+ - te pide elegir el idioma (`English`, `Korean` o escribir tu propio idioma)
67
+ - guarda el modo de provider, el provider real de onboarding y el idioma en `~/.gctree/settings.json`
68
+ - prepara la superficie de comandos adecuada en el entorno actual
69
+ - inicia el onboarding guiado del gc-branch activo cuando `main` sigue vacío
70
+
71
+ #### 2) Resuelve el contexto activo
72
+
73
+ ```bash
74
+ gctree resolve --query "auth token rotation"
75
+ ```
76
+
77
+ Si el repositorio actual aún no está asociado a ese gc-branch, `gctree` puede dejarte elegir entre:
78
+
79
+ 1. continuar solo esta vez
80
+ 2. usar siempre este gc-branch en este repo
81
+ 3. ignorar este gc-branch en este repo
82
+
83
+ Si eliges 2 o 3, `~/.gctree/branch-repo-map.json` se actualiza.
84
+
85
+ #### 3) Crea otro gc-branch si necesitas un contexto separado
86
+
87
+ ```bash
88
+ gctree checkout -b client-b
89
+ ```
90
+
91
+ `checkout -b` crea un **gc-branch vacío nuevo**. No copia los documentos de otra rama.
92
+
93
+ #### 4) Haz onboarding de un gc-branch vacío
94
+
95
+ ```bash
96
+ gctree onboard
97
+ ```
98
+
99
+ #### 5) Actualiza el contexto duradero más adelante
100
+
101
+ ```bash
102
+ gctree update-global-context
103
+ ```
104
+
105
+ Alias cortos:
106
+
107
+ ```bash
108
+ gctree update-gc
109
+ gctree ugc
110
+ ```
111
+
112
+ Si al trabajar descubres que un repo realmente pertenece al gc-branch actual, el flujo natural es:
113
+
114
+ 1. primero añadir ese repo al branch repo map
115
+ 2. después ejecutar `gctree update-global-context` para agregar contexto duradero sobre qué hace ese repo y por qué importa
116
+
117
+ #### 6) Restablece un gc-branch antes de volver a hacer onboarding
118
+
119
+ ```bash
120
+ gctree reset-gc-branch --branch client-b --yes
121
+ ```
122
+
123
+ ### Comandos visibles dentro del runtime
124
+
125
+ Después del scaffold, los comandos visibles son:
126
+
127
+ - **Codex:** `$gc-onboard`, `$gc-update-global-context`
128
+ - **Claude Code:** `/gc-onboard`, `/gc-update-global-context`
129
+
130
+ Esos comandos deben dejar claro cuál es el gc-branch activo antes de empezar a recoger o actualizar contexto duradero, y también deben mantener el idioma guardado hasta el final, salvo que el usuario pida cambiarlo explícitamente.
131
+
132
+ ### Comandos clave de un vistazo
133
+
134
+ | Objetivo | Comando |
135
+ | --- | --- |
136
+ | Inicializar gc-tree y elegir provider | `gctree init` |
137
+ | Confirmar el gc-branch activo | `gctree status` |
138
+ | Buscar en el contexto activo | `gctree resolve --query "..."` |
139
+ | Ver las reglas de alcance por repo | `gctree repo-map` |
140
+ | Incluir o excluir un repo para un gc-branch | `gctree set-repo-scope --branch <name> --include` / `--exclude` |
141
+ | Crear o cambiar gc-branches | `gctree checkout <branch>` / `gctree checkout -b <branch>` |
142
+ | Hacer onboarding de un gc-branch vacío | `gctree onboard` |
143
+ | Actualizar el gc-branch activo | `gctree update-global-context` / `gctree update-gc` / `gctree ugc` |
144
+ | Restablecer un gc-branch antes de re-onboard | `gctree reset-gc-branch --branch <name> --yes` |
145
+ | Instalar scaffold manualmente en otro entorno | `gctree scaffold --host codex --target /path/to/repo` |
146
+
147
+ ## Documentación
148
+
149
+ La documentación detallada está en el directorio [`docs/`](docs).
150
+
151
+ - **Concepto** — [`docs/concept.es.md`](docs/concept.es.md)
152
+ Explica qué es `gctree`, qué problema resuelve y cuál es el alcance de la capa de contexto global.
153
+ - **Principios** — [`docs/principles.es.md`](docs/principles.es.md)
154
+ Resume las reglas de gc-branches, alcance por repositorio, documentos summary-first y actualizaciones guiadas.
155
+ - **Uso** — [`docs/usage.es.md`](docs/usage.es.md)
156
+ Describe el flujo CLI estándar, los comandos del provider, el comportamiento de alcance por repo y los patrones de integración.
157
+ - **Desarrollo local** — [`docs/local-development.es.md`](docs/local-development.es.md)
158
+ Explica cómo instalar dependencias, ejecutar la CLI localmente y verificar cambios.
159
+
160
+ ## Contribuir
161
+
162
+ Las contribuciones son bienvenidas. Consulta el documento en inglés [CONTRIBUTING.md](CONTRIBUTING.md) para ver el flujo de desarrollo y la checklist de PR.
163
+
164
+ ## Licencia
165
+
166
+ MIT. Consulta [`LICENSE`](LICENSE).
package/README.ja.md ADDED
@@ -0,0 +1,166 @@
1
+ # gc-tree
2
+
3
+ AI コーディングツール向けのブランチ対応グローバルコンテキストレイヤー。
4
+
5
+ [English](README.md) | [한국어](README.ko.md) | [简体中文](README.zh.md) | [日本語](README.ja.md) | [Español](README.es.md)
6
+
7
+ ## 紹介
8
+
9
+ `gctree` は AI コーディングツール向けの軽量な **Global Context Tree** です。
10
+ 長期的なコンテキストに、ファイルベースで再利用しやすく、ブランチ単位で切り替えられる明確な置き場所を与え、既存のワークフローにも自然に組み込めます。
11
+
12
+ 1 つの `AGENTS.md`、`CLAUDE.md`、あるいは短いプロンプト断片だけでは足りなくなったとき、`gctree` は次のことを助けます。
13
+
14
+ - プロダクト、クライアント、作業トラックごとにコンテキストを分ける
15
+ - 隠れたメモリではなく、markdown 文書を source of truth として管理する
16
+ - 小さなインデックスと summary-first ドキュメントで必要なコンテキストを素早く見つける
17
+ - 好みの LLM CLI を使ってオンボーディングと永続更新を進める
18
+ - ある gc-branch が本当に関係するリポジトリでだけ使われるようにする
19
+
20
+ ## 簡単な特徴
21
+
22
+ - **Provider 駆動のオンボーディング**
23
+ `gctree init` はまず `claude-code`、`codex`、`both` のどの provider モードを使うかを聞き、その後に応答言語を選ばせ、選択内容を保存して必要なコマンド面を用意したうえで、デフォルトの `main` gc-branch のオンボーディングを開始します。
24
+ - **リポジトリ範囲付き gc-branch**
25
+ `~/.gctree/branch-repo-map.json` により、1 つの gc-branch を特定のリポジトリ群にだけ結びつけられます。たとえば A を B/C/D にだけ適用し、F では無視できます。
26
+ - **対話的な範囲ガード**
27
+ `gctree resolve` が現在のリポジトリをまだこの gc-branch に結び付けていないと判断した場合、今回だけ使うか、今後も使うか、ここでは無視するかを選べます。
28
+ - **Summary-first ドキュメント構造**
29
+ ツールはまず短い要約を読み、必要なときだけ全文を読み込めます。
30
+ - **ガイド付きの永続更新**
31
+ JSON ファイルを手で作らなくても、同じ provider フローでグローバルコンテキストを更新できます。
32
+
33
+ ## インストールとクイックスタート
34
+
35
+ ### npm からインストール
36
+
37
+ ```bash
38
+ npm install -g @handsupmin/gc-tree
39
+ ```
40
+
41
+ グローバルインストールなしで一度だけ実行する場合:
42
+
43
+ ```bash
44
+ npx @handsupmin/gc-tree init
45
+ ```
46
+
47
+ - **パッケージ名:** `@handsupmin/gc-tree`
48
+ - **CLI コマンド:** `gctree`
49
+ - **要件:** Node.js 20+
50
+ ソースベースの開発は [docs/local-development.md](docs/local-development.md) を参照してください。
51
+
52
+ ### クイックスタート
53
+
54
+ #### 1) gc-tree を初期化する
55
+
56
+ ```bash
57
+ gctree init
58
+ ```
59
+
60
+ このコマンドは次のことを行います。
61
+
62
+ - `~/.gctree` を作成する
63
+ - デフォルトの `main` gc-branch を作成する
64
+ - provider モード(`claude-code`、`codex`、`both`)を選ばせる
65
+ - `both` を選んだ場合は、今回のオンボーディングをどちらで始めるかをさらに選ばせる
66
+ - 言語(`English`、`Korean`、または自由入力)を選ばせる
67
+ - provider モード、実際のオンボーディング provider、言語を `~/.gctree/settings.json` に保存する
68
+ - 現在の環境に必要なコマンド面を用意する
69
+ - `main` が空であれば、アクティブな gc-branch のガイド付きオンボーディングを開始する
70
+
71
+ #### 2) 現在のコンテキストを解決する
72
+
73
+ ```bash
74
+ gctree resolve --query "auth token rotation"
75
+ ```
76
+
77
+ 現在のリポジトリがその gc-branch にまだ紐付いていない場合、`gctree` は次を選ばせます。
78
+
79
+ 1. 今回だけ続行する
80
+ 2. 今後もこのリポジトリでこの gc-branch を使う
81
+ 3. このリポジトリではこの gc-branch を無視する
82
+
83
+ 2 または 3 を選ぶと `~/.gctree/branch-repo-map.json` が更新されます。
84
+
85
+ #### 3) 別のコンテキストが必要なら新しい gc-branch を作る
86
+
87
+ ```bash
88
+ gctree checkout -b client-b
89
+ ```
90
+
91
+ `checkout -b` は**新しい空の gc-branch**を作ります。既存のブランチ文書はコピーしません。
92
+
93
+ #### 4) 空の gc-branch をオンボードする
94
+
95
+ ```bash
96
+ gctree onboard
97
+ ```
98
+
99
+ #### 5) 後から永続コンテキストを更新する
100
+
101
+ ```bash
102
+ gctree update-global-context
103
+ ```
104
+
105
+ 短い別名:
106
+
107
+ ```bash
108
+ gctree update-gc
109
+ gctree ugc
110
+ ```
111
+
112
+ 実際に作業してみて、そのリポジトリが現在の gc-branch に属するべきだと分かった場合は、自然な流れはこうです。
113
+
114
+ 1. まずそのリポジトリを branch repo map に追加する
115
+ 2. その後 `gctree update-global-context` を実行して、そのリポジトリが何を担うのか、なぜ重要なのかといった長期コンテキストを追加する
116
+
117
+ #### 6) 再オンボーディングの前に gc-branch をリセットする
118
+
119
+ ```bash
120
+ gctree reset-gc-branch --branch client-b --yes
121
+ ```
122
+
123
+ ### ランタイムで見える provider コマンド
124
+
125
+ scaffold 後に見えるコマンドは次の通りです。
126
+
127
+ - **Codex:** `$gc-onboard`, `$gc-update-global-context`
128
+ - **Claude Code:** `/gc-onboard`, `/gc-update-global-context`
129
+
130
+ これらのコマンドは、長期コンテキストを集めたり更新したりする前に、現在の gc-branch を必ず明示し、ユーザーが明示的に切り替えを求めない限り、保存された言語を最後まで維持するべきです。
131
+
132
+ ### 主要コマンド一覧
133
+
134
+ | 目的 | コマンド |
135
+ | --- | --- |
136
+ | gc-tree を初期化して provider を選ぶ | `gctree init` |
137
+ | 現在の gc-branch を確認する | `gctree status` |
138
+ | 現在のコンテキストを検索する | `gctree resolve --query "..."` |
139
+ | リポジトリ範囲ルールを確認する | `gctree repo-map` |
140
+ | gc-branch に対してリポジトリを明示的に含める/除外する | `gctree set-repo-scope --branch <name> --include` / `--exclude` |
141
+ | gc-branch を作成/切り替えする | `gctree checkout <branch>` / `gctree checkout -b <branch>` |
142
+ | 空の gc-branch をオンボードする | `gctree onboard` |
143
+ | 現在の gc-branch を永続更新する | `gctree update-global-context` / `gctree update-gc` / `gctree ugc` |
144
+ | 再オンボーディング前に gc-branch をリセットする | `gctree reset-gc-branch --branch <name> --yes` |
145
+ | 別環境に手動で scaffold を入れる | `gctree scaffold --host codex --target /path/to/repo` |
146
+
147
+ ## ドキュメント
148
+
149
+ 詳細ドキュメントは [`docs/`](docs) にまとまっています。
150
+
151
+ - **コンセプト** — [`docs/concept.ja.md`](docs/concept.ja.md)
152
+ `gctree` が何であり、どの課題を解決し、どこまでを担当するのかを説明します。
153
+ - **原則** — [`docs/principles.ja.md`](docs/principles.ja.md)
154
+ gc-branch、リポジトリ範囲、summary-first 文書、ガイド付き更新の考え方をまとめています。
155
+ - **使い方** — [`docs/usage.ja.md`](docs/usage.ja.md)
156
+ 標準 CLI フロー、provider コマンド、リポジトリ範囲の挙動、統合パターンを案内します。
157
+ - **ローカル実行方法** — [`docs/local-development.ja.md`](docs/local-development.ja.md)
158
+ 依存関係のインストール、CLI のローカル実行、変更確認手順を説明します。
159
+
160
+ ## コントリビュート
161
+
162
+ コントリビューション歓迎です。開発フローと PR チェックリストは英語ドキュメントの [CONTRIBUTING.md](CONTRIBUTING.md) を参照してください。
163
+
164
+ ## ライセンス
165
+
166
+ MIT。詳細は [`LICENSE`](LICENSE) を参照してください。
package/README.ko.md ADDED
@@ -0,0 +1,166 @@
1
+ # gc-tree
2
+
3
+ AI 코딩 도구를 위한 브랜치 기반 글로벌 컨텍스트 레이어.
4
+
5
+ [English](README.md) | [한국어](README.ko.md) | [简体中文](README.zh.md) | [日本語](README.ja.md) | [Español](README.es.md)
6
+
7
+ ## 소개
8
+
9
+ `gctree`는 AI 코딩 도구를 위한 가벼운 **Global Context Tree**입니다.
10
+ 장기적으로 유지해야 하는 컨텍스트를 파일 기반으로 명시적으로 관리할 수 있게 해주며, 브랜치 단위로 분리해서 기존 워크플로에 자연스럽게 붙일 수 있습니다.
11
+
12
+ 하나의 `AGENTS.md`, `CLAUDE.md`, 혹은 짧은 프롬프트 파일만으로는 부족해질 때 `gctree`는 다음을 도와줍니다.
13
+
14
+ - 제품, 고객사, 업무 트랙별로 컨텍스트를 분리하기
15
+ - 숨겨진 메모리 대신 markdown 기반의 source-of-truth 문서로 관리하기
16
+ - 작은 인덱스와 summary-first 문서 구조로 필요한 컨텍스트를 빠르게 찾기
17
+ - 선호하는 LLM CLI를 통해 온보딩과 장기 업데이트를 진행하기
18
+ - 특정 gc-branch가 실제로 관련 있는 레포에만 적용되게 하기
19
+
20
+ ## 간단 특징
21
+
22
+ - **Provider 기반 온보딩**
23
+ `gctree init`은 `claude-code`, `codex`, `both` 중 어떤 provider 모드를 쓸지 묻고, 이어서 응답 언어를 고르게 한 뒤, 그 선택을 저장하고 필요한 명령 표면을 스캐폴딩한 다음 기본 `main` gc-branch 온보딩을 시작합니다.
24
+ - **레포 범위 인식 gc-branch**
25
+ `~/.gctree/branch-repo-map.json`을 통해 하나의 gc-branch를 특정 레포 집합에만 연결할 수 있습니다. 예를 들어 A는 B/C/D에만 적용하고 F에서는 무시하게 만들 수 있습니다.
26
+ - **인터랙티브 범위 가드**
27
+ `gctree resolve`가 현재 레포가 아직 이 gc-branch에 매핑되지 않았다고 판단하면, 이번만 진행할지 / 항상 사용할지 / 여기서는 무시할지를 물어볼 수 있습니다.
28
+ - **Summary-first 문서 구조**
29
+ 도구가 먼저 짧은 요약을 읽고, 필요할 때만 본문을 확장해서 읽을 수 있습니다.
30
+ - **가이드형 장기 업데이트**
31
+ JSON 파일을 직접 만들지 않아도 같은 provider 흐름으로 글로벌 컨텍스트를 갱신할 수 있습니다.
32
+
33
+ ## 설치 및 빠른 시작
34
+
35
+ ### npm으로 설치
36
+
37
+ ```bash
38
+ npm install -g @handsupmin/gc-tree
39
+ ```
40
+
41
+ 글로벌 설치 없이 한 번만 실행하려면:
42
+
43
+ ```bash
44
+ npx @handsupmin/gc-tree init
45
+ ```
46
+
47
+ - **패키지 이름:** `@handsupmin/gc-tree`
48
+ - **CLI 명령어:** `gctree`
49
+ - **요구 사항:** Node.js 20+
50
+ 소스 기반 개발은 [docs/local-development.md](docs/local-development.md)를 참고하세요.
51
+
52
+ ### 빠른 시작
53
+
54
+ #### 1) gc-tree 초기화
55
+
56
+ ```bash
57
+ gctree init
58
+ ```
59
+
60
+ 이 명령은 다음을 수행합니다.
61
+
62
+ - `~/.gctree` 생성
63
+ - 기본 `main` gc-branch 생성
64
+ - 사용할 provider 모드(`claude-code`, `codex`, `both`) 선택
65
+ - `both`를 고르면 이번 온보딩을 어느 provider로 시작할지 한 번 더 선택
66
+ - 사용할 언어(`English`, `Korean`, 또는 직접 입력한 언어) 선택
67
+ - provider 모드, 실제 온보딩 provider, 언어를 `~/.gctree/settings.json`에 저장
68
+ - 현재 환경에 맞는 명령 표면 스캐폴딩
69
+ - `main`이 비어 있으면 활성 gc-branch에 대한 가이드형 온보딩 시작
70
+
71
+ #### 2) 현재 컨텍스트 조회
72
+
73
+ ```bash
74
+ gctree resolve --query "auth token rotation"
75
+ ```
76
+
77
+ 만약 현재 레포가 이 gc-branch의 매핑 범위 밖이라면, `gctree`는 다음 중 하나를 고르게 할 수 있습니다.
78
+
79
+ 1. 이번만 진행
80
+ 2. 이 레포에서 항상 이 gc-branch 사용
81
+ 3. 이 레포에서는 이 gc-branch 무시
82
+
83
+ 2번 또는 3번을 고르면 `~/.gctree/branch-repo-map.json`이 갱신됩니다.
84
+
85
+ #### 3) 별도 컨텍스트가 필요하면 새 gc-branch 생성
86
+
87
+ ```bash
88
+ gctree checkout -b client-b
89
+ ```
90
+
91
+ `checkout -b`는 **새로운 빈 gc-branch**를 만듭니다. 기존 브랜치 문서를 복사하지 않습니다.
92
+
93
+ #### 4) 비어 있는 gc-branch를 온보딩
94
+
95
+ ```bash
96
+ gctree onboard
97
+ ```
98
+
99
+ #### 5) 나중에 장기 컨텍스트 업데이트
100
+
101
+ ```bash
102
+ gctree update-global-context
103
+ ```
104
+
105
+ 짧은 별칭:
106
+
107
+ ```bash
108
+ gctree update-gc
109
+ gctree ugc
110
+ ```
111
+
112
+ 만약 실제 작업을 하다 보니 어떤 레포가 현재 gc-branch에 포함되어야 할 것 같다면, 자연스러운 흐름은 이렇습니다.
113
+
114
+ 1. 먼저 그 레포를 branch repo map에 포함시키고
115
+ 2. 그 다음 `gctree update-global-context`로 이 레포가 어떤 역할을 하는지, 왜 중요한지 같은 장기 컨텍스트를 추가
116
+
117
+ #### 6) 다시 온보딩하려면 먼저 gc-branch 리셋
118
+
119
+ ```bash
120
+ gctree reset-gc-branch --branch client-b --yes
121
+ ```
122
+
123
+ ### 런타임에서 보이는 provider 명령
124
+
125
+ 스캐폴딩 이후 런타임에서 보이는 명령은 다음과 같습니다.
126
+
127
+ - **Codex:** `$gc-onboard`, `$gc-update-global-context`
128
+ - **Claude Code:** `/gc-onboard`, `/gc-update-global-context`
129
+
130
+ 이 명령들은 항상 현재 활성 gc-branch가 무엇인지 먼저 밝히고, 사용자가 명시적으로 바꾸라고 하지 않는 한 저장된 언어를 끝까지 유지하면서 컨텍스트를 수집하거나 업데이트해야 합니다.
131
+
132
+ ### 핵심 명령 한눈에 보기
133
+
134
+ | 목적 | 명령 |
135
+ | --- | --- |
136
+ | gc-tree 초기화 및 provider 선택 | `gctree init` |
137
+ | 현재 gc-branch 확인 | `gctree status` |
138
+ | 현재 컨텍스트 검색 | `gctree resolve --query "..."` |
139
+ | 레포 범위 규칙 확인 | `gctree repo-map` |
140
+ | gc-branch에 레포 포함/제외 설정 | `gctree set-repo-scope --branch <name> --include` / `--exclude` |
141
+ | gc-branch 생성/전환 | `gctree checkout <branch>` / `gctree checkout -b <branch>` |
142
+ | 비어 있는 gc-branch 온보딩 | `gctree onboard` |
143
+ | 활성 gc-branch 장기 업데이트 | `gctree update-global-context` / `gctree update-gc` / `gctree ugc` |
144
+ | 다시 온보딩하기 전 gc-branch 초기화 | `gctree reset-gc-branch --branch <name> --yes` |
145
+ | 다른 환경에 수동 스캐폴딩 | `gctree scaffold --host codex --target /path/to/repo` |
146
+
147
+ ## 문서
148
+
149
+ 자세한 문서는 [`docs/`](docs) 아래에 정리되어 있습니다.
150
+
151
+ - **컨셉** — [`docs/concept.ko.md`](docs/concept.ko.md)
152
+ `gctree`가 무엇인지, 어떤 문제를 해결하는지, 글로벌 컨텍스트 레이어의 범위를 설명합니다.
153
+ - **원리** — [`docs/principles.ko.md`](docs/principles.ko.md)
154
+ gc-branch, 레포 범위, slim index, summary-first 문서, 가이드형 업데이트 원칙을 정리합니다.
155
+ - **사용방법** — [`docs/usage.ko.md`](docs/usage.ko.md)
156
+ 표준 CLI 흐름, provider 명령, 레포 범위 동작, 통합 패턴을 안내합니다.
157
+ - **로컬 실행방법** — [`docs/local-development.ko.md`](docs/local-development.ko.md)
158
+ 의존성 설치, 로컬 CLI 실행, 변경 검증 방법을 설명합니다.
159
+
160
+ ## 기여하기
161
+
162
+ 기여는 언제든 환영합니다. 개발 흐름과 PR 체크리스트는 영어 문서인 [CONTRIBUTING.md](CONTRIBUTING.md)를 참고해주세요.
163
+
164
+ ## 라이선스
165
+
166
+ MIT. 자세한 내용은 [`LICENSE`](LICENSE)를 참고하세요.
package/README.md ADDED
@@ -0,0 +1,166 @@
1
+ # gc-tree
2
+
3
+ Branch-aware global context for AI coding tools.
4
+
5
+ [English](README.md) | [한국어](README.ko.md) | [简体中文](README.zh.md) | [日本語](README.ja.md) | [Español](README.es.md)
6
+
7
+ ## Introduction
8
+
9
+ `gctree` is a lightweight **Global Context Tree** for AI coding tools.
10
+ It gives long-lived context a reusable, file-backed home that stays explicit, branch-aware, and easy to plug into existing workflows.
11
+
12
+ When a single `AGENTS.md`, `CLAUDE.md`, or prompt snippet is no longer enough, `gctree` helps you:
13
+
14
+ - separate context by product, client, or workstream
15
+ - keep source-of-truth knowledge in markdown instead of hidden memory
16
+ - resolve the active context quickly with a slim index and summary-first docs
17
+ - onboard and update durable context through your preferred LLM CLI provider
18
+ - limit a gc-branch to the repositories where it actually applies
19
+
20
+ ## Key Features
21
+
22
+ - **Provider-driven onboarding**
23
+ `gctree init` asks which provider mode you want (`claude-code`, `codex`, or `both`), then asks which language to use for responses, saves both choices, scaffolds the right command surface, and starts guided onboarding for the default `main` gc-branch.
24
+ - **Repo-aware gc-branch scope**
25
+ `gctree` can map a gc-branch to specific repositories through `~/.gctree/branch-repo-map.json`, so one branch can apply to B/C/D while being ignored in F.
26
+ - **Interactive scope guard**
27
+ If `gctree resolve` runs in a repo that is not yet mapped to the current gc-branch, it can ask whether to continue once, always use this gc-branch here, or ignore it here.
28
+ - **Summary-first documentation**
29
+ Let tools read the short version first and expand only when they need more detail.
30
+ - **Guided durable updates**
31
+ Reuse the same provider-driven flow to update context without hand-authoring JSON files.
32
+
33
+ ## Install & Quick Start
34
+
35
+ ### Install from npm
36
+
37
+ ```bash
38
+ npm install -g @handsupmin/gc-tree
39
+ ```
40
+
41
+ Or run it once without a global install:
42
+
43
+ ```bash
44
+ npx @handsupmin/gc-tree init
45
+ ```
46
+
47
+ - **Package name:** `@handsupmin/gc-tree`
48
+ - **CLI command:** `gctree`
49
+ - **Requirements:** Node.js 20+
50
+ For source-based development details, see [docs/local-development.md](docs/local-development.md).
51
+
52
+ ### Quick Start
53
+
54
+ #### 1) Initialize gc-tree
55
+
56
+ ```bash
57
+ gctree init
58
+ ```
59
+
60
+ This command:
61
+
62
+ - creates `~/.gctree`
63
+ - creates the default `main` gc-branch
64
+ - asks which provider mode you want to use (`claude-code`, `codex`, or `both`)
65
+ - if you choose `both`, asks which provider should start onboarding now
66
+ - asks which language the workflow should use (`English`, `Korean`, or a custom language)
67
+ - saves provider mode, onboarding provider, and language in `~/.gctree/settings.json`
68
+ - scaffolds the current environment for the selected provider mode
69
+ - launches guided onboarding for the active gc-branch when `main` is still empty
70
+
71
+ #### 2) Resolve the active context
72
+
73
+ ```bash
74
+ gctree resolve --query "auth token rotation"
75
+ ```
76
+
77
+ If the current repo is outside the mapped scope for the chosen gc-branch, `gctree` can ask whether to:
78
+
79
+ 1. continue once
80
+ 2. always use this gc-branch for this repo
81
+ 3. ignore this gc-branch for this repo
82
+
83
+ Choosing 2 or 3 updates `~/.gctree/branch-repo-map.json`.
84
+
85
+ #### 3) Create another gc-branch when you need a separate context tree
86
+
87
+ ```bash
88
+ gctree checkout -b client-b
89
+ ```
90
+
91
+ `checkout -b` creates a **new empty gc-branch**. It does not copy existing branch docs.
92
+
93
+ #### 4) Onboard that empty gc-branch through the configured provider
94
+
95
+ ```bash
96
+ gctree onboard
97
+ ```
98
+
99
+ #### 5) Make a durable update later
100
+
101
+ ```bash
102
+ gctree update-global-context
103
+ ```
104
+
105
+ Short aliases:
106
+
107
+ ```bash
108
+ gctree update-gc
109
+ gctree ugc
110
+ ```
111
+
112
+ If a repo turns out to belong to the current gc-branch after real work, the natural flow is:
113
+
114
+ 1. allow that repo in the branch repo map
115
+ 2. then run `gctree update-global-context` to add durable context about what that repo is and why it matters
116
+
117
+ #### 6) Re-onboard only after resetting a gc-branch
118
+
119
+ ```bash
120
+ gctree reset-gc-branch --branch client-b --yes
121
+ ```
122
+
123
+ ### Provider-facing commands inside the runtime
124
+
125
+ After scaffolding, the visible commands are:
126
+
127
+ - **Codex:** `$gc-onboard`, `$gc-update-global-context`
128
+ - **Claude Code:** `/gc-onboard`, `/gc-update-global-context`
129
+
130
+ Those commands should always mention the current active gc-branch before gathering or updating durable context, and they should keep using the saved workflow language unless the user explicitly asks to switch.
131
+
132
+ ### Core commands at a glance
133
+
134
+ | Goal | Command |
135
+ | --- | --- |
136
+ | Initialize gc-tree and choose a provider | `gctree init` |
137
+ | Confirm the active gc-branch | `gctree status` |
138
+ | Search the active context | `gctree resolve --query "..."` |
139
+ | Show repo-scope rules | `gctree repo-map` |
140
+ | Explicitly include/exclude a repo for a gc-branch | `gctree set-repo-scope --branch <name> --include` / `--exclude` |
141
+ | Create or switch gc-branches | `gctree checkout <branch>` / `gctree checkout -b <branch>` |
142
+ | Guided onboarding for an empty gc-branch | `gctree onboard` |
143
+ | Guided durable update for the active gc-branch | `gctree update-global-context` / `gctree update-gc` / `gctree ugc` |
144
+ | Reset a gc-branch before re-onboarding | `gctree reset-gc-branch --branch <name> --yes` |
145
+ | Scaffold another environment manually | `gctree scaffold --host codex --target /path/to/repo` |
146
+
147
+ ## Documentation
148
+
149
+ Detailed docs live in the [`docs/`](docs) directory.
150
+
151
+ - **Concept** — [`docs/concept.md`](docs/concept.md)
152
+ Learn what `gctree` is, which problem it solves, and what belongs in the global-context layer.
153
+ - **Principles** — [`docs/principles.md`](docs/principles.md)
154
+ Read the rules behind gc-branches, repo scope, slim indexes, summary-first docs, and guided updates.
155
+ - **Usage** — [`docs/usage.md`](docs/usage.md)
156
+ See the standard CLI flow, provider-facing commands, repo-scope behavior, and integration patterns.
157
+ - **Local development** — [`docs/local-development.md`](docs/local-development.md)
158
+ Learn how to run the CLI locally and verify changes before contributing.
159
+
160
+ ## Contribution
161
+
162
+ Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for the development workflow and pull request checklist.
163
+
164
+ ## License
165
+
166
+ MIT. See [`LICENSE`](LICENSE).