agent-switchboard 0.1.27 → 0.1.28
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.md +26 -1
- package/dist/commands/distribution.js +2 -2
- package/dist/commands/distribution.js.map +1 -1
- package/dist/commands/library.d.ts +1 -1
- package/dist/commands/library.js +5 -5
- package/dist/commands/library.js.map +1 -1
- package/dist/config/application-config.d.ts +37 -0
- package/dist/config/application-config.js +83 -0
- package/dist/config/application-config.js.map +1 -0
- package/dist/config/layered-config.js +43 -2
- package/dist/config/layered-config.js.map +1 -1
- package/dist/config/paths.d.ts +7 -2
- package/dist/config/paths.js +12 -3
- package/dist/config/paths.js.map +1 -1
- package/dist/config/schemas.d.ts +103 -22
- package/dist/config/schemas.js +22 -18
- package/dist/config/schemas.js.map +1 -1
- package/dist/config/switchboard-config.d.ts +3 -6
- package/dist/config/switchboard-config.js +3 -6
- package/dist/config/switchboard-config.js.map +1 -1
- package/dist/hooks/distribution.d.ts +27 -0
- package/dist/hooks/distribution.js +235 -0
- package/dist/hooks/distribution.js.map +1 -0
- package/dist/hooks/library.d.ts +40 -0
- package/dist/hooks/library.js +143 -0
- package/dist/hooks/library.js.map +1 -0
- package/dist/hooks/schema.d.ts +542 -0
- package/dist/hooks/schema.js +49 -0
- package/dist/hooks/schema.js.map +1 -0
- package/dist/index.js +608 -146
- package/dist/index.js.map +1 -1
- package/dist/library/fs.d.ts +1 -3
- package/dist/library/fs.js +24 -7
- package/dist/library/fs.js.map +1 -1
- package/dist/library/schema.d.ts +1 -1
- package/dist/library/schema.js +1 -1
- package/dist/library/sources.d.ts +3 -0
- package/dist/library/sources.js +8 -2
- package/dist/library/sources.js.map +1 -1
- package/dist/library/state.d.ts +4 -5
- package/dist/library/state.js +15 -31
- package/dist/library/state.js.map +1 -1
- package/dist/marketplace/plugin-loader.d.ts +30 -0
- package/dist/marketplace/plugin-loader.js +178 -0
- package/dist/marketplace/plugin-loader.js.map +1 -0
- package/dist/marketplace/reader.d.ts +36 -0
- package/dist/marketplace/reader.js +90 -0
- package/dist/marketplace/reader.js.map +1 -0
- package/dist/marketplace/schemas.d.ts +467 -0
- package/dist/marketplace/schemas.js +57 -0
- package/dist/marketplace/schemas.js.map +1 -0
- package/dist/marketplace/source-loader.d.ts +32 -0
- package/dist/marketplace/source-loader.js +45 -0
- package/dist/marketplace/source-loader.js.map +1 -0
- package/dist/rules/composer.d.ts +2 -2
- package/dist/rules/composer.js +5 -5
- package/dist/rules/composer.js.map +1 -1
- package/dist/rules/distribution.js +2 -2
- package/dist/rules/distribution.js.map +1 -1
- package/dist/skills/distribution.js +6 -6
- package/dist/skills/distribution.js.map +1 -1
- package/dist/skills/library.d.ts +1 -2
- package/dist/skills/library.js +6 -6
- package/dist/skills/library.js.map +1 -1
- package/dist/subagents/distribution.d.ts +1 -1
- package/dist/subagents/distribution.js +319 -20
- package/dist/subagents/distribution.js.map +1 -1
- package/dist/subagents/importer.d.ts +1 -1
- package/dist/subagents/importer.js +61 -1
- package/dist/subagents/importer.js.map +1 -1
- package/dist/subagents/inventory.js +3 -3
- package/dist/subagents/inventory.js.map +1 -1
- package/dist/subagents/library.d.ts +2 -2
- package/dist/subagents/library.js +14 -19
- package/dist/subagents/library.js.map +1 -1
- package/dist/ui/hook-ui.d.ts +8 -0
- package/dist/ui/hook-ui.js +17 -0
- package/dist/ui/hook-ui.js.map +1 -0
- package/dist/ui/library-selector.d.ts +1 -1
- package/dist/ui/subagent-ui.js +3 -3
- package/dist/ui/subagent-ui.js.map +1 -1
- package/dist/util/cli.d.ts +20 -0
- package/dist/util/cli.js +107 -14
- package/dist/util/cli.js.map +1 -1
- package/package.json +3 -2
- package/dist/config/agent-config.d.ts +0 -35
- package/dist/config/agent-config.js +0 -88
- package/dist/config/agent-config.js.map +0 -1
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook distribution: copies bundle files and merges hook configurations
|
|
3
|
+
* into Claude Code's settings.json.
|
|
4
|
+
*
|
|
5
|
+
* Two-phase distribution for each active hook:
|
|
6
|
+
* 1. **Bundle copy** (bundle hooks only): copy script files to
|
|
7
|
+
* `~/.claude/hooks/asb/<hook-id>/` using the existing bundle distributor.
|
|
8
|
+
* 2. **Config merge**: deep-merge all active hooks' event maps into
|
|
9
|
+
* `~/.claude/settings.json` under the `hooks` key. For bundle hooks,
|
|
10
|
+
* `${HOOK_DIR}` placeholders are resolved to the distributed path.
|
|
11
|
+
*
|
|
12
|
+
* Only Claude Code is supported as a distribution target.
|
|
13
|
+
*/
|
|
14
|
+
import fs from 'node:fs';
|
|
15
|
+
import path from 'node:path';
|
|
16
|
+
import { getClaudeDir, getProjectClaudeDir } from '../config/paths.js';
|
|
17
|
+
import { distributeBundle } from '../library/distribute-bundle.js';
|
|
18
|
+
import { ensureParentDir } from '../library/fs.js';
|
|
19
|
+
import { loadLibraryStateSectionForApplication } from '../library/state.js';
|
|
20
|
+
import { listHookBundleFiles, loadHookLibrary } from './library.js';
|
|
21
|
+
import { HOOK_DIR_PLACEHOLDER } from './schema.js';
|
|
22
|
+
const ASB_MANAGED_KEY = '_asb_managed_hooks';
|
|
23
|
+
const ASB_HOOKS_SUBDIR = 'asb';
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
// Path helpers
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
function resolveSettingsPath(scope) {
|
|
28
|
+
const projectRoot = scope?.project?.trim();
|
|
29
|
+
if (projectRoot && projectRoot.length > 0) {
|
|
30
|
+
return path.join(getProjectClaudeDir(projectRoot), 'settings.local.json');
|
|
31
|
+
}
|
|
32
|
+
return path.join(getClaudeDir(), 'settings.json');
|
|
33
|
+
}
|
|
34
|
+
function resolveHooksBundleParentDir(scope) {
|
|
35
|
+
const projectRoot = scope?.project?.trim();
|
|
36
|
+
if (projectRoot && projectRoot.length > 0) {
|
|
37
|
+
return path.join(getProjectClaudeDir(projectRoot), 'hooks', ASB_HOOKS_SUBDIR);
|
|
38
|
+
}
|
|
39
|
+
return path.join(getClaudeDir(), 'hooks', ASB_HOOKS_SUBDIR);
|
|
40
|
+
}
|
|
41
|
+
function resolveHookBundleTargetDir(_platform, entry, scope) {
|
|
42
|
+
return path.join(resolveHooksBundleParentDir(scope), entry.id);
|
|
43
|
+
}
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
// Settings.json I/O
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
function readSettingsJson(filePath) {
|
|
48
|
+
try {
|
|
49
|
+
if (fs.existsSync(filePath)) {
|
|
50
|
+
return JSON.parse(fs.readFileSync(filePath, 'utf-8'));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
// Corrupted or unreadable; start fresh for hooks section
|
|
55
|
+
}
|
|
56
|
+
return {};
|
|
57
|
+
}
|
|
58
|
+
function writeSettingsJson(filePath, data) {
|
|
59
|
+
ensureParentDir(filePath);
|
|
60
|
+
fs.writeFileSync(filePath, `${JSON.stringify(data, null, 2)}\n`, 'utf-8');
|
|
61
|
+
}
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
// ${HOOK_DIR} rewriting
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
/**
|
|
66
|
+
* Deep-clone matcher groups, replacing `${HOOK_DIR}` in command strings
|
|
67
|
+
* with the absolute path to the distributed bundle directory.
|
|
68
|
+
*/
|
|
69
|
+
function rewriteHookDir(groups, distributedDir) {
|
|
70
|
+
return groups.map((group) => ({
|
|
71
|
+
...group,
|
|
72
|
+
hooks: group.hooks.map((handler) => {
|
|
73
|
+
if (typeof handler.command !== 'string')
|
|
74
|
+
return handler;
|
|
75
|
+
return {
|
|
76
|
+
...handler,
|
|
77
|
+
command: handler.command.replaceAll(HOOK_DIR_PLACEHOLDER, distributedDir),
|
|
78
|
+
};
|
|
79
|
+
}),
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
// ---------------------------------------------------------------------------
|
|
83
|
+
// Config merge
|
|
84
|
+
// ---------------------------------------------------------------------------
|
|
85
|
+
/**
|
|
86
|
+
* Merge active hook entries into the settings.json `hooks` key.
|
|
87
|
+
* Tags each injected matcher group with `_asb_source` for future cleanup.
|
|
88
|
+
*/
|
|
89
|
+
function mergeHooksIntoSettings(settings, selected, scope) {
|
|
90
|
+
const existingHooks = (settings.hooks ?? {});
|
|
91
|
+
// Remove previously ASB-managed matcher groups
|
|
92
|
+
const cleanedHooks = {};
|
|
93
|
+
for (const [event, groups] of Object.entries(existingHooks)) {
|
|
94
|
+
const kept = groups.filter((g) => g._asb_source === undefined);
|
|
95
|
+
if (kept.length > 0)
|
|
96
|
+
cleanedHooks[event] = kept;
|
|
97
|
+
}
|
|
98
|
+
// Merge active entries
|
|
99
|
+
for (const entry of selected) {
|
|
100
|
+
for (const [event, groups] of Object.entries(entry.hooks)) {
|
|
101
|
+
if (!cleanedHooks[event])
|
|
102
|
+
cleanedHooks[event] = [];
|
|
103
|
+
// Resolve ${HOOK_DIR} for bundle hooks
|
|
104
|
+
const resolvedGroups = entry.isBundle
|
|
105
|
+
? rewriteHookDir(groups, resolveHookBundleTargetDir('claude-code', entry, scope))
|
|
106
|
+
: groups;
|
|
107
|
+
for (const group of resolvedGroups) {
|
|
108
|
+
cleanedHooks[event].push({ ...group, _asb_source: true });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
settings.hooks = cleanedHooks;
|
|
113
|
+
settings[ASB_MANAGED_KEY] = selected.map((e) => e.id);
|
|
114
|
+
}
|
|
115
|
+
// ---------------------------------------------------------------------------
|
|
116
|
+
// Orphan cleanup for bundles
|
|
117
|
+
// ---------------------------------------------------------------------------
|
|
118
|
+
function rmDirRecursive(dirPath) {
|
|
119
|
+
if (!fs.existsSync(dirPath))
|
|
120
|
+
return;
|
|
121
|
+
const entries = fs.readdirSync(dirPath, { withFileTypes: true });
|
|
122
|
+
for (const entry of entries) {
|
|
123
|
+
const fullPath = path.join(dirPath, entry.name);
|
|
124
|
+
if (entry.isDirectory()) {
|
|
125
|
+
rmDirRecursive(fullPath);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
fs.unlinkSync(fullPath);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
fs.rmdirSync(dirPath);
|
|
132
|
+
}
|
|
133
|
+
function cleanOrphanBundleDirs(activeIds, scope) {
|
|
134
|
+
const parentDir = resolveHooksBundleParentDir(scope);
|
|
135
|
+
const results = [];
|
|
136
|
+
if (!fs.existsSync(parentDir))
|
|
137
|
+
return results;
|
|
138
|
+
try {
|
|
139
|
+
const entries = fs.readdirSync(parentDir, { withFileTypes: true });
|
|
140
|
+
for (const entry of entries) {
|
|
141
|
+
if (!entry.isDirectory())
|
|
142
|
+
continue;
|
|
143
|
+
if (activeIds.has(entry.name))
|
|
144
|
+
continue;
|
|
145
|
+
const dirPath = path.join(parentDir, entry.name);
|
|
146
|
+
try {
|
|
147
|
+
rmDirRecursive(dirPath);
|
|
148
|
+
results.push({
|
|
149
|
+
platform: 'claude-code',
|
|
150
|
+
targetDir: dirPath,
|
|
151
|
+
status: 'deleted',
|
|
152
|
+
reason: 'orphan',
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
157
|
+
results.push({
|
|
158
|
+
platform: 'claude-code',
|
|
159
|
+
targetDir: dirPath,
|
|
160
|
+
status: 'error',
|
|
161
|
+
error: `Failed to delete orphan: ${msg}`,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
// Ignore directory read errors
|
|
168
|
+
}
|
|
169
|
+
return results;
|
|
170
|
+
}
|
|
171
|
+
// ---------------------------------------------------------------------------
|
|
172
|
+
// Main distribution entry point
|
|
173
|
+
// ---------------------------------------------------------------------------
|
|
174
|
+
/**
|
|
175
|
+
* Distribute hooks to Claude Code:
|
|
176
|
+
* 1. Copy bundle files for bundle-type hooks
|
|
177
|
+
* 2. Merge all active hook configs into settings.json
|
|
178
|
+
* 3. Clean up orphan bundle directories
|
|
179
|
+
*/
|
|
180
|
+
export function distributeHooks(scope) {
|
|
181
|
+
const results = [];
|
|
182
|
+
const platform = 'claude-code';
|
|
183
|
+
const allEntries = loadHookLibrary();
|
|
184
|
+
const byId = new Map(allEntries.map((e) => [e.id, e]));
|
|
185
|
+
const state = loadLibraryStateSectionForApplication('hooks', 'claude-code', scope);
|
|
186
|
+
const selected = [];
|
|
187
|
+
for (const id of state.active) {
|
|
188
|
+
const e = byId.get(id);
|
|
189
|
+
if (e)
|
|
190
|
+
selected.push(e);
|
|
191
|
+
}
|
|
192
|
+
// Phase 1: Copy bundle files for bundle-type hooks
|
|
193
|
+
const bundleEntries = selected.filter((e) => e.isBundle);
|
|
194
|
+
if (bundleEntries.length > 0) {
|
|
195
|
+
const bundleOutcome = distributeBundle({
|
|
196
|
+
section: 'hooks',
|
|
197
|
+
selected: bundleEntries,
|
|
198
|
+
platforms: [platform],
|
|
199
|
+
resolveTargetDir: (_p, entry) => resolveHookBundleTargetDir(_p, entry, scope),
|
|
200
|
+
listFiles: listHookBundleFiles,
|
|
201
|
+
getId: (entry) => entry.id,
|
|
202
|
+
scope,
|
|
203
|
+
});
|
|
204
|
+
results.push(...bundleOutcome.results);
|
|
205
|
+
}
|
|
206
|
+
// Clean up orphan bundle directories
|
|
207
|
+
const activeBundleIds = new Set(bundleEntries.map((e) => e.id));
|
|
208
|
+
results.push(...cleanOrphanBundleDirs(activeBundleIds, scope));
|
|
209
|
+
// Phase 2: Merge hook configs into settings.json
|
|
210
|
+
const settingsPath = resolveSettingsPath(scope);
|
|
211
|
+
const settings = readSettingsJson(settingsPath);
|
|
212
|
+
const previouslyManaged = (settings[ASB_MANAGED_KEY] ?? []);
|
|
213
|
+
if (selected.length === 0 && previouslyManaged.length === 0) {
|
|
214
|
+
return { results };
|
|
215
|
+
}
|
|
216
|
+
const before = JSON.stringify(settings);
|
|
217
|
+
mergeHooksIntoSettings(settings, selected, scope);
|
|
218
|
+
const after = JSON.stringify(settings);
|
|
219
|
+
if (before === after) {
|
|
220
|
+
results.push({ platform, filePath: settingsPath, status: 'skipped', reason: 'up-to-date' });
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
try {
|
|
224
|
+
writeSettingsJson(settingsPath, settings);
|
|
225
|
+
const reason = selected.length === 0 ? 'hooks cleared' : `${selected.length} hook(s) merged`;
|
|
226
|
+
results.push({ platform, filePath: settingsPath, status: 'written', reason });
|
|
227
|
+
}
|
|
228
|
+
catch (error) {
|
|
229
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
230
|
+
results.push({ platform, filePath: settingsPath, status: 'error', error: msg });
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return { results };
|
|
234
|
+
}
|
|
235
|
+
//# sourceMappingURL=distribution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"distribution.js","sourceRoot":"","sources":["../../src/hooks/distribution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAIvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,qCAAqC,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAqB,MAAM,aAAa,CAAC;AAQtE,MAAM,eAAe,GAAG,oBAAoB,CAAC;AAC7C,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAE/B,8EAA8E;AAC9E,eA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G,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAEvC,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;IAC9F,CAAC;SAAM,CAAC;QACN,IAAI,CAAC;YACH,iBAAiB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;YAC1C,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,iBAAiB,CAAC;YAC7F,OAAO,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;QAChF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,GAAG,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnE,OAAO,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;QAClF,CAAC;IACH,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook library: loads hook entries from ~/.asb/hooks/ and marketplace sources.
|
|
3
|
+
*
|
|
4
|
+
* Two storage formats are supported:
|
|
5
|
+
* - **Bundle**: a directory containing `hook.json` + script files
|
|
6
|
+
* e.g. `~/.asb/hooks/memorize/hook.json` + `memorize/*.mjs`
|
|
7
|
+
* - **Single file**: a standalone JSON file (no scripts)
|
|
8
|
+
* e.g. `~/.asb/hooks/auto-lint.json`
|
|
9
|
+
*/
|
|
10
|
+
import type { BundleFile } from '../library/distribute-bundle.js';
|
|
11
|
+
import type { HookFile } from './schema.js';
|
|
12
|
+
export interface HookEntry {
|
|
13
|
+
id: string;
|
|
14
|
+
bareId: string;
|
|
15
|
+
namespace?: string;
|
|
16
|
+
source: string;
|
|
17
|
+
filePath: string;
|
|
18
|
+
name?: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
hooks: HookFile['hooks'];
|
|
21
|
+
/** True when the hook is a directory bundle with script files */
|
|
22
|
+
isBundle: boolean;
|
|
23
|
+
/** Absolute path to the bundle directory (only set for bundles) */
|
|
24
|
+
dirPath?: string;
|
|
25
|
+
}
|
|
26
|
+
export declare function ensureHooksDirectory(): string;
|
|
27
|
+
/**
|
|
28
|
+
* Load hook entries from a single directory.
|
|
29
|
+
* Scans for both bundle directories (containing hook.json) and standalone .json files.
|
|
30
|
+
*/
|
|
31
|
+
export declare function loadHooksFromDirectory(directory: string, namespace?: string): HookEntry[];
|
|
32
|
+
/**
|
|
33
|
+
* List all files in a hook bundle for distribution.
|
|
34
|
+
* Excludes hook.json itself (config is merged into settings.json, not copied).
|
|
35
|
+
*/
|
|
36
|
+
export declare function listHookBundleFiles(entry: HookEntry): BundleFile[];
|
|
37
|
+
/**
|
|
38
|
+
* Load all hooks from the default library, flat sources, and marketplace sources.
|
|
39
|
+
*/
|
|
40
|
+
export declare function loadHookLibrary(): HookEntry[];
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook library: loads hook entries from ~/.asb/hooks/ and marketplace sources.
|
|
3
|
+
*
|
|
4
|
+
* Two storage formats are supported:
|
|
5
|
+
* - **Bundle**: a directory containing `hook.json` + script files
|
|
6
|
+
* e.g. `~/.asb/hooks/memorize/hook.json` + `memorize/*.mjs`
|
|
7
|
+
* - **Single file**: a standalone JSON file (no scripts)
|
|
8
|
+
* e.g. `~/.asb/hooks/auto-lint.json`
|
|
9
|
+
*/
|
|
10
|
+
import fs from 'node:fs';
|
|
11
|
+
import path from 'node:path';
|
|
12
|
+
import { getHooksDir } from '../config/paths.js';
|
|
13
|
+
import { loadEntriesFromSources } from '../marketplace/source-loader.js';
|
|
14
|
+
import { hookFileSchema } from './schema.js';
|
|
15
|
+
const HOOK_JSON = 'hook.json';
|
|
16
|
+
function isJsonFile(fileName) {
|
|
17
|
+
return path.extname(fileName).toLowerCase() === '.json';
|
|
18
|
+
}
|
|
19
|
+
function toId(fileName) {
|
|
20
|
+
return path.basename(fileName, path.extname(fileName));
|
|
21
|
+
}
|
|
22
|
+
export function ensureHooksDirectory() {
|
|
23
|
+
const directory = getHooksDir();
|
|
24
|
+
if (!fs.existsSync(directory)) {
|
|
25
|
+
fs.mkdirSync(directory, { recursive: true });
|
|
26
|
+
}
|
|
27
|
+
return directory;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Load a single-file hook entry from a .json file.
|
|
31
|
+
*/
|
|
32
|
+
function loadSingleFileHook(absolutePath, bareId, directory, namespace) {
|
|
33
|
+
const rawContent = fs.readFileSync(absolutePath, 'utf-8');
|
|
34
|
+
const parsed = hookFileSchema.parse(JSON.parse(rawContent));
|
|
35
|
+
const id = namespace ? `${namespace}:${bareId}` : bareId;
|
|
36
|
+
return {
|
|
37
|
+
id,
|
|
38
|
+
bareId,
|
|
39
|
+
namespace,
|
|
40
|
+
source: directory,
|
|
41
|
+
filePath: absolutePath,
|
|
42
|
+
name: parsed.name,
|
|
43
|
+
description: parsed.description,
|
|
44
|
+
hooks: parsed.hooks,
|
|
45
|
+
isBundle: false,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Load a bundle hook entry from a directory containing hook.json.
|
|
50
|
+
*/
|
|
51
|
+
function loadBundleHook(bundleDir, bareId, parentDir, namespace) {
|
|
52
|
+
const hookJsonPath = path.join(bundleDir, HOOK_JSON);
|
|
53
|
+
const rawContent = fs.readFileSync(hookJsonPath, 'utf-8');
|
|
54
|
+
const parsed = hookFileSchema.parse(JSON.parse(rawContent));
|
|
55
|
+
const id = namespace ? `${namespace}:${bareId}` : bareId;
|
|
56
|
+
return {
|
|
57
|
+
id,
|
|
58
|
+
bareId,
|
|
59
|
+
namespace,
|
|
60
|
+
source: parentDir,
|
|
61
|
+
filePath: hookJsonPath,
|
|
62
|
+
name: parsed.name,
|
|
63
|
+
description: parsed.description,
|
|
64
|
+
hooks: parsed.hooks,
|
|
65
|
+
isBundle: true,
|
|
66
|
+
dirPath: bundleDir,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Load hook entries from a single directory.
|
|
71
|
+
* Scans for both bundle directories (containing hook.json) and standalone .json files.
|
|
72
|
+
*/
|
|
73
|
+
export function loadHooksFromDirectory(directory, namespace) {
|
|
74
|
+
if (!fs.existsSync(directory)) {
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
const dirEntries = fs.readdirSync(directory, { withFileTypes: true });
|
|
78
|
+
const result = [];
|
|
79
|
+
for (const entry of dirEntries) {
|
|
80
|
+
try {
|
|
81
|
+
if (entry.isDirectory()) {
|
|
82
|
+
const hookJsonPath = path.join(directory, entry.name, HOOK_JSON);
|
|
83
|
+
if (fs.existsSync(hookJsonPath)) {
|
|
84
|
+
result.push(loadBundleHook(path.join(directory, entry.name), entry.name, directory, namespace));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else if (entry.isFile() && isJsonFile(entry.name)) {
|
|
88
|
+
const bareId = toId(entry.name);
|
|
89
|
+
const absolutePath = path.join(directory, entry.name);
|
|
90
|
+
result.push(loadSingleFileHook(absolutePath, bareId, directory, namespace));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
95
|
+
throw new Error(`Failed to parse hook "${entry.name}": ${msg}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* List all files in a hook bundle for distribution.
|
|
102
|
+
* Excludes hook.json itself (config is merged into settings.json, not copied).
|
|
103
|
+
*/
|
|
104
|
+
export function listHookBundleFiles(entry) {
|
|
105
|
+
if (!entry.isBundle || !entry.dirPath)
|
|
106
|
+
return [];
|
|
107
|
+
const files = [];
|
|
108
|
+
collectFiles(entry.dirPath, entry.dirPath, files);
|
|
109
|
+
return files;
|
|
110
|
+
}
|
|
111
|
+
function collectFiles(baseDir, currentDir, files) {
|
|
112
|
+
const entries = fs.readdirSync(currentDir, { withFileTypes: true });
|
|
113
|
+
for (const entry of entries) {
|
|
114
|
+
const fullPath = path.join(currentDir, entry.name);
|
|
115
|
+
if (entry.isDirectory()) {
|
|
116
|
+
collectFiles(baseDir, fullPath, files);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
// Include all files (scripts, hook.json, anything else in the bundle)
|
|
120
|
+
files.push({
|
|
121
|
+
sourcePath: fullPath,
|
|
122
|
+
relativePath: path.relative(baseDir, fullPath),
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Load all hooks from the default library, flat sources, and marketplace sources.
|
|
129
|
+
*/
|
|
130
|
+
export function loadHookLibrary() {
|
|
131
|
+
const result = [];
|
|
132
|
+
const defaultDir = ensureHooksDirectory();
|
|
133
|
+
result.push(...loadHooksFromDirectory(defaultDir));
|
|
134
|
+
const { flatSources, marketplaceEntries } = loadEntriesFromSources();
|
|
135
|
+
for (const { namespace, basePath } of flatSources) {
|
|
136
|
+
const hooksDir = path.join(basePath, 'hooks');
|
|
137
|
+
result.push(...loadHooksFromDirectory(hooksDir, namespace));
|
|
138
|
+
}
|
|
139
|
+
result.push(...marketplaceEntries.hooks);
|
|
140
|
+
result.sort((a, b) => a.id.localeCompare(b.id));
|
|
141
|
+
return result;
|
|
142
|
+
}
|
|
143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