@omnidev-ai/core 0.3.0 → 0.4.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 (64) hide show
  1. package/dist/index.d.ts +889 -0
  2. package/dist/index.js +2173 -0
  3. package/dist/test-utils/index.d.ts +142 -0
  4. package/dist/test-utils/index.js +261 -0
  5. package/package.json +16 -6
  6. package/src/capability/AGENTS.md +0 -58
  7. package/src/capability/commands.test.ts +0 -410
  8. package/src/capability/commands.ts +0 -72
  9. package/src/capability/docs.test.ts +0 -192
  10. package/src/capability/docs.ts +0 -48
  11. package/src/capability/index.ts +0 -20
  12. package/src/capability/loader.test.ts +0 -668
  13. package/src/capability/loader.ts +0 -431
  14. package/src/capability/registry.test.ts +0 -455
  15. package/src/capability/registry.ts +0 -55
  16. package/src/capability/rules.test.ts +0 -135
  17. package/src/capability/rules.ts +0 -135
  18. package/src/capability/skills.test.ts +0 -312
  19. package/src/capability/skills.ts +0 -58
  20. package/src/capability/sources.test.ts +0 -439
  21. package/src/capability/sources.ts +0 -998
  22. package/src/capability/subagents.test.ts +0 -474
  23. package/src/capability/subagents.ts +0 -105
  24. package/src/capability/wrapping-integration.test.ts +0 -412
  25. package/src/capability/yaml-parser.ts +0 -81
  26. package/src/config/AGENTS.md +0 -46
  27. package/src/config/capabilities.ts +0 -54
  28. package/src/config/env.test.ts +0 -270
  29. package/src/config/env.ts +0 -96
  30. package/src/config/index.ts +0 -6
  31. package/src/config/loader.test.ts +0 -198
  32. package/src/config/loader.ts +0 -207
  33. package/src/config/parser.test.ts +0 -256
  34. package/src/config/parser.ts +0 -55
  35. package/src/config/profiles.test.ts +0 -222
  36. package/src/config/profiles.ts +0 -75
  37. package/src/config/provider.test.ts +0 -66
  38. package/src/config/provider.ts +0 -55
  39. package/src/debug.ts +0 -20
  40. package/src/index.test.ts +0 -26
  41. package/src/index.ts +0 -37
  42. package/src/mcp-json/index.ts +0 -1
  43. package/src/mcp-json/manager.test.ts +0 -310
  44. package/src/mcp-json/manager.ts +0 -106
  45. package/src/state/active-profile.test.ts +0 -117
  46. package/src/state/active-profile.ts +0 -41
  47. package/src/state/index.ts +0 -3
  48. package/src/state/manifest.test.ts +0 -411
  49. package/src/state/manifest.ts +0 -137
  50. package/src/state/providers.test.ts +0 -125
  51. package/src/state/providers.ts +0 -69
  52. package/src/sync.ts +0 -288
  53. package/src/templates/agents.test.ts +0 -23
  54. package/src/templates/agents.ts +0 -14
  55. package/src/templates/claude.test.ts +0 -48
  56. package/src/templates/claude.ts +0 -57
  57. package/src/test-utils/helpers.test.ts +0 -214
  58. package/src/test-utils/helpers.ts +0 -284
  59. package/src/test-utils/index.ts +0 -34
  60. package/src/test-utils/mocks.test.ts +0 -83
  61. package/src/test-utils/mocks.ts +0 -101
  62. package/src/types/capability-export.ts +0 -157
  63. package/src/types/index.test.ts +0 -28
  64. package/src/types/index.ts +0 -314
@@ -0,0 +1,889 @@
1
+ import { buildCommand, buildRouteMap } from "@stricli/core";
2
+
3
+ //#region src/types/capability-export.d.ts
4
+
5
+ /**
6
+ * Capability Export Types
7
+ *
8
+ * These types define the structure that capabilities use to export their features.
9
+ * Capabilities should import these types from @omnidev-ai/core and use them in their index.ts.
10
+ */
11
+ /**
12
+ * File content structure for programmatic file creation
13
+ */
14
+ interface FileContent {
15
+ /** File name (relative path within capability) */
16
+ name: string;
17
+ /** File content */
18
+ content: string;
19
+ }
20
+ /**
21
+ * Documentation export structure
22
+ */
23
+ interface DocExport {
24
+ /** Document title */
25
+ title: string;
26
+ /** Markdown content */
27
+ content: string;
28
+ }
29
+ /**
30
+ * Skill export structure
31
+ */
32
+ interface SkillExport {
33
+ /** SKILL.md content (markdown with YAML frontmatter) */
34
+ skillMd: string;
35
+ /** Optional: Reference files to create (files the skill needs access to) */
36
+ references?: FileContent[];
37
+ /** Optional: Additional files to create (templates, examples, etc.) */
38
+ additionalFiles?: FileContent[];
39
+ }
40
+ /**
41
+ * Subagent export structure
42
+ *
43
+ * Defines a subagent that Claude can delegate tasks to.
44
+ * Uses YAML frontmatter in markdown format for configuration.
45
+ *
46
+ * @example
47
+ * ```typescript
48
+ * const codeReviewer: SubagentExport = {
49
+ * subagentMd: `---
50
+ * name: code-reviewer
51
+ * description: Reviews code for quality and best practices
52
+ * tools: Read, Glob, Grep
53
+ * model: sonnet
54
+ * ---
55
+ *
56
+ * You are a code reviewer. When invoked, analyze the code and provide
57
+ * specific, actionable feedback on quality, security, and best practices.`
58
+ * };
59
+ * ```
60
+ */
61
+ interface SubagentExport {
62
+ /** SUBAGENT.md content (markdown with YAML frontmatter) */
63
+ subagentMd: string;
64
+ }
65
+ /**
66
+ * Slash command export structure
67
+ *
68
+ * Defines a slash command that can be invoked in Claude Code.
69
+ * Uses YAML frontmatter in markdown format for configuration.
70
+ *
71
+ * @example
72
+ * ```typescript
73
+ * const fixIssue: CommandExport = {
74
+ * commandMd: `---
75
+ * name: fix-issue
76
+ * description: Fix a GitHub issue following coding standards
77
+ * allowed-tools: Bash(git add:*), Bash(git commit:*)
78
+ * ---
79
+ *
80
+ * Fix issue #$ARGUMENTS following our coding standards.
81
+ *
82
+ * 1. Read the issue details
83
+ * 2. Implement the fix
84
+ * 3. Write tests
85
+ * 4. Create a commit`
86
+ * };
87
+ * ```
88
+ */
89
+ interface CommandExport {
90
+ /** COMMAND.md content (markdown with YAML frontmatter) */
91
+ commandMd: string;
92
+ }
93
+ /**
94
+ * Complete capability export structure
95
+ *
96
+ * Capabilities export this as their default export from index.ts.
97
+ * All content fields are OPTIONAL and PROGRAMMATIC.
98
+ * Capabilities can also provide content via static files in their directory.
99
+ * Both approaches are supported and will be merged during sync.
100
+ *
101
+ * @example
102
+ * ```typescript
103
+ * // Static files approach - just export CLI commands
104
+ * export default {
105
+ * cliCommands: { mycap: myRoutes },
106
+ * gitignore: ["mycap/"],
107
+ * sync
108
+ * } satisfies CapabilityExport;
109
+ * ```
110
+ *
111
+ * @example
112
+ * ```typescript
113
+ * // Programmatic approach - generate content dynamically
114
+ * export default {
115
+ * cliCommands: { mycap: myRoutes },
116
+ * docs: [{ title: "Guide", content: "# Guide\n..." }],
117
+ * rules: ["# Rule content..."],
118
+ * skills: [{ skillMd: "...", references: [...] }],
119
+ * gitignore: ["mycap/"],
120
+ * sync
121
+ * } satisfies CapabilityExport;
122
+ * ```
123
+ */
124
+ interface CapabilityExport {
125
+ /** CLI commands provided by this capability */
126
+ cliCommands?: Record<string, unknown>;
127
+ /** Documentation (programmatic - optional, can also use docs/ directory) */
128
+ docs?: DocExport[];
129
+ /** Rules (programmatic - optional, can also use rules/ directory) */
130
+ rules?: string[];
131
+ /** Skills (programmatic - optional, can also use skills/ directory) */
132
+ skills?: SkillExport[];
133
+ /** Subagents (programmatic - optional, can also use subagents/ directory) */
134
+ subagents?: SubagentExport[];
135
+ /** Commands (programmatic - optional, can also use commands/ directory) */
136
+ commands?: CommandExport[];
137
+ /** Gitignore patterns */
138
+ gitignore?: string[];
139
+ /** Custom sync hook function */
140
+ sync?: () => Promise<void>;
141
+ /** Additional exports for extensibility */
142
+ [key: string]: unknown;
143
+ }
144
+ //#endregion
145
+ //#region src/types/index.d.ts
146
+ interface CapabilityMetadata {
147
+ id: string;
148
+ name: string;
149
+ version: string;
150
+ description: string;
151
+ /** Optional author information */
152
+ author?: {
153
+ name?: string;
154
+ email?: string;
155
+ };
156
+ /** Optional metadata about the capability author and source */
157
+ metadata?: {
158
+ author?: string;
159
+ repository?: string;
160
+ license?: string;
161
+ /** True if this capability was auto-generated by wrapping a skills repo */
162
+ wrapped?: boolean;
163
+ /** For wrapped capabilities: the full commit hash */
164
+ commit?: string;
165
+ /** True if this capability was auto-generated from omni.toml [mcps] section */
166
+ generated_from_omni_toml?: boolean;
167
+ };
168
+ }
169
+ interface CapabilityExports {
170
+ module?: string;
171
+ gitignore?: string[];
172
+ }
173
+ interface EnvDeclaration {
174
+ required?: boolean;
175
+ secret?: boolean;
176
+ default?: string;
177
+ }
178
+ interface SyncConfig {
179
+ on_sync?: string;
180
+ }
181
+ interface CliConfig {
182
+ commands?: string[];
183
+ }
184
+ interface CapabilityConfig {
185
+ capability: CapabilityMetadata;
186
+ exports?: CapabilityExports;
187
+ env?: Record<string, EnvDeclaration | Record<string, never>>;
188
+ mcp?: McpConfig;
189
+ sync?: SyncConfig;
190
+ cli?: CliConfig;
191
+ }
192
+ type McpTransport = "stdio" | "sse" | "http";
193
+ interface McpToolSchema {
194
+ name: string;
195
+ description: string;
196
+ inputSchema: Record<string, unknown>;
197
+ }
198
+ interface McpConfig {
199
+ command: string;
200
+ args?: string[];
201
+ env?: Record<string, string>;
202
+ cwd?: string;
203
+ transport?: McpTransport;
204
+ tools?: McpToolSchema[];
205
+ }
206
+ interface Skill {
207
+ name: string;
208
+ description: string;
209
+ instructions: string;
210
+ capabilityId: string;
211
+ }
212
+ interface Rule {
213
+ name: string;
214
+ content: string;
215
+ capabilityId: string;
216
+ }
217
+ interface Doc {
218
+ name: string;
219
+ content: string;
220
+ capabilityId: string;
221
+ }
222
+ type SubagentModel = "sonnet" | "opus" | "haiku" | "inherit";
223
+ type SubagentPermissionMode = "default" | "acceptEdits" | "dontAsk" | "bypassPermissions" | "plan";
224
+ interface SubagentHookConfig {
225
+ matcher?: string;
226
+ hooks: {
227
+ type: "command";
228
+ command: string;
229
+ }[];
230
+ }
231
+ interface SubagentHooks {
232
+ PreToolUse?: SubagentHookConfig[];
233
+ PostToolUse?: SubagentHookConfig[];
234
+ Stop?: SubagentHookConfig[];
235
+ }
236
+ interface Subagent {
237
+ /** Unique identifier using lowercase letters and hyphens */
238
+ name: string;
239
+ /** When Claude should delegate to this subagent */
240
+ description: string;
241
+ /** System prompt that guides the subagent's behavior */
242
+ systemPrompt: string;
243
+ /** Tools the subagent can use (inherits all if omitted) */
244
+ tools?: string[];
245
+ /** Tools to deny (removed from inherited or specified list) */
246
+ disallowedTools?: string[];
247
+ /** Model to use: sonnet, opus, haiku, or inherit */
248
+ model?: SubagentModel;
249
+ /** Permission mode for the subagent */
250
+ permissionMode?: SubagentPermissionMode;
251
+ /** Skills to load into the subagent's context at startup */
252
+ skills?: string[];
253
+ /** Lifecycle hooks scoped to this subagent */
254
+ hooks?: SubagentHooks;
255
+ /** Capability that provides this subagent */
256
+ capabilityId: string;
257
+ }
258
+ interface Command {
259
+ /** Command name (used as /command-name) */
260
+ name: string;
261
+ /** Brief description of what this command does */
262
+ description: string;
263
+ /** Optional allowed tools specification (e.g., "Bash(git add:*), Bash(git status:*)") */
264
+ allowedTools?: string;
265
+ /** Command prompt (markdown content with support for $ARGUMENTS, $1, $2, !`commands`, @files) */
266
+ prompt: string;
267
+ /** Capability that provides this command */
268
+ capabilityId: string;
269
+ }
270
+ type CapabilitySourceType = "local" | "git";
271
+ /** Configuration for a Git-sourced capability */
272
+ interface GitCapabilitySourceConfig {
273
+ /** Source URL or shorthand (e.g., "github:user/repo", "git@github.com:...") */
274
+ source: string;
275
+ /** Git ref to checkout: tag, branch, or commit hash */
276
+ ref?: string;
277
+ /** Subdirectory within the repo containing the capability */
278
+ path?: string;
279
+ }
280
+ /** Combined type for all capability source configurations */
281
+ type CapabilitySourceConfig = string | GitCapabilitySourceConfig;
282
+ /** Lock file entry for a capability (version tracking) */
283
+ interface CapabilityLockEntry {
284
+ /** Original source reference */
285
+ source: string;
286
+ /** Version from capability.toml or package.json */
287
+ version: string;
288
+ /** For git sources: exact commit hash */
289
+ commit?: string;
290
+ /** Pinned ref if specified */
291
+ ref?: string;
292
+ /** Last update timestamp (ISO 8601) */
293
+ updated_at: string;
294
+ }
295
+ /** Lock file structure (omni.lock.toml at project root) */
296
+ interface CapabilitiesLockFile {
297
+ capabilities: Record<string, CapabilityLockEntry>;
298
+ }
299
+ /** Capabilities configuration section in omni.toml */
300
+ interface CapabilitiesConfig {
301
+ /** List of enabled capability IDs */
302
+ enable?: string[];
303
+ /** List of disabled capability IDs */
304
+ disable?: string[];
305
+ /** Capability sources: id -> source string or full config (git or file) */
306
+ sources?: Record<string, CapabilitySourceConfig>;
307
+ }
308
+ interface ProfileConfig {
309
+ capabilities?: string[];
310
+ }
311
+ interface OmniConfig {
312
+ project?: string;
313
+ active_profile?: string;
314
+ always_enabled_capabilities?: string[];
315
+ env?: Record<string, string>;
316
+ profiles?: Record<string, ProfileConfig>;
317
+ providers?: {
318
+ enabled?: Provider[];
319
+ };
320
+ /** Capabilities configuration (enable/disable, sources) */
321
+ capabilities?: CapabilitiesConfig;
322
+ /** MCP server definitions that auto-generate capabilities */
323
+ mcps?: Record<string, McpConfig>;
324
+ }
325
+ type Provider = "claude" | "codex" | "claude-code" | "cursor" | "opencode";
326
+ interface ProviderConfig {
327
+ provider?: Provider;
328
+ providers?: Provider[];
329
+ }
330
+ declare function getActiveProviders(config: ProviderConfig): Provider[];
331
+ /** Runtime info about where a capability came from */
332
+ interface CapabilitySource {
333
+ type: CapabilitySourceType;
334
+ /** For git-sourced capabilities: the source URL/shorthand */
335
+ gitSource?: string;
336
+ /** For git-sourced capabilities: the pinned ref if any */
337
+ ref?: string;
338
+ /** For git-sourced capabilities: the current commit hash */
339
+ commit?: string;
340
+ /** Version from capability.toml or package.json */
341
+ version?: string;
342
+ }
343
+ interface LoadedCapability {
344
+ id: string;
345
+ path: string;
346
+ config: CapabilityConfig;
347
+ skills: Skill[];
348
+ rules: Rule[];
349
+ docs: Doc[];
350
+ subagents: Subagent[];
351
+ commands: Command[];
352
+ typeDefinitions?: string;
353
+ gitignore?: string[];
354
+ exports: Record<string, unknown>;
355
+ /** Where this capability comes from */
356
+ source?: CapabilitySource;
357
+ }
358
+ type ProviderId = Provider | (string & {});
359
+ interface SyncBundle {
360
+ capabilities: LoadedCapability[];
361
+ skills: Skill[];
362
+ rules: Rule[];
363
+ docs: Doc[];
364
+ commands: Command[];
365
+ subagents: Subagent[];
366
+ instructionsPath: string;
367
+ instructionsContent: string;
368
+ }
369
+ interface ProviderContext {
370
+ projectRoot: string;
371
+ config: OmniConfig;
372
+ activeProfile?: string;
373
+ }
374
+ interface ProviderInitResult {
375
+ filesCreated?: string[];
376
+ message?: string;
377
+ }
378
+ interface ProviderSyncResult {
379
+ filesWritten: string[];
380
+ filesDeleted: string[];
381
+ }
382
+ interface ProviderManifest {
383
+ files: string[];
384
+ lastSync: string;
385
+ }
386
+ interface ProviderAdapter {
387
+ id: ProviderId;
388
+ displayName: string;
389
+ init?(ctx: ProviderContext): Promise<ProviderInitResult>;
390
+ sync(bundle: SyncBundle, ctx: ProviderContext): Promise<ProviderSyncResult>;
391
+ cleanup?(manifest: ProviderManifest, ctx: ProviderContext): Promise<void>;
392
+ }
393
+ //#endregion
394
+ //#region src/capability/commands.d.ts
395
+ /**
396
+ * Load commands from a commands/ directory of a capability.
397
+ * Each command is a COMMAND.md file in its own subdirectory.
398
+ */
399
+ declare function loadCommands(capabilityPath: string, capabilityId: string): Promise<Command[]>;
400
+ //#endregion
401
+ //#region src/capability/docs.d.ts
402
+ /**
403
+ * Load documentation from a capability directory
404
+ * Loads both definition.md and all files from docs/ directory
405
+ * @param capabilityPath Path to the capability directory
406
+ * @param capabilityId ID of the capability
407
+ * @returns Array of Doc objects
408
+ */
409
+ declare function loadDocs(capabilityPath: string, capabilityId: string): Promise<Doc[]>;
410
+ //#endregion
411
+ //#region src/capability/loader.d.ts
412
+ /**
413
+ * Discovers capabilities by scanning the .omni/capabilities directory.
414
+ * A directory is considered a capability if it contains a capability.toml file.
415
+ *
416
+ * @returns Array of capability directory paths
417
+ */
418
+ declare function discoverCapabilities(): Promise<string[]>;
419
+ /**
420
+ * Loads and parses a capability configuration file.
421
+ * Validates required fields.
422
+ *
423
+ * @param capabilityPath - Path to the capability directory
424
+ * @returns Parsed capability configuration
425
+ * @throws Error if the config is invalid
426
+ */
427
+ declare function loadCapabilityConfig(capabilityPath: string): Promise<CapabilityConfig>;
428
+ /**
429
+ * Loads a complete capability including config, skills, rules, docs, and exports.
430
+ * Validates environment requirements before loading.
431
+ *
432
+ * @param capabilityPath - Path to the capability directory
433
+ * @param env - Environment variables to validate against
434
+ * @returns Fully loaded capability
435
+ * @throws Error if validation fails or loading errors occur
436
+ */
437
+ declare function loadCapability(capabilityPath: string, env: Record<string, string>): Promise<LoadedCapability>;
438
+ //#endregion
439
+ //#region src/capability/registry.d.ts
440
+ /**
441
+ * Registry of loaded capabilities with helper functions.
442
+ */
443
+ interface CapabilityRegistry {
444
+ capabilities: Map<string, LoadedCapability>;
445
+ getCapability(id: string): LoadedCapability | undefined;
446
+ getAllCapabilities(): LoadedCapability[];
447
+ getAllSkills(): Skill[];
448
+ getAllRules(): Rule[];
449
+ getAllDocs(): Doc[];
450
+ }
451
+ /**
452
+ * Builds a capability registry by discovering, loading, and filtering capabilities.
453
+ * Only enabled capabilities (based on active profile) are included.
454
+ *
455
+ * @returns Capability registry with helper functions
456
+ */
457
+ declare function buildCapabilityRegistry(): Promise<CapabilityRegistry>;
458
+ //#endregion
459
+ //#region src/capability/rules.d.ts
460
+ /**
461
+ * Load rules from a capability's rules/ directory
462
+ * @param capabilityPath Path to the capability directory
463
+ * @param capabilityId ID of the capability
464
+ * @returns Array of Rule objects
465
+ */
466
+ declare function loadRules(capabilityPath: string, capabilityId: string): Promise<Rule[]>;
467
+ /**
468
+ * Write aggregated rules and docs to .omni/instructions.md
469
+ * Updates the generated section between markers while preserving user content
470
+ * @param rules Array of rules from all enabled capabilities
471
+ * @param docs Array of docs from all enabled capabilities
472
+ */
473
+ declare function writeRules(rules: Rule[], docs?: Doc[]): Promise<void>;
474
+ //#endregion
475
+ //#region src/capability/skills.d.ts
476
+ declare function loadSkills(capabilityPath: string, capabilityId: string): Promise<Skill[]>;
477
+ //#endregion
478
+ //#region src/capability/sources.d.ts
479
+ interface FetchResult {
480
+ id: string;
481
+ path: string;
482
+ version: string;
483
+ /** Git commit hash */
484
+ commit?: string;
485
+ updated: boolean;
486
+ wrapped: boolean;
487
+ }
488
+ interface SourceUpdateInfo {
489
+ id: string;
490
+ source: string;
491
+ currentVersion: string;
492
+ latestVersion: string;
493
+ hasUpdate: boolean;
494
+ }
495
+ /**
496
+ * Check if a source string is a git source
497
+ */
498
+
499
+ /**
500
+ * Parse a capability source string or config into normalized form
501
+ * Returns a GitCapabilitySourceConfig
502
+ */
503
+ declare function parseSourceConfig(source: CapabilitySourceConfig): GitCapabilitySourceConfig;
504
+ /**
505
+ * Convert source to a git-cloneable URL
506
+ */
507
+ declare function sourceToGitUrl(source: string): string;
508
+ /**
509
+ * Get the path where a capability source will be stored
510
+ */
511
+ declare function getSourceCapabilityPath(id: string): string;
512
+ /**
513
+ * Get the lock file path
514
+ */
515
+ declare function getLockFilePath(): string;
516
+ /**
517
+ * Load the capabilities lock file
518
+ */
519
+ declare function loadLockFile(): Promise<CapabilitiesLockFile>;
520
+ /**
521
+ * Save the capabilities lock file
522
+ */
523
+ declare function saveLockFile(lockFile: CapabilitiesLockFile): Promise<void>;
524
+ /**
525
+ * Plugin metadata from .claude-plugin/plugin.json
526
+ */
527
+
528
+ /**
529
+ * Discover content in a wrapped repository
530
+ */
531
+ interface DiscoveredContent {
532
+ skills: Array<{
533
+ name: string;
534
+ path: string;
535
+ isFolder: boolean;
536
+ }>;
537
+ agents: Array<{
538
+ name: string;
539
+ path: string;
540
+ isFolder: boolean;
541
+ }>;
542
+ commands: Array<{
543
+ name: string;
544
+ path: string;
545
+ isFolder: boolean;
546
+ }>;
547
+ rulesDir: string | null;
548
+ docsDir: string | null;
549
+ }
550
+ /**
551
+ * Fetch a single capability source from git
552
+ */
553
+ declare function fetchCapabilitySource(id: string, sourceConfig: CapabilitySourceConfig, options?: {
554
+ silent?: boolean;
555
+ }): Promise<FetchResult>;
556
+ /**
557
+ * Generate synthetic capabilities for MCP definitions in omni.toml
558
+ */
559
+
560
+ /**
561
+ * Fetch all capability sources from config
562
+ */
563
+ declare function fetchAllCapabilitySources(config: OmniConfig, options?: {
564
+ silent?: boolean;
565
+ force?: boolean;
566
+ }): Promise<FetchResult[]>;
567
+ /**
568
+ * Check for available updates without applying them
569
+ */
570
+ declare function checkForUpdates(config: OmniConfig): Promise<SourceUpdateInfo[]>;
571
+ //#endregion
572
+ //#region src/capability/subagents.d.ts
573
+ /**
574
+ * Load subagents from the subagents/ directory of a capability.
575
+ * Each subagent is a SUBAGENT.md file in its own subdirectory.
576
+ */
577
+ declare function loadSubagents(capabilityPath: string, capabilityId: string): Promise<Subagent[]>;
578
+ //#endregion
579
+ //#region src/config/capabilities.d.ts
580
+ /**
581
+ * Get enabled capabilities for the active profile
582
+ * Includes both profile-specific and always-enabled capabilities
583
+ * @returns Array of enabled capability IDs
584
+ */
585
+ declare function getEnabledCapabilities(): Promise<string[]>;
586
+ /**
587
+ * Enable a capability by adding it to the active profile's capabilities list
588
+ * @param capabilityId - The ID of the capability to enable
589
+ */
590
+ declare function enableCapability(capabilityId: string): Promise<void>;
591
+ /**
592
+ * Disable a capability by removing it from the active profile's capabilities list
593
+ * @param capabilityId - The ID of the capability to disable
594
+ */
595
+ declare function disableCapability(capabilityId: string): Promise<void>;
596
+ //#endregion
597
+ //#region src/config/env.d.ts
598
+ /**
599
+ * Load environment variables from .omni/.env file and merge with process.env.
600
+ * Process environment variables take precedence over file values.
601
+ *
602
+ * @returns Merged environment variables
603
+ */
604
+ declare function loadEnvironment(): Promise<Record<string, string>>;
605
+ /**
606
+ * Validate that all required environment variables are present.
607
+ * Checks declarations from capability config and throws descriptive errors for missing vars.
608
+ *
609
+ * @param declarations - Environment variable declarations from capability.toml
610
+ * @param env - Loaded environment variables
611
+ * @param capabilityId - ID of the capability being validated
612
+ * @throws Error if required environment variables are missing
613
+ */
614
+ declare function validateEnv(declarations: Record<string, EnvDeclaration | Record<string, never>>, env: Record<string, string | undefined>, capabilityId: string): void;
615
+ /**
616
+ * Check if an environment variable should be treated as a secret.
617
+ * Secrets should be masked in logs and error messages.
618
+ *
619
+ * @param key - Environment variable name
620
+ * @param declarations - Environment variable declarations from capability.toml
621
+ * @returns true if the variable is marked as secret
622
+ */
623
+ declare function isSecretEnvVar(key: string, declarations: Record<string, EnvDeclaration | Record<string, never>>): boolean;
624
+ //#endregion
625
+ //#region src/config/loader.d.ts
626
+ /**
627
+ * Load and merge config and local configuration files
628
+ * @returns Merged OmniConfig object
629
+ *
630
+ * Reads omni.toml (main config) and omni.local.toml (local overrides).
631
+ * Local config takes precedence over main config. Missing files are treated as empty configs.
632
+ */
633
+ declare function loadConfig(): Promise<OmniConfig>;
634
+ /**
635
+ * Write config to omni.toml at project root
636
+ * @param config - The config object to write
637
+ */
638
+ declare function writeConfig(config: OmniConfig): Promise<void>;
639
+ //#endregion
640
+ //#region src/config/parser.d.ts
641
+ /**
642
+ * Parse a TOML string into an OmniConfig object
643
+ * @param tomlContent - The TOML content to parse
644
+ * @returns Parsed OmniConfig object
645
+ * @throws Error if TOML is invalid
646
+ */
647
+ declare function parseOmniConfig(tomlContent: string): OmniConfig;
648
+ /**
649
+ * Parse a TOML string into a CapabilityConfig object
650
+ * @param tomlContent - The TOML content to parse
651
+ * @returns Parsed CapabilityConfig object
652
+ * @throws Error if TOML is invalid or required fields are missing
653
+ */
654
+ declare function parseCapabilityConfig(tomlContent: string): CapabilityConfig;
655
+ //#endregion
656
+ //#region src/config/profiles.d.ts
657
+ /**
658
+ * Gets the name of the currently active profile.
659
+ * Reads from state file first, falls back to config.toml for backwards compatibility.
660
+ * Returns null if no profile is set.
661
+ */
662
+ declare function getActiveProfile(): Promise<string | null>;
663
+ /**
664
+ * Sets the active profile by writing to state file.
665
+ * @param name - The name of the profile to activate
666
+ */
667
+ declare function setActiveProfile(name: string): Promise<void>;
668
+ /**
669
+ * Resolves the enabled capabilities for a given profile
670
+ *
671
+ * @param config - The merged OmniConfig
672
+ * @param profileName - The name of the profile to apply, or null to use active
673
+ * @returns Array of capability IDs that should be enabled
674
+ */
675
+ declare function resolveEnabledCapabilities(config: OmniConfig, profileName: string | null): string[];
676
+ /**
677
+ * Load a specific profile configuration from config.toml
678
+ * @param profileName - Name of the profile to load
679
+ * @returns ProfileConfig if found, undefined otherwise
680
+ */
681
+ declare function loadProfileConfig(profileName: string): Promise<ProfileConfig | undefined>;
682
+ /**
683
+ * Set a profile configuration in config.toml
684
+ * @param profileName - Name of the profile to set
685
+ * @param profileConfig - Profile configuration
686
+ */
687
+ declare function setProfile(profileName: string, profileConfig: ProfileConfig): Promise<void>;
688
+ //#endregion
689
+ //#region src/config/provider.d.ts
690
+ declare function loadProviderConfig(): Promise<ProviderConfig>;
691
+ declare function writeProviderConfig(config: ProviderConfig): Promise<void>;
692
+ declare function parseProviderFlag(flag: string): Provider[];
693
+ //#endregion
694
+ //#region src/state/manifest.d.ts
695
+ /**
696
+ * Resources provided by a single capability
697
+ */
698
+ interface CapabilityResources {
699
+ skills: string[];
700
+ rules: string[];
701
+ commands: string[];
702
+ subagents: string[];
703
+ mcps: string[];
704
+ }
705
+ /**
706
+ * Manifest tracking which resources each capability provides.
707
+ * Used to clean up stale resources when capabilities are disabled.
708
+ */
709
+ interface ResourceManifest {
710
+ /** Schema version for future migrations */
711
+ version: 1;
712
+ /** Last sync timestamp (ISO 8601) */
713
+ syncedAt: string;
714
+ /** Map of capability ID → resources it provides */
715
+ capabilities: Record<string, CapabilityResources>;
716
+ }
717
+ /**
718
+ * Result of cleaning up stale resources
719
+ */
720
+ interface CleanupResult {
721
+ deletedSkills: string[];
722
+ deletedRules: string[];
723
+ deletedCommands: string[];
724
+ deletedSubagents: string[];
725
+ deletedMcps: string[];
726
+ }
727
+ /**
728
+ * Load the previous manifest from disk.
729
+ * Returns an empty manifest if the file doesn't exist.
730
+ */
731
+ declare function loadManifest(): Promise<ResourceManifest>;
732
+ /**
733
+ * Save the manifest to disk.
734
+ */
735
+ declare function saveManifest(manifest: ResourceManifest): Promise<void>;
736
+ /**
737
+ * Build a manifest from the current registry capabilities.
738
+ */
739
+ declare function buildManifestFromCapabilities(capabilities: LoadedCapability[]): ResourceManifest;
740
+ /**
741
+ * Delete resources for capabilities that are no longer enabled.
742
+ * Compares the previous manifest against current capability IDs
743
+ * and removes files/directories for capabilities not in the current set.
744
+ */
745
+ declare function cleanupStaleResources(previousManifest: ResourceManifest, currentCapabilityIds: Set<string>): Promise<CleanupResult>;
746
+ //#endregion
747
+ //#region src/mcp-json/manager.d.ts
748
+ /**
749
+ * MCP server configuration in .mcp.json
750
+ */
751
+ interface McpServerConfig {
752
+ command: string;
753
+ args?: string[];
754
+ env?: Record<string, string>;
755
+ }
756
+ /**
757
+ * Structure of .mcp.json file
758
+ */
759
+ interface McpJsonConfig {
760
+ mcpServers: Record<string, McpServerConfig>;
761
+ }
762
+ /**
763
+ * Read .mcp.json or return empty config if doesn't exist
764
+ */
765
+ declare function readMcpJson(): Promise<McpJsonConfig>;
766
+ /**
767
+ * Write .mcp.json, preserving non-OmniDev entries
768
+ */
769
+ declare function writeMcpJson(config: McpJsonConfig): Promise<void>;
770
+ /**
771
+ * Sync .mcp.json with enabled capability MCP servers
772
+ *
773
+ * Each capability with an [mcp] section is registered using its capability ID.
774
+ * Uses the previous manifest to track which MCPs were managed by OmniDev.
775
+ */
776
+ declare function syncMcpJson(capabilities: LoadedCapability[], previousManifest: ResourceManifest, options?: {
777
+ silent?: boolean;
778
+ }): Promise<void>;
779
+ //#endregion
780
+ //#region src/state/active-profile.d.ts
781
+ /**
782
+ * Read the active profile from state file.
783
+ * Returns null if no active profile is set in state.
784
+ */
785
+ declare function readActiveProfileState(): Promise<string | null>;
786
+ /**
787
+ * Write the active profile to state file.
788
+ * @param profileName - The name of the profile to set as active
789
+ */
790
+ declare function writeActiveProfileState(profileName: string): Promise<void>;
791
+ /**
792
+ * Clear the active profile state (delete the state file).
793
+ */
794
+ declare function clearActiveProfileState(): Promise<void>;
795
+ //#endregion
796
+ //#region src/state/providers.d.ts
797
+ interface ProvidersState {
798
+ enabled: ProviderId[];
799
+ }
800
+ /**
801
+ * Read the enabled providers from local state.
802
+ * Returns default providers if no state file exists.
803
+ */
804
+ declare function readEnabledProviders(): Promise<ProviderId[]>;
805
+ /**
806
+ * Write enabled providers to local state.
807
+ * @param providers - List of provider IDs to enable
808
+ */
809
+ declare function writeEnabledProviders(providers: ProviderId[]): Promise<void>;
810
+ /**
811
+ * Enable a specific provider.
812
+ * @param providerId - The provider to enable
813
+ */
814
+ declare function enableProvider(providerId: ProviderId): Promise<void>;
815
+ /**
816
+ * Disable a specific provider.
817
+ * @param providerId - The provider to disable
818
+ */
819
+ declare function disableProvider(providerId: ProviderId): Promise<void>;
820
+ /**
821
+ * Check if a provider is enabled.
822
+ * @param providerId - The provider to check
823
+ */
824
+ declare function isProviderEnabled(providerId: ProviderId): Promise<boolean>;
825
+ //#endregion
826
+ //#region src/sync.d.ts
827
+ interface SyncResult {
828
+ capabilities: string[];
829
+ skillCount: number;
830
+ ruleCount: number;
831
+ docCount: number;
832
+ }
833
+ interface SyncOptions {
834
+ silent?: boolean;
835
+ /** Optional list of adapters to run. If not provided, adapters are not run. */
836
+ adapters?: ProviderAdapter[];
837
+ }
838
+ /**
839
+ * Install dependencies for capabilities in .omni/capabilities/
840
+ * Only installs for capabilities that have a package.json
841
+ */
842
+ declare function installCapabilityDependencies(silent: boolean): Promise<void>;
843
+ /**
844
+ * Build a provider-agnostic SyncBundle from the capability registry.
845
+ * This bundle can then be passed to adapters for provider-specific materialization.
846
+ */
847
+ declare function buildSyncBundle(options?: {
848
+ silent?: boolean;
849
+ }): Promise<{
850
+ bundle: SyncBundle;
851
+ }>;
852
+ /**
853
+ * Central sync function that regenerates all agent configuration files.
854
+ * Called automatically after any config change (init, capability enable/disable, profile change).
855
+ *
856
+ * If adapters are provided, they will be called after core sync to write provider-specific files.
857
+ */
858
+ declare function syncAgentConfiguration(options?: SyncOptions): Promise<SyncResult>;
859
+ //#endregion
860
+ //#region src/templates/agents.d.ts
861
+ /**
862
+ * Template for AGENTS.md (Codex provider)
863
+ * Creates a minimal file with reference to OmniDev instructions
864
+ */
865
+ declare function generateAgentsTemplate(): string;
866
+ //#endregion
867
+ //#region src/templates/claude.d.ts
868
+ /**
869
+ * Template for CLAUDE.md (Claude provider)
870
+ * Creates a minimal file with reference to OmniDev instructions
871
+ */
872
+ declare function generateClaudeTemplate(): string;
873
+ /**
874
+ * Template for .omni/instructions.md
875
+ * Contains OmniDev-specific instructions and capability rules
876
+ */
877
+ declare function generateInstructionsTemplate(): string;
878
+ //#endregion
879
+ //#region src/debug.d.ts
880
+ /**
881
+ * Debug logger that writes to stdout when OMNIDEV_DEBUG=1
882
+ */
883
+ declare function debug(message: string, data?: unknown): void;
884
+ //#endregion
885
+ //#region src/index.d.ts
886
+ declare const version = "0.1.0";
887
+ declare function getVersion(): string;
888
+ //#endregion
889
+ export { CapabilitiesConfig, CapabilitiesLockFile, CapabilityConfig, CapabilityExport, CapabilityExports, CapabilityLockEntry, CapabilityMetadata, CapabilityRegistry, CapabilityResources, CapabilitySource, CapabilitySourceConfig, CapabilitySourceType, CleanupResult, CliConfig, Command, CommandExport, DiscoveredContent, Doc, DocExport, EnvDeclaration, FetchResult, FileContent, GitCapabilitySourceConfig, LoadedCapability, McpConfig, McpJsonConfig, McpServerConfig, McpToolSchema, McpTransport, OmniConfig, ProfileConfig, Provider, ProviderAdapter, ProviderConfig, ProviderContext, ProviderId, ProviderInitResult, ProviderManifest, ProviderSyncResult, ProvidersState, ResourceManifest, Rule, Skill, SkillExport, SourceUpdateInfo, Subagent, SubagentExport, SubagentHookConfig, SubagentHooks, SubagentModel, SubagentPermissionMode, SyncBundle, SyncConfig, SyncOptions, SyncResult, buildCapabilityRegistry, buildCommand, buildManifestFromCapabilities, buildRouteMap, buildSyncBundle, checkForUpdates, cleanupStaleResources, clearActiveProfileState, debug, disableCapability, disableProvider, discoverCapabilities, enableCapability, enableProvider, fetchAllCapabilitySources, fetchCapabilitySource, generateAgentsTemplate, generateClaudeTemplate, generateInstructionsTemplate, getActiveProfile, getActiveProviders, getEnabledCapabilities, getLockFilePath, getSourceCapabilityPath, getVersion, installCapabilityDependencies, isProviderEnabled, isSecretEnvVar, loadCapability, loadCapabilityConfig, loadCommands, loadConfig, loadDocs, loadEnvironment, loadLockFile, loadManifest, loadProfileConfig, loadProviderConfig, loadRules, loadSkills, loadSubagents, parseCapabilityConfig, parseOmniConfig, parseProviderFlag, parseSourceConfig, readActiveProfileState, readEnabledProviders, readMcpJson, resolveEnabledCapabilities, saveLockFile, saveManifest, setActiveProfile, setProfile, sourceToGitUrl, syncAgentConfiguration, syncMcpJson, validateEnv, version, writeActiveProfileState, writeConfig, writeEnabledProviders, writeMcpJson, writeProviderConfig, writeRules };