@varveai/adit-hooks 0.2.1
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/LICENSE +21 -0
- package/dist/adapters/claude-code.d.ts +9 -0
- package/dist/adapters/claude-code.d.ts.map +1 -0
- package/dist/adapters/claude-code.js +349 -0
- package/dist/adapters/claude-code.js.map +1 -0
- package/dist/adapters/index.d.ts +12 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +29 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/opencode.d.ts +18 -0
- package/dist/adapters/opencode.d.ts.map +1 -0
- package/dist/adapters/opencode.js +961 -0
- package/dist/adapters/opencode.js.map +1 -0
- package/dist/adapters/registry.d.ts +31 -0
- package/dist/adapters/registry.d.ts.map +1 -0
- package/dist/adapters/registry.js +102 -0
- package/dist/adapters/registry.js.map +1 -0
- package/dist/adapters/stub.d.ts +24 -0
- package/dist/adapters/stub.d.ts.map +1 -0
- package/dist/adapters/stub.js +60 -0
- package/dist/adapters/stub.js.map +1 -0
- package/dist/adapters/types.d.ts +107 -0
- package/dist/adapters/types.d.ts.map +1 -0
- package/dist/adapters/types.js +8 -0
- package/dist/adapters/types.js.map +1 -0
- package/dist/common/context.d.ts +19 -0
- package/dist/common/context.d.ts.map +1 -0
- package/dist/common/context.js +94 -0
- package/dist/common/context.js.map +1 -0
- package/dist/handlers/index.d.ts +2 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +2 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/unified.d.ts +13 -0
- package/dist/handlers/unified.d.ts.map +1 -0
- package/dist/handlers/unified.js +304 -0
- package/dist/handlers/unified.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/package.json +37 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 vkenliu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code platform adapter.
|
|
3
|
+
*
|
|
4
|
+
* Maps Claude Code's hook events to ADIT's internal model.
|
|
5
|
+
* Handles installation into .claude/settings.local.json.
|
|
6
|
+
*/
|
|
7
|
+
import type { PlatformAdapter } from "./types.js";
|
|
8
|
+
export declare const claudeCodeAdapter: PlatformAdapter;
|
|
9
|
+
//# sourceMappingURL=claude-code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../src/adapters/claude-code.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EACV,eAAe,EAMhB,MAAM,YAAY,CAAC;AAgGpB,eAAO,MAAM,iBAAiB,EAAE,eAmR/B,CAAC"}
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code platform adapter.
|
|
3
|
+
*
|
|
4
|
+
* Maps Claude Code's hook events to ADIT's internal model.
|
|
5
|
+
* Handles installation into .claude/settings.local.json.
|
|
6
|
+
*/
|
|
7
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync, unlinkSync } from "node:fs";
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
const HOOK_MAPPINGS = [
|
|
10
|
+
{ platformEvent: "UserPromptSubmit", aditHandler: "prompt-submit" },
|
|
11
|
+
{ platformEvent: "Stop", aditHandler: "stop" },
|
|
12
|
+
{ platformEvent: "SessionStart", aditHandler: "session-start" },
|
|
13
|
+
{ platformEvent: "SessionEnd", aditHandler: "session-end" },
|
|
14
|
+
{ platformEvent: "TaskCompleted", aditHandler: "task-completed" },
|
|
15
|
+
{ platformEvent: "Notification", aditHandler: "notification" },
|
|
16
|
+
{ platformEvent: "SubagentStart", aditHandler: "subagent-start" },
|
|
17
|
+
{ platformEvent: "SubagentStop", aditHandler: "subagent-stop" },
|
|
18
|
+
];
|
|
19
|
+
/** Map Claude Code platform events to ADIT hook types (derived from HOOK_MAPPINGS) */
|
|
20
|
+
const PLATFORM_TO_ADIT = Object.fromEntries(HOOK_MAPPINGS.map((m) => [m.platformEvent, m.aditHandler]));
|
|
21
|
+
/** Slash command installed into .claude/commands/ */
|
|
22
|
+
const ADIT_COMMAND = {
|
|
23
|
+
filename: "adit.md",
|
|
24
|
+
content: `---
|
|
25
|
+
name: adit
|
|
26
|
+
description: ADIT — manage cloud project linking and development intents
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
**Requested action:** \`$ARGUMENTS\`
|
|
30
|
+
|
|
31
|
+
## Routing
|
|
32
|
+
|
|
33
|
+
Parse the requested action above and follow the **first matching rule**:
|
|
34
|
+
|
|
35
|
+
1. Action is \`link\` (with optional flags) → run \`npx adit cloud link\` with the appropriate flags mapped from the arguments: \`--force\`, \`--skip-docs\`, \`--skip-commits\`, \`--dry-run\`.
|
|
36
|
+
2. Action is \`intent\` (with optional flags) → run \`npx adit cloud intent\` with the appropriate flags mapped from the arguments: \`--id <value>\`, \`--state <value>\`. Add \`--json\` for structured output.
|
|
37
|
+
3. No action, empty arguments, or unrecognized action → display the **Help** section below as your response. Do not run any commands.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Help
|
|
42
|
+
|
|
43
|
+
Display the following when no valid action is provided:
|
|
44
|
+
|
|
45
|
+
### ADIT Cloud
|
|
46
|
+
|
|
47
|
+
ADIT tracks your AI-assisted development sessions, links project context to the cloud, and helps you manage development intents (plans).
|
|
48
|
+
|
|
49
|
+
**Usage:** \`/adit <action> [options]\`
|
|
50
|
+
|
|
51
|
+
#### \`link\` — Sync project to adit-cloud
|
|
52
|
+
|
|
53
|
+
Uploads git metadata (branches, commits) and project documents for intent planning.
|
|
54
|
+
|
|
55
|
+
| Option | Description |
|
|
56
|
+
|---|---|
|
|
57
|
+
| \`--force\` | Clear cache and re-link from scratch |
|
|
58
|
+
| \`--skip-docs\` | Only upload git metadata, skip documents |
|
|
59
|
+
| \`--skip-commits\` | Skip commit history upload |
|
|
60
|
+
| \`--dry-run\` | Preview what would be uploaded |
|
|
61
|
+
|
|
62
|
+
#### \`intent\` — View development intents
|
|
63
|
+
|
|
64
|
+
Shows intents (development plans) and tasks from the connected adit-cloud project.
|
|
65
|
+
|
|
66
|
+
| Option | Description |
|
|
67
|
+
|---|---|
|
|
68
|
+
| \`--id <id>\` | Show a specific intent by ID |
|
|
69
|
+
| \`--state <state>\` | Filter by state (e.g. \`capture\`, \`execution\`, \`shipped\`) |
|
|
70
|
+
|
|
71
|
+
#### Examples
|
|
72
|
+
|
|
73
|
+
- \`/adit link\` — link the project with defaults
|
|
74
|
+
- \`/adit link --force --skip-docs\` — re-link, git metadata only
|
|
75
|
+
- \`/adit intent\` — list all intents
|
|
76
|
+
- \`/adit intent --state execution\` — show active intents
|
|
77
|
+
|
|
78
|
+
> **Tip:** Not logged in? Run \`npx adit cloud login\` in your terminal first.
|
|
79
|
+
`,
|
|
80
|
+
};
|
|
81
|
+
/** Filenames of old command files to clean up during install */
|
|
82
|
+
const LEGACY_COMMAND_FILES = ["adit-link.md", "adit-intent.md"];
|
|
83
|
+
/** Check if a command string is an ADIT hook (matches both npx and resolved-path formats) */
|
|
84
|
+
function isAditHookCommand(command) {
|
|
85
|
+
return command.includes("adit-hook") || command.includes("hooks/dist/index.js");
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Detect system-injected prompts that Claude Code sends through UserPromptSubmit
|
|
89
|
+
* (e.g. background task completion callbacks wrapped in <task-notification> XML).
|
|
90
|
+
*/
|
|
91
|
+
function isSystemInjectedPrompt(prompt) {
|
|
92
|
+
if (typeof prompt !== "string")
|
|
93
|
+
return false;
|
|
94
|
+
return prompt.trimStart().startsWith("<task-notification>");
|
|
95
|
+
}
|
|
96
|
+
export const claudeCodeAdapter = {
|
|
97
|
+
platform: "claude-code",
|
|
98
|
+
displayName: "Claude Code",
|
|
99
|
+
hookMappings: HOOK_MAPPINGS,
|
|
100
|
+
parseInput(raw, hookType) {
|
|
101
|
+
let aditHookType = PLATFORM_TO_ADIT[hookType] ?? hookType;
|
|
102
|
+
const cwd = raw.cwd ?? process.cwd();
|
|
103
|
+
// Claude Code sends <task-notification> XML blocks through UserPromptSubmit
|
|
104
|
+
// when background tasks complete. Reclassify these as notification events
|
|
105
|
+
// so they don't pollute the user prompt timeline.
|
|
106
|
+
const isReclassifiedNotification = aditHookType === "prompt-submit" && isSystemInjectedPrompt(raw.prompt);
|
|
107
|
+
if (isReclassifiedNotification) {
|
|
108
|
+
aditHookType = "notification";
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
cwd,
|
|
112
|
+
hookType: aditHookType,
|
|
113
|
+
platformCli: "claude-code",
|
|
114
|
+
platformSessionId: raw.session_id,
|
|
115
|
+
transcriptPath: raw.transcript_path,
|
|
116
|
+
// Prompt
|
|
117
|
+
prompt: isReclassifiedNotification ? undefined : raw.prompt,
|
|
118
|
+
// Tool use fields (available from SubagentStop, etc.)
|
|
119
|
+
toolName: raw.tool_name,
|
|
120
|
+
toolInput: raw.tool_input,
|
|
121
|
+
toolOutput: raw.tool_output,
|
|
122
|
+
// Stop
|
|
123
|
+
stopReason: raw.stop_reason,
|
|
124
|
+
lastAssistantMessage: raw.last_assistant_message,
|
|
125
|
+
stopHookActive: raw.stop_hook_active,
|
|
126
|
+
// Task completed
|
|
127
|
+
taskId: raw.task_id,
|
|
128
|
+
taskSubject: raw.task_subject,
|
|
129
|
+
taskDescription: raw.task_description,
|
|
130
|
+
teammateName: raw.teammate_name,
|
|
131
|
+
teamName: raw.team_name,
|
|
132
|
+
// Notification
|
|
133
|
+
notificationMessage: isReclassifiedNotification
|
|
134
|
+
? raw.prompt
|
|
135
|
+
: raw.message,
|
|
136
|
+
notificationTitle: isReclassifiedNotification
|
|
137
|
+
? "task-notification"
|
|
138
|
+
: raw.title,
|
|
139
|
+
notificationType: isReclassifiedNotification
|
|
140
|
+
? "task-notification"
|
|
141
|
+
: raw.notification_type,
|
|
142
|
+
// Subagent
|
|
143
|
+
agentId: raw.agent_id,
|
|
144
|
+
agentType: raw.agent_type,
|
|
145
|
+
agentTranscriptPath: raw.agent_transcript_path,
|
|
146
|
+
// Common metadata (present in all events)
|
|
147
|
+
permissionMode: raw.permission_mode,
|
|
148
|
+
model: raw.model,
|
|
149
|
+
// Session lifecycle
|
|
150
|
+
sessionSource: raw.source,
|
|
151
|
+
sessionEndReason: raw.reason,
|
|
152
|
+
rawPlatformData: raw,
|
|
153
|
+
};
|
|
154
|
+
},
|
|
155
|
+
generateHookConfig(aditBinaryPath) {
|
|
156
|
+
const makeHookEntry = (command) => [
|
|
157
|
+
{ hooks: [{ type: "command", command: `CLAUDE_CODE=1 ${command}`, timeout: 10000 }] },
|
|
158
|
+
];
|
|
159
|
+
return {
|
|
160
|
+
configPath: ".claude/settings.local.json",
|
|
161
|
+
content: {
|
|
162
|
+
hooks: {
|
|
163
|
+
UserPromptSubmit: makeHookEntry(`${aditBinaryPath} prompt-submit`),
|
|
164
|
+
Stop: makeHookEntry(`${aditBinaryPath} stop`),
|
|
165
|
+
SessionStart: makeHookEntry(`${aditBinaryPath} session-start`),
|
|
166
|
+
SessionEnd: makeHookEntry(`${aditBinaryPath} session-end`),
|
|
167
|
+
TaskCompleted: makeHookEntry(`${aditBinaryPath} task-completed`),
|
|
168
|
+
Notification: makeHookEntry(`${aditBinaryPath} notification`),
|
|
169
|
+
SubagentStart: makeHookEntry(`${aditBinaryPath} subagent-start`),
|
|
170
|
+
SubagentStop: makeHookEntry(`${aditBinaryPath} subagent-stop`),
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
},
|
|
175
|
+
async validateInstallation(projectRoot) {
|
|
176
|
+
const checks = [];
|
|
177
|
+
// Check .claude directory exists
|
|
178
|
+
const claudeDir = join(projectRoot, ".claude");
|
|
179
|
+
const claudeDirExists = existsSync(claudeDir);
|
|
180
|
+
checks.push({
|
|
181
|
+
name: ".claude directory",
|
|
182
|
+
ok: claudeDirExists,
|
|
183
|
+
detail: claudeDirExists ? claudeDir : "Not found",
|
|
184
|
+
});
|
|
185
|
+
// Check settings file for hook configuration
|
|
186
|
+
const settingsFiles = [
|
|
187
|
+
join(projectRoot, ".claude", "settings.local.json"),
|
|
188
|
+
join(projectRoot, ".claude", "settings.json"),
|
|
189
|
+
];
|
|
190
|
+
let hooksFound = false;
|
|
191
|
+
let hooksDetail = "No hook configuration found";
|
|
192
|
+
const requiredHooks = HOOK_MAPPINGS.map((m) => m.platformEvent);
|
|
193
|
+
const missingHooks = [];
|
|
194
|
+
for (const settingsPath of settingsFiles) {
|
|
195
|
+
if (!existsSync(settingsPath))
|
|
196
|
+
continue;
|
|
197
|
+
try {
|
|
198
|
+
const settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
|
|
199
|
+
if (!settings.hooks)
|
|
200
|
+
continue;
|
|
201
|
+
for (const hookName of requiredHooks) {
|
|
202
|
+
const entries = settings.hooks[hookName];
|
|
203
|
+
if (!Array.isArray(entries)) {
|
|
204
|
+
missingHooks.push(hookName);
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
const hasAdit = entries.some((entry) => {
|
|
208
|
+
if (typeof entry.command === "string" && isAditHookCommand(entry.command))
|
|
209
|
+
return true;
|
|
210
|
+
if (Array.isArray(entry.hooks)) {
|
|
211
|
+
return entry.hooks.some((h) => typeof h.command === "string" && isAditHookCommand(h.command));
|
|
212
|
+
}
|
|
213
|
+
return false;
|
|
214
|
+
});
|
|
215
|
+
if (!hasAdit)
|
|
216
|
+
missingHooks.push(hookName);
|
|
217
|
+
}
|
|
218
|
+
hooksFound = missingHooks.length === 0;
|
|
219
|
+
hooksDetail = hooksFound
|
|
220
|
+
? `All hooks registered in ${settingsPath}`
|
|
221
|
+
: `Missing hooks: ${missingHooks.join(", ")}`;
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
catch {
|
|
225
|
+
hooksDetail = `Failed to parse ${settingsPath}`;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
checks.push({
|
|
229
|
+
name: "Hook configuration",
|
|
230
|
+
ok: hooksFound,
|
|
231
|
+
detail: hooksDetail,
|
|
232
|
+
});
|
|
233
|
+
// Check slash command file
|
|
234
|
+
const cmdPath = join(projectRoot, ".claude", "commands", ADIT_COMMAND.filename);
|
|
235
|
+
const cmdExists = existsSync(cmdPath);
|
|
236
|
+
checks.push({
|
|
237
|
+
name: "Command /adit",
|
|
238
|
+
ok: cmdExists,
|
|
239
|
+
detail: cmdExists ? cmdPath : "Not found",
|
|
240
|
+
});
|
|
241
|
+
return {
|
|
242
|
+
valid: checks.every((c) => c.ok),
|
|
243
|
+
checks,
|
|
244
|
+
};
|
|
245
|
+
},
|
|
246
|
+
async installHooks(projectRoot, aditBinaryPath) {
|
|
247
|
+
const claudeDir = join(projectRoot, ".claude");
|
|
248
|
+
if (!existsSync(claudeDir)) {
|
|
249
|
+
mkdirSync(claudeDir, { recursive: true });
|
|
250
|
+
}
|
|
251
|
+
const settingsPath = join(claudeDir, "settings.local.json");
|
|
252
|
+
let settings = {};
|
|
253
|
+
if (existsSync(settingsPath)) {
|
|
254
|
+
try {
|
|
255
|
+
settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
|
|
256
|
+
}
|
|
257
|
+
catch {
|
|
258
|
+
// Start fresh if settings are invalid
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
const hookConfig = this.generateHookConfig(aditBinaryPath);
|
|
262
|
+
const existingHooks = settings.hooks ?? {};
|
|
263
|
+
const newHooks = hookConfig.content.hooks;
|
|
264
|
+
// Merge hook entries per event key: preserve other tools' hooks,
|
|
265
|
+
// remove stale ADIT entries, then append new ADIT entries.
|
|
266
|
+
const mergedHooks = { ...existingHooks };
|
|
267
|
+
for (const [eventKey, aditEntries] of Object.entries(newHooks)) {
|
|
268
|
+
const existing = Array.isArray(mergedHooks[eventKey]) ? mergedHooks[eventKey] : [];
|
|
269
|
+
// Remove stale ADIT entries (same logic as uninstallHooks)
|
|
270
|
+
const nonAditEntries = existing.filter((raw) => {
|
|
271
|
+
const entry = raw;
|
|
272
|
+
if (typeof entry.command === "string" && isAditHookCommand(entry.command))
|
|
273
|
+
return false;
|
|
274
|
+
if (Array.isArray(entry.hooks)) {
|
|
275
|
+
return !entry.hooks.some((h) => typeof h.command === "string" && isAditHookCommand(h.command));
|
|
276
|
+
}
|
|
277
|
+
return true;
|
|
278
|
+
});
|
|
279
|
+
// Append new ADIT entries after other tools' hooks
|
|
280
|
+
mergedHooks[eventKey] = [...nonAditEntries, ...aditEntries];
|
|
281
|
+
}
|
|
282
|
+
settings.hooks = mergedHooks;
|
|
283
|
+
writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
|
|
284
|
+
// Install slash command
|
|
285
|
+
const commandsDir = join(claudeDir, "commands");
|
|
286
|
+
mkdirSync(commandsDir, { recursive: true });
|
|
287
|
+
writeFileSync(join(commandsDir, ADIT_COMMAND.filename), ADIT_COMMAND.content);
|
|
288
|
+
// Clean up legacy command files from previous versions
|
|
289
|
+
for (const legacy of LEGACY_COMMAND_FILES) {
|
|
290
|
+
try {
|
|
291
|
+
unlinkSync(join(commandsDir, legacy));
|
|
292
|
+
}
|
|
293
|
+
catch { /* best-effort */ }
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
getResumeCommand(_projectRoot) {
|
|
297
|
+
return "claude --continue";
|
|
298
|
+
},
|
|
299
|
+
async uninstallHooks(projectRoot) {
|
|
300
|
+
const settingsPath = join(projectRoot, ".claude", "settings.local.json");
|
|
301
|
+
if (!existsSync(settingsPath))
|
|
302
|
+
return;
|
|
303
|
+
try {
|
|
304
|
+
const settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
|
|
305
|
+
if (!settings.hooks)
|
|
306
|
+
return;
|
|
307
|
+
// Remove ADIT hook entries
|
|
308
|
+
for (const hookName of Object.keys(settings.hooks)) {
|
|
309
|
+
const entries = settings.hooks[hookName];
|
|
310
|
+
if (!Array.isArray(entries))
|
|
311
|
+
continue;
|
|
312
|
+
settings.hooks[hookName] = entries.filter((entry) => {
|
|
313
|
+
if (typeof entry.command === "string" && isAditHookCommand(entry.command))
|
|
314
|
+
return false;
|
|
315
|
+
if (Array.isArray(entry.hooks)) {
|
|
316
|
+
return !entry.hooks.some((h) => typeof h.command === "string" && isAditHookCommand(h.command));
|
|
317
|
+
}
|
|
318
|
+
return true;
|
|
319
|
+
});
|
|
320
|
+
// Clean up empty arrays
|
|
321
|
+
if (settings.hooks[hookName].length === 0) {
|
|
322
|
+
delete settings.hooks[hookName];
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
// Clean up empty hooks object
|
|
326
|
+
if (Object.keys(settings.hooks).length === 0) {
|
|
327
|
+
delete settings.hooks;
|
|
328
|
+
}
|
|
329
|
+
writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
|
|
330
|
+
}
|
|
331
|
+
catch {
|
|
332
|
+
// Ignore parse errors
|
|
333
|
+
}
|
|
334
|
+
// Remove slash command
|
|
335
|
+
const commandsDir = join(projectRoot, ".claude", "commands");
|
|
336
|
+
try {
|
|
337
|
+
unlinkSync(join(commandsDir, ADIT_COMMAND.filename));
|
|
338
|
+
}
|
|
339
|
+
catch { /* best-effort */ }
|
|
340
|
+
// Clean up legacy command files
|
|
341
|
+
for (const legacy of LEGACY_COMMAND_FILES) {
|
|
342
|
+
try {
|
|
343
|
+
unlinkSync(join(commandsDir, legacy));
|
|
344
|
+
}
|
|
345
|
+
catch { /* best-effort */ }
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
};
|
|
349
|
+
//# sourceMappingURL=claude-code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-code.js","sourceRoot":"","sources":["../../src/adapters/claude-code.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACzF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAWjC,MAAM,aAAa,GAAkB;IACnC,EAAE,aAAa,EAAE,kBAAkB,EAAE,WAAW,EAAE,eAAe,EAAE;IACnE,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE;IAC9C,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,eAAe,EAAE;IAC/D,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE;IAC3D,EAAE,aAAa,EAAE,eAAe,E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AC,CAAC;YAAC,CAAC;YAAC,MAAM,CAAC,CAAC,iBAAiB,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type { PlatformAdapter, HookMapping, NormalizedHookInput, PlatformHookConfig, ValidationResult, ValidationCheck, AditHookType, } from "./types.js";
|
|
2
|
+
export { claudeCodeAdapter } from "./claude-code.js";
|
|
3
|
+
export { opencodeAdapter } from "./opencode.js";
|
|
4
|
+
export { createStubAdapter, cursorAdapter, copilotAdapter, codexAdapter, otherAdapter } from "./stub.js";
|
|
5
|
+
export { getAdapter, listAdapters, registerAdapter, detectPlatform, detectPlatforms } from "./registry.js";
|
|
6
|
+
/**
|
|
7
|
+
* Resolve the absolute path to the adit-hook binary for reliable invocation.
|
|
8
|
+
* Navigates from this module's location to the entry point (dist/index.js),
|
|
9
|
+
* avoiding npx which can hang when the package isn't found locally.
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveAditHookBinary(): string;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAIA,YAAY,EACV,eAAe,EACf,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,YAAY,GACb,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzG,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAE3G;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAc9C"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { fileURLToPath } from "node:url";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
|
+
export { claudeCodeAdapter } from "./claude-code.js";
|
|
5
|
+
export { opencodeAdapter } from "./opencode.js";
|
|
6
|
+
export { createStubAdapter, cursorAdapter, copilotAdapter, codexAdapter, otherAdapter } from "./stub.js";
|
|
7
|
+
export { getAdapter, listAdapters, registerAdapter, detectPlatform, detectPlatforms } from "./registry.js";
|
|
8
|
+
/**
|
|
9
|
+
* Resolve the absolute path to the adit-hook binary for reliable invocation.
|
|
10
|
+
* Navigates from this module's location to the entry point (dist/index.js),
|
|
11
|
+
* avoiding npx which can hang when the package isn't found locally.
|
|
12
|
+
*/
|
|
13
|
+
export function resolveAditHookBinary() {
|
|
14
|
+
try {
|
|
15
|
+
// This module lives at <pkg>/dist/adapters/index.js (or src/ in dev).
|
|
16
|
+
// The binary entry point is one directory up at <pkg>/dist/index.js.
|
|
17
|
+
const thisDir = dirname(fileURLToPath(import.meta.url));
|
|
18
|
+
const binaryPath = join(thisDir, "..", "index.js");
|
|
19
|
+
if (existsSync(binaryPath)) {
|
|
20
|
+
return `node "${binaryPath}"`;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
/* fall through */
|
|
25
|
+
}
|
|
26
|
+
// Fallback: when installed via npm globally, adit-hook is on PATH
|
|
27
|
+
return "adit-hook";
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAYrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzG,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAE3G;;;;GAIG;AACH,MAAM,UAAU,qBAAqB;IACnC,IAAI,CAAC;QACH,sEAAsE;QACtE,qEAAqE;QACrE,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACxD,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;QACnD,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC3B,OAAO,SAAS,UAAU,GAAG,CAAC;QAChC,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,kBAAkB;IACpB,CAAC;IACD,kEAAkE;IAClE,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenCode platform adapter.
|
|
3
|
+
*
|
|
4
|
+
* Maps OpenCode's plugin hook events to ADIT's internal model.
|
|
5
|
+
* Handles installation by generating a plugin file in .opencode/plugins/.
|
|
6
|
+
*
|
|
7
|
+
* OpenCode uses a plugin system (not config-based hooks like Claude Code).
|
|
8
|
+
* Plugins are JS/TS modules placed in .opencode/plugins/ that export
|
|
9
|
+
* hook functions. The generated plugin listens for OpenCode events and
|
|
10
|
+
* spawns `adit-hook` via child process to keep ADIT fail-open.
|
|
11
|
+
*
|
|
12
|
+
* OpenCode stores session data in SQLite (not a single transcript JSONL
|
|
13
|
+
* like Claude Code), so transcript upload is not applicable here.
|
|
14
|
+
* All hook events are synced to the ADIT server directly.
|
|
15
|
+
*/
|
|
16
|
+
import type { PlatformAdapter } from "./types.js";
|
|
17
|
+
export declare const opencodeAdapter: PlatformAdapter;
|
|
18
|
+
//# sourceMappingURL=opencode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opencode.d.ts","sourceRoot":"","sources":["../../src/adapters/opencode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,KAAK,EACV,eAAe,EAMhB,MAAM,YAAY,CAAC;AA4xBpB,eAAO,MAAM,eAAe,EAAE,eAoK7B,CAAC"}
|