@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,83 @@
1
+ # ローカル実行方法
2
+
3
+ [English](local-development.md) | [한국어](local-development.ko.md) | [简体中文](local-development.zh.md) | [日本語](local-development.ja.md) | [Español](local-development.es.md)
4
+
5
+ ## Summary
6
+
7
+ ローカル開発は標準的な Node.js 20+ ワークフローです。依存関係を入れ、CLI をビルドし、ローカルで実行し、提出前に既存テストで検証します。
8
+
9
+ ## パッケージ状況
10
+
11
+ このリポジトリの npm パッケージ名は `@handsupmin/gc-tree` で、リポジトリ名は引き続き `gc-tree` のままです。
12
+ リリース前には `npm publish --dry-run` を実行し、実際に publish した後はクリーンなディレクトリで `npx @handsupmin/gc-tree --help` または `npm install -g @handsupmin/gc-tree` を使って配布物を検証してください。
13
+
14
+ ## 前提条件
15
+
16
+ - Node.js 20+
17
+ - npm
18
+ - provider 起動を手動で確認したい場合は、ローカルの `codex` または `claude` バイナリ
19
+
20
+ ## セットアップ
21
+
22
+ ```bash
23
+ npm install
24
+ npm run build
25
+ ```
26
+
27
+ ## ローカルで CLI を実行する
28
+
29
+ ### 方法 1: ビルド済みエントリを直接実行する
30
+
31
+ ```bash
32
+ node dist/src/cli.js status
33
+ ```
34
+
35
+ ### 方法 2: CLI をシェルにリンクする
36
+
37
+ ```bash
38
+ npm link
39
+ gctree status
40
+ ```
41
+
42
+ TypeScript ソースを変更した場合は、再度 CLI を試す前にビルドし直してください。
43
+
44
+ ## 検証
45
+
46
+ 変更を提出する前に次を実行してください。
47
+
48
+ ```bash
49
+ npm run build
50
+ npm test
51
+ npm publish --dry-run
52
+ ```
53
+
54
+ ## リポジトリ範囲テスト
55
+
56
+ 現在のテストスイートでは次を検証しています。
57
+
58
+ - provider モード(`claude-code`、`codex`、`both`)の保存
59
+ - 優先言語の保存と launch prompt での強い言語固定
60
+ - リポジトリに応じた gc-branch 選択
61
+ - `resolve` 中の include/exclude インタラクション
62
+ - branch repo map の更新
63
+ - ガイド付きオンボーディング/更新フローの境界条件
64
+
65
+ ## 手動 provider E2E 検証
66
+
67
+ 自動テストでは provider launch を無効にしているため、Codex や Claude Code の実セッションは開かず、launch plan だけを確認します。
68
+ 実際の起動経路を手元で確認したい場合は、使い捨てディレクトリで次を実行してください。
69
+
70
+ ```bash
71
+ gctree init --provider codex
72
+ gctree init --provider claude-code
73
+ ```
74
+
75
+ 正常なら provider が実際に起動し、すぐに `$gc-onboard` または `/gc-onboard` が渡されます。
76
+
77
+ ## プロジェクト構成
78
+
79
+ - `src/` — CLI、コンテキスト保存、provider 選択、リポジトリ範囲マッピング、ガイド付きオンボーディング/更新フロー、scaffolding ロジック
80
+ - `tests/` — CLI と挙動のテスト
81
+ - `skills/` — ツール非依存のワークフロースキル
82
+ - `scaffolds/` — ホスト別 bootstrap テンプレート
83
+ - `docs/` — concept、principles、usage、development ドキュメント
@@ -0,0 +1,83 @@
1
+ # 로컬 실행방법
2
+
3
+ [English](local-development.md) | [한국어](local-development.ko.md) | [简体中文](local-development.zh.md) | [日本語](local-development.ja.md) | [Español](local-development.es.md)
4
+
5
+ ## Summary
6
+
7
+ 로컬 개발은 일반적인 Node.js 20+ 워크플로를 따릅니다. 의존성을 설치하고, CLI를 빌드한 뒤, 로컬에서 실행하고, 제출 전에 기존 테스트로 검증하면 됩니다.
8
+
9
+ ## 패키지 상태
10
+
11
+ 이 레포의 npm 패키지 이름은 `@handsupmin/gc-tree`이고, 레포 이름은 계속 `gc-tree`로 유지됩니다.
12
+ 릴리스 시도 전에는 `npm publish --dry-run`을 실행하고, 실제 publish 후에는 깨끗한 디렉터리에서 `npx @handsupmin/gc-tree --help` 또는 `npm install -g @handsupmin/gc-tree`로 배포본을 검증하세요.
13
+
14
+ ## 준비사항
15
+
16
+ - Node.js 20+
17
+ - npm
18
+ - provider 런치를 수동으로 점검하려면 로컬 `codex` 또는 `claude` 바이너리
19
+
20
+ ## 설정
21
+
22
+ ```bash
23
+ npm install
24
+ npm run build
25
+ ```
26
+
27
+ ## 로컬에서 CLI 실행
28
+
29
+ ### 방법 1: 빌드된 엔트리를 직접 실행
30
+
31
+ ```bash
32
+ node dist/src/cli.js status
33
+ ```
34
+
35
+ ### 방법 2: 셸에 CLI를 링크
36
+
37
+ ```bash
38
+ npm link
39
+ gctree status
40
+ ```
41
+
42
+ TypeScript 소스를 수정했다면 다시 테스트하기 전에 재빌드하세요.
43
+
44
+ ## 검증
45
+
46
+ 변경을 제출하기 전에 다음을 실행하세요.
47
+
48
+ ```bash
49
+ npm run build
50
+ npm test
51
+ npm publish --dry-run
52
+ ```
53
+
54
+ ## 레포 범위 관련 테스트
55
+
56
+ 현재 테스트 스위트는 다음을 검증합니다.
57
+
58
+ - provider 모드(`claude-code`, `codex`, `both`) 저장
59
+ - 선호 언어 저장과 launch prompt에서의 강한 언어 고정
60
+ - 레포에 따른 gc-branch 선택
61
+ - `resolve` 중 include/exclude 인터랙션
62
+ - branch repo map 갱신
63
+ - 가이드형 온보딩/업데이트 경계 조건
64
+
65
+ ## 수동 provider E2E 점검
66
+
67
+ 자동 테스트는 Codex/Claude Code 세션을 실제로 열지 않도록 provider launch를 비활성화한 상태에서 launch plan만 검증합니다.
68
+ 실제 런치 경로를 직접 확인하고 싶다면 임시 디렉터리에서 다음처럼 실행하면 됩니다.
69
+
70
+ ```bash
71
+ gctree init --provider codex
72
+ gctree init --provider claude-code
73
+ ```
74
+
75
+ 정상이라면 provider가 실제로 열리고, 바로 `$gc-onboard` 또는 `/gc-onboard` 명령이 주입되어야 합니다.
76
+
77
+ ## 프로젝트 구조
78
+
79
+ - `src/` — CLI, 컨텍스트 저장소, provider 선택, 레포 범위 매핑, 가이드형 온보딩/업데이트 흐름, 스캐폴딩 로직
80
+ - `tests/` — CLI 및 동작 테스트
81
+ - `skills/` — 도구 독립형 워크플로 스킬
82
+ - `scaffolds/` — 호스트별 bootstrap 템플릿
83
+ - `docs/` — concept, principles, usage, development 문서
@@ -0,0 +1,83 @@
1
+ # Local Development
2
+
3
+ [English](local-development.md) | [한국어](local-development.ko.md) | [简体中文](local-development.zh.md) | [日本語](local-development.ja.md) | [Español](local-development.es.md)
4
+
5
+ ## Summary
6
+
7
+ Local development follows a standard Node.js 20+ workflow: install dependencies, build the CLI, run it locally, and verify with the existing test suite before you send changes.
8
+
9
+ ## Package status
10
+
11
+ `@handsupmin/gc-tree` is the published npm package name for this repository, while the repository name stays `gc-tree`.
12
+ Run `npm publish --dry-run` before release attempts, and after a real publish verify the released package from a clean directory with `npx @handsupmin/gc-tree --help` or `npm install -g @handsupmin/gc-tree`.
13
+
14
+ ## Prerequisites
15
+
16
+ - Node.js 20+
17
+ - npm
18
+ - local `codex` and/or `claude` binaries if you want to manually dogfood provider launches
19
+
20
+ ## Setup
21
+
22
+ ```bash
23
+ npm install
24
+ npm run build
25
+ ```
26
+
27
+ ## Run the CLI locally
28
+
29
+ ### Option 1: run the built entry directly
30
+
31
+ ```bash
32
+ node dist/src/cli.js status
33
+ ```
34
+
35
+ ### Option 2: link the CLI into your shell
36
+
37
+ ```bash
38
+ npm link
39
+ gctree status
40
+ ```
41
+
42
+ If you change TypeScript sources, rebuild before testing the CLI again.
43
+
44
+ ## Verification
45
+
46
+ Run these before opening a pull request:
47
+
48
+ ```bash
49
+ npm run build
50
+ npm test
51
+ npm publish --dry-run
52
+ ```
53
+
54
+ ## Repo-scope tests
55
+
56
+ The test suite now covers:
57
+
58
+ - provider mode persistence (`claude-code`, `codex`, `both`)
59
+ - preferred language persistence and strong language enforcement in launch prompts
60
+ - repo-aware gc-branch selection
61
+ - interactive include/exclude decisions during `resolve`
62
+ - branch repo map updates
63
+ - guided onboarding/update flow boundaries
64
+
65
+ ## Manual provider E2E checks
66
+
67
+ Automated tests disable provider launch so they can verify launch plans without opening Codex or Claude Code sessions.
68
+ If you want to dogfood the real launch path, run one of these in a throwaway directory:
69
+
70
+ ```bash
71
+ gctree init --provider codex
72
+ gctree init --provider claude-code
73
+ ```
74
+
75
+ You should see the provider open and immediately receive `$gc-onboard` or `/gc-onboard`.
76
+
77
+ ## Project layout
78
+
79
+ - `src/` — CLI, context storage, provider selection, repo-scope mapping, guided onboarding/update flows, and scaffolding logic
80
+ - `tests/` — CLI and behavior tests
81
+ - `skills/` — tool-agnostic workflow skills
82
+ - `scaffolds/` — host-specific bootstrap templates
83
+ - `docs/` — concept, principles, usage, and development documentation
@@ -0,0 +1,83 @@
1
+ # 本地运行方法
2
+
3
+ [English](local-development.md) | [한국어](local-development.ko.md) | [简体中文](local-development.zh.md) | [日本語](local-development.ja.md) | [Español](local-development.es.md)
4
+
5
+ ## Summary
6
+
7
+ 本地开发采用标准的 Node.js 20+ 工作流:安装依赖、构建 CLI、本地运行,并在提交前用现有测试套件进行验证。
8
+
9
+ ## 包状态
10
+
11
+ 这个仓库对应的 npm 包名是 `@handsupmin/gc-tree`,而仓库名仍然保持为 `gc-tree`。
12
+ 在任何发布尝试前先运行 `npm publish --dry-run`;真正发布之后,再在干净目录里用 `npx @handsupmin/gc-tree --help` 或 `npm install -g @handsupmin/gc-tree` 验证发布结果。
13
+
14
+ ## 前置条件
15
+
16
+ - Node.js 20+
17
+ - npm
18
+ - 如果想手动验证 provider 启动流程,需要本地可用的 `codex` 或 `claude` 二进制
19
+
20
+ ## 设置
21
+
22
+ ```bash
23
+ npm install
24
+ npm run build
25
+ ```
26
+
27
+ ## 在本地运行 CLI
28
+
29
+ ### 方法 1:直接运行构建后的入口
30
+
31
+ ```bash
32
+ node dist/src/cli.js status
33
+ ```
34
+
35
+ ### 方法 2:把 CLI 链接到你的 shell
36
+
37
+ ```bash
38
+ npm link
39
+ gctree status
40
+ ```
41
+
42
+ 如果你修改了 TypeScript 源码,请在再次测试 CLI 之前重新构建。
43
+
44
+ ## 验证
45
+
46
+ 提交改动前请运行:
47
+
48
+ ```bash
49
+ npm run build
50
+ npm test
51
+ npm publish --dry-run
52
+ ```
53
+
54
+ ## 仓库范围相关测试
55
+
56
+ 目前测试套件会验证:
57
+
58
+ - provider 模式(`claude-code`、`codex`、`both`)持久化
59
+ - 首选语言持久化以及 launch prompt 中更强的语言约束
60
+ - 根据仓库自动选择 gc-branch
61
+ - `resolve` 过程中的 include/exclude 交互
62
+ - branch repo map 更新
63
+ - 引导式 onboarding/update 的边界条件
64
+
65
+ ## 手动 provider E2E 验证
66
+
67
+ 自动测试会关闭 provider launch,只验证 launch plan,而不会真的打开 Codex 或 Claude Code 会话。
68
+ 如果你想亲自验证真实启动路径,可以在临时目录里运行:
69
+
70
+ ```bash
71
+ gctree init --provider codex
72
+ gctree init --provider claude-code
73
+ ```
74
+
75
+ 正常情况下,provider 会真正启动,并立即收到 `$gc-onboard` 或 `/gc-onboard`。
76
+
77
+ ## 项目结构
78
+
79
+ - `src/` — CLI、上下文存储、provider 选择、仓库范围映射、引导式 onboarding/update 流程、scaffolding 逻辑
80
+ - `tests/` — CLI 与行为测试
81
+ - `skills/` — 工具无关的工作流技能
82
+ - `scaffolds/` — 宿主特定的 bootstrap 模板
83
+ - `docs/` — concept、principles、usage 与 development 文档
@@ -0,0 +1,49 @@
1
+ # Principios
2
+
3
+ [English](principles.md) | [한국어](principles.ko.md) | [简体中文](principles.zh.md) | [日本語](principles.ja.md) | [Español](principles.es.md)
4
+
5
+ ## Summary
6
+
7
+ `gctree` sigue un conjunto pequeño pero claro de principios de producto: separar el contexto por gc-branch, escribir documentos summary-first, mantener los índices livianos y hacer que cada gc-branch solo influya en los repositorios donde realmente corresponde.
8
+
9
+ ## 1. Separar el contexto por gc-branch
10
+
11
+ Una sola máquina puede contener varios árboles de contexto global sin mezclarlos.
12
+ Por eso `gctree` usa comandos al estilo git como `checkout` y `checkout -b`, pero en la interfaz deja claro que la rama activa se presenta como **gc-branch**.
13
+
14
+ ## 2. Gestionar explícitamente el alcance por repositorio
15
+
16
+ Un gc-branch no debería afectar en silencio a todos los repositorios de la máquina.
17
+ `gctree` usa `branch-repo-map.json` para registrar el estado de un repo respecto a un gc-branch:
18
+
19
+ - include
20
+ - exclude
21
+ - aún sin mapear
22
+
23
+ Si `resolve` se ejecuta en un repo sin mapear, el usuario puede decidir si quiere continuar solo esta vez, usar siempre ese gc-branch allí o ignorarlo allí.
24
+
25
+ ## 3. Mantener `index.md` liviano
26
+
27
+ El `index.md` de nivel superior es un índice, no un volcado de conocimiento.
28
+ Su trabajo es llevar a herramientas y personas rápidamente al documento fuente correcto.
29
+
30
+ ## 4. Priorizar documentos summary-first
31
+
32
+ Cada documento markdown source-of-truth debería incluir una sección `## Summary` cerca del inicio.
33
+ Así las herramientas pueden leer primero la versión corta y abrir el resto solo cuando haga falta.
34
+
35
+ ## 5. Hacer que el onboarding sea explícito y guiado
36
+
37
+ El usuario no debería tener que escribir JSON a mano para crear un contexto global útil.
38
+ `gctree init` y `gctree onboard` deberían guiar la conversación a través del provider elegido y guardar el resultado en el gc-branch activo.
39
+
40
+ El onboarding solo aplica a gc-branches vacíos.
41
+ Si un gc-branch ya tiene contexto, la ruta correcta es:
42
+
43
+ - resetear ese gc-branch y volver a hacer onboarding
44
+ - o ejecutar una actualización duradera guiada
45
+
46
+ ## 6. Mantener las actualizaciones duraderas bajo control
47
+
48
+ El contexto duradero no debería cambiar por accidente ni por memoria oculta.
49
+ El flujo de actualización debe ser explícito, guiado por el provider y siempre ligado al gc-branch activo.
@@ -0,0 +1,49 @@
1
+ # 原則
2
+
3
+ [English](principles.md) | [한국어](principles.ko.md) | [简体中文](principles.zh.md) | [日本語](principles.ja.md) | [Español](principles.es.md)
4
+
5
+ ## Summary
6
+
7
+ `gctree` は、少数の明確な製品原則に基づいています。コンテキストは gc-branch 単位で分け、文書は summary-first で書き、インデックスは小さく保ち、各 gc-branch が本当に関係するリポジトリでだけ使われるようにします。
8
+
9
+ ## 1. コンテキストを gc-branch 単位で分ける
10
+
11
+ 1 台のマシン上に複数のグローバルコンテキストツリーを混在させずに保持できます。
12
+ そのため `gctree` は `checkout` や `checkout -b` のような git ライクなコマンドを使いながら、ユーザー向けには現在のブランチを **gc-branch** と明示します。
13
+
14
+ ## 2. リポジトリ範囲を明示的に管理する
15
+
16
+ ある gc-branch がマシン上のすべてのリポジトリへ静かに影響してはいけません。
17
+ `gctree` は `branch-repo-map.json` によって、そのリポジトリがその gc-branch に対してどの状態かを記録します。
18
+
19
+ - include
20
+ - exclude
21
+ - まだ未設定
22
+
23
+ `resolve` が未設定のリポジトリで呼ばれた場合、今回だけ使うか、今後も使うか、ここでは無視するかを選べます。
24
+
25
+ ## 3. `index.md` を小さく保つ
26
+
27
+ トップレベルの `index.md` はダンプではなくインデックスです。
28
+ 役割は、ツールを適切な source document へ素早く導くことであり、知識をすべてインラインで複製することではありません。
29
+
30
+ ## 4. summary-first 文書を優先する
31
+
32
+ すべての source-of-truth markdown 文書は、できるだけ冒頭近くに `## Summary` を置くべきです。
33
+ これにより、ツールはまず短い要約を読み、要約だけで足りる場合は全文読み込みを避けられます。
34
+
35
+ ## 5. オンボーディングは明示的かつガイド付きにする
36
+
37
+ 有用なグローバルコンテキストを作るために、ユーザーが手で onboarding JSON を書く必要はありません。
38
+ `gctree init` と `gctree onboard` は、ユーザーが選んだ provider を通じて対話し、その結果を現在の gc-branch に書き込みます。
39
+
40
+ オンボーディングは空の gc-branch に対してのみ実行します。
41
+ すでにコンテキストが入っている場合は、次のどちらかが正しい流れです。
42
+
43
+ - gc-branch をリセットしてから再オンボーディングする
44
+ - またはガイド付きの永続更新を行う
45
+
46
+ ## 6. 永続更新は意図的に行う
47
+
48
+ 長期コンテキストは、隠れたメモリや偶発的な操作で変わるべきではありません。
49
+ 更新フローは明示的で、provider 主導で、常に現在アクティブな gc-branch に結びついている必要があります。
@@ -0,0 +1,49 @@
1
+ # 원리
2
+
3
+ [English](principles.md) | [한국어](principles.ko.md) | [简体中文](principles.zh.md) | [日本語](principles.ja.md) | [Español](principles.es.md)
4
+
5
+ ## Summary
6
+
7
+ `gctree`는 몇 가지 단순한 제품 원칙을 따릅니다. 컨텍스트는 gc-branch 단위로 분리하고, 문서는 summary-first로 작성하며, 인덱스는 작게 유지하고, 각 gc-branch가 실제로 관련 있는 레포에서만 영향을 주도록 범위를 명시합니다.
8
+
9
+ ## 1. 컨텍스트는 gc-branch 단위로 분리한다
10
+
11
+ 한 머신 안에서도 여러 글로벌 컨텍스트 트리를 섞지 않고 운영할 수 있어야 합니다.
12
+ 그래서 `gctree`는 `checkout`, `checkout -b` 같은 git 스타일 명령을 쓰되, 사용자에게는 현재 브랜치를 **gc-branch**라고 명시합니다.
13
+
14
+ ## 2. 레포 범위를 명시적으로 관리한다
15
+
16
+ 어떤 gc-branch가 머신의 모든 레포에 조용히 영향을 주면 안 됩니다.
17
+ `gctree`는 `branch-repo-map.json`을 통해 각 레포가 해당 gc-branch에 대해 어떤 상태인지 기록합니다.
18
+
19
+ - include
20
+ - exclude
21
+ - 아직 미지정
22
+
23
+ `resolve`가 미지정 레포에서 호출되면, 이번만 사용할지 / 항상 사용할지 / 여기서는 무시할지를 고를 수 있습니다.
24
+
25
+ ## 3. `index.md`는 작게 유지한다
26
+
27
+ 최상위 `index.md`는 지식 덤프가 아니라 인덱스입니다.
28
+ 역할은 도구를 올바른 source document로 빠르게 안내하는 것이지, 모든 내용을 인라인으로 복제하는 것이 아닙니다.
29
+
30
+ ## 4. summary-first 문서를 우선한다
31
+
32
+ 모든 source-of-truth markdown 문서는 상단 근처에 `## Summary` 섹션을 두는 것이 좋습니다.
33
+ 이렇게 하면 도구가 먼저 짧은 버전을 읽고, 요약만으로 충분할 때는 전체 문서를 읽지 않아도 됩니다.
34
+
35
+ ## 5. 온보딩은 명시적이고 가이드형이어야 한다
36
+
37
+ 유용한 글로벌 컨텍스트를 만들기 위해 사용자가 직접 onboarding JSON을 손으로 작성할 필요는 없어야 합니다.
38
+ `gctree init`과 `gctree onboard`는 사용자가 고른 provider를 통해 질문을 주고받으며 활성 gc-branch에 결과를 기록해야 합니다.
39
+
40
+ 온보딩은 비어 있는 gc-branch에서만 실행합니다.
41
+ 이미 컨텍스트가 있다면 다음 중 하나가 올바른 경로입니다.
42
+
43
+ - gc-branch를 리셋하고 다시 온보딩한다
44
+ - 또는 가이드형 장기 업데이트를 실행한다
45
+
46
+ ## 6. 장기 업데이트는 의도적으로 수행한다
47
+
48
+ 장기 컨텍스트는 실수로 바뀌거나 숨겨진 메모리로 덮어써지면 안 됩니다.
49
+ 업데이트는 명시적이어야 하고, provider를 통해 진행되며, 항상 현재 활성 gc-branch에 연결되어야 합니다.
@@ -0,0 +1,50 @@
1
+ # Principles
2
+
3
+ [English](principles.md) | [한국어](principles.ko.md) | [简体中文](principles.zh.md) | [日本語](principles.ja.md) | [Español](principles.es.md)
4
+
5
+ ## Summary
6
+
7
+ `gctree` follows a small set of product rules: keep context branch-aware, keep source docs summary-first, keep indexes slim, and make repo scope explicit so a gc-branch only influences the repositories where it belongs.
8
+
9
+ ## 1. Keep context branch-aware
10
+
11
+ A single machine should be able to hold multiple global-context trees without mixing them.
12
+ That is why `gctree` uses git-like language such as `checkout` and `checkout -b`, while referring to the active branch as a **gc-branch** in user-facing language.
13
+
14
+ ## 2. Keep repo scope explicit
15
+
16
+ A gc-branch should not silently affect every repository on the machine.
17
+ `gctree` uses `branch-repo-map.json` to record whether a repository is:
18
+
19
+ - included for a gc-branch
20
+ - excluded for a gc-branch
21
+ - not mapped yet
22
+
23
+ If `resolve` is called from an unmapped repository, the user can decide whether to continue once, always use that gc-branch there, or ignore it there.
24
+
25
+ ## 3. Keep `index.md` slim
26
+
27
+ The top-level `index.md` is an index, not a dump.
28
+ Its job is to help tools and humans find the right source document quickly.
29
+ It should stay compact and link-oriented instead of duplicating full knowledge inline.
30
+
31
+ ## 4. Make source docs summary-first
32
+
33
+ Every source-of-truth markdown document should include a `## Summary` section near the top.
34
+ That gives downstream tools a fast path: read the short version first, then expand only when more detail is necessary.
35
+
36
+ ## 5. Make onboarding explicit and guided
37
+
38
+ A user should not have to hand-author onboarding JSON just to create a useful context tree.
39
+ `gctree init` and `gctree onboard` should guide the user through their preferred provider and write the resulting context into the active gc-branch.
40
+
41
+ Onboarding is only for empty gc-branches.
42
+ If a gc-branch already contains context, the correct path is either:
43
+
44
+ - reset that gc-branch and onboard again
45
+ - or run a guided durable update
46
+
47
+ ## 6. Keep durable updates intentional
48
+
49
+ Durable context should not change by accident or through hidden memory.
50
+ The update flow should be explicit, provider-driven, and tied to the currently active gc-branch.
@@ -0,0 +1,49 @@
1
+ # 原理
2
+
3
+ [English](principles.md) | [한국어](principles.ko.md) | [简体中文](principles.zh.md) | [日本語](principles.ja.md) | [Español](principles.es.md)
4
+
5
+ ## Summary
6
+
7
+ `gctree` 遵循一组简洁而明确的产品原则:上下文按 gc-branch 隔离、文档采用 summary-first 结构、索引保持精简,并且让每个 gc-branch 只在真正相关的仓库里生效。
8
+
9
+ ## 1. 按 gc-branch 隔离上下文
10
+
11
+ 一台机器可以同时保存多个全局上下文树,而且彼此不混淆。
12
+ 因此 `gctree` 虽然使用 `checkout`、`checkout -b` 这样的 git 风格命令,但在用户界面里会明确把当前分支称为 **gc-branch**。
13
+
14
+ ## 2. 显式管理仓库范围
15
+
16
+ 某个 gc-branch 不应该悄悄影响整台机器上的所有仓库。
17
+ `gctree` 通过 `branch-repo-map.json` 记录一个仓库相对于某个 gc-branch 的状态:
18
+
19
+ - include
20
+ - exclude
21
+ - 尚未映射
22
+
23
+ 当 `resolve` 在一个尚未映射的仓库里被调用时,用户可以选择是仅本次继续、以后总是使用,还是在这里忽略它。
24
+
25
+ ## 3. 保持 `index.md` 精简
26
+
27
+ 顶层 `index.md` 是索引,不是内容堆积区。
28
+ 它的职责是把工具快速引导到正确的源文档,而不是把所有知识都内联复制进去。
29
+
30
+ ## 4. 优先使用 summary-first 文档
31
+
32
+ 每个 source-of-truth markdown 文档都应该在靠前位置包含 `## Summary`。
33
+ 这样工具可以先读取简短版本,如果摘要已经足够,就不必再读取整篇文档。
34
+
35
+ ## 5. 让 onboarding 明确且有引导
36
+
37
+ 用户不应该为了创建可用的全局上下文而手写 onboarding JSON。
38
+ `gctree init` 和 `gctree onboard` 应该通过用户选择的 provider 与用户对话,并把结果写入当前 gc-branch。
39
+
40
+ onboarding 只适用于空的 gc-branch。
41
+ 如果该 gc-branch 已经有内容,正确做法是:
42
+
43
+ - 重置该 gc-branch 后重新 onboarding
44
+ - 或者执行一次引导式长期更新
45
+
46
+ ## 6. 让长期更新保持可控
47
+
48
+ 长期上下文不应该因为隐式记忆或误操作而被改写。
49
+ 更新流程应当是显式的、由 provider 驱动的,并且始终绑定到当前激活的 gc-branch。