ocx 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4533,32 +4533,32 @@ var require_fuzzysort = __commonJS((exports, module) => {
4533
4533
  noResults.total = 0;
4534
4534
  var NULL = null;
4535
4535
  var noTarget = prepare("");
4536
- var fastpriorityqueue = (r2) => {
4537
- var e2 = [], o2 = 0, a3 = {}, v2 = (r3) => {
4538
- for (var a4 = 0, v3 = e2[a4], c2 = 1;c2 < o2; ) {
4536
+ var fastpriorityqueue = (r3) => {
4537
+ var e4 = [], o2 = 0, a3 = {}, v2 = (r4) => {
4538
+ for (var a4 = 0, v3 = e4[a4], c2 = 1;c2 < o2; ) {
4539
4539
  var s2 = c2 + 1;
4540
- a4 = c2, s2 < o2 && e2[s2]._score < e2[c2]._score && (a4 = s2), e2[a4 - 1 >> 1] = e2[a4], c2 = 1 + (a4 << 1);
4540
+ a4 = c2, s2 < o2 && e4[s2]._score < e4[c2]._score && (a4 = s2), e4[a4 - 1 >> 1] = e4[a4], c2 = 1 + (a4 << 1);
4541
4541
  }
4542
- for (var f2 = a4 - 1 >> 1;a4 > 0 && v3._score < e2[f2]._score; f2 = (a4 = f2) - 1 >> 1)
4543
- e2[a4] = e2[f2];
4544
- e2[a4] = v3;
4542
+ for (var f2 = a4 - 1 >> 1;a4 > 0 && v3._score < e4[f2]._score; f2 = (a4 = f2) - 1 >> 1)
4543
+ e4[a4] = e4[f2];
4544
+ e4[a4] = v3;
4545
4545
  };
4546
- return a3.add = (r3) => {
4546
+ return a3.add = (r4) => {
4547
4547
  var a4 = o2;
4548
- e2[o2++] = r3;
4549
- for (var v3 = a4 - 1 >> 1;a4 > 0 && r3._score < e2[v3]._score; v3 = (a4 = v3) - 1 >> 1)
4550
- e2[a4] = e2[v3];
4551
- e2[a4] = r3;
4552
- }, a3.poll = (r3) => {
4548
+ e4[o2++] = r4;
4549
+ for (var v3 = a4 - 1 >> 1;a4 > 0 && r4._score < e4[v3]._score; v3 = (a4 = v3) - 1 >> 1)
4550
+ e4[a4] = e4[v3];
4551
+ e4[a4] = r4;
4552
+ }, a3.poll = (r4) => {
4553
4553
  if (o2 !== 0) {
4554
- var a4 = e2[0];
4555
- return e2[0] = e2[--o2], v2(), a4;
4554
+ var a4 = e4[0];
4555
+ return e4[0] = e4[--o2], v2(), a4;
4556
4556
  }
4557
- }, a3.peek = (r3) => {
4557
+ }, a3.peek = (r4) => {
4558
4558
  if (o2 !== 0)
4559
- return e2[0];
4560
- }, a3.replaceTop = (r3) => {
4561
- e2[0] = r3, v2();
4559
+ return e4[0];
4560
+ }, a3.replaceTop = (r4) => {
4561
+ e4[0] = r4, v2();
4562
4562
  }, a3;
4563
4563
  };
4564
4564
  var q2 = fastpriorityqueue();
@@ -13052,11 +13052,14 @@ var targetPathSchema = exports_external.string().refine((path3) => path3.startsW
13052
13052
  var skillTargetSchema = exports_external.string().regex(/^\.opencode\/skill\/[a-z0-9]+(-[a-z0-9]+)*\/SKILL\.md$/, {
13053
13053
  message: 'Skill target must match pattern ".opencode/skill/<name>/SKILL.md" where name follows OpenCode naming rules'
13054
13054
  });
13055
- var mcpServerSchema = exports_external.object({
13055
+ var mcpServerObjectSchema = exports_external.object({
13056
13056
  type: exports_external.enum(["remote", "local"]),
13057
13057
  url: exports_external.string().url().optional(),
13058
13058
  command: exports_external.array(exports_external.string()).optional(),
13059
+ args: exports_external.array(exports_external.string()).optional(),
13060
+ environment: exports_external.record(exports_external.string()).optional(),
13059
13061
  headers: exports_external.record(exports_external.string()).optional(),
13062
+ oauth: exports_external.boolean().optional(),
13060
13063
  enabled: exports_external.boolean().default(true)
13061
13064
  }).refine((data) => {
13062
13065
  if (data.type === "remote" && !data.url) {
@@ -13069,10 +13072,27 @@ var mcpServerSchema = exports_external.object({
13069
13072
  }, {
13070
13073
  message: "Remote MCP servers require 'url', local servers require 'command'"
13071
13074
  });
13072
- var componentFileSchema = exports_external.object({
13075
+ var mcpServerSchema = exports_external.union([exports_external.string().url(), mcpServerObjectSchema]);
13076
+ var componentFileObjectSchema = exports_external.object({
13073
13077
  path: exports_external.string().min(1, "File path cannot be empty"),
13074
13078
  target: targetPathSchema
13075
13079
  });
13080
+ var componentFileSchema = exports_external.union([
13081
+ exports_external.string().min(1, "File path cannot be empty"),
13082
+ componentFileObjectSchema
13083
+ ]);
13084
+ var agentConfigSchema = exports_external.object({
13085
+ tools: exports_external.record(exports_external.boolean()).optional(),
13086
+ temperature: exports_external.number().min(0).max(2).optional(),
13087
+ prompt: exports_external.string().optional(),
13088
+ permission: exports_external.record(exports_external.enum(["allow", "deny"])).optional()
13089
+ });
13090
+ var opencodeConfigSchema = exports_external.object({
13091
+ plugins: exports_external.array(exports_external.string()).optional(),
13092
+ tools: exports_external.record(exports_external.boolean()).optional(),
13093
+ agent: exports_external.record(agentConfigSchema).optional(),
13094
+ instructions: exports_external.array(exports_external.string()).optional()
13095
+ });
13076
13096
  var componentManifestSchema = exports_external.object({
13077
13097
  name: openCodeNameSchema,
13078
13098
  type: componentTypeSchema,
@@ -13083,8 +13103,41 @@ var componentManifestSchema = exports_external.object({
13083
13103
  npmDevDependencies: exports_external.array(exports_external.string()).optional(),
13084
13104
  mcpServers: exports_external.record(mcpServerSchema).optional(),
13085
13105
  mcpScope: exports_external.enum(["agent", "global"]).default("agent"),
13106
+ opencode: opencodeConfigSchema.optional(),
13086
13107
  disabledTools: exports_external.array(exports_external.string()).optional()
13087
13108
  });
13109
+ function inferTargetPath(sourcePath) {
13110
+ return `.opencode/${sourcePath}`;
13111
+ }
13112
+ function normalizeFile(file) {
13113
+ if (typeof file === "string") {
13114
+ return {
13115
+ path: file,
13116
+ target: inferTargetPath(file)
13117
+ };
13118
+ }
13119
+ return file;
13120
+ }
13121
+ function normalizeMcpServer(server) {
13122
+ if (typeof server === "string") {
13123
+ return {
13124
+ type: "remote",
13125
+ url: server,
13126
+ enabled: true
13127
+ };
13128
+ }
13129
+ return server;
13130
+ }
13131
+ function normalizeComponentManifest(manifest) {
13132
+ return {
13133
+ ...manifest,
13134
+ files: manifest.files.map(normalizeFile),
13135
+ mcpServers: manifest.mcpServers ? Object.fromEntries(Object.entries(manifest.mcpServers).map(([name, server]) => [
13136
+ name,
13137
+ normalizeMcpServer(server)
13138
+ ])) : undefined
13139
+ };
13140
+ }
13088
13141
  var semverRegex = /^\d+\.\d+\.\d+(-[a-zA-Z0-9.-]+)?(\+[a-zA-Z0-9.-]+)?$/;
13089
13142
  var registrySchema = exports_external.object({
13090
13143
  name: exports_external.string().min(1, "Registry name cannot be empty"),
@@ -13252,6 +13305,48 @@ async function fetchFileContent(baseUrl, componentName, filePath) {
13252
13305
  return response.text();
13253
13306
  }
13254
13307
 
13308
+ // ../../node_modules/.bun/remeda@2.33.0/node_modules/remeda/dist/lazyDataLastImpl-DtF3cihj.js
13309
+ function e2(e3, t2, n2) {
13310
+ let r2 = (n3) => e3(n3, ...t2);
13311
+ return n2 === undefined ? r2 : Object.assign(r2, { lazy: n2, lazyArgs: t2 });
13312
+ }
13313
+
13314
+ // ../../node_modules/.bun/remeda@2.33.0/node_modules/remeda/dist/purry-GjwKKIlp.js
13315
+ function t2(t3, n2, r2) {
13316
+ let i2 = t3.length - n2.length;
13317
+ if (i2 === 0)
13318
+ return t3(...n2);
13319
+ if (i2 === 1)
13320
+ return e2(t3, n2, r2);
13321
+ throw Error(`Wrong number of arguments`);
13322
+ }
13323
+
13324
+ // ../../node_modules/.bun/remeda@2.33.0/node_modules/remeda/dist/isPlainObject.js
13325
+ function e3(e4) {
13326
+ if (typeof e4 != `object` || !e4)
13327
+ return false;
13328
+ let t3 = Object.getPrototypeOf(e4);
13329
+ return t3 === null || t3 === Object.prototype;
13330
+ }
13331
+
13332
+ // ../../node_modules/.bun/remeda@2.33.0/node_modules/remeda/dist/mergeDeep.js
13333
+ function n2(...t3) {
13334
+ return t2(r2, t3);
13335
+ }
13336
+ function r2(e4, n3) {
13337
+ let i2 = { ...e4, ...n3 };
13338
+ for (let a3 in n3) {
13339
+ if (!(a3 in e4))
13340
+ continue;
13341
+ let { [a3]: o2 } = e4;
13342
+ if (!e3(o2))
13343
+ continue;
13344
+ let { [a3]: s2 } = n3;
13345
+ e3(s2) && (i2[a3] = r2(o2, s2));
13346
+ }
13347
+ return i2;
13348
+ }
13349
+
13255
13350
  // src/registry/resolver.ts
13256
13351
  async function resolveDependencies(registries, componentNames) {
13257
13352
  const resolved = new Map;
@@ -13261,6 +13356,9 @@ async function resolveDependencies(registries, componentNames) {
13261
13356
  const npmDeps = new Set;
13262
13357
  const npmDevDeps = new Set;
13263
13358
  const disabledTools = new Set;
13359
+ const plugins = new Set;
13360
+ const agentConfigs = {};
13361
+ const instructionsSet = new Set;
13264
13362
  async function resolve2(name, path3 = []) {
13265
13363
  if (resolved.has(name)) {
13266
13364
  return;
@@ -13287,15 +13385,16 @@ async function resolveDependencies(registries, componentNames) {
13287
13385
  for (const dep of component.dependencies) {
13288
13386
  await resolve2(dep, [...path3, name]);
13289
13387
  }
13388
+ const normalizedComponent = normalizeComponentManifest(component);
13290
13389
  resolved.set(name, {
13291
- ...component,
13390
+ ...normalizedComponent,
13292
13391
  registryName: foundRegistry.name,
13293
13392
  baseUrl: foundRegistry.url
13294
13393
  });
13295
13394
  visiting.delete(name);
13296
- if (component.mcpServers) {
13395
+ if (normalizedComponent.mcpServers) {
13297
13396
  const serverNames = [];
13298
- for (const [serverName, config2] of Object.entries(component.mcpServers)) {
13397
+ for (const [serverName, config2] of Object.entries(normalizedComponent.mcpServers)) {
13299
13398
  mcpServers[serverName] = config2;
13300
13399
  serverNames.push(serverName);
13301
13400
  }
@@ -13322,6 +13421,30 @@ async function resolveDependencies(registries, componentNames) {
13322
13421
  disabledTools.add(tool);
13323
13422
  }
13324
13423
  }
13424
+ if (component.opencode) {
13425
+ if (component.opencode.plugins) {
13426
+ for (const plugin of component.opencode.plugins) {
13427
+ plugins.add(plugin);
13428
+ }
13429
+ }
13430
+ if (component.opencode.agent) {
13431
+ for (const [agentName, config2] of Object.entries(component.opencode.agent)) {
13432
+ agentConfigs[agentName] = n2(agentConfigs[agentName] ?? {}, config2);
13433
+ }
13434
+ }
13435
+ if (component.opencode.instructions) {
13436
+ for (const instruction of component.opencode.instructions) {
13437
+ instructionsSet.add(instruction);
13438
+ }
13439
+ }
13440
+ if (component.opencode.tools) {
13441
+ for (const [tool, enabled] of Object.entries(component.opencode.tools)) {
13442
+ if (enabled === false) {
13443
+ disabledTools.add(tool);
13444
+ }
13445
+ }
13446
+ }
13447
+ }
13325
13448
  }
13326
13449
  for (const name of componentNames) {
13327
13450
  await resolve2(name);
@@ -13335,7 +13458,10 @@ async function resolveDependencies(registries, componentNames) {
13335
13458
  agentMcpBindings,
13336
13459
  npmDependencies: Array.from(npmDeps),
13337
13460
  npmDevDependencies: Array.from(npmDevDeps),
13338
- disabledTools: Array.from(disabledTools)
13461
+ disabledTools: Array.from(disabledTools),
13462
+ plugins: Array.from(plugins),
13463
+ agentConfigs,
13464
+ instructions: Array.from(instructionsSet)
13339
13465
  };
13340
13466
  }
13341
13467
 
@@ -14651,13 +14777,13 @@ function applyEdits(text2, edits) {
14651
14777
  });
14652
14778
  let lastModifiedOffset = text2.length;
14653
14779
  for (let i2 = sortedEdits.length - 1;i2 >= 0; i2--) {
14654
- let e2 = sortedEdits[i2];
14655
- if (e2.offset + e2.length <= lastModifiedOffset) {
14656
- text2 = applyEdit(text2, e2);
14780
+ let e4 = sortedEdits[i2];
14781
+ if (e4.offset + e4.length <= lastModifiedOffset) {
14782
+ text2 = applyEdit(text2, e4);
14657
14783
  } else {
14658
14784
  throw new Error("Overlapping edit");
14659
14785
  }
14660
- lastModifiedOffset = e2.offset;
14786
+ lastModifiedOffset = e4.offset;
14661
14787
  }
14662
14788
  return text2;
14663
14789
  }
@@ -14687,13 +14813,18 @@ var ocxLockSchema = exports_external.object({
14687
14813
  var opencodeMcpSchema = exports_external.record(mcpServerSchema);
14688
14814
  var opencodeAgentSchema = exports_external.object({
14689
14815
  disable: exports_external.boolean().optional(),
14690
- tools: exports_external.record(exports_external.boolean()).optional()
14816
+ tools: exports_external.record(exports_external.boolean()).optional(),
14817
+ temperature: exports_external.number().min(0).max(2).optional(),
14818
+ prompt: exports_external.string().optional(),
14819
+ permission: exports_external.record(exports_external.enum(["allow", "deny"])).optional()
14691
14820
  });
14692
14821
  var opencodeConfigPatchSchema = exports_external.object({
14693
14822
  default_agent: exports_external.string().optional(),
14694
14823
  mcp: opencodeMcpSchema.optional(),
14695
14824
  tools: exports_external.record(exports_external.boolean()).optional(),
14696
- agent: exports_external.record(opencodeAgentSchema).optional()
14825
+ agent: exports_external.record(opencodeAgentSchema).optional(),
14826
+ plugin: exports_external.array(exports_external.string()).optional(),
14827
+ instructions: exports_external.array(exports_external.string()).optional()
14697
14828
  });
14698
14829
  var CONFIG_FILE = "ocx.jsonc";
14699
14830
  var LOCK_FILE = "ocx.lock";
@@ -14826,6 +14957,66 @@ function applyDefaultAgent(content, config2, defaultAgent) {
14826
14957
  const edits = modify(content, ["default_agent"], defaultAgent, JSONC_OPTIONS);
14827
14958
  return applyEdits(content, edits);
14828
14959
  }
14960
+ function applyPlugins(content, config2, plugins) {
14961
+ const added = [];
14962
+ let updatedContent = content;
14963
+ const existingPlugins = config2.plugin ?? [];
14964
+ for (const plugin of plugins) {
14965
+ if (existingPlugins.includes(plugin)) {
14966
+ continue;
14967
+ }
14968
+ const newIndex = existingPlugins.length + added.length;
14969
+ const edits = modify(updatedContent, ["plugin", newIndex], plugin, JSONC_OPTIONS);
14970
+ updatedContent = applyEdits(updatedContent, edits);
14971
+ added.push(plugin);
14972
+ }
14973
+ return { content: updatedContent, added };
14974
+ }
14975
+ function applyAgentConfigs(content, existingConfig, agentConfigs) {
14976
+ let updatedContent = content;
14977
+ const agentsConfigured = [];
14978
+ for (const [agentName, componentAgentConfig] of Object.entries(agentConfigs)) {
14979
+ const existingAgentConfig = existingConfig.agent?.[agentName] ?? {};
14980
+ const merged = n2(componentAgentConfig, existingAgentConfig);
14981
+ if (merged.tools) {
14982
+ for (const [toolPattern, enabled] of Object.entries(merged.tools)) {
14983
+ const edits = modify(updatedContent, ["agent", agentName, "tools", toolPattern], enabled, JSONC_OPTIONS);
14984
+ updatedContent = applyEdits(updatedContent, edits);
14985
+ }
14986
+ }
14987
+ if (merged.temperature !== undefined) {
14988
+ const edits = modify(updatedContent, ["agent", agentName, "temperature"], merged.temperature, JSONC_OPTIONS);
14989
+ updatedContent = applyEdits(updatedContent, edits);
14990
+ }
14991
+ if (merged.prompt) {
14992
+ const edits = modify(updatedContent, ["agent", agentName, "prompt"], merged.prompt, JSONC_OPTIONS);
14993
+ updatedContent = applyEdits(updatedContent, edits);
14994
+ }
14995
+ if (merged.permission) {
14996
+ for (const [pattern, permission] of Object.entries(merged.permission)) {
14997
+ const edits = modify(updatedContent, ["agent", agentName, "permission", pattern], permission, JSONC_OPTIONS);
14998
+ updatedContent = applyEdits(updatedContent, edits);
14999
+ }
15000
+ }
15001
+ agentsConfigured.push(agentName);
15002
+ }
15003
+ return { content: updatedContent, agentsConfigured };
15004
+ }
15005
+ function applyInstructions(content, config2, instructions) {
15006
+ const added = [];
15007
+ let updatedContent = content;
15008
+ const existingInstructions = config2.instructions ?? [];
15009
+ for (const instruction of instructions) {
15010
+ if (existingInstructions.includes(instruction)) {
15011
+ continue;
15012
+ }
15013
+ const newIndex = existingInstructions.length + added.length;
15014
+ const edits = modify(updatedContent, ["instructions", newIndex], instruction, JSONC_OPTIONS);
15015
+ updatedContent = applyEdits(updatedContent, edits);
15016
+ added.push(instruction);
15017
+ }
15018
+ return { content: updatedContent, added };
15019
+ }
14829
15020
  async function updateOpencodeConfig(cwd, options2) {
14830
15021
  const existing = await readOpencodeConfig(cwd);
14831
15022
  let content;
@@ -14846,6 +15037,8 @@ async function updateOpencodeConfig(cwd, options2) {
14846
15037
  let mcpSkipped = [];
14847
15038
  let agentsConfigured = [];
14848
15039
  let toolsDisabled = [];
15040
+ let pluginsAdded = [];
15041
+ let instructionsAdded = [];
14849
15042
  if (options2.mcpServers && Object.keys(options2.mcpServers).length > 0) {
14850
15043
  const result = applyMcpServers(content, config2, options2.mcpServers);
14851
15044
  content = result.content;
@@ -14869,6 +15062,24 @@ async function updateOpencodeConfig(cwd, options2) {
14869
15062
  content = applyDisabledTools(content, options2.disabledTools);
14870
15063
  toolsDisabled = options2.disabledTools;
14871
15064
  }
15065
+ if (options2.plugins && options2.plugins.length > 0) {
15066
+ const updatedConfig = parse2(content, [], { allowTrailingComma: true });
15067
+ const result = applyPlugins(content, updatedConfig, options2.plugins);
15068
+ content = result.content;
15069
+ pluginsAdded = result.added;
15070
+ }
15071
+ if (options2.agentConfigs && Object.keys(options2.agentConfigs).length > 0) {
15072
+ const updatedConfig = parse2(content, [], { allowTrailingComma: true });
15073
+ const result = applyAgentConfigs(content, updatedConfig, options2.agentConfigs);
15074
+ content = result.content;
15075
+ agentsConfigured = [...new Set([...agentsConfigured, ...result.agentsConfigured])];
15076
+ }
15077
+ if (options2.instructions && options2.instructions.length > 0) {
15078
+ const updatedConfig = parse2(content, [], { allowTrailingComma: true });
15079
+ const result = applyInstructions(content, updatedConfig, options2.instructions);
15080
+ content = result.content;
15081
+ instructionsAdded = result.added;
15082
+ }
14872
15083
  await writeOpencodeConfig(configPath, content);
14873
15084
  return {
14874
15085
  path: configPath,
@@ -14876,7 +15087,9 @@ async function updateOpencodeConfig(cwd, options2) {
14876
15087
  mcpAdded,
14877
15088
  mcpSkipped,
14878
15089
  agentsConfigured,
14879
- toolsDisabled
15090
+ toolsDisabled,
15091
+ pluginsAdded,
15092
+ instructionsAdded
14880
15093
  };
14881
15094
  }
14882
15095
 
@@ -16471,11 +16684,17 @@ async function runAdd(componentNames, options3) {
16471
16684
  installSpin?.succeed(`Installed ${resolved.components.length} components`);
16472
16685
  const hasMcpChanges = Object.keys(resolved.mcpServers).length > 0 || resolved.agentMcpBindings.length > 0;
16473
16686
  const hasDisabledTools = resolved.disabledTools.length > 0;
16474
- if (hasMcpChanges || hasDisabledTools) {
16687
+ const hasPlugins = resolved.plugins.length > 0;
16688
+ const hasAgentConfigs = Object.keys(resolved.agentConfigs).length > 0;
16689
+ const hasInstructions = resolved.instructions.length > 0;
16690
+ if (hasMcpChanges || hasDisabledTools || hasPlugins || hasAgentConfigs || hasInstructions) {
16475
16691
  const result = await updateOpencodeConfig(cwd, {
16476
16692
  mcpServers: resolved.mcpServers,
16477
16693
  agentMcpBindings: resolved.agentMcpBindings,
16478
- disabledTools: resolved.disabledTools
16694
+ disabledTools: resolved.disabledTools,
16695
+ plugins: resolved.plugins,
16696
+ agentConfigs: resolved.agentConfigs,
16697
+ instructions: resolved.instructions
16479
16698
  });
16480
16699
  if (result.mcpSkipped.length > 0 && !options3.quiet) {
16481
16700
  for (const name of result.mcpSkipped) {
@@ -16491,6 +16710,15 @@ async function runAdd(componentNames, options3) {
16491
16710
  if (!options3.quiet && result.toolsDisabled.length > 0) {
16492
16711
  logger.info(`Disabled ${result.toolsDisabled.length} tools: ${result.toolsDisabled.join(", ")}`);
16493
16712
  }
16713
+ if (!options3.quiet && result.pluginsAdded.length > 0) {
16714
+ logger.info(`Added ${result.pluginsAdded.length} plugins: ${result.pluginsAdded.join(", ")}`);
16715
+ }
16716
+ if (!options3.quiet && result.agentsConfigured.length > 0) {
16717
+ logger.info(`Configured ${result.agentsConfigured.length} agents: ${result.agentsConfigured.join(", ")}`);
16718
+ }
16719
+ if (!options3.quiet && result.instructionsAdded.length > 0) {
16720
+ logger.info(`Added ${result.instructionsAdded.length} instructions`);
16721
+ }
16494
16722
  }
16495
16723
  const hasNpmDeps = resolved.npmDependencies.length > 0;
16496
16724
  const hasNpmDevDeps = resolved.npmDevDependencies.length > 0;
@@ -16536,7 +16764,8 @@ async function installComponent(component, files, cwd) {
16536
16764
  }
16537
16765
  }
16538
16766
  function getTargetPath(component) {
16539
- return component.files[0]?.target ?? `.opencode/${component.type}/${component.name}`;
16767
+ const typeDir = component.type.replace(/^ocx:/, "");
16768
+ return component.files[0]?.target ?? `.opencode/${typeDir}/${component.name}`;
16540
16769
  }
16541
16770
  async function hashContent(content) {
16542
16771
  return createHash("sha256").update(content).digest("hex");
@@ -16619,7 +16848,7 @@ function registerBuildCommand(program2) {
16619
16848
  if (!parseResult.success) {
16620
16849
  if (!options3.json) {
16621
16850
  spinner2.fail("Registry validation failed");
16622
- const errors3 = parseResult.error.errors.map((e2) => ` ${e2.path.join(".")}: ${e2.message}`);
16851
+ const errors3 = parseResult.error.errors.map((e4) => ` ${e4.path.join(".")}: ${e4.message}`);
16623
16852
  for (const err of errors3) {
16624
16853
  console.log(kleur_default.red(err));
16625
16854
  }
@@ -16642,7 +16871,8 @@ function registerBuildCommand(program2) {
16642
16871
  };
16643
16872
  const packumentPath = join3(componentsDir, `${component.name}.json`);
16644
16873
  await Bun.write(packumentPath, JSON.stringify(packument, null, 2));
16645
- for (const file of component.files) {
16874
+ for (const rawFile of component.files) {
16875
+ const file = normalizeFile(rawFile);
16646
16876
  const sourceFilePath = join3(sourcePath, "files", file.path);
16647
16877
  const destFilePath = join3(componentsDir, component.name, file.path);
16648
16878
  const destFileDir = dirname3(destFilePath);
@@ -17548,11 +17778,12 @@ function registerDiffCommand(program2) {
17548
17778
  }
17549
17779
  try {
17550
17780
  const upstream = await fetchComponent(registryConfig.url, name);
17551
- const upstreamFile = upstream.files[0];
17552
- if (!upstreamFile) {
17781
+ const rawUpstreamFile = upstream.files[0];
17782
+ if (!rawUpstreamFile) {
17553
17783
  results.push({ name, hasChanges: false });
17554
17784
  continue;
17555
17785
  }
17786
+ const upstreamFile = normalizeFile(rawUpstreamFile);
17556
17787
  const upstreamContent = await fetchFileContent(registryConfig.url, name, upstreamFile.path);
17557
17788
  if (localContent === upstreamContent) {
17558
17789
  results.push({ name, hasChanges: false });
@@ -17822,7 +18053,7 @@ function registerSearchCommand(program2) {
17822
18053
  keys: ["name", "description"],
17823
18054
  limit
17824
18055
  });
17825
- results = fuzzyResults.map((r2) => r2.obj);
18056
+ results = fuzzyResults.map((r3) => r3.obj);
17826
18057
  } else {
17827
18058
  results = results.slice(0, limit);
17828
18059
  }
@@ -17845,7 +18076,7 @@ function registerSearchCommand(program2) {
17845
18076
  }
17846
18077
 
17847
18078
  // src/index.ts
17848
- var version2 = "1.0.6";
18079
+ var version2 = "1.0.7";
17849
18080
  async function main2() {
17850
18081
  const program2 = new Command().name("ocx").description("OpenCode Extensions - Install agents, skills, plugins, and commands").version(version2);
17851
18082
  registerInitCommand(program2);
@@ -17860,4 +18091,4 @@ main2().catch((err) => {
17860
18091
  handleError(err);
17861
18092
  });
17862
18093
 
17863
- //# debugId=1145245802C7C7C964756E2164756E21
18094
+ //# debugId=787522CA1BFEEB9464756E2164756E21