@kuznai/inception-engine 0.1.0 → 0.2.0
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/index.js +12 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -56,34 +56,29 @@ function parseArgs(argv) {
|
|
|
56
56
|
i++;
|
|
57
57
|
const next = args[i];
|
|
58
58
|
if (!next) {
|
|
59
|
-
|
|
60
|
-
process.exit(1);
|
|
59
|
+
throw new UserError("--agents requires a comma-separated list");
|
|
61
60
|
}
|
|
62
61
|
const ids = next.split(",").map((s) => s.trim());
|
|
63
62
|
for (const id of ids) {
|
|
64
63
|
if (!AGENT_IDS.includes(id)) {
|
|
65
|
-
|
|
66
|
-
process.exit(1);
|
|
64
|
+
throw new UserError(`Unknown agent: "${id}". Valid agents: ${AGENT_IDS.join(", ")}`);
|
|
67
65
|
}
|
|
68
66
|
}
|
|
69
67
|
agents = ids;
|
|
70
68
|
}
|
|
71
69
|
else if (arg.startsWith("--")) {
|
|
72
|
-
|
|
73
|
-
process.exit(1);
|
|
70
|
+
throw new UserError(`Unknown option: ${arg}`);
|
|
74
71
|
}
|
|
75
72
|
else if (!directory) {
|
|
76
73
|
directory = arg;
|
|
77
74
|
}
|
|
78
75
|
else {
|
|
79
|
-
|
|
80
|
-
process.exit(1);
|
|
76
|
+
throw new UserError(`Unexpected argument: ${arg}`);
|
|
81
77
|
}
|
|
82
78
|
i++;
|
|
83
79
|
}
|
|
84
80
|
if (!directory) {
|
|
85
|
-
|
|
86
|
-
process.exit(1);
|
|
81
|
+
throw new UserError("Missing required <directory> argument");
|
|
87
82
|
}
|
|
88
83
|
return { command, directory: path.resolve(directory), dryRun, agents, verbose, debug };
|
|
89
84
|
}
|
|
@@ -91,7 +86,7 @@ function main() {
|
|
|
91
86
|
const options = parseArgs(process.argv);
|
|
92
87
|
if (options.command === "help") {
|
|
93
88
|
console.log(USAGE);
|
|
94
|
-
|
|
89
|
+
return 0;
|
|
95
90
|
}
|
|
96
91
|
const manifest = loadManifest(options.directory);
|
|
97
92
|
const home = resolveHome();
|
|
@@ -107,7 +102,7 @@ function main() {
|
|
|
107
102
|
if (detectedAgents.length === 0) {
|
|
108
103
|
console.log("No supported AI agents detected on this system.");
|
|
109
104
|
console.log(`Install one of: ${AGENT_REGISTRY.map((a) => a.displayName).join(", ")}`);
|
|
110
|
-
|
|
105
|
+
return 0;
|
|
111
106
|
}
|
|
112
107
|
if (options.verbose) {
|
|
113
108
|
console.log(`Detected agents: ${detectedAgents.join(", ")}`);
|
|
@@ -118,14 +113,14 @@ function main() {
|
|
|
118
113
|
const actions = planDeploy(manifest, options.directory, detectedAgents, home);
|
|
119
114
|
if (actions.length === 0) {
|
|
120
115
|
console.log("No skills to deploy for detected agents.");
|
|
121
|
-
return;
|
|
116
|
+
return 0;
|
|
122
117
|
}
|
|
123
118
|
console.log(`${prefix}Deploying ${actions.length} skill(s):`);
|
|
124
119
|
const { succeeded, failed } = executeDeploy(actions, options.dryRun, options.verbose);
|
|
125
120
|
console.log();
|
|
126
121
|
if (failed.length > 0) {
|
|
127
122
|
console.log(`${succeeded} succeeded, ${failed.length} failed`);
|
|
128
|
-
|
|
123
|
+
return 1;
|
|
129
124
|
}
|
|
130
125
|
else {
|
|
131
126
|
console.log(`${succeeded} skill(s) deployed${options.dryRun ? " (dry-run)" : ""}`);
|
|
@@ -135,7 +130,7 @@ function main() {
|
|
|
135
130
|
const actions = planRevert(manifest, detectedAgents, home);
|
|
136
131
|
if (actions.length === 0) {
|
|
137
132
|
console.log("No skills to revert for detected agents.");
|
|
138
|
-
return;
|
|
133
|
+
return 0;
|
|
139
134
|
}
|
|
140
135
|
console.log(`${prefix}Reverting ${actions.length} skill(s):`);
|
|
141
136
|
const { succeeded, skipped } = executeRevert(actions, options.dryRun, options.verbose);
|
|
@@ -145,10 +140,11 @@ function main() {
|
|
|
145
140
|
parts.push(`${skipped} skipped`);
|
|
146
141
|
console.log(`${parts.join(", ")}${options.dryRun ? " (dry-run)" : ""}`);
|
|
147
142
|
}
|
|
143
|
+
return 0;
|
|
148
144
|
}
|
|
149
145
|
const debugMode = process.argv.includes("--debug");
|
|
150
146
|
try {
|
|
151
|
-
main();
|
|
147
|
+
process.exit(main());
|
|
152
148
|
}
|
|
153
149
|
catch (err) {
|
|
154
150
|
if (err instanceof UserError) {
|