@omnidev-ai/cli 0.13.1 → 0.13.3

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 +970 -734
  2. package/package.json +37 -37
package/dist/index.js CHANGED
@@ -28,9 +28,118 @@ var __export = (target, all) => {
28
28
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
29
29
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
30
30
 
31
- // ../core/dist/shared/chunk-1dqs11h6.js
32
- import { createRequire as createRequire2 } from "node:module";
33
- var init_chunk_1dqs11h6 = () => {};
31
+ // ../core/src/capability/yaml-parser.ts
32
+ function parseSimpleYamlFrontmatter(yaml) {
33
+ const result = {};
34
+ for (const line of yaml.split(`
35
+ `)) {
36
+ const trimmed = line.trim();
37
+ if (!trimmed || trimmed.startsWith("#")) {
38
+ continue;
39
+ }
40
+ const colonIndex = trimmed.indexOf(":");
41
+ if (colonIndex === -1) {
42
+ continue;
43
+ }
44
+ const rawKey = trimmed.slice(0, colonIndex).trim();
45
+ let value = trimmed.slice(colonIndex + 1).trim();
46
+ if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
47
+ value = value.slice(1, -1);
48
+ }
49
+ const key = rawKey.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
50
+ result[key] = value;
51
+ }
52
+ return result;
53
+ }
54
+ function parseFrontmatterWithMarkdown(content) {
55
+ const match = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/s);
56
+ if (!match?.[1] || match[2] === undefined) {
57
+ return null;
58
+ }
59
+ const frontmatter = parseSimpleYamlFrontmatter(match[1]);
60
+ const markdown = match[2];
61
+ return { frontmatter, markdown };
62
+ }
63
+
64
+ // ../core/src/capability/commands.ts
65
+ import { existsSync, readdirSync } from "node:fs";
66
+ import { readFile } from "node:fs/promises";
67
+ import { join as join2 } from "node:path";
68
+ async function loadCommands(capabilityPath, capabilityId) {
69
+ const commandsDir = join2(capabilityPath, "commands");
70
+ if (!existsSync(commandsDir)) {
71
+ return [];
72
+ }
73
+ const commands = [];
74
+ const entries = readdirSync(commandsDir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
75
+ for (const entry of entries) {
76
+ if (entry.isDirectory()) {
77
+ const commandPath = join2(commandsDir, entry.name, "COMMAND.md");
78
+ if (existsSync(commandPath)) {
79
+ const command = await parseCommandFile(commandPath, capabilityId);
80
+ commands.push(command);
81
+ }
82
+ }
83
+ }
84
+ return commands;
85
+ }
86
+ async function parseCommandFile(filePath, capabilityId) {
87
+ const content = await readFile(filePath, "utf-8");
88
+ const parsed = parseFrontmatterWithMarkdown(content);
89
+ if (!parsed) {
90
+ throw new Error(`Invalid COMMAND.md format at ${filePath}: missing YAML frontmatter`);
91
+ }
92
+ const frontmatter = parsed.frontmatter;
93
+ const prompt = parsed.markdown;
94
+ if (!frontmatter.name || !frontmatter.description) {
95
+ throw new Error(`Invalid COMMAND.md at ${filePath}: name and description required`);
96
+ }
97
+ const result = {
98
+ name: frontmatter.name,
99
+ description: frontmatter.description,
100
+ prompt: prompt.trim(),
101
+ capabilityId
102
+ };
103
+ if (frontmatter.allowedTools) {
104
+ result.allowedTools = frontmatter.allowedTools;
105
+ }
106
+ return result;
107
+ }
108
+ var init_commands = () => {};
109
+
110
+ // ../core/src/capability/docs.ts
111
+ import { existsSync as existsSync2, readdirSync as readdirSync2 } from "node:fs";
112
+ import { readFile as readFile2 } from "node:fs/promises";
113
+ import { basename, join as join3 } from "node:path";
114
+ async function loadDocs(capabilityPath, capabilityId) {
115
+ const docs = [];
116
+ const definitionPath = join3(capabilityPath, "definition.md");
117
+ if (existsSync2(definitionPath)) {
118
+ const content = await readFile2(definitionPath, "utf-8");
119
+ docs.push({
120
+ name: "definition",
121
+ content: content.trim(),
122
+ capabilityId
123
+ });
124
+ }
125
+ const docsDir = join3(capabilityPath, "docs");
126
+ if (existsSync2(docsDir)) {
127
+ const entries = readdirSync2(docsDir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
128
+ for (const entry of entries) {
129
+ if (entry.isFile() && entry.name.endsWith(".md")) {
130
+ const docPath = join3(docsDir, entry.name);
131
+ const content = await readFile2(docPath, "utf-8");
132
+ docs.push({
133
+ name: basename(entry.name, ".md"),
134
+ content: content.trim(),
135
+ capabilityId
136
+ });
137
+ }
138
+ }
139
+ }
140
+ return docs;
141
+ }
142
+ var init_docs = () => {};
34
143
 
35
144
  // ../../node_modules/.bun/smol-toml@1.6.0/node_modules/smol-toml/dist/error.js
36
145
  function getLineColFromPtr(string, ptr) {
@@ -1013,286 +1122,7 @@ var init_dist = __esm(() => {
1013
1122
  */
1014
1123
  });
1015
1124
 
1016
- // ../core/dist/index.js
1017
- var exports_dist = {};
1018
- __export(exports_dist, {
1019
- writeSecurityAllows: () => writeSecurityAllows,
1020
- writeProviderConfig: () => writeProviderConfig,
1021
- writeMcpJson: () => writeMcpJson,
1022
- writeEnabledProviders: () => writeEnabledProviders,
1023
- writeConfig: () => writeConfig,
1024
- writeActiveProfileState: () => writeActiveProfileState,
1025
- version: () => version,
1026
- verifyIntegrity: () => verifyIntegrity,
1027
- validateHooksConfig: () => validateHooksConfig,
1028
- validateHook: () => validateHook,
1029
- transformToOmnidev: () => transformToOmnidev,
1030
- transformToClaude: () => transformToClaude,
1031
- transformHooksConfig: () => transformHooksConfig,
1032
- syncMcpJson: () => syncMcpJson,
1033
- syncAgentConfiguration: () => syncAgentConfiguration,
1034
- sourceToGitUrl: () => sourceToGitUrl,
1035
- setProfile: () => setProfile,
1036
- setActiveProfile: () => setActiveProfile,
1037
- scanCapability: () => scanCapability,
1038
- scanCapabilities: () => scanCapabilities,
1039
- saveManifest: () => saveManifest,
1040
- saveLockFile: () => saveLockFile,
1041
- resolveEnabledCapabilities: () => resolveEnabledCapabilities,
1042
- removeSecurityAllow: () => removeSecurityAllow,
1043
- readSecurityAllows: () => readSecurityAllows,
1044
- readMcpJson: () => readMcpJson,
1045
- readEnabledProviders: () => readEnabledProviders,
1046
- readCapabilityIdFromPath: () => readCapabilityIdFromPath,
1047
- readActiveProfileState: () => readActiveProfileState,
1048
- patchAddToProfile: () => patchAddToProfile,
1049
- patchAddMcp: () => patchAddMcp,
1050
- patchAddCapabilitySource: () => patchAddCapabilitySource,
1051
- parseSourceConfig: () => parseSourceConfig,
1052
- parseProviderFlag: () => parseProviderFlag,
1053
- parseOmniConfig: () => parseOmniConfig,
1054
- parseFileSourcePath: () => parseFileSourcePath,
1055
- parseCapabilityConfig: () => parseCapabilityConfig,
1056
- mergeHooksConfigs: () => mergeHooksConfigs,
1057
- mergeAndDeduplicateHooks: () => mergeAndDeduplicateHooks,
1058
- loadSubagents: () => loadSubagents,
1059
- loadSkills: () => loadSkills,
1060
- loadRules: () => loadRules,
1061
- loadProviderConfig: () => loadProviderConfig,
1062
- loadProfileConfig: () => loadProfileConfig,
1063
- loadManifest: () => loadManifest,
1064
- loadLockFile: () => loadLockFile,
1065
- loadHooksFromCapability: () => loadHooksFromCapability,
1066
- loadDocs: () => loadDocs,
1067
- loadConfig: () => loadConfig,
1068
- loadCommands: () => loadCommands,
1069
- loadCapabilityHooks: () => loadCapabilityHooks,
1070
- loadCapabilityConfig: () => loadCapabilityConfig,
1071
- loadCapability: () => loadCapability,
1072
- loadBaseConfig: () => loadBaseConfig,
1073
- isValidMatcherPattern: () => isValidMatcherPattern,
1074
- isSecurityAllowed: () => isSecurityAllowed,
1075
- isProviderEnabled: () => isProviderEnabled,
1076
- isPromptHookEvent: () => isPromptHookEvent,
1077
- isMatcherEvent: () => isMatcherEvent,
1078
- isHookType: () => isHookType,
1079
- isHookPrompt: () => isHookPrompt,
1080
- isHookEvent: () => isHookEvent,
1081
- isHookCommand: () => isHookCommand,
1082
- isGitSource: () => isGitSource,
1083
- isFileSourceConfig: () => isFileSourceConfig,
1084
- isFileSource: () => isFileSource,
1085
- installCapabilityDependencies: () => installCapabilityDependencies,
1086
- hasHooks: () => hasHooks,
1087
- hasAnyHooks: () => hasAnyHooks,
1088
- getVersion: () => getVersion,
1089
- getSourceCapabilityPath: () => getSourceCapabilityPath,
1090
- getLockFilePath: () => getLockFilePath,
1091
- getHooksDirectory: () => getHooksDirectory,
1092
- getHooksConfigPath: () => getHooksConfigPath,
1093
- getEventsWithHooks: () => getEventsWithHooks,
1094
- getEnabledCapabilities: () => getEnabledCapabilities,
1095
- getCapabilityAllows: () => getCapabilityAllows,
1096
- getAllSecurityAllows: () => getAllSecurityAllows,
1097
- getActiveProviders: () => getActiveProviders,
1098
- getActiveProfile: () => getActiveProfile,
1099
- generateSkillTemplate: () => generateSkillTemplate,
1100
- generateRuleTemplate: () => generateRuleTemplate,
1101
- generateOmniMdTemplate: () => generateOmniMdTemplate,
1102
- generateHooksTemplate: () => generateHooksTemplate,
1103
- generateHookScript: () => generateHookScript,
1104
- generateClaudeTemplate: () => generateClaudeTemplate,
1105
- generateCapabilityToml: () => generateCapabilityToml2,
1106
- generateAgentsTemplate: () => generateAgentsTemplate,
1107
- formatScanResults: () => formatScanResults,
1108
- findDuplicateCommands: () => findDuplicateCommands,
1109
- fetchCapabilitySource: () => fetchCapabilitySource,
1110
- fetchAllCapabilitySources: () => fetchAllCapabilitySources,
1111
- enableProvider: () => enableProvider,
1112
- enableCapability: () => enableCapability,
1113
- discoverCapabilities: () => discoverCapabilities,
1114
- disableProvider: () => disableProvider,
1115
- disableCapability: () => disableCapability,
1116
- detectPinVersion: () => detectPinVersion,
1117
- debug: () => debug,
1118
- createEmptyValidationResult: () => createEmptyValidationResult,
1119
- createEmptyHooksConfig: () => createEmptyHooksConfig,
1120
- countHooks: () => countHooks,
1121
- containsOmnidevVariables: () => containsOmnidevVariables,
1122
- containsClaudeVariables: () => containsClaudeVariables,
1123
- clearCapabilityAllows: () => clearCapabilityAllows,
1124
- clearAllSecurityAllows: () => clearAllSecurityAllows,
1125
- clearActiveProfileState: () => clearActiveProfileState,
1126
- cleanupStaleResources: () => cleanupStaleResources,
1127
- checkVersionMismatch: () => checkVersionMismatch,
1128
- checkForUpdates: () => checkForUpdates,
1129
- buildSyncBundle: () => buildSyncBundle,
1130
- buildManifestFromCapabilities: () => buildManifestFromCapabilities,
1131
- buildCapabilityRegistry: () => buildCapabilityRegistry,
1132
- addSecurityAllow: () => addSecurityAllow,
1133
- VARIABLE_MAPPINGS: () => VARIABLE_MAPPINGS,
1134
- SESSION_START_MATCHERS: () => SESSION_START_MATCHERS,
1135
- PROMPT_HOOK_EVENTS: () => PROMPT_HOOK_EVENTS,
1136
- PRE_COMPACT_MATCHERS: () => PRE_COMPACT_MATCHERS,
1137
- NOTIFICATION_MATCHERS: () => NOTIFICATION_MATCHERS,
1138
- MATCHER_EVENTS: () => MATCHER_EVENTS,
1139
- HOOK_TYPES: () => HOOK_TYPES,
1140
- HOOK_EVENTS: () => HOOK_EVENTS,
1141
- HOOKS_DIRECTORY: () => HOOKS_DIRECTORY,
1142
- HOOKS_CONFIG_FILENAME: () => HOOKS_CONFIG_FILENAME,
1143
- DEFAULT_SECURITY_CONFIG: () => DEFAULT_SECURITY_CONFIG,
1144
- DEFAULT_SCAN_SETTINGS: () => DEFAULT_SCAN_SETTINGS,
1145
- DEFAULT_PROMPT_TIMEOUT: () => DEFAULT_PROMPT_TIMEOUT,
1146
- DEFAULT_COMMAND_TIMEOUT: () => DEFAULT_COMMAND_TIMEOUT,
1147
- COMMON_TOOL_MATCHERS: () => COMMON_TOOL_MATCHERS
1148
- });
1149
- import { existsSync, readdirSync } from "node:fs";
1150
- import { readFile } from "node:fs/promises";
1151
- import { join as join2 } from "node:path";
1152
- import { existsSync as existsSync2, readdirSync as readdirSync2 } from "node:fs";
1153
- import { readFile as readFile2 } from "node:fs/promises";
1154
- import { basename, join as join22 } from "node:path";
1155
- import { existsSync as existsSync8, readdirSync as readdirSync6 } from "node:fs";
1156
- import { readFile as readFile6 } from "node:fs/promises";
1157
- import { join as join7 } from "node:path";
1158
- import { existsSync as existsSync4, readFileSync } from "node:fs";
1159
- import { join as join3 } from "node:path";
1160
- import { existsSync as existsSync3, statSync } from "node:fs";
1161
- import { resolve } from "node:path";
1162
- import { existsSync as existsSync5, readdirSync as readdirSync3 } from "node:fs";
1163
- import { readFile as readFile3 } from "node:fs/promises";
1164
- import { basename as basename2, join as join4 } from "node:path";
1165
- import { existsSync as existsSync6, readdirSync as readdirSync4 } from "node:fs";
1166
- import { readFile as readFile4 } from "node:fs/promises";
1167
- import { join as join5 } from "node:path";
1168
- import { existsSync as existsSync7, readdirSync as readdirSync5 } from "node:fs";
1169
- import { readFile as readFile5 } from "node:fs/promises";
1170
- import { join as join6 } from "node:path";
1171
- import { existsSync as existsSync9 } from "node:fs";
1172
- import { readFile as readFile7, writeFile as writeFile2 } from "node:fs/promises";
1173
- import { existsSync as existsSync10, mkdirSync } from "node:fs";
1174
- import { readFile as readFile8, unlink, writeFile as writeFile22 } from "node:fs/promises";
1175
- import { existsSync as existsSync11 } from "node:fs";
1176
- import { spawn } from "node:child_process";
1177
- import { cp, mkdir as mkdir2, readdir, readFile as readFile9, rename, rm, stat, writeFile as writeFile3 } from "node:fs/promises";
1178
- import { join as join8 } from "node:path";
1179
- import { createHash } from "node:crypto";
1180
- import { existsSync as existsSync12 } from "node:fs";
1181
- import { readFile as readFile10, writeFile as writeFile4 } from "node:fs/promises";
1182
- import { existsSync as existsSync13 } from "node:fs";
1183
- import { readFile as readFile11, writeFile as writeFile5 } from "node:fs/promises";
1184
- import { existsSync as existsSync14 } from "node:fs";
1185
- import { readFile as readFile12, writeFile as writeFile6 } from "node:fs/promises";
1186
- import { existsSync as existsSync15, mkdirSync as mkdirSync2, rmSync } from "node:fs";
1187
- import { readFile as readFile13, writeFile as writeFile7 } from "node:fs/promises";
1188
- import { existsSync as existsSync16, mkdirSync as mkdirSync3 } from "node:fs";
1189
- import { readFile as readFile14, writeFile as writeFile8 } from "node:fs/promises";
1190
- import { existsSync as existsSync17, mkdirSync as mkdirSync4 } from "node:fs";
1191
- import { readFile as readFile15, writeFile as writeFile9 } from "node:fs/promises";
1192
- import { spawn as spawn2 } from "node:child_process";
1193
- import { mkdirSync as mkdirSync5 } from "node:fs";
1194
- import { existsSync as existsSync18 } from "node:fs";
1195
- import { lstat, readdir as readdir2, readFile as readFile16, readlink, realpath } from "node:fs/promises";
1196
- import { join as join9, relative, resolve as resolve2 } from "node:path";
1197
- function parseSimpleYamlFrontmatter(yaml) {
1198
- const result = {};
1199
- for (const line of yaml.split(`
1200
- `)) {
1201
- const trimmed = line.trim();
1202
- if (!trimmed || trimmed.startsWith("#")) {
1203
- continue;
1204
- }
1205
- const colonIndex = trimmed.indexOf(":");
1206
- if (colonIndex === -1) {
1207
- continue;
1208
- }
1209
- const rawKey = trimmed.slice(0, colonIndex).trim();
1210
- let value = trimmed.slice(colonIndex + 1).trim();
1211
- if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
1212
- value = value.slice(1, -1);
1213
- }
1214
- const key = rawKey.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
1215
- result[key] = value;
1216
- }
1217
- return result;
1218
- }
1219
- function parseFrontmatterWithMarkdown(content) {
1220
- const match = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/s);
1221
- if (!match?.[1] || match[2] === undefined) {
1222
- return null;
1223
- }
1224
- const frontmatter = parseSimpleYamlFrontmatter(match[1]);
1225
- const markdown = match[2];
1226
- return { frontmatter, markdown };
1227
- }
1228
- async function loadCommands(capabilityPath, capabilityId) {
1229
- const commandsDir = join2(capabilityPath, "commands");
1230
- if (!existsSync(commandsDir)) {
1231
- return [];
1232
- }
1233
- const commands = [];
1234
- const entries = readdirSync(commandsDir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
1235
- for (const entry of entries) {
1236
- if (entry.isDirectory()) {
1237
- const commandPath = join2(commandsDir, entry.name, "COMMAND.md");
1238
- if (existsSync(commandPath)) {
1239
- const command = await parseCommandFile(commandPath, capabilityId);
1240
- commands.push(command);
1241
- }
1242
- }
1243
- }
1244
- return commands;
1245
- }
1246
- async function parseCommandFile(filePath, capabilityId) {
1247
- const content = await readFile(filePath, "utf-8");
1248
- const parsed = parseFrontmatterWithMarkdown(content);
1249
- if (!parsed) {
1250
- throw new Error(`Invalid COMMAND.md format at ${filePath}: missing YAML frontmatter`);
1251
- }
1252
- const frontmatter = parsed.frontmatter;
1253
- const prompt = parsed.markdown;
1254
- if (!frontmatter.name || !frontmatter.description) {
1255
- throw new Error(`Invalid COMMAND.md at ${filePath}: name and description required`);
1256
- }
1257
- const result = {
1258
- name: frontmatter.name,
1259
- description: frontmatter.description,
1260
- prompt: prompt.trim(),
1261
- capabilityId
1262
- };
1263
- if (frontmatter.allowedTools) {
1264
- result.allowedTools = frontmatter.allowedTools;
1265
- }
1266
- return result;
1267
- }
1268
- async function loadDocs(capabilityPath, capabilityId) {
1269
- const docs = [];
1270
- const definitionPath = join22(capabilityPath, "definition.md");
1271
- if (existsSync2(definitionPath)) {
1272
- const content = await readFile2(definitionPath, "utf-8");
1273
- docs.push({
1274
- name: "definition",
1275
- content: content.trim(),
1276
- capabilityId
1277
- });
1278
- }
1279
- const docsDir = join22(capabilityPath, "docs");
1280
- if (existsSync2(docsDir)) {
1281
- const entries = readdirSync2(docsDir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
1282
- for (const entry of entries) {
1283
- if (entry.isFile() && entry.name.endsWith(".md")) {
1284
- const docPath = join22(docsDir, entry.name);
1285
- const content = await readFile2(docPath, "utf-8");
1286
- docs.push({
1287
- name: basename(entry.name, ".md"),
1288
- content: content.trim(),
1289
- capabilityId
1290
- });
1291
- }
1292
- }
1293
- }
1294
- return docs;
1295
- }
1125
+ // ../core/src/config/parser.ts
1296
1126
  function parseOmniConfig(tomlContent) {
1297
1127
  try {
1298
1128
  return parse(tomlContent);
@@ -1327,6 +1157,71 @@ function parseCapabilityConfig(tomlContent) {
1327
1157
  throw new Error(`Invalid capability.toml: ${message}`);
1328
1158
  }
1329
1159
  }
1160
+ var init_parser = __esm(() => {
1161
+ init_dist();
1162
+ });
1163
+
1164
+ // ../core/src/hooks/constants.ts
1165
+ var HOOK_EVENTS, MATCHER_EVENTS, PROMPT_HOOK_EVENTS, HOOK_TYPES, COMMON_TOOL_MATCHERS, NOTIFICATION_MATCHERS, SESSION_START_MATCHERS, PRE_COMPACT_MATCHERS, DEFAULT_COMMAND_TIMEOUT = 60, DEFAULT_PROMPT_TIMEOUT = 30, VARIABLE_MAPPINGS, HOOKS_CONFIG_FILENAME = "hooks.toml", HOOKS_DIRECTORY = "hooks";
1166
+ var init_constants = __esm(() => {
1167
+ HOOK_EVENTS = [
1168
+ "PreToolUse",
1169
+ "PostToolUse",
1170
+ "PermissionRequest",
1171
+ "UserPromptSubmit",
1172
+ "Stop",
1173
+ "SubagentStop",
1174
+ "Notification",
1175
+ "SessionStart",
1176
+ "SessionEnd",
1177
+ "PreCompact"
1178
+ ];
1179
+ MATCHER_EVENTS = [
1180
+ "PreToolUse",
1181
+ "PostToolUse",
1182
+ "PermissionRequest",
1183
+ "Notification",
1184
+ "SessionStart",
1185
+ "PreCompact"
1186
+ ];
1187
+ PROMPT_HOOK_EVENTS = [
1188
+ "Stop",
1189
+ "SubagentStop",
1190
+ "UserPromptSubmit",
1191
+ "PreToolUse",
1192
+ "PermissionRequest"
1193
+ ];
1194
+ HOOK_TYPES = ["command", "prompt"];
1195
+ COMMON_TOOL_MATCHERS = [
1196
+ "Bash",
1197
+ "Read",
1198
+ "Write",
1199
+ "Edit",
1200
+ "Glob",
1201
+ "Grep",
1202
+ "Task",
1203
+ "WebFetch",
1204
+ "WebSearch",
1205
+ "NotebookEdit",
1206
+ "LSP",
1207
+ "TodoWrite",
1208
+ "AskUserQuestion"
1209
+ ];
1210
+ NOTIFICATION_MATCHERS = [
1211
+ "permission_prompt",
1212
+ "idle_prompt",
1213
+ "auth_success",
1214
+ "elicitation_dialog"
1215
+ ];
1216
+ SESSION_START_MATCHERS = ["startup", "resume", "clear", "compact"];
1217
+ PRE_COMPACT_MATCHERS = ["manual", "auto"];
1218
+ VARIABLE_MAPPINGS = {
1219
+ OMNIDEV_CAPABILITY_ROOT: "CLAUDE_PLUGIN_ROOT",
1220
+ OMNIDEV_PROJECT_DIR: "CLAUDE_PROJECT_DIR"
1221
+ };
1222
+ });
1223
+
1224
+ // ../core/src/hooks/types.ts
1330
1225
  function isHookCommand(hook) {
1331
1226
  return hook.type === "command";
1332
1227
  }
@@ -1345,6 +1240,13 @@ function isHookEvent(event) {
1345
1240
  function isHookType(type) {
1346
1241
  return HOOK_TYPES.includes(type);
1347
1242
  }
1243
+ var init_types = __esm(() => {
1244
+ init_constants();
1245
+ });
1246
+
1247
+ // ../core/src/hooks/validation.ts
1248
+ import { existsSync as existsSync3, statSync } from "node:fs";
1249
+ import { resolve } from "node:path";
1348
1250
  function validateHooksConfig(config, options) {
1349
1251
  const errors = [];
1350
1252
  const warnings = [];
@@ -1711,6 +1613,12 @@ function createEmptyValidationResult() {
1711
1613
  warnings: []
1712
1614
  };
1713
1615
  }
1616
+ var init_validation = __esm(() => {
1617
+ init_constants();
1618
+ init_types();
1619
+ });
1620
+
1621
+ // ../core/src/hooks/variables.ts
1714
1622
  function transformToOmnidev(content) {
1715
1623
  let result = content;
1716
1624
  for (const [claude, omni] of Object.entries(REVERSE_MAPPINGS)) {
@@ -1790,6 +1698,15 @@ function containsOmnidevVariables(content) {
1790
1698
  }
1791
1699
  return false;
1792
1700
  }
1701
+ var REVERSE_MAPPINGS;
1702
+ var init_variables = __esm(() => {
1703
+ init_constants();
1704
+ REVERSE_MAPPINGS = Object.fromEntries(Object.entries(VARIABLE_MAPPINGS).map(([omni, claude]) => [claude, omni]));
1705
+ });
1706
+
1707
+ // ../core/src/hooks/loader.ts
1708
+ import { existsSync as existsSync4, readFileSync } from "node:fs";
1709
+ import { join as join4 } from "node:path";
1793
1710
  function loadHooksFromCapability(capabilityPath, options) {
1794
1711
  const opts = {
1795
1712
  transformVariables: true,
@@ -1797,8 +1714,8 @@ function loadHooksFromCapability(capabilityPath, options) {
1797
1714
  checkScripts: false,
1798
1715
  ...options
1799
1716
  };
1800
- const hooksDir = join3(capabilityPath, HOOKS_DIRECTORY);
1801
- const configPath = join3(hooksDir, HOOKS_CONFIG_FILENAME);
1717
+ const hooksDir = join4(capabilityPath, HOOKS_DIRECTORY);
1718
+ const configPath = join4(hooksDir, HOOKS_CONFIG_FILENAME);
1802
1719
  if (!existsSync4(configPath)) {
1803
1720
  return {
1804
1721
  config: createEmptyHooksConfig(),
@@ -1885,17 +1802,28 @@ function loadCapabilityHooks(capabilityName, capabilityPath, options) {
1885
1802
  };
1886
1803
  }
1887
1804
  function hasHooks(capabilityPath) {
1888
- const configPath = join3(capabilityPath, HOOKS_DIRECTORY, HOOKS_CONFIG_FILENAME);
1805
+ const configPath = join4(capabilityPath, HOOKS_DIRECTORY, HOOKS_CONFIG_FILENAME);
1889
1806
  return existsSync4(configPath);
1890
1807
  }
1891
1808
  function getHooksDirectory(capabilityPath) {
1892
- return join3(capabilityPath, HOOKS_DIRECTORY);
1809
+ return join4(capabilityPath, HOOKS_DIRECTORY);
1893
1810
  }
1894
1811
  function getHooksConfigPath(capabilityPath) {
1895
- return join3(capabilityPath, HOOKS_DIRECTORY, HOOKS_CONFIG_FILENAME);
1812
+ return join4(capabilityPath, HOOKS_DIRECTORY, HOOKS_CONFIG_FILENAME);
1896
1813
  }
1814
+ var init_loader = __esm(() => {
1815
+ init_dist();
1816
+ init_constants();
1817
+ init_validation();
1818
+ init_variables();
1819
+ });
1820
+
1821
+ // ../core/src/capability/rules.ts
1822
+ import { existsSync as existsSync5, readdirSync as readdirSync3 } from "node:fs";
1823
+ import { readFile as readFile3 } from "node:fs/promises";
1824
+ import { basename as basename2, join as join5 } from "node:path";
1897
1825
  async function loadRules(capabilityPath, capabilityId) {
1898
- const rulesDir = join4(capabilityPath, "rules");
1826
+ const rulesDir = join5(capabilityPath, "rules");
1899
1827
  if (!existsSync5(rulesDir)) {
1900
1828
  return [];
1901
1829
  }
@@ -1903,7 +1831,7 @@ async function loadRules(capabilityPath, capabilityId) {
1903
1831
  const entries = readdirSync3(rulesDir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
1904
1832
  for (const entry of entries) {
1905
1833
  if (entry.isFile() && entry.name.endsWith(".md")) {
1906
- const rulePath = join4(rulesDir, entry.name);
1834
+ const rulePath = join5(rulesDir, entry.name);
1907
1835
  const content = await readFile3(rulePath, "utf-8");
1908
1836
  rules.push({
1909
1837
  name: basename2(entry.name, ".md"),
@@ -1914,8 +1842,14 @@ async function loadRules(capabilityPath, capabilityId) {
1914
1842
  }
1915
1843
  return rules;
1916
1844
  }
1845
+ var init_rules = () => {};
1846
+
1847
+ // ../core/src/capability/skills.ts
1848
+ import { existsSync as existsSync6, readdirSync as readdirSync4 } from "node:fs";
1849
+ import { readFile as readFile4 } from "node:fs/promises";
1850
+ import { join as join6 } from "node:path";
1917
1851
  async function loadSkills(capabilityPath, capabilityId) {
1918
- const skillsDir = join5(capabilityPath, "skills");
1852
+ const skillsDir = join6(capabilityPath, "skills");
1919
1853
  if (!existsSync6(skillsDir)) {
1920
1854
  return [];
1921
1855
  }
@@ -1923,7 +1857,7 @@ async function loadSkills(capabilityPath, capabilityId) {
1923
1857
  const entries = readdirSync4(skillsDir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
1924
1858
  for (const entry of entries) {
1925
1859
  if (entry.isDirectory()) {
1926
- const skillPath = join5(skillsDir, entry.name, "SKILL.md");
1860
+ const skillPath = join6(skillsDir, entry.name, "SKILL.md");
1927
1861
  if (existsSync6(skillPath)) {
1928
1862
  const skill = await parseSkillFile(skillPath, capabilityId);
1929
1863
  skills.push(skill);
@@ -1950,8 +1884,14 @@ async function parseSkillFile(filePath, capabilityId) {
1950
1884
  capabilityId
1951
1885
  };
1952
1886
  }
1887
+ var init_skills = () => {};
1888
+
1889
+ // ../core/src/capability/subagents.ts
1890
+ import { existsSync as existsSync7, readdirSync as readdirSync5 } from "node:fs";
1891
+ import { readFile as readFile5 } from "node:fs/promises";
1892
+ import { join as join7 } from "node:path";
1953
1893
  async function loadSubagents(capabilityPath, capabilityId) {
1954
- const subagentsDir = join6(capabilityPath, "subagents");
1894
+ const subagentsDir = join7(capabilityPath, "subagents");
1955
1895
  if (!existsSync7(subagentsDir)) {
1956
1896
  return [];
1957
1897
  }
@@ -1959,7 +1899,7 @@ async function loadSubagents(capabilityPath, capabilityId) {
1959
1899
  const entries = readdirSync5(subagentsDir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
1960
1900
  for (const entry of entries) {
1961
1901
  if (entry.isDirectory()) {
1962
- const subagentPath = join6(subagentsDir, entry.name, "SUBAGENT.md");
1902
+ const subagentPath = join7(subagentsDir, entry.name, "SUBAGENT.md");
1963
1903
  if (existsSync7(subagentPath)) {
1964
1904
  const subagent = await parseSubagentFile(subagentPath, capabilityId);
1965
1905
  subagents.push(subagent);
@@ -2008,14 +1948,20 @@ async function parseSubagentFile(filePath, capabilityId) {
2008
1948
  function parseCommaSeparatedList(value) {
2009
1949
  return value.split(",").map((item) => item.trim()).filter(Boolean);
2010
1950
  }
1951
+ var init_subagents = () => {};
1952
+
1953
+ // ../core/src/capability/loader.ts
1954
+ import { existsSync as existsSync8, readdirSync as readdirSync6 } from "node:fs";
1955
+ import { readFile as readFile6 } from "node:fs/promises";
1956
+ import { join as join8 } from "node:path";
2011
1957
  async function discoverCapabilities() {
2012
1958
  const capabilities = [];
2013
1959
  if (existsSync8(CAPABILITIES_DIR)) {
2014
1960
  const entries = readdirSync6(CAPABILITIES_DIR, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
2015
1961
  for (const entry of entries) {
2016
1962
  if (entry.isDirectory()) {
2017
- const entryPath = join7(CAPABILITIES_DIR, entry.name);
2018
- const configPath = join7(entryPath, "capability.toml");
1963
+ const entryPath = join8(CAPABILITIES_DIR, entry.name);
1964
+ const configPath = join8(entryPath, "capability.toml");
2019
1965
  if (existsSync8(configPath)) {
2020
1966
  capabilities.push(entryPath);
2021
1967
  }
@@ -2025,15 +1971,15 @@ async function discoverCapabilities() {
2025
1971
  return capabilities;
2026
1972
  }
2027
1973
  async function loadCapabilityConfig(capabilityPath) {
2028
- const configPath = join7(capabilityPath, "capability.toml");
1974
+ const configPath = join8(capabilityPath, "capability.toml");
2029
1975
  const content = await readFile6(configPath, "utf-8");
2030
1976
  const config = parseCapabilityConfig(content);
2031
1977
  return config;
2032
1978
  }
2033
1979
  async function importCapabilityExports(capabilityPath) {
2034
- const builtIndexPath = join7(capabilityPath, "dist", "index.js");
2035
- const jsIndexPath = join7(capabilityPath, "index.js");
2036
- const tsIndexPath = join7(capabilityPath, "index.ts");
1980
+ const builtIndexPath = join8(capabilityPath, "dist", "index.js");
1981
+ const jsIndexPath = join8(capabilityPath, "index.js");
1982
+ const tsIndexPath = join8(capabilityPath, "index.ts");
2037
1983
  let indexPath = null;
2038
1984
  if (existsSync8(builtIndexPath)) {
2039
1985
  indexPath = builtIndexPath;
@@ -2046,7 +1992,7 @@ async function importCapabilityExports(capabilityPath) {
2046
1992
  return {};
2047
1993
  }
2048
1994
  try {
2049
- const absolutePath = join7(process.cwd(), indexPath);
1995
+ const absolutePath = join8(process.cwd(), indexPath);
2050
1996
  const module = await import(absolutePath);
2051
1997
  return module;
2052
1998
  } catch (error) {
@@ -2066,7 +2012,7 @@ If this is a project-specific capability, install dependencies or remove it from
2066
2012
  }
2067
2013
  }
2068
2014
  async function loadTypeDefinitions(capabilityPath) {
2069
- const typesPath = join7(capabilityPath, "types.d.ts");
2015
+ const typesPath = join8(capabilityPath, "types.d.ts");
2070
2016
  if (!existsSync8(typesPath)) {
2071
2017
  return;
2072
2018
  }
@@ -2283,6 +2229,20 @@ async function loadCapability(capabilityPath) {
2283
2229
  }
2284
2230
  return result;
2285
2231
  }
2232
+ var CAPABILITIES_DIR = ".omni/capabilities";
2233
+ var init_loader2 = __esm(() => {
2234
+ init_parser();
2235
+ init_loader();
2236
+ init_commands();
2237
+ init_docs();
2238
+ init_rules();
2239
+ init_skills();
2240
+ init_subagents();
2241
+ });
2242
+
2243
+ // ../core/src/config/config.ts
2244
+ import { existsSync as existsSync9 } from "node:fs";
2245
+ import { readFile as readFile7, writeFile as writeFile2 } from "node:fs/promises";
2286
2246
  function mergeConfigs(base, override) {
2287
2247
  const merged = { ...base, ...override };
2288
2248
  merged.profiles = { ...base.profiles };
@@ -2466,6 +2426,14 @@ function generateConfigToml(config) {
2466
2426
  return lines.join(`
2467
2427
  `);
2468
2428
  }
2429
+ var CONFIG_PATH = "omni.toml", LOCAL_CONFIG = "omni.local.toml";
2430
+ var init_config = __esm(() => {
2431
+ init_parser();
2432
+ });
2433
+
2434
+ // ../core/src/state/active-profile.ts
2435
+ import { existsSync as existsSync10, mkdirSync } from "node:fs";
2436
+ import { readFile as readFile8, unlink, writeFile as writeFile3 } from "node:fs/promises";
2469
2437
  async function readActiveProfileState() {
2470
2438
  if (!existsSync10(ACTIVE_PROFILE_PATH)) {
2471
2439
  return null;
@@ -2480,13 +2448,19 @@ async function readActiveProfileState() {
2480
2448
  }
2481
2449
  async function writeActiveProfileState(profileName) {
2482
2450
  mkdirSync(STATE_DIR, { recursive: true });
2483
- await writeFile22(ACTIVE_PROFILE_PATH, profileName, "utf-8");
2451
+ await writeFile3(ACTIVE_PROFILE_PATH, profileName, "utf-8");
2484
2452
  }
2485
2453
  async function clearActiveProfileState() {
2486
2454
  if (existsSync10(ACTIVE_PROFILE_PATH)) {
2487
2455
  await unlink(ACTIVE_PROFILE_PATH);
2488
2456
  }
2489
2457
  }
2458
+ var STATE_DIR = ".omni/state", ACTIVE_PROFILE_PATH;
2459
+ var init_active_profile = __esm(() => {
2460
+ ACTIVE_PROFILE_PATH = `${STATE_DIR}/active-profile`;
2461
+ });
2462
+
2463
+ // ../core/src/config/profiles.ts
2490
2464
  async function getActiveProfile() {
2491
2465
  return await readActiveProfileState();
2492
2466
  }
@@ -2528,6 +2502,12 @@ async function setProfile(profileName, profileConfig) {
2528
2502
  config.profiles[profileName] = profileConfig;
2529
2503
  await writeConfig(config);
2530
2504
  }
2505
+ var init_profiles = __esm(() => {
2506
+ init_active_profile();
2507
+ init_config();
2508
+ });
2509
+
2510
+ // ../core/src/config/capabilities.ts
2531
2511
  async function getEnabledCapabilities() {
2532
2512
  const config = await loadConfig();
2533
2513
  const activeProfile = await getActiveProfile() ?? "default";
@@ -2558,6 +2538,12 @@ async function disableCapability(capabilityId) {
2558
2538
  config.profiles[activeProfile].capabilities = Array.from(capabilities);
2559
2539
  await writeConfig(config);
2560
2540
  }
2541
+ var init_capabilities = __esm(() => {
2542
+ init_config();
2543
+ init_profiles();
2544
+ });
2545
+
2546
+ // ../core/src/hooks/merger.ts
2561
2547
  function mergeHooksConfigs(capabilityHooks) {
2562
2548
  const result = {};
2563
2549
  for (const event of HOOK_EVENTS) {
@@ -2643,6 +2629,11 @@ function getEventsWithHooks(config) {
2643
2629
  }
2644
2630
  return events;
2645
2631
  }
2632
+ var init_merger = __esm(() => {
2633
+ init_constants();
2634
+ });
2635
+
2636
+ // ../core/src/capability/registry.ts
2646
2637
  async function buildCapabilityRegistry() {
2647
2638
  const enabledIds = await getEnabledCapabilities();
2648
2639
  const capabilityPaths = await discoverCapabilities();
@@ -2679,6 +2670,12 @@ async function buildCapabilityRegistry() {
2679
2670
  getMergedHooks: () => mergeHooksConfigs(getAllCapabilityHooks())
2680
2671
  };
2681
2672
  }
2673
+ var init_registry = __esm(() => {
2674
+ init_capabilities();
2675
+ init_merger();
2676
+ init_loader2();
2677
+ });
2678
+ // ../core/src/types/index.ts
2682
2679
  function isFileSourceConfig(config) {
2683
2680
  if (typeof config === "string") {
2684
2681
  return config.startsWith("file://");
@@ -2692,14 +2689,29 @@ function getActiveProviders(config) {
2692
2689
  return [config.provider];
2693
2690
  return ["claude"];
2694
2691
  }
2692
+ var init_types2 = () => {};
2693
+
2694
+ // ../core/src/capability/sources.ts
2695
+ import { existsSync as existsSync11 } from "node:fs";
2696
+ import { spawn } from "node:child_process";
2697
+ import { cp, mkdir as mkdir2, readdir, readFile as readFile9, rename, rm, stat, writeFile as writeFile4 } from "node:fs/promises";
2698
+ import { join as join9 } from "node:path";
2699
+ import { createHash } from "node:crypto";
2695
2700
  async function spawnCapture(command, args, options) {
2696
- return await new Promise((resolve22, reject) => {
2701
+ const timeout = options?.timeout ?? 60000;
2702
+ return await new Promise((resolve2, reject) => {
2697
2703
  const child = spawn(command, args, {
2698
2704
  cwd: options?.cwd,
2699
2705
  stdio: ["ignore", "pipe", "pipe"]
2700
2706
  });
2701
2707
  let stdout = "";
2702
2708
  let stderr = "";
2709
+ let timedOut = false;
2710
+ const timeoutId = setTimeout(() => {
2711
+ timedOut = true;
2712
+ child.kill("SIGTERM");
2713
+ setTimeout(() => child.kill("SIGKILL"), 5000);
2714
+ }, timeout);
2703
2715
  child.stdout?.setEncoding("utf-8");
2704
2716
  child.stderr?.setEncoding("utf-8");
2705
2717
  child.stdout?.on("data", (chunk) => {
@@ -2708,9 +2720,22 @@ async function spawnCapture(command, args, options) {
2708
2720
  child.stderr?.on("data", (chunk) => {
2709
2721
  stderr += chunk;
2710
2722
  });
2711
- child.on("error", (error) => reject(error));
2723
+ child.on("error", (error) => {
2724
+ clearTimeout(timeoutId);
2725
+ reject(error);
2726
+ });
2712
2727
  child.on("close", (exitCode) => {
2713
- resolve22({ exitCode: exitCode ?? 0, stdout, stderr });
2728
+ clearTimeout(timeoutId);
2729
+ if (timedOut) {
2730
+ resolve2({
2731
+ exitCode: 124,
2732
+ stdout,
2733
+ stderr: `${stderr}
2734
+ Process timed out after ${timeout}ms`
2735
+ });
2736
+ } else {
2737
+ resolve2({ exitCode: exitCode ?? 0, stdout, stderr });
2738
+ }
2714
2739
  });
2715
2740
  });
2716
2741
  }
@@ -2727,7 +2752,7 @@ function parseFileSourcePath(source) {
2727
2752
  return source.slice(7);
2728
2753
  }
2729
2754
  async function readCapabilityIdFromPath(capabilityPath) {
2730
- const tomlPath = join8(capabilityPath, "capability.toml");
2755
+ const tomlPath = join9(capabilityPath, "capability.toml");
2731
2756
  if (existsSync11(tomlPath)) {
2732
2757
  try {
2733
2758
  const content = await readFile9(tomlPath, "utf-8");
@@ -2783,7 +2808,7 @@ function sourceToGitUrl(source) {
2783
2808
  return source;
2784
2809
  }
2785
2810
  function getSourceCapabilityPath(id) {
2786
- return join8(OMNI_LOCAL, "capabilities", id);
2811
+ return join9(OMNI_LOCAL, "capabilities", id);
2787
2812
  }
2788
2813
  function getLockFilePath() {
2789
2814
  return "omni.lock.toml";
@@ -2852,14 +2877,14 @@ function stringifyLockFile(lockFile) {
2852
2877
  }
2853
2878
  async function saveLockFile(lockFile) {
2854
2879
  const lockPath = getLockFilePath();
2855
- await mkdir2(join8(OMNI_LOCAL, "capabilities"), { recursive: true });
2880
+ await mkdir2(join9(OMNI_LOCAL, "capabilities"), { recursive: true });
2856
2881
  const header = `# Auto-generated by OmniDev - DO NOT EDIT
2857
2882
  # Records installed capability versions for reproducibility
2858
2883
  # Last updated: ${new Date().toISOString()}
2859
2884
 
2860
2885
  `;
2861
2886
  const content = header + stringifyLockFile(lockFile);
2862
- await writeFile3(lockPath, content, "utf-8");
2887
+ await writeFile4(lockPath, content, "utf-8");
2863
2888
  }
2864
2889
  async function getRepoCommit(repoPath) {
2865
2890
  const { exitCode, stdout, stderr } = await spawnCapture("git", ["rev-parse", "HEAD"], {
@@ -2883,7 +2908,7 @@ async function computeContentHash(dirPath, excludePatterns = CONTENT_HASH_EXCLUD
2883
2908
  const entries = await readdir(currentPath, { withFileTypes: true });
2884
2909
  entries.sort((a, b) => a.name.localeCompare(b.name));
2885
2910
  for (const entry of entries) {
2886
- const fullPath = join8(currentPath, entry.name);
2911
+ const fullPath = join9(currentPath, entry.name);
2887
2912
  const relativePath = fullPath.slice(relativeTo.length + 1);
2888
2913
  if (excludePatterns.some((pattern) => entry.name === pattern || relativePath.startsWith(`${pattern}/`))) {
2889
2914
  continue;
@@ -2905,7 +2930,7 @@ async function computeContentHash(dirPath, excludePatterns = CONTENT_HASH_EXCLUD
2905
2930
  return hash.digest("hex");
2906
2931
  }
2907
2932
  async function detectDisplayVersion(dirPath, fallback, fallbackSource) {
2908
- const capTomlPath = join8(dirPath, "capability.toml");
2933
+ const capTomlPath = join9(dirPath, "capability.toml");
2909
2934
  if (existsSync11(capTomlPath)) {
2910
2935
  try {
2911
2936
  const content = await readFile9(capTomlPath, "utf-8");
@@ -2916,7 +2941,7 @@ async function detectDisplayVersion(dirPath, fallback, fallbackSource) {
2916
2941
  }
2917
2942
  } catch {}
2918
2943
  }
2919
- const pluginJsonPath = join8(dirPath, ".claude-plugin", "plugin.json");
2944
+ const pluginJsonPath = join9(dirPath, ".claude-plugin", "plugin.json");
2920
2945
  if (existsSync11(pluginJsonPath)) {
2921
2946
  try {
2922
2947
  const content = await readFile9(pluginJsonPath, "utf-8");
@@ -2926,7 +2951,7 @@ async function detectDisplayVersion(dirPath, fallback, fallbackSource) {
2926
2951
  }
2927
2952
  } catch {}
2928
2953
  }
2929
- const pkgJsonPath = join8(dirPath, "package.json");
2954
+ const pkgJsonPath = join9(dirPath, "package.json");
2930
2955
  if (existsSync11(pkgJsonPath)) {
2931
2956
  try {
2932
2957
  const content = await readFile9(pkgJsonPath, "utf-8");
@@ -2940,17 +2965,17 @@ async function detectDisplayVersion(dirPath, fallback, fallbackSource) {
2940
2965
  }
2941
2966
  async function detectPinVersion(sourceUrl, subPath) {
2942
2967
  const gitUrl = sourceToGitUrl(sourceUrl);
2943
- const tempPath = join8(OMNI_LOCAL, "_temp", `_pin-detect-${Date.now()}`);
2968
+ const tempPath = join9(OMNI_LOCAL, "_temp", `_pin-detect-${Date.now()}`);
2944
2969
  try {
2945
- await mkdir2(join8(tempPath, ".."), { recursive: true });
2970
+ await mkdir2(join9(tempPath, ".."), { recursive: true });
2946
2971
  const args = ["clone", "--depth", "1", gitUrl, tempPath];
2947
2972
  const { exitCode, stderr } = await spawnCapture("git", args);
2948
2973
  if (exitCode !== 0) {
2949
2974
  throw new Error(`Failed to clone ${gitUrl}: ${stderr.trim()}`);
2950
2975
  }
2951
2976
  const commit = await getRepoCommit(tempPath);
2952
- const checkPath = subPath ? join8(tempPath, subPath) : tempPath;
2953
- const capTomlPath = join8(checkPath, "capability.toml");
2977
+ const checkPath = subPath ? join9(tempPath, subPath) : tempPath;
2978
+ const capTomlPath = join9(checkPath, "capability.toml");
2954
2979
  if (existsSync11(capTomlPath)) {
2955
2980
  try {
2956
2981
  const content = await readFile9(capTomlPath, "utf-8");
@@ -2961,7 +2986,7 @@ async function detectPinVersion(sourceUrl, subPath) {
2961
2986
  }
2962
2987
  } catch {}
2963
2988
  }
2964
- const pluginJsonPath = join8(checkPath, ".claude-plugin", "plugin.json");
2989
+ const pluginJsonPath = join9(checkPath, ".claude-plugin", "plugin.json");
2965
2990
  if (existsSync11(pluginJsonPath)) {
2966
2991
  try {
2967
2992
  const content = await readFile9(pluginJsonPath, "utf-8");
@@ -2979,7 +3004,7 @@ async function detectPinVersion(sourceUrl, subPath) {
2979
3004
  }
2980
3005
  }
2981
3006
  async function cloneRepo(gitUrl, targetPath, ref) {
2982
- await mkdir2(join8(targetPath, ".."), { recursive: true });
3007
+ await mkdir2(join9(targetPath, ".."), { recursive: true });
2983
3008
  const args = ["clone", "--depth", "1"];
2984
3009
  if (ref) {
2985
3010
  args.push("--branch", ref);
@@ -3016,15 +3041,15 @@ async function fetchRepo(repoPath, ref) {
3016
3041
  return true;
3017
3042
  }
3018
3043
  function hasCapabilityToml(dirPath) {
3019
- return existsSync11(join8(dirPath, "capability.toml"));
3044
+ return existsSync11(join9(dirPath, "capability.toml"));
3020
3045
  }
3021
3046
  async function shouldWrapDirectory(dirPath) {
3022
- if (existsSync11(join8(dirPath, ".claude-plugin", "plugin.json"))) {
3047
+ if (existsSync11(join9(dirPath, ".claude-plugin", "plugin.json"))) {
3023
3048
  return true;
3024
3049
  }
3025
3050
  const allDirs = [...SKILL_DIRS, ...AGENT_DIRS, ...COMMAND_DIRS, ...RULE_DIRS, ...DOC_DIRS];
3026
3051
  for (const dirName of allDirs) {
3027
- const checkPath = join8(dirPath, dirName);
3052
+ const checkPath = join9(dirPath, dirName);
3028
3053
  if (existsSync11(checkPath)) {
3029
3054
  const stats = await stat(checkPath);
3030
3055
  if (stats.isDirectory()) {
@@ -3036,7 +3061,7 @@ async function shouldWrapDirectory(dirPath) {
3036
3061
  }
3037
3062
  async function findMatchingDirs(basePath, names) {
3038
3063
  for (const name of names) {
3039
- const dirPath = join8(basePath, name);
3064
+ const dirPath = join9(basePath, name);
3040
3065
  if (existsSync11(dirPath)) {
3041
3066
  const stats = await stat(dirPath);
3042
3067
  if (stats.isDirectory()) {
@@ -3053,10 +3078,10 @@ async function findContentItems(dirPath, filePatterns) {
3053
3078
  }
3054
3079
  const entries = (await readdir(dirPath, { withFileTypes: true })).sort((a, b) => a.name.localeCompare(b.name));
3055
3080
  for (const entry of entries) {
3056
- const entryPath = join8(dirPath, entry.name);
3081
+ const entryPath = join9(dirPath, entry.name);
3057
3082
  if (entry.isDirectory()) {
3058
3083
  for (const pattern of filePatterns) {
3059
- if (existsSync11(join8(entryPath, pattern))) {
3084
+ if (existsSync11(join9(entryPath, pattern))) {
3060
3085
  items.push({
3061
3086
  name: entry.name,
3062
3087
  path: entryPath,
@@ -3077,7 +3102,7 @@ async function findContentItems(dirPath, filePatterns) {
3077
3102
  return items;
3078
3103
  }
3079
3104
  async function parsePluginJson(dirPath) {
3080
- const pluginJsonPath = join8(dirPath, ".claude-plugin", "plugin.json");
3105
+ const pluginJsonPath = join9(dirPath, ".claude-plugin", "plugin.json");
3081
3106
  if (!existsSync11(pluginJsonPath)) {
3082
3107
  return null;
3083
3108
  }
@@ -3102,7 +3127,7 @@ async function parsePluginJson(dirPath) {
3102
3127
  }
3103
3128
  }
3104
3129
  async function readReadmeDescription(dirPath) {
3105
- const readmePath = join8(dirPath, "README.md");
3130
+ const readmePath = join9(dirPath, "README.md");
3106
3131
  if (!existsSync11(readmePath)) {
3107
3132
  return null;
3108
3133
  }
@@ -3144,8 +3169,8 @@ async function normalizeFolderNames(repoPath) {
3144
3169
  { from: "subagent", to: "subagents" }
3145
3170
  ];
3146
3171
  for (const { from, to } of renameMappings) {
3147
- const fromPath = join8(repoPath, from);
3148
- const toPath = join8(repoPath, to);
3172
+ const fromPath = join9(repoPath, from);
3173
+ const toPath = join9(repoPath, to);
3149
3174
  if (existsSync11(fromPath) && !existsSync11(toPath)) {
3150
3175
  try {
3151
3176
  const stats = await stat(fromPath);
@@ -3235,7 +3260,7 @@ repository = "${repoUrl}"
3235
3260
  wrapped = true
3236
3261
  commit = "${commit}"
3237
3262
  `;
3238
- await writeFile3(join8(repoPath, "capability.toml"), tomlContent, "utf-8");
3263
+ await writeFile4(join9(repoPath, "capability.toml"), tomlContent, "utf-8");
3239
3264
  }
3240
3265
  async function fetchGitCapabilitySource(id, config, options) {
3241
3266
  const gitUrl = sourceToGitUrl(config.source);
@@ -3245,29 +3270,29 @@ async function fetchGitCapabilitySource(id, config, options) {
3245
3270
  let repoPath;
3246
3271
  const gitRef = config.version && config.version !== "latest" ? config.version : undefined;
3247
3272
  if (config.path) {
3248
- const tempPath = join8(OMNI_LOCAL, "_temp", `${id}-repo`);
3249
- if (existsSync11(join8(tempPath, ".git"))) {
3273
+ const tempPath = join9(OMNI_LOCAL, "_temp", `${id}-repo`);
3274
+ if (existsSync11(join9(tempPath, ".git"))) {
3250
3275
  updated = await fetchRepo(tempPath, gitRef);
3251
3276
  commit = await getRepoCommit(tempPath);
3252
3277
  } else {
3253
- await mkdir2(join8(tempPath, ".."), { recursive: true });
3278
+ await mkdir2(join9(tempPath, ".."), { recursive: true });
3254
3279
  await cloneRepo(gitUrl, tempPath, gitRef);
3255
3280
  commit = await getRepoCommit(tempPath);
3256
3281
  updated = true;
3257
3282
  }
3258
- const sourcePath = join8(tempPath, config.path);
3283
+ const sourcePath = join9(tempPath, config.path);
3259
3284
  if (!existsSync11(sourcePath)) {
3260
3285
  throw new Error(`Path not found in repository: ${config.path}`);
3261
3286
  }
3262
3287
  if (existsSync11(targetPath)) {
3263
3288
  await rm(targetPath, { recursive: true });
3264
3289
  }
3265
- await mkdir2(join8(targetPath, ".."), { recursive: true });
3290
+ await mkdir2(join9(targetPath, ".."), { recursive: true });
3266
3291
  await cp(sourcePath, targetPath, { recursive: true });
3267
3292
  await rm(tempPath, { recursive: true });
3268
3293
  repoPath = targetPath;
3269
3294
  } else {
3270
- if (existsSync11(join8(targetPath, ".git"))) {
3295
+ if (existsSync11(join9(targetPath, ".git"))) {
3271
3296
  if (!options?.silent) {
3272
3297
  console.log(` Checking ${id}...`);
3273
3298
  }
@@ -3326,7 +3351,7 @@ async function fetchFileCapabilitySource(id, config, options) {
3326
3351
  throw new Error(`File source must be a directory: ${sourcePath}`);
3327
3352
  }
3328
3353
  const contentHash = await computeContentHash(sourcePath);
3329
- const hasCapToml = existsSync11(join8(sourcePath, "capability.toml"));
3354
+ const hasCapToml = existsSync11(join9(sourcePath, "capability.toml"));
3330
3355
  let needsWrap = false;
3331
3356
  if (!hasCapToml) {
3332
3357
  needsWrap = await shouldWrapDirectory(sourcePath);
@@ -3340,7 +3365,7 @@ async function fetchFileCapabilitySource(id, config, options) {
3340
3365
  if (existsSync11(targetPath)) {
3341
3366
  await rm(targetPath, { recursive: true });
3342
3367
  }
3343
- await mkdir2(join8(targetPath, ".."), { recursive: true });
3368
+ await mkdir2(join9(targetPath, ".."), { recursive: true });
3344
3369
  await cp(sourcePath, targetPath, { recursive: true });
3345
3370
  if (needsWrap) {
3346
3371
  await normalizeFolderNames(targetPath);
@@ -3420,7 +3445,7 @@ description = "${description}"
3420
3445
  wrapped = true
3421
3446
  source = "${source}"
3422
3447
  `;
3423
- await writeFile3(join8(targetPath, "capability.toml"), tomlContent, "utf-8");
3448
+ await writeFile4(join9(targetPath, "capability.toml"), tomlContent, "utf-8");
3424
3449
  }
3425
3450
  async function fetchCapabilitySource(id, sourceConfig, options) {
3426
3451
  const config = parseSourceConfig(sourceConfig);
@@ -3493,10 +3518,10 @@ generated_from_omni_toml = true
3493
3518
  }
3494
3519
  async function generateMcpCapabilityToml(id, mcpConfig, targetPath) {
3495
3520
  const tomlContent = generateMcpCapabilityTomlContent(id, mcpConfig);
3496
- await writeFile3(join8(targetPath, "capability.toml"), tomlContent, "utf-8");
3521
+ await writeFile4(join9(targetPath, "capability.toml"), tomlContent, "utf-8");
3497
3522
  }
3498
3523
  async function isGeneratedMcpCapability(capabilityDir) {
3499
- const tomlPath = join8(capabilityDir, "capability.toml");
3524
+ const tomlPath = join9(capabilityDir, "capability.toml");
3500
3525
  if (!existsSync11(tomlPath)) {
3501
3526
  console.warn("no capability.toml found in", capabilityDir);
3502
3527
  return false;
@@ -3512,14 +3537,14 @@ async function isGeneratedMcpCapability(capabilityDir) {
3512
3537
  }
3513
3538
  }
3514
3539
  async function cleanupStaleMcpCapabilities(currentMcpIds) {
3515
- const capabilitiesDir = join8(OMNI_LOCAL, "capabilities");
3540
+ const capabilitiesDir = join9(OMNI_LOCAL, "capabilities");
3516
3541
  if (!existsSync11(capabilitiesDir)) {
3517
3542
  return;
3518
3543
  }
3519
3544
  const entries = await readdir(capabilitiesDir, { withFileTypes: true });
3520
3545
  for (const entry of entries) {
3521
3546
  if (entry.isDirectory()) {
3522
- const capDir = join8(capabilitiesDir, entry.name);
3547
+ const capDir = join9(capabilitiesDir, entry.name);
3523
3548
  const isGenerated = await isGeneratedMcpCapability(capDir);
3524
3549
  if (isGenerated && !currentMcpIds.has(entry.name)) {
3525
3550
  await rm(capDir, { recursive: true });
@@ -3532,10 +3557,10 @@ async function generateMcpCapabilities(config) {
3532
3557
  await cleanupStaleMcpCapabilities(new Set);
3533
3558
  return;
3534
3559
  }
3535
- const mcpCapabilitiesDir = join8(OMNI_LOCAL, "capabilities");
3560
+ const mcpCapabilitiesDir = join9(OMNI_LOCAL, "capabilities");
3536
3561
  const currentMcpIds = new Set;
3537
3562
  for (const [id, mcpConfig] of Object.entries(config.mcps)) {
3538
- const targetPath = join8(mcpCapabilitiesDir, id);
3563
+ const targetPath = join9(mcpCapabilitiesDir, id);
3539
3564
  currentMcpIds.add(id);
3540
3565
  await mkdir2(targetPath, { recursive: true });
3541
3566
  await generateMcpCapabilityToml(id, mcpConfig, targetPath);
@@ -3544,7 +3569,7 @@ async function generateMcpCapabilities(config) {
3544
3569
  }
3545
3570
  async function fetchAllCapabilitySources(config, options) {
3546
3571
  await generateMcpCapabilities(config);
3547
- const tempDir = join8(OMNI_LOCAL, "_temp");
3572
+ const tempDir = join9(OMNI_LOCAL, "_temp");
3548
3573
  if (existsSync11(tempDir)) {
3549
3574
  await rm(tempDir, { recursive: true });
3550
3575
  }
@@ -3631,7 +3656,7 @@ async function checkForUpdates(config) {
3631
3656
  continue;
3632
3657
  }
3633
3658
  const gitConfig = sourceConfig;
3634
- if (!existsSync11(join8(targetPath, ".git"))) {
3659
+ if (!existsSync11(join9(targetPath, ".git"))) {
3635
3660
  updates.push({
3636
3661
  id,
3637
3662
  source: gitConfig.source,
@@ -3678,7 +3703,7 @@ async function verifyIntegrity(id, lockEntry) {
3678
3703
  return "capability directory missing";
3679
3704
  }
3680
3705
  if (lockEntry.commit) {
3681
- const gitDir = join8(capabilityPath, ".git");
3706
+ const gitDir = join9(capabilityPath, ".git");
3682
3707
  if (existsSync11(gitDir)) {
3683
3708
  try {
3684
3709
  const currentCommit = await getRepoCommit(capabilityPath);
@@ -3698,6 +3723,57 @@ async function verifyIntegrity(id, lockEntry) {
3698
3723
  }
3699
3724
  return null;
3700
3725
  }
3726
+ var OMNI_LOCAL = ".omni", SKILL_DIRS, AGENT_DIRS, COMMAND_DIRS, RULE_DIRS, DOC_DIRS, SKILL_FILES, AGENT_FILES, COMMAND_FILES, CONTENT_HASH_EXCLUDES;
3727
+ var init_sources = __esm(() => {
3728
+ init_dist();
3729
+ init_types2();
3730
+ SKILL_DIRS = ["skills", "skill"];
3731
+ AGENT_DIRS = ["agents", "agent", "subagents", "subagent"];
3732
+ COMMAND_DIRS = ["commands", "command"];
3733
+ RULE_DIRS = ["rules", "rule"];
3734
+ DOC_DIRS = ["docs", "doc", "documentation"];
3735
+ SKILL_FILES = ["SKILL.md", "skill.md", "Skill.md"];
3736
+ AGENT_FILES = ["AGENT.md", "agent.md", "Agent.md", "SUBAGENT.md", "subagent.md"];
3737
+ COMMAND_FILES = ["COMMAND.md", "command.md", "Command.md"];
3738
+ CONTENT_HASH_EXCLUDES = [
3739
+ ".git",
3740
+ "node_modules",
3741
+ ".omni",
3742
+ "__pycache__",
3743
+ ".pytest_cache",
3744
+ ".mypy_cache",
3745
+ "dist",
3746
+ "build",
3747
+ ".DS_Store",
3748
+ "Thumbs.db"
3749
+ ];
3750
+ });
3751
+
3752
+ // ../core/src/capability/index.ts
3753
+ var init_capability = __esm(() => {
3754
+ init_commands();
3755
+ init_docs();
3756
+ init_loader2();
3757
+ init_registry();
3758
+ init_rules();
3759
+ init_skills();
3760
+ init_sources();
3761
+ init_subagents();
3762
+ });
3763
+
3764
+ // ../core/src/hooks/index.ts
3765
+ var init_hooks = __esm(() => {
3766
+ init_constants();
3767
+ init_types();
3768
+ init_validation();
3769
+ init_variables();
3770
+ init_loader();
3771
+ init_merger();
3772
+ });
3773
+
3774
+ // ../core/src/config/provider.ts
3775
+ import { existsSync as existsSync12 } from "node:fs";
3776
+ import { readFile as readFile10, writeFile as writeFile5 } from "node:fs/promises";
3701
3777
  async function loadProviderConfig() {
3702
3778
  if (!existsSync12(PROVIDER_CONFIG_PATH)) {
3703
3779
  return { provider: "claude" };
@@ -3729,7 +3805,7 @@ async function writeProviderConfig(config) {
3729
3805
  lines.push("# Default: Claude");
3730
3806
  lines.push('provider = "claude"');
3731
3807
  }
3732
- await writeFile4(PROVIDER_CONFIG_PATH, `${lines.join(`
3808
+ await writeFile5(PROVIDER_CONFIG_PATH, `${lines.join(`
3733
3809
  `)}
3734
3810
  `, "utf-8");
3735
3811
  }
@@ -3743,6 +3819,14 @@ function parseProviderFlag(flag) {
3743
3819
  }
3744
3820
  throw new Error(`Invalid provider: ${flag}. Must be 'claude', 'codex', or 'both'.`);
3745
3821
  }
3822
+ var PROVIDER_CONFIG_PATH = ".omni/provider.toml";
3823
+ var init_provider = __esm(() => {
3824
+ init_dist();
3825
+ });
3826
+
3827
+ // ../core/src/config/toml-patcher.ts
3828
+ import { existsSync as existsSync13 } from "node:fs";
3829
+ import { readFile as readFile11, writeFile as writeFile6 } from "node:fs/promises";
3746
3830
  async function readConfigFile() {
3747
3831
  if (!existsSync13(CONFIG_PATH2)) {
3748
3832
  return "";
@@ -3750,7 +3834,7 @@ async function readConfigFile() {
3750
3834
  return readFile11(CONFIG_PATH2, "utf-8");
3751
3835
  }
3752
3836
  async function writeConfigFile(content) {
3753
- await writeFile5(CONFIG_PATH2, content, "utf-8");
3837
+ await writeFile6(CONFIG_PATH2, content, "utf-8");
3754
3838
  }
3755
3839
  function findSection(lines, sectionPattern) {
3756
3840
  return lines.findIndex((line) => sectionPattern.test(line.trim()));
@@ -3955,9 +4039,25 @@ async function patchAddToProfile(profileName, capabilityName) {
3955
4039
  function escapeRegExp(str) {
3956
4040
  return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3957
4041
  }
3958
- async function readMcpJson() {
3959
- if (!existsSync14(MCP_JSON_PATH)) {
3960
- return { mcpServers: {} };
4042
+ var CONFIG_PATH2 = "omni.toml";
4043
+ var init_toml_patcher = () => {};
4044
+
4045
+ // ../core/src/config/index.ts
4046
+ var init_config2 = __esm(() => {
4047
+ init_capabilities();
4048
+ init_config();
4049
+ init_parser();
4050
+ init_profiles();
4051
+ init_provider();
4052
+ init_toml_patcher();
4053
+ });
4054
+
4055
+ // ../core/src/mcp-json/manager.ts
4056
+ import { existsSync as existsSync14 } from "node:fs";
4057
+ import { readFile as readFile12, writeFile as writeFile7 } from "node:fs/promises";
4058
+ async function readMcpJson() {
4059
+ if (!existsSync14(MCP_JSON_PATH)) {
4060
+ return { mcpServers: {} };
3961
4061
  }
3962
4062
  try {
3963
4063
  const content = await readFile12(MCP_JSON_PATH, "utf-8");
@@ -3970,7 +4070,7 @@ async function readMcpJson() {
3970
4070
  }
3971
4071
  }
3972
4072
  async function writeMcpJson(config2) {
3973
- await writeFile6(MCP_JSON_PATH, `${JSON.stringify(config2, null, 2)}
4073
+ await writeFile7(MCP_JSON_PATH, `${JSON.stringify(config2, null, 2)}
3974
4074
  `, "utf-8");
3975
4075
  }
3976
4076
  function buildMcpServerConfig(mcp) {
@@ -4033,6 +4133,17 @@ async function syncMcpJson(capabilities2, previousManifest) {
4033
4133
  }
4034
4134
  await writeMcpJson(mcpJson);
4035
4135
  }
4136
+ var MCP_JSON_PATH = ".mcp.json";
4137
+ var init_manager = () => {};
4138
+
4139
+ // ../core/src/mcp-json/index.ts
4140
+ var init_mcp_json = __esm(() => {
4141
+ init_manager();
4142
+ });
4143
+
4144
+ // ../core/src/state/manifest.ts
4145
+ import { existsSync as existsSync15, mkdirSync as mkdirSync2, rmSync } from "node:fs";
4146
+ import { readFile as readFile13, writeFile as writeFile8 } from "node:fs/promises";
4036
4147
  async function loadManifest() {
4037
4148
  if (!existsSync15(MANIFEST_PATH)) {
4038
4149
  return {
@@ -4046,7 +4157,7 @@ async function loadManifest() {
4046
4157
  }
4047
4158
  async function saveManifest(manifest) {
4048
4159
  mkdirSync2(".omni/state", { recursive: true });
4049
- await writeFile7(MANIFEST_PATH, `${JSON.stringify(manifest, null, 2)}
4160
+ await writeFile8(MANIFEST_PATH, `${JSON.stringify(manifest, null, 2)}
4050
4161
  `, "utf-8");
4051
4162
  }
4052
4163
  function buildManifestFromCapabilities(capabilities2) {
@@ -4096,6 +4207,12 @@ async function cleanupStaleResources(previousManifest, currentCapabilityIds) {
4096
4207
  }
4097
4208
  return result;
4098
4209
  }
4210
+ var MANIFEST_PATH = ".omni/state/manifest.json", CURRENT_VERSION = 1;
4211
+ var init_manifest = () => {};
4212
+
4213
+ // ../core/src/state/providers.ts
4214
+ import { existsSync as existsSync16, mkdirSync as mkdirSync3 } from "node:fs";
4215
+ import { readFile as readFile14, writeFile as writeFile9 } from "node:fs/promises";
4099
4216
  async function readEnabledProviders() {
4100
4217
  if (!existsSync16(PROVIDERS_PATH)) {
4101
4218
  return DEFAULT_PROVIDERS;
@@ -4111,7 +4228,7 @@ async function readEnabledProviders() {
4111
4228
  async function writeEnabledProviders(providers) {
4112
4229
  mkdirSync3(STATE_DIR2, { recursive: true });
4113
4230
  const state = { enabled: providers };
4114
- await writeFile8(PROVIDERS_PATH, `${JSON.stringify(state, null, 2)}
4231
+ await writeFile9(PROVIDERS_PATH, `${JSON.stringify(state, null, 2)}
4115
4232
  `, "utf-8");
4116
4233
  }
4117
4234
  async function enableProvider(providerId) {
@@ -4129,6 +4246,15 @@ async function isProviderEnabled(providerId) {
4129
4246
  const current = await readEnabledProviders();
4130
4247
  return current.includes(providerId);
4131
4248
  }
4249
+ var STATE_DIR2 = ".omni/state", PROVIDERS_PATH, DEFAULT_PROVIDERS;
4250
+ var init_providers = __esm(() => {
4251
+ PROVIDERS_PATH = `${STATE_DIR2}/providers.json`;
4252
+ DEFAULT_PROVIDERS = ["claude-code"];
4253
+ });
4254
+
4255
+ // ../core/src/state/security-allows.ts
4256
+ import { existsSync as existsSync17, mkdirSync as mkdirSync4 } from "node:fs";
4257
+ import { readFile as readFile15, writeFile as writeFile10 } from "node:fs/promises";
4132
4258
  async function readSecurityAllows() {
4133
4259
  if (!existsSync17(SECURITY_PATH)) {
4134
4260
  return { ...DEFAULT_STATE };
@@ -4144,7 +4270,7 @@ async function readSecurityAllows() {
4144
4270
  async function writeSecurityAllows(state) {
4145
4271
  mkdirSync4(OMNI_DIR, { recursive: true });
4146
4272
  state.modifiedAt = new Date().toISOString();
4147
- await writeFile9(SECURITY_PATH, `${JSON.stringify(state, null, 2)}
4273
+ await writeFile10(SECURITY_PATH, `${JSON.stringify(state, null, 2)}
4148
4274
  `, "utf-8");
4149
4275
  }
4150
4276
  async function addSecurityAllow(capabilityId, findingType) {
@@ -4209,19 +4335,40 @@ async function clearAllSecurityAllows() {
4209
4335
  const state = { ...DEFAULT_STATE };
4210
4336
  await writeSecurityAllows(state);
4211
4337
  }
4338
+ var OMNI_DIR = ".omni", SECURITY_PATH, DEFAULT_STATE;
4339
+ var init_security_allows = __esm(() => {
4340
+ SECURITY_PATH = `${OMNI_DIR}/security.json`;
4341
+ DEFAULT_STATE = {
4342
+ version: 1,
4343
+ modifiedAt: new Date().toISOString(),
4344
+ allows: {}
4345
+ };
4346
+ });
4347
+
4348
+ // ../core/src/state/index.ts
4349
+ var init_state = __esm(() => {
4350
+ init_active_profile();
4351
+ init_manifest();
4352
+ init_providers();
4353
+ init_security_allows();
4354
+ });
4355
+
4356
+ // ../core/src/sync.ts
4357
+ import { spawn as spawn2 } from "node:child_process";
4358
+ import { mkdirSync as mkdirSync5 } from "node:fs";
4212
4359
  async function installCapabilityDependencies(silent) {
4213
- const { existsSync: existsSync182, readdirSync: readdirSync7, readFileSync: readFileSync2 } = await import("node:fs");
4214
- const { join: join92 } = await import("node:path");
4360
+ const { existsSync: existsSync18, readdirSync: readdirSync7, readFileSync: readFileSync2 } = await import("node:fs");
4361
+ const { join: join10 } = await import("node:path");
4215
4362
  const capabilitiesDir = ".omni/capabilities";
4216
- if (!existsSync182(capabilitiesDir)) {
4363
+ if (!existsSync18(capabilitiesDir)) {
4217
4364
  return;
4218
4365
  }
4219
4366
  const entries = readdirSync7(capabilitiesDir, { withFileTypes: true });
4220
4367
  async function commandExists(cmd) {
4221
- return await new Promise((resolve22) => {
4368
+ return await new Promise((resolve2) => {
4222
4369
  const proc = spawn2(cmd, ["--version"], { stdio: "ignore" });
4223
- proc.on("error", () => resolve22(false));
4224
- proc.on("close", (code) => resolve22(code === 0));
4370
+ proc.on("error", () => resolve2(false));
4371
+ proc.on("close", (code) => resolve2(code === 0));
4225
4372
  });
4226
4373
  }
4227
4374
  const hasBun = await commandExists("bun");
@@ -4233,13 +4380,13 @@ async function installCapabilityDependencies(silent) {
4233
4380
  if (!entry.isDirectory()) {
4234
4381
  continue;
4235
4382
  }
4236
- const capabilityPath = join92(capabilitiesDir, entry.name);
4237
- const packageJsonPath = join92(capabilityPath, "package.json");
4238
- if (!existsSync182(packageJsonPath)) {
4383
+ const capabilityPath = join10(capabilitiesDir, entry.name);
4384
+ const packageJsonPath = join10(capabilityPath, "package.json");
4385
+ if (!existsSync18(packageJsonPath)) {
4239
4386
  continue;
4240
4387
  }
4241
- await new Promise((resolve22, reject) => {
4242
- const useNpmCi = hasNpm && existsSync182(join92(capabilityPath, "package-lock.json"));
4388
+ await new Promise((resolve2, reject) => {
4389
+ const useNpmCi = hasNpm && existsSync18(join10(capabilityPath, "package-lock.json"));
4243
4390
  const cmd = hasBun ? "bun" : "npm";
4244
4391
  const args = hasBun ? ["install"] : useNpmCi ? ["ci"] : ["install"];
4245
4392
  const proc = spawn2(cmd, args, {
@@ -4252,7 +4399,7 @@ async function installCapabilityDependencies(silent) {
4252
4399
  });
4253
4400
  proc.on("close", (code) => {
4254
4401
  if (code === 0) {
4255
- resolve22();
4402
+ resolve2();
4256
4403
  } else {
4257
4404
  reject(new Error(`Failed to install dependencies for ${capabilityPath}:
4258
4405
  ${stderr}`));
@@ -4262,8 +4409,8 @@ ${stderr}`));
4262
4409
  reject(error);
4263
4410
  });
4264
4411
  });
4265
- const hasIndexTs = existsSync182(join92(capabilityPath, "index.ts"));
4266
- const hasBuiltIndex = existsSync182(join92(capabilityPath, "dist", "index.js"));
4412
+ const hasIndexTs = existsSync18(join10(capabilityPath, "index.ts"));
4413
+ const hasBuiltIndex = existsSync18(join10(capabilityPath, "dist", "index.js"));
4267
4414
  if (hasIndexTs && !hasBuiltIndex) {
4268
4415
  let hasBuildScript = false;
4269
4416
  try {
@@ -4271,7 +4418,7 @@ ${stderr}`));
4271
4418
  hasBuildScript = Boolean(pkgJson.scripts?.build);
4272
4419
  } catch {}
4273
4420
  if (hasBuildScript) {
4274
- await new Promise((resolve22, reject) => {
4421
+ await new Promise((resolve2, reject) => {
4275
4422
  const cmd = hasBun ? "bun" : "npm";
4276
4423
  const args = ["run", "build"];
4277
4424
  const proc = spawn2(cmd, args, {
@@ -4284,7 +4431,7 @@ ${stderr}`));
4284
4431
  });
4285
4432
  proc.on("close", (code) => {
4286
4433
  if (code === 0) {
4287
- resolve22();
4434
+ resolve2();
4288
4435
  } else {
4289
4436
  reject(new Error(`Failed to build capability ${capabilityPath}:
4290
4437
  ${stderr}`));
@@ -4401,6 +4548,40 @@ function generateInstructionsContent(rules, _docs) {
4401
4548
  }
4402
4549
  return content.trim();
4403
4550
  }
4551
+ var init_sync = __esm(() => {
4552
+ init_registry();
4553
+ init_sources();
4554
+ init_config();
4555
+ init_merger();
4556
+ init_manager();
4557
+ init_manifest();
4558
+ });
4559
+
4560
+ // ../core/src/security/types.ts
4561
+ var DEFAULT_SECURITY_CONFIG, DEFAULT_SCAN_SETTINGS;
4562
+ var init_types3 = __esm(() => {
4563
+ DEFAULT_SECURITY_CONFIG = {
4564
+ mode: "off",
4565
+ trusted_sources: [],
4566
+ scan: {
4567
+ unicode: true,
4568
+ symlinks: true,
4569
+ scripts: true,
4570
+ binaries: false
4571
+ }
4572
+ };
4573
+ DEFAULT_SCAN_SETTINGS = {
4574
+ unicode: true,
4575
+ symlinks: true,
4576
+ scripts: true,
4577
+ binaries: false
4578
+ };
4579
+ });
4580
+
4581
+ // ../core/src/security/scanner.ts
4582
+ import { existsSync as existsSync18 } from "node:fs";
4583
+ import { lstat, readdir as readdir2, readFile as readFile16, readlink, realpath } from "node:fs/promises";
4584
+ import { join as join10, relative, resolve as resolve2 } from "node:path";
4404
4585
  async function scanFileForUnicode(filePath, relativePath) {
4405
4586
  const findings = [];
4406
4587
  try {
@@ -4484,7 +4665,7 @@ async function scanFileForScripts(filePath, relativePath) {
4484
4665
  async function checkSymlink(symlinkPath, relativePath, capabilityRoot) {
4485
4666
  try {
4486
4667
  const linkTarget = await readlink(symlinkPath);
4487
- const resolvedTarget = resolve2(join9(symlinkPath, "..", linkTarget));
4668
+ const resolvedTarget = resolve2(join10(symlinkPath, "..", linkTarget));
4488
4669
  const normalizedRoot = await realpath(capabilityRoot);
4489
4670
  if (linkTarget.startsWith("/")) {
4490
4671
  return {
@@ -4531,7 +4712,7 @@ async function scanCapability(capabilityId, capabilityPath, settings = DEFAULT_S
4531
4712
  async function scanDirectory(dirPath) {
4532
4713
  const entries = await readdir2(dirPath, { withFileTypes: true });
4533
4714
  for (const entry of entries) {
4534
- const fullPath = join9(dirPath, entry.name);
4715
+ const fullPath = join10(dirPath, entry.name);
4535
4716
  const relativePath = relative(capabilityPath, fullPath);
4536
4717
  if (entry.name.startsWith(".") || entry.name === "node_modules" || entry.name === "__pycache__") {
4537
4718
  continue;
@@ -4675,6 +4856,141 @@ function formatScanResults(summary, verbose = false) {
4675
4856
  return lines.join(`
4676
4857
  `);
4677
4858
  }
4859
+ var UNICODE_PATTERNS, SUSPICIOUS_SCRIPT_PATTERNS, BINARY_EXTENSIONS, TEXT_EXTENSIONS;
4860
+ var init_scanner = __esm(() => {
4861
+ init_types3();
4862
+ UNICODE_PATTERNS = {
4863
+ bidi: [
4864
+ 8234,
4865
+ 8235,
4866
+ 8236,
4867
+ 8237,
4868
+ 8238,
4869
+ 8294,
4870
+ 8295,
4871
+ 8296,
4872
+ 8297
4873
+ ],
4874
+ zeroWidth: [
4875
+ 8203,
4876
+ 8204,
4877
+ 8205,
4878
+ 8288,
4879
+ 65279
4880
+ ],
4881
+ control: [
4882
+ 0,
4883
+ 1,
4884
+ 2,
4885
+ 3,
4886
+ 4,
4887
+ 5,
4888
+ 6,
4889
+ 7,
4890
+ 8,
4891
+ 11,
4892
+ 12,
4893
+ 14,
4894
+ 15,
4895
+ 16,
4896
+ 17,
4897
+ 18,
4898
+ 19,
4899
+ 20,
4900
+ 21,
4901
+ 22,
4902
+ 23,
4903
+ 24,
4904
+ 25,
4905
+ 26,
4906
+ 27,
4907
+ 28,
4908
+ 29,
4909
+ 30,
4910
+ 31,
4911
+ 127
4912
+ ]
4913
+ };
4914
+ SUSPICIOUS_SCRIPT_PATTERNS = [
4915
+ {
4916
+ pattern: /curl\s+.*\|\s*(ba)?sh/i,
4917
+ message: "Piping curl to shell can execute arbitrary remote code",
4918
+ severity: "high"
4919
+ },
4920
+ {
4921
+ pattern: /wget\s+.*\|\s*(ba)?sh/i,
4922
+ message: "Piping wget to shell can execute arbitrary remote code",
4923
+ severity: "high"
4924
+ },
4925
+ {
4926
+ pattern: /eval\s*\(\s*\$\(/,
4927
+ message: "eval with command substitution can be dangerous",
4928
+ severity: "medium"
4929
+ },
4930
+ {
4931
+ pattern: /rm\s+-rf\s+\/($|\s)|rm\s+-rf\s+~($|\s)/,
4932
+ message: "Recursive deletion from root or home directory",
4933
+ severity: "critical"
4934
+ },
4935
+ {
4936
+ pattern: /chmod\s+777/,
4937
+ message: "Setting world-writable permissions",
4938
+ severity: "medium"
4939
+ },
4940
+ {
4941
+ pattern: /\bsudo\b.*>/,
4942
+ message: "Using sudo with output redirection",
4943
+ severity: "medium"
4944
+ },
4945
+ {
4946
+ pattern: /base64\s+-d.*\|\s*(ba)?sh/i,
4947
+ message: "Decoding and executing base64 content",
4948
+ severity: "high"
4949
+ }
4950
+ ];
4951
+ BINARY_EXTENSIONS = new Set([
4952
+ ".exe",
4953
+ ".dll",
4954
+ ".so",
4955
+ ".dylib",
4956
+ ".bin",
4957
+ ".o",
4958
+ ".a",
4959
+ ".lib",
4960
+ ".pyc",
4961
+ ".pyo",
4962
+ ".class",
4963
+ ".jar",
4964
+ ".war",
4965
+ ".ear",
4966
+ ".wasm",
4967
+ ".node"
4968
+ ]);
4969
+ TEXT_EXTENSIONS = new Set([
4970
+ ".md",
4971
+ ".txt",
4972
+ ".toml",
4973
+ ".yaml",
4974
+ ".yml",
4975
+ ".json",
4976
+ ".js",
4977
+ ".ts",
4978
+ ".sh",
4979
+ ".bash",
4980
+ ".zsh",
4981
+ ".fish",
4982
+ ".py",
4983
+ ".rb"
4984
+ ]);
4985
+ });
4986
+
4987
+ // ../core/src/security/index.ts
4988
+ var init_security = __esm(() => {
4989
+ init_scanner();
4990
+ init_types3();
4991
+ });
4992
+
4993
+ // ../core/src/templates/agents.ts
4678
4994
  function generateAgentsTemplate() {
4679
4995
  return `# Project Instructions
4680
4996
 
@@ -4685,6 +5001,8 @@ function generateAgentsTemplate() {
4685
5001
  <!-- This section is populated during sync with capability rules and docs -->
4686
5002
  `;
4687
5003
  }
5004
+
5005
+ // ../core/src/templates/capability.ts
4688
5006
  function generateCapabilityToml2(options) {
4689
5007
  const description = options.description || "TODO: Add a description for your capability";
4690
5008
  return `[capability]
@@ -4795,12 +5113,16 @@ exit 0
4795
5113
  function formatDisplayName(kebabCase) {
4796
5114
  return kebabCase.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
4797
5115
  }
5116
+
5117
+ // ../core/src/templates/claude.ts
4798
5118
  function generateClaudeTemplate() {
4799
5119
  return `# Project Instructions
4800
5120
 
4801
5121
  <!-- Add your project-specific instructions here -->
4802
5122
  `;
4803
5123
  }
5124
+
5125
+ // ../core/src/templates/omni.ts
4804
5126
  function generateOmniMdTemplate() {
4805
5127
  return `# Project Instructions
4806
5128
 
@@ -4821,6 +5143,8 @@ function generateOmniMdTemplate() {
4821
5143
  <!-- Describe your project's architecture and key components -->
4822
5144
  `;
4823
5145
  }
5146
+
5147
+ // ../core/src/debug.ts
4824
5148
  function debug(message, data) {
4825
5149
  if (process.env["OMNIDEV_DEBUG"] !== "1") {
4826
5150
  return;
@@ -4834,253 +5158,166 @@ function debug(message, data) {
4834
5158
  }
4835
5159
  console.log(logLine);
4836
5160
  }
5161
+
5162
+ // ../core/src/index.ts
5163
+ var exports_src = {};
5164
+ __export(exports_src, {
5165
+ writeSecurityAllows: () => writeSecurityAllows,
5166
+ writeProviderConfig: () => writeProviderConfig,
5167
+ writeMcpJson: () => writeMcpJson,
5168
+ writeEnabledProviders: () => writeEnabledProviders,
5169
+ writeConfig: () => writeConfig,
5170
+ writeActiveProfileState: () => writeActiveProfileState,
5171
+ version: () => version,
5172
+ verifyIntegrity: () => verifyIntegrity,
5173
+ validateHooksConfig: () => validateHooksConfig,
5174
+ validateHook: () => validateHook,
5175
+ transformToOmnidev: () => transformToOmnidev,
5176
+ transformToClaude: () => transformToClaude,
5177
+ transformHooksConfig: () => transformHooksConfig,
5178
+ syncMcpJson: () => syncMcpJson,
5179
+ syncAgentConfiguration: () => syncAgentConfiguration,
5180
+ sourceToGitUrl: () => sourceToGitUrl,
5181
+ setProfile: () => setProfile,
5182
+ setActiveProfile: () => setActiveProfile,
5183
+ scanCapability: () => scanCapability,
5184
+ scanCapabilities: () => scanCapabilities,
5185
+ saveManifest: () => saveManifest,
5186
+ saveLockFile: () => saveLockFile,
5187
+ resolveEnabledCapabilities: () => resolveEnabledCapabilities,
5188
+ removeSecurityAllow: () => removeSecurityAllow,
5189
+ readSecurityAllows: () => readSecurityAllows,
5190
+ readMcpJson: () => readMcpJson,
5191
+ readEnabledProviders: () => readEnabledProviders,
5192
+ readCapabilityIdFromPath: () => readCapabilityIdFromPath,
5193
+ readActiveProfileState: () => readActiveProfileState,
5194
+ patchAddToProfile: () => patchAddToProfile,
5195
+ patchAddMcp: () => patchAddMcp,
5196
+ patchAddCapabilitySource: () => patchAddCapabilitySource,
5197
+ parseSourceConfig: () => parseSourceConfig,
5198
+ parseProviderFlag: () => parseProviderFlag,
5199
+ parseOmniConfig: () => parseOmniConfig,
5200
+ parseFileSourcePath: () => parseFileSourcePath,
5201
+ parseCapabilityConfig: () => parseCapabilityConfig,
5202
+ mergeHooksConfigs: () => mergeHooksConfigs,
5203
+ mergeAndDeduplicateHooks: () => mergeAndDeduplicateHooks,
5204
+ loadSubagents: () => loadSubagents,
5205
+ loadSkills: () => loadSkills,
5206
+ loadRules: () => loadRules,
5207
+ loadProviderConfig: () => loadProviderConfig,
5208
+ loadProfileConfig: () => loadProfileConfig,
5209
+ loadManifest: () => loadManifest,
5210
+ loadLockFile: () => loadLockFile,
5211
+ loadHooksFromCapability: () => loadHooksFromCapability,
5212
+ loadDocs: () => loadDocs,
5213
+ loadConfig: () => loadConfig,
5214
+ loadCommands: () => loadCommands,
5215
+ loadCapabilityHooks: () => loadCapabilityHooks,
5216
+ loadCapabilityConfig: () => loadCapabilityConfig,
5217
+ loadCapability: () => loadCapability,
5218
+ loadBaseConfig: () => loadBaseConfig,
5219
+ isValidMatcherPattern: () => isValidMatcherPattern,
5220
+ isSecurityAllowed: () => isSecurityAllowed,
5221
+ isProviderEnabled: () => isProviderEnabled,
5222
+ isPromptHookEvent: () => isPromptHookEvent,
5223
+ isMatcherEvent: () => isMatcherEvent,
5224
+ isHookType: () => isHookType,
5225
+ isHookPrompt: () => isHookPrompt,
5226
+ isHookEvent: () => isHookEvent,
5227
+ isHookCommand: () => isHookCommand,
5228
+ isGitSource: () => isGitSource,
5229
+ isFileSourceConfig: () => isFileSourceConfig,
5230
+ isFileSource: () => isFileSource,
5231
+ installCapabilityDependencies: () => installCapabilityDependencies,
5232
+ hasHooks: () => hasHooks,
5233
+ hasAnyHooks: () => hasAnyHooks,
5234
+ getVersion: () => getVersion,
5235
+ getSourceCapabilityPath: () => getSourceCapabilityPath,
5236
+ getLockFilePath: () => getLockFilePath,
5237
+ getHooksDirectory: () => getHooksDirectory,
5238
+ getHooksConfigPath: () => getHooksConfigPath,
5239
+ getEventsWithHooks: () => getEventsWithHooks,
5240
+ getEnabledCapabilities: () => getEnabledCapabilities,
5241
+ getCapabilityAllows: () => getCapabilityAllows,
5242
+ getAllSecurityAllows: () => getAllSecurityAllows,
5243
+ getActiveProviders: () => getActiveProviders,
5244
+ getActiveProfile: () => getActiveProfile,
5245
+ generateSkillTemplate: () => generateSkillTemplate,
5246
+ generateRuleTemplate: () => generateRuleTemplate,
5247
+ generateOmniMdTemplate: () => generateOmniMdTemplate,
5248
+ generateHooksTemplate: () => generateHooksTemplate,
5249
+ generateHookScript: () => generateHookScript,
5250
+ generateClaudeTemplate: () => generateClaudeTemplate,
5251
+ generateCapabilityToml: () => generateCapabilityToml2,
5252
+ generateAgentsTemplate: () => generateAgentsTemplate,
5253
+ formatScanResults: () => formatScanResults,
5254
+ findDuplicateCommands: () => findDuplicateCommands,
5255
+ fetchCapabilitySource: () => fetchCapabilitySource,
5256
+ fetchAllCapabilitySources: () => fetchAllCapabilitySources,
5257
+ enableProvider: () => enableProvider,
5258
+ enableCapability: () => enableCapability,
5259
+ discoverCapabilities: () => discoverCapabilities,
5260
+ disableProvider: () => disableProvider,
5261
+ disableCapability: () => disableCapability,
5262
+ detectPinVersion: () => detectPinVersion,
5263
+ debug: () => debug,
5264
+ createEmptyValidationResult: () => createEmptyValidationResult,
5265
+ createEmptyHooksConfig: () => createEmptyHooksConfig,
5266
+ countHooks: () => countHooks,
5267
+ containsOmnidevVariables: () => containsOmnidevVariables,
5268
+ containsClaudeVariables: () => containsClaudeVariables,
5269
+ clearCapabilityAllows: () => clearCapabilityAllows,
5270
+ clearAllSecurityAllows: () => clearAllSecurityAllows,
5271
+ clearActiveProfileState: () => clearActiveProfileState,
5272
+ cleanupStaleResources: () => cleanupStaleResources,
5273
+ checkVersionMismatch: () => checkVersionMismatch,
5274
+ checkForUpdates: () => checkForUpdates,
5275
+ buildSyncBundle: () => buildSyncBundle,
5276
+ buildManifestFromCapabilities: () => buildManifestFromCapabilities,
5277
+ buildCapabilityRegistry: () => buildCapabilityRegistry,
5278
+ addSecurityAllow: () => addSecurityAllow,
5279
+ VARIABLE_MAPPINGS: () => VARIABLE_MAPPINGS,
5280
+ SESSION_START_MATCHERS: () => SESSION_START_MATCHERS,
5281
+ PROMPT_HOOK_EVENTS: () => PROMPT_HOOK_EVENTS,
5282
+ PRE_COMPACT_MATCHERS: () => PRE_COMPACT_MATCHERS,
5283
+ NOTIFICATION_MATCHERS: () => NOTIFICATION_MATCHERS,
5284
+ MATCHER_EVENTS: () => MATCHER_EVENTS,
5285
+ HOOK_TYPES: () => HOOK_TYPES,
5286
+ HOOK_EVENTS: () => HOOK_EVENTS,
5287
+ HOOKS_DIRECTORY: () => HOOKS_DIRECTORY,
5288
+ HOOKS_CONFIG_FILENAME: () => HOOKS_CONFIG_FILENAME,
5289
+ DEFAULT_SECURITY_CONFIG: () => DEFAULT_SECURITY_CONFIG,
5290
+ DEFAULT_SCAN_SETTINGS: () => DEFAULT_SCAN_SETTINGS,
5291
+ DEFAULT_PROMPT_TIMEOUT: () => DEFAULT_PROMPT_TIMEOUT,
5292
+ DEFAULT_COMMAND_TIMEOUT: () => DEFAULT_COMMAND_TIMEOUT,
5293
+ COMMON_TOOL_MATCHERS: () => COMMON_TOOL_MATCHERS
5294
+ });
4837
5295
  function getVersion() {
4838
5296
  return version;
4839
5297
  }
4840
- var HOOK_EVENTS, MATCHER_EVENTS, PROMPT_HOOK_EVENTS, HOOK_TYPES, COMMON_TOOL_MATCHERS, NOTIFICATION_MATCHERS, SESSION_START_MATCHERS, PRE_COMPACT_MATCHERS, DEFAULT_COMMAND_TIMEOUT = 60, DEFAULT_PROMPT_TIMEOUT = 30, VARIABLE_MAPPINGS, HOOKS_CONFIG_FILENAME = "hooks.toml", HOOKS_DIRECTORY = "hooks", REVERSE_MAPPINGS, CAPABILITIES_DIR = ".omni/capabilities", CONFIG_PATH = "omni.toml", LOCAL_CONFIG = "omni.local.toml", STATE_DIR = ".omni/state", ACTIVE_PROFILE_PATH, OMNI_LOCAL = ".omni", SKILL_DIRS, AGENT_DIRS, COMMAND_DIRS, RULE_DIRS, DOC_DIRS, SKILL_FILES, AGENT_FILES, COMMAND_FILES, CONTENT_HASH_EXCLUDES, PROVIDER_CONFIG_PATH = ".omni/provider.toml", CONFIG_PATH2 = "omni.toml", MCP_JSON_PATH = ".mcp.json", MANIFEST_PATH = ".omni/state/manifest.json", CURRENT_VERSION = 1, STATE_DIR2 = ".omni/state", PROVIDERS_PATH, DEFAULT_PROVIDERS, OMNI_DIR = ".omni", SECURITY_PATH, DEFAULT_STATE, DEFAULT_SECURITY_CONFIG, DEFAULT_SCAN_SETTINGS, UNICODE_PATTERNS, SUSPICIOUS_SCRIPT_PATTERNS, BINARY_EXTENSIONS, TEXT_EXTENSIONS, version = "0.1.0";
4841
- var init_dist2 = __esm(() => {
4842
- init_chunk_1dqs11h6();
4843
- init_dist();
4844
- init_dist();
4845
- init_dist();
4846
- init_dist();
4847
- HOOK_EVENTS = [
4848
- "PreToolUse",
4849
- "PostToolUse",
4850
- "PermissionRequest",
4851
- "UserPromptSubmit",
4852
- "Stop",
4853
- "SubagentStop",
4854
- "Notification",
4855
- "SessionStart",
4856
- "SessionEnd",
4857
- "PreCompact"
4858
- ];
4859
- MATCHER_EVENTS = [
4860
- "PreToolUse",
4861
- "PostToolUse",
4862
- "PermissionRequest",
4863
- "Notification",
4864
- "SessionStart",
4865
- "PreCompact"
4866
- ];
4867
- PROMPT_HOOK_EVENTS = [
4868
- "Stop",
4869
- "SubagentStop",
4870
- "UserPromptSubmit",
4871
- "PreToolUse",
4872
- "PermissionRequest"
4873
- ];
4874
- HOOK_TYPES = ["command", "prompt"];
4875
- COMMON_TOOL_MATCHERS = [
4876
- "Bash",
4877
- "Read",
4878
- "Write",
4879
- "Edit",
4880
- "Glob",
4881
- "Grep",
4882
- "Task",
4883
- "WebFetch",
4884
- "WebSearch",
4885
- "NotebookEdit",
4886
- "LSP",
4887
- "TodoWrite",
4888
- "AskUserQuestion"
4889
- ];
4890
- NOTIFICATION_MATCHERS = [
4891
- "permission_prompt",
4892
- "idle_prompt",
4893
- "auth_success",
4894
- "elicitation_dialog"
4895
- ];
4896
- SESSION_START_MATCHERS = ["startup", "resume", "clear", "compact"];
4897
- PRE_COMPACT_MATCHERS = ["manual", "auto"];
4898
- VARIABLE_MAPPINGS = {
4899
- OMNIDEV_CAPABILITY_ROOT: "CLAUDE_PLUGIN_ROOT",
4900
- OMNIDEV_PROJECT_DIR: "CLAUDE_PROJECT_DIR"
4901
- };
4902
- REVERSE_MAPPINGS = Object.fromEntries(Object.entries(VARIABLE_MAPPINGS).map(([omni, claude]) => [claude, omni]));
4903
- ACTIVE_PROFILE_PATH = `${STATE_DIR}/active-profile`;
4904
- SKILL_DIRS = ["skills", "skill"];
4905
- AGENT_DIRS = ["agents", "agent", "subagents", "subagent"];
4906
- COMMAND_DIRS = ["commands", "command"];
4907
- RULE_DIRS = ["rules", "rule"];
4908
- DOC_DIRS = ["docs", "doc", "documentation"];
4909
- SKILL_FILES = ["SKILL.md", "skill.md", "Skill.md"];
4910
- AGENT_FILES = ["AGENT.md", "agent.md", "Agent.md", "SUBAGENT.md", "subagent.md"];
4911
- COMMAND_FILES = ["COMMAND.md", "command.md", "Command.md"];
4912
- CONTENT_HASH_EXCLUDES = [
4913
- ".git",
4914
- "node_modules",
4915
- ".omni",
4916
- "__pycache__",
4917
- ".pytest_cache",
4918
- ".mypy_cache",
4919
- "dist",
4920
- "build",
4921
- ".DS_Store",
4922
- "Thumbs.db"
4923
- ];
4924
- PROVIDERS_PATH = `${STATE_DIR2}/providers.json`;
4925
- DEFAULT_PROVIDERS = ["claude-code"];
4926
- SECURITY_PATH = `${OMNI_DIR}/security.json`;
4927
- DEFAULT_STATE = {
4928
- version: 1,
4929
- modifiedAt: new Date().toISOString(),
4930
- allows: {}
4931
- };
4932
- DEFAULT_SECURITY_CONFIG = {
4933
- mode: "off",
4934
- trusted_sources: [],
4935
- scan: {
4936
- unicode: true,
4937
- symlinks: true,
4938
- scripts: true,
4939
- binaries: false
4940
- }
4941
- };
4942
- DEFAULT_SCAN_SETTINGS = {
4943
- unicode: true,
4944
- symlinks: true,
4945
- scripts: true,
4946
- binaries: false
4947
- };
4948
- UNICODE_PATTERNS = {
4949
- bidi: [
4950
- 8234,
4951
- 8235,
4952
- 8236,
4953
- 8237,
4954
- 8238,
4955
- 8294,
4956
- 8295,
4957
- 8296,
4958
- 8297
4959
- ],
4960
- zeroWidth: [
4961
- 8203,
4962
- 8204,
4963
- 8205,
4964
- 8288,
4965
- 65279
4966
- ],
4967
- control: [
4968
- 0,
4969
- 1,
4970
- 2,
4971
- 3,
4972
- 4,
4973
- 5,
4974
- 6,
4975
- 7,
4976
- 8,
4977
- 11,
4978
- 12,
4979
- 14,
4980
- 15,
4981
- 16,
4982
- 17,
4983
- 18,
4984
- 19,
4985
- 20,
4986
- 21,
4987
- 22,
4988
- 23,
4989
- 24,
4990
- 25,
4991
- 26,
4992
- 27,
4993
- 28,
4994
- 29,
4995
- 30,
4996
- 31,
4997
- 127
4998
- ]
4999
- };
5000
- SUSPICIOUS_SCRIPT_PATTERNS = [
5001
- {
5002
- pattern: /curl\s+.*\|\s*(ba)?sh/i,
5003
- message: "Piping curl to shell can execute arbitrary remote code",
5004
- severity: "high"
5005
- },
5006
- {
5007
- pattern: /wget\s+.*\|\s*(ba)?sh/i,
5008
- message: "Piping wget to shell can execute arbitrary remote code",
5009
- severity: "high"
5010
- },
5011
- {
5012
- pattern: /eval\s*\(\s*\$\(/,
5013
- message: "eval with command substitution can be dangerous",
5014
- severity: "medium"
5015
- },
5016
- {
5017
- pattern: /rm\s+-rf\s+\/($|\s)|rm\s+-rf\s+~($|\s)/,
5018
- message: "Recursive deletion from root or home directory",
5019
- severity: "critical"
5020
- },
5021
- {
5022
- pattern: /chmod\s+777/,
5023
- message: "Setting world-writable permissions",
5024
- severity: "medium"
5025
- },
5026
- {
5027
- pattern: /\bsudo\b.*>/,
5028
- message: "Using sudo with output redirection",
5029
- severity: "medium"
5030
- },
5031
- {
5032
- pattern: /base64\s+-d.*\|\s*(ba)?sh/i,
5033
- message: "Decoding and executing base64 content",
5034
- severity: "high"
5035
- }
5036
- ];
5037
- BINARY_EXTENSIONS = new Set([
5038
- ".exe",
5039
- ".dll",
5040
- ".so",
5041
- ".dylib",
5042
- ".bin",
5043
- ".o",
5044
- ".a",
5045
- ".lib",
5046
- ".pyc",
5047
- ".pyo",
5048
- ".class",
5049
- ".jar",
5050
- ".war",
5051
- ".ear",
5052
- ".wasm",
5053
- ".node"
5054
- ]);
5055
- TEXT_EXTENSIONS = new Set([
5056
- ".md",
5057
- ".txt",
5058
- ".toml",
5059
- ".yaml",
5060
- ".yml",
5061
- ".json",
5062
- ".js",
5063
- ".ts",
5064
- ".sh",
5065
- ".bash",
5066
- ".zsh",
5067
- ".fish",
5068
- ".py",
5069
- ".rb"
5070
- ]);
5298
+ var version = "0.1.0";
5299
+ var init_src = __esm(() => {
5300
+ init_capability();
5301
+ init_hooks();
5302
+ init_config2();
5303
+ init_mcp_json();
5304
+ init_state();
5305
+ init_sync();
5306
+ init_security();
5307
+ init_types2();
5071
5308
  });
5072
5309
 
5073
5310
  // src/index.ts
5074
5311
  import { run } from "@stricli/core";
5075
5312
 
5076
5313
  // src/lib/dynamic-app.ts
5077
- import { existsSync as existsSync29 } from "node:fs";
5078
- import { createRequire as createRequire3 } from "node:module";
5314
+ import { existsSync as existsSync28 } from "node:fs";
5315
+ import { createRequire as createRequire2 } from "node:module";
5079
5316
  import { join as join18 } from "node:path";
5080
5317
  import { buildApplication, buildRouteMap as buildRouteMap7 } from "@stricli/core";
5081
5318
 
5082
5319
  // src/commands/add.ts
5083
- import { existsSync as existsSync22 } from "node:fs";
5320
+ import { existsSync as existsSync21 } from "node:fs";
5084
5321
  import { basename as basename3, resolve as resolve3 } from "node:path";
5085
5322
 
5086
5323
  // ../adapters/src/writers/cursor-rules.ts
@@ -5103,17 +5340,17 @@ var CursorRulesWriter = {
5103
5340
  }
5104
5341
  };
5105
5342
  // ../adapters/src/writers/hooks.ts
5106
- init_dist2();
5343
+ init_src();
5107
5344
  import { existsSync as existsSync19 } from "node:fs";
5108
- import { mkdir as mkdir3, readFile as readFile17, writeFile as writeFile10 } from "node:fs/promises";
5109
- import { dirname, join as join10 } from "node:path";
5345
+ import { mkdir as mkdir3, readFile as readFile17, writeFile as writeFile11 } from "node:fs/promises";
5346
+ import { dirname, join as join11 } from "node:path";
5110
5347
  var HooksWriter = {
5111
5348
  id: "hooks",
5112
5349
  async write(bundle, ctx) {
5113
5350
  if (!bundle.hooks) {
5114
5351
  return { filesWritten: [] };
5115
5352
  }
5116
- const settingsPath = join10(ctx.projectRoot, ctx.outputPath);
5353
+ const settingsPath = join11(ctx.projectRoot, ctx.outputPath);
5117
5354
  const parentDir = dirname(settingsPath);
5118
5355
  await mkdir3(parentDir, { recursive: true });
5119
5356
  const claudeHooks = transformHooksConfig(bundle.hooks, "toClaude");
@@ -5130,7 +5367,7 @@ var HooksWriter = {
5130
5367
  ...existingSettings,
5131
5368
  hooks: claudeHooks
5132
5369
  };
5133
- await writeFile10(settingsPath, `${JSON.stringify(newSettings, null, 2)}
5370
+ await writeFile11(settingsPath, `${JSON.stringify(newSettings, null, 2)}
5134
5371
  `, "utf-8");
5135
5372
  return {
5136
5373
  filesWritten: [ctx.outputPath]
@@ -5138,8 +5375,8 @@ var HooksWriter = {
5138
5375
  }
5139
5376
  };
5140
5377
  // ../adapters/src/writers/instructions-md.ts
5141
- import { existsSync as existsSync21 } from "node:fs";
5142
- import { mkdir as mkdir4, readFile as readFile19, writeFile as writeFile12 } from "node:fs/promises";
5378
+ import { existsSync as existsSync20 } from "node:fs";
5379
+ import { mkdir as mkdir4, readFile as readFile18, writeFile as writeFile12 } from "node:fs/promises";
5143
5380
  import { dirname as dirname2, join as join12 } from "node:path";
5144
5381
  var InstructionsMdWriter = {
5145
5382
  id: "instructions-md",
@@ -5151,8 +5388,8 @@ var InstructionsMdWriter = {
5151
5388
  }
5152
5389
  const omniMdPath = join12(ctx.projectRoot, "OMNI.md");
5153
5390
  let omniMdContent = "";
5154
- if (existsSync21(omniMdPath)) {
5155
- omniMdContent = await readFile19(omniMdPath, "utf-8");
5391
+ if (existsSync20(omniMdPath)) {
5392
+ omniMdContent = await readFile18(omniMdPath, "utf-8");
5156
5393
  }
5157
5394
  let content = omniMdContent;
5158
5395
  if (bundle.instructionsContent) {
@@ -5199,19 +5436,19 @@ async function executeWriters(writerConfigs, bundle, projectRoot) {
5199
5436
  const seen = new Set;
5200
5437
  const uniqueConfigs = [];
5201
5438
  let deduplicatedCount = 0;
5202
- for (const config of writerConfigs) {
5203
- const key = `${config.writer.id}:${config.outputPath}`;
5439
+ for (const config3 of writerConfigs) {
5440
+ const key = `${config3.writer.id}:${config3.outputPath}`;
5204
5441
  if (seen.has(key)) {
5205
5442
  deduplicatedCount++;
5206
5443
  continue;
5207
5444
  }
5208
5445
  seen.add(key);
5209
- uniqueConfigs.push(config);
5446
+ uniqueConfigs.push(config3);
5210
5447
  }
5211
5448
  const allFilesWritten = [];
5212
- for (const config of uniqueConfigs) {
5213
- const result = await config.writer.write(bundle, {
5214
- outputPath: config.outputPath,
5449
+ for (const config3 of uniqueConfigs) {
5450
+ const result = await config3.writer.write(bundle, {
5451
+ outputPath: config3.outputPath,
5215
5452
  projectRoot
5216
5453
  });
5217
5454
  allFilesWritten.push(...result.filesWritten);
@@ -5271,7 +5508,7 @@ var codexAdapter = {
5271
5508
  }
5272
5509
  };
5273
5510
  // ../adapters/src/cursor/index.ts
5274
- import { mkdirSync as mkdirSync8 } from "node:fs";
5511
+ import { mkdirSync as mkdirSync7 } from "node:fs";
5275
5512
  import { join as join15 } from "node:path";
5276
5513
  var cursorAdapter = {
5277
5514
  id: "cursor",
@@ -5283,7 +5520,7 @@ var cursorAdapter = {
5283
5520
  ],
5284
5521
  async init(ctx) {
5285
5522
  const rulesDir = join15(ctx.projectRoot, ".cursor", "rules");
5286
- mkdirSync8(rulesDir, { recursive: true });
5523
+ mkdirSync7(rulesDir, { recursive: true });
5287
5524
  return {
5288
5525
  filesCreated: [".cursor/rules/"],
5289
5526
  message: "Created .cursor/rules/ directory"
@@ -5298,7 +5535,7 @@ var cursorAdapter = {
5298
5535
  }
5299
5536
  };
5300
5537
  // ../adapters/src/opencode/index.ts
5301
- import { mkdirSync as mkdirSync9 } from "node:fs";
5538
+ import { mkdirSync as mkdirSync8 } from "node:fs";
5302
5539
  import { join as join16 } from "node:path";
5303
5540
  var opencodeAdapter = {
5304
5541
  id: "opencode",
@@ -5309,7 +5546,7 @@ var opencodeAdapter = {
5309
5546
  ],
5310
5547
  async init(ctx) {
5311
5548
  const opencodeDir = join16(ctx.projectRoot, ".opencode");
5312
- mkdirSync9(opencodeDir, { recursive: true });
5549
+ mkdirSync8(opencodeDir, { recursive: true });
5313
5550
  return {
5314
5551
  filesCreated: [".opencode/"],
5315
5552
  message: "OpenCode adapter initialized"
@@ -5324,7 +5561,7 @@ var opencodeAdapter = {
5324
5561
  }
5325
5562
  };
5326
5563
  // ../adapters/src/registry.ts
5327
- init_dist2();
5564
+ init_src();
5328
5565
  var builtInAdapters = [
5329
5566
  claudeCodeAdapter,
5330
5567
  codexAdapter,
@@ -5340,7 +5577,7 @@ async function getEnabledAdapters() {
5340
5577
  return enabledIds.map((id) => adapterMap.get(id)).filter((a) => a != null);
5341
5578
  }
5342
5579
  // src/commands/add.ts
5343
- init_dist2();
5580
+ init_src();
5344
5581
  import { buildCommand, buildRouteMap } from "@stricli/core";
5345
5582
  async function inferCapabilityId(source, sourceType) {
5346
5583
  if (sourceType === "local") {
@@ -5360,7 +5597,7 @@ async function inferCapabilityId(source, sourceType) {
5360
5597
  }
5361
5598
  async function runAddCap(flags, name) {
5362
5599
  try {
5363
- if (!existsSync22("omni.toml")) {
5600
+ if (!existsSync21("omni.toml")) {
5364
5601
  console.log("✗ No config file found");
5365
5602
  console.log(" Run: omnidev init");
5366
5603
  process.exit(1);
@@ -5383,7 +5620,7 @@ async function runAddCap(flags, name) {
5383
5620
  sourceType = "local";
5384
5621
  const localPath = flags.local.startsWith("file://") ? flags.local.slice(7) : flags.local;
5385
5622
  source = `file://${localPath}`;
5386
- if (!existsSync22(localPath)) {
5623
+ if (!existsSync21(localPath)) {
5387
5624
  console.error(`✗ Local path not found: ${localPath}`);
5388
5625
  process.exit(1);
5389
5626
  }
@@ -5416,9 +5653,9 @@ async function runAddCap(flags, name) {
5416
5653
  }
5417
5654
  console.log(` Inferred capability ID: ${capabilityId}`);
5418
5655
  }
5419
- const config = await loadBaseConfig();
5656
+ const config3 = await loadBaseConfig();
5420
5657
  const activeProfile = await getActiveProfile() ?? "default";
5421
- if (config.capabilities?.sources?.[capabilityId]) {
5658
+ if (config3.capabilities?.sources?.[capabilityId]) {
5422
5659
  console.error(`✗ Capability source "${capabilityId}" already exists`);
5423
5660
  console.log(" Use a different name or remove the existing source first");
5424
5661
  process.exit(1);
@@ -5464,14 +5701,14 @@ async function runAddCap(flags, name) {
5464
5701
  }
5465
5702
  async function runAddMcp(flags, name) {
5466
5703
  try {
5467
- if (!existsSync22("omni.toml")) {
5704
+ if (!existsSync21("omni.toml")) {
5468
5705
  console.log("✗ No config file found");
5469
5706
  console.log(" Run: omnidev init");
5470
5707
  process.exit(1);
5471
5708
  }
5472
- const config = await loadBaseConfig();
5709
+ const config3 = await loadBaseConfig();
5473
5710
  const activeProfile = await getActiveProfile() ?? "default";
5474
- if (config.mcps?.[name]) {
5711
+ if (config3.mcps?.[name]) {
5475
5712
  console.error(`✗ MCP "${name}" already exists`);
5476
5713
  console.log(" Use a different name or remove the existing MCP first");
5477
5714
  process.exit(1);
@@ -5747,11 +5984,11 @@ var addRoutes = buildRouteMap({
5747
5984
  });
5748
5985
 
5749
5986
  // src/commands/capability.ts
5750
- import { existsSync as existsSync23, mkdirSync as mkdirSync10 } from "node:fs";
5987
+ import { existsSync as existsSync22, mkdirSync as mkdirSync9 } from "node:fs";
5751
5988
  import { writeFile as writeFile14 } from "node:fs/promises";
5752
5989
  import { join as join17 } from "node:path";
5753
5990
  import { input } from "@inquirer/prompts";
5754
- init_dist2();
5991
+ init_src();
5755
5992
  import { buildCommand as buildCommand2, buildRouteMap as buildRouteMap2 } from "@stricli/core";
5756
5993
 
5757
5994
  // src/prompts/capability.ts
@@ -5768,15 +6005,14 @@ async function runCapabilityList(flags = {}) {
5768
6005
  if (capabilityPaths.length === 0) {
5769
6006
  console.log("No capabilities found.");
5770
6007
  console.log("");
5771
- console.log("To add capabilities, create directories in omni/capabilities/");
5772
- console.log("Each capability must have a capability.toml file.");
6008
+ console.log("To add capabilities, use the 'omnidev add cap' command.");
5773
6009
  return;
5774
6010
  }
5775
6011
  let updates;
5776
6012
  if (flags.verbose) {
5777
6013
  try {
5778
- const config = await loadBaseConfig();
5779
- const updateInfo = await checkForUpdates(config);
6014
+ const config3 = await loadBaseConfig();
6015
+ const updateInfo = await checkForUpdates(config3);
5780
6016
  updates = new Map(updateInfo.map((u) => [u.id, { hasUpdate: u.hasUpdate, latestVersion: u.latestVersion }]));
5781
6017
  } catch {}
5782
6018
  }
@@ -5831,8 +6067,8 @@ async function runCapabilityEnable(_flags, name) {
5831
6067
  try {
5832
6068
  const capabilityPaths = await discoverCapabilities();
5833
6069
  const capabilityExists = capabilityPaths.some(async (path) => {
5834
- const config = await loadCapabilityConfig(path);
5835
- return config.capability.id === name;
6070
+ const config3 = await loadCapabilityConfig(path);
6071
+ return config3.capability.id === name;
5836
6072
  });
5837
6073
  if (!capabilityExists) {
5838
6074
  console.error(`Error: Capability '${name}' not found`);
@@ -5935,7 +6171,7 @@ node_modules/
5935
6171
  }
5936
6172
  async function runCapabilityNew(flags, capabilityId) {
5937
6173
  try {
5938
- if (!existsSync23(".omni")) {
6174
+ if (!existsSync22(".omni")) {
5939
6175
  console.error("✗ OmniDev is not initialized in this directory.");
5940
6176
  console.log("");
5941
6177
  console.log(" Run: omnidev init");
@@ -5959,22 +6195,22 @@ async function runCapabilityNew(flags, capabilityId) {
5959
6195
  default: defaultPath
5960
6196
  });
5961
6197
  }
5962
- if (existsSync23(capabilityDir)) {
6198
+ if (existsSync22(capabilityDir)) {
5963
6199
  console.error(`✗ Directory already exists at ${capabilityDir}`);
5964
6200
  process.exit(1);
5965
6201
  }
5966
6202
  const name = toTitleCase(id);
5967
- mkdirSync10(capabilityDir, { recursive: true });
6203
+ mkdirSync9(capabilityDir, { recursive: true });
5968
6204
  const capabilityToml = generateCapabilityToml2({ id, name });
5969
6205
  await writeFile14(join17(capabilityDir, "capability.toml"), capabilityToml, "utf-8");
5970
6206
  const skillDir = join17(capabilityDir, "skills", "getting-started");
5971
- mkdirSync10(skillDir, { recursive: true });
6207
+ mkdirSync9(skillDir, { recursive: true });
5972
6208
  await writeFile14(join17(skillDir, "SKILL.md"), generateSkillTemplate("getting-started"), "utf-8");
5973
6209
  const rulesDir = join17(capabilityDir, "rules");
5974
- mkdirSync10(rulesDir, { recursive: true });
6210
+ mkdirSync9(rulesDir, { recursive: true });
5975
6211
  await writeFile14(join17(rulesDir, "coding-standards.md"), generateRuleTemplate("coding-standards"), "utf-8");
5976
6212
  const hooksDir = join17(capabilityDir, "hooks");
5977
- mkdirSync10(hooksDir, { recursive: true });
6213
+ mkdirSync9(hooksDir, { recursive: true });
5978
6214
  await writeFile14(join17(hooksDir, "hooks.toml"), generateHooksTemplate(), "utf-8");
5979
6215
  await writeFile14(join17(hooksDir, "example-hook.sh"), generateHookScript(), "utf-8");
5980
6216
  if (flags.programmatic) {
@@ -6136,9 +6372,9 @@ var capabilityRoutes = buildRouteMap2({
6136
6372
  });
6137
6373
 
6138
6374
  // src/commands/doctor.ts
6139
- import { existsSync as existsSync24 } from "node:fs";
6375
+ import { existsSync as existsSync23 } from "node:fs";
6140
6376
  import { execFile } from "node:child_process";
6141
- import { readFile as readFile20 } from "node:fs/promises";
6377
+ import { readFile as readFile19 } from "node:fs/promises";
6142
6378
  import { promisify } from "node:util";
6143
6379
  import { buildCommand as buildCommand3 } from "@stricli/core";
6144
6380
  var doctorCommand = buildCommand3({
@@ -6226,7 +6462,7 @@ async function checkPackageManager() {
6226
6462
  }
6227
6463
  }
6228
6464
  async function checkOmniLocalDir() {
6229
- const exists = existsSync24(".omni");
6465
+ const exists = existsSync23(".omni");
6230
6466
  if (!exists) {
6231
6467
  return {
6232
6468
  name: ".omni/ directory",
@@ -6243,7 +6479,7 @@ async function checkOmniLocalDir() {
6243
6479
  }
6244
6480
  async function checkConfig() {
6245
6481
  const configPath = "omni.toml";
6246
- if (!existsSync24(configPath)) {
6482
+ if (!existsSync23(configPath)) {
6247
6483
  return {
6248
6484
  name: "Configuration",
6249
6485
  passed: false,
@@ -6252,7 +6488,7 @@ async function checkConfig() {
6252
6488
  };
6253
6489
  }
6254
6490
  try {
6255
- const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_dist2(), exports_dist));
6491
+ const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_src(), exports_src));
6256
6492
  await loadConfig2();
6257
6493
  return {
6258
6494
  name: "Configuration",
@@ -6270,7 +6506,7 @@ async function checkConfig() {
6270
6506
  }
6271
6507
  async function checkRootGitignore() {
6272
6508
  const gitignorePath = ".gitignore";
6273
- if (!existsSync24(gitignorePath)) {
6509
+ if (!existsSync23(gitignorePath)) {
6274
6510
  return {
6275
6511
  name: "Root .gitignore",
6276
6512
  passed: false,
@@ -6278,7 +6514,7 @@ async function checkRootGitignore() {
6278
6514
  fix: "Run: omnidev init"
6279
6515
  };
6280
6516
  }
6281
- const content = await readFile20(gitignorePath, "utf-8");
6517
+ const content = await readFile19(gitignorePath, "utf-8");
6282
6518
  const lines = content.split(`
6283
6519
  `).map((line) => line.trim());
6284
6520
  const hasOmniDir = lines.includes(".omni/");
@@ -6304,7 +6540,7 @@ async function checkRootGitignore() {
6304
6540
  }
6305
6541
  async function checkCapabilitiesDir() {
6306
6542
  const capabilitiesDirPath = ".omni/capabilities";
6307
- if (!existsSync24(capabilitiesDirPath)) {
6543
+ if (!existsSync23(capabilitiesDirPath)) {
6308
6544
  return {
6309
6545
  name: "Capabilities Directory",
6310
6546
  passed: true,
@@ -6320,10 +6556,10 @@ async function checkCapabilitiesDir() {
6320
6556
 
6321
6557
  // src/commands/init.ts
6322
6558
  import { exec } from "node:child_process";
6323
- import { existsSync as existsSync25, mkdirSync as mkdirSync11 } from "node:fs";
6324
- import { readFile as readFile21, writeFile as writeFile15 } from "node:fs/promises";
6559
+ import { existsSync as existsSync24, mkdirSync as mkdirSync10 } from "node:fs";
6560
+ import { readFile as readFile20, writeFile as writeFile15 } from "node:fs/promises";
6325
6561
  import { promisify as promisify2 } from "node:util";
6326
- init_dist2();
6562
+ init_src();
6327
6563
  import { buildCommand as buildCommand4 } from "@stricli/core";
6328
6564
 
6329
6565
  // src/prompts/provider.ts
@@ -6334,8 +6570,8 @@ var PROVIDER_GITIGNORE_FILES = {
6334
6570
  codex: ["AGENTS.md", ".codex/"],
6335
6571
  opencode: [".opencode/"]
6336
6572
  };
6337
- function getProviderGitignoreFiles(providers) {
6338
- return providers.flatMap((p) => PROVIDER_GITIGNORE_FILES[p] ?? []);
6573
+ function getProviderGitignoreFiles(providers2) {
6574
+ return providers2.flatMap((p) => PROVIDER_GITIGNORE_FILES[p] ?? []);
6339
6575
  }
6340
6576
  async function promptForProviders() {
6341
6577
  const answers = await checkbox({
@@ -6362,9 +6598,9 @@ async function promptForGitignoreProviderFiles(selectedProviders) {
6362
6598
  var execAsync = promisify2(exec);
6363
6599
  async function runInit(_flags, providerArg) {
6364
6600
  console.log("Initializing OmniDev...");
6365
- mkdirSync11(".omni", { recursive: true });
6366
- mkdirSync11(".omni/capabilities", { recursive: true });
6367
- mkdirSync11(".omni/state", { recursive: true });
6601
+ mkdirSync10(".omni", { recursive: true });
6602
+ mkdirSync10(".omni/capabilities", { recursive: true });
6603
+ mkdirSync10(".omni/state", { recursive: true });
6368
6604
  await updateRootGitignore();
6369
6605
  let providerIds;
6370
6606
  const isInteractive = !providerArg;
@@ -6390,7 +6626,7 @@ async function runInit(_flags, providerArg) {
6390
6626
  }
6391
6627
  }
6392
6628
  await writeEnabledProviders(providerIds);
6393
- if (!existsSync25("omni.toml")) {
6629
+ if (!existsSync24("omni.toml")) {
6394
6630
  await writeConfig({
6395
6631
  profiles: {
6396
6632
  default: {
@@ -6406,13 +6642,13 @@ async function runInit(_flags, providerArg) {
6406
6642
  });
6407
6643
  await setActiveProfile("default");
6408
6644
  }
6409
- if (!existsSync25("OMNI.md")) {
6645
+ if (!existsSync24("OMNI.md")) {
6410
6646
  await writeFile15("OMNI.md", generateOmniMdTemplate(), "utf-8");
6411
6647
  }
6412
- const config = await loadConfig();
6648
+ const config3 = await loadConfig();
6413
6649
  const ctx = {
6414
6650
  projectRoot: process.cwd(),
6415
- config
6651
+ config: config3
6416
6652
  };
6417
6653
  const selectedAdapters = await initializeAdaptersForProviders(providerIds, ctx);
6418
6654
  const enabledAdapters = await getEnabledAdapters();
@@ -6484,8 +6720,8 @@ async function addProviderFilesToGitignore(entries) {
6484
6720
  async function addToGitignore(entriesToAdd, sectionHeader) {
6485
6721
  const gitignorePath = ".gitignore";
6486
6722
  let content = "";
6487
- if (existsSync25(gitignorePath)) {
6488
- content = await readFile21(gitignorePath, "utf-8");
6723
+ if (existsSync24(gitignorePath)) {
6724
+ content = await readFile20(gitignorePath, "utf-8");
6489
6725
  }
6490
6726
  const lines = content.split(`
6491
6727
  `);
@@ -6516,8 +6752,8 @@ async function getTrackedProviderFiles(files) {
6516
6752
  }
6517
6753
 
6518
6754
  // src/commands/profile.ts
6519
- import { existsSync as existsSync26 } from "node:fs";
6520
- init_dist2();
6755
+ import { existsSync as existsSync25 } from "node:fs";
6756
+ init_src();
6521
6757
  import { buildCommand as buildCommand5, buildRouteMap as buildRouteMap3 } from "@stricli/core";
6522
6758
  var listCommand2 = buildCommand5({
6523
6759
  docs: {
@@ -6560,15 +6796,15 @@ var profileRoutes = buildRouteMap3({
6560
6796
  });
6561
6797
  async function runProfileList() {
6562
6798
  try {
6563
- if (!existsSync26("omni.toml")) {
6799
+ if (!existsSync25("omni.toml")) {
6564
6800
  console.log("✗ No config file found");
6565
6801
  console.log(" Run: omnidev init");
6566
6802
  process.exit(1);
6567
6803
  }
6568
- const config = await loadConfig();
6804
+ const config3 = await loadConfig();
6569
6805
  const activeProfile = await getActiveProfile() ?? "default";
6570
- const profiles = config.profiles ?? {};
6571
- const profileNames = Object.keys(profiles);
6806
+ const profiles2 = config3.profiles ?? {};
6807
+ const profileNames = Object.keys(profiles2);
6572
6808
  if (profileNames.length === 0) {
6573
6809
  console.log("No profiles defined in omni.toml");
6574
6810
  console.log("");
@@ -6580,14 +6816,14 @@ async function runProfileList() {
6580
6816
  for (const name of profileNames) {
6581
6817
  const isActive = name === activeProfile;
6582
6818
  const icon = isActive ? "●" : "○";
6583
- const profile = profiles[name];
6819
+ const profile = profiles2[name];
6584
6820
  if (profile === undefined) {
6585
6821
  continue;
6586
6822
  }
6587
6823
  console.log(`${icon} ${name}${isActive ? " (active)" : ""}`);
6588
- const capabilities = resolveEnabledCapabilities(config, name);
6589
- if (capabilities.length > 0) {
6590
- console.log(` Capabilities: ${capabilities.join(", ")}`);
6824
+ const capabilities2 = resolveEnabledCapabilities(config3, name);
6825
+ if (capabilities2.length > 0) {
6826
+ console.log(` Capabilities: ${capabilities2.join(", ")}`);
6591
6827
  } else {
6592
6828
  console.log(" Capabilities: none");
6593
6829
  }
@@ -6600,18 +6836,18 @@ async function runProfileList() {
6600
6836
  }
6601
6837
  async function runProfileSet(profileName) {
6602
6838
  try {
6603
- if (!existsSync26("omni.toml")) {
6839
+ if (!existsSync25("omni.toml")) {
6604
6840
  console.log("✗ No config file found");
6605
6841
  console.log(" Run: omnidev init");
6606
6842
  process.exit(1);
6607
6843
  }
6608
- const config = await loadConfig();
6609
- const profiles = config.profiles ?? {};
6610
- if (!(profileName in profiles)) {
6844
+ const config3 = await loadConfig();
6845
+ const profiles2 = config3.profiles ?? {};
6846
+ if (!(profileName in profiles2)) {
6611
6847
  console.log(`✗ Profile "${profileName}" not found in omni.toml`);
6612
6848
  console.log("");
6613
6849
  console.log("Available profiles:");
6614
- const profileNames = Object.keys(profiles);
6850
+ const profileNames = Object.keys(profiles2);
6615
6851
  if (profileNames.length === 0) {
6616
6852
  console.log(" (none defined)");
6617
6853
  } else {
@@ -6633,7 +6869,7 @@ async function runProfileSet(profileName) {
6633
6869
  }
6634
6870
 
6635
6871
  // src/commands/provider.ts
6636
- init_dist2();
6872
+ init_src();
6637
6873
  import { buildCommand as buildCommand6, buildRouteMap as buildRouteMap4 } from "@stricli/core";
6638
6874
  async function runProviderList() {
6639
6875
  const enabled = await readEnabledProviders();
@@ -6748,8 +6984,8 @@ var providerRoutes = buildRouteMap4({
6748
6984
  });
6749
6985
 
6750
6986
  // src/commands/security.ts
6751
- init_dist2();
6752
- import { existsSync as existsSync27 } from "node:fs";
6987
+ init_src();
6988
+ import { existsSync as existsSync26 } from "node:fs";
6753
6989
  import { buildCommand as buildCommand7, buildRouteMap as buildRouteMap5 } from "@stricli/core";
6754
6990
  var VALID_FINDING_TYPES = [
6755
6991
  "unicode_bidi",
@@ -6764,10 +7000,10 @@ function isValidFindingType(type) {
6764
7000
  return VALID_FINDING_TYPES.includes(type);
6765
7001
  }
6766
7002
  async function filterAllowedFindings(summary, options = {}) {
6767
- const state = await readSecurityAllows();
7003
+ const state2 = await readSecurityAllows();
6768
7004
  const { includeLow = false } = options;
6769
7005
  const filteredResults = summary.results.map((result) => {
6770
- const allows = state.allows[result.capabilityId] ?? [];
7006
+ const allows = state2.allows[result.capabilityId] ?? [];
6771
7007
  const filteredFindings = result.findings.filter((finding) => {
6772
7008
  if (allows.includes(finding.type))
6773
7009
  return false;
@@ -6866,7 +7102,7 @@ function formatFindingsWithHints(summary) {
6866
7102
  }
6867
7103
  async function runSecurityIssues(flags = {}) {
6868
7104
  try {
6869
- if (!existsSync27("omni.toml")) {
7105
+ if (!existsSync26("omni.toml")) {
6870
7106
  console.log("No config file found");
6871
7107
  console.log(" Run: omnidev init");
6872
7108
  process.exit(1);
@@ -6874,12 +7110,12 @@ async function runSecurityIssues(flags = {}) {
6874
7110
  console.log("Scanning capabilities for security issues...");
6875
7111
  console.log("");
6876
7112
  const registry = await buildCapabilityRegistry();
6877
- const capabilities = registry.getAllCapabilities();
6878
- if (capabilities.length === 0) {
7113
+ const capabilities2 = registry.getAllCapabilities();
7114
+ if (capabilities2.length === 0) {
6879
7115
  console.log("No capabilities found to scan.");
6880
7116
  return;
6881
7117
  }
6882
- const capabilityInfos = capabilities.map((cap) => ({
7118
+ const capabilityInfos = capabilities2.map((cap) => ({
6883
7119
  id: cap.id,
6884
7120
  path: cap.path
6885
7121
  }));
@@ -6979,9 +7215,9 @@ async function runSecurityListAllows() {
6979
7215
  byCapability[allow.capabilityId] = [allow.findingType];
6980
7216
  }
6981
7217
  }
6982
- for (const [capId, types] of Object.entries(byCapability)) {
7218
+ for (const [capId, types3] of Object.entries(byCapability)) {
6983
7219
  console.log(` ${capId}:`);
6984
- for (const type of types) {
7220
+ for (const type of types3) {
6985
7221
  console.log(` - ${type}`);
6986
7222
  }
6987
7223
  console.log("");
@@ -7121,8 +7357,8 @@ var securityRoutes = buildRouteMap5({
7121
7357
  });
7122
7358
 
7123
7359
  // src/commands/sync.ts
7124
- import { existsSync as existsSync28 } from "node:fs";
7125
- init_dist2();
7360
+ import { existsSync as existsSync27 } from "node:fs";
7361
+ init_src();
7126
7362
  import { buildCommand as buildCommand8 } from "@stricli/core";
7127
7363
  var PROVIDERS_STATE_PATH = ".omni/state/providers.json";
7128
7364
  var syncCommand = buildCommand8({
@@ -7136,16 +7372,16 @@ var syncCommand = buildCommand8({
7136
7372
  });
7137
7373
  async function runSync() {
7138
7374
  try {
7139
- const config = await loadConfig();
7375
+ const config3 = await loadConfig();
7140
7376
  const activeProfile = await getActiveProfile() ?? "default";
7141
7377
  let adapters = await getEnabledAdapters();
7142
- if (!existsSync28(PROVIDERS_STATE_PATH) || adapters.length === 0) {
7378
+ if (!existsSync27(PROVIDERS_STATE_PATH) || adapters.length === 0) {
7143
7379
  console.log("No providers configured yet. Select your provider(s):");
7144
7380
  const providerIds = await promptForProviders();
7145
7381
  await writeEnabledProviders(providerIds);
7146
7382
  const ctx = {
7147
7383
  projectRoot: process.cwd(),
7148
- config
7384
+ config: config3
7149
7385
  };
7150
7386
  adapters = await initializeAdaptersForProviders(providerIds, ctx);
7151
7387
  console.log("");
@@ -7175,7 +7411,7 @@ async function runSync() {
7175
7411
  }
7176
7412
 
7177
7413
  // src/lib/dynamic-app.ts
7178
- init_dist2();
7414
+ init_src();
7179
7415
 
7180
7416
  // src/lib/command-transformer.ts
7181
7417
  import { buildCommand as buildCommand9, buildRouteMap as buildRouteMap6 } from "@stricli/core";
@@ -7327,7 +7563,7 @@ function transformCapabilityCommands(cliCommands) {
7327
7563
  }
7328
7564
 
7329
7565
  // src/lib/dynamic-app.ts
7330
- var require2 = createRequire3(import.meta.url);
7566
+ var require2 = createRequire2(import.meta.url);
7331
7567
  function readCliVersion() {
7332
7568
  try {
7333
7569
  const pkg = require2("../package.json");
@@ -7350,8 +7586,8 @@ async function buildDynamicApp() {
7350
7586
  };
7351
7587
  debug("Core routes registered", Object.keys(routes));
7352
7588
  const configPath = join18(process.cwd(), "omni.toml");
7353
- debug("Checking for config", { configPath, exists: existsSync29(configPath), cwd: process.cwd() });
7354
- if (existsSync29(configPath)) {
7589
+ debug("Checking for config", { configPath, exists: existsSync28(configPath), cwd: process.cwd() });
7590
+ if (existsSync28(configPath)) {
7355
7591
  try {
7356
7592
  debug("Loading capability commands...");
7357
7593
  const capabilityCommands = await loadCapabilityCommands();
@@ -7388,20 +7624,20 @@ async function buildDynamicApp() {
7388
7624
  return app;
7389
7625
  }
7390
7626
  async function loadCapabilityCommands() {
7391
- const { buildCapabilityRegistry: buildCapabilityRegistry2, installCapabilityDependencies: installCapabilityDependencies2 } = await Promise.resolve().then(() => (init_dist2(), exports_dist));
7627
+ const { buildCapabilityRegistry: buildCapabilityRegistry2, installCapabilityDependencies: installCapabilityDependencies2 } = await Promise.resolve().then(() => (init_src(), exports_src));
7392
7628
  await installCapabilityDependencies2(true);
7393
7629
  const registry = await buildCapabilityRegistry2();
7394
- const capabilities = registry.getAllCapabilities();
7630
+ const capabilities2 = registry.getAllCapabilities();
7395
7631
  debug("Registry built", {
7396
- capabilityCount: capabilities.length,
7397
- capabilities: capabilities.map((c) => ({ id: c.id, path: c.path }))
7632
+ capabilityCount: capabilities2.length,
7633
+ capabilities: capabilities2.map((c) => ({ id: c.id, path: c.path }))
7398
7634
  });
7399
7635
  const commands = {};
7400
- for (const capability of capabilities) {
7636
+ for (const capability3 of capabilities2) {
7401
7637
  try {
7402
- debug(`Loading capability '${capability.id}'`, { path: capability.path });
7403
- const capabilityExport = await loadCapabilityExport(capability);
7404
- debug(`Capability '${capability.id}' export`, {
7638
+ debug(`Loading capability '${capability3.id}'`, { path: capability3.path });
7639
+ const capabilityExport = await loadCapabilityExport(capability3);
7640
+ debug(`Capability '${capability3.id}' export`, {
7405
7641
  found: !!capabilityExport,
7406
7642
  hasCLICommands: !!capabilityExport?.cliCommands,
7407
7643
  cliCommands: capabilityExport?.cliCommands ? Object.keys(capabilityExport.cliCommands) : []
@@ -7410,57 +7646,57 @@ async function loadCapabilityCommands() {
7410
7646
  const transformedCommands = transformCapabilityCommands(capabilityExport.cliCommands);
7411
7647
  for (const [commandName, command] of Object.entries(transformedCommands)) {
7412
7648
  if (commands[commandName]) {
7413
- console.warn(`Command '${commandName}' from capability '${capability.id}' conflicts with existing command. Using '${capability.id}' version.`);
7649
+ console.warn(`Command '${commandName}' from capability '${capability3.id}' conflicts with existing command. Using '${capability3.id}' version.`);
7414
7650
  }
7415
7651
  commands[commandName] = command;
7416
- debug(`Registered command '${commandName}' from '${capability.id}'`, {
7652
+ debug(`Registered command '${commandName}' from '${capability3.id}'`, {
7417
7653
  type: typeof command,
7418
7654
  constructor: command?.constructor?.name
7419
7655
  });
7420
7656
  }
7421
7657
  }
7422
7658
  } catch (error) {
7423
- console.error(`Failed to load capability '${capability.id}':`, error);
7659
+ console.error(`Failed to load capability '${capability3.id}':`, error);
7424
7660
  }
7425
7661
  }
7426
7662
  return commands;
7427
7663
  }
7428
- async function loadCapabilityExport(capability) {
7429
- const capabilityPath = join18(process.cwd(), capability.path);
7664
+ async function loadCapabilityExport(capability3) {
7665
+ const capabilityPath = join18(process.cwd(), capability3.path);
7430
7666
  const builtIndexPath = join18(capabilityPath, "dist", "index.js");
7431
7667
  const jsIndexPath = join18(capabilityPath, "index.js");
7432
7668
  const tsIndexPath = join18(capabilityPath, "index.ts");
7433
- debug(`Checking entry points for '${capability.id}'`, {
7669
+ debug(`Checking entry points for '${capability3.id}'`, {
7434
7670
  capabilityPath,
7435
7671
  builtIndexPath,
7436
- builtExists: existsSync29(builtIndexPath),
7672
+ builtExists: existsSync28(builtIndexPath),
7437
7673
  jsIndexPath,
7438
- jsExists: existsSync29(jsIndexPath),
7674
+ jsExists: existsSync28(jsIndexPath),
7439
7675
  tsIndexPath,
7440
- tsExists: existsSync29(tsIndexPath)
7676
+ tsExists: existsSync28(tsIndexPath)
7441
7677
  });
7442
7678
  let indexPath = null;
7443
- if (existsSync29(builtIndexPath)) {
7679
+ if (existsSync28(builtIndexPath)) {
7444
7680
  indexPath = builtIndexPath;
7445
- } else if (existsSync29(jsIndexPath)) {
7681
+ } else if (existsSync28(jsIndexPath)) {
7446
7682
  indexPath = jsIndexPath;
7447
- } else if (existsSync29(tsIndexPath)) {
7683
+ } else if (existsSync28(tsIndexPath)) {
7448
7684
  indexPath = tsIndexPath;
7449
7685
  }
7450
7686
  if (!indexPath) {
7451
- debug(`No entry point found for '${capability.id}'`);
7687
+ debug(`No entry point found for '${capability3.id}'`);
7452
7688
  return null;
7453
7689
  }
7454
- debug(`Using entry point for '${capability.id}'`, { indexPath });
7690
+ debug(`Using entry point for '${capability3.id}'`, { indexPath });
7455
7691
  const module = await import(indexPath);
7456
- debug(`Module loaded for '${capability.id}'`, {
7692
+ debug(`Module loaded for '${capability3.id}'`, {
7457
7693
  hasDefault: !!module.default,
7458
7694
  moduleKeys: Object.keys(module),
7459
7695
  defaultType: typeof module.default,
7460
7696
  defaultKeys: module.default ? Object.keys(module.default) : []
7461
7697
  });
7462
7698
  if (!module.default) {
7463
- debug(`No default export for '${capability.id}'`);
7699
+ debug(`No default export for '${capability3.id}'`);
7464
7700
  return null;
7465
7701
  }
7466
7702
  const capExport = module.default;
@@ -7479,7 +7715,7 @@ async function loadCapabilityExport(capability) {
7479
7715
  }
7480
7716
 
7481
7717
  // src/index.ts
7482
- init_dist2();
7718
+ init_src();
7483
7719
 
7484
7720
  // src/lib/version-check.ts
7485
7721
  var NPM_REGISTRY_URL = "https://registry.npmjs.org/@omnidev-ai/cli/latest";