@varveai/adit-cli 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/commands/cloud.d.ts +51 -0
- package/dist/commands/cloud.d.ts.map +1 -0
- package/dist/commands/cloud.js +430 -0
- package/dist/commands/cloud.js.map +1 -0
- package/dist/commands/config.d.ts +8 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +30 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/db.d.ts +17 -0
- package/dist/commands/db.d.ts.map +1 -0
- package/dist/commands/db.js +48 -0
- package/dist/commands/db.js.map +1 -0
- package/dist/commands/diff.d.ts +30 -0
- package/dist/commands/diff.d.ts.map +1 -0
- package/dist/commands/diff.js +265 -0
- package/dist/commands/diff.js.map +1 -0
- package/dist/commands/doctor.d.ts +15 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +265 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/export.d.ts +24 -0
- package/dist/commands/export.d.ts.map +1 -0
- package/dist/commands/export.js +219 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/init.d.ts +12 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +137 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/list.d.ts +20 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +110 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/perf.d.ts +19 -0
- package/dist/commands/perf.d.ts.map +1 -0
- package/dist/commands/perf.js +102 -0
- package/dist/commands/perf.js.map +1 -0
- package/dist/commands/plugin.d.ts +28 -0
- package/dist/commands/plugin.d.ts.map +1 -0
- package/dist/commands/plugin.js +516 -0
- package/dist/commands/plugin.js.map +1 -0
- package/dist/commands/project-link.d.ts +16 -0
- package/dist/commands/project-link.d.ts.map +1 -0
- package/dist/commands/project-link.js +143 -0
- package/dist/commands/project-link.js.map +1 -0
- package/dist/commands/resume.d.ts +28 -0
- package/dist/commands/resume.d.ts.map +1 -0
- package/dist/commands/resume.js +229 -0
- package/dist/commands/resume.js.map +1 -0
- package/dist/commands/revert.d.ts +30 -0
- package/dist/commands/revert.d.ts.map +1 -0
- package/dist/commands/revert.js +271 -0
- package/dist/commands/revert.js.map +1 -0
- package/dist/commands/search.d.ts +16 -0
- package/dist/commands/search.d.ts.map +1 -0
- package/dist/commands/search.js +72 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/commands/self-update.d.ts +12 -0
- package/dist/commands/self-update.d.ts.map +1 -0
- package/dist/commands/self-update.js +161 -0
- package/dist/commands/self-update.js.map +1 -0
- package/dist/commands/show.d.ts +5 -0
- package/dist/commands/show.d.ts.map +1 -0
- package/dist/commands/show.js +86 -0
- package/dist/commands/show.js.map +1 -0
- package/dist/commands/status.d.ts +11 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +237 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/task.d.ts +18 -0
- package/dist/commands/task.d.ts.map +1 -0
- package/dist/commands/task.js +131 -0
- package/dist/commands/task.js.map +1 -0
- package/dist/commands/transcript.d.ts +40 -0
- package/dist/commands/transcript.d.ts.map +1 -0
- package/dist/commands/transcript.js +275 -0
- package/dist/commands/transcript.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +385 -0
- package/dist/index.js.map +1 -0
- package/dist/tui/App.d.ts +8 -0
- package/dist/tui/App.d.ts.map +1 -0
- package/dist/tui/App.js +132 -0
- package/dist/tui/App.js.map +1 -0
- package/dist/tui/components/DiffView.d.ts +11 -0
- package/dist/tui/components/DiffView.d.ts.map +1 -0
- package/dist/tui/components/DiffView.js +29 -0
- package/dist/tui/components/DiffView.js.map +1 -0
- package/dist/tui/components/EventDetail.d.ts +11 -0
- package/dist/tui/components/EventDetail.d.ts.map +1 -0
- package/dist/tui/components/EventDetail.js +36 -0
- package/dist/tui/components/EventDetail.js.map +1 -0
- package/dist/tui/components/EventList.d.ts +15 -0
- package/dist/tui/components/EventList.d.ts.map +1 -0
- package/dist/tui/components/EventList.js +77 -0
- package/dist/tui/components/EventList.js.map +1 -0
- package/dist/tui/components/FilterBar.d.ts +12 -0
- package/dist/tui/components/FilterBar.d.ts.map +1 -0
- package/dist/tui/components/FilterBar.js +20 -0
- package/dist/tui/components/FilterBar.js.map +1 -0
- package/dist/tui/components/StatusBar.d.ts +16 -0
- package/dist/tui/components/StatusBar.d.ts.map +1 -0
- package/dist/tui/components/StatusBar.js +13 -0
- package/dist/tui/components/StatusBar.js.map +1 -0
- package/dist/tui/hooks/useKeyboard.d.ts +22 -0
- package/dist/tui/hooks/useKeyboard.d.ts.map +1 -0
- package/dist/tui/hooks/useKeyboard.js +64 -0
- package/dist/tui/hooks/useKeyboard.js.map +1 -0
- package/dist/tui/hooks/useTimeline.d.ts +31 -0
- package/dist/tui/hooks/useTimeline.d.ts.map +1 -0
- package/dist/tui/hooks/useTimeline.js +136 -0
- package/dist/tui/hooks/useTimeline.js.map +1 -0
- package/dist/tui/index.d.ts +5 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +10 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/screens/DiffScreen.d.ts +12 -0
- package/dist/tui/screens/DiffScreen.d.ts.map +1 -0
- package/dist/tui/screens/DiffScreen.js +25 -0
- package/dist/tui/screens/DiffScreen.js.map +1 -0
- package/dist/tui/screens/EnvScreen.d.ts +11 -0
- package/dist/tui/screens/EnvScreen.d.ts.map +1 -0
- package/dist/tui/screens/EnvScreen.js +25 -0
- package/dist/tui/screens/EnvScreen.js.map +1 -0
- package/dist/tui/screens/SearchScreen.d.ts +13 -0
- package/dist/tui/screens/SearchScreen.d.ts.map +1 -0
- package/dist/tui/screens/SearchScreen.js +56 -0
- package/dist/tui/screens/SearchScreen.js.map +1 -0
- package/dist/tui/screens/TimelineScreen.d.ts +19 -0
- package/dist/tui/screens/TimelineScreen.d.ts.map +1 -0
- package/dist/tui/screens/TimelineScreen.js +10 -0
- package/dist/tui/screens/TimelineScreen.js.map +1 -0
- package/dist/utils/format.d.ts +23 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/format.js +65 -0
- package/dist/utils/format.js.map +1 -0
- package/dist/utils/summary.d.ts +26 -0
- package/dist/utils/summary.d.ts.map +1 -0
- package/dist/utils/summary.js +87 -0
- package/dist/utils/summary.js.map +1 -0
- package/dist/version.d.ts +8 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +11 -0
- package/dist/version.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `adit perf` — Performance stats for time-sensitive operations.
|
|
3
|
+
*
|
|
4
|
+
* Reads daily JSONL perf logs from .adit/perf-logs/ and generates
|
|
5
|
+
* an aggregated stats report showing call counts, timing distributions,
|
|
6
|
+
* and failure rates.
|
|
7
|
+
*/
|
|
8
|
+
import { loadConfig, readPerfLogs, generatePerfStats, clearPerfLogs, } from "@varveai/adit-core";
|
|
9
|
+
/** Show performance stats report */
|
|
10
|
+
export function perfCommand(opts) {
|
|
11
|
+
const config = loadConfig();
|
|
12
|
+
const entries = readPerfLogs(config.dataDir, opts?.from, opts?.to);
|
|
13
|
+
// Filter by category if specified
|
|
14
|
+
const filtered = opts?.category
|
|
15
|
+
? entries.filter((e) => e.category === opts.category)
|
|
16
|
+
: entries;
|
|
17
|
+
const report = generatePerfStats(filtered);
|
|
18
|
+
if (opts?.json) {
|
|
19
|
+
console.log(JSON.stringify(report, null, 2));
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
printReport(report);
|
|
23
|
+
}
|
|
24
|
+
/** Clear all performance logs */
|
|
25
|
+
export function perfClearCommand(opts) {
|
|
26
|
+
const config = loadConfig();
|
|
27
|
+
const deleted = clearPerfLogs(config.dataDir);
|
|
28
|
+
if (opts?.json) {
|
|
29
|
+
console.log(JSON.stringify({ cleared: deleted }));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (deleted === 0) {
|
|
33
|
+
console.log("No performance logs to clear.");
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
console.log(`Cleared ${deleted} log file${deleted === 1 ? "" : "s"}.`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/** Print a formatted stats report to the terminal */
|
|
40
|
+
function printReport(report) {
|
|
41
|
+
if (report.totalEntries === 0) {
|
|
42
|
+
console.log("No performance data recorded yet.");
|
|
43
|
+
console.log("Performance logs are automatically captured during hook events.");
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
console.log("ADIT Performance Report");
|
|
47
|
+
console.log("=======================");
|
|
48
|
+
console.log();
|
|
49
|
+
console.log(`Period: ${report.fromDate} to ${report.toDate}`);
|
|
50
|
+
console.log(`Total calls: ${report.totalEntries}`);
|
|
51
|
+
console.log();
|
|
52
|
+
// Table header
|
|
53
|
+
const colCategory = 12;
|
|
54
|
+
const colOperation = 24;
|
|
55
|
+
const colCount = 7;
|
|
56
|
+
const colAvg = 10;
|
|
57
|
+
const colMin = 10;
|
|
58
|
+
const colMax = 10;
|
|
59
|
+
const colP95 = 10;
|
|
60
|
+
const colStddev = 10;
|
|
61
|
+
const colFail = 6;
|
|
62
|
+
const header = [
|
|
63
|
+
padRight("Category", colCategory),
|
|
64
|
+
padRight("Operation", colOperation),
|
|
65
|
+
padLeft("Count", colCount),
|
|
66
|
+
padLeft("Avg (ms)", colAvg),
|
|
67
|
+
padLeft("Min (ms)", colMin),
|
|
68
|
+
padLeft("Max (ms)", colMax),
|
|
69
|
+
padLeft("P95 (ms)", colP95),
|
|
70
|
+
padLeft("StdDev", colStddev),
|
|
71
|
+
padLeft("Fail", colFail),
|
|
72
|
+
].join(" ");
|
|
73
|
+
console.log(header);
|
|
74
|
+
console.log("-".repeat(header.length));
|
|
75
|
+
for (const op of report.operations) {
|
|
76
|
+
const row = [
|
|
77
|
+
padRight(op.category, colCategory),
|
|
78
|
+
padRight(op.operation, colOperation),
|
|
79
|
+
padLeft(String(op.count), colCount),
|
|
80
|
+
padLeft(formatMs(op.avgMs), colAvg),
|
|
81
|
+
padLeft(formatMs(op.minMs), colMin),
|
|
82
|
+
padLeft(formatMs(op.maxMs), colMax),
|
|
83
|
+
padLeft(formatMs(op.p95Ms), colP95),
|
|
84
|
+
padLeft(formatMs(op.stddevMs), colStddev),
|
|
85
|
+
padLeft(op.failures > 0 ? String(op.failures) : "-", colFail),
|
|
86
|
+
].join(" ");
|
|
87
|
+
console.log(row);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function padRight(str, len) {
|
|
91
|
+
return str.length >= len ? str.substring(0, len) : str + " ".repeat(len - str.length);
|
|
92
|
+
}
|
|
93
|
+
function padLeft(str, len) {
|
|
94
|
+
return str.length >= len ? str : " ".repeat(len - str.length) + str;
|
|
95
|
+
}
|
|
96
|
+
function formatMs(ms) {
|
|
97
|
+
if (ms >= 1000) {
|
|
98
|
+
return (ms / 1000).toFixed(2) + "s";
|
|
99
|
+
}
|
|
100
|
+
return ms.toFixed(2);
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=perf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"perf.js","sourceRoot":"","sources":["../../src/commands/perf.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,aAAa,GAEd,MAAM,oBAAoB,CAAC;AAE5B,oCAAoC;AACpC,MAAM,UAAU,WAAW,CAAC,IAK3B;IACC,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;IAEnE,kCAAkC;IAClC,MAAM,QAAQ,GAAG,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AACxF,CAAC;AAED,SAAS,OAAO,CAAC,GAAW,EAAE,GAAW;IACvC,OAAO,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC;AACtE,CAAC;AAED,SAAS,QAAQ,CAAC,EAAU;IAC1B,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC;QACf,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;IACtC,CAAC;IACD,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `adit plugin` — Platform plugin management commands.
|
|
3
|
+
*
|
|
4
|
+
* Install, uninstall, list, and validate ADIT integrations
|
|
5
|
+
* for different AI platforms. All commands auto-detect which
|
|
6
|
+
* platforms are present in the project (by checking for config
|
|
7
|
+
* directories like .claude/ and .opencode/) when no explicit
|
|
8
|
+
* platform argument is given.
|
|
9
|
+
*/
|
|
10
|
+
/** adit plugin install [platform] */
|
|
11
|
+
export declare function pluginInstallCommand(platformArg?: string, opts?: {
|
|
12
|
+
json?: boolean;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
/** adit plugin uninstall [platform] */
|
|
15
|
+
export declare function pluginUninstallCommand(platformArg?: string, opts?: {
|
|
16
|
+
json?: boolean;
|
|
17
|
+
all?: boolean;
|
|
18
|
+
clean?: boolean;
|
|
19
|
+
}): Promise<void>;
|
|
20
|
+
/** adit plugin list */
|
|
21
|
+
export declare function pluginListCommand(opts?: {
|
|
22
|
+
json?: boolean;
|
|
23
|
+
}): Promise<void>;
|
|
24
|
+
/** adit plugin validate [platform] */
|
|
25
|
+
export declare function pluginValidateCommand(platformArg?: string, opts?: {
|
|
26
|
+
json?: boolean;
|
|
27
|
+
}): Promise<void>;
|
|
28
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/commands/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAsBH,qCAAqC;AACrC,wBAAsB,oBAAoB,CACxC,WAAW,CAAC,EAAE,MAAM,EACpB,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GACxB,OAAO,CAAC,IAAI,CAAC,CAyGf;AA8CD,uCAAuC;AACvC,wBAAsB,sBAAsB,CAC1C,WAAW,CAAC,EAAE,MAAM,EACpB,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GACxD,OAAO,CAAC,IAAI,CAAC,CAiHf;AA+GD,uBAAuB;AACvB,wBAAsB,iBAAiB,CACrC,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GACxB,OAAO,CAAC,IAAI,CAAC,CA8Df;AAED,sCAAsC;AACtC,wBAAsB,qBAAqB,CACzC,WAAW,CAAC,EAAE,MAAM,EACpB,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GACxB,OAAO,CAAC,IAAI,CAAC,CAkEf"}
|
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `adit plugin` — Platform plugin management commands.
|
|
3
|
+
*
|
|
4
|
+
* Install, uninstall, list, and validate ADIT integrations
|
|
5
|
+
* for different AI platforms. All commands auto-detect which
|
|
6
|
+
* platforms are present in the project (by checking for config
|
|
7
|
+
* directories like .claude/ and .opencode/) when no explicit
|
|
8
|
+
* platform argument is given.
|
|
9
|
+
*/
|
|
10
|
+
import { existsSync, rmSync } from "node:fs";
|
|
11
|
+
import { loadConfig, findGitRoot } from "@varveai/adit-core";
|
|
12
|
+
import { getAdapter, listAdapters, detectPlatforms, resolveAditHookBinary, } from "@varveai/adit-hooks/adapters";
|
|
13
|
+
/**
|
|
14
|
+
* Resolve the project root from config, preferring git root for
|
|
15
|
+
* directory-based platform detection.
|
|
16
|
+
*/
|
|
17
|
+
function resolveProjectRoot() {
|
|
18
|
+
const config = loadConfig();
|
|
19
|
+
return findGitRoot(config.projectRoot) ?? config.projectRoot;
|
|
20
|
+
}
|
|
21
|
+
/** adit plugin install [platform] */
|
|
22
|
+
export async function pluginInstallCommand(platformArg, opts) {
|
|
23
|
+
const config = loadConfig();
|
|
24
|
+
const projectRoot = resolveProjectRoot();
|
|
25
|
+
const aditBinaryPath = resolveAditHookBinary();
|
|
26
|
+
// If explicit platform, install just that one
|
|
27
|
+
if (platformArg) {
|
|
28
|
+
const platform = platformArg;
|
|
29
|
+
const adapter = getAdapterSafe(platform);
|
|
30
|
+
if (!adapter)
|
|
31
|
+
return;
|
|
32
|
+
await installSinglePlatform(adapter, config.projectRoot, aditBinaryPath, opts);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
// Auto-detect all platforms present in the project
|
|
36
|
+
const platforms = detectPlatforms(projectRoot);
|
|
37
|
+
if (platforms.length === 0) {
|
|
38
|
+
if (opts?.json) {
|
|
39
|
+
console.log(JSON.stringify({
|
|
40
|
+
ok: false,
|
|
41
|
+
action: "install",
|
|
42
|
+
error: "No AI platforms detected",
|
|
43
|
+
platforms: [],
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
console.log();
|
|
48
|
+
console.log(" No AI platforms detected in this project.");
|
|
49
|
+
console.log();
|
|
50
|
+
console.log(" ADIT looks for platform config directories:");
|
|
51
|
+
console.log(" Claude Code → .claude/");
|
|
52
|
+
console.log(" OpenCode → .opencode/ or opencode.json");
|
|
53
|
+
console.log();
|
|
54
|
+
console.log(" To install for a specific platform:");
|
|
55
|
+
console.log(" adit plugin install claude-code");
|
|
56
|
+
console.log(" adit plugin install opencode");
|
|
57
|
+
console.log();
|
|
58
|
+
}
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
// Install for all detected platforms
|
|
62
|
+
const installed = [];
|
|
63
|
+
const errors = [];
|
|
64
|
+
if (!opts?.json) {
|
|
65
|
+
console.log();
|
|
66
|
+
console.log(` Installing ADIT hooks (${platforms.length} platform${platforms.length > 1 ? "s" : ""} detected)`);
|
|
67
|
+
console.log();
|
|
68
|
+
}
|
|
69
|
+
for (const platform of platforms) {
|
|
70
|
+
const adapter = getAdapterSafe(platform);
|
|
71
|
+
if (!adapter)
|
|
72
|
+
continue;
|
|
73
|
+
if (adapter.hookMappings.length === 0) {
|
|
74
|
+
if (!opts?.json) {
|
|
75
|
+
console.log(` [-] ${adapter.displayName} — detected but not yet supported`);
|
|
76
|
+
}
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
await adapter.installHooks(config.projectRoot, aditBinaryPath);
|
|
81
|
+
installed.push(adapter.displayName);
|
|
82
|
+
if (!opts?.json) {
|
|
83
|
+
console.log(` [+] ${adapter.displayName} — ${adapter.hookMappings.length} hook events`);
|
|
84
|
+
// Show validation checks
|
|
85
|
+
const result = await adapter.validateInstallation(config.projectRoot);
|
|
86
|
+
for (const check of result.checks) {
|
|
87
|
+
const symbol = check.ok ? "+" : "x";
|
|
88
|
+
console.log(` [${symbol}] ${check.name}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
errors.push(`${adapter.displayName}: ${err.message}`);
|
|
94
|
+
if (!opts?.json) {
|
|
95
|
+
console.log(` [x] ${adapter.displayName} — ${err.message}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (opts?.json) {
|
|
100
|
+
console.log(JSON.stringify({
|
|
101
|
+
ok: errors.length === 0 && installed.length > 0,
|
|
102
|
+
action: "install",
|
|
103
|
+
installed,
|
|
104
|
+
errors: errors.length > 0 ? errors : undefined,
|
|
105
|
+
}));
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
console.log();
|
|
109
|
+
if (installed.length > 0) {
|
|
110
|
+
console.log(` Done! Installed for: ${installed.join(", ")}`);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
console.log(" No hooks were installed.");
|
|
114
|
+
}
|
|
115
|
+
if (errors.length > 0) {
|
|
116
|
+
for (const err of errors) {
|
|
117
|
+
console.log(` Error: ${err}`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
console.log();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/** Install hooks for a single explicit platform */
|
|
124
|
+
async function installSinglePlatform(adapter, projectRoot, aditBinaryPath, opts) {
|
|
125
|
+
try {
|
|
126
|
+
await adapter.installHooks(projectRoot, aditBinaryPath);
|
|
127
|
+
if (opts?.json) {
|
|
128
|
+
console.log(JSON.stringify({
|
|
129
|
+
ok: true,
|
|
130
|
+
platform: adapter.platform,
|
|
131
|
+
action: "install",
|
|
132
|
+
}));
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
console.log();
|
|
136
|
+
console.log(` [+] Installed ADIT hooks for ${adapter.displayName}`);
|
|
137
|
+
console.log();
|
|
138
|
+
// Validate after install
|
|
139
|
+
const result = await adapter.validateInstallation(projectRoot);
|
|
140
|
+
for (const check of result.checks) {
|
|
141
|
+
const symbol = check.ok ? "+" : "x";
|
|
142
|
+
console.log(` [${symbol}] ${check.name}: ${check.detail}`);
|
|
143
|
+
}
|
|
144
|
+
console.log();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
catch (err) {
|
|
148
|
+
if (opts?.json) {
|
|
149
|
+
console.log(JSON.stringify({
|
|
150
|
+
ok: false,
|
|
151
|
+
platform: adapter.platform,
|
|
152
|
+
action: "install",
|
|
153
|
+
error: err.message,
|
|
154
|
+
}));
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
console.error(` [x] Failed to install hooks for ${adapter.displayName}: ${err.message}`);
|
|
158
|
+
}
|
|
159
|
+
process.exit(1);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/** adit plugin uninstall [platform] */
|
|
163
|
+
export async function pluginUninstallCommand(platformArg, opts) {
|
|
164
|
+
const config = loadConfig();
|
|
165
|
+
const projectRoot = resolveProjectRoot();
|
|
166
|
+
// --all: uninstall every installed platform (legacy behavior preserved)
|
|
167
|
+
if (opts?.all) {
|
|
168
|
+
await uninstallAll(config.projectRoot, config.dataDir, opts);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
// Explicit platform: uninstall just that one
|
|
172
|
+
if (platformArg) {
|
|
173
|
+
const platform = platformArg;
|
|
174
|
+
const adapter = getAdapterSafe(platform);
|
|
175
|
+
if (!adapter)
|
|
176
|
+
return;
|
|
177
|
+
await uninstallSinglePlatform(adapter, config.projectRoot, config.dataDir, opts);
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
// No arg, no --all: auto-detect and uninstall all detected/installed platforms
|
|
181
|
+
// First check which platforms are actually installed
|
|
182
|
+
const detectedPlatforms = detectPlatforms(projectRoot);
|
|
183
|
+
const allAdapters = listAdapters().filter((a) => a.hookMappings.length > 0);
|
|
184
|
+
// Combine: check detected platforms + any currently-installed platform
|
|
185
|
+
const toCheck = new Map();
|
|
186
|
+
for (const p of detectedPlatforms) {
|
|
187
|
+
const adapter = getAdapterSafe(p);
|
|
188
|
+
if (adapter && adapter.hookMappings.length > 0) {
|
|
189
|
+
toCheck.set(adapter.platform, adapter);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
for (const adapter of allAdapters) {
|
|
193
|
+
if (!toCheck.has(adapter.platform)) {
|
|
194
|
+
try {
|
|
195
|
+
const result = await adapter.validateInstallation(config.projectRoot);
|
|
196
|
+
if (result.valid) {
|
|
197
|
+
toCheck.set(adapter.platform, adapter);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
// ignore
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (toCheck.size === 0) {
|
|
206
|
+
if (opts?.json) {
|
|
207
|
+
console.log(JSON.stringify({
|
|
208
|
+
ok: true,
|
|
209
|
+
action: "uninstall",
|
|
210
|
+
uninstalled: [],
|
|
211
|
+
}));
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
console.log();
|
|
215
|
+
console.log(" No ADIT hooks found to remove.");
|
|
216
|
+
console.log();
|
|
217
|
+
}
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
const uninstalled = [];
|
|
221
|
+
const errors = [];
|
|
222
|
+
if (!opts?.json) {
|
|
223
|
+
console.log();
|
|
224
|
+
}
|
|
225
|
+
for (const adapter of toCheck.values()) {
|
|
226
|
+
try {
|
|
227
|
+
const result = await adapter.validateInstallation(config.projectRoot);
|
|
228
|
+
if (result.valid) {
|
|
229
|
+
await adapter.uninstallHooks(config.projectRoot);
|
|
230
|
+
uninstalled.push(adapter.displayName);
|
|
231
|
+
if (!opts?.json) {
|
|
232
|
+
console.log(` [~] Removed ${adapter.displayName} hooks`);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
catch (err) {
|
|
237
|
+
errors.push(`${adapter.displayName}: ${err.message}`);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
// Optionally remove .adit/ data directory
|
|
241
|
+
let dataRemoved = false;
|
|
242
|
+
if (opts?.clean && existsSync(config.dataDir)) {
|
|
243
|
+
try {
|
|
244
|
+
rmSync(config.dataDir, { recursive: true, force: true });
|
|
245
|
+
dataRemoved = true;
|
|
246
|
+
}
|
|
247
|
+
catch (err) {
|
|
248
|
+
errors.push(`Failed to remove data directory: ${err.message}`);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (opts?.json) {
|
|
252
|
+
console.log(JSON.stringify({
|
|
253
|
+
ok: errors.length === 0,
|
|
254
|
+
action: "uninstall",
|
|
255
|
+
uninstalled,
|
|
256
|
+
dataRemoved,
|
|
257
|
+
errors: errors.length > 0 ? errors : undefined,
|
|
258
|
+
}));
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
if (uninstalled.length === 0) {
|
|
262
|
+
console.log(" No ADIT hooks found to remove.");
|
|
263
|
+
}
|
|
264
|
+
if (dataRemoved) {
|
|
265
|
+
console.log(` [~] Removed data directory: ${config.dataDir}`);
|
|
266
|
+
}
|
|
267
|
+
for (const err of errors) {
|
|
268
|
+
console.error(` [x] ${err}`);
|
|
269
|
+
}
|
|
270
|
+
console.log();
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/** Uninstall hooks for ALL installed platforms (--all flag) */
|
|
274
|
+
async function uninstallAll(projectRoot, dataDir, opts) {
|
|
275
|
+
const uninstalled = [];
|
|
276
|
+
const errors = [];
|
|
277
|
+
if (!opts?.json) {
|
|
278
|
+
console.log();
|
|
279
|
+
}
|
|
280
|
+
for (const adapter of listAdapters()) {
|
|
281
|
+
if (adapter.hookMappings.length === 0)
|
|
282
|
+
continue;
|
|
283
|
+
try {
|
|
284
|
+
const result = await adapter.validateInstallation(projectRoot);
|
|
285
|
+
if (result.valid) {
|
|
286
|
+
await adapter.uninstallHooks(projectRoot);
|
|
287
|
+
uninstalled.push(adapter.displayName);
|
|
288
|
+
if (!opts?.json) {
|
|
289
|
+
console.log(` [~] Removed ${adapter.displayName} hooks`);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
catch (err) {
|
|
294
|
+
errors.push(`${adapter.platform}: ${err.message}`);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
// Optionally remove .adit/ data directory
|
|
298
|
+
let dataRemoved = false;
|
|
299
|
+
if (opts?.clean && existsSync(dataDir)) {
|
|
300
|
+
try {
|
|
301
|
+
rmSync(dataDir, { recursive: true, force: true });
|
|
302
|
+
dataRemoved = true;
|
|
303
|
+
}
|
|
304
|
+
catch (err) {
|
|
305
|
+
errors.push(`Failed to remove data directory: ${err.message}`);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
if (opts?.json) {
|
|
309
|
+
console.log(JSON.stringify({
|
|
310
|
+
ok: errors.length === 0,
|
|
311
|
+
action: "uninstall",
|
|
312
|
+
uninstalled,
|
|
313
|
+
dataRemoved,
|
|
314
|
+
errors: errors.length > 0 ? errors : undefined,
|
|
315
|
+
}));
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
if (uninstalled.length === 0) {
|
|
319
|
+
console.log(" No ADIT hooks found to remove.");
|
|
320
|
+
}
|
|
321
|
+
if (dataRemoved) {
|
|
322
|
+
console.log(` [~] Removed data directory: ${dataDir}`);
|
|
323
|
+
}
|
|
324
|
+
for (const err of errors) {
|
|
325
|
+
console.error(` [x] ${err}`);
|
|
326
|
+
}
|
|
327
|
+
console.log();
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
/** Uninstall hooks for a single explicit platform */
|
|
331
|
+
async function uninstallSinglePlatform(adapter, projectRoot, dataDir, opts) {
|
|
332
|
+
try {
|
|
333
|
+
await adapter.uninstallHooks(projectRoot);
|
|
334
|
+
// Optionally remove .adit/ data directory
|
|
335
|
+
let dataRemoved = false;
|
|
336
|
+
if (opts?.clean && existsSync(dataDir)) {
|
|
337
|
+
rmSync(dataDir, { recursive: true, force: true });
|
|
338
|
+
dataRemoved = true;
|
|
339
|
+
}
|
|
340
|
+
if (opts?.json) {
|
|
341
|
+
console.log(JSON.stringify({
|
|
342
|
+
ok: true,
|
|
343
|
+
platform: adapter.platform,
|
|
344
|
+
action: "uninstall",
|
|
345
|
+
dataRemoved,
|
|
346
|
+
}));
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
console.log();
|
|
350
|
+
console.log(` [~] Removed ${adapter.displayName} hooks`);
|
|
351
|
+
if (dataRemoved) {
|
|
352
|
+
console.log(` [~] Removed data directory: ${dataDir}`);
|
|
353
|
+
}
|
|
354
|
+
console.log();
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
catch (err) {
|
|
358
|
+
if (opts?.json) {
|
|
359
|
+
console.log(JSON.stringify({
|
|
360
|
+
ok: false,
|
|
361
|
+
platform: adapter.platform,
|
|
362
|
+
action: "uninstall",
|
|
363
|
+
error: err.message,
|
|
364
|
+
}));
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
console.error(` [x] Failed to remove hooks for ${adapter.displayName}: ${err.message}`);
|
|
368
|
+
}
|
|
369
|
+
process.exit(1);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
/** adit plugin list */
|
|
373
|
+
export async function pluginListCommand(opts) {
|
|
374
|
+
const adapters = listAdapters();
|
|
375
|
+
const projectRoot = resolveProjectRoot();
|
|
376
|
+
if (opts?.json) {
|
|
377
|
+
const results = [];
|
|
378
|
+
for (const a of adapters) {
|
|
379
|
+
const isImplemented = a.hookMappings.length > 0;
|
|
380
|
+
let isInstalled = false;
|
|
381
|
+
if (isImplemented) {
|
|
382
|
+
try {
|
|
383
|
+
const result = await a.validateInstallation(projectRoot);
|
|
384
|
+
isInstalled = result.valid;
|
|
385
|
+
}
|
|
386
|
+
catch {
|
|
387
|
+
// ignore
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
results.push({
|
|
391
|
+
platform: a.platform,
|
|
392
|
+
displayName: a.displayName,
|
|
393
|
+
implemented: isImplemented,
|
|
394
|
+
installed: isInstalled,
|
|
395
|
+
hooks: a.hookMappings.map((m) => m.platformEvent),
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
console.log(JSON.stringify(results, null, 2));
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
console.log();
|
|
402
|
+
console.log(" Available Platforms");
|
|
403
|
+
console.log(" ------------------");
|
|
404
|
+
console.log();
|
|
405
|
+
for (const adapter of adapters) {
|
|
406
|
+
const isImplemented = adapter.hookMappings.length > 0;
|
|
407
|
+
let status = "not yet supported";
|
|
408
|
+
if (isImplemented) {
|
|
409
|
+
try {
|
|
410
|
+
const result = await adapter.validateInstallation(projectRoot);
|
|
411
|
+
status = result.valid ? "installed" : "available";
|
|
412
|
+
}
|
|
413
|
+
catch {
|
|
414
|
+
status = "available";
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
const statusIcon = status === "installed" ? "+" :
|
|
418
|
+
status === "available" ? " " : "-";
|
|
419
|
+
console.log(` [${statusIcon}] ${adapter.displayName} (${adapter.platform})`);
|
|
420
|
+
if (isImplemented) {
|
|
421
|
+
console.log(` ${adapter.hookMappings.length} hook events: ${adapter.hookMappings.map((m) => m.platformEvent).join(", ")}`);
|
|
422
|
+
}
|
|
423
|
+
else {
|
|
424
|
+
console.log(` Stub — contributions welcome`);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
console.log();
|
|
428
|
+
console.log(" [+] installed [ ] available [-] not yet supported");
|
|
429
|
+
console.log();
|
|
430
|
+
}
|
|
431
|
+
/** adit plugin validate [platform] */
|
|
432
|
+
export async function pluginValidateCommand(platformArg, opts) {
|
|
433
|
+
const config = loadConfig();
|
|
434
|
+
const projectRoot = resolveProjectRoot();
|
|
435
|
+
// If explicit platform, validate just that one
|
|
436
|
+
if (platformArg) {
|
|
437
|
+
const platform = platformArg;
|
|
438
|
+
const adapter = getAdapterSafe(platform);
|
|
439
|
+
if (!adapter)
|
|
440
|
+
return;
|
|
441
|
+
await validateSinglePlatform(adapter, config.projectRoot, opts);
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
// Auto-detect and validate all detected platforms
|
|
445
|
+
const platforms = detectPlatforms(projectRoot);
|
|
446
|
+
if (platforms.length === 0) {
|
|
447
|
+
if (opts?.json) {
|
|
448
|
+
console.log(JSON.stringify({ platforms: [], valid: false }));
|
|
449
|
+
}
|
|
450
|
+
else {
|
|
451
|
+
console.log();
|
|
452
|
+
console.log(" No AI platforms detected in this project.");
|
|
453
|
+
console.log(" Run 'adit plugin validate <platform>' for a specific platform.");
|
|
454
|
+
console.log();
|
|
455
|
+
}
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
const results = [];
|
|
459
|
+
if (!opts?.json) {
|
|
460
|
+
console.log();
|
|
461
|
+
}
|
|
462
|
+
for (const platform of platforms) {
|
|
463
|
+
const adapter = getAdapterSafe(platform);
|
|
464
|
+
if (!adapter)
|
|
465
|
+
continue;
|
|
466
|
+
if (adapter.hookMappings.length === 0)
|
|
467
|
+
continue;
|
|
468
|
+
const result = await adapter.validateInstallation(config.projectRoot);
|
|
469
|
+
results.push({
|
|
470
|
+
platform: adapter.platform,
|
|
471
|
+
displayName: adapter.displayName,
|
|
472
|
+
valid: result.valid,
|
|
473
|
+
checks: result.checks,
|
|
474
|
+
});
|
|
475
|
+
if (!opts?.json) {
|
|
476
|
+
console.log(` ${adapter.displayName}`);
|
|
477
|
+
for (const check of result.checks) {
|
|
478
|
+
const symbol = check.ok ? "+" : "x";
|
|
479
|
+
console.log(` [${symbol}] ${check.name}: ${check.detail}`);
|
|
480
|
+
}
|
|
481
|
+
console.log(result.valid ? " All checks passed." : " Some checks failed.");
|
|
482
|
+
console.log();
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
if (opts?.json) {
|
|
486
|
+
const allValid = results.every((r) => r.valid);
|
|
487
|
+
console.log(JSON.stringify({ platforms: results, valid: allValid }, null, 2));
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
/** Validate a single platform */
|
|
491
|
+
async function validateSinglePlatform(adapter, projectRoot, opts) {
|
|
492
|
+
const result = await adapter.validateInstallation(projectRoot);
|
|
493
|
+
if (opts?.json) {
|
|
494
|
+
console.log(JSON.stringify(result, null, 2));
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
console.log();
|
|
498
|
+
console.log(` Plugin validation: ${adapter.displayName}`);
|
|
499
|
+
console.log();
|
|
500
|
+
for (const check of result.checks) {
|
|
501
|
+
const symbol = check.ok ? "+" : "x";
|
|
502
|
+
console.log(` [${symbol}] ${check.name}: ${check.detail}`);
|
|
503
|
+
}
|
|
504
|
+
console.log(result.valid ? "\n All checks passed." : "\n Some checks failed.");
|
|
505
|
+
console.log();
|
|
506
|
+
}
|
|
507
|
+
function getAdapterSafe(platform) {
|
|
508
|
+
try {
|
|
509
|
+
return getAdapter(platform);
|
|
510
|
+
}
|
|
511
|
+
catch (err) {
|
|
512
|
+
console.error(err.message);
|
|
513
|
+
process.exit(1);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
//# sourceMappingURL=plugin.js.map
|