@handsupmin/gc-tree 0.5.1 → 0.5.3
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 +1 -1
- package/dist/src/integration-files.js +8 -5
- package/dist/src/scaffold.js +6 -1
- package/package.json +1 -1
package/dist/src/cli.js
CHANGED
|
@@ -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
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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', '
|
|
168
|
+
claude: join(targetDir, '.claude', 'settings.json'),
|
|
166
169
|
};
|
|
167
170
|
}
|
package/dist/src/scaffold.js
CHANGED
|
@@ -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),
|