agent-skillboard 0.2.15 → 0.2.16

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/src/workspace.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { readdir, readFile, realpath, stat } from "node:fs/promises";
2
2
  import { homedir } from "node:os";
3
3
  import { dirname, isAbsolute, join, relative, resolve } from "node:path";
4
- import YAML from "yaml";
4
+ import YAML from "yaml";
5
5
  import {
6
6
  readBoolean,
7
7
  readOptionalRecord,
@@ -21,8 +21,8 @@ import { parseInstallUnits } from "./install-units.mjs";
21
21
  import { normalizeSkillPath } from "./skill-paths.mjs";
22
22
 
23
23
  export async function loadWorkspace(options) {
24
- const configText = await readFile(options.configPath, "utf8");
25
- const parsed = YAML.parse(configText);
24
+ const configText = await readFile(options.configPath, "utf8");
25
+ const parsed = YAML.parse(configText);
26
26
  const config = requireRecord(parsed, "config root");
27
27
  const version = parseVersion(config.version);
28
28
  const skills = parseSkills(config.skills);
@@ -123,7 +123,7 @@ function resolveStoredPath(value, options) {
123
123
  }
124
124
  return resolve(dirname(options.configPath ?? "."), value);
125
125
  }
126
-
126
+
127
127
  async function findSkillFiles(root, seen = new Set()) {
128
128
  const files = [];
129
129
  const resolvedRoot = await realpath(root).catch(() => root);
@@ -148,8 +148,8 @@ async function findSkillFiles(root, seen = new Set()) {
148
148
  }
149
149
  }
150
150
  return files;
151
- }
152
-
151
+ }
152
+
153
153
  function parseSkillFrontmatter(text) {
154
154
  const match = /^---[ \t]*\r?\n(?<body>[\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/.exec(text);
155
155
  if (match?.groups === undefined) {
@@ -170,49 +170,49 @@ function parseSkillFrontmatter(text) {
170
170
  description: readString(raw, "description", "")
171
171
  };
172
172
  }
173
-
174
- function parseVersion(value) {
175
- if (value === undefined) {
176
- return 1;
177
- }
178
- if (value !== 1) {
179
- throw new Error(`Unsupported config version: ${value}`);
180
- }
181
- return value;
182
- }
183
-
184
- function parseDefaults(value) {
185
- const raw = requireRecord(value ?? {}, "defaults");
186
- return {
187
- invocationPolicy: readString(raw, "invocation_policy", "deny-by-default"),
188
- allowModelInvocation: readBoolean(raw, "allow_model_invocation", false),
189
- requireExplicitWorkflow: readBoolean(raw, "require_explicit_workflow", true)
190
- };
191
- }
192
-
193
- function parseSkills(value) {
194
- const raw = requireRecord(value ?? {}, "skills");
195
- return Object.entries(raw).map(([id, entry]) => {
196
- const skill = requireRecord(entry, `skills.${id}`);
197
- const status = readString(skill, "status", "vendor");
198
- const invocation = readString(skill, "invocation", "manual-only");
199
- const exposure = readString(skill, "exposure", "exported");
200
- if (!STATUS_VALUES.has(status)) {
201
- throw new Error(`Unsupported status for ${id}: ${status}`);
202
- }
203
- if (!INVOCATION_VALUES.has(invocation)) {
204
- throw new Error(`Unsupported invocation for ${id}: ${invocation}`);
205
- }
206
- if (!EXPOSURE_VALUES.has(exposure)) {
207
- throw new Error(`Unsupported exposure for ${id}: ${exposure}`);
208
- }
173
+
174
+ function parseVersion(value) {
175
+ if (value === undefined) {
176
+ return 1;
177
+ }
178
+ if (value !== 1) {
179
+ throw new Error(`Unsupported config version: ${value}`);
180
+ }
181
+ return value;
182
+ }
183
+
184
+ function parseDefaults(value) {
185
+ const raw = requireRecord(value ?? {}, "defaults");
186
+ return {
187
+ invocationPolicy: readString(raw, "invocation_policy", "deny-by-default"),
188
+ allowModelInvocation: readBoolean(raw, "allow_model_invocation", false),
189
+ requireExplicitWorkflow: readBoolean(raw, "require_explicit_workflow", true)
190
+ };
191
+ }
192
+
193
+ function parseSkills(value) {
194
+ const raw = requireRecord(value ?? {}, "skills");
195
+ return Object.entries(raw).map(([id, entry]) => {
196
+ const skill = requireRecord(entry, `skills.${id}`);
197
+ const status = readString(skill, "status", "vendor");
198
+ const invocation = readString(skill, "invocation", "manual-only");
199
+ const exposure = readString(skill, "exposure", "exported");
200
+ if (!STATUS_VALUES.has(status)) {
201
+ throw new Error(`Unsupported status for ${id}: ${status}`);
202
+ }
203
+ if (!INVOCATION_VALUES.has(invocation)) {
204
+ throw new Error(`Unsupported invocation for ${id}: ${invocation}`);
205
+ }
206
+ if (!EXPOSURE_VALUES.has(exposure)) {
207
+ throw new Error(`Unsupported exposure for ${id}: ${exposure}`);
208
+ }
209
209
  return {
210
210
  id,
211
211
  path: normalizeSkillPath(readString(skill, "path", id), `skills.${id}.path`),
212
- status,
213
- invocation,
214
- exposure,
215
- category: readString(skill, "category", "uncategorized"),
212
+ status,
213
+ invocation,
214
+ exposure,
215
+ category: readString(skill, "category", "uncategorized"),
216
216
  canonicalFor: readStringList(skill, "canonical_for"),
217
217
  conflictsWith: readStringList(skill, "conflicts_with"),
218
218
  replacedBy: readOptionalString(skill, "replaced_by"),
@@ -266,39 +266,39 @@ function parseCapabilities(value) {
266
266
  };
267
267
  });
268
268
  }
269
-
270
- function parseHarnesses(value) {
271
- const raw = requireRecord(value ?? {}, "harnesses");
272
- return Object.entries(raw).map(([name, entry]) => {
273
- const harness = requireRecord(entry, `harnesses.${name}`);
274
- const status = readString(harness, "status", "available");
275
- if (!HARNESS_STATUS_VALUES.has(status)) {
276
- throw new Error(`Unsupported harness status for ${name}: ${status}`);
277
- }
278
- return {
279
- name,
280
- status,
281
- workflows: readStringList(harness, "workflows"),
282
- commands: readStringList(harness, "commands")
283
- };
284
- });
285
- }
286
-
287
- function parseWorkflows(value) {
288
- const raw = requireRecord(value ?? {}, "workflows");
289
- return Object.entries(raw).map(([name, entry]) => {
290
- const workflow = requireRecord(entry, `workflows.${name}`);
291
- return {
292
- name,
293
- harness: readString(workflow, "harness", "unspecified"),
294
- activeSkills: readStringList(workflow, "active_skills"),
295
- blockedSkills: readStringList(workflow, "blocked_skills"),
296
- requiredOutputs: readStringList(workflow, "required_outputs"),
297
- requiredCapabilities: parseRequiredCapabilities(workflow.required_capabilities, `workflows.${name}.required_capabilities`)
298
- };
299
- });
300
- }
301
-
269
+
270
+ function parseHarnesses(value) {
271
+ const raw = requireRecord(value ?? {}, "harnesses");
272
+ return Object.entries(raw).map(([name, entry]) => {
273
+ const harness = requireRecord(entry, `harnesses.${name}`);
274
+ const status = readString(harness, "status", "available");
275
+ if (!HARNESS_STATUS_VALUES.has(status)) {
276
+ throw new Error(`Unsupported harness status for ${name}: ${status}`);
277
+ }
278
+ return {
279
+ name,
280
+ status,
281
+ workflows: readStringList(harness, "workflows"),
282
+ commands: readStringList(harness, "commands")
283
+ };
284
+ });
285
+ }
286
+
287
+ function parseWorkflows(value) {
288
+ const raw = requireRecord(value ?? {}, "workflows");
289
+ return Object.entries(raw).map(([name, entry]) => {
290
+ const workflow = requireRecord(entry, `workflows.${name}`);
291
+ return {
292
+ name,
293
+ harness: readString(workflow, "harness", "unspecified"),
294
+ activeSkills: readStringList(workflow, "active_skills"),
295
+ blockedSkills: readStringList(workflow, "blocked_skills"),
296
+ requiredOutputs: readStringList(workflow, "required_outputs"),
297
+ requiredCapabilities: parseRequiredCapabilities(workflow.required_capabilities, `workflows.${name}.required_capabilities`)
298
+ };
299
+ });
300
+ }
301
+
302
302
  function parseRequiredCapabilities(value, label) {
303
303
  const raw = requireRecord(value ?? {}, label);
304
304
  return Object.entries(raw).map(([name, entry]) => {