@handsupmin/gc-tree 1.1.4 → 1.1.6

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/dist/src/cli.js CHANGED
File without changes
package/dist/src/hook.js CHANGED
@@ -197,7 +197,6 @@ export async function dispatchGcTreeHook({ event, home, payload, }) {
197
197
  const prompt = normalizeText(payload.user_prompt || payload.prompt || '');
198
198
  if (!prompt)
199
199
  return null;
200
- const branchStatus = await statusForBranch(home, gcBranch);
201
200
  const previousCache = await readHookCache(home, sessionId);
202
201
  const promptSignature = hashQuery(`${event}:${gcBranch}:${currentRepo || ''}:${repoScopeStatus}:${prompt}`);
203
202
  if (previousCache?.last_prompt_signature === promptSignature &&
@@ -221,47 +220,35 @@ export async function dispatchGcTreeHook({ event, home, payload, }) {
221
220
  cached: previousCache?.branch_excluded === true,
222
221
  });
223
222
  }
224
- else if (branchStatus.doc_count === 0) {
225
- const wasCached = cache.branch_empty;
226
- cache.branch_empty = true;
227
- additionalContext = buildEmptyBranchContext({ gcBranch, currentRepo, cached: wasCached });
228
- }
229
- else if (repoScopeStatus === 'unmapped' && currentRepo && cache.unmapped_shown_repos.includes(currentRepo)) {
230
- // Already showed context for this unmapped repo this session — skip silently.
223
+ else if (repoScopeStatus === 'unmapped' && currentRepo) {
231
224
  cache.updated_at = now.toISOString();
232
225
  await writeHookCache(home, cache);
233
226
  return null;
234
227
  }
235
228
  else {
236
- // For unmapped repos: use prompt only (no repo prefix) to avoid bias; apply higher score threshold.
237
- const isUnmapped = repoScopeStatus === 'unmapped';
238
- const query = !isUnmapped && currentRepo ? `${currentRepo} ${prompt}` : prompt;
239
- const signature = hashQuery(query);
240
- if (!isUnmapped && cache.no_match_signatures.includes(signature)) {
241
- additionalContext = buildNoMatchContext({ gcBranch, currentRepo, cached: true });
229
+ const branchStatus = await statusForBranch(home, gcBranch);
230
+ if (branchStatus.doc_count === 0) {
231
+ const wasCached = cache.branch_empty;
232
+ cache.branch_empty = true;
233
+ additionalContext = buildEmptyBranchContext({ gcBranch, currentRepo, cached: wasCached });
242
234
  }
243
235
  else {
244
- const result = await resolveContext({ home, branch: gcBranch, query });
245
- const effectiveMatches = result.matches;
246
- if (effectiveMatches.length === 0) {
247
- if (isUnmapped) {
248
- // Unmapped + no strong match: skip silently, no noise.
249
- cache.updated_at = now.toISOString();
250
- await writeHookCache(home, cache);
251
- return null;
252
- }
253
- cache.no_match_signatures = [...new Set([...cache.no_match_signatures, signature])];
254
- additionalContext = buildNoMatchContext({ gcBranch, currentRepo, cached: false });
236
+ const query = currentRepo ? `${currentRepo} ${prompt}` : prompt;
237
+ const signature = hashQuery(query);
238
+ if (cache.no_match_signatures.includes(signature)) {
239
+ additionalContext = buildNoMatchContext({ gcBranch, currentRepo, cached: true });
255
240
  }
256
241
  else {
257
- if (!isUnmapped) {
258
- cache.no_match_signatures = cache.no_match_signatures.filter((entry) => entry !== signature);
242
+ const result = await resolveContext({ home, branch: gcBranch, query });
243
+ const effectiveMatches = result.matches;
244
+ if (effectiveMatches.length === 0) {
245
+ cache.no_match_signatures = [...new Set([...cache.no_match_signatures, signature])];
246
+ additionalContext = buildNoMatchContext({ gcBranch, currentRepo, cached: false });
259
247
  }
260
- else if (currentRepo) {
261
- // Mark this unmapped repo as shown so we don't repeat next prompt.
262
- cache.unmapped_shown_repos = [...new Set([...cache.unmapped_shown_repos, currentRepo])];
248
+ else {
249
+ cache.no_match_signatures = cache.no_match_signatures.filter((entry) => entry !== signature);
250
+ additionalContext = buildMatchContext({ gcBranch, currentRepo, repoScopeStatus, matches: effectiveMatches });
263
251
  }
264
- additionalContext = buildMatchContext({ gcBranch, currentRepo, repoScopeStatus, matches: effectiveMatches });
265
252
  }
266
253
  }
267
254
  if (cache.prompt_count > 0 && cache.prompt_count % SELF_REVIEW_INTERVAL === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@handsupmin/gc-tree",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "Global Context Tree, a lightweight branch-aware global context orchestrator for AI coding tools",
5
5
  "type": "module",
6
6
  "private": false,
@@ -18,7 +18,7 @@
18
18
  "gctree": "dist/src/cli.js"
19
19
  },
20
20
  "scripts": {
21
- "build": "tsc -p tsconfig.json",
21
+ "build": "tsc -p tsconfig.json && node -e \"require('node:fs').chmodSync('dist/src/cli.js', 0o755)\"",
22
22
  "test": "node --import tsx --test tests/*.test.ts",
23
23
  "prepack": "npm run build",
24
24
  "eval": "node --import tsx tests/eval/index.ts",