@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
@@ -0,0 +1,119 @@
1
+ # Uso
2
+
3
+ [English](usage.md) | [한국어](usage.ko.md) | [简体中文](usage.zh.md) | [日本語](usage.ja.md) | [Español](usage.es.md)
4
+
5
+ ## Summary
6
+
7
+ Un flujo estándar de `gctree` consiste en inicializar gc-tree, elegir un provider, completar el onboarding del gc-branch `main`, crear nuevos gc-branches cuando haga falta, asociar cada repositorio al gc-branch correcto y usar actualizaciones guiadas para los cambios duraderos.
8
+
9
+ ## Flujo estándar
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 escribe tu propio idioma)
14
+ 4. si elegiste `both`, decide qué provider debe iniciar este onboarding
15
+ 5. completa el onboarding guiado del gc-branch `main`
16
+ 6. resuelve el contexto relevante con `gctree resolve --query "..."`
17
+ 7. crea o cambia gc-branches con `gctree checkout`
18
+ 8. usa `gctree onboard` solo en gc-branches vacíos
19
+ 9. usa el mapeo por repositorio para que cada gc-branch solo aplique donde corresponde
20
+ 10. usa `gctree update-global-context` para cambios duraderos posteriores
21
+
22
+ ## Comandos clave
23
+
24
+ | Comando | Propósito |
25
+ | --- | --- |
26
+ | `gctree init` | Crea `~/.gctree`, crea el gc-branch `main`, guarda el modo de provider, el provider real de onboarding y el idioma preferido, prepara el entorno actual y arranca el onboarding guiado si `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 muestra el activo. |
30
+ | `gctree status` | Muestra el gc-branch activo, el repo actual, el estado de alcance para ese repo, las advertencias y el provider guardado. |
31
+ | `gctree resolve --query TEXT` | Busca contexto en el gc-branch relevante. Si el repo actual aún no está mapeado, permite decidir interactivamente qué hacer. |
32
+ | `gctree repo-map` | Muestra el contenido actual de `branch-repo-map.json`. |
33
+ | `gctree set-repo-scope --branch <name> --include` | Añade el repo actual al include de ese gc-branch. |
34
+ | `gctree set-repo-scope --branch <name> --exclude` | Añade el repo actual al exclude de ese gc-branch. |
35
+ | `gctree onboard` | Inicia el onboarding guiado del gc-branch activo. Solo funciona si ese gc-branch está vacío. |
36
+ | `gctree reset-gc-branch --branch <name> --yes` | Limpia un gc-branch para poder volver a hacer onboarding. |
37
+ | `gctree update-global-context` | Inicia 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 alcance por repositorio
42
+
43
+ Por ejemplo, si el gc-branch `A` solo aplica a `B`, `C` y `D`, y no a `F`, puedes gestionarlo así:
44
+
45
+ ```json
46
+ {
47
+ "A": {
48
+ "include": ["B", "C", "D"],
49
+ "exclude": ["F"]
50
+ }
51
+ }
52
+ ```
53
+
54
+ Guardado en:
55
+
56
+ ```text
57
+ ~/.gctree/branch-repo-map.json
58
+ ```
59
+
60
+ Si luego llamas a `resolve` desde `E`, puedes elegir entre:
61
+
62
+ 1. continuar solo esta vez
63
+ 2. usar siempre `A` en `E`
64
+ 3. ignorar `A` en `E`
65
+
66
+ ## Ejemplo de primera ejecución
67
+
68
+ ```bash
69
+ gctree init
70
+ ```
71
+
72
+ Después:
73
+
74
+ 1. elige `codex` o `claude-code`
75
+ 2. deja que `gctree` prepare el entorno actual
76
+ 3. completa el onboarding del gc-branch `main`
77
+
78
+ ## Ejemplo con varios gc-branches
79
+
80
+ ```bash
81
+ gctree checkout -b client-b
82
+ gctree onboard
83
+ gctree resolve --query "billing retry policy"
84
+ ```
85
+
86
+ ## Ejemplo de actualización
87
+
88
+ ```bash
89
+ gctree update-global-context
90
+ ```
91
+
92
+ Alias cortos:
93
+
94
+ ```bash
95
+ gctree update-gc
96
+ gctree ugc
97
+ ```
98
+
99
+ Si al trabajar descubres que un repo realmente pertenece al gc-branch actual, el flujo natural es:
100
+
101
+ 1. primero añadir ese repo al branch repo map
102
+ 2. después ejecutar `update-global-context` para agregar contexto duradero sobre qué hace ese repo y por qué importa
103
+
104
+ ## Patrones de integración
105
+
106
+ ### Codex CLI / Claude Code CLI
107
+
108
+ `gctree scaffold` instala comandos del provider para onboarding y actualizaciones guiadas.
109
+ Esos comandos deben dejar claro cuál es el gc-branch activo antes de empezar, y también deben mantener el idioma guardado durante todo el flujo salvo que el usuario pida cambiarlo explícitamente.
110
+
111
+ ```bash
112
+ gctree scaffold --host codex --target /path/to/repo
113
+ gctree scaffold --host claude-code --target /path/to/repo
114
+ ```
115
+
116
+ ### Comportamiento en runtime
117
+
118
+ El gc-branch activo es el fallback apuntado por `HEAD` dentro de `~/.gctree`.
119
+ Pero si un repo está vinculado explícitamente a otro gc-branch, para ese repo el branch map tiene prioridad sobre HEAD.
@@ -0,0 +1,119 @@
1
+ # 使い方
2
+
3
+ [English](usage.md) | [한국어](usage.ko.md) | [简体中文](usage.zh.md) | [日本語](usage.ja.md) | [Español](usage.es.md)
4
+
5
+ ## Summary
6
+
7
+ 標準的な `gctree` の使い方は、gc-tree を初期化し、provider を選び、デフォルトの `main` gc-branch をオンボードし、必要に応じて新しい gc-branch を作り、リポジトリを正しい gc-branch に結び付け、その後の長期変更はガイド付き更新で処理する流れです。
8
+
9
+ ## 標準フロー
10
+
11
+ 1. `gctree init` を実行する
12
+ 2. 好みの provider モード(`claude-code`、`codex`、`both`)を選ぶ
13
+ 3. ワークフローで使う言語(`English`、`Korean`、または自由入力)を選ぶ
14
+ 4. `both` を選んだ場合は、今回のオンボーディングをどちらで始めるかを選ぶ
15
+ 5. デフォルトの `main` gc-branch のガイド付きオンボーディングを完了する
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
+
22
+ ## 主要コマンド
23
+
24
+ | コマンド | 説明 |
25
+ | --- | --- |
26
+ | `gctree init` | `~/.gctree` とデフォルトの `main` gc-branch を作成し、provider モード、実際のオンボーディング provider、優先言語を保存し、現在の環境を scaffold したうえで、`main` が空ならガイド付きオンボーディングを開始します。 |
27
+ | `gctree checkout <branch>` | アクティブな gc-branch を切り替えます。 |
28
+ | `gctree checkout -b <branch>` | 新しい空の gc-branch を作成して切り替えます。 |
29
+ | `gctree branches` | 利用可能な gc-branches と現在の gc-branch を表示します。 |
30
+ | `gctree status` | アクティブな gc-branch、現在のリポジトリ、そのリポジトリの 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 の include に追加します。 |
34
+ | `gctree set-repo-scope --branch <name> --exclude` | 現在のリポジトリをその gc-branch の exclude に追加します。 |
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
+ ## リポジトリ範囲の例
42
+
43
+ たとえば gc-branch `A` が `B`、`C`、`D` にだけ関係し、`F` には関係しないなら、次のように管理できます。
44
+
45
+ ```json
46
+ {
47
+ "A": {
48
+ "include": ["B", "C", "D"],
49
+ "exclude": ["F"]
50
+ }
51
+ }
52
+ ```
53
+
54
+ 保存先:
55
+
56
+ ```text
57
+ ~/.gctree/branch-repo-map.json
58
+ ```
59
+
60
+ この状態で `E` リポジトリから `resolve` を実行すると、次を選べます。
61
+
62
+ 1. 今回だけ続行する
63
+ 2. 今後も `E` で `A` を使う
64
+ 3. `E` では `A` を無視する
65
+
66
+ ## 初回実行の例
67
+
68
+ ```bash
69
+ gctree init
70
+ ```
71
+
72
+ その後:
73
+
74
+ 1. `codex` または `claude-code` を選ぶ
75
+ 2. `gctree` に現在の環境を scaffold させる
76
+ 3. `main` gc-branch のオンボーディングを完了する
77
+
78
+ ## 複数 gc-branch の例
79
+
80
+ ```bash
81
+ gctree checkout -b client-b
82
+ gctree onboard
83
+ gctree resolve --query "billing retry policy"
84
+ ```
85
+
86
+ ## 更新の例
87
+
88
+ ```bash
89
+ gctree update-global-context
90
+ ```
91
+
92
+ 短い別名:
93
+
94
+ ```bash
95
+ gctree update-gc
96
+ gctree ugc
97
+ ```
98
+
99
+ 実際に作業してみて、そのリポジトリが現在の gc-branch に属するべきだと分かった場合は、自然な流れはこうです。
100
+
101
+ 1. まずそのリポジトリを branch repo map に追加する
102
+ 2. その後 `update-global-context` を実行して、そのリポジトリが何を担うのか、なぜ重要なのかといった長期コンテキストを追加する
103
+
104
+ ## 統合パターン
105
+
106
+ ### Codex CLI / Claude Code CLI
107
+
108
+ `gctree scaffold` は、ガイド付きオンボーディングやガイド付き更新などの provider 向けコマンドをインストールします。
109
+ それらのコマンドは、開始前に必ず現在アクティブな gc-branch を明示するべきであり、ユーザーが明示的に変更を求めない限り、保存されたワークフロー言語を最後まで維持するべきです。
110
+
111
+ ```bash
112
+ gctree scaffold --host codex --target /path/to/repo
113
+ gctree scaffold --host claude-code --target /path/to/repo
114
+ ```
115
+
116
+ ### ランタイム上の扱い
117
+
118
+ 現在の gc-branch は `~/.gctree` 内の `HEAD` が指す fallback ブランチです。
119
+ ただし、あるリポジトリが別の gc-branch に明示的に結び付けられている場合、そのリポジトリでは branch map が HEAD より優先されます。
@@ -0,0 +1,119 @@
1
+ # 사용방법
2
+
3
+ [English](usage.md) | [한국어](usage.ko.md) | [简体中文](usage.zh.md) | [日本語](usage.ja.md) | [Español](usage.es.md)
4
+
5
+ ## Summary
6
+
7
+ 기본적인 `gctree` 사용 흐름은 이렇습니다. gc-tree를 초기화하고, provider를 선택하고, 기본 `main` gc-branch를 온보딩한 뒤, 필요할 때 새 gc-branch를 만들고, 레포를 올바른 gc-branch에 매핑하고, 이후 장기 변경은 가이드형 업데이트로 처리합니다.
8
+
9
+ ## 기본 흐름
10
+
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 "..."`로 관련 컨텍스트 조회
17
+ 7. `gctree checkout`으로 gc-branch 생성 또는 전환
18
+ 8. 비어 있는 gc-branch에서만 `gctree onboard` 실행
19
+ 9. gc-branch가 실제 관련 레포에만 적용되도록 레포 범위 매핑 관리
20
+ 10. 이후 장기 변경은 `gctree update-global-context`로 반영
21
+
22
+ ## 핵심 명령
23
+
24
+ | 명령 | 설명 |
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와 현재 gc-branch를 보여줍니다. |
30
+ | `gctree status` | 활성 gc-branch, 현재 레포, 현재 레포의 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의 include로 등록합니다. |
34
+ | `gctree set-repo-scope --branch <name> --exclude` | 현재 레포를 해당 gc-branch의 exclude로 등록합니다. |
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
+ ## 레포 범위 예시
42
+
43
+ 예를 들어 gc-branch `A`가 `B`, `C`, `D` 레포에만 관련 있고 `F`와는 무관하다면, 다음과 같이 관리할 수 있습니다.
44
+
45
+ ```json
46
+ {
47
+ "A": {
48
+ "include": ["B", "C", "D"],
49
+ "exclude": ["F"]
50
+ }
51
+ }
52
+ ```
53
+
54
+ 저장 위치:
55
+
56
+ ```text
57
+ ~/.gctree/branch-repo-map.json
58
+ ```
59
+
60
+ 그 상태에서 `E` 레포에서 `resolve`를 호출하면 다음 중 하나를 고를 수 있습니다.
61
+
62
+ 1. 이번만 진행
63
+ 2. 앞으로 이 레포에서도 `A` 사용
64
+ 3. 이 레포에서는 `A` 무시
65
+
66
+ ## 최초 실행 예시
67
+
68
+ ```bash
69
+ gctree init
70
+ ```
71
+
72
+ 그다음:
73
+
74
+ 1. `codex` 또는 `claude-code` 선택
75
+ 2. `gctree`가 현재 환경을 스캐폴딩하도록 둠
76
+ 3. `main` gc-branch 온보딩 완료
77
+
78
+ ## 다중 gc-branch 예시
79
+
80
+ ```bash
81
+ gctree checkout -b client-b
82
+ gctree onboard
83
+ gctree resolve --query "billing retry policy"
84
+ ```
85
+
86
+ ## 업데이트 예시
87
+
88
+ ```bash
89
+ gctree update-global-context
90
+ ```
91
+
92
+ 짧은 별칭:
93
+
94
+ ```bash
95
+ gctree update-gc
96
+ gctree ugc
97
+ ```
98
+
99
+ 만약 실제 작업을 하다 보니 어떤 레포가 현재 gc-branch에 포함되어야 할 것 같다면, 자연스러운 흐름은 이렇습니다.
100
+
101
+ 1. 먼저 branch repo map에 그 레포를 포함시키고
102
+ 2. 그 다음 `update-global-context`로 이 레포가 무엇을 하는지, 왜 중요한지 같은 장기 컨텍스트를 추가
103
+
104
+ ## 통합 패턴
105
+
106
+ ### Codex CLI / Claude Code CLI
107
+
108
+ `gctree scaffold`는 가이드형 온보딩과 가이드형 업데이트 같은 provider용 명령을 설치합니다.
109
+ 이 명령들은 항상 현재 활성 gc-branch가 무엇인지 먼저 명시해야 하며, 사용자가 명시적으로 바꾸라고 하지 않는 한 저장된 워크플로 언어를 끝까지 유지해야 합니다.
110
+
111
+ ```bash
112
+ gctree scaffold --host codex --target /path/to/repo
113
+ gctree scaffold --host claude-code --target /path/to/repo
114
+ ```
115
+
116
+ ### 런타임 동작
117
+
118
+ 활성 gc-branch는 `~/.gctree` 안의 `HEAD`가 가리키는 fallback 브랜치입니다.
119
+ 다만 어떤 레포가 다른 gc-branch에 명시적으로 묶여 있으면, 그 레포에 대해서는 branch map이 HEAD보다 우선합니다.
package/docs/usage.md ADDED
@@ -0,0 +1,121 @@
1
+ # Usage
2
+
3
+ [English](usage.md) | [한국어](usage.ko.md) | [简体中文](usage.zh.md) | [日本語](usage.ja.md) | [Español](usage.es.md)
4
+
5
+ ## Summary
6
+
7
+ A standard `gctree` workflow is: initialize gc-tree, choose a provider, onboard the default `main` gc-branch, resolve active context, create new gc-branches when needed, map repositories to the right gc-branches, and use guided updates for durable changes.
8
+
9
+ ## Standard workflow
10
+
11
+ 1. run `gctree init`
12
+ 2. choose your preferred provider mode (`claude-code`, `codex`, or `both`)
13
+ 3. choose the workflow language (`English`, `Korean`, or a custom language)
14
+ 4. if you picked `both`, choose which provider should start onboarding now
15
+ 5. complete guided onboarding for the default `main` gc-branch
16
+ 6. resolve relevant context with `gctree resolve --query "..."`
17
+ 7. create or switch gc-branches with `gctree checkout`
18
+ 8. run `gctree onboard` only for an empty gc-branch
19
+ 9. use repo scope mapping so a gc-branch only applies where it belongs
20
+ 10. use `gctree update-global-context` for durable changes later
21
+
22
+ ## Core commands
23
+
24
+ | Command | Purpose |
25
+ | --- | --- |
26
+ | `gctree init` | Create `~/.gctree`, create the default `main` gc-branch, save the provider mode, onboarding provider, and preferred language, scaffold the current environment, and start guided onboarding when `main` is empty. |
27
+ | `gctree checkout <branch>` | Switch the active gc-branch. |
28
+ | `gctree checkout -b <branch>` | Create and switch to a new empty gc-branch. |
29
+ | `gctree branches` | List available gc-branches and show the active one. |
30
+ | `gctree status` | Show the active gc-branch, the current repo, the current repo-scope status, warnings, and the preferred provider. |
31
+ | `gctree resolve --query TEXT` | Search the relevant gc-branch for context. If the current repo is unmapped, `gctree` can ask how that repo should be treated. |
32
+ | `gctree repo-map` | Show the current contents of `branch-repo-map.json`. |
33
+ | `gctree set-repo-scope --branch <name> --include` | Mark the current repo as included for that gc-branch. |
34
+ | `gctree set-repo-scope --branch <name> --exclude` | Mark the current repo as ignored for that gc-branch. |
35
+ | `gctree onboard` | Launch guided onboarding for the active gc-branch. Works only when that gc-branch is empty. |
36
+ | `gctree reset-gc-branch --branch <name> --yes` | Clear a gc-branch so it can be onboarded again. |
37
+ | `gctree update-global-context` | Launch a guided durable update for the active gc-branch. |
38
+ | `gctree update-gc` / `gctree ugc` | Aliases for `gctree update-global-context`. |
39
+ | `gctree scaffold --host <codex|claude-code>` | Install the provider-facing command surface in another environment. |
40
+
41
+ ## Example repo-scope flow
42
+
43
+ Suppose gc-branch `A` is relevant to repos `B`, `C`, and `D`, but not `F`.
44
+
45
+ You can manage that through:
46
+
47
+ ```json
48
+ {
49
+ "A": {
50
+ "include": ["B", "C", "D"],
51
+ "exclude": ["F"]
52
+ }
53
+ }
54
+ ```
55
+
56
+ stored in:
57
+
58
+ ```text
59
+ ~/.gctree/branch-repo-map.json
60
+ ```
61
+
62
+ When `resolve` runs from repo `E` and branch `A` is not mapped there yet, `gctree` can ask whether to:
63
+
64
+ 1. continue once
65
+ 2. always use `A` in `E`
66
+ 3. ignore `A` in `E`
67
+
68
+ ## Example first-run flow
69
+
70
+ ```bash
71
+ gctree init
72
+ ```
73
+
74
+ Then:
75
+
76
+ 1. choose `codex` or `claude-code`
77
+ 2. let `gctree` scaffold the current environment
78
+ 3. complete guided onboarding for the `main` gc-branch
79
+
80
+ ## Example multi-branch flow
81
+
82
+ ```bash
83
+ gctree checkout -b client-b
84
+ gctree onboard
85
+ gctree resolve --query "billing retry policy"
86
+ ```
87
+
88
+ ## Example update flow
89
+
90
+ ```bash
91
+ gctree update-global-context
92
+ ```
93
+
94
+ Short aliases:
95
+
96
+ ```bash
97
+ gctree update-gc
98
+ gctree ugc
99
+ ```
100
+
101
+ If a newly relevant repo should also become part of the durable context, the natural flow is:
102
+
103
+ 1. map that repo to the gc-branch
104
+ 2. then run `update-global-context` to add durable knowledge about what that repo does and why it matters
105
+
106
+ ## Integration patterns
107
+
108
+ ### Codex CLI / Claude Code CLI
109
+
110
+ `gctree scaffold` installs provider-facing commands such as guided onboarding and guided updates.
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.
112
+
113
+ ```bash
114
+ gctree scaffold --host codex --target /path/to/repo
115
+ gctree scaffold --host claude-code --target /path/to/repo
116
+ ```
117
+
118
+ ### Runtime behavior
119
+
120
+ 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.
121
+ This makes gc-tree practical for heavy users who keep many unrelated sessions open at the same time.
@@ -0,0 +1,119 @@
1
+ # 使用方法
2
+
3
+ [English](usage.md) | [한국어](usage.ko.md) | [简体中文](usage.zh.md) | [日本語](usage.ja.md) | [Español](usage.es.md)
4
+
5
+ ## Summary
6
+
7
+ 标准的 `gctree` 使用流程是:初始化 gc-tree、选择 provider、完成默认 `main` gc-branch 的 onboarding、在需要时创建新的 gc-branch、把仓库映射到正确的 gc-branch,并把后续长期变更交给引导式更新流程。
8
+
9
+ ## 标准流程
10
+
11
+ 1. 运行 `gctree init`
12
+ 2. 选择偏好的 provider 模式(`claude-code`、`codex` 或 `both`)
13
+ 3. 选择工作流语言(`English`、`Korean`,或手动输入语言)
14
+ 4. 如果选择了 `both`,再选择这次 onboarding 要由哪个 provider 启动
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
+
22
+ ## 核心命令
23
+
24
+ | 命令 | 说明 |
25
+ | --- | --- |
26
+ | `gctree init` | 创建 `~/.gctree` 和默认 `main` gc-branch,保存 provider 模式、实际 onboarding provider 和首选语言,给当前环境安装命令表面,并在 `main` 为空时启动引导式 onboarding。 |
27
+ | `gctree checkout <branch>` | 切换当前激活的 gc-branch。 |
28
+ | `gctree checkout -b <branch>` | 创建新的空 gc-branch 并切换过去。 |
29
+ | `gctree branches` | 列出可用 gc-branches 并显示当前 gc-branch。 |
30
+ | `gctree status` | 显示当前 gc-branch、当前仓库、当前仓库的 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 的 include。 |
34
+ | `gctree set-repo-scope --branch <name> --exclude` | 把当前仓库加入该 gc-branch 的 exclude。 |
35
+ | `gctree onboard` | 为当前 gc-branch 启动引导式 onboarding。只有该 gc-branch 为空时才可使用。 |
36
+ | `gctree reset-gc-branch --branch <name> --yes` | 清空一个 gc-branch,使其可以重新 onboarding。 |
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
+ ## 仓库范围示例
42
+
43
+ 例如 gc-branch `A` 只适用于 `B`、`C`、`D`,而不适用于 `F`,可以这样管理:
44
+
45
+ ```json
46
+ {
47
+ "A": {
48
+ "include": ["B", "C", "D"],
49
+ "exclude": ["F"]
50
+ }
51
+ }
52
+ ```
53
+
54
+ 保存位置:
55
+
56
+ ```text
57
+ ~/.gctree/branch-repo-map.json
58
+ ```
59
+
60
+ 此时如果在 `E` 仓库里调用 `resolve`,可以选择:
61
+
62
+ 1. 这次先继续
63
+ 2. 以后这个仓库总是使用 `A`
64
+ 3. 在这个仓库里忽略 `A`
65
+
66
+ ## 首次使用示例
67
+
68
+ ```bash
69
+ gctree init
70
+ ```
71
+
72
+ 然后:
73
+
74
+ 1. 选择 `codex` 或 `claude-code`
75
+ 2. 让 `gctree` 为当前环境安装命令表面
76
+ 3. 完成 `main` gc-branch 的 onboarding
77
+
78
+ ## 多 gc-branch 示例
79
+
80
+ ```bash
81
+ gctree checkout -b client-b
82
+ gctree onboard
83
+ gctree resolve --query "billing retry policy"
84
+ ```
85
+
86
+ ## 更新示例
87
+
88
+ ```bash
89
+ gctree update-global-context
90
+ ```
91
+
92
+ 简短别名:
93
+
94
+ ```bash
95
+ gctree update-gc
96
+ gctree ugc
97
+ ```
98
+
99
+ 如果在实际工作中发现某个仓库其实应该属于当前 gc-branch,更自然的流程是:
100
+
101
+ 1. 先把这个仓库加入 branch repo map
102
+ 2. 然后用 `update-global-context` 补充这个仓库是什么、为什么重要等长期上下文
103
+
104
+ ## 集成模式
105
+
106
+ ### Codex CLI / Claude Code CLI
107
+
108
+ `gctree scaffold` 会安装 provider 侧的 guided onboarding 和 guided update 命令。
109
+ 这些命令在开始前都应该明确说明当前激活的是哪个 gc-branch,并且除非用户明确要求切换,否则要始终使用保存下来的工作流语言。
110
+
111
+ ```bash
112
+ gctree scaffold --host codex --target /path/to/repo
113
+ gctree scaffold --host claude-code --target /path/to/repo
114
+ ```
115
+
116
+ ### 运行时行为
117
+
118
+ 当前激活的 gc-branch 是 `~/.gctree` 里的 `HEAD` 指向的 fallback 分支。
119
+ 但如果某个仓库被明确映射到另一个 gc-branch,那么对这个仓库来说,branch map 的优先级高于 HEAD。
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@handsupmin/gc-tree",
3
+ "version": "0.1.1",
4
+ "description": "Global Context Tree, a lightweight branch-aware global context orchestrator for AI coding tools",
5
+ "type": "module",
6
+ "private": false,
7
+ "files": [
8
+ "dist",
9
+ "skills",
10
+ "scaffolds",
11
+ "docs",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
15
+ "bin": {
16
+ "gctree": "dist/src/cli.js"
17
+ },
18
+ "scripts": {
19
+ "build": "tsc -p tsconfig.json",
20
+ "test": "node --import tsx --test tests/*.test.ts",
21
+ "prepack": "npm run build"
22
+ },
23
+ "engines": {
24
+ "node": ">=20"
25
+ },
26
+ "devDependencies": {
27
+ "@types/node": "^22.10.2",
28
+ "tsx": "^4.19.2",
29
+ "typescript": "^5.7.2"
30
+ },
31
+ "license": "MIT"
32
+ }
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: checkout
3
+ description: Switch or create a gctree gc-branch.
4
+ ---
5
+
6
+ # gctree Checkout
7
+
8
+ Use this when the user wants to separate global context for different products, clients, companies, or work modes.
9
+
10
+ ## Procedure
11
+ - `gctree checkout <branch>` switches to an existing gc-branch.
12
+ - `gctree checkout -b <branch>` creates a new empty gc-branch and switches to it.
13
+ - After checkout, run `gctree status` so the user can see which gc-branch is active.
14
+
15
+ ## Notes
16
+ - In user-facing language, call these **gc-branches** so they are not confused with git branches.
17
+ - Keep gc-branch switching explicit so different products do not bleed into each other.