@omnidev-ai/core 0.1.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 (59) hide show
  1. package/package.json +31 -0
  2. package/src/capability/AGENTS.md +58 -0
  3. package/src/capability/commands.test.ts +414 -0
  4. package/src/capability/commands.ts +70 -0
  5. package/src/capability/docs.test.ts +199 -0
  6. package/src/capability/docs.ts +46 -0
  7. package/src/capability/index.ts +20 -0
  8. package/src/capability/loader.test.ts +815 -0
  9. package/src/capability/loader.ts +492 -0
  10. package/src/capability/registry.test.ts +473 -0
  11. package/src/capability/registry.ts +55 -0
  12. package/src/capability/rules.test.ts +145 -0
  13. package/src/capability/rules.ts +133 -0
  14. package/src/capability/skills.test.ts +316 -0
  15. package/src/capability/skills.ts +56 -0
  16. package/src/capability/sources.test.ts +338 -0
  17. package/src/capability/sources.ts +966 -0
  18. package/src/capability/subagents.test.ts +478 -0
  19. package/src/capability/subagents.ts +103 -0
  20. package/src/capability/yaml-parser.ts +81 -0
  21. package/src/config/AGENTS.md +46 -0
  22. package/src/config/capabilities.ts +82 -0
  23. package/src/config/env.test.ts +286 -0
  24. package/src/config/env.ts +96 -0
  25. package/src/config/index.ts +6 -0
  26. package/src/config/loader.test.ts +282 -0
  27. package/src/config/loader.ts +137 -0
  28. package/src/config/parser.test.ts +281 -0
  29. package/src/config/parser.ts +55 -0
  30. package/src/config/profiles.test.ts +259 -0
  31. package/src/config/profiles.ts +75 -0
  32. package/src/config/provider.test.ts +79 -0
  33. package/src/config/provider.ts +55 -0
  34. package/src/debug.ts +20 -0
  35. package/src/gitignore/manager.test.ts +219 -0
  36. package/src/gitignore/manager.ts +167 -0
  37. package/src/index.test.ts +26 -0
  38. package/src/index.ts +39 -0
  39. package/src/mcp-json/index.ts +1 -0
  40. package/src/mcp-json/manager.test.ts +415 -0
  41. package/src/mcp-json/manager.ts +118 -0
  42. package/src/state/active-profile.test.ts +131 -0
  43. package/src/state/active-profile.ts +41 -0
  44. package/src/state/index.ts +2 -0
  45. package/src/state/manifest.test.ts +548 -0
  46. package/src/state/manifest.ts +164 -0
  47. package/src/sync.ts +213 -0
  48. package/src/templates/agents.test.ts +23 -0
  49. package/src/templates/agents.ts +14 -0
  50. package/src/templates/claude.test.ts +48 -0
  51. package/src/templates/claude.ts +122 -0
  52. package/src/test-utils/helpers.test.ts +196 -0
  53. package/src/test-utils/helpers.ts +187 -0
  54. package/src/test-utils/index.ts +30 -0
  55. package/src/test-utils/mocks.test.ts +83 -0
  56. package/src/test-utils/mocks.ts +101 -0
  57. package/src/types/capability-export.ts +234 -0
  58. package/src/types/index.test.ts +28 -0
  59. package/src/types/index.ts +270 -0
@@ -0,0 +1,270 @@
1
+ // Capability Export Types (for capability developers)
2
+ export * from "./capability-export.js";
3
+
4
+ // Capability Types
5
+ export interface CapabilityMetadata {
6
+ id: string;
7
+ name: string;
8
+ version: string;
9
+ description: string;
10
+ /** Optional metadata about the capability author and source */
11
+ metadata?: {
12
+ author?: string;
13
+ repository?: string;
14
+ license?: string;
15
+ /** True if this capability was auto-generated by wrapping a skills repo */
16
+ wrapped?: boolean;
17
+ /** For wrapped capabilities: the full commit hash */
18
+ commit?: string;
19
+ };
20
+ }
21
+
22
+ export interface CapabilityExports {
23
+ module?: string;
24
+ gitignore?: string[];
25
+ }
26
+
27
+ export interface EnvDeclaration {
28
+ required?: boolean;
29
+ secret?: boolean;
30
+ default?: string;
31
+ }
32
+
33
+ export interface SyncConfig {
34
+ on_sync?: string;
35
+ }
36
+
37
+ export interface CliConfig {
38
+ commands?: string[];
39
+ }
40
+
41
+ export interface CapabilityConfig {
42
+ capability: CapabilityMetadata;
43
+ exports?: CapabilityExports;
44
+ env?: Record<string, EnvDeclaration | Record<string, never>>;
45
+ mcp?: McpConfig;
46
+ sync?: SyncConfig;
47
+ cli?: CliConfig;
48
+ }
49
+
50
+ export type McpTransport = "stdio" | "sse" | "http";
51
+
52
+ export interface McpToolSchema {
53
+ name: string;
54
+ description: string;
55
+ inputSchema: Record<string, unknown>;
56
+ }
57
+
58
+ export interface McpConfig {
59
+ command: string;
60
+ args?: string[];
61
+ env?: Record<string, string>;
62
+ cwd?: string;
63
+ transport?: McpTransport;
64
+ tools?: McpToolSchema[];
65
+ }
66
+
67
+ // Content Types
68
+ export interface Skill {
69
+ name: string;
70
+ description: string;
71
+ instructions: string;
72
+ capabilityId: string;
73
+ }
74
+
75
+ export interface Rule {
76
+ name: string;
77
+ content: string;
78
+ capabilityId: string;
79
+ }
80
+
81
+ export interface Doc {
82
+ name: string;
83
+ content: string;
84
+ capabilityId: string;
85
+ }
86
+
87
+ export type SubagentModel = "sonnet" | "opus" | "haiku" | "inherit";
88
+ export type SubagentPermissionMode =
89
+ | "default"
90
+ | "acceptEdits"
91
+ | "dontAsk"
92
+ | "bypassPermissions"
93
+ | "plan";
94
+
95
+ export interface SubagentHookConfig {
96
+ matcher?: string;
97
+ hooks: {
98
+ type: "command";
99
+ command: string;
100
+ }[];
101
+ }
102
+
103
+ export interface SubagentHooks {
104
+ PreToolUse?: SubagentHookConfig[];
105
+ PostToolUse?: SubagentHookConfig[];
106
+ Stop?: SubagentHookConfig[];
107
+ }
108
+
109
+ export interface Subagent {
110
+ /** Unique identifier using lowercase letters and hyphens */
111
+ name: string;
112
+ /** When Claude should delegate to this subagent */
113
+ description: string;
114
+ /** System prompt that guides the subagent's behavior */
115
+ systemPrompt: string;
116
+ /** Tools the subagent can use (inherits all if omitted) */
117
+ tools?: string[];
118
+ /** Tools to deny (removed from inherited or specified list) */
119
+ disallowedTools?: string[];
120
+ /** Model to use: sonnet, opus, haiku, or inherit */
121
+ model?: SubagentModel;
122
+ /** Permission mode for the subagent */
123
+ permissionMode?: SubagentPermissionMode;
124
+ /** Skills to load into the subagent's context at startup */
125
+ skills?: string[];
126
+ /** Lifecycle hooks scoped to this subagent */
127
+ hooks?: SubagentHooks;
128
+ /** Capability that provides this subagent */
129
+ capabilityId: string;
130
+ }
131
+
132
+ export interface Command {
133
+ /** Command name (used as /command-name) */
134
+ name: string;
135
+ /** Brief description of what this command does */
136
+ description: string;
137
+ /** Optional allowed tools specification (e.g., "Bash(git add:*), Bash(git status:*)") */
138
+ allowedTools?: string;
139
+ /** Command prompt (markdown content with support for $ARGUMENTS, $1, $2, !`commands`, @files) */
140
+ prompt: string;
141
+ /** Capability that provides this command */
142
+ capabilityId: string;
143
+ }
144
+
145
+ // Capability Source Types
146
+ // Sources: local (manual), git (version via package.json), file (local path), hub (future)
147
+ export type CapabilitySourceType = "built-in" | "local" | "git" | "file" | "hub";
148
+
149
+ /** Configuration for a Git-sourced capability */
150
+ export interface GitCapabilitySourceConfig {
151
+ /** Source URL or shorthand (e.g., "github:user/repo", "git@github.com:...") */
152
+ source: string;
153
+ /** Git ref to checkout: tag, branch, or commit hash */
154
+ ref?: string;
155
+ /** Subdirectory within the repo containing the capability */
156
+ path?: string;
157
+ /**
158
+ * Type of capability:
159
+ * - "full" (default): Repo has capability.toml, use as-is
160
+ * - "wrap": Auto-discover skills/agents/commands and generate capability.toml
161
+ */
162
+ type?: "full" | "wrap";
163
+ }
164
+
165
+ /** Configuration for a file-sourced capability (local path) */
166
+ export interface FileCapabilitySourceConfig {
167
+ /** Source path as file:// URL (e.g., "file://./local-cap", "file:///absolute/path") */
168
+ source: string;
169
+ }
170
+
171
+ /** Combined type for all capability source configurations */
172
+ export type CapabilitySourceConfig =
173
+ | string // shorthand: "github:user/repo" or "file://./path"
174
+ | GitCapabilitySourceConfig
175
+ | FileCapabilitySourceConfig;
176
+
177
+ /** Lock file entry for a capability (version tracking) */
178
+ export interface CapabilityLockEntry {
179
+ /** Original source reference */
180
+ source: string;
181
+ /** Version from capability.toml or package.json */
182
+ version: string;
183
+ /** For git sources: exact commit hash */
184
+ commit?: string;
185
+ /** For file sources: content hash (sha256) for change detection */
186
+ content_hash?: string;
187
+ /** Pinned ref if specified */
188
+ ref?: string;
189
+ /** Last update timestamp (ISO 8601) */
190
+ updated_at: string;
191
+ }
192
+
193
+ /** Lock file structure (omni.lock.toml at project root) */
194
+ export interface CapabilitiesLockFile {
195
+ capabilities: Record<string, CapabilityLockEntry>;
196
+ }
197
+
198
+ /** Capabilities configuration section in omni.toml */
199
+ export interface CapabilitiesConfig {
200
+ /** List of enabled capability IDs */
201
+ enable?: string[];
202
+ /** List of disabled capability IDs */
203
+ disable?: string[];
204
+ /** Capability sources: id -> source string or full config (git or file) */
205
+ sources?: Record<string, CapabilitySourceConfig>;
206
+ }
207
+
208
+ // Config Types
209
+ export interface ProfileConfig {
210
+ capabilities?: string[];
211
+ }
212
+
213
+ export interface OmniConfig {
214
+ project?: string;
215
+ active_profile?: string;
216
+ always_enabled_capabilities?: string[];
217
+ env?: Record<string, string>;
218
+ profiles?: Record<string, ProfileConfig>;
219
+ providers?: {
220
+ enabled?: Provider[];
221
+ };
222
+ /** Capabilities configuration (enable/disable, sources) */
223
+ capabilities?: CapabilitiesConfig;
224
+ /** Enable sandbox mode (default: true). When false, MCPs are written directly to .mcp.json */
225
+ sandbox_enabled?: boolean;
226
+ }
227
+
228
+ // Provider Types
229
+ export type Provider = "claude" | "codex";
230
+
231
+ export interface ProviderConfig {
232
+ provider?: Provider;
233
+ providers?: Provider[];
234
+ }
235
+
236
+ export function getActiveProviders(config: ProviderConfig): Provider[] {
237
+ if (config.providers) return config.providers;
238
+ if (config.provider) return [config.provider];
239
+ return ["claude"]; // Default
240
+ }
241
+
242
+ /** Runtime info about where a capability came from */
243
+ export interface CapabilitySource {
244
+ type: CapabilitySourceType;
245
+ /** For git-sourced capabilities: the source URL/shorthand */
246
+ gitSource?: string;
247
+ /** For git-sourced capabilities: the pinned ref if any */
248
+ ref?: string;
249
+ /** For git-sourced capabilities: the current commit hash */
250
+ commit?: string;
251
+ /** Version from capability.toml or package.json */
252
+ version?: string;
253
+ }
254
+
255
+ // Loaded Capability
256
+ export interface LoadedCapability {
257
+ id: string;
258
+ path: string;
259
+ config: CapabilityConfig;
260
+ skills: Skill[];
261
+ rules: Rule[];
262
+ docs: Doc[];
263
+ subagents: Subagent[];
264
+ commands: Command[];
265
+ typeDefinitions?: string;
266
+ gitignore?: string[];
267
+ exports: Record<string, unknown>;
268
+ /** Where this capability comes from */
269
+ source?: CapabilitySource;
270
+ }