@handsupmin/gc-tree 0.5.2 → 0.5.4

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.
@@ -109,7 +109,7 @@ function mergeHookJson(raw, target) {
109
109
  };
110
110
  upsertGroup(sessionEvent, target === 'codex' ? 'startup|resume' : '*');
111
111
  upsertGroup(promptEvent, target === 'codex' ? undefined : '*');
112
- return `${JSON.stringify({ hooks }, null, 2)}\n`;
112
+ return `${JSON.stringify({ ...parsed, hooks }, null, 2)}\n`;
113
113
  }
114
114
  function unmergeHookJson(raw, events) {
115
115
  const parsed = ensureObject(JSON.parse(raw));
@@ -128,9 +128,12 @@ function unmergeHookJson(raw, events) {
128
128
  else
129
129
  delete hooks[event];
130
130
  }
131
- if (Object.keys(hooks).length === 0)
132
- return '';
133
- return `${JSON.stringify({ hooks }, null, 2)}\n`;
131
+ const { hooks: _unused, ...otherFields } = parsed;
132
+ const hasOtherFields = Object.keys(otherFields).length > 0;
133
+ if (Object.keys(hooks).length === 0) {
134
+ return hasOtherFields ? `${JSON.stringify(otherFields, null, 2)}\n` : '';
135
+ }
136
+ return `${JSON.stringify({ ...otherFields, hooks }, null, 2)}\n`;
134
137
  }
135
138
  export async function mergeGcTreeHooksJson({ filePath, target, }) {
136
139
  const existing = (await pathExists(filePath)) ? await readFile(filePath, 'utf8') : null;
@@ -162,6 +165,6 @@ export function gctreeManagedMarkdownTargets(targetDir) {
162
165
  export function gctreeHookJsonTargets(targetDir) {
163
166
  return {
164
167
  codex: join(targetDir, '.codex', 'hooks.json'),
165
- claude: join(targetDir, '.claude', 'hooks', 'hooks.json'),
168
+ claude: join(targetDir, '.claude', 'settings.json'),
166
169
  };
167
170
  }
@@ -41,7 +41,8 @@ export function onboardingCompletionLines() {
41
41
  'Then summarize what you now understand from the saved docs instead of stopping at the filenames alone.',
42
42
  'Ask whether that final summary matches the user\'s reality, and capture any corrections before you wrap up.',
43
43
  'Ask whether anything else should be saved while the context is still fresh.',
44
+ 'After docs are confirmed correct, ask which repositories discussed during onboarding should be explicitly mapped to this gc-branch. For each confirmed repo, navigate to that directory and run `gctree set-repo-scope --branch <current-gc-branch> --include`. Skip this step only if the user explicitly says repo mapping is not needed.',
44
45
  'Do not finish onboarding while material related repos, workflows, or domain terms remain uninspected when recoverable local evidence is still available.',
45
- 'Only after the related repos, workflows, glossary, and default verification commands are either captured or explicitly unavailable should you wrap up, then remind the user that future changes belong in `gctree update-global-context`.',
46
+ 'Only after the related repos, workflows, glossary, default verification commands, and repo-scope mapping are either captured or explicitly skipped should you wrap up, then remind the user that future changes belong in `gctree update-global-context`.',
46
47
  ];
47
48
  }
@@ -1,6 +1,6 @@
1
1
  import { access, mkdir, writeFile } from 'node:fs/promises';
2
2
  import { dirname, join } from 'node:path';
3
- import { gctreeHookJsonTargets, gctreeManagedMarkdownTargets, mergeGcTreeHooksJson, upsertManagedMarkdownBlock, } from './integration-files.js';
3
+ import { gctreeHookJsonTargets, gctreeManagedMarkdownTargets, mergeGcTreeHooksJson, unmergeGcTreeHooksJson, upsertManagedMarkdownBlock, } from './integration-files.js';
4
4
  import { onboardingCompletionLines, onboardingProtocolLines } from './onboarding-protocol.js';
5
5
  function renderCodexAgentsSnippet() {
6
6
  return [
@@ -246,6 +246,11 @@ export async function scaffoldHostIntegration({ host, targetDir, force = false,
246
246
  target: isCodex ? 'codex' : 'claude-code',
247
247
  });
248
248
  written.push(hookPath);
249
+ // Migrate: clean up gctree entries from old hooks.json location (claude-code only)
250
+ if (!isCodex) {
251
+ const oldHooksPath = join(targetDir, '.claude', 'hooks', 'hooks.json');
252
+ await unmergeGcTreeHooksJson(oldHooksPath);
253
+ }
249
254
  const targets = files.map((file) => ({
250
255
  ...file,
251
256
  fullPath: join(targetDir, file.path),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@handsupmin/gc-tree",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
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,
@@ -78,6 +78,7 @@ Use this when a user wants to create global context for a product, company, or w
78
78
  26. Summarize what you now understand from the saved docs instead of ending at the filenames alone.
79
79
  27. Ask whether that final summary matches the user's reality, and capture any corrections before you wrap up.
80
80
  28. Ask whether anything else should be saved while the context is still fresh.
81
- 29. Do not finish onboarding while material related repos, workflows, or domain terms remain uninspected when recoverable local evidence is still available.
82
- 30. Only after the related repos, workflows, glossary, and default verification commands are either captured or explicitly unavailable should you wrap up, then remind the user that future changes belong in `gctree update-global-context`.
83
- 31. Keep the current gc-branch explicit while gathering context.
81
+ 29. After docs are confirmed correct, ask which repositories discussed during onboarding should be explicitly mapped to this gc-branch. For each confirmed repo, navigate to that directory and run `gctree set-repo-scope --branch <gc-branch> --include`. Skip this step only if the user explicitly says repo mapping is not needed.
82
+ 30. Do not finish onboarding while material related repos, workflows, or domain terms remain uninspected when recoverable local evidence is still available.
83
+ 31. Only after the related repos, workflows, glossary, default verification commands, and repo-scope mapping are either captured or explicitly skipped should you wrap up, then remind the user that future changes belong in `gctree update-global-context`.
84
+ 32. Keep the current gc-branch explicit while gathering context.