clementine-agent 1.18.107 → 1.18.109

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,57 +1,63 @@
1
1
  /**
2
- * Skill store — Phase A (read-only) of the Skills-First redesign.
2
+ * Skill store — Phase A / A.5 of the Skills-First redesign.
3
3
  *
4
- * Discovers skill .md files from two locations and parses their
5
- * frontmatter into the Skill type. Phase A surfaces what's already on
6
- * disk; Phase B adds editing + testing; Phase C wires runtime invocation.
4
+ * Anthropic-compatible skill loader. Walks two skill directories and
5
+ * accepts both layouts:
7
6
  *
8
- * Discovery order:
9
- * 1. ~/.clementine/vault/00-System/skills/<name>.md (global)
10
- * 2. <work_dir>/.clementine/skills/<name>.md (per-project)
7
+ * 1. **Folder form** (Anthropic spec): <dir>/<skill-name>/SKILL.md
8
+ * A capital-S SKILL.md is the entry point. Sibling .md files and
9
+ * a scripts/ subdirectory are surfaced as bundled files.
11
10
  *
12
- * Per-project files win on name collision — they override global skills
13
- * for that project. The dashboard surfaces both pools and tags each
14
- * skill with its scope so the user can see which one will resolve.
11
+ * 2. **Flat form** (Clementine legacy): <dir>/<skill-name>.md
12
+ * A single .md file with frontmatter + body. Bundled files
13
+ * unsupported. Used by the 12 pre-redesign skill files we already
14
+ * have on disk.
15
15
  *
16
- * Schema detection: a file is `v1` when its frontmatter declares any of
17
- * inputs / tools.allow / tools.deny / dataSources / stateKeys / success.
18
- * Otherwise (only legacy fields like title / triggers / toolsUsed) it's
19
- * `legacy` and the dashboard shows a migration badge.
16
+ * Discovery directories (per-project wins on name collision):
17
+ * - global: $CLEMENTINE_HOME/vault/00-System/skills/
18
+ * - per-project: <work_dir>/.clementine/skills/
20
19
  *
21
- * Used-by join: Phase A reads the `skills:` array on CronJobDefinition
22
- * (the existing field) to populate Skill.usedByTriggers. Phase C will
23
- * extend this to read the new top-level `skill:` field on the trigger.
20
+ * Phase A is read-only. Phase B adds editing + a "Test this skill"
21
+ * runner. Phase C wires runtime invocation. Phase E migrates legacy
22
+ * crons folder-form skills.
24
23
  */
25
- import type { Skill, SkillScope, CronJobDefinition } from '../types.js';
24
+ import type { Skill, SkillScope, SkillValidationWarning, CronJobDefinition } from '../types.js';
25
+ /** Run Anthropic-spec validations on a parsed skill. Errors are spec
26
+ * violations (skill would be rejected by the Anthropic API); warnings
27
+ * are best-practice hints (still loadable). Findings render in the
28
+ * dashboard's detail pane. */
29
+ export declare function validateSkill(skill: Skill): SkillValidationWarning[];
26
30
  interface ParseResult {
27
31
  skill: Skill;
28
32
  /** Set when the file existed but couldn't be parsed (bad YAML, etc.).
29
- * We still surface the file with a fallback frontmatter so the user
30
- * can see which one needs fixing. */
33
+ * We still surface the skill with synthesized frontmatter so the
34
+ * dashboard can render the offending file with an error banner. */
31
35
  parseError?: string;
32
36
  }
33
- /** Parse a single skill file. Returns a Skill record even when the
34
- * frontmatter is malformed — the dashboard renders the parse error
35
- * in-pane so the user can fix it without leaving the UI. */
37
+ /** Parse a flat-form skill file (single .md). */
36
38
  export declare function parseSkillFile(filePath: string, scope: SkillScope): ParseResult;
39
+ /** Parse a folder-form skill (Anthropic spec: <name>/SKILL.md plus optional
40
+ * bundled files). The folder name is the canonical skill identifier. */
41
+ export declare function parseSkillFolder(folderPath: string, scope: SkillScope): ParseResult;
37
42
  export interface ListSkillsOptions {
38
- /** Optional per-project work_dir to also scan. Per-project skills
39
- * override global skills with the same filename. */
43
+ /** Optional per-project work_dir to scan. Per-project skills shadow
44
+ * global ones with the same identifier. */
40
45
  projectWorkDir?: string;
41
- /** Optional cron jobs list when provided, the loader populates the
42
- * usedByTriggers field on each skill via the existing skills[] array
43
- * on CronJobDefinition (Phase A's join). */
46
+ /** Optional cron jobs for the usedByTriggers join (via skills[]). */
44
47
  jobs?: CronJobDefinition[];
45
48
  }
46
- /** Top-level discovery API. Returns the merged list of skills across
47
- * global + per-project pools, with per-project taking precedence on
48
- * name collision. usedByTriggers is populated when jobs are passed in. */
49
+ /** Top-level discovery API. Merges global + per-project pools, with
50
+ * per-project taking precedence. Populates usedByTriggers when jobs
51
+ * are passed. Returned list is sorted alphabetically by name. */
49
52
  export declare function listSkills(opts?: ListSkillsOptions): Skill[];
50
- /** Get a single skill by name, with the same global/project precedence
51
- * as listSkills. Returns null if neither pool has the skill. */
53
+ /** Get one skill by name, applying per-project precedence. Returns
54
+ * null when neither pool has the skill. */
52
55
  export declare function getSkill(name: string, opts?: ListSkillsOptions): Skill | null;
53
- /** Test-only: where the loader looked. Useful in unit tests + the
54
- * dashboard's diagnostics surface. */
56
+ /** Read one bundled file's contents used by Phase B's preview pane.
57
+ * Defends against directory traversal: rejects paths that escape the
58
+ * skill folder. */
59
+ export declare function readBundledFile(skill: Skill, relPath: string): string | null;
60
+ /** Diagnostics for the dashboard — expose where the loader looked. */
55
61
  export declare function _skillDirsForDiagnostics(workDir?: string): {
56
62
  global: string;
57
63
  project: string | null;