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