@omnidev-ai/cli 0.4.0 → 0.5.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/dist/index.js CHANGED
@@ -1,772 +1,1062 @@
1
1
  #!/usr/bin/env node
2
- import { buildApplication, buildCommand, buildRouteMap, run } from "@stricli/core";
2
+ import {
3
+ __require,
4
+ __toESM,
5
+ debug,
6
+ disableCapability,
7
+ disableProvider,
8
+ discoverCapabilities,
9
+ enableCapability,
10
+ enableProvider,
11
+ generateInstructionsTemplate,
12
+ getActiveProfile,
13
+ getEnabledCapabilities,
14
+ loadCapabilityConfig,
15
+ loadConfig,
16
+ readEnabledProviders,
17
+ resolveEnabledCapabilities,
18
+ setActiveProfile,
19
+ syncAgentConfiguration,
20
+ writeConfig,
21
+ writeEnabledProviders
22
+ } from "./shared/chunk-7txw9v1e.js";
23
+
24
+ // src/index.ts
25
+ import { run } from "@stricli/core";
26
+
27
+ // src/lib/dynamic-app.ts
28
+ import { existsSync as existsSync7 } from "node:fs";
29
+ import { join as join5 } from "node:path";
30
+ import { buildApplication, buildRouteMap as buildRouteMap4 } from "@stricli/core";
31
+
32
+ // ../adapters/src/claude-code/index.ts
3
33
  import { existsSync, mkdirSync } from "node:fs";
4
34
  import { join } from "node:path";
5
- import { getAllAdapters, getEnabledAdapters } from "@omnidev-ai/adapters";
6
- import { debug, disableCapability, disableProvider, discoverCapabilities, enableCapability, enableProvider, generateInstructionsTemplate, getActiveProfile, getEnabledCapabilities, loadCapabilityConfig, loadConfig, readEnabledProviders, resolveEnabledCapabilities, setActiveProfile, syncAgentConfiguration, writeConfig, writeEnabledProviders } from "@omnidev-ai/core";
7
- import { checkbox } from "@inquirer/prompts";
35
+ var claudeCodeAdapter = {
36
+ id: "claude-code",
37
+ displayName: "Claude Code",
38
+ async init(ctx) {
39
+ const claudeMdPath = join(ctx.projectRoot, "CLAUDE.md");
40
+ const filesCreated = [];
41
+ if (!existsSync(claudeMdPath)) {
42
+ await Bun.write(claudeMdPath, generateClaudeTemplate());
43
+ filesCreated.push("CLAUDE.md");
44
+ }
45
+ return {
46
+ filesCreated,
47
+ message: filesCreated.length > 0 ? `Created ${filesCreated.join(", ")}` : "CLAUDE.md already exists"
48
+ };
49
+ },
50
+ async sync(bundle, ctx) {
51
+ const filesWritten = [];
52
+ const filesDeleted = [];
53
+ const skillsDir = join(ctx.projectRoot, ".claude", "skills");
54
+ mkdirSync(skillsDir, { recursive: true });
55
+ for (const skill of bundle.skills) {
56
+ const skillDir = join(skillsDir, skill.name);
57
+ mkdirSync(skillDir, { recursive: true });
58
+ const skillPath = join(skillDir, "SKILL.md");
59
+ const content = `---
60
+ name: ${skill.name}
61
+ description: "${skill.description}"
62
+ ---
63
+
64
+ ${skill.instructions}`;
65
+ await Bun.write(skillPath, content);
66
+ filesWritten.push(`.claude/skills/${skill.name}/SKILL.md`);
67
+ }
68
+ return {
69
+ filesWritten,
70
+ filesDeleted
71
+ };
72
+ }
73
+ };
74
+ function generateClaudeTemplate() {
75
+ return `# Project Instructions
76
+
77
+ <!-- Add your project-specific instructions here -->
78
+
79
+ ## OmniDev
80
+
81
+ @import .omni/instructions.md
82
+ `;
83
+ }
84
+ // ../adapters/src/codex/index.ts
85
+ import { existsSync as existsSync2 } from "node:fs";
86
+ import { join as join2 } from "node:path";
87
+ var codexAdapter = {
88
+ id: "codex",
89
+ displayName: "Codex",
90
+ async init(ctx) {
91
+ const agentsMdPath = join2(ctx.projectRoot, "AGENTS.md");
92
+ const filesCreated = [];
93
+ if (!existsSync2(agentsMdPath)) {
94
+ await Bun.write(agentsMdPath, generateAgentsTemplate());
95
+ filesCreated.push("AGENTS.md");
96
+ }
97
+ return {
98
+ filesCreated,
99
+ message: filesCreated.length > 0 ? `Created ${filesCreated.join(", ")}` : "AGENTS.md already exists"
100
+ };
101
+ },
102
+ async sync(_bundle, _ctx) {
103
+ return {
104
+ filesWritten: [],
105
+ filesDeleted: []
106
+ };
107
+ }
108
+ };
109
+ function generateAgentsTemplate() {
110
+ return `# Project Instructions
111
+
112
+ <!-- Add your project-specific instructions here -->
113
+
114
+ ## OmniDev
8
115
 
9
- //#region src/commands/capability.ts
10
- /**
11
- * Run the capability list command.
12
- */
116
+ @import .omni/instructions.md
117
+ `;
118
+ }
119
+ // ../adapters/src/cursor/index.ts
120
+ import { mkdirSync as mkdirSync2 } from "node:fs";
121
+ import { join as join3 } from "node:path";
122
+ var cursorAdapter = {
123
+ id: "cursor",
124
+ displayName: "Cursor",
125
+ async init(ctx) {
126
+ const rulesDir = join3(ctx.projectRoot, ".cursor", "rules");
127
+ mkdirSync2(rulesDir, { recursive: true });
128
+ return {
129
+ filesCreated: [".cursor/rules/"],
130
+ message: "Created .cursor/rules/ directory"
131
+ };
132
+ },
133
+ async sync(bundle, ctx) {
134
+ const filesWritten = [];
135
+ const filesDeleted = [];
136
+ const rulesDir = join3(ctx.projectRoot, ".cursor", "rules");
137
+ mkdirSync2(rulesDir, { recursive: true });
138
+ for (const rule of bundle.rules) {
139
+ const rulePath = join3(rulesDir, `omnidev-${rule.name}.mdc`);
140
+ await Bun.write(rulePath, rule.content);
141
+ filesWritten.push(`.cursor/rules/omnidev-${rule.name}.mdc`);
142
+ }
143
+ return {
144
+ filesWritten,
145
+ filesDeleted
146
+ };
147
+ }
148
+ };
149
+ // ../adapters/src/opencode/index.ts
150
+ import { existsSync as existsSync3, mkdirSync as mkdirSync3 } from "node:fs";
151
+ import { join as join4 } from "node:path";
152
+ var opencodeAdapter = {
153
+ id: "opencode",
154
+ displayName: "OpenCode",
155
+ async init(ctx) {
156
+ const opencodeDir = join4(ctx.projectRoot, ".opencode");
157
+ mkdirSync3(opencodeDir, { recursive: true });
158
+ const instructionsPath = join4(opencodeDir, "instructions.md");
159
+ const filesCreated = [];
160
+ if (!existsSync3(instructionsPath)) {
161
+ await Bun.write(instructionsPath, generateOpencodeTemplate());
162
+ filesCreated.push(".opencode/instructions.md");
163
+ }
164
+ return {
165
+ filesCreated,
166
+ message: filesCreated.length > 0 ? `Created ${filesCreated.join(", ")}` : ".opencode/instructions.md already exists"
167
+ };
168
+ },
169
+ async sync(_bundle, _ctx) {
170
+ return {
171
+ filesWritten: [],
172
+ filesDeleted: []
173
+ };
174
+ }
175
+ };
176
+ function generateOpencodeTemplate() {
177
+ return `# OpenCode Instructions
178
+
179
+ <!-- Add your project-specific instructions here -->
180
+
181
+ ## OmniDev
182
+
183
+ @import ../.omni/instructions.md
184
+ `;
185
+ }
186
+ // ../adapters/src/registry.ts
187
+ var builtInAdapters = [
188
+ claudeCodeAdapter,
189
+ codexAdapter,
190
+ cursorAdapter,
191
+ opencodeAdapter
192
+ ];
193
+ var adapterMap = new Map(builtInAdapters.map((adapter) => [adapter.id, adapter]));
194
+ function getAllAdapters() {
195
+ return builtInAdapters;
196
+ }
197
+ async function getEnabledAdapters() {
198
+ const enabledIds = await readEnabledProviders();
199
+ return enabledIds.map((id) => adapterMap.get(id)).filter((a) => a != null);
200
+ }
201
+ // src/commands/capability.ts
202
+ import { buildCommand, buildRouteMap } from "@stricli/core";
13
203
  async function runCapabilityList() {
14
- try {
15
- const enabledIds = await getEnabledCapabilities();
16
- const capabilityPaths = await discoverCapabilities();
17
- if (capabilityPaths.length === 0) {
18
- console.log("No capabilities found.");
19
- console.log("");
20
- console.log("To add capabilities, create directories in omni/capabilities/");
21
- console.log("Each capability must have a capability.toml file.");
22
- return;
23
- }
24
- console.log("Capabilities:");
25
- console.log("");
26
- for (const path of capabilityPaths) try {
27
- const capConfig = await loadCapabilityConfig(path);
28
- const isEnabled = enabledIds.includes(capConfig.capability.id);
29
- const status = isEnabled ? "✓ enabled" : "✗ disabled";
30
- const { id, name, version } = capConfig.capability;
31
- console.log(` ${status} ${name}`);
32
- console.log(` ID: ${id}`);
33
- console.log(` Version: ${version}`);
34
- console.log("");
35
- } catch (error) {
36
- console.error(` ✗ Failed to load capability at ${path}:`, error);
37
- console.log("");
38
- }
39
- } catch (error) {
40
- console.error("Error listing capabilities:", error);
41
- process.exit(1);
42
- }
204
+ try {
205
+ const enabledIds = await getEnabledCapabilities();
206
+ const capabilityPaths = await discoverCapabilities();
207
+ if (capabilityPaths.length === 0) {
208
+ console.log("No capabilities found.");
209
+ console.log("");
210
+ console.log("To add capabilities, create directories in omni/capabilities/");
211
+ console.log("Each capability must have a capability.toml file.");
212
+ return;
213
+ }
214
+ console.log("Capabilities:");
215
+ console.log("");
216
+ for (const path of capabilityPaths) {
217
+ try {
218
+ const capConfig = await loadCapabilityConfig(path);
219
+ const isEnabled = enabledIds.includes(capConfig.capability.id);
220
+ const status = isEnabled ? "✓ enabled" : "✗ disabled";
221
+ const { id, name, version } = capConfig.capability;
222
+ console.log(` ${status} ${name}`);
223
+ console.log(` ID: ${id}`);
224
+ console.log(` Version: ${version}`);
225
+ console.log("");
226
+ } catch (error) {
227
+ console.error(` ✗ Failed to load capability at ${path}:`, error);
228
+ console.log("");
229
+ }
230
+ }
231
+ } catch (error) {
232
+ console.error("Error listing capabilities:", error);
233
+ process.exit(1);
234
+ }
43
235
  }
44
- /**
45
- * Run the capability enable command.
46
- */
47
236
  async function runCapabilityEnable(_flags, name) {
48
- try {
49
- const capabilityPaths = await discoverCapabilities();
50
- const capabilityExists = capabilityPaths.some(async (path) => {
51
- const config = await loadCapabilityConfig(path);
52
- return config.capability.id === name;
53
- });
54
- if (!capabilityExists) {
55
- console.error(`Error: Capability '${name}' not found`);
56
- console.log("");
57
- console.log("Run 'dev capability list' to see available capabilities");
58
- process.exit(1);
59
- }
60
- await enableCapability(name);
61
- console.log(`✓ Enabled capability: ${name}`);
62
- console.log("");
63
- const adapters = await getEnabledAdapters();
64
- await syncAgentConfiguration({ adapters });
65
- } catch (error) {
66
- console.error("Error enabling capability:", error);
67
- process.exit(1);
68
- }
237
+ try {
238
+ const capabilityPaths = await discoverCapabilities();
239
+ const capabilityExists = capabilityPaths.some(async (path) => {
240
+ const config = await loadCapabilityConfig(path);
241
+ return config.capability.id === name;
242
+ });
243
+ if (!capabilityExists) {
244
+ console.error(`Error: Capability '${name}' not found`);
245
+ console.log("");
246
+ console.log("Run 'dev capability list' to see available capabilities");
247
+ process.exit(1);
248
+ }
249
+ await enableCapability(name);
250
+ console.log(`✓ Enabled capability: ${name}`);
251
+ console.log("");
252
+ const adapters = await getEnabledAdapters();
253
+ await syncAgentConfiguration({ adapters });
254
+ } catch (error) {
255
+ console.error("Error enabling capability:", error);
256
+ process.exit(1);
257
+ }
69
258
  }
70
- /**
71
- * Run the capability disable command.
72
- */
73
259
  async function runCapabilityDisable(_flags, name) {
74
- try {
75
- await disableCapability(name);
76
- console.log(`✓ Disabled capability: ${name}`);
77
- console.log("");
78
- const adapters = await getEnabledAdapters();
79
- await syncAgentConfiguration({ adapters });
80
- } catch (error) {
81
- console.error("Error disabling capability:", error);
82
- process.exit(1);
83
- }
260
+ try {
261
+ await disableCapability(name);
262
+ console.log(`✓ Disabled capability: ${name}`);
263
+ console.log("");
264
+ const adapters = await getEnabledAdapters();
265
+ await syncAgentConfiguration({ adapters });
266
+ } catch (error) {
267
+ console.error("Error disabling capability:", error);
268
+ process.exit(1);
269
+ }
84
270
  }
85
- const listCommand$2 = buildCommand({
86
- docs: { brief: "List all discovered capabilities" },
87
- parameters: {},
88
- async func() {
89
- await runCapabilityList();
90
- }
271
+ var listCommand = buildCommand({
272
+ docs: {
273
+ brief: "List all discovered capabilities"
274
+ },
275
+ parameters: {},
276
+ async func() {
277
+ await runCapabilityList();
278
+ }
91
279
  });
92
- const enableCommand$1 = buildCommand({
93
- docs: { brief: "Enable a capability" },
94
- parameters: {
95
- flags: {},
96
- positional: {
97
- kind: "tuple",
98
- parameters: [{
99
- brief: "Capability name to enable",
100
- parse: String
101
- }]
102
- }
103
- },
104
- func: runCapabilityEnable
280
+ var enableCommand = buildCommand({
281
+ docs: {
282
+ brief: "Enable a capability"
283
+ },
284
+ parameters: {
285
+ flags: {},
286
+ positional: {
287
+ kind: "tuple",
288
+ parameters: [
289
+ {
290
+ brief: "Capability name to enable",
291
+ parse: String
292
+ }
293
+ ]
294
+ }
295
+ },
296
+ func: runCapabilityEnable
105
297
  });
106
- const disableCommand$1 = buildCommand({
107
- docs: { brief: "Disable a capability" },
108
- parameters: {
109
- flags: {},
110
- positional: {
111
- kind: "tuple",
112
- parameters: [{
113
- brief: "Capability name to disable",
114
- parse: String
115
- }]
116
- }
117
- },
118
- func: runCapabilityDisable
298
+ var disableCommand = buildCommand({
299
+ docs: {
300
+ brief: "Disable a capability"
301
+ },
302
+ parameters: {
303
+ flags: {},
304
+ positional: {
305
+ kind: "tuple",
306
+ parameters: [
307
+ {
308
+ brief: "Capability name to disable",
309
+ parse: String
310
+ }
311
+ ]
312
+ }
313
+ },
314
+ func: runCapabilityDisable
119
315
  });
120
- const capabilityRoutes = buildRouteMap({
121
- routes: {
122
- list: listCommand$2,
123
- enable: enableCommand$1,
124
- disable: disableCommand$1
125
- },
126
- docs: { brief: "Manage capabilities" }
316
+ var capabilityRoutes = buildRouteMap({
317
+ routes: {
318
+ list: listCommand,
319
+ enable: enableCommand,
320
+ disable: disableCommand
321
+ },
322
+ docs: {
323
+ brief: "Manage capabilities"
324
+ }
127
325
  });
128
326
 
129
- //#endregion
130
- //#region src/commands/doctor.ts
131
- const doctorCommand = buildCommand({
132
- docs: { brief: "Check OmniDev setup and dependencies" },
133
- parameters: {},
134
- async func() {
135
- return await runDoctor();
136
- }
327
+ // src/commands/doctor.ts
328
+ import { existsSync as existsSync4 } from "node:fs";
329
+ import { buildCommand as buildCommand2 } from "@stricli/core";
330
+ var doctorCommand = buildCommand2({
331
+ docs: {
332
+ brief: "Check OmniDev setup and dependencies"
333
+ },
334
+ parameters: {},
335
+ async func() {
336
+ return await runDoctor();
337
+ }
137
338
  });
138
339
  async function runDoctor() {
139
- console.log("OmniDev Doctor");
140
- console.log("==============");
141
- console.log("");
142
- const checks = [
143
- checkBunVersion(),
144
- checkOmniLocalDir(),
145
- checkConfig(),
146
- checkRootGitignore(),
147
- checkCapabilitiesDir()
148
- ];
149
- let allPassed = true;
150
- for (const check of checks) {
151
- const { name, passed, message, fix } = await check;
152
- const icon = passed ? "✓" : "✗";
153
- console.log(`${icon} ${name}: ${message}`);
154
- if (!passed && fix) console.log(` Fix: ${fix}`);
155
- if (!passed) allPassed = false;
156
- }
157
- console.log("");
158
- if (allPassed) console.log("All checks passed!");
159
- else {
160
- console.log("Some checks failed. Please fix the issues above.");
161
- process.exit(1);
162
- }
340
+ console.log("OmniDev Doctor");
341
+ console.log("==============");
342
+ console.log("");
343
+ const checks = [
344
+ checkBunVersion(),
345
+ checkOmniLocalDir(),
346
+ checkConfig(),
347
+ checkRootGitignore(),
348
+ checkCapabilitiesDir()
349
+ ];
350
+ let allPassed = true;
351
+ for (const check of checks) {
352
+ const { name, passed, message, fix } = await check;
353
+ const icon = passed ? "✓" : "✗";
354
+ console.log(`${icon} ${name}: ${message}`);
355
+ if (!passed && fix) {
356
+ console.log(` Fix: ${fix}`);
357
+ }
358
+ if (!passed)
359
+ allPassed = false;
360
+ }
361
+ console.log("");
362
+ if (allPassed) {
363
+ console.log("All checks passed!");
364
+ } else {
365
+ console.log("Some checks failed. Please fix the issues above.");
366
+ process.exit(1);
367
+ }
163
368
  }
164
369
  async function checkBunVersion() {
165
- const version = Bun.version;
166
- const parts = version.split(".");
167
- const firstPart = parts[0];
168
- if (!firstPart) return {
169
- name: "Bun Version",
170
- passed: false,
171
- message: `Invalid version format: ${version}`,
172
- fix: "Reinstall Bun: curl -fsSL https://bun.sh/install | bash"
173
- };
174
- const major = Number.parseInt(firstPart, 10);
175
- if (major < 1) return {
176
- name: "Bun Version",
177
- passed: false,
178
- message: `v${version}`,
179
- fix: "Upgrade Bun: curl -fsSL https://bun.sh/install | bash"
180
- };
181
- return {
182
- name: "Bun Version",
183
- passed: true,
184
- message: `v${version}`
185
- };
370
+ const version = Bun.version;
371
+ const parts = version.split(".");
372
+ const firstPart = parts[0];
373
+ if (!firstPart) {
374
+ return {
375
+ name: "Bun Version",
376
+ passed: false,
377
+ message: `Invalid version format: ${version}`,
378
+ fix: "Reinstall Bun: curl -fsSL https://bun.sh/install | bash"
379
+ };
380
+ }
381
+ const major = Number.parseInt(firstPart, 10);
382
+ if (major < 1) {
383
+ return {
384
+ name: "Bun Version",
385
+ passed: false,
386
+ message: `v${version}`,
387
+ fix: "Upgrade Bun: curl -fsSL https://bun.sh/install | bash"
388
+ };
389
+ }
390
+ return {
391
+ name: "Bun Version",
392
+ passed: true,
393
+ message: `v${version}`
394
+ };
186
395
  }
187
396
  async function checkOmniLocalDir() {
188
- const exists = existsSync(".omni");
189
- if (!exists) return {
190
- name: ".omni/ directory",
191
- passed: false,
192
- message: "Not found",
193
- fix: "Run: omnidev init"
194
- };
195
- return {
196
- name: ".omni/ directory",
197
- passed: true,
198
- message: "Found"
199
- };
397
+ const exists = existsSync4(".omni");
398
+ if (!exists) {
399
+ return {
400
+ name: ".omni/ directory",
401
+ passed: false,
402
+ message: "Not found",
403
+ fix: "Run: omnidev init"
404
+ };
405
+ }
406
+ return {
407
+ name: ".omni/ directory",
408
+ passed: true,
409
+ message: "Found"
410
+ };
200
411
  }
201
412
  async function checkConfig() {
202
- const configPath = "omni.toml";
203
- if (!existsSync(configPath)) return {
204
- name: "Configuration",
205
- passed: false,
206
- message: "omni.toml not found",
207
- fix: "Run: omnidev init"
208
- };
209
- try {
210
- const { loadConfig: loadConfig$1 } = await import("@omnidev-ai/core");
211
- await loadConfig$1();
212
- return {
213
- name: "Configuration",
214
- passed: true,
215
- message: "Valid"
216
- };
217
- } catch (error) {
218
- return {
219
- name: "Configuration",
220
- passed: false,
221
- message: `Invalid: ${error instanceof Error ? error.message : String(error)}`,
222
- fix: "Check omni.toml syntax"
223
- };
224
- }
413
+ const configPath = "omni.toml";
414
+ if (!existsSync4(configPath)) {
415
+ return {
416
+ name: "Configuration",
417
+ passed: false,
418
+ message: "omni.toml not found",
419
+ fix: "Run: omnidev init"
420
+ };
421
+ }
422
+ try {
423
+ const { loadConfig: loadConfig2 } = await import("./shared/chunk-7txw9v1e.js");
424
+ await loadConfig2();
425
+ return {
426
+ name: "Configuration",
427
+ passed: true,
428
+ message: "Valid"
429
+ };
430
+ } catch (error) {
431
+ return {
432
+ name: "Configuration",
433
+ passed: false,
434
+ message: `Invalid: ${error instanceof Error ? error.message : String(error)}`,
435
+ fix: "Check omni.toml syntax"
436
+ };
437
+ }
225
438
  }
226
439
  async function checkRootGitignore() {
227
- const gitignorePath = ".gitignore";
228
- if (!existsSync(gitignorePath)) return {
229
- name: "Root .gitignore",
230
- passed: false,
231
- message: ".gitignore not found",
232
- fix: "Run: omnidev init"
233
- };
234
- const content = await Bun.file(gitignorePath).text();
235
- const lines = content.split("\n").map((line) => line.trim());
236
- const hasOmniDir = lines.includes(".omni/");
237
- const hasLocalToml = lines.includes("omni.local.toml");
238
- if (!hasOmniDir || !hasLocalToml) {
239
- const missing = [];
240
- if (!hasOmniDir) missing.push(".omni/");
241
- if (!hasLocalToml) missing.push("omni.local.toml");
242
- return {
243
- name: "Root .gitignore",
244
- passed: false,
245
- message: `Missing entries: ${missing.join(", ")}`,
246
- fix: "Run: omnidev init"
247
- };
248
- }
249
- return {
250
- name: "Root .gitignore",
251
- passed: true,
252
- message: "Found with OmniDev entries"
253
- };
440
+ const gitignorePath = ".gitignore";
441
+ if (!existsSync4(gitignorePath)) {
442
+ return {
443
+ name: "Root .gitignore",
444
+ passed: false,
445
+ message: ".gitignore not found",
446
+ fix: "Run: omnidev init"
447
+ };
448
+ }
449
+ const content = await Bun.file(gitignorePath).text();
450
+ const lines = content.split(`
451
+ `).map((line) => line.trim());
452
+ const hasOmniDir = lines.includes(".omni/");
453
+ const hasLocalToml = lines.includes("omni.local.toml");
454
+ if (!hasOmniDir || !hasLocalToml) {
455
+ const missing = [];
456
+ if (!hasOmniDir)
457
+ missing.push(".omni/");
458
+ if (!hasLocalToml)
459
+ missing.push("omni.local.toml");
460
+ return {
461
+ name: "Root .gitignore",
462
+ passed: false,
463
+ message: `Missing entries: ${missing.join(", ")}`,
464
+ fix: "Run: omnidev init"
465
+ };
466
+ }
467
+ return {
468
+ name: "Root .gitignore",
469
+ passed: true,
470
+ message: "Found with OmniDev entries"
471
+ };
254
472
  }
255
473
  async function checkCapabilitiesDir() {
256
- const capabilitiesDirPath = ".omni/capabilities";
257
- if (!existsSync(capabilitiesDirPath)) return {
258
- name: "Capabilities Directory",
259
- passed: true,
260
- message: "Not found (no custom capabilities)"
261
- };
262
- return {
263
- name: "Capabilities Directory",
264
- passed: true,
265
- message: "Found"
266
- };
474
+ const capabilitiesDirPath = ".omni/capabilities";
475
+ if (!existsSync4(capabilitiesDirPath)) {
476
+ return {
477
+ name: "Capabilities Directory",
478
+ passed: true,
479
+ message: "Not found (no custom capabilities)"
480
+ };
481
+ }
482
+ return {
483
+ name: "Capabilities Directory",
484
+ passed: true,
485
+ message: "Found"
486
+ };
267
487
  }
268
488
 
269
- //#endregion
270
- //#region src/prompts/provider.ts
489
+ // src/commands/init.ts
490
+ import { existsSync as existsSync5, mkdirSync as mkdirSync4 } from "node:fs";
491
+ import { buildCommand as buildCommand3 } from "@stricli/core";
492
+
493
+ // src/prompts/provider.ts
494
+ import { checkbox } from "@inquirer/prompts";
271
495
  async function promptForProviders() {
272
- const answers = await checkbox({
273
- message: "Select your AI provider(s):",
274
- choices: [
275
- {
276
- name: "Claude Code (Claude CLI)",
277
- value: "claude-code",
278
- checked: true
279
- },
280
- {
281
- name: "Cursor",
282
- value: "cursor",
283
- checked: false
284
- },
285
- {
286
- name: "Codex",
287
- value: "codex",
288
- checked: false
289
- },
290
- {
291
- name: "OpenCode",
292
- value: "opencode",
293
- checked: false
294
- }
295
- ],
296
- required: true
297
- });
298
- return answers;
496
+ const answers = await checkbox({
497
+ message: "Select your AI provider(s):",
498
+ choices: [
499
+ { name: "Claude Code (Claude CLI)", value: "claude-code", checked: true },
500
+ { name: "Cursor", value: "cursor", checked: false },
501
+ { name: "Codex", value: "codex", checked: false },
502
+ { name: "OpenCode", value: "opencode", checked: false }
503
+ ],
504
+ required: true
505
+ });
506
+ return answers;
299
507
  }
300
508
 
301
- //#endregion
302
- //#region src/commands/init.ts
509
+ // src/commands/init.ts
303
510
  async function runInit(_flags, providerArg) {
304
- console.log("Initializing OmniDev...");
305
- mkdirSync(".omni", { recursive: true });
306
- mkdirSync(".omni/capabilities", { recursive: true });
307
- mkdirSync(".omni/state", { recursive: true });
308
- await updateRootGitignore();
309
- let providerIds;
310
- if (providerArg) providerIds = parseProviderArg(providerArg);
311
- else providerIds = await promptForProviders();
312
- await writeEnabledProviders(providerIds);
313
- if (!existsSync("omni.toml")) {
314
- await writeConfig({
315
- project: "my-project",
316
- profiles: {
317
- default: { capabilities: [] },
318
- planning: { capabilities: [] },
319
- coding: { capabilities: [] }
320
- }
321
- });
322
- await setActiveProfile("default");
323
- }
324
- if (!existsSync(".omni/instructions.md")) await Bun.write(".omni/instructions.md", generateInstructionsTemplate());
325
- const config = await loadConfig();
326
- const ctx = {
327
- projectRoot: process.cwd(),
328
- config
329
- };
330
- const allAdapters = getAllAdapters();
331
- const selectedAdapters = allAdapters.filter((a) => providerIds.includes(a.id));
332
- const filesCreated = [];
333
- const filesExisting = [];
334
- for (const adapter of selectedAdapters) if (adapter.init) {
335
- const result = await adapter.init(ctx);
336
- if (result.filesCreated) filesCreated.push(...result.filesCreated);
337
- }
338
- const enabledAdapters = await getEnabledAdapters();
339
- await syncAgentConfiguration({
340
- silent: true,
341
- adapters: enabledAdapters
342
- });
343
- console.log("");
344
- console.log(`✓ OmniDev initialized for ${selectedAdapters.map((a) => a.displayName).join(" and ")}!`);
345
- console.log("");
346
- if (filesCreated.length > 0) {
347
- console.log("📝 Don't forget to add your project description to:");
348
- console.log(" • .omni/instructions.md");
349
- }
350
- if (filesExisting.length > 0) {
351
- console.log("📝 Add this line to your existing file(s):");
352
- for (const file of filesExisting) console.log(` • ${file}: @import .omni/instructions.md`);
353
- }
354
- console.log("");
355
- console.log("💡 Recommendation:");
356
- console.log(" Add provider-specific files to .gitignore:");
357
- console.log(" CLAUDE.md, .claude/, AGENTS.md, .cursor/, .mcp.json");
358
- console.log("");
359
- console.log(" Run 'omnidev capability list' to see available capabilities.");
511
+ console.log("Initializing OmniDev...");
512
+ mkdirSync4(".omni", { recursive: true });
513
+ mkdirSync4(".omni/capabilities", { recursive: true });
514
+ mkdirSync4(".omni/state", { recursive: true });
515
+ await updateRootGitignore();
516
+ let providerIds;
517
+ if (providerArg) {
518
+ providerIds = parseProviderArg(providerArg);
519
+ } else {
520
+ providerIds = await promptForProviders();
521
+ }
522
+ await writeEnabledProviders(providerIds);
523
+ if (!existsSync5("omni.toml")) {
524
+ await writeConfig({
525
+ project: "my-project",
526
+ profiles: {
527
+ default: {
528
+ capabilities: []
529
+ },
530
+ planning: {
531
+ capabilities: []
532
+ },
533
+ coding: {
534
+ capabilities: []
535
+ }
536
+ }
537
+ });
538
+ await setActiveProfile("default");
539
+ }
540
+ if (!existsSync5(".omni/instructions.md")) {
541
+ await Bun.write(".omni/instructions.md", generateInstructionsTemplate());
542
+ }
543
+ const config = await loadConfig();
544
+ const ctx = {
545
+ projectRoot: process.cwd(),
546
+ config
547
+ };
548
+ const allAdapters = getAllAdapters();
549
+ const selectedAdapters = allAdapters.filter((a) => providerIds.includes(a.id));
550
+ const filesCreated = [];
551
+ const filesExisting = [];
552
+ for (const adapter of selectedAdapters) {
553
+ if (adapter.init) {
554
+ const result = await adapter.init(ctx);
555
+ if (result.filesCreated) {
556
+ filesCreated.push(...result.filesCreated);
557
+ }
558
+ }
559
+ }
560
+ const enabledAdapters = await getEnabledAdapters();
561
+ await syncAgentConfiguration({ silent: true, adapters: enabledAdapters });
562
+ console.log("");
563
+ console.log(`✓ OmniDev initialized for ${selectedAdapters.map((a) => a.displayName).join(" and ")}!`);
564
+ console.log("");
565
+ if (filesCreated.length > 0) {
566
+ console.log("\uD83D\uDCDD Don't forget to add your project description to:");
567
+ console.log(" • .omni/instructions.md");
568
+ }
569
+ if (filesExisting.length > 0) {
570
+ console.log("\uD83D\uDCDD Add this line to your existing file(s):");
571
+ for (const file of filesExisting) {
572
+ console.log(` • ${file}: @import .omni/instructions.md`);
573
+ }
574
+ }
575
+ console.log("");
576
+ console.log("\uD83D\uDCA1 Recommendation:");
577
+ console.log(" Add provider-specific files to .gitignore:");
578
+ console.log(" CLAUDE.md, .claude/, AGENTS.md, .cursor/, .mcp.json");
579
+ console.log("");
580
+ console.log(" Run 'omnidev capability list' to see available capabilities.");
360
581
  }
361
- const initCommand = buildCommand({
362
- parameters: {
363
- flags: {},
364
- positional: {
365
- kind: "tuple",
366
- parameters: [{
367
- brief: "AI provider(s): claude-code, cursor, codex, opencode, or comma-separated",
368
- parse: String,
369
- optional: true
370
- }]
371
- }
372
- },
373
- docs: { brief: "Initialize OmniDev in the current project" },
374
- func: runInit
582
+ var initCommand = buildCommand3({
583
+ parameters: {
584
+ flags: {},
585
+ positional: {
586
+ kind: "tuple",
587
+ parameters: [
588
+ {
589
+ brief: "AI provider(s): claude-code, cursor, codex, opencode, or comma-separated",
590
+ parse: String,
591
+ optional: true
592
+ }
593
+ ]
594
+ }
595
+ },
596
+ docs: {
597
+ brief: "Initialize OmniDev in the current project"
598
+ },
599
+ func: runInit
375
600
  });
376
601
  function parseProviderArg(arg) {
377
- const allAdapters = getAllAdapters();
378
- const validIds = new Set(allAdapters.map((a) => a.id));
379
- if (arg.toLowerCase() === "both") return ["claude-code", "cursor"];
380
- const parts = arg.split(",").map((p) => p.trim().toLowerCase());
381
- const result = [];
382
- for (const part of parts) {
383
- let id = part;
384
- if (id === "claude") id = "claude-code";
385
- if (!validIds.has(id)) throw new Error(`Invalid provider: ${part}. Valid providers: ${[...validIds].join(", ")}`);
386
- result.push(id);
387
- }
388
- return result;
602
+ const allAdapters = getAllAdapters();
603
+ const validIds = new Set(allAdapters.map((a) => a.id));
604
+ if (arg.toLowerCase() === "both") {
605
+ return ["claude-code", "cursor"];
606
+ }
607
+ const parts = arg.split(",").map((p) => p.trim().toLowerCase());
608
+ const result = [];
609
+ for (const part of parts) {
610
+ let id = part;
611
+ if (id === "claude") {
612
+ id = "claude-code";
613
+ }
614
+ if (!validIds.has(id)) {
615
+ throw new Error(`Invalid provider: ${part}. Valid providers: ${[...validIds].join(", ")}`);
616
+ }
617
+ result.push(id);
618
+ }
619
+ return result;
389
620
  }
390
621
  async function updateRootGitignore() {
391
- const gitignorePath = ".gitignore";
392
- const entriesToAdd = [".omni/", "omni.local.toml"];
393
- let content = "";
394
- if (existsSync(gitignorePath)) content = await Bun.file(gitignorePath).text();
395
- const lines = content.split("\n");
396
- const missingEntries = entriesToAdd.filter((entry) => !lines.some((line) => line.trim() === entry));
397
- if (missingEntries.length === 0) return;
398
- const needsNewline = content.length > 0 && !content.endsWith("\n");
399
- const section = `${needsNewline ? "\n" : ""}# OmniDev\n${missingEntries.join("\n")}\n`;
400
- await Bun.write(gitignorePath, content + section);
622
+ const gitignorePath = ".gitignore";
623
+ const entriesToAdd = [".omni/", "omni.local.toml"];
624
+ let content = "";
625
+ if (existsSync5(gitignorePath)) {
626
+ content = await Bun.file(gitignorePath).text();
627
+ }
628
+ const lines = content.split(`
629
+ `);
630
+ const missingEntries = entriesToAdd.filter((entry) => !lines.some((line) => line.trim() === entry));
631
+ if (missingEntries.length === 0) {
632
+ return;
633
+ }
634
+ const needsNewline = content.length > 0 && !content.endsWith(`
635
+ `);
636
+ const section = `${needsNewline ? `
637
+ ` : ""}# OmniDev
638
+ ${missingEntries.join(`
639
+ `)}
640
+ `;
641
+ await Bun.write(gitignorePath, content + section);
401
642
  }
402
643
 
403
- //#endregion
404
- //#region src/commands/profile.ts
405
- const listCommand$1 = buildCommand({
406
- docs: { brief: "List available profiles" },
407
- parameters: {},
408
- async func() {
409
- await runProfileList();
410
- }
644
+ // src/commands/profile.ts
645
+ import { existsSync as existsSync6 } from "node:fs";
646
+ import { buildCommand as buildCommand4, buildRouteMap as buildRouteMap2 } from "@stricli/core";
647
+ var listCommand2 = buildCommand4({
648
+ docs: {
649
+ brief: "List available profiles"
650
+ },
651
+ parameters: {},
652
+ async func() {
653
+ await runProfileList();
654
+ }
411
655
  });
412
656
  async function runSetCommand(_flags, profileName) {
413
- await runProfileSet(profileName);
657
+ await runProfileSet(profileName);
414
658
  }
415
- const setCommand = buildCommand({
416
- docs: { brief: "Set the active profile" },
417
- parameters: {
418
- flags: {},
419
- positional: {
420
- kind: "tuple",
421
- parameters: [{
422
- brief: "Profile name",
423
- parse: String
424
- }]
425
- }
426
- },
427
- func: runSetCommand
659
+ var setCommand = buildCommand4({
660
+ docs: {
661
+ brief: "Set the active profile"
662
+ },
663
+ parameters: {
664
+ flags: {},
665
+ positional: {
666
+ kind: "tuple",
667
+ parameters: [
668
+ {
669
+ brief: "Profile name",
670
+ parse: String
671
+ }
672
+ ]
673
+ }
674
+ },
675
+ func: runSetCommand
428
676
  });
429
- const profileRoutes = buildRouteMap({
430
- routes: {
431
- list: listCommand$1,
432
- set: setCommand
433
- },
434
- docs: { brief: "Manage capability profiles" }
677
+ var profileRoutes = buildRouteMap2({
678
+ routes: {
679
+ list: listCommand2,
680
+ set: setCommand
681
+ },
682
+ docs: {
683
+ brief: "Manage capability profiles"
684
+ }
435
685
  });
436
686
  async function runProfileList() {
437
- try {
438
- if (!existsSync("omni.toml")) {
439
- console.log("✗ No config file found");
440
- console.log(" Run: omnidev init");
441
- process.exit(1);
442
- }
443
- const config = await loadConfig();
444
- const activeProfile = await getActiveProfile() ?? config.active_profile ?? "default";
445
- const profiles = config.profiles ?? {};
446
- const profileNames = Object.keys(profiles);
447
- if (profileNames.length === 0) {
448
- console.log("No profiles defined in omni.toml");
449
- console.log("");
450
- console.log("Using default capabilities from omni.toml");
451
- return;
452
- }
453
- console.log("Available Profiles:");
454
- console.log("");
455
- for (const name of profileNames) {
456
- const isActive = name === activeProfile;
457
- const icon = isActive ? "●" : "○";
458
- const profile = profiles[name];
459
- if (profile === void 0) continue;
460
- console.log(`${icon} ${name}${isActive ? " (active)" : ""}`);
461
- const capabilities = resolveEnabledCapabilities(config, name);
462
- if (capabilities.length > 0) console.log(` Capabilities: ${capabilities.join(", ")}`);
463
- else console.log(" Capabilities: none");
464
- console.log("");
465
- }
466
- } catch (error) {
467
- console.error(" Error loading profiles:", error);
468
- process.exit(1);
469
- }
687
+ try {
688
+ if (!existsSync6("omni.toml")) {
689
+ console.log("✗ No config file found");
690
+ console.log(" Run: omnidev init");
691
+ process.exit(1);
692
+ }
693
+ const config = await loadConfig();
694
+ const activeProfile = await getActiveProfile() ?? config.active_profile ?? "default";
695
+ const profiles = config.profiles ?? {};
696
+ const profileNames = Object.keys(profiles);
697
+ if (profileNames.length === 0) {
698
+ console.log("No profiles defined in omni.toml");
699
+ console.log("");
700
+ console.log("Using default capabilities from omni.toml");
701
+ return;
702
+ }
703
+ console.log("Available Profiles:");
704
+ console.log("");
705
+ for (const name of profileNames) {
706
+ const isActive = name === activeProfile;
707
+ const icon = isActive ? "●" : "○";
708
+ const profile = profiles[name];
709
+ if (profile === undefined) {
710
+ continue;
711
+ }
712
+ console.log(`${icon} ${name}${isActive ? " (active)" : ""}`);
713
+ const capabilities = resolveEnabledCapabilities(config, name);
714
+ if (capabilities.length > 0) {
715
+ console.log(` Capabilities: ${capabilities.join(", ")}`);
716
+ } else {
717
+ console.log(" Capabilities: none");
718
+ }
719
+ console.log("");
720
+ }
721
+ } catch (error) {
722
+ console.error("✗ Error loading profiles:", error);
723
+ process.exit(1);
724
+ }
470
725
  }
471
726
  async function runProfileSet(profileName) {
472
- try {
473
- if (!existsSync("omni.toml")) {
474
- console.log("✗ No config file found");
475
- console.log(" Run: omnidev init");
476
- process.exit(1);
477
- }
478
- const config = await loadConfig();
479
- const profiles = config.profiles ?? {};
480
- if (!(profileName in profiles)) {
481
- console.log(`✗ Profile "${profileName}" not found in omni.toml`);
482
- console.log("");
483
- console.log("Available profiles:");
484
- const profileNames = Object.keys(profiles);
485
- if (profileNames.length === 0) console.log(" (none defined)");
486
- else for (const name of profileNames) console.log(` - ${name}`);
487
- process.exit(1);
488
- }
489
- await setActiveProfile(profileName);
490
- console.log(`✓ Active profile set to: ${profileName}`);
491
- console.log("");
492
- const adapters = await getEnabledAdapters();
493
- await syncAgentConfiguration({ adapters });
494
- } catch (error) {
495
- console.error("✗ Error setting profile:", error);
496
- process.exit(1);
497
- }
727
+ try {
728
+ if (!existsSync6("omni.toml")) {
729
+ console.log("✗ No config file found");
730
+ console.log(" Run: omnidev init");
731
+ process.exit(1);
732
+ }
733
+ const config = await loadConfig();
734
+ const profiles = config.profiles ?? {};
735
+ if (!(profileName in profiles)) {
736
+ console.log(`✗ Profile "${profileName}" not found in omni.toml`);
737
+ console.log("");
738
+ console.log("Available profiles:");
739
+ const profileNames = Object.keys(profiles);
740
+ if (profileNames.length === 0) {
741
+ console.log(" (none defined)");
742
+ } else {
743
+ for (const name of profileNames) {
744
+ console.log(` - ${name}`);
745
+ }
746
+ }
747
+ process.exit(1);
748
+ }
749
+ await setActiveProfile(profileName);
750
+ console.log(`✓ Active profile set to: ${profileName}`);
751
+ console.log("");
752
+ const adapters = await getEnabledAdapters();
753
+ await syncAgentConfiguration({ adapters });
754
+ } catch (error) {
755
+ console.error("✗ Error setting profile:", error);
756
+ process.exit(1);
757
+ }
498
758
  }
499
759
 
500
- //#endregion
501
- //#region src/commands/provider.ts
760
+ // src/commands/provider.ts
761
+ import { buildCommand as buildCommand5, buildRouteMap as buildRouteMap3 } from "@stricli/core";
502
762
  async function runProviderList() {
503
- const enabled = await readEnabledProviders();
504
- const allAdapters = getAllAdapters();
505
- console.log("Available providers:");
506
- console.log("");
507
- for (const adapter of allAdapters) {
508
- const isEnabled = enabled.includes(adapter.id);
509
- const marker = isEnabled ? "●" : "○";
510
- console.log(` ${marker} ${adapter.displayName} (${adapter.id})`);
511
- }
512
- console.log("");
513
- console.log("Legend: ● enabled, ○ disabled");
763
+ const enabled = await readEnabledProviders();
764
+ const allAdapters = getAllAdapters();
765
+ console.log("Available providers:");
766
+ console.log("");
767
+ for (const adapter of allAdapters) {
768
+ const isEnabled = enabled.includes(adapter.id);
769
+ const marker = isEnabled ? "●" : "○";
770
+ console.log(` ${marker} ${adapter.displayName} (${adapter.id})`);
771
+ }
772
+ console.log("");
773
+ console.log("Legend: ● enabled, ○ disabled");
514
774
  }
515
775
  async function runProviderEnable(_flags, providerId) {
516
- if (!providerId) {
517
- console.error("Error: Provider ID is required");
518
- console.error("Usage: omnidev provider enable <provider-id>");
519
- process.exit(1);
520
- }
521
- const allAdapters = getAllAdapters();
522
- const adapter = allAdapters.find((a) => a.id === providerId);
523
- if (!adapter) {
524
- console.error(`Error: Unknown provider "${providerId}"`);
525
- console.error("Available providers:");
526
- for (const a of allAdapters) console.error(` - ${a.id}`);
527
- process.exit(1);
528
- }
529
- await enableProvider(providerId);
530
- console.log(`✓ Enabled provider: ${adapter.displayName}`);
531
- const enabledAdapters = await getEnabledAdapters();
532
- await syncAgentConfiguration({
533
- silent: false,
534
- adapters: enabledAdapters
535
- });
776
+ if (!providerId) {
777
+ console.error("Error: Provider ID is required");
778
+ console.error("Usage: omnidev provider enable <provider-id>");
779
+ process.exit(1);
780
+ }
781
+ const allAdapters = getAllAdapters();
782
+ const adapter = allAdapters.find((a) => a.id === providerId);
783
+ if (!adapter) {
784
+ console.error(`Error: Unknown provider "${providerId}"`);
785
+ console.error("Available providers:");
786
+ for (const a of allAdapters) {
787
+ console.error(` - ${a.id}`);
788
+ }
789
+ process.exit(1);
790
+ }
791
+ await enableProvider(providerId);
792
+ console.log(`✓ Enabled provider: ${adapter.displayName}`);
793
+ const enabledAdapters = await getEnabledAdapters();
794
+ await syncAgentConfiguration({ silent: false, adapters: enabledAdapters });
536
795
  }
537
796
  async function runProviderDisable(_flags, providerId) {
538
- if (!providerId) {
539
- console.error("Error: Provider ID is required");
540
- console.error("Usage: omnidev provider disable <provider-id>");
541
- process.exit(1);
542
- }
543
- const allAdapters = getAllAdapters();
544
- const adapter = allAdapters.find((a) => a.id === providerId);
545
- if (!adapter) {
546
- console.error(`Error: Unknown provider "${providerId}"`);
547
- console.error("Available providers:");
548
- for (const a of allAdapters) console.error(` - ${a.id}`);
549
- process.exit(1);
550
- }
551
- await disableProvider(providerId);
552
- console.log(`✓ Disabled provider: ${adapter.displayName}`);
797
+ if (!providerId) {
798
+ console.error("Error: Provider ID is required");
799
+ console.error("Usage: omnidev provider disable <provider-id>");
800
+ process.exit(1);
801
+ }
802
+ const allAdapters = getAllAdapters();
803
+ const adapter = allAdapters.find((a) => a.id === providerId);
804
+ if (!adapter) {
805
+ console.error(`Error: Unknown provider "${providerId}"`);
806
+ console.error("Available providers:");
807
+ for (const a of allAdapters) {
808
+ console.error(` - ${a.id}`);
809
+ }
810
+ process.exit(1);
811
+ }
812
+ await disableProvider(providerId);
813
+ console.log(`✓ Disabled provider: ${adapter.displayName}`);
553
814
  }
554
- const listCommand = buildCommand({
555
- parameters: {
556
- flags: {},
557
- positional: {
558
- kind: "tuple",
559
- parameters: []
560
- }
561
- },
562
- docs: { brief: "List all providers and their status" },
563
- func: runProviderList
815
+ var listCommand3 = buildCommand5({
816
+ parameters: {
817
+ flags: {},
818
+ positional: { kind: "tuple", parameters: [] }
819
+ },
820
+ docs: {
821
+ brief: "List all providers and their status"
822
+ },
823
+ func: runProviderList
564
824
  });
565
- const enableCommand = buildCommand({
566
- parameters: {
567
- flags: {},
568
- positional: {
569
- kind: "tuple",
570
- parameters: [{
571
- brief: "Provider ID to enable",
572
- parse: String,
573
- optional: true
574
- }]
575
- }
576
- },
577
- docs: { brief: "Enable a provider" },
578
- func: runProviderEnable
825
+ var enableCommand2 = buildCommand5({
826
+ parameters: {
827
+ flags: {},
828
+ positional: {
829
+ kind: "tuple",
830
+ parameters: [
831
+ {
832
+ brief: "Provider ID to enable",
833
+ parse: String,
834
+ optional: true
835
+ }
836
+ ]
837
+ }
838
+ },
839
+ docs: {
840
+ brief: "Enable a provider"
841
+ },
842
+ func: runProviderEnable
579
843
  });
580
- const disableCommand = buildCommand({
581
- parameters: {
582
- flags: {},
583
- positional: {
584
- kind: "tuple",
585
- parameters: [{
586
- brief: "Provider ID to disable",
587
- parse: String,
588
- optional: true
589
- }]
590
- }
591
- },
592
- docs: { brief: "Disable a provider" },
593
- func: runProviderDisable
844
+ var disableCommand2 = buildCommand5({
845
+ parameters: {
846
+ flags: {},
847
+ positional: {
848
+ kind: "tuple",
849
+ parameters: [
850
+ {
851
+ brief: "Provider ID to disable",
852
+ parse: String,
853
+ optional: true
854
+ }
855
+ ]
856
+ }
857
+ },
858
+ docs: {
859
+ brief: "Disable a provider"
860
+ },
861
+ func: runProviderDisable
594
862
  });
595
- const providerRoutes = buildRouteMap({
596
- routes: {
597
- list: listCommand,
598
- enable: enableCommand,
599
- disable: disableCommand
600
- },
601
- docs: { brief: "Manage AI provider adapters" }
863
+ var providerRoutes = buildRouteMap3({
864
+ routes: {
865
+ list: listCommand3,
866
+ enable: enableCommand2,
867
+ disable: disableCommand2
868
+ },
869
+ docs: {
870
+ brief: "Manage AI provider adapters"
871
+ }
602
872
  });
603
873
 
604
- //#endregion
605
- //#region src/commands/sync.ts
606
- const syncCommand = buildCommand({
607
- docs: { brief: "Manually sync all capabilities, roles, and instructions" },
608
- parameters: {},
609
- async func() {
610
- return await runSync();
611
- }
874
+ // src/commands/sync.ts
875
+ import { buildCommand as buildCommand6 } from "@stricli/core";
876
+ var syncCommand = buildCommand6({
877
+ docs: {
878
+ brief: "Manually sync all capabilities, roles, and instructions"
879
+ },
880
+ parameters: {},
881
+ async func() {
882
+ return await runSync();
883
+ }
612
884
  });
613
885
  async function runSync() {
614
- console.log("Syncing OmniDev configuration...");
615
- console.log("");
616
- try {
617
- const config = await loadConfig();
618
- const activeProfile = await getActiveProfile() ?? config.active_profile ?? "default";
619
- const adapters = await getEnabledAdapters();
620
- const result = await syncAgentConfiguration({
621
- silent: false,
622
- adapters
623
- });
624
- console.log("");
625
- console.log(" Sync completed successfully!");
626
- console.log("");
627
- console.log(`Profile: ${activeProfile}`);
628
- console.log(`Capabilities: ${result.capabilities.join(", ") || "none"}`);
629
- console.log(`Providers: ${adapters.map((a) => a.displayName).join(", ") || "none"}`);
630
- console.log("");
631
- console.log("Synced components:");
632
- console.log(" • Capability registry");
633
- console.log(" • Capability sync hooks");
634
- console.log(" • .omni/.gitignore");
635
- console.log(" • .omni/instructions.md");
636
- if (adapters.length > 0) console.log(" • Provider-specific files");
637
- } catch (error) {
638
- console.error("");
639
- console.error("✗ Sync failed:");
640
- console.error(` ${error instanceof Error ? error.message : String(error)}`);
641
- process.exit(1);
642
- }
886
+ console.log("Syncing OmniDev configuration...");
887
+ console.log("");
888
+ try {
889
+ const config = await loadConfig();
890
+ const activeProfile = await getActiveProfile() ?? config.active_profile ?? "default";
891
+ const adapters = await getEnabledAdapters();
892
+ const result = await syncAgentConfiguration({ silent: false, adapters });
893
+ console.log("");
894
+ console.log("✓ Sync completed successfully!");
895
+ console.log("");
896
+ console.log(`Profile: ${activeProfile}`);
897
+ console.log(`Capabilities: ${result.capabilities.join(", ") || "none"}`);
898
+ console.log(`Providers: ${adapters.map((a) => a.displayName).join(", ") || "none"}`);
899
+ console.log("");
900
+ console.log("Synced components:");
901
+ console.log(" Capability registry");
902
+ console.log(" • Capability sync hooks");
903
+ console.log(" .omni/.gitignore");
904
+ console.log(" • .omni/instructions.md");
905
+ if (adapters.length > 0) {
906
+ console.log(" • Provider-specific files");
907
+ }
908
+ } catch (error) {
909
+ console.error("");
910
+ console.error("✗ Sync failed:");
911
+ console.error(` ${error instanceof Error ? error.message : String(error)}`);
912
+ process.exit(1);
913
+ }
643
914
  }
644
-
645
- //#endregion
646
- //#region src/lib/dynamic-app.ts
647
- /**
648
- * Build CLI app with dynamically loaded capability commands
649
- */
915
+ // src/lib/dynamic-app.ts
650
916
  async function buildDynamicApp() {
651
- const routes = {
652
- init: initCommand,
653
- doctor: doctorCommand,
654
- sync: syncCommand,
655
- capability: capabilityRoutes,
656
- profile: profileRoutes,
657
- provider: providerRoutes
658
- };
659
- debug("Core routes registered", Object.keys(routes));
660
- if (existsSync(".omni/config.toml")) try {
661
- const capabilityCommands = await loadCapabilityCommands();
662
- debug("Capability commands loaded", {
663
- commands: Object.keys(capabilityCommands),
664
- details: Object.entries(capabilityCommands).map(([name, cmd]) => ({
665
- name,
666
- type: typeof cmd,
667
- constructor: cmd?.constructor?.name,
668
- keys: Object.keys(cmd),
669
- hasGetRoutingTargetForInput: typeof cmd?.getRoutingTargetForInput
670
- }))
671
- });
672
- Object.assign(routes, capabilityCommands);
673
- } catch (error) {
674
- const errorMessage = error instanceof Error ? error.message : String(error);
675
- console.warn(`Warning: Failed to load capability commands: ${errorMessage}`);
676
- debug("Full error loading capabilities", error);
677
- }
678
- debug("Final routes", Object.keys(routes));
679
- const app$1 = buildApplication(buildRouteMap({
680
- routes,
681
- docs: { brief: "OmniDev commands" }
682
- }), {
683
- name: "omnidev",
684
- versionInfo: { currentVersion: "0.1.0" }
685
- });
686
- debug("App built successfully");
687
- return app$1;
917
+ const routes = {
918
+ init: initCommand,
919
+ doctor: doctorCommand,
920
+ sync: syncCommand,
921
+ capability: capabilityRoutes,
922
+ profile: profileRoutes,
923
+ provider: providerRoutes
924
+ };
925
+ debug("Core routes registered", Object.keys(routes));
926
+ if (existsSync7(".omni/config.toml")) {
927
+ try {
928
+ const capabilityCommands = await loadCapabilityCommands();
929
+ debug("Capability commands loaded", {
930
+ commands: Object.keys(capabilityCommands),
931
+ details: Object.entries(capabilityCommands).map(([name, cmd]) => ({
932
+ name,
933
+ type: typeof cmd,
934
+ constructor: cmd?.constructor?.name,
935
+ keys: Object.keys(cmd),
936
+ hasGetRoutingTargetForInput: typeof cmd?.getRoutingTargetForInput
937
+ }))
938
+ });
939
+ Object.assign(routes, capabilityCommands);
940
+ } catch (error) {
941
+ const errorMessage = error instanceof Error ? error.message : String(error);
942
+ console.warn(`Warning: Failed to load capability commands: ${errorMessage}`);
943
+ debug("Full error loading capabilities", error);
944
+ }
945
+ }
946
+ debug("Final routes", Object.keys(routes));
947
+ const app = buildApplication(buildRouteMap4({
948
+ routes,
949
+ docs: {
950
+ brief: "OmniDev commands"
951
+ }
952
+ }), {
953
+ name: "omnidev",
954
+ versionInfo: {
955
+ currentVersion: "0.1.0"
956
+ }
957
+ });
958
+ debug("App built successfully");
959
+ return app;
688
960
  }
689
- /**
690
- * Load CLI commands from enabled capabilities
691
- */
692
961
  async function loadCapabilityCommands() {
693
- const { buildCapabilityRegistry, installCapabilityDependencies } = await import("@omnidev-ai/core");
694
- await installCapabilityDependencies(true);
695
- const registry = await buildCapabilityRegistry();
696
- const capabilities = registry.getAllCapabilities();
697
- const commands = {};
698
- for (const capability of capabilities) try {
699
- debug(`Loading capability '${capability.id}'`, { path: capability.path });
700
- const capabilityExport = await loadCapabilityExport(capability);
701
- debug(`Capability '${capability.id}' export`, {
702
- found: !!capabilityExport,
703
- hasCLICommands: !!capabilityExport?.cliCommands,
704
- cliCommands: capabilityExport?.cliCommands ? Object.keys(capabilityExport.cliCommands) : []
705
- });
706
- if (capabilityExport?.cliCommands) for (const [commandName, command] of Object.entries(capabilityExport.cliCommands)) {
707
- if (commands[commandName]) console.warn(`Command '${commandName}' from capability '${capability.id}' conflicts with existing command. Using '${capability.id}' version.`);
708
- commands[commandName] = command;
709
- debug(`Registered command '${commandName}' from '${capability.id}'`, {
710
- type: typeof command,
711
- constructor: command?.constructor?.name
712
- });
713
- }
714
- } catch (error) {
715
- console.error(`Failed to load capability '${capability.id}':`, error);
716
- }
717
- return commands;
962
+ const { buildCapabilityRegistry, installCapabilityDependencies } = await import("./shared/chunk-7txw9v1e.js");
963
+ await installCapabilityDependencies(true);
964
+ const registry = await buildCapabilityRegistry();
965
+ const capabilities = registry.getAllCapabilities();
966
+ const commands = {};
967
+ for (const capability of capabilities) {
968
+ try {
969
+ debug(`Loading capability '${capability.id}'`, { path: capability.path });
970
+ const capabilityExport = await loadCapabilityExport(capability);
971
+ debug(`Capability '${capability.id}' export`, {
972
+ found: !!capabilityExport,
973
+ hasCLICommands: !!capabilityExport?.cliCommands,
974
+ cliCommands: capabilityExport?.cliCommands ? Object.keys(capabilityExport.cliCommands) : []
975
+ });
976
+ if (capabilityExport?.cliCommands) {
977
+ for (const [commandName, command] of Object.entries(capabilityExport.cliCommands)) {
978
+ if (commands[commandName]) {
979
+ console.warn(`Command '${commandName}' from capability '${capability.id}' conflicts with existing command. Using '${capability.id}' version.`);
980
+ }
981
+ commands[commandName] = command;
982
+ debug(`Registered command '${commandName}' from '${capability.id}'`, {
983
+ type: typeof command,
984
+ constructor: command?.constructor?.name
985
+ });
986
+ }
987
+ }
988
+ } catch (error) {
989
+ console.error(`Failed to load capability '${capability.id}':`, error);
990
+ }
991
+ }
992
+ return commands;
718
993
  }
719
- /**
720
- * Load the default export from a capability
721
- */
722
994
  async function loadCapabilityExport(capability) {
723
- const capabilityPath = join(process.cwd(), capability.path);
724
- const indexPath = join(capabilityPath, "index.ts");
725
- if (!existsSync(indexPath)) {
726
- const jsIndexPath = join(capabilityPath, "index.js");
727
- if (!existsSync(jsIndexPath)) return null;
728
- const module$1 = await import(jsIndexPath);
729
- if (!module$1.default) return null;
730
- return module$1.default;
731
- }
732
- const module = await import(indexPath);
733
- if (!module.default) return null;
734
- const capExport = module.default;
735
- if (capExport.cliCommands) for (const [name, cmd] of Object.entries(capExport.cliCommands)) debug(`CLI command '${name}' structure`, {
736
- type: typeof cmd,
737
- constructor: cmd?.constructor?.name,
738
- keys: Object.keys(cmd),
739
- hasGetRoutingTargetForInput: typeof cmd?.getRoutingTargetForInput,
740
- routesKeys: cmd.routes ? Object.keys(cmd.routes) : void 0
741
- });
742
- return capExport;
995
+ const capabilityPath = join5(process.cwd(), capability.path);
996
+ const indexPath = join5(capabilityPath, "index.ts");
997
+ if (!existsSync7(indexPath)) {
998
+ const jsIndexPath = join5(capabilityPath, "index.js");
999
+ if (!existsSync7(jsIndexPath)) {
1000
+ return null;
1001
+ }
1002
+ const module2 = await import(jsIndexPath);
1003
+ if (!module2.default) {
1004
+ return null;
1005
+ }
1006
+ return module2.default;
1007
+ }
1008
+ const module = await import(indexPath);
1009
+ if (!module.default) {
1010
+ return null;
1011
+ }
1012
+ const capExport = module.default;
1013
+ if (capExport.cliCommands) {
1014
+ for (const [name, cmd] of Object.entries(capExport.cliCommands)) {
1015
+ debug(`CLI command '${name}' structure`, {
1016
+ type: typeof cmd,
1017
+ constructor: cmd?.constructor?.name,
1018
+ keys: Object.keys(cmd),
1019
+ hasGetRoutingTargetForInput: typeof cmd?.getRoutingTargetForInput,
1020
+ routesKeys: cmd.routes ? Object.keys(cmd.routes) : undefined
1021
+ });
1022
+ }
1023
+ }
1024
+ return capExport;
743
1025
  }
744
1026
 
745
- //#endregion
746
- //#region src/index.ts
747
- const app = await buildDynamicApp();
1027
+ // src/index.ts
1028
+ var app = await buildDynamicApp();
748
1029
  debug("CLI startup", {
749
- arguments: process.argv.slice(2),
750
- cwd: process.cwd()
1030
+ arguments: process.argv.slice(2),
1031
+ cwd: process.cwd()
751
1032
  });
752
1033
  try {
753
- run(app, process.argv.slice(2), { process });
1034
+ run(app, process.argv.slice(2), {
1035
+ process
1036
+ });
754
1037
  } catch (error) {
755
- if (error instanceof Error) if (error.message.includes("getRoutingTargetForInput") || error.stack?.includes("@stricli/core")) {
756
- const args = process.argv.slice(2);
757
- console.error(`\nError: Command not found or invalid usage.`);
758
- if (args.length > 0) {
759
- console.error(`\nYou tried to run: omnidev ${args.join(" ")}`);
760
- console.error("\nThis could mean:");
761
- console.error(" 1. The command doesn't exist");
762
- console.error(" 2. A required capability is not enabled");
763
- console.error(" 3. Invalid command syntax\n");
764
- }
765
- console.error("Run 'omnidev --help' to see available commands");
766
- console.error("\nTo enable capabilities, run: omnidev capability enable <name>");
767
- console.error("To see enabled capabilities: omnidev capability list");
768
- process.exit(1);
769
- } else throw error;
1038
+ if (error instanceof Error) {
1039
+ if (error.message.includes("getRoutingTargetForInput") || error.stack?.includes("@stricli/core")) {
1040
+ const args = process.argv.slice(2);
1041
+ console.error(`
1042
+ Error: Command not found or invalid usage.`);
1043
+ if (args.length > 0) {
1044
+ console.error(`
1045
+ You tried to run: omnidev ${args.join(" ")}`);
1046
+ console.error(`
1047
+ This could mean:`);
1048
+ console.error(" 1. The command doesn't exist");
1049
+ console.error(" 2. A required capability is not enabled");
1050
+ console.error(` 3. Invalid command syntax
1051
+ `);
1052
+ }
1053
+ console.error("Run 'omnidev --help' to see available commands");
1054
+ console.error(`
1055
+ To enable capabilities, run: omnidev capability enable <name>`);
1056
+ console.error("To see enabled capabilities: omnidev capability list");
1057
+ process.exit(1);
1058
+ } else {
1059
+ throw error;
1060
+ }
1061
+ }
770
1062
  }
771
-
772
- //#endregion