@purveyors/cli 0.35.1 → 0.36.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 +43 -6
- package/dist/commands/skill.d.ts +3 -0
- package/dist/commands/skill.d.ts.map +1 -0
- package/dist/commands/skill.js +145 -0
- package/dist/commands/skill.js.map +1 -0
- package/dist/lib/agent-skill.d.ts +110 -0
- package/dist/lib/agent-skill.d.ts.map +1 -0
- package/dist/lib/agent-skill.js +615 -0
- package/dist/lib/agent-skill.js.map +1 -0
- package/dist/lib/manifest.d.ts +2 -0
- package/dist/lib/manifest.d.ts.map +1 -1
- package/dist/lib/manifest.js +126 -9
- package/dist/lib/manifest.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +5 -0
- package/dist/program.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ Use `purvey --help` for quick command discovery, `purvey context` for the dense
|
|
|
11
11
|
- Official binary: `purvey`
|
|
12
12
|
- Package: `@purveyors/cli`
|
|
13
13
|
- Runtime: Node.js 20+
|
|
14
|
-
- No pre-existing credentials required: `auth`, `config`, `context`, `manifest`
|
|
14
|
+
- No pre-existing credentials required: `auth`, `config`, `context`, `manifest`, `skill`
|
|
15
15
|
- Viewer role required: `catalog` (excluding structured process filters on `catalog search`)
|
|
16
16
|
- Member role required: `procurement`, `inventory`, `roast`, `sales`, `tasting`
|
|
17
17
|
- Mixed public and entitled access: `market` and `price-index` public teaser slices are unauthenticated; filtered, non-public, and evidence slices require a credential and, where entitled, Parchment Intelligence access
|
|
@@ -19,6 +19,7 @@ Use `purvey --help` for quick command discovery, `purvey context` for the dense
|
|
|
19
19
|
- Dense human-readable reference: `purvey context`
|
|
20
20
|
- Compatibility JSON alias: `purvey context --json`
|
|
21
21
|
- In-process machine contract: `@purveyors/cli/manifest`
|
|
22
|
+
- Agent instructions generated from the manifest: `purvey skill print`, `purvey skill install`
|
|
22
23
|
|
|
23
24
|
## Installation
|
|
24
25
|
|
|
@@ -105,6 +106,7 @@ Use the right reference surface for the job:
|
|
|
105
106
|
- `purvey context` is the dense human-readable operator reference for reviewers and interactive use.
|
|
106
107
|
- `purvey context --json` and `purvey context --pretty` emit the same JSON payload as `purvey manifest`, but exist mainly for compatibility with tooling that already shells out to `context`.
|
|
107
108
|
- `@purveyors/cli/manifest` exposes the same contract in-process for Node.js and agent runtimes.
|
|
109
|
+
- `purvey skill print` renders an agent skill from the manifest: a compact SKILL.md plus workflows.md with the step-by-step workflows. `purvey skill install` puts it where Claude Code, Codex, or Cursor will load it, or adds a short block to a repository AGENTS.md.
|
|
108
110
|
|
|
109
111
|
Manifest commands carry `sdkMethods`, the `@purveyors/sdk` operations whose canonical endpoints
|
|
110
112
|
they consume, and, for writes, `confirmedActionEquivalents`, the Purveyors web assistant's
|
|
@@ -142,7 +144,7 @@ Export discipline:
|
|
|
142
144
|
|
|
143
145
|
## Authentication and access model
|
|
144
146
|
|
|
145
|
-
No pre-existing credentials are required for `auth`, `config`, `context`, or `
|
|
147
|
+
No pre-existing credentials are required for `auth`, `config`, `context`, `manifest`, or `skill`.
|
|
146
148
|
|
|
147
149
|
Remote data commands require a valid owner-bound API key with the required scope:
|
|
148
150
|
|
|
@@ -204,7 +206,7 @@ The `reference-profile` commands also require Studio access; the API enforces th
|
|
|
204
206
|
|
|
205
207
|
Market Index teaser slices are public. Filtered `market signals`, origin/process/wholesale `market stats`, non-public `market metadata`, `market evidence`, `price-index comparisons`, `price-index comparison`, and `price-index history` windows over 90 days require Parchment Intelligence access; API-key denial is enforced by the canonical API. The stored login key carries `catalog:read`, which is also the canonical read scope for Market Index, Price Index, and procurement.
|
|
206
208
|
|
|
207
|
-
`auth`, `config`, `context`, and `
|
|
209
|
+
`auth`, `config`, `context`, `manifest`, and `skill` remain available without pre-existing credentials.
|
|
208
210
|
|
|
209
211
|
Commands that require a higher role exit with code `3` on auth failure. That includes missing, revoked, or invalid credentials and an insufficient role.
|
|
210
212
|
|
|
@@ -964,6 +966,39 @@ Notes:
|
|
|
964
966
|
- Use `purvey manifest` for new automation and treat `purvey context --json` as a compatibility alias.
|
|
965
967
|
- `--csv` is not supported.
|
|
966
968
|
|
|
969
|
+
### skill
|
|
970
|
+
|
|
971
|
+
- `purvey skill print [--file SKILL.md|workflows.md|all]`
|
|
972
|
+
- `purvey skill print --agents-md`
|
|
973
|
+
- `purvey skill install --target <claude|agents|agents-md> [--scope user|project] [--force] [--dry-run] [--link-claude-md]`
|
|
974
|
+
|
|
975
|
+
The skill is a folder in the open [Agent Skills](https://agentskills.io/specification) format, rendered from `purvey manifest` so it changes only when the CLI contract changes:
|
|
976
|
+
|
|
977
|
+
- `SKILL.md` loads whenever the skill triggers. It covers when to use `purvey`, headless sign-in, output and exit codes, the ID map, an index of workflows, and working rules, and points to `purvey manifest` for everything else.
|
|
978
|
+
- `workflows.md` holds the step-by-step command sequence for each manifest workflow. `SKILL.md` links to it and tells the agent to read it before a multi-step task, so it is loaded only when needed ([Claude Code](https://code.claude.com/docs/en/skills#add-supporting-files), [Agent Skills](https://agentskills.io/specification#progressive-disclosure)).
|
|
979
|
+
|
|
980
|
+
`skill print` writes `SKILL.md` to stdout; `--file workflows.md` prints the other file. `--json` or `--pretty` wraps one file as `{ name, file, cliVersion, bytes, content }`, and `--file all --json` prints both as `{ name, cliVersion, files: [{ file, bytes, content }] }`. `--agents-md` prints a shorter block for a repository's AGENTS.md instead.
|
|
981
|
+
|
|
982
|
+
`skill install` writes the same content to a location an agent loads:
|
|
983
|
+
|
|
984
|
+
| Target | User scope (default) | Project scope (`--scope project`) | Loaded by |
|
|
985
|
+
| ----------- | -------------------------------------------------------------- | ------------------------------------------------- | --------------------------------------------------------------- |
|
|
986
|
+
| `claude` | `SKILL.md` and `workflows.md` in `~/.claude/skills/purveyors/` | the same files in `.claude/skills/purveyors/` | Claude Code |
|
|
987
|
+
| `agents` | `SKILL.md` and `workflows.md` in `~/.agents/skills/purveyors/` | the same files in `.agents/skills/purveyors/` | Codex, Cursor, and other Agent Skills clients (not Claude Code) |
|
|
988
|
+
| `agents-md` | n/a | one block in `AGENTS.md` in the current directory | Codex and Cursor; Claude Code only as described below |
|
|
989
|
+
|
|
990
|
+
Notes:
|
|
991
|
+
|
|
992
|
+
- No credentials or network access are needed.
|
|
993
|
+
- Prints `{ target, scope, path, action, written, dryRun, cliVersion, bytes }` as JSON; `action` is `create`, `update`, `unchanged`, `append`, or `overwrite`.
|
|
994
|
+
- `claude` and `agents` also print `files: [{ file, path, action, written, bytes }]`, one entry per file. The top-level `path` is `SKILL.md`, `action` is the most significant file action (`overwrite`, then `update`, `create`, `unchanged`), `written` is true when any file changed, and `bytes` is the total.
|
|
995
|
+
- Re-running is safe. Identical files are left alone, an unedited file from an earlier CLI version is updated in place, and a missing `workflows.md` is created, so a `SKILL.md`-only install from an earlier version upgrades cleanly. Rerun after upgrading the CLI.
|
|
996
|
+
- Each file is checked on its own. A file with local edits, or one `purvey` did not write, is refused with exit code `6` unless you pass `--force`; the refusal names every such file and writes nothing. `--dry-run` reports the paths and actions without writing.
|
|
997
|
+
- `agents-md` adds one marked block to `AGENTS.md` (creating the file if needed) and leaves the rest of the file untouched.
|
|
998
|
+
- Claude Code loads skills only from `.claude/skills`, so use `--target claude` for it. It does not read `.agents/`.
|
|
999
|
+
- Claude Code reads `AGENTS.md` only as a fallback: when a `CLAUDE.md`, `.claude/CLAUDE.md`, or `CLAUDE.local.md` exists in the current directory or any directory above it, it reads those instead, unless one imports `@AGENTS.md` ([Claude Code docs](https://code.claude.com/docs/en/memory#agents-md)). `agents-md` reports this as `claudeCode: { visible, via, reason, claudeMdFiles }` in its JSON output and prints a warning on stderr when Claude Code will not see the block. It does not change your `CLAUDE.md` unless you ask.
|
|
1000
|
+
- `--link-claude-md` (with `agents-md`) adds that import: one `@AGENTS.md` line appended to `./CLAUDE.md` (or `@../AGENTS.md` to `./.claude/CLAUDE.md`), creating `./CLAUDE.md` if neither exists. It is a no-op when Claude Code already sees the block, honors `--dry-run`, and never edits `CLAUDE.local.md` or a parent directory's `CLAUDE.md`. `claudeCode.link` reports `{ path, action, written }`, where `action` is `create`, `append`, `unchanged`, or `not-needed`.
|
|
1001
|
+
|
|
967
1002
|
### In-process manifest export
|
|
968
1003
|
|
|
969
1004
|
- `@purveyors/cli/manifest`
|
|
@@ -1055,11 +1090,13 @@ Use the right ID for the right command.
|
|
|
1055
1090
|
Recommended bootstrap order:
|
|
1056
1091
|
|
|
1057
1092
|
```bash
|
|
1058
|
-
purvey
|
|
1059
|
-
purvey context
|
|
1093
|
+
purvey skill install --target claude # Claude Code; Codex and Cursor: --target agents
|
|
1060
1094
|
purvey auth login --headless
|
|
1095
|
+
purvey manifest
|
|
1061
1096
|
```
|
|
1062
1097
|
|
|
1098
|
+
The installed skill gives a coding agent the sign-in flow, output contract, and ID map up front, the step-by-step workflows in `workflows.md` when a task needs them, and `purvey manifest` for the full contract.
|
|
1099
|
+
|
|
1063
1100
|
Use `purvey manifest` as the authoritative machine-readable entry point. Keep `purvey context` for dense operator context, or use `purvey context --json` only when you need compatibility with an existing wrapper.
|
|
1064
1101
|
|
|
1065
1102
|
Why this CLI works well for agents:
|
|
@@ -1105,7 +1142,7 @@ Use the [ID reference](#id-reference) section above. `catalog_id` and inventory
|
|
|
1105
1142
|
|
|
1106
1143
|
**Pagination only shows the first page**
|
|
1107
1144
|
|
|
1108
|
-
|
|
1145
|
+
Only `catalog search` (default 10 results), `inventory list`, `roast list`, and `sales list` (default 20) page with `--limit` and `--offset`.
|
|
1109
1146
|
|
|
1110
1147
|
```bash
|
|
1111
1148
|
purvey inventory list --limit 20 --offset 0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../src/commands/skill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA2DpC,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAsK1D"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { AGENT_SKILL_FILE, AGENT_SKILL_FILES, AGENT_SKILL_NAME, installAgentSkill, renderAgentSkillFile, renderAgentsMdBlock, } from '../lib/agent-skill.js';
|
|
3
|
+
import { PrvrsError, withErrorHandling } from '../lib/errors.js';
|
|
4
|
+
import { info, outputData, shouldUseInteractiveOutput, success, warn } from '../lib/output.js';
|
|
5
|
+
const ACTION_LABELS = {
|
|
6
|
+
create: 'Created',
|
|
7
|
+
update: 'Updated',
|
|
8
|
+
unchanged: 'Already current:',
|
|
9
|
+
append: 'Appended the purvey block to',
|
|
10
|
+
overwrite: 'Replaced',
|
|
11
|
+
};
|
|
12
|
+
function sized(content) {
|
|
13
|
+
return { bytes: Buffer.byteLength(content, 'utf8'), content };
|
|
14
|
+
}
|
|
15
|
+
function parsePrintFile(value, fileGiven, agentsMd, structured) {
|
|
16
|
+
if (agentsMd) {
|
|
17
|
+
if (fileGiven) {
|
|
18
|
+
throw new PrvrsError('INVALID_ARGUMENT', '--agents-md prints the AGENTS.md block and cannot be combined with --file.');
|
|
19
|
+
}
|
|
20
|
+
return 'agents-md';
|
|
21
|
+
}
|
|
22
|
+
if (value === 'all') {
|
|
23
|
+
if (!structured) {
|
|
24
|
+
throw new PrvrsError('INVALID_ARGUMENT', '--file all prints several files, so it needs --json or --pretty. Use --file SKILL.md or --file workflows.md for Markdown.');
|
|
25
|
+
}
|
|
26
|
+
return [...AGENT_SKILL_FILES];
|
|
27
|
+
}
|
|
28
|
+
if (!AGENT_SKILL_FILES.includes(value)) {
|
|
29
|
+
throw new PrvrsError('INVALID_ARGUMENT', `Unknown --file "${value}". Use one of: ${AGENT_SKILL_FILES.join(', ')}, all.`);
|
|
30
|
+
}
|
|
31
|
+
return [value];
|
|
32
|
+
}
|
|
33
|
+
export function buildSkillCommand(version) {
|
|
34
|
+
const skill = new Command('skill').description('Print or install agent instructions generated from the CLI manifest');
|
|
35
|
+
skill
|
|
36
|
+
.command('print')
|
|
37
|
+
.description('Write the generated SKILL.md, workflows.md, or the AGENTS.md block to stdout')
|
|
38
|
+
.option('--file <file>', `Skill file to print: ${AGENT_SKILL_FILES.join(', ')}, or all (needs --json or --pretty)`, AGENT_SKILL_FILE)
|
|
39
|
+
.option('--agents-md', 'Print the compact AGENTS.md block instead of the skill')
|
|
40
|
+
.addHelpText('after', `
|
|
41
|
+
The skill is a folder: SKILL.md, which agents load first, and workflows.md, which it points to for
|
|
42
|
+
step-by-step workflows. Prints SKILL.md as Markdown by default. --json or --pretty wraps one file as
|
|
43
|
+
{ name, file, cliVersion, bytes, content }, or every file with --file all as
|
|
44
|
+
{ name, cliVersion, files: [{ file, bytes, content }] }.
|
|
45
|
+
The output is rendered from \`purvey manifest\`; no credentials are needed.
|
|
46
|
+
|
|
47
|
+
Examples:
|
|
48
|
+
purvey skill print
|
|
49
|
+
purvey skill print --file workflows.md
|
|
50
|
+
purvey skill print --file all --json
|
|
51
|
+
purvey skill print --agents-md
|
|
52
|
+
purvey skill print > SKILL.md
|
|
53
|
+
`)
|
|
54
|
+
.action(withErrorHandling(async (opts, cmd) => {
|
|
55
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
56
|
+
if (globalOpts.csv) {
|
|
57
|
+
throw new PrvrsError('INVALID_ARGUMENT', 'The skill print command does not support --csv. Use Markdown (default), --json, or --pretty.');
|
|
58
|
+
}
|
|
59
|
+
const structured = Boolean(globalOpts.json || globalOpts.pretty);
|
|
60
|
+
const files = parsePrintFile(opts.file, cmd.getOptionValueSource('file') !== 'default', Boolean(opts.agentsMd), structured);
|
|
61
|
+
if (files === 'agents-md') {
|
|
62
|
+
const content = renderAgentsMdBlock(version);
|
|
63
|
+
if (structured) {
|
|
64
|
+
outputData({ name: AGENT_SKILL_NAME, file: 'AGENTS.md', cliVersion: version, ...sized(content) }, { pretty: globalOpts.pretty });
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
process.stdout.write(content);
|
|
68
|
+
}
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const rendered = files.map((file) => ({
|
|
72
|
+
file,
|
|
73
|
+
...sized(renderAgentSkillFile(file, version)),
|
|
74
|
+
}));
|
|
75
|
+
if (!structured) {
|
|
76
|
+
process.stdout.write(rendered[0].content);
|
|
77
|
+
}
|
|
78
|
+
else if (opts.file === 'all') {
|
|
79
|
+
outputData({ name: AGENT_SKILL_NAME, cliVersion: version, files: rendered }, { pretty: globalOpts.pretty });
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
const [{ file, ...rest }] = rendered;
|
|
83
|
+
outputData({ name: AGENT_SKILL_NAME, file, cliVersion: version, ...rest }, { pretty: globalOpts.pretty });
|
|
84
|
+
}
|
|
85
|
+
}));
|
|
86
|
+
skill
|
|
87
|
+
.command('install')
|
|
88
|
+
.description('Install the generated instructions for Claude Code, Agent Skills clients such as Codex and Cursor, or a repository AGENTS.md')
|
|
89
|
+
.option('--target <target>', 'claude, agents, or agents-md (required)')
|
|
90
|
+
.option('--scope <scope>', 'user (home directory) or project (current directory); defaults to user, or project for agents-md')
|
|
91
|
+
.option('--force', 'Replace skill files or an AGENTS.md block that have local edits')
|
|
92
|
+
.option('--dry-run', 'Report the path and action without writing')
|
|
93
|
+
.option('--link-claude-md', 'agents-md only: add an @AGENTS.md import to ./CLAUDE.md so Claude Code loads the block')
|
|
94
|
+
.addHelpText('after', `
|
|
95
|
+
Targets:
|
|
96
|
+
claude ~/.claude/skills/purveyors/{SKILL.md,workflows.md} (Claude Code)
|
|
97
|
+
agents ~/.agents/skills/purveyors/{SKILL.md,workflows.md} (Codex, Cursor, other Agent Skills clients)
|
|
98
|
+
agents-md ./AGENTS.md, as one marked block (repository-level instructions)
|
|
99
|
+
|
|
100
|
+
claude and agents write a skill folder: SKILL.md, which agents load first, and workflows.md, the
|
|
101
|
+
step-by-step workflows it points to. Each file is checked and reported on its own under "files".
|
|
102
|
+
Claude Code loads skills only from .claude/skills, so use --target claude there; it does not read .agents/.
|
|
103
|
+
--scope project writes .claude/skills/... or .agents/skills/... under the current directory instead.
|
|
104
|
+
|
|
105
|
+
Claude Code reads AGENTS.md only when no CLAUDE.md, .claude/CLAUDE.md, or CLAUDE.local.md exists in the
|
|
106
|
+
current directory or above it. agents-md reports this as "claudeCode" in its JSON output. --link-claude-md
|
|
107
|
+
adds an @AGENTS.md import to ./CLAUDE.md (or ./.claude/CLAUDE.md), creating ./CLAUDE.md if needed, and never
|
|
108
|
+
edits CLAUDE.local.md or a parent directory's CLAUDE.md. See https://code.claude.com/docs/en/memory#agents-md
|
|
109
|
+
Re-running is safe: identical files are left alone, unedited earlier output is updated, and a missing
|
|
110
|
+
workflows.md is created. If any file has local edits, nothing is written and the command exits 6 unless
|
|
111
|
+
--force is passed. No credentials are needed.
|
|
112
|
+
|
|
113
|
+
Examples:
|
|
114
|
+
purvey skill install --target claude
|
|
115
|
+
purvey skill install --target agents --dry-run
|
|
116
|
+
purvey skill install --target claude --scope project
|
|
117
|
+
purvey skill install --target agents-md
|
|
118
|
+
purvey skill install --target agents-md --link-claude-md
|
|
119
|
+
`)
|
|
120
|
+
.action(withErrorHandling(async (opts, cmd) => {
|
|
121
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
122
|
+
const result = await installAgentSkill({ ...opts, version });
|
|
123
|
+
if (shouldUseInteractiveOutput(globalOpts)) {
|
|
124
|
+
for (const { action, path } of result.files ?? [result]) {
|
|
125
|
+
if (result.dryRun) {
|
|
126
|
+
info(`Dry run, nothing written. Would ${action}: ${path}`);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
success(`${ACTION_LABELS[action]} ${path}`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (result.claudeCode?.visible) {
|
|
133
|
+
info(result.claudeCode.reason);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const { claudeCode } = result;
|
|
137
|
+
if (claudeCode && !claudeCode.visible) {
|
|
138
|
+
// Always on stderr, so agents running non-interactively see it too.
|
|
139
|
+
warn(`Claude Code will not load this block. ${claudeCode.reason}`);
|
|
140
|
+
}
|
|
141
|
+
outputData(result, globalOpts);
|
|
142
|
+
}));
|
|
143
|
+
return skill;
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=skill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill.js","sourceRoot":"","sources":["../../src/commands/skill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,GAEpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,0BAA0B,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAG/F,MAAM,aAAa,GAAG;IACpB,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;IACjB,SAAS,EAAE,kBAAkB;IAC7B,MAAM,EAAE,8BAA8B;IACtC,SAAS,EAAE,UAAU;CACb,CAAC;AAEX,SAAS,KAAK,CAAC,OAAe;IAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC;AAChE,CAAC;AAED,SAAS,cAAc,CACrB,KAAa,EACb,SAAkB,EAClB,QAAiB,EACjB,UAAmB;IAEnB,IAAI,QAAQ,EAAE,CAAC;QACb,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,IAAI,UAAU,CAClB,kBAAkB,EAClB,4EAA4E,CAC7E,CAAC;QACJ,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,IAAI,KAAK,KAAK,KAAK,EAAE,CA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B,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;YACjC,CAAC;QACH,CAAC;QACD,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;QAC9B,IAAI,UAAU,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;YACtC,oEAAoE;YACpE,IAAI,CAAC,yCAAyC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;QACrE,CAAC;QAED,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACjC,CAAC,CACF,CACF,CAAC;IAEJ,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { type CliManifest } from './manifest.js';
|
|
2
|
+
/**
|
|
3
|
+
* Agent instructions rendered from the CLI manifest. The manifest stays the
|
|
4
|
+
* single source of truth: commands, flags, auth, output, exit codes, ID types,
|
|
5
|
+
* and workflows all come from `getCliManifest()`, so the skill cannot drift
|
|
6
|
+
* from the contract it describes.
|
|
7
|
+
*/
|
|
8
|
+
export declare const AGENT_SKILL_NAME = "purveyors";
|
|
9
|
+
export declare const AGENT_SKILL_FILE = "SKILL.md";
|
|
10
|
+
/**
|
|
11
|
+
* Supporting file in the same skill folder. Agent Skills clients load SKILL.md
|
|
12
|
+
* when the skill triggers and read other files only when SKILL.md points to
|
|
13
|
+
* them, so the step-by-step workflows, which grow with the manifest, live here.
|
|
14
|
+
* See https://code.claude.com/docs/en/skills#add-supporting-files and
|
|
15
|
+
* https://agentskills.io/specification#progressive-disclosure
|
|
16
|
+
*/
|
|
17
|
+
export declare const AGENT_WORKFLOWS_FILE = "workflows.md";
|
|
18
|
+
/** Every file in the skill folder, SKILL.md first. */
|
|
19
|
+
export declare const AGENT_SKILL_FILES: readonly ["SKILL.md", "workflows.md"];
|
|
20
|
+
export type AgentSkillFile = (typeof AGENT_SKILL_FILES)[number];
|
|
21
|
+
/** Upper bound for the rendered SKILL.md, enforced by tests. */
|
|
22
|
+
export declare const AGENT_SKILL_MAX_BYTES: number;
|
|
23
|
+
/** Upper bound for the rendered workflows.md, enforced by tests. */
|
|
24
|
+
export declare const AGENT_WORKFLOWS_MAX_BYTES: number;
|
|
25
|
+
export declare const AGENT_SKILL_DESCRIPTION: string;
|
|
26
|
+
export declare const SKILL_TARGETS: readonly ["claude", "agents", "agents-md"];
|
|
27
|
+
export declare const SKILL_SCOPES: readonly ["user", "project"];
|
|
28
|
+
export type SkillTarget = (typeof SKILL_TARGETS)[number];
|
|
29
|
+
export type SkillScope = (typeof SKILL_SCOPES)[number];
|
|
30
|
+
export type SkillInstallAction = 'create' | 'update' | 'unchanged' | 'append' | 'overwrite';
|
|
31
|
+
export interface SkillInstallFileResult {
|
|
32
|
+
file: AgentSkillFile;
|
|
33
|
+
path: string;
|
|
34
|
+
action: SkillInstallAction;
|
|
35
|
+
written: boolean;
|
|
36
|
+
bytes: number;
|
|
37
|
+
}
|
|
38
|
+
export interface SkillInstallResult {
|
|
39
|
+
target: SkillTarget;
|
|
40
|
+
scope: SkillScope;
|
|
41
|
+
/** SKILL.md for claude and agents, AGENTS.md for agents-md. */
|
|
42
|
+
path: string;
|
|
43
|
+
/** For claude and agents, summarizes `files`: overwrite, then update, then create, then unchanged. */
|
|
44
|
+
action: SkillInstallAction;
|
|
45
|
+
/** True when any file was written. */
|
|
46
|
+
written: boolean;
|
|
47
|
+
dryRun: boolean;
|
|
48
|
+
cliVersion: string;
|
|
49
|
+
/** Total bytes across the installed content. */
|
|
50
|
+
bytes: number;
|
|
51
|
+
/** claude and agents only: each file in the skill folder, SKILL.md first. */
|
|
52
|
+
files?: SkillInstallFileResult[];
|
|
53
|
+
/** agents-md only: whether Claude Code will load the AGENTS.md block. */
|
|
54
|
+
claudeCode?: ClaudeCodeVisibility;
|
|
55
|
+
}
|
|
56
|
+
export type ClaudeMdLinkAction = 'create' | 'append' | 'unchanged' | 'not-needed';
|
|
57
|
+
/**
|
|
58
|
+
* Claude Code reads AGENTS.md only as a fallback: when a CLAUDE.md,
|
|
59
|
+
* .claude/CLAUDE.md, or CLAUDE.local.md sits in the project directory or any
|
|
60
|
+
* directory above it, it reads those instead, unless one imports AGENTS.md.
|
|
61
|
+
* See https://code.claude.com/docs/en/memory#agents-md
|
|
62
|
+
*/
|
|
63
|
+
export interface ClaudeCodeVisibility {
|
|
64
|
+
visible: boolean;
|
|
65
|
+
/** How Claude Code loads the block: AGENTS.md directly, a CLAUDE.md import, or not at all. */
|
|
66
|
+
via: 'agents-md' | 'claude-md-import' | null;
|
|
67
|
+
reason: string;
|
|
68
|
+
/** CLAUDE.md files on the path that take precedence over AGENTS.md. */
|
|
69
|
+
claudeMdFiles: string[];
|
|
70
|
+
/** Present with --link-claude-md. */
|
|
71
|
+
link?: {
|
|
72
|
+
path: string | null;
|
|
73
|
+
action: ClaudeMdLinkAction;
|
|
74
|
+
written: boolean;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/** Render SKILL.md in the open Agent Skills format. */
|
|
78
|
+
export declare function renderAgentSkill(version: string, manifest?: CliManifest): string;
|
|
79
|
+
/** Render workflows.md, the supporting file SKILL.md points to for step-by-step workflows. */
|
|
80
|
+
export declare function renderAgentWorkflows(version: string, manifest?: CliManifest): string;
|
|
81
|
+
/** Render one file of the skill folder. */
|
|
82
|
+
export declare function renderAgentSkillFile(file: AgentSkillFile, version: string, manifest?: CliManifest): string;
|
|
83
|
+
/** Render the marked AGENTS.md block; markers let `install` refresh it in place. */
|
|
84
|
+
export declare function renderAgentsMdBlock(version: string, manifest?: CliManifest): string;
|
|
85
|
+
export declare function resolveSkillInstallPath(target: SkillTarget, scope: SkillScope, roots?: {
|
|
86
|
+
home?: string;
|
|
87
|
+
cwd?: string;
|
|
88
|
+
}): string;
|
|
89
|
+
export declare const CLAUDE_CODE_AGENTS_MD_DOCS = "https://code.claude.com/docs/en/memory#agents-md";
|
|
90
|
+
export interface SkillInstallOptions {
|
|
91
|
+
target?: string;
|
|
92
|
+
scope?: string;
|
|
93
|
+
force?: boolean;
|
|
94
|
+
dryRun?: boolean;
|
|
95
|
+
/** agents-md only: add an `@AGENTS.md` import so Claude Code loads the block past a CLAUDE.md. */
|
|
96
|
+
linkClaudeMd?: boolean;
|
|
97
|
+
version: string;
|
|
98
|
+
manifest?: CliManifest;
|
|
99
|
+
home?: string;
|
|
100
|
+
cwd?: string;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Install the generated instructions. Never touches credentials or the network.
|
|
104
|
+
* claude and agents write both files of the skill folder; agents-md writes one
|
|
105
|
+
* block. Identical content is left alone, unedited earlier output is updated,
|
|
106
|
+
* and anything else needs `force`. For agents-md, also reports whether Claude Code
|
|
107
|
+
* will load the block, and with `linkClaudeMd` makes sure it does.
|
|
108
|
+
*/
|
|
109
|
+
export declare function installAgentSkill(options: SkillInstallOptions): Promise<SkillInstallResult>;
|
|
110
|
+
//# sourceMappingURL=agent-skill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-skill.d.ts","sourceRoot":"","sources":["../../src/lib/agent-skill.ts"],"names":[],"mappings":"AAKA,OAAO,EAKL,KAAK,WAAW,EACjB,MAAM,eAAe,CAAC;AAEvB;;;;;GAKG;AAEH,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAC5C,eAAO,MAAM,gBAAgB,aAAa,CAAC;AAC3C;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,iBAAiB,CAAC;AACnD,sDAAsD;AACtD,eAAO,MAAM,iBAAiB,uCAAoD,CAAC;AACnF,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAChE,gEAAgE;AAChE,eAAO,MAAM,qBAAqB,QAAW,CAAC;AAC9C,oEAAoE;AACpE,eAAO,MAAM,yBAAyB,QAAY,CAAC;AAKnD,eAAO,MAAM,uBAAuB,QAAiP,CAAC;AAEtR,eAAO,MAAM,aAAa,4CAA6C,CAAC;AACxE,eAAO,M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