agentpacks 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +168 -8
- package/dist/api.d.ts +2 -0
- package/dist/api.js +929 -409
- package/dist/cli/export-cmd.js +281 -149
- package/dist/cli/generate.js +740 -247
- package/dist/cli/import-cmd.js +57 -85
- package/dist/cli/info.d.ts +4 -0
- package/dist/cli/info.js +232 -0
- package/dist/cli/init.js +8 -36
- package/dist/cli/install.js +414 -129
- package/dist/cli/login.d.ts +9 -0
- package/dist/cli/login.js +202 -0
- package/dist/cli/models-explain.d.ts +16 -0
- package/dist/cli/models-explain.js +1205 -0
- package/dist/cli/pack/create.js +4 -32
- package/dist/cli/pack/enable.js +1 -29
- package/dist/cli/pack/list.js +266 -134
- package/dist/cli/pack/validate.js +274 -127
- package/dist/cli/publish.d.ts +8 -0
- package/dist/cli/publish.js +672 -0
- package/dist/cli/search.d.ts +12 -0
- package/dist/cli/search.js +210 -0
- package/dist/core/config.d.ts +2 -1
- package/dist/core/config.js +74 -117
- package/dist/core/dependency-resolver.js +4 -28
- package/dist/core/feature-merger.d.ts +7 -0
- package/dist/core/feature-merger.js +289 -29
- package/dist/core/index.js +283 -140
- package/dist/core/lockfile.js +0 -28
- package/dist/core/metarepo.js +74 -116
- package/dist/core/pack-loader.d.ts +2 -0
- package/dist/core/pack-loader.js +266 -133
- package/dist/core/profile-resolver.d.ts +75 -0
- package/dist/core/profile-resolver.js +111 -0
- package/dist/exporters/cursor-plugin.js +4 -32
- package/dist/exporters/index.js +4 -32
- package/dist/features/agents.d.ts +5 -0
- package/dist/features/agents.js +2 -30
- package/dist/features/commands.js +2 -30
- package/dist/features/hooks.js +2 -30
- package/dist/features/ignore.js +0 -28
- package/dist/features/index.d.ts +1 -0
- package/dist/features/index.js +176 -31
- package/dist/features/mcp.js +2 -30
- package/dist/features/models.d.ts +167 -0
- package/dist/features/models.js +293 -0
- package/dist/features/plugins.js +2 -30
- package/dist/features/rules.js +2 -30
- package/dist/features/skills.js +2 -30
- package/dist/importers/claude-code.js +10 -38
- package/dist/importers/cursor.js +15 -43
- package/dist/importers/opencode.js +16 -44
- package/dist/importers/rulesync.js +22 -50
- package/dist/index.js +1710 -538
- package/dist/node/api.js +929 -409
- package/dist/node/cli/export-cmd.js +281 -149
- package/dist/node/cli/generate.js +740 -247
- package/dist/node/cli/import-cmd.js +57 -85
- package/dist/node/cli/info.js +232 -0
- package/dist/node/cli/init.js +8 -36
- package/dist/node/cli/install.js +414 -129
- package/dist/node/cli/login.js +202 -0
- package/dist/node/cli/models-explain.js +1205 -0
- package/dist/node/cli/pack/create.js +4 -32
- package/dist/node/cli/pack/enable.js +1 -29
- package/dist/node/cli/pack/list.js +266 -134
- package/dist/node/cli/pack/validate.js +274 -127
- package/dist/node/cli/publish.js +672 -0
- package/dist/node/cli/search.js +210 -0
- package/dist/node/core/config.js +74 -117
- package/dist/node/core/dependency-resolver.js +4 -28
- package/dist/node/core/feature-merger.js +289 -29
- package/dist/node/core/index.js +283 -140
- package/dist/node/core/lockfile.js +0 -28
- package/dist/node/core/metarepo.js +74 -116
- package/dist/node/core/pack-loader.js +266 -133
- package/dist/node/core/profile-resolver.js +111 -0
- package/dist/node/exporters/cursor-plugin.js +4 -32
- package/dist/node/exporters/index.js +4 -32
- package/dist/node/features/agents.js +2 -30
- package/dist/node/features/commands.js +2 -30
- package/dist/node/features/hooks.js +2 -30
- package/dist/node/features/ignore.js +0 -28
- package/dist/node/features/index.js +176 -31
- package/dist/node/features/mcp.js +2 -30
- package/dist/node/features/models.js +293 -0
- package/dist/node/features/plugins.js +2 -30
- package/dist/node/features/rules.js +2 -30
- package/dist/node/features/skills.js +2 -30
- package/dist/node/importers/claude-code.js +10 -38
- package/dist/node/importers/cursor.js +15 -43
- package/dist/node/importers/opencode.js +16 -44
- package/dist/node/importers/rulesync.js +22 -50
- package/dist/node/index.js +1710 -538
- package/dist/node/sources/git-ref.js +7 -30
- package/dist/node/sources/git.js +7 -30
- package/dist/node/sources/index.js +337 -39
- package/dist/node/sources/local.js +0 -28
- package/dist/node/sources/npm-ref.js +0 -28
- package/dist/node/sources/npm.js +10 -37
- package/dist/node/sources/registry-ref.js +37 -0
- package/dist/node/sources/registry.js +355 -0
- package/dist/node/targets/additional-targets.js +196 -37
- package/dist/node/targets/agents-md.js +5 -33
- package/dist/node/targets/base-target.js +0 -28
- package/dist/node/targets/claude-code.js +211 -41
- package/dist/node/targets/codex-cli.js +7 -35
- package/dist/node/targets/copilot.js +202 -41
- package/dist/node/targets/cursor.js +188 -40
- package/dist/node/targets/gemini-cli.js +10 -38
- package/dist/node/targets/generic-md-target.js +196 -37
- package/dist/node/targets/index.js +414 -106
- package/dist/node/targets/opencode.js +171 -51
- package/dist/node/targets/registry.js +414 -106
- package/dist/node/utils/credentials.js +38 -0
- package/dist/node/utils/diff.js +22 -34
- package/dist/node/utils/filesystem.js +2 -30
- package/dist/node/utils/frontmatter.js +0 -28
- package/dist/node/utils/global.js +3 -31
- package/dist/node/utils/markdown.js +0 -28
- package/dist/node/utils/model-allowlist.js +110 -0
- package/dist/node/utils/model-guidance.js +78 -0
- package/dist/node/utils/registry-client.js +142 -0
- package/dist/node/utils/tarball.js +49 -0
- package/dist/sources/git-ref.js +7 -30
- package/dist/sources/git.d.ts +2 -2
- package/dist/sources/git.js +7 -30
- package/dist/sources/index.d.ts +2 -0
- package/dist/sources/index.js +337 -39
- package/dist/sources/local.js +0 -28
- package/dist/sources/npm-ref.js +0 -28
- package/dist/sources/npm.js +10 -37
- package/dist/sources/registry-ref.d.ts +30 -0
- package/dist/sources/registry-ref.js +37 -0
- package/dist/sources/registry.d.ts +18 -0
- package/dist/sources/registry.js +355 -0
- package/dist/targets/additional-targets.js +196 -37
- package/dist/targets/agents-md.js +5 -33
- package/dist/targets/base-target.d.ts +2 -0
- package/dist/targets/base-target.js +0 -28
- package/dist/targets/claude-code.js +211 -41
- package/dist/targets/codex-cli.js +7 -35
- package/dist/targets/copilot.js +202 -41
- package/dist/targets/cursor.js +188 -40
- package/dist/targets/gemini-cli.js +10 -38
- package/dist/targets/generic-md-target.js +196 -37
- package/dist/targets/index.js +414 -106
- package/dist/targets/opencode.js +171 -51
- package/dist/targets/registry.js +414 -106
- package/dist/utils/credentials.d.ts +19 -0
- package/dist/utils/credentials.js +38 -0
- package/dist/utils/diff.js +22 -34
- package/dist/utils/filesystem.js +2 -30
- package/dist/utils/frontmatter.js +0 -28
- package/dist/utils/global.js +3 -31
- package/dist/utils/markdown.js +0 -28
- package/dist/utils/model-allowlist.d.ts +39 -0
- package/dist/utils/model-allowlist.js +110 -0
- package/dist/utils/model-guidance.d.ts +6 -0
- package/dist/utils/model-guidance.js +78 -0
- package/dist/utils/registry-client.d.ts +141 -0
- package/dist/utils/registry-client.js +142 -0
- package/dist/utils/tarball.d.ts +13 -0
- package/dist/utils/tarball.js +49 -0
- package/package.json +171 -5
- package/templates/pack/models.json +38 -0
package/dist/targets/opencode.js
CHANGED
|
@@ -1,32 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __moduleCache = /* @__PURE__ */ new WeakMap;
|
|
7
|
-
var __toCommonJS = (from) => {
|
|
8
|
-
var entry = __moduleCache.get(from), desc;
|
|
9
|
-
if (entry)
|
|
10
|
-
return entry;
|
|
11
|
-
entry = __defProp({}, "__esModule", { value: true });
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
13
|
-
__getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
|
|
14
|
-
get: () => from[key],
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
}));
|
|
17
|
-
__moduleCache.set(from, entry);
|
|
18
|
-
return entry;
|
|
19
|
-
};
|
|
20
|
-
var __export = (target, all) => {
|
|
21
|
-
for (var name in all)
|
|
22
|
-
__defProp(target, name, {
|
|
23
|
-
get: all[name],
|
|
24
|
-
enumerable: true,
|
|
25
|
-
configurable: true,
|
|
26
|
-
set: (newValue) => all[name] = () => newValue
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
30
2
|
var __require = import.meta.require;
|
|
31
3
|
|
|
32
4
|
// src/utils/filesystem.ts
|
|
@@ -36,10 +8,10 @@ import {
|
|
|
36
8
|
readFileSync,
|
|
37
9
|
writeFileSync,
|
|
38
10
|
readdirSync,
|
|
11
|
+
rmSync,
|
|
39
12
|
statSync
|
|
40
13
|
} from "fs";
|
|
41
14
|
import { dirname, relative, join } from "path";
|
|
42
|
-
import { removeSync } from "fs-extra";
|
|
43
15
|
var GENERATED_HEADER_MD = "<!-- Generated by agentpacks. DO NOT EDIT. -->";
|
|
44
16
|
var GENERATED_HEADER_JSON = "// Generated by agentpacks. DO NOT EDIT.";
|
|
45
17
|
var GENERATED_HEADER_JS = "// Generated by agentpacks. DO NOT EDIT.";
|
|
@@ -80,7 +52,7 @@ function ensureDir(dirPath) {
|
|
|
80
52
|
}
|
|
81
53
|
function removeIfExists(targetPath) {
|
|
82
54
|
if (existsSync(targetPath)) {
|
|
83
|
-
|
|
55
|
+
rmSync(targetPath, { recursive: true, force: true });
|
|
84
56
|
}
|
|
85
57
|
}
|
|
86
58
|
function listFiles(dirPath, options = {}) {
|
|
@@ -317,6 +289,110 @@ function resolveHooksForTarget(hooks, targetId) {
|
|
|
317
289
|
return merged;
|
|
318
290
|
}
|
|
319
291
|
|
|
292
|
+
// src/core/profile-resolver.ts
|
|
293
|
+
function resolveModels(merged, modelProfile, targetId) {
|
|
294
|
+
let defaultModel = merged.default;
|
|
295
|
+
let smallModel = merged.small;
|
|
296
|
+
let agents = { ...merged.agents };
|
|
297
|
+
if (modelProfile && merged.profiles?.[modelProfile]) {
|
|
298
|
+
const resolvedProfile = resolveProfileInheritance(modelProfile, merged.profiles);
|
|
299
|
+
if (resolvedProfile.default)
|
|
300
|
+
defaultModel = resolvedProfile.default;
|
|
301
|
+
if (resolvedProfile.small)
|
|
302
|
+
smallModel = resolvedProfile.small;
|
|
303
|
+
if (resolvedProfile.agents) {
|
|
304
|
+
agents = { ...agents, ...resolvedProfile.agents };
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
if (targetId) {
|
|
308
|
+
const targetOverride = merged.overrides?.[targetId];
|
|
309
|
+
if (targetOverride) {
|
|
310
|
+
if (targetOverride.default)
|
|
311
|
+
defaultModel = targetOverride.default;
|
|
312
|
+
if (targetOverride.small)
|
|
313
|
+
smallModel = targetOverride.small;
|
|
314
|
+
if (targetOverride.agents) {
|
|
315
|
+
agents = { ...agents, ...targetOverride.agents };
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
const providers = {};
|
|
320
|
+
if (merged.providers) {
|
|
321
|
+
for (const [name, config] of Object.entries(merged.providers)) {
|
|
322
|
+
providers[name] = {
|
|
323
|
+
...config.options ? { options: config.options } : {},
|
|
324
|
+
...config.models ? { models: config.models } : {}
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
const profileNames = Object.keys(merged.profiles ?? {});
|
|
329
|
+
const profiles = {};
|
|
330
|
+
if (merged.profiles) {
|
|
331
|
+
for (const [name, profile] of Object.entries(merged.profiles)) {
|
|
332
|
+
profiles[name] = {
|
|
333
|
+
description: profile.description,
|
|
334
|
+
default: profile.default,
|
|
335
|
+
small: profile.small
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return {
|
|
340
|
+
default: defaultModel,
|
|
341
|
+
small: smallModel,
|
|
342
|
+
agents,
|
|
343
|
+
providers,
|
|
344
|
+
routing: merged.routing ?? [],
|
|
345
|
+
profileNames,
|
|
346
|
+
activeProfile: modelProfile,
|
|
347
|
+
profiles
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
function resolveAgentModel(resolved, agentName, frontmatterModel) {
|
|
351
|
+
const fromModels = resolved.agents[agentName];
|
|
352
|
+
if (fromModels) {
|
|
353
|
+
return {
|
|
354
|
+
model: fromModels.model,
|
|
355
|
+
temperature: fromModels.temperature,
|
|
356
|
+
top_p: fromModels.top_p
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
if (frontmatterModel) {
|
|
360
|
+
return { model: frontmatterModel };
|
|
361
|
+
}
|
|
362
|
+
return {};
|
|
363
|
+
}
|
|
364
|
+
function resolveProfileInheritance(profileName, profiles) {
|
|
365
|
+
const visited = new Set;
|
|
366
|
+
return resolveProfileChain(profileName, profiles, visited, 0);
|
|
367
|
+
}
|
|
368
|
+
var MAX_INHERITANCE_DEPTH = 10;
|
|
369
|
+
function resolveProfileChain(name, profiles, visited, depth) {
|
|
370
|
+
if (depth > MAX_INHERITANCE_DEPTH) {
|
|
371
|
+
throw new Error(`Profile inheritance too deep (max ${MAX_INHERITANCE_DEPTH}): ${name}`);
|
|
372
|
+
}
|
|
373
|
+
if (visited.has(name)) {
|
|
374
|
+
throw new Error(`Circular profile inheritance detected: ${[...visited, name].join(" \u2192 ")}`);
|
|
375
|
+
}
|
|
376
|
+
const profile = profiles[name];
|
|
377
|
+
if (!profile) {
|
|
378
|
+
throw new Error(`Profile "${name}" not found`);
|
|
379
|
+
}
|
|
380
|
+
visited.add(name);
|
|
381
|
+
if (!profile.extends) {
|
|
382
|
+
return { ...profile };
|
|
383
|
+
}
|
|
384
|
+
const parent = resolveProfileChain(profile.extends, profiles, visited, depth + 1);
|
|
385
|
+
return {
|
|
386
|
+
description: profile.description ?? parent.description,
|
|
387
|
+
default: profile.default ?? parent.default,
|
|
388
|
+
small: profile.small ?? parent.small,
|
|
389
|
+
agents: {
|
|
390
|
+
...parent.agents,
|
|
391
|
+
...profile.agents
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
|
|
320
396
|
// src/targets/base-target.ts
|
|
321
397
|
class BaseTarget {
|
|
322
398
|
supportsFeature(feature) {
|
|
@@ -361,7 +437,7 @@ ${content}`;
|
|
|
361
437
|
}
|
|
362
438
|
|
|
363
439
|
// src/targets/opencode.ts
|
|
364
|
-
import { resolve
|
|
440
|
+
import { resolve, join as join4 } from "path";
|
|
365
441
|
var TARGET_ID = "opencode";
|
|
366
442
|
|
|
367
443
|
class OpenCodeTarget extends BaseTarget {
|
|
@@ -375,32 +451,48 @@ class OpenCodeTarget extends BaseTarget {
|
|
|
375
451
|
"hooks",
|
|
376
452
|
"plugins",
|
|
377
453
|
"mcp",
|
|
378
|
-
"ignore"
|
|
454
|
+
"ignore",
|
|
455
|
+
"models"
|
|
379
456
|
];
|
|
380
457
|
generate(options) {
|
|
381
458
|
const { projectRoot, baseDir, features, enabledFeatures, deleteExisting } = options;
|
|
382
|
-
const root =
|
|
459
|
+
const root = resolve(projectRoot, baseDir);
|
|
383
460
|
const effective = this.getEffectiveFeatures(enabledFeatures);
|
|
384
461
|
const filesWritten = [];
|
|
385
462
|
const filesDeleted = [];
|
|
386
463
|
const warnings = [];
|
|
387
|
-
const opencodeDir =
|
|
464
|
+
const opencodeDir = resolve(root, ".opencode");
|
|
388
465
|
if (effective.includes("agents")) {
|
|
389
|
-
const agentDir =
|
|
466
|
+
const agentDir = resolve(opencodeDir, "agent");
|
|
390
467
|
if (deleteExisting) {
|
|
391
468
|
removeIfExists(agentDir);
|
|
392
469
|
filesDeleted.push(agentDir);
|
|
393
470
|
}
|
|
394
471
|
ensureDir(agentDir);
|
|
472
|
+
const resolvedModels = features.models ? resolveModels(features.models, options.modelProfile, TARGET_ID) : null;
|
|
395
473
|
const agents = features.agents.filter((a) => agentMatchesTarget(a, TARGET_ID));
|
|
396
474
|
for (const agent of agents) {
|
|
397
475
|
const filepath = join4(agentDir, `${agent.name}.md`);
|
|
398
|
-
|
|
476
|
+
const fm = {};
|
|
477
|
+
const oc = agent.meta.opencode ?? {};
|
|
478
|
+
const modelsAgent = resolvedModels?.agents[agent.name];
|
|
479
|
+
const agentModel = modelsAgent?.model ?? oc.model;
|
|
480
|
+
const agentTemp = modelsAgent?.temperature ?? oc.temperature;
|
|
481
|
+
if (agentModel)
|
|
482
|
+
fm.model = agentModel;
|
|
483
|
+
if (agentTemp !== undefined)
|
|
484
|
+
fm.temperature = agentTemp;
|
|
485
|
+
if (oc.mode)
|
|
486
|
+
fm.mode = oc.mode;
|
|
487
|
+
if (oc.top_p !== undefined)
|
|
488
|
+
fm.top_p = oc.top_p;
|
|
489
|
+
const content = Object.keys(fm).length > 0 ? serializeFrontmatter(fm, agent.content) : agent.content;
|
|
490
|
+
writeGeneratedFile(filepath, content);
|
|
399
491
|
filesWritten.push(filepath);
|
|
400
492
|
}
|
|
401
493
|
}
|
|
402
494
|
if (effective.includes("skills")) {
|
|
403
|
-
const skillDir =
|
|
495
|
+
const skillDir = resolve(opencodeDir, "skill");
|
|
404
496
|
if (deleteExisting) {
|
|
405
497
|
removeIfExists(skillDir);
|
|
406
498
|
filesDeleted.push(skillDir);
|
|
@@ -416,7 +508,7 @@ class OpenCodeTarget extends BaseTarget {
|
|
|
416
508
|
}
|
|
417
509
|
}
|
|
418
510
|
if (effective.includes("commands")) {
|
|
419
|
-
const cmdDir =
|
|
511
|
+
const cmdDir = resolve(opencodeDir, "command");
|
|
420
512
|
if (deleteExisting) {
|
|
421
513
|
removeIfExists(cmdDir);
|
|
422
514
|
filesDeleted.push(cmdDir);
|
|
@@ -430,7 +522,7 @@ class OpenCodeTarget extends BaseTarget {
|
|
|
430
522
|
}
|
|
431
523
|
}
|
|
432
524
|
if (effective.includes("hooks") || effective.includes("plugins")) {
|
|
433
|
-
const pluginsDir =
|
|
525
|
+
const pluginsDir = resolve(opencodeDir, "plugins");
|
|
434
526
|
ensureDir(pluginsDir);
|
|
435
527
|
if (effective.includes("hooks")) {
|
|
436
528
|
for (const hookSet of features.hooks) {
|
|
@@ -453,21 +545,52 @@ class OpenCodeTarget extends BaseTarget {
|
|
|
453
545
|
}
|
|
454
546
|
}
|
|
455
547
|
}
|
|
456
|
-
if (effective.includes("mcp")) {
|
|
457
|
-
const
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
548
|
+
if (effective.includes("mcp") || effective.includes("models")) {
|
|
549
|
+
const filepath = resolve(root, "opencode.json");
|
|
550
|
+
const opencodeConfig = {
|
|
551
|
+
$schema: "https://opencode.ai/config.json"
|
|
552
|
+
};
|
|
553
|
+
if (effective.includes("mcp")) {
|
|
554
|
+
const mcpEntries = Object.entries(features.mcpServers);
|
|
555
|
+
if (mcpEntries.length > 0) {
|
|
556
|
+
opencodeConfig.mcp = buildOpenCodeMcpServers(features.mcpServers);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
if (effective.includes("models") && features.models) {
|
|
560
|
+
const resolved = resolveModels(features.models, options.modelProfile, TARGET_ID);
|
|
561
|
+
if (resolved.default)
|
|
562
|
+
opencodeConfig.model = resolved.default;
|
|
563
|
+
if (resolved.small)
|
|
564
|
+
opencodeConfig.small_model = resolved.small;
|
|
565
|
+
if (Object.keys(resolved.providers).length > 0) {
|
|
566
|
+
opencodeConfig.provider = resolved.providers;
|
|
567
|
+
}
|
|
568
|
+
const agentEntries = Object.entries(resolved.agents);
|
|
569
|
+
if (agentEntries.length > 0) {
|
|
570
|
+
const agentConfig = {};
|
|
571
|
+
for (const [name, assignment] of agentEntries) {
|
|
572
|
+
const config = { model: assignment.model };
|
|
573
|
+
if (assignment.temperature !== undefined) {
|
|
574
|
+
config.temperature = assignment.temperature;
|
|
575
|
+
}
|
|
576
|
+
if (assignment.top_p !== undefined) {
|
|
577
|
+
config.top_p = assignment.top_p;
|
|
578
|
+
}
|
|
579
|
+
agentConfig[name] = config;
|
|
580
|
+
}
|
|
581
|
+
opencodeConfig.agent = agentConfig;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
if (Object.keys(opencodeConfig).length > 1) {
|
|
461
585
|
writeGeneratedJson(filepath, opencodeConfig, { header: false });
|
|
462
586
|
filesWritten.push(filepath);
|
|
463
587
|
}
|
|
464
588
|
}
|
|
465
589
|
if (effective.includes("rules")) {
|
|
466
590
|
const rules = features.rules.filter((r) => ruleMatchesTarget(r, TARGET_ID));
|
|
467
|
-
const rootRules = getRootRules(rules);
|
|
468
591
|
const detailRules = getDetailRules(rules);
|
|
469
592
|
if (detailRules.length > 0) {
|
|
470
|
-
const memoriesDir =
|
|
593
|
+
const memoriesDir = resolve(opencodeDir, "memories");
|
|
471
594
|
if (deleteExisting) {
|
|
472
595
|
removeIfExists(memoriesDir);
|
|
473
596
|
filesDeleted.push(memoriesDir);
|
|
@@ -483,7 +606,7 @@ class OpenCodeTarget extends BaseTarget {
|
|
|
483
606
|
return this.createResult(filesWritten, filesDeleted, warnings);
|
|
484
607
|
}
|
|
485
608
|
}
|
|
486
|
-
function
|
|
609
|
+
function buildOpenCodeMcpServers(servers) {
|
|
487
610
|
const mcp = {};
|
|
488
611
|
for (const [name, entry] of Object.entries(servers)) {
|
|
489
612
|
if (entry.url) {
|
|
@@ -503,10 +626,7 @@ function buildOpenCodeMcp(servers) {
|
|
|
503
626
|
};
|
|
504
627
|
}
|
|
505
628
|
}
|
|
506
|
-
return
|
|
507
|
-
$schema: "https://opencode.ai/config.json",
|
|
508
|
-
mcp
|
|
509
|
-
};
|
|
629
|
+
return mcp;
|
|
510
630
|
}
|
|
511
631
|
function generateOpenCodeHookPlugin(packName, events) {
|
|
512
632
|
const identifier = packNameToIdentifier(packName);
|