@fro.bot/systematic 3.21.4 → 3.21.6

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.
@@ -1,402 +1,85 @@
1
1
  // @bun
2
- // src/lib/validation.ts
3
- function isRecord(value) {
4
- return typeof value === "object" && value !== null && !Array.isArray(value);
5
- }
6
- function isPermissionSetting(value) {
7
- return value === "ask" || value === "allow" || value === "deny";
8
- }
9
- function isToolsMap(value) {
10
- if (!isRecord(value))
11
- return false;
12
- return Object.values(value).every((entry) => typeof entry === "boolean");
13
- }
14
- function isAgentMode(value) {
15
- return value === "subagent" || value === "primary" || value === "all";
16
- }
17
- function extractSimplePermission(data, key) {
18
- if (!(key in data))
19
- return;
20
- const value = data[key];
21
- return isPermissionSetting(value) ? value : null;
22
- }
23
- function extractBashPermission(data) {
24
- if (!("bash" in data))
25
- return;
26
- const bash = data.bash;
27
- if (isPermissionSetting(bash))
28
- return bash;
29
- if (isRecord(bash)) {
30
- const entries = Object.entries(bash);
31
- if (entries.every(([, setting]) => isPermissionSetting(setting))) {
32
- return Object.fromEntries(entries);
33
- }
2
+ // src/lib/frontmatter.ts
3
+ import yaml from "js-yaml";
4
+ function parseFrontmatter(content) {
5
+ const frontmatterRegex = /^---\r?\n([\s\S]*?)\r?\n?---\r?\n([\s\S]*)$/;
6
+ const match = content.match(frontmatterRegex);
7
+ if (!match) {
8
+ return {
9
+ data: {},
10
+ body: content,
11
+ hadFrontmatter: false,
12
+ parseError: false
13
+ };
34
14
  }
35
- return null;
36
- }
37
- function buildPermissionObject(edit, bash, webfetch, doom_loop, external_directory, task, skill) {
38
- const permission = {};
39
- if (edit)
40
- permission.edit = edit;
41
- if (bash)
42
- permission.bash = bash;
43
- if (webfetch)
44
- permission.webfetch = webfetch;
45
- if (doom_loop)
46
- permission.doom_loop = doom_loop;
47
- if (external_directory)
48
- permission.external_directory = external_directory;
49
- if (task)
50
- permission.task = task;
51
- if (skill)
52
- permission.skill = skill;
53
- return Object.keys(permission).length > 0 ? permission : undefined;
54
- }
55
- function normalizePermission(value) {
56
- if (!isRecord(value))
57
- return;
58
- const bash = extractBashPermission(value);
59
- if (bash === null)
60
- return;
61
- const edit = extractSimplePermission(value, "edit");
62
- if (edit === null)
63
- return;
64
- const webfetch = extractSimplePermission(value, "webfetch");
65
- if (webfetch === null)
66
- return;
67
- const doom_loop = extractSimplePermission(value, "doom_loop");
68
- if (doom_loop === null)
69
- return;
70
- const external_directory = extractSimplePermission(value, "external_directory");
71
- if (external_directory === null)
72
- return;
73
- const task = extractSimplePermission(value, "task");
74
- if (task === null)
75
- return;
76
- const skill = extractSimplePermission(value, "skill");
77
- if (skill === null)
78
- return;
79
- return buildPermissionObject(edit, bash, webfetch, doom_loop, external_directory, task, skill);
80
- }
81
- function extractString(data, key, fallback = "") {
82
- const value = data[key];
83
- return typeof value === "string" ? value : fallback;
84
- }
85
- function extractNonEmptyString(data, key) {
86
- const value = data[key];
87
- if (typeof value !== "string")
88
- return;
89
- const trimmed = value.trim();
90
- return trimmed !== "" ? trimmed : undefined;
91
- }
92
- function extractNumber(data, key) {
93
- const value = data[key];
94
- return typeof value === "number" ? value : undefined;
95
- }
96
- function extractBoolean(data, key) {
97
- const value = data[key];
98
- if (typeof value === "boolean")
99
- return value;
100
- if (typeof value === "string") {
101
- const normalized = value.trim().toLowerCase();
102
- if (normalized === "true")
103
- return true;
104
- if (normalized === "false")
105
- return false;
15
+ const [, yamlContent = "", body = ""] = match;
16
+ try {
17
+ const parsed = yaml.load(yamlContent, { schema: yaml.JSON_SCHEMA });
18
+ const data = parsed ?? {};
19
+ return { data, body, hadFrontmatter: true, parseError: false };
20
+ } catch {
21
+ return { data: {}, body, hadFrontmatter: true, parseError: true };
106
22
  }
107
- return;
108
23
  }
109
24
 
110
- // src/lib/routing-resolver.ts
111
- function getOverlayValue(map, key) {
112
- return map[key]?.value;
113
- }
114
- function toSourcedOverlayMap(map) {
115
- const result = {};
116
- if (!map)
117
- return result;
118
- for (const [key, value] of Object.entries(map)) {
119
- result[key] = { value, sourcePath: "", keyPath: key };
120
- }
121
- return result;
122
- }
123
- function toSourcedPiSubagentsOverlays(map) {
124
- return {
125
- agents: toSourcedOverlayMap(map?.agents),
126
- categories: toSourcedOverlayMap(map?.categories)
127
- };
128
- }
129
- function lookupAgentOverlayEntry(overlays, target) {
130
- return overlays.agents[target.agentKey] ?? overlays.agents[`${target.category}/${target.agentKey}`];
131
- }
132
- function readBlockField(overlay, blockKey, field) {
133
- if (overlay === undefined)
134
- return;
135
- const block = overlay[blockKey];
136
- if (!isRecord(block))
137
- return;
138
- return block[field];
139
- }
140
- function readFlatField(overlay, field) {
141
- if (overlay === undefined)
142
- return;
143
- return overlay[field];
144
- }
145
- function narrowModelValue(value) {
146
- if (typeof value === "string")
147
- return value;
148
- if (value === null)
149
- return null;
150
- return;
151
- }
152
- function narrowQualifierValue(value) {
153
- return typeof value === "string" ? value : undefined;
154
- }
155
- function resolveField(candidates) {
156
- for (const candidate of candidates) {
157
- if (candidate.value !== undefined) {
158
- return { value: candidate.value, source: candidate.source };
25
+ // src/lib/config.ts
26
+ import fs from "fs";
27
+ import os from "os";
28
+ import path from "path";
29
+
30
+ // node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
31
+ function createScanner(text, ignoreTrivia = false) {
32
+ const len = text.length;
33
+ let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
34
+ function scanHexDigits(count, exact) {
35
+ let digits = 0;
36
+ let value = 0;
37
+ while (digits < count || !exact) {
38
+ let ch = text.charCodeAt(pos);
39
+ if (ch >= 48 && ch <= 57) {
40
+ value = value * 16 + ch - 48;
41
+ } else if (ch >= 65 && ch <= 70) {
42
+ value = value * 16 + ch - 65 + 10;
43
+ } else if (ch >= 97 && ch <= 102) {
44
+ value = value * 16 + ch - 97 + 10;
45
+ } else {
46
+ break;
47
+ }
48
+ pos++;
49
+ digits++;
50
+ }
51
+ if (digits < count) {
52
+ value = -1;
159
53
  }
54
+ return value;
160
55
  }
161
- return { value: undefined, source: undefined };
162
- }
163
- function resolveModel(agentOverlay, agentOrigins, categoryOverlay, categoryOrigins, harness) {
164
- const { value, source } = resolveField([
165
- {
166
- value: readBlockField(agentOverlay, harness, "model"),
167
- source: { level: "agent", form: "block", origin: agentOrigins?.piModel }
168
- },
169
- {
170
- value: readFlatField(agentOverlay, "model"),
171
- source: { level: "agent", form: "flat", origin: agentOrigins?.model }
172
- },
173
- {
174
- value: readBlockField(categoryOverlay, harness, "model"),
175
- source: {
176
- level: "category",
177
- form: "block",
178
- origin: categoryOrigins?.piModel
56
+ function setPosition(newPosition) {
57
+ pos = newPosition;
58
+ value = "";
59
+ tokenOffset = 0;
60
+ token = 16;
61
+ scanError = 0;
62
+ }
63
+ function scanNumber() {
64
+ let start = pos;
65
+ if (text.charCodeAt(pos) === 48) {
66
+ pos++;
67
+ } else {
68
+ pos++;
69
+ while (pos < text.length && isDigit(text.charCodeAt(pos))) {
70
+ pos++;
179
71
  }
180
- },
181
- {
182
- value: readFlatField(categoryOverlay, "model"),
183
- source: {
184
- level: "category",
185
- form: "flat",
186
- origin: categoryOrigins?.model
187
- }
188
- }
189
- ]);
190
- const narrowedValue = narrowModelValue(value);
191
- return {
192
- value: narrowedValue,
193
- source: narrowedValue === undefined ? undefined : source
194
- };
195
- }
196
- var OPENCODE_MODEL_VARIANT_LAYERS = [
197
- { level: "agent", form: "block" },
198
- { level: "agent", form: "flat" },
199
- { level: "category", form: "block" },
200
- { level: "category", form: "flat" }
201
- ];
202
- function readOpencodeLayerField(agentOverlay, categoryOverlay, layer, field) {
203
- const overlay = layer.level === "agent" ? agentOverlay : categoryOverlay;
204
- return layer.form === "block" ? readBlockField(overlay, "opencode", field) : readFlatField(overlay, field);
205
- }
206
- function readOpencodeLayerOrigin(agentOrigins, categoryOrigins, layer, field) {
207
- const origins = layer.level === "agent" ? agentOrigins : categoryOrigins;
208
- if (field === "model") {
209
- return layer.form === "block" ? origins?.opencodeModel : origins?.model;
210
- }
211
- return layer.form === "block" ? origins?.opencodeVariant : origins?.variant;
212
- }
213
- function resolveOpencodeModelAndVariant(agentOverlay, agentOrigins, categoryOverlay, categoryOrigins) {
214
- const modelLayerIndex = OPENCODE_MODEL_VARIANT_LAYERS.findIndex((layer) => readOpencodeLayerField(agentOverlay, categoryOverlay, layer, "model") !== undefined);
215
- const modelLayer = modelLayerIndex === -1 ? undefined : OPENCODE_MODEL_VARIANT_LAYERS[modelLayerIndex];
216
- const rawModel = modelLayer === undefined ? undefined : readOpencodeLayerField(agentOverlay, categoryOverlay, modelLayer, "model");
217
- const model = narrowModelValue(rawModel);
218
- const hasModel = model !== undefined;
219
- const modelSource = hasModel && modelLayer !== undefined ? {
220
- ...modelLayer,
221
- origin: readOpencodeLayerOrigin(agentOrigins, categoryOrigins, modelLayer, "model")
222
- } : undefined;
223
- let qualifier;
224
- let qualifierSource;
225
- if (model !== null) {
226
- const eligibleLayerCount = hasModel ? modelLayerIndex + 1 : OPENCODE_MODEL_VARIANT_LAYERS.length;
227
- for (const layer of OPENCODE_MODEL_VARIANT_LAYERS.slice(0, eligibleLayerCount)) {
228
- const narrowed = narrowQualifierValue(readOpencodeLayerField(agentOverlay, categoryOverlay, layer, "variant"));
229
- if (narrowed !== undefined) {
230
- qualifier = narrowed;
231
- qualifierSource = {
232
- ...layer,
233
- origin: readOpencodeLayerOrigin(agentOrigins, categoryOrigins, layer, "variant")
234
- };
235
- break;
236
- }
237
- }
238
- }
239
- return { model, modelSource, qualifier, qualifierSource };
240
- }
241
- function resolvePiThinking(agentOverlay, agentOrigins, categoryOverlay, categoryOrigins, piSubagentsOverlays, target) {
242
- const blockResolution = resolveField([
243
- {
244
- value: readBlockField(agentOverlay, "pi", "thinking"),
245
- source: {
246
- level: "agent",
247
- form: "block",
248
- origin: agentOrigins?.piThinking
249
- }
250
- },
251
- {
252
- value: readBlockField(categoryOverlay, "pi", "thinking"),
253
- source: {
254
- level: "category",
255
- form: "block",
256
- origin: categoryOrigins?.piThinking
257
- }
258
- }
259
- ]);
260
- const legacyAgentThinking = getOverlayValue(piSubagentsOverlays.agents, target.agentKey)?.thinking;
261
- const legacyCategoryThinking = getOverlayValue(piSubagentsOverlays.categories, target.category)?.thinking;
262
- const legacyValue = legacyAgentThinking !== undefined ? legacyAgentThinking : legacyCategoryThinking;
263
- const legacyPresent = legacyValue !== undefined;
264
- const narrowedBlockValue = narrowQualifierValue(blockResolution.value);
265
- if (narrowedBlockValue !== undefined) {
266
- return {
267
- value: narrowedBlockValue,
268
- source: blockResolution.source,
269
- legacyPresent
270
- };
271
- }
272
- const narrowedLegacyValue = narrowQualifierValue(legacyValue);
273
- if (narrowedLegacyValue !== undefined) {
274
- return {
275
- value: narrowedLegacyValue,
276
- source: {
277
- level: legacyAgentThinking !== undefined ? "agent" : "category",
278
- form: "legacy-pi-subagents"
279
- },
280
- legacyPresent
281
- };
282
- }
283
- return { value: undefined, source: undefined, legacyPresent };
284
- }
285
- function resolveRouting(input) {
286
- const { overlays, piSubagentsOverlays, target, harness } = input;
287
- const agentEntry = lookupAgentOverlayEntry(overlays, target);
288
- const categoryEntry = overlays.categories[target.category];
289
- const agentOverlay = agentEntry?.value;
290
- const categoryOverlay = categoryEntry?.value;
291
- const agentOrigins = agentEntry?.origins;
292
- const categoryOrigins = categoryEntry?.origins;
293
- if (harness === "opencode") {
294
- const resolution = resolveOpencodeModelAndVariant(agentOverlay, agentOrigins, categoryOverlay, categoryOrigins);
295
- return {
296
- model: resolution.model,
297
- qualifier: resolution.qualifier,
298
- source: {
299
- model: resolution.modelSource,
300
- qualifier: resolution.qualifierSource
301
- },
302
- legacyPiSubagentsThinkingPresent: false,
303
- harness
304
- };
305
- }
306
- const modelResolution = resolveModel(agentOverlay, agentOrigins, categoryOverlay, categoryOrigins, harness);
307
- const qualifierResolution = resolvePiThinking(agentOverlay, agentOrigins, categoryOverlay, categoryOrigins, piSubagentsOverlays, target);
308
- return {
309
- model: modelResolution.value,
310
- qualifier: qualifierResolution.value,
311
- source: {
312
- model: modelResolution.source,
313
- qualifier: qualifierResolution.source
314
- },
315
- legacyPiSubagentsThinkingPresent: qualifierResolution.legacyPresent,
316
- harness
317
- };
318
- }
319
- function qualifierResolvesWithoutModel(resolution) {
320
- if (resolution.harness !== "opencode")
321
- return false;
322
- return resolution.qualifier !== undefined && resolution.model === undefined;
323
- }
324
- function formatWrittenLegacyPiSubagentsThinkingWarning(scope, key) {
325
- const writtenPath = `pi_subagents.${scope}.${key}.thinking`;
326
- const replacementPath = `${scope}.${key}.pi.thinking`;
327
- return `[systematic] ${writtenPath} is deprecated; set ${replacementPath} instead. The legacy value is ` + "honoured only when the new location is unset, and support for it will be removed in a future release.";
328
- }
329
- function collectWrittenLegacyPiSubagentsThinkingWarnings(piSubagentsOverlays) {
330
- const warnings = [];
331
- for (const scope of ["agents", "categories"]) {
332
- for (const [key, overlay] of Object.entries(piSubagentsOverlays[scope])) {
333
- if (!isRecord(overlay.value) || !Object.hasOwn(overlay.value, "thinking")) {
334
- continue;
335
- }
336
- warnings.push(formatWrittenLegacyPiSubagentsThinkingWarning(scope, key));
337
- }
338
- }
339
- return warnings;
340
- }
341
-
342
- // src/lib/config.ts
343
- import fs from "fs";
344
- import os from "os";
345
- import path from "path";
346
-
347
- // node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
348
- function createScanner(text, ignoreTrivia = false) {
349
- const len = text.length;
350
- let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
351
- function scanHexDigits(count, exact) {
352
- let digits = 0;
353
- let value = 0;
354
- while (digits < count || !exact) {
355
- let ch = text.charCodeAt(pos);
356
- if (ch >= 48 && ch <= 57) {
357
- value = value * 16 + ch - 48;
358
- } else if (ch >= 65 && ch <= 70) {
359
- value = value * 16 + ch - 65 + 10;
360
- } else if (ch >= 97 && ch <= 102) {
361
- value = value * 16 + ch - 97 + 10;
362
- } else {
363
- break;
364
- }
365
- pos++;
366
- digits++;
367
- }
368
- if (digits < count) {
369
- value = -1;
370
- }
371
- return value;
372
- }
373
- function setPosition(newPosition) {
374
- pos = newPosition;
375
- value = "";
376
- tokenOffset = 0;
377
- token = 16;
378
- scanError = 0;
379
- }
380
- function scanNumber() {
381
- let start = pos;
382
- if (text.charCodeAt(pos) === 48) {
383
- pos++;
384
- } else {
385
- pos++;
386
- while (pos < text.length && isDigit(text.charCodeAt(pos))) {
387
- pos++;
388
- }
389
- }
390
- if (pos < text.length && text.charCodeAt(pos) === 46) {
391
- pos++;
392
- if (pos < text.length && isDigit(text.charCodeAt(pos))) {
393
- pos++;
394
- while (pos < text.length && isDigit(text.charCodeAt(pos))) {
395
- pos++;
396
- }
397
- } else {
398
- scanError = 3;
399
- return text.substring(start, pos);
72
+ }
73
+ if (pos < text.length && text.charCodeAt(pos) === 46) {
74
+ pos++;
75
+ if (pos < text.length && isDigit(text.charCodeAt(pos))) {
76
+ pos++;
77
+ while (pos < text.length && isDigit(text.charCodeAt(pos))) {
78
+ pos++;
79
+ }
80
+ } else {
81
+ scanError = 3;
82
+ return text.substring(start, pos);
400
83
  }
401
84
  }
402
85
  let end = pos;
@@ -7987,131 +7670,471 @@ var PiSubagentsSchema = object({
7987
7670
  description: "Pi-native pi-subagents export field overlays (thinking, max_turns, tools, skills). Category values apply first; per-agent values override. No model field \u2014 model stays in the categories/agents overlay.",
7988
7671
  examples: [
7989
7672
  {
7990
- categories: { research: { thinking: "high" } },
7991
- agents: { "repo-research-analyst": { max_turns: 10 } }
7673
+ categories: { research: { thinking: "high" } },
7674
+ agents: { "repo-research-analyst": { max_turns: 10 } }
7675
+ }
7676
+ ]
7677
+ });
7678
+ var PI_SUBAGENTS_PROTECTED_FIELDS = [
7679
+ "thinking",
7680
+ "tools",
7681
+ "skills"
7682
+ ];
7683
+ var BootstrapSchema = object({
7684
+ enabled: boolean().default(true).meta({
7685
+ description: "Enable bootstrap prompt injection into every conversation",
7686
+ examples: [true, false]
7687
+ }),
7688
+ file: string().optional().meta({
7689
+ description: "Path to a custom bootstrap prompt file",
7690
+ examples: ["~/.config/opencode/bootstrap.md"]
7691
+ })
7692
+ }).strict().meta({
7693
+ description: "Bootstrap prompt configuration",
7694
+ examples: [{ enabled: true }, { enabled: false }]
7695
+ });
7696
+ function createSystematicConfigSchema(opts) {
7697
+ const {
7698
+ agentNames,
7699
+ qualifiedAgentIds,
7700
+ skillNames,
7701
+ removedSkillNames = [],
7702
+ removedAgentNames = []
7703
+ } = opts;
7704
+ return object({
7705
+ $schema: string().url().optional().meta({
7706
+ description: "JSON Schema URL for IDE autocomplete. The value is informational only \u2014 the loader does not fetch or validate against it. Add this to enable IDE schema activation and field-level autocomplete in editors that support JSON Schema (VSCode, Zed, IntelliJ).",
7707
+ examples: [
7708
+ "https://fro.bot/systematic/schemas/latest/systematic-config.schema.json"
7709
+ ]
7710
+ }),
7711
+ agents: object(Object.fromEntries([...agentNames, ...qualifiedAgentIds].map((name) => [
7712
+ name,
7713
+ AgentOverlaySchema.optional()
7714
+ ]))).strict().default({}).meta({
7715
+ description: "Per-agent configuration overlays keyed by bundled agent name (bare or qualified category/name). Unknown keys are rejected with a Zod parse error, except that a project config entry under an unknown key is discarded before that check if stripping trust-protected fields leaves it empty. To overlay a user-defined agent, configure it through OpenCode-native config (.opencode/opencode.json) instead. Trust-protected fields (model, variant, skills, permission, opencode, pi) are only valid in user config or OPENCODE_CONFIG_DIR config \u2014 a project config setting them has that field ignored with a warning; other fields in the same overlay still apply.",
7716
+ examples: [
7717
+ { "correctness-reviewer": { temperature: 0.1 } },
7718
+ { "review/correctness-reviewer": { temperature: 0.1 } },
7719
+ {}
7720
+ ]
7721
+ }),
7722
+ categories: record(string(), CategoryOverlaySchema).default({}).meta({
7723
+ description: "Per-category configuration overlays keyed by category name. Trust-protected fields (model, variant, skills, permission, opencode, pi) are only valid in user config or OPENCODE_CONFIG_DIR config \u2014 a project config setting them has that field ignored with a warning; other fields in the same overlay still apply.",
7724
+ examples: [{ review: { model: "anthropic/claude-opus-5" } }, {}]
7725
+ }),
7726
+ profiles: record(string(), createProfileBundleSchema(agentNames, qualifiedAgentIds)).default({}).meta({
7727
+ description: "Named routing-only overlay bundles, selectable by name via the profile field. Valid in user config and OPENCODE_CONFIG_DIR config. A project config may always select a profile, but may only define this field when the user sets allow_project_profiles; a project-defined bundle is advisory and fills only routing the user has not set.",
7728
+ examples: [
7729
+ {
7730
+ personal: {
7731
+ agents: {
7732
+ "correctness-reviewer": { model: "openai/gpt-6-astra" }
7733
+ }
7734
+ }
7735
+ },
7736
+ {}
7737
+ ]
7738
+ }),
7739
+ profile: profileSchema,
7740
+ allow_project_profiles: trustProtected(boolean().meta({
7741
+ description: "Allow a repository's project config to define its own `profiles` map. User-owned only \u2014 only valid in user config or OPENCODE_CONFIG_DIR config; a project config setting this field has it ignored (a project cannot grant itself a permission it does not already have). Defaults to false.",
7742
+ examples: [true, false]
7743
+ })).default(false),
7744
+ disabled_skills: array(_enum([...skillNames, ...removedSkillNames])).default([]).meta({
7745
+ description: "Array of bundled skill names to disable globally. Unknown skill names are rejected at parse time.",
7746
+ examples: [["ce:plan", "ce:review"]]
7747
+ }),
7748
+ disabled_agents: array(_enum([
7749
+ ...agentNames,
7750
+ ...qualifiedAgentIds,
7751
+ ...removedAgentNames
7752
+ ])).default([]).meta({
7753
+ description: "Array of bundled agent names (bare or qualified category/name) to disable globally. Unknown agent names are rejected at parse time.",
7754
+ examples: [
7755
+ ["previous-comments-reviewer", "cli-readiness-reviewer"],
7756
+ ["review/security-reviewer"]
7757
+ ]
7758
+ }),
7759
+ disabled_commands: array(string()).default([]).meta({
7760
+ description: "Array of command names to disable globally",
7761
+ examples: [["deprecated-migration-helper"]]
7762
+ }),
7763
+ bootstrap: BootstrapSchema.default({ enabled: true }).meta({
7764
+ description: "Bootstrap prompt configuration",
7765
+ examples: [
7766
+ { enabled: true },
7767
+ { enabled: false, file: ".opencode/custom-prompt.md" }
7768
+ ]
7769
+ }),
7770
+ workflow_guard: WorkflowGuardSchema,
7771
+ pi_subagents: PiSubagentsSchema,
7772
+ skills_as_commands: boolean().default(true).meta({
7773
+ description: "Register skills discovered from user/project skill directories (OpenCode config and other agent-harness-standard locations) as slash commands. Default true.",
7774
+ examples: [true, false]
7775
+ })
7776
+ }).strict().meta({
7777
+ description: "Systematic user configuration file (systematic.json / systematic.jsonc)",
7778
+ examples: [
7779
+ { disabled_skills: ["ce:plan"], bootstrap: { enabled: false } }
7780
+ ]
7781
+ });
7782
+ }
7783
+ var SystematicConfigSchema = createSystematicConfigSchema({
7784
+ agentNames: BUNDLED_AGENT_NAMES,
7785
+ qualifiedAgentIds: BUNDLED_AGENT_QUALIFIED_IDS,
7786
+ skillNames: BUNDLED_SKILL_NAMES,
7787
+ removedSkillNames: REMOVED_BUNDLED_SKILL_NAMES,
7788
+ removedAgentNames: REMOVED_BUNDLED_AGENT_NAMES
7789
+ });
7790
+ var SECURITY_OVERLAY_FIELDS = [
7791
+ "model",
7792
+ "variant",
7793
+ "skills",
7794
+ "permission",
7795
+ "opencode",
7796
+ "pi"
7797
+ ];
7798
+
7799
+ // src/lib/validation.ts
7800
+ function isRecord(value) {
7801
+ return typeof value === "object" && value !== null && !Array.isArray(value);
7802
+ }
7803
+ function isPermissionSetting(value) {
7804
+ return value === "ask" || value === "allow" || value === "deny";
7805
+ }
7806
+ function isToolsMap(value) {
7807
+ if (!isRecord(value))
7808
+ return false;
7809
+ return Object.values(value).every((entry) => typeof entry === "boolean");
7810
+ }
7811
+ function isAgentMode(value) {
7812
+ return value === "subagent" || value === "primary" || value === "all";
7813
+ }
7814
+ function extractSimplePermission(data, key) {
7815
+ if (!(key in data))
7816
+ return;
7817
+ const value = data[key];
7818
+ return isPermissionSetting(value) ? value : null;
7819
+ }
7820
+ function extractBashPermission(data) {
7821
+ if (!("bash" in data))
7822
+ return;
7823
+ const bash = data.bash;
7824
+ if (isPermissionSetting(bash))
7825
+ return bash;
7826
+ if (isRecord(bash)) {
7827
+ const entries = Object.entries(bash);
7828
+ if (entries.every(([, setting]) => isPermissionSetting(setting))) {
7829
+ return Object.fromEntries(entries);
7830
+ }
7831
+ }
7832
+ return null;
7833
+ }
7834
+ function buildPermissionObject(edit, bash, webfetch, doom_loop, external_directory, task, skill) {
7835
+ const permission = {};
7836
+ if (edit)
7837
+ permission.edit = edit;
7838
+ if (bash)
7839
+ permission.bash = bash;
7840
+ if (webfetch)
7841
+ permission.webfetch = webfetch;
7842
+ if (doom_loop)
7843
+ permission.doom_loop = doom_loop;
7844
+ if (external_directory)
7845
+ permission.external_directory = external_directory;
7846
+ if (task)
7847
+ permission.task = task;
7848
+ if (skill)
7849
+ permission.skill = skill;
7850
+ return Object.keys(permission).length > 0 ? permission : undefined;
7851
+ }
7852
+ function normalizePermission(value) {
7853
+ if (!isRecord(value))
7854
+ return;
7855
+ const bash = extractBashPermission(value);
7856
+ if (bash === null)
7857
+ return;
7858
+ const edit = extractSimplePermission(value, "edit");
7859
+ if (edit === null)
7860
+ return;
7861
+ const webfetch = extractSimplePermission(value, "webfetch");
7862
+ if (webfetch === null)
7863
+ return;
7864
+ const doom_loop = extractSimplePermission(value, "doom_loop");
7865
+ if (doom_loop === null)
7866
+ return;
7867
+ const external_directory = extractSimplePermission(value, "external_directory");
7868
+ if (external_directory === null)
7869
+ return;
7870
+ const task = extractSimplePermission(value, "task");
7871
+ if (task === null)
7872
+ return;
7873
+ const skill = extractSimplePermission(value, "skill");
7874
+ if (skill === null)
7875
+ return;
7876
+ return buildPermissionObject(edit, bash, webfetch, doom_loop, external_directory, task, skill);
7877
+ }
7878
+ function extractString(data, key, fallback = "") {
7879
+ const value = data[key];
7880
+ return typeof value === "string" ? value : fallback;
7881
+ }
7882
+ function extractNonEmptyString(data, key) {
7883
+ const value = data[key];
7884
+ if (typeof value !== "string")
7885
+ return;
7886
+ const trimmed = value.trim();
7887
+ return trimmed !== "" ? trimmed : undefined;
7888
+ }
7889
+ function extractNumber(data, key) {
7890
+ const value = data[key];
7891
+ return typeof value === "number" ? value : undefined;
7892
+ }
7893
+ function extractBoolean(data, key) {
7894
+ const value = data[key];
7895
+ if (typeof value === "boolean")
7896
+ return value;
7897
+ if (typeof value === "string") {
7898
+ const normalized = value.trim().toLowerCase();
7899
+ if (normalized === "true")
7900
+ return true;
7901
+ if (normalized === "false")
7902
+ return false;
7903
+ }
7904
+ return;
7905
+ }
7906
+
7907
+ // src/lib/routing-resolver.ts
7908
+ function getOverlayValue(map, key) {
7909
+ return map[key]?.value;
7910
+ }
7911
+ function toSourcedOverlayMap(map) {
7912
+ const result = {};
7913
+ if (!map)
7914
+ return result;
7915
+ for (const [key, value] of Object.entries(map)) {
7916
+ result[key] = { value, sourcePath: "", keyPath: key };
7917
+ }
7918
+ return result;
7919
+ }
7920
+ function toSourcedPiSubagentsOverlays(map) {
7921
+ return {
7922
+ agents: toSourcedOverlayMap(map?.agents),
7923
+ categories: toSourcedOverlayMap(map?.categories)
7924
+ };
7925
+ }
7926
+ function lookupAgentOverlayEntry(overlays, target) {
7927
+ return overlays.agents[target.agentKey] ?? overlays.agents[`${target.category}/${target.agentKey}`];
7928
+ }
7929
+ function readBlockField(overlay, blockKey, field) {
7930
+ if (overlay === undefined)
7931
+ return;
7932
+ const block = overlay[blockKey];
7933
+ if (!isRecord(block))
7934
+ return;
7935
+ return block[field];
7936
+ }
7937
+ function readFlatField(overlay, field) {
7938
+ if (overlay === undefined)
7939
+ return;
7940
+ return overlay[field];
7941
+ }
7942
+ function narrowModelValue(value) {
7943
+ if (typeof value === "string")
7944
+ return value;
7945
+ if (value === null)
7946
+ return null;
7947
+ return;
7948
+ }
7949
+ function narrowQualifierValue(value) {
7950
+ return typeof value === "string" ? value : undefined;
7951
+ }
7952
+ function resolveField(candidates) {
7953
+ for (const candidate of candidates) {
7954
+ if (candidate.value !== undefined) {
7955
+ return { value: candidate.value, source: candidate.source };
7956
+ }
7957
+ }
7958
+ return { value: undefined, source: undefined };
7959
+ }
7960
+ function resolveModel(agentOverlay, agentOrigins, categoryOverlay, categoryOrigins, harness) {
7961
+ const { value, source } = resolveField([
7962
+ {
7963
+ value: readBlockField(agentOverlay, harness, "model"),
7964
+ source: { level: "agent", form: "block", origin: agentOrigins?.piModel }
7965
+ },
7966
+ {
7967
+ value: readFlatField(agentOverlay, "model"),
7968
+ source: { level: "agent", form: "flat", origin: agentOrigins?.model }
7969
+ },
7970
+ {
7971
+ value: readBlockField(categoryOverlay, harness, "model"),
7972
+ source: {
7973
+ level: "category",
7974
+ form: "block",
7975
+ origin: categoryOrigins?.piModel
7976
+ }
7977
+ },
7978
+ {
7979
+ value: readFlatField(categoryOverlay, "model"),
7980
+ source: {
7981
+ level: "category",
7982
+ form: "flat",
7983
+ origin: categoryOrigins?.model
7984
+ }
7985
+ }
7986
+ ]);
7987
+ const narrowedValue = narrowModelValue(value);
7988
+ return {
7989
+ value: narrowedValue,
7990
+ source: narrowedValue === undefined ? undefined : source
7991
+ };
7992
+ }
7993
+ var OPENCODE_MODEL_VARIANT_LAYERS = [
7994
+ { level: "agent", form: "block" },
7995
+ { level: "agent", form: "flat" },
7996
+ { level: "category", form: "block" },
7997
+ { level: "category", form: "flat" }
7998
+ ];
7999
+ function readOpencodeLayerField(agentOverlay, categoryOverlay, layer, field) {
8000
+ const overlay = layer.level === "agent" ? agentOverlay : categoryOverlay;
8001
+ return layer.form === "block" ? readBlockField(overlay, "opencode", field) : readFlatField(overlay, field);
8002
+ }
8003
+ function readOpencodeLayerOrigin(agentOrigins, categoryOrigins, layer, field) {
8004
+ const origins = layer.level === "agent" ? agentOrigins : categoryOrigins;
8005
+ if (field === "model") {
8006
+ return layer.form === "block" ? origins?.opencodeModel : origins?.model;
8007
+ }
8008
+ return layer.form === "block" ? origins?.opencodeVariant : origins?.variant;
8009
+ }
8010
+ function resolveOpencodeModelAndVariant(agentOverlay, agentOrigins, categoryOverlay, categoryOrigins) {
8011
+ const modelLayerIndex = OPENCODE_MODEL_VARIANT_LAYERS.findIndex((layer) => readOpencodeLayerField(agentOverlay, categoryOverlay, layer, "model") !== undefined);
8012
+ const modelLayer = modelLayerIndex === -1 ? undefined : OPENCODE_MODEL_VARIANT_LAYERS[modelLayerIndex];
8013
+ const rawModel = modelLayer === undefined ? undefined : readOpencodeLayerField(agentOverlay, categoryOverlay, modelLayer, "model");
8014
+ const model = narrowModelValue(rawModel);
8015
+ const hasModel = model !== undefined;
8016
+ const modelSource = hasModel && modelLayer !== undefined ? {
8017
+ ...modelLayer,
8018
+ origin: readOpencodeLayerOrigin(agentOrigins, categoryOrigins, modelLayer, "model")
8019
+ } : undefined;
8020
+ let qualifier;
8021
+ let qualifierSource;
8022
+ if (model !== null) {
8023
+ const eligibleLayerCount = hasModel ? modelLayerIndex + 1 : OPENCODE_MODEL_VARIANT_LAYERS.length;
8024
+ for (const layer of OPENCODE_MODEL_VARIANT_LAYERS.slice(0, eligibleLayerCount)) {
8025
+ const narrowed = narrowQualifierValue(readOpencodeLayerField(agentOverlay, categoryOverlay, layer, "variant"));
8026
+ if (narrowed !== undefined) {
8027
+ qualifier = narrowed;
8028
+ qualifierSource = {
8029
+ ...layer,
8030
+ origin: readOpencodeLayerOrigin(agentOrigins, categoryOrigins, layer, "variant")
8031
+ };
8032
+ break;
8033
+ }
8034
+ }
8035
+ }
8036
+ return { model, modelSource, qualifier, qualifierSource };
8037
+ }
8038
+ function resolvePiThinking(agentOverlay, agentOrigins, categoryOverlay, categoryOrigins, piSubagentsOverlays, target) {
8039
+ const blockResolution = resolveField([
8040
+ {
8041
+ value: readBlockField(agentOverlay, "pi", "thinking"),
8042
+ source: {
8043
+ level: "agent",
8044
+ form: "block",
8045
+ origin: agentOrigins?.piThinking
8046
+ }
8047
+ },
8048
+ {
8049
+ value: readBlockField(categoryOverlay, "pi", "thinking"),
8050
+ source: {
8051
+ level: "category",
8052
+ form: "block",
8053
+ origin: categoryOrigins?.piThinking
8054
+ }
7992
8055
  }
7993
- ]
7994
- });
7995
- var PI_SUBAGENTS_PROTECTED_FIELDS = [
7996
- "thinking",
7997
- "tools",
7998
- "skills"
7999
- ];
8000
- var BootstrapSchema = object({
8001
- enabled: boolean().default(true).meta({
8002
- description: "Enable bootstrap prompt injection into every conversation",
8003
- examples: [true, false]
8004
- }),
8005
- file: string().optional().meta({
8006
- description: "Path to a custom bootstrap prompt file",
8007
- examples: ["~/.config/opencode/bootstrap.md"]
8008
- })
8009
- }).strict().meta({
8010
- description: "Bootstrap prompt configuration",
8011
- examples: [{ enabled: true }, { enabled: false }]
8012
- });
8013
- function createSystematicConfigSchema(opts) {
8014
- const {
8015
- agentNames,
8016
- qualifiedAgentIds,
8017
- skillNames,
8018
- removedSkillNames = [],
8019
- removedAgentNames = []
8020
- } = opts;
8021
- return object({
8022
- $schema: string().url().optional().meta({
8023
- description: "JSON Schema URL for IDE autocomplete. The value is informational only \u2014 the loader does not fetch or validate against it. Add this to enable IDE schema activation and field-level autocomplete in editors that support JSON Schema (VSCode, Zed, IntelliJ).",
8024
- examples: [
8025
- "https://fro.bot/systematic/schemas/latest/systematic-config.schema.json"
8026
- ]
8027
- }),
8028
- agents: object(Object.fromEntries([...agentNames, ...qualifiedAgentIds].map((name) => [
8029
- name,
8030
- AgentOverlaySchema.optional()
8031
- ]))).strict().default({}).meta({
8032
- description: "Per-agent configuration overlays keyed by bundled agent name (bare or qualified category/name). Unknown keys are rejected with a Zod parse error, except that a project config entry under an unknown key is discarded before that check if stripping trust-protected fields leaves it empty. To overlay a user-defined agent, configure it through OpenCode-native config (.opencode/opencode.json) instead. Trust-protected fields (model, variant, skills, permission, opencode, pi) are only valid in user config or OPENCODE_CONFIG_DIR config \u2014 a project config setting them has that field ignored with a warning; other fields in the same overlay still apply.",
8033
- examples: [
8034
- { "correctness-reviewer": { temperature: 0.1 } },
8035
- { "review/correctness-reviewer": { temperature: 0.1 } },
8036
- {}
8037
- ]
8038
- }),
8039
- categories: record(string(), CategoryOverlaySchema).default({}).meta({
8040
- description: "Per-category configuration overlays keyed by category name. Trust-protected fields (model, variant, skills, permission, opencode, pi) are only valid in user config or OPENCODE_CONFIG_DIR config \u2014 a project config setting them has that field ignored with a warning; other fields in the same overlay still apply.",
8041
- examples: [{ review: { model: "anthropic/claude-opus-5" } }, {}]
8042
- }),
8043
- profiles: record(string(), createProfileBundleSchema(agentNames, qualifiedAgentIds)).default({}).meta({
8044
- description: "Named routing-only overlay bundles, selectable by name via the profile field. Valid in user config and OPENCODE_CONFIG_DIR config. A project config may always select a profile, but may only define this field when the user sets allow_project_profiles; a project-defined bundle is advisory and fills only routing the user has not set.",
8045
- examples: [
8046
- {
8047
- personal: {
8048
- agents: {
8049
- "correctness-reviewer": { model: "openai/gpt-6-astra" }
8050
- }
8051
- }
8052
- },
8053
- {}
8054
- ]
8055
- }),
8056
- profile: profileSchema,
8057
- allow_project_profiles: trustProtected(boolean().meta({
8058
- description: "Allow a repository's project config to define its own `profiles` map. User-owned only \u2014 only valid in user config or OPENCODE_CONFIG_DIR config; a project config setting this field has it ignored (a project cannot grant itself a permission it does not already have). Defaults to false.",
8059
- examples: [true, false]
8060
- })).default(false),
8061
- disabled_skills: array(_enum([...skillNames, ...removedSkillNames])).default([]).meta({
8062
- description: "Array of bundled skill names to disable globally. Unknown skill names are rejected at parse time.",
8063
- examples: [["ce:plan", "ce:review"]]
8064
- }),
8065
- disabled_agents: array(_enum([
8066
- ...agentNames,
8067
- ...qualifiedAgentIds,
8068
- ...removedAgentNames
8069
- ])).default([]).meta({
8070
- description: "Array of bundled agent names (bare or qualified category/name) to disable globally. Unknown agent names are rejected at parse time.",
8071
- examples: [
8072
- ["previous-comments-reviewer", "cli-readiness-reviewer"],
8073
- ["review/security-reviewer"]
8074
- ]
8075
- }),
8076
- disabled_commands: array(string()).default([]).meta({
8077
- description: "Array of command names to disable globally",
8078
- examples: [["deprecated-migration-helper"]]
8079
- }),
8080
- bootstrap: BootstrapSchema.default({ enabled: true }).meta({
8081
- description: "Bootstrap prompt configuration",
8082
- examples: [
8083
- { enabled: true },
8084
- { enabled: false, file: ".opencode/custom-prompt.md" }
8085
- ]
8086
- }),
8087
- workflow_guard: WorkflowGuardSchema,
8088
- pi_subagents: PiSubagentsSchema,
8089
- skills_as_commands: boolean().default(true).meta({
8090
- description: "Register skills discovered from user/project skill directories (OpenCode config and other agent-harness-standard locations) as slash commands. Default true.",
8091
- examples: [true, false]
8092
- })
8093
- }).strict().meta({
8094
- description: "Systematic user configuration file (systematic.json / systematic.jsonc)",
8095
- examples: [
8096
- { disabled_skills: ["ce:plan"], bootstrap: { enabled: false } }
8097
- ]
8098
- });
8056
+ ]);
8057
+ const legacyAgentThinking = getOverlayValue(piSubagentsOverlays.agents, target.agentKey)?.thinking;
8058
+ const legacyCategoryThinking = getOverlayValue(piSubagentsOverlays.categories, target.category)?.thinking;
8059
+ const legacyValue = legacyAgentThinking !== undefined ? legacyAgentThinking : legacyCategoryThinking;
8060
+ const legacyPresent = legacyValue !== undefined;
8061
+ const narrowedBlockValue = narrowQualifierValue(blockResolution.value);
8062
+ if (narrowedBlockValue !== undefined) {
8063
+ return {
8064
+ value: narrowedBlockValue,
8065
+ source: blockResolution.source,
8066
+ legacyPresent
8067
+ };
8068
+ }
8069
+ const narrowedLegacyValue = narrowQualifierValue(legacyValue);
8070
+ if (narrowedLegacyValue !== undefined) {
8071
+ return {
8072
+ value: narrowedLegacyValue,
8073
+ source: {
8074
+ level: legacyAgentThinking !== undefined ? "agent" : "category",
8075
+ form: "legacy-pi-subagents"
8076
+ },
8077
+ legacyPresent
8078
+ };
8079
+ }
8080
+ return { value: undefined, source: undefined, legacyPresent };
8081
+ }
8082
+ function resolveRouting(input) {
8083
+ const { overlays, piSubagentsOverlays, target, harness } = input;
8084
+ const agentEntry = lookupAgentOverlayEntry(overlays, target);
8085
+ const categoryEntry = overlays.categories[target.category];
8086
+ const agentOverlay = agentEntry?.value;
8087
+ const categoryOverlay = categoryEntry?.value;
8088
+ const agentOrigins = agentEntry?.origins;
8089
+ const categoryOrigins = categoryEntry?.origins;
8090
+ if (harness === "opencode") {
8091
+ const resolution = resolveOpencodeModelAndVariant(agentOverlay, agentOrigins, categoryOverlay, categoryOrigins);
8092
+ return {
8093
+ model: resolution.model,
8094
+ qualifier: resolution.qualifier,
8095
+ source: {
8096
+ model: resolution.modelSource,
8097
+ qualifier: resolution.qualifierSource
8098
+ },
8099
+ legacyPiSubagentsThinkingPresent: false,
8100
+ harness
8101
+ };
8102
+ }
8103
+ const modelResolution = resolveModel(agentOverlay, agentOrigins, categoryOverlay, categoryOrigins, harness);
8104
+ const qualifierResolution = resolvePiThinking(agentOverlay, agentOrigins, categoryOverlay, categoryOrigins, piSubagentsOverlays, target);
8105
+ return {
8106
+ model: modelResolution.value,
8107
+ qualifier: qualifierResolution.value,
8108
+ source: {
8109
+ model: modelResolution.source,
8110
+ qualifier: qualifierResolution.source
8111
+ },
8112
+ legacyPiSubagentsThinkingPresent: qualifierResolution.legacyPresent,
8113
+ harness
8114
+ };
8115
+ }
8116
+ function qualifierResolvesWithoutModel(resolution) {
8117
+ if (resolution.harness !== "opencode")
8118
+ return false;
8119
+ return resolution.qualifier !== undefined && resolution.model === undefined;
8120
+ }
8121
+ function formatWrittenLegacyPiSubagentsThinkingWarning(scope, key) {
8122
+ const writtenPath = `pi_subagents.${scope}.${key}.thinking`;
8123
+ const replacementPath = `${scope}.${key}.pi.thinking`;
8124
+ return `[systematic] ${writtenPath} is deprecated; set ${replacementPath} instead. The legacy value is ` + "honoured only when the new location is unset, and support for it will be removed in a future release.";
8125
+ }
8126
+ function collectWrittenLegacyPiSubagentsThinkingWarnings(piSubagentsOverlays) {
8127
+ const warnings = [];
8128
+ for (const scope of ["agents", "categories"]) {
8129
+ for (const [key, overlay] of Object.entries(piSubagentsOverlays[scope])) {
8130
+ if (!isRecord(overlay.value) || !Object.hasOwn(overlay.value, "thinking")) {
8131
+ continue;
8132
+ }
8133
+ warnings.push(formatWrittenLegacyPiSubagentsThinkingWarning(scope, key));
8134
+ }
8135
+ }
8136
+ return warnings;
8099
8137
  }
8100
- var SystematicConfigSchema = createSystematicConfigSchema({
8101
- agentNames: BUNDLED_AGENT_NAMES,
8102
- qualifiedAgentIds: BUNDLED_AGENT_QUALIFIED_IDS,
8103
- skillNames: BUNDLED_SKILL_NAMES,
8104
- removedSkillNames: REMOVED_BUNDLED_SKILL_NAMES,
8105
- removedAgentNames: REMOVED_BUNDLED_AGENT_NAMES
8106
- });
8107
- var SECURITY_OVERLAY_FIELDS = [
8108
- "model",
8109
- "variant",
8110
- "skills",
8111
- "permission",
8112
- "opencode",
8113
- "pi"
8114
- ];
8115
8138
 
8116
8139
  // src/lib/config.ts
8117
8140
  var CONFIG_AUTHORITY_FIELD_PATHS = [
@@ -9142,29 +9165,6 @@ function getConfigPaths(projectDir, options) {
9142
9165
  return result;
9143
9166
  }
9144
9167
 
9145
- // src/lib/frontmatter.ts
9146
- import yaml from "js-yaml";
9147
- function parseFrontmatter(content) {
9148
- const frontmatterRegex = /^---\r?\n([\s\S]*?)\r?\n?---\r?\n([\s\S]*)$/;
9149
- const match = content.match(frontmatterRegex);
9150
- if (!match) {
9151
- return {
9152
- data: {},
9153
- body: content,
9154
- hadFrontmatter: false,
9155
- parseError: false
9156
- };
9157
- }
9158
- const [, yamlContent = "", body = ""] = match;
9159
- try {
9160
- const parsed = yaml.load(yamlContent, { schema: yaml.JSON_SCHEMA });
9161
- const data = parsed ?? {};
9162
- return { data, body, hadFrontmatter: true, parseError: false };
9163
- } catch {
9164
- return { data: {}, body, hadFrontmatter: true, parseError: true };
9165
- }
9166
- }
9167
-
9168
9168
  // src/lib/walk-dir.ts
9169
9169
  import fs2 from "fs";
9170
9170
  import path2 from "path";
@@ -9275,6 +9275,10 @@ function extractCommandFrontmatter(content) {
9275
9275
  };
9276
9276
  }
9277
9277
 
9278
+ // src/lib/discovered-skills.ts
9279
+ import fs4 from "fs";
9280
+ import path4 from "path";
9281
+
9278
9282
  // src/lib/skills.ts
9279
9283
  import fs3 from "fs";
9280
9284
  import path3 from "path";
@@ -9352,8 +9356,6 @@ function findSkillsInDir(dir, maxDepth = 3) {
9352
9356
  }
9353
9357
 
9354
9358
  // src/lib/discovered-skills.ts
9355
- import fs4 from "fs";
9356
- import path4 from "path";
9357
9359
  var SKILL_NAME_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
9358
9360
  function isValidSkillName(name) {
9359
9361
  return name.length >= 1 && name.length <= 64 && SKILL_NAME_REGEX.test(name);