@handsupmin/gc-tree 0.7.8 → 0.7.10

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
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import { existsSync } from 'node:fs';
3
3
  import { readFile } from 'node:fs/promises';
4
+ import { resolve } from 'node:path';
4
5
  import { stdin, stderr, stdout } from 'node:process';
5
6
  import { readAsciiLogo, readAsciiTree } from './ascii.js';
7
+ import { gctreeGlobalRoot } from './integration-files.js';
6
8
  import { dispatchGcTreeHook } from './hook.js';
7
9
  import { onboardBranch } from './onboard.js';
8
10
  import { buildProviderLaunchPlan, maybeLaunchProvider, promptLanguageSelection, promptLaunchProviderSelection, promptProviderSelection, } from './provider.js';
@@ -525,9 +527,10 @@ async function main() {
525
527
  if (!host)
526
528
  usage();
527
529
  const explicitTarget = readArg('--target');
530
+ const isGlobal = !explicitTarget || Object.values({ codex: gctreeGlobalRoot('codex'), claude: gctreeGlobalRoot('claude-code') }).some((r) => resolve(explicitTarget) === resolve(r));
528
531
  const result = await ensureScaffold({
529
532
  providerMode: host,
530
- ...(explicitTarget ? { targetDir: explicitTarget, scope: 'local' } : { scope: 'global' }),
533
+ ...(isGlobal ? { scope: 'global' } : { targetDir: explicitTarget, scope: 'local' }),
531
534
  force: hasFlag('--force'),
532
535
  });
533
536
  console.log(JSON.stringify(result, null, 2));
package/dist/src/hook.js CHANGED
@@ -52,11 +52,11 @@ function buildNoMatchContext({ gcBranch, currentRepo, query, cached, }) {
52
52
  }
53
53
  function buildMatchContext({ gcBranch, currentRepo, repoScopeStatus, query, matches, }) {
54
54
  return [
55
- `gc-tree auto-resolve checked gc-branch "${gcBranch}" for repo "${currentRepo || 'unscoped'}" (scope: ${repoScopeStatus}) before this prompt.`,
56
- `Query: "${query}".`,
57
- `Use these matching gc-tree summaries before planning or implementation:`,
55
+ `[gc-tree] PRE-TASK CONTEXT read before any tool use or code exploration.`,
56
+ `gc-branch: "${gcBranch}" | repo: "${currentRepo || 'unscoped'}" (scope: ${repoScopeStatus}) | query: "${query}".`,
57
+ `Do NOT call Explore, grep, or read code files until you have read and internalized these summaries:`,
58
58
  formatMatches(matches),
59
- `Read full docs only if the summaries are insufficient. Each doc has a ## Summary section at the top — read that before the full body.`,
59
+ `Read full docs (gctree resolve --id <id>) only if summaries are insufficient. Each doc has a ## Summary section — read that first.`,
60
60
  ].join('\n');
61
61
  }
62
62
  async function readHookCache(home, sessionId) {
@@ -108,8 +108,9 @@ function renderClaudeSnippet() {
108
108
  '# gctree Claude Code integration snippet',
109
109
  '',
110
110
  '- Treat the active gctree branch as a **gc-branch** in user-facing language.',
111
- '- gctree init installs SessionStart and UserPromptSubmit hooks that auto-check gc-tree before work.',
112
- '- Use the hook-injected gc-tree context first. If hooks are unavailable or clearly stale, run `gctree status` and `gctree resolve --query "<task>"` yourself before planning or implementation.',
111
+ '- gctree init installs SessionStart and UserPromptSubmit hooks that auto-inject gc-tree context before every prompt.',
112
+ '- When a UserPromptSubmit hook provides `[gc-tree] PRE-TASK CONTEXT`, treat it as mandatory pre-reading. Read and internalize the injected summaries **before** calling any tools (Explore, grep, Read, Bash). Do not explore code first.',
113
+ '- If hooks are unavailable or clearly stale, run `gctree status` and `gctree resolve --query "<task>"` yourself before planning or implementation.',
113
114
  '- Use `/gc-onboard` only for an empty gc-branch.',
114
115
  '- Use `/gc-update-global-context` when durable context in the active gc-branch should change.',
115
116
  '',
@@ -119,7 +120,7 @@ function renderClaudeSessionStartHook() {
119
120
  return [
120
121
  '# gctree Claude Code SessionStart note',
121
122
  '',
122
- '- gctree init installs real SessionStart/UserPromptSubmit hooks via `.claude/hooks/hooks.json`.',
123
+ '- gctree init installs real SessionStart/UserPromptSubmit hooks via `.claude/settings.json`.',
123
124
  '- At session start, use the injected hook context to confirm the active gc-branch.',
124
125
  '- Refer to gctree branches as **gc-branches** in user-facing language.',
125
126
  '- If hook context is missing or stale, resolve summaries before planning or implementation when branch-level context may change the answer.',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@handsupmin/gc-tree",
3
- "version": "0.7.8",
3
+ "version": "0.7.10",
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,