@handsupmin/gc-tree 0.8.3 → 0.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.es.md +1 -1
- package/README.ja.md +1 -1
- package/README.ko.md +1 -1
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/dist/src/hook.js +11 -25
- package/dist/src/repo-map.js +2 -1
- package/dist/src/scaffold.js +10 -8
- package/docs/usage.es.md +2 -0
- package/docs/usage.ja.md +2 -0
- package/docs/usage.ko.md +2 -0
- package/docs/usage.md +2 -0
- package/docs/usage.zh.md +2 -0
- package/package.json +1 -1
package/README.es.md
CHANGED
|
@@ -74,7 +74,7 @@ gctree init
|
|
|
74
74
|
2. Instalar los archivos de integración en el repositorio actual
|
|
75
75
|
3. Completar el onboarding guiado para el gc-branch `main`
|
|
76
76
|
|
|
77
|
-
Después, tu herramienta de IA instala integración real de hooks SessionStart/UserPromptSubmit: revisa gc-tree automáticamente antes de trabajar y cachea resultados vacíos/no-match durante la sesión.
|
|
77
|
+
Después, tu herramienta de IA instala integración real de hooks SessionStart/UserPromptSubmit: revisa gc-tree automáticamente antes de trabajar y cachea resultados vacíos/no-match durante la sesión. La salida del hook se mantiene compacta: muestra el estado found/no-match junto con IDs y resúmenes, y deja el documento completo detrás de `gctree resolve --id <id>`.
|
|
78
78
|
|
|
79
79
|
- **CLI:** `gctree`
|
|
80
80
|
- **Requisito:** Node.js 20+
|
package/README.ja.md
CHANGED
|
@@ -74,7 +74,7 @@ gctree init
|
|
|
74
74
|
2. 現在のリポジトリへの統合ファイルのインストール
|
|
75
75
|
3. `main` gc-branch のガイド付きオンボーディング実行
|
|
76
76
|
|
|
77
|
-
その後は、AI ツールに実際の SessionStart / UserPromptSubmit フック統合が入り、作業前に gc-tree を自動確認し、空結果や no-match
|
|
77
|
+
その後は、AI ツールに実際の SessionStart / UserPromptSubmit フック統合が入り、作業前に gc-tree を自動確認し、空結果や no-match をセッション中キャッシュします。フック出力はコンパクトに保たれ、found/no-match 状態、ドキュメント ID、要約だけを示し、全文は必要なときに `gctree resolve --id <id>` で開きます。
|
|
78
78
|
|
|
79
79
|
- **CLI:** `gctree`
|
|
80
80
|
- **動作条件:** Node.js 20+
|
package/README.ko.md
CHANGED
|
@@ -74,7 +74,7 @@ gctree init
|
|
|
74
74
|
2. 현재 레포에 통합 파일 스캐폴딩
|
|
75
75
|
3. `main` gc-branch 가이드형 온보딩 실행
|
|
76
76
|
|
|
77
|
-
이후 AI 도구에 실제 SessionStart/UserPromptSubmit 훅 통합이 설치되어, 작업 전에 gc-tree를 자동 확인하고 세션 동안 빈 결과·no-match를 캐시합니다.
|
|
77
|
+
이후 AI 도구에 실제 SessionStart/UserPromptSubmit 훅 통합이 설치되어, 작업 전에 gc-tree를 자동 확인하고 세션 동안 빈 결과·no-match를 캐시합니다. 훅 출력은 짧게 유지됩니다: 찾음/no-match 상태와 문서 ID, 요약만 보여주고 전체 문서는 `gctree resolve --id <id>`로 필요할 때 엽니다.
|
|
78
78
|
|
|
79
79
|
- **CLI:** `gctree`
|
|
80
80
|
- **요구 사항:** Node.js 20+
|
package/README.md
CHANGED
|
@@ -74,7 +74,7 @@ gctree init
|
|
|
74
74
|
2. Scaffold the integration files into your current repo
|
|
75
75
|
3. Run guided onboarding for the `main` gc-branch
|
|
76
76
|
|
|
77
|
-
After that, your AI tool gets real SessionStart/UserPromptSubmit hook integration, so it auto-checks gc-tree before work and caches empty/no-match results for the session.
|
|
77
|
+
After that, your AI tool gets real SessionStart/UserPromptSubmit hook integration, so it auto-checks gc-tree before work and caches empty/no-match results for the session. Hook output stays compact: it reports found/no-match state plus document IDs and summaries, and full docs stay behind `gctree resolve --id <id>`.
|
|
78
78
|
|
|
79
79
|
- **CLI:** `gctree`
|
|
80
80
|
- **Requires:** Node.js 20+
|
package/README.zh.md
CHANGED
|
@@ -61,7 +61,7 @@ gctree init
|
|
|
61
61
|
2. 在当前仓库安装集成文件
|
|
62
62
|
3. 为 `main` gc-branch 完成引导式 onboarding
|
|
63
63
|
|
|
64
|
-
之后,AI 工具会安装真正的 SessionStart / UserPromptSubmit hook 集成:在开始工作前自动检查 gc-tree,并在整个会话内缓存空结果和 no-match。
|
|
64
|
+
之后,AI 工具会安装真正的 SessionStart / UserPromptSubmit hook 集成:在开始工作前自动检查 gc-tree,并在整个会话内缓存空结果和 no-match。Hook 输出保持紧凑:只显示 found/no-match 状态、文档 ID 和摘要,完整文档需要时再通过 `gctree resolve --id <id>` 打开。
|
|
65
65
|
|
|
66
66
|
- **CLI:** `gctree`
|
|
67
67
|
- **要求:** Node.js 20+
|
package/dist/src/hook.js
CHANGED
|
@@ -18,7 +18,7 @@ function limitMatches(matches, max = 3) {
|
|
|
18
18
|
}
|
|
19
19
|
function formatMatches(matches) {
|
|
20
20
|
return limitMatches(matches)
|
|
21
|
-
.map((match, index) => `${index + 1}. ${match.title} [id=${match.id}]
|
|
21
|
+
.map((match, index) => `${index + 1}. ${match.title} [id=${match.id}]: ${match.summary}`)
|
|
22
22
|
.join('\n');
|
|
23
23
|
}
|
|
24
24
|
function buildSessionStartContext({ gcBranch, currentRepo, repoScopeStatus, }) {
|
|
@@ -31,33 +31,19 @@ function buildSessionStartContext({ gcBranch, currentRepo, repoScopeStatus, }) {
|
|
|
31
31
|
].join(' ');
|
|
32
32
|
}
|
|
33
33
|
function buildEmptyBranchContext({ gcBranch, currentRepo, cached, }) {
|
|
34
|
-
return [
|
|
35
|
-
`gc-tree auto-resolve ${cached ? 'used cached state' : 'checked the active gc-branch'} and found no reusable global context for this session because gc-branch "${gcBranch}" currently has 0 docs.`,
|
|
36
|
-
`Repo: ${currentRepo || 'unscoped'}.`,
|
|
37
|
-
`Treat this as "no reusable global context yet" until the gc-branch content changes or a different repo/gc-branch is active.`,
|
|
38
|
-
].join(' ');
|
|
34
|
+
return `[gc-tree] no context docs in gc-branch "${gcBranch}" for repo "${currentRepo || 'unscoped'}"${cached ? ' (cached)' : ''}.`;
|
|
39
35
|
}
|
|
40
36
|
function buildExcludedContext({ gcBranch, currentRepo, cached, }) {
|
|
41
|
-
return [
|
|
42
|
-
`gc-tree auto-resolve ${cached ? 'used cached state' : 'checked the active gc-branch'} and found that repo "${currentRepo || 'unknown'}" is excluded from gc-branch "${gcBranch}".`,
|
|
43
|
-
`No reusable global context applies here unless the branch-repo mapping changes.`,
|
|
44
|
-
].join(' ');
|
|
37
|
+
return `[gc-tree] repo "${currentRepo || 'unknown'}" is excluded from gc-branch "${gcBranch}"${cached ? ' (cached)' : ''}.`;
|
|
45
38
|
}
|
|
46
|
-
function buildNoMatchContext({ gcBranch, currentRepo,
|
|
47
|
-
return [
|
|
48
|
-
`gc-tree auto-resolve ${cached ? 'skipped a redundant lookup using cached no-match state' : 'checked the active gc-branch'} and found no reusable global context for this prompt in gc-branch "${gcBranch}".`,
|
|
49
|
-
`Repo: ${currentRepo || 'unscoped'}.`,
|
|
50
|
-
`Query: "${query}".`,
|
|
51
|
-
`Only re-run resolve if the repo, gc-branch, or task changes materially.`,
|
|
52
|
-
].join(' ');
|
|
39
|
+
function buildNoMatchContext({ gcBranch, currentRepo, cached, }) {
|
|
40
|
+
return `[gc-tree] no matching context in gc-branch "${gcBranch}" for repo "${currentRepo || 'unscoped'}"${cached ? ' (cached)' : ''}.`;
|
|
53
41
|
}
|
|
54
|
-
function buildMatchContext({ gcBranch, currentRepo, repoScopeStatus,
|
|
42
|
+
function buildMatchContext({ gcBranch, currentRepo, repoScopeStatus, matches, }) {
|
|
55
43
|
return [
|
|
56
|
-
`[gc-tree]
|
|
57
|
-
`gc-branch: "${gcBranch}" | repo: "${currentRepo || 'unscoped'}" (scope: ${repoScopeStatus}) | query: "${query}".`,
|
|
58
|
-
`If these summaries contain enough information to answer the question or complete the task, respond directly from them WITHOUT calling any tools. Do not grep, explore, or read code to confirm what the summaries already cover. Only use tools if the summaries are clearly insufficient.`,
|
|
44
|
+
`[gc-tree] found ${Math.min(matches.length, 3)} matching context doc(s) in gc-branch "${gcBranch}" for repo "${currentRepo || 'unscoped'}" (scope: ${repoScopeStatus}).`,
|
|
59
45
|
formatMatches(matches),
|
|
60
|
-
`
|
|
46
|
+
`Use these summaries first; read full docs with \`gctree resolve --id <id>\` only if needed.`,
|
|
61
47
|
].join('\n');
|
|
62
48
|
}
|
|
63
49
|
function buildSelfReviewAppend(promptCount) {
|
|
@@ -155,17 +141,17 @@ export async function dispatchGcTreeHook({ event, home, payload, }) {
|
|
|
155
141
|
const query = currentRepo ? `${currentRepo} ${prompt}` : prompt;
|
|
156
142
|
const signature = hashQuery(query);
|
|
157
143
|
if (cache.no_match_signatures.includes(signature)) {
|
|
158
|
-
additionalContext = buildNoMatchContext({ gcBranch, currentRepo,
|
|
144
|
+
additionalContext = buildNoMatchContext({ gcBranch, currentRepo, cached: true });
|
|
159
145
|
}
|
|
160
146
|
else {
|
|
161
147
|
const result = await resolveContext({ home, branch: gcBranch, query });
|
|
162
148
|
if (result.matches.length === 0) {
|
|
163
149
|
cache.no_match_signatures = [...new Set([...cache.no_match_signatures, signature])];
|
|
164
|
-
additionalContext = buildNoMatchContext({ gcBranch, currentRepo,
|
|
150
|
+
additionalContext = buildNoMatchContext({ gcBranch, currentRepo, cached: false });
|
|
165
151
|
}
|
|
166
152
|
else {
|
|
167
153
|
cache.no_match_signatures = cache.no_match_signatures.filter((entry) => entry !== signature);
|
|
168
|
-
additionalContext = buildMatchContext({ gcBranch, currentRepo, repoScopeStatus,
|
|
154
|
+
additionalContext = buildMatchContext({ gcBranch, currentRepo, repoScopeStatus, matches: result.matches });
|
|
169
155
|
}
|
|
170
156
|
}
|
|
171
157
|
if (cache.prompt_count > 0 && cache.prompt_count % SELF_REVIEW_INTERVAL === 0) {
|
package/dist/src/repo-map.js
CHANGED
|
@@ -132,7 +132,8 @@ export async function resolveBranchForRepo({ home, head, explicitBranch, cwd = p
|
|
|
132
132
|
}
|
|
133
133
|
export async function promptResolveScopeDecision(branch, repo, preferredLanguage = 'English') {
|
|
134
134
|
if (!stdin.isTTY && process.env.GCTREE_ALLOW_STDIN_PROMPT !== '1') {
|
|
135
|
-
|
|
135
|
+
process.stderr.write(`gc-tree: repo "${repo}" is not mapped to gc-branch "${branch}" — continuing without scope decision.\n`);
|
|
136
|
+
return 'continue-once';
|
|
136
137
|
}
|
|
137
138
|
const rl = createInterface({ input: stdin, output: stderr });
|
|
138
139
|
try {
|
package/dist/src/scaffold.js
CHANGED
|
@@ -8,11 +8,12 @@ function renderCodexAgentsSnippet() {
|
|
|
8
8
|
'',
|
|
9
9
|
'- Treat the active gctree branch as a **gc-branch** when you describe it to users.',
|
|
10
10
|
'- gctree init installs SessionStart and UserPromptSubmit hooks that auto-check gc-tree before work.',
|
|
11
|
-
'- When you encounter an unfamiliar term, acronym, concept, or domain word, follow this protocol **before** grepping or reading code files:',
|
|
12
|
-
' 1.
|
|
13
|
-
' 2.
|
|
14
|
-
' 3. If the concept exists in a doc but was not indexed → propose adding it as an Index Entry to that doc
|
|
11
|
+
'- When you encounter an unfamiliar term, acronym, concept, or domain word, follow this scope-aware protocol **before** grepping or reading code files:',
|
|
12
|
+
' 1. Always run `gctree resolve --query "<term>"` first. If matched, use the result directly.',
|
|
13
|
+
' 2. Only if the current repo scope is **included** (not unmapped/excluded): if step 1 found nothing, try broader related queries to check if the concept exists in any doc.',
|
|
14
|
+
' 3. If the concept exists in a doc but was not indexed → propose adding it as an Index Entry to that doc.',
|
|
15
15
|
' 4. If it does not exist anywhere → decide whether a new doc is needed and propose it to the user.',
|
|
16
|
+
' — If the repo is **unmapped** or **excluded**: do step 1 only; if no match, skip and proceed normally.',
|
|
16
17
|
'- When a UserPromptSubmit hook provides `[gc-tree] PRE-TASK CONTEXT`, treat it as mandatory pre-reading before any tool use.',
|
|
17
18
|
'- If the injected summaries contain enough information to answer the question or complete the task, respond directly from them **without calling any tools**. Do not grep, explore, or read code files to confirm what the summaries already cover.',
|
|
18
19
|
'- Only use tools if the summaries are clearly insufficient — meaning the answer cannot be derived from them at all.',
|
|
@@ -123,11 +124,12 @@ function renderClaudeSnippet() {
|
|
|
123
124
|
'',
|
|
124
125
|
'- Treat the active gctree branch as a **gc-branch** in user-facing language.',
|
|
125
126
|
'- gctree init installs SessionStart and UserPromptSubmit hooks that auto-inject gc-tree context before every prompt.',
|
|
126
|
-
'- When you encounter an unfamiliar term, acronym, concept, or domain word, follow this protocol **before** grepping or reading code files:',
|
|
127
|
-
' 1.
|
|
128
|
-
' 2.
|
|
129
|
-
' 3. If the concept exists in a doc but was not indexed → propose adding it as an Index Entry to that doc
|
|
127
|
+
'- When you encounter an unfamiliar term, acronym, concept, or domain word, follow this scope-aware protocol **before** grepping or reading code files:',
|
|
128
|
+
' 1. Always run `gctree resolve --query "<term>"` first. If matched, use the result directly.',
|
|
129
|
+
' 2. Only if the current repo scope is **included** (not unmapped/excluded): if step 1 found nothing, try broader related queries to check if the concept exists in any doc.',
|
|
130
|
+
' 3. If the concept exists in a doc but was not indexed → propose adding it as an Index Entry to that doc.',
|
|
130
131
|
' 4. If it does not exist anywhere → decide whether a new doc is needed and propose it to the user.',
|
|
132
|
+
' — If the repo is **unmapped** or **excluded**: do step 1 only; if no match, skip and proceed normally.',
|
|
131
133
|
'- When a UserPromptSubmit hook provides `[gc-tree] PRE-TASK CONTEXT`, treat it as mandatory pre-reading before any tool use.',
|
|
132
134
|
'- If the injected summaries contain enough information to answer the question or complete the task, respond directly from them **without calling any tools**. Do not grep, explore, or read code files to confirm what the summaries already cover.',
|
|
133
135
|
'- Only use tools if the summaries are clearly insufficient — meaning the answer cannot be derived from them at all.',
|
package/docs/usage.es.md
CHANGED
|
@@ -157,6 +157,8 @@ Si un repositorio recién relevante también debería pasar a formar parte del c
|
|
|
157
157
|
|
|
158
158
|
`gctree init` instala la superficie global de hooks orientada al proveedor. `gctree scaffold` instala un override local en un directorio de destino cuando un repositorio concreto necesita sus propios snippets markdown o una superficie de comandos local.
|
|
159
159
|
|
|
160
|
+
El hook UserPromptSubmit solo inyecta contexto previo compacto: estado found/no-match, IDs de documentos coincidentes y resúmenes. No incluye excerpts largos por defecto; abre documentos completos con `gctree resolve --id <id>` cuando el resumen no sea suficiente.
|
|
161
|
+
|
|
160
162
|
```bash
|
|
161
163
|
gctree scaffold --host codex --target /path/to/repo
|
|
162
164
|
gctree scaffold --host claude-code --target /path/to/repo
|
package/docs/usage.ja.md
CHANGED
|
@@ -157,6 +157,8 @@ gctree ugc
|
|
|
157
157
|
|
|
158
158
|
`gctree init` はグローバルなプロバイダーフック面をインストールします。`gctree scaffold` は特定のリポジトリに独自の markdown スニペットやローカルなコマンド面が必要なときに、ターゲットディレクトリへローカル override をインストールします。
|
|
159
159
|
|
|
160
|
+
UserPromptSubmit フックが注入するのは compact な pre-task context だけです。found/no-match 状態、マッチしたドキュメント ID、要約を示し、長い excerpt はデフォルトではインラインしません。要約だけで足りない場合は `gctree resolve --id <id>` で全文を開きます。
|
|
161
|
+
|
|
160
162
|
```bash
|
|
161
163
|
gctree scaffold --host codex --target /path/to/repo
|
|
162
164
|
gctree scaffold --host claude-code --target /path/to/repo
|
package/docs/usage.ko.md
CHANGED
|
@@ -157,6 +157,8 @@ gctree ugc
|
|
|
157
157
|
|
|
158
158
|
`gctree init`은 전역 프로바이더 훅 표면을 설치합니다. `gctree scaffold`는 특정 저장소에 자체 markdown 스니펫이나 로컬 명령 표면이 필요할 때 대상 디렉토리에 로컬 override를 설치합니다.
|
|
159
159
|
|
|
160
|
+
UserPromptSubmit 훅은 compact pre-task context만 주입합니다: 찾음/no-match 상태, 매칭된 문서 ID, 요약입니다. 기본적으로 긴 excerpt를 인라인하지 않으며, 요약만으로 부족할 때 `gctree resolve --id <id>`로 전체 문서를 엽니다.
|
|
161
|
+
|
|
160
162
|
```bash
|
|
161
163
|
gctree scaffold --host codex --target /path/to/repo
|
|
162
164
|
gctree scaffold --host claude-code --target /path/to/repo
|
package/docs/usage.md
CHANGED
|
@@ -157,6 +157,8 @@ If a newly relevant repo should also become part of the durable context, the nat
|
|
|
157
157
|
|
|
158
158
|
`gctree init` installs the provider-facing hook surface globally. `gctree scaffold` installs a local override into one target directory when a specific repository needs its own markdown snippets or local command surface.
|
|
159
159
|
|
|
160
|
+
The UserPromptSubmit hook injects compact pre-task context only: found/no-match state, matched document IDs, and summaries. It does not inline long excerpts by default; open full documents with `gctree resolve --id <id>` when the summary is not enough.
|
|
161
|
+
|
|
160
162
|
```bash
|
|
161
163
|
gctree scaffold --host codex --target /path/to/repo
|
|
162
164
|
gctree scaffold --host claude-code --target /path/to/repo
|
package/docs/usage.zh.md
CHANGED
|
@@ -157,6 +157,8 @@ gctree ugc
|
|
|
157
157
|
|
|
158
158
|
`gctree init` 会安装全局 provider hook 表面。`gctree scaffold` 则在某个仓库需要自己的 markdown 片段或本地命令表面时,将本地 override 安装到目标目录中。
|
|
159
159
|
|
|
160
|
+
UserPromptSubmit hook 只注入紧凑的 pre-task context:found/no-match 状态、匹配文档 ID 和摘要。默认不内联长 excerpt;当摘要不够时,用 `gctree resolve --id <id>` 打开完整文档。
|
|
161
|
+
|
|
160
162
|
```bash
|
|
161
163
|
gctree scaffold --host codex --target /path/to/repo
|
|
162
164
|
gctree scaffold --host claude-code --target /path/to/repo
|