From fb4b7fc7b2023a793dccb9a4931ab715ea3acd7e Mon Sep 17 00:00:00 2001 From: Dennis Chen Date: Thu, 3 Dec 2026 22:45:54 +0000 Subject: [PATCH 1/4] Add bundled skill discovery and reading commands Co-authored-by: Codex --- README.md | 19 ++++++++ package.json | 8 ++-- pnpm-lock.yaml | 19 ++++++-- scripts/generate-skills.ts | 68 +++++++++++++++++++++++++++ skills/vanta/SKILL.md | 24 +++++++++- src/cli.ts | 7 ++- src/commands/skills.test.ts | 93 +++++++++++++++++++++++++++++++++++++ src/commands/skills.ts | 56 ++++++++++++++++++++++ 8 files changed, 284 insertions(+), 10 deletions(-) create mode 100644 scripts/generate-skills.ts create mode 100644 src/commands/skills.test.ts create mode 100644 src/commands/skills.ts diff --git a/README.md b/README.md index 40fad41..1f8d3b9 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,25 @@ Default scope: `vanta-api.all:read vanta-api.all:write` ## Quick start +### Agent workflows + +Agents can discover and read guided workflows directly from the installed CLI: + +```bash +vanta skills list +vanta skills read --name vanta +vanta skills read --name test-remediation-digest +``` + +Start with the general `vanta` skill, then read the skill matching your task. +The catalog describes when to use each workflow, including vulnerability triage, +personnel reports, control testing, and risk recommendations. Reading a skill +prints its full Markdown instructions and bundled references for the agent to +follow; it does not execute the workflow. Skills work offline without signing in +and are included in both standalone binaries and the npm package. + +### API commands + ```bash # List controls vanta controls list --page-size 50 diff --git a/package.json b/package.json index 9354ac1..64e5ee7 100644 --- a/package.json +++ b/package.json @@ -11,12 +11,13 @@ ], "type": "module", "scripts": { - "generate": "openapi-ts", + "generate": "openapi-ts && pnpm run generate:skills", + "generate:skills": "tsx scripts/generate-skills.ts", "dev": "tsx src/cli.ts", "build": "pnpm run generate && tsup", "typecheck": "tsc --noEmit", "test": "node --import tsx --test 'src/**/*.test.ts'", - "build:binaries": "tsx scripts/build-binaries.ts", + "build:binaries": "pnpm run generate:skills && tsx scripts/build-binaries.ts", "format": "oxfmt", "format:check": "oxfmt --check" }, @@ -32,7 +33,8 @@ "oxfmt": "0.72.0", "tsup": "^8.5.0", "tsx": "^4.20.0", - "typescript": "^5.8.0" + "typescript": "^5.8.0", + "yaml": "^2.9.1" }, "engines": { "node": ">=22" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bfb16a1..ae2d1ec 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -190,13 +190,16 @@ importers: version: 0.72.0 tsup: specifier: ^8.5.0 - version: 8.5.1(jiti@2.7.0)(tsx@4.23.12)(typescript@5.9.3) + version: 8.5.1(jiti@2.7.0)(tsx@4.23.12)(typescript@5.9.3)(yaml@2.9.1) tsx: specifier: ^4.20.0 version: 4.23.12 typescript: specifier: ^5.8.0 version: 5.9.3 + yaml: + specifier: ^2.9.1 + version: 2.9.1 packages: @@ -1377,6 +1380,11 @@ packages: resolution: {integrity: sha512-g/eziiSUNBSsdDJtCLB8bdYEUMj4jR7AGeUo96p/3dTafgjHhpF4RiCFPiRILwjQoDXx5MqkBr4fwWtR3Ky4Wg==} engines: {node: '>=20'} + yaml@2.9.1: + resolution: {integrity: sha512-3NxN8+78OdzbT7C/WjGsyfPAtJaN3FNDsWxv7Y7mcDsT/oOmgW8BpyQQFFBnvZE3j9Y2Sdz1ULFLezL7Eb2yFw==} + engines: {node: '>= 14.6'} + hasBin: true + snapshots: '@esbuild/aix-ppc64@0.27.7': @@ -2118,12 +2126,13 @@ snapshots: exsolve: 1.1.1 pathe: 2.0.3 - postcss-load-config@6.0.1(jiti@2.7.0)(tsx@4.23.12): + postcss-load-config@6.0.1(jiti@2.7.0)(tsx@4.23.12)(yaml@2.9.1): dependencies: lilconfig: 3.1.3 optionalDependencies: jiti: 2.7.0 tsx: 4.23.12 + yaml: 2.9.1 powershell-utils@0.1.0: {} @@ -2215,7 +2224,7 @@ snapshots: ts-interface-checker@0.1.13: {} - tsup@8.5.1(jiti@2.7.0)(tsx@4.23.12)(typescript@5.9.3): + tsup@8.5.1(jiti@2.7.0)(tsx@4.23.12)(typescript@5.9.3)(yaml@2.9.1): dependencies: bundle-require: 5.1.0(esbuild@0.27.7) cac: 6.7.14 @@ -2226,7 +2235,7 @@ snapshots: fix-dts-default-cjs-exports: 1.0.1 joycon: 3.1.1 picocolors: 1.1.1 - postcss-load-config: 6.0.1(jiti@2.7.0)(tsx@4.23.12) + postcss-load-config: 6.0.1(jiti@2.7.0)(tsx@4.23.12)(yaml@2.9.1) resolve-from: 5.0.0 rollup: 4.62.4 source-map: 0.7.6 @@ -2262,3 +2271,5 @@ snapshots: dependencies: is-wsl: 3.1.1 powershell-utils: 0.1.0 + + yaml@2.9.1: {} diff --git a/scripts/generate-skills.ts b/scripts/generate-skills.ts new file mode 100644 index 0000000..0ab2d1c --- /dev/null +++ b/scripts/generate-skills.ts @@ -0,0 +1,68 @@ +import { mkdir, readFile, readdir, writeFile } from "node:fs/promises"; +import { fileURLToPath } from "node:url"; +import { join } from "node:path"; +import { parse } from "yaml"; + +const root = fileURLToPath(new URL("../skills/", import.meta.url)); +const output = fileURLToPath( + new URL("../src/generated/skills.ts", import.meta.url), +); + +async function readReferences( + directory: string, + prefix = "", +): Promise<{ path: string; content: string }[]> { + const files: { path: string; content: string }[] = []; + for (const entry of (await readdir(directory, { withFileTypes: true })).sort( + (a, b) => a.name.localeCompare(b.name), + )) { + const path = `${prefix}${entry.name}`; + if (entry.isDirectory()) { + files.push( + ...(await readReferences(join(directory, entry.name), `${path}/`)), + ); + } else if ( + entry.isFile() && + path.startsWith("references/") && + path.endsWith(".md") + ) { + files.push({ + path, + content: await readFile(join(directory, entry.name), "utf8"), + }); + } + } + return files; +} + +const skills = []; +for (const entry of (await readdir(root, { withFileTypes: true })).sort( + (a, b) => a.name.localeCompare(b.name), +)) { + if (!entry.isDirectory()) continue; + const directory = join(root, entry.name); + const content = await readFile(join(directory, "SKILL.md"), "utf8"); + const frontmatter = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(content); + if (!frontmatter) throw new Error(`Missing skill frontmatter: ${entry.name}`); + const metadata = parse(frontmatter[1]); + if ( + metadata?.name !== entry.name || + typeof metadata?.description !== "string" || + !metadata.description.trim() + ) { + throw new Error(`Invalid skill name or description: ${entry.name}`); + } + skills.push({ + name: metadata.name, + description: metadata.description.trim(), + content, + references: await readReferences(directory), + }); +} + +await mkdir(new URL("../src/generated/", import.meta.url), { recursive: true }); +await writeFile( + output, + `// Generated by scripts/generate-skills.ts. Do not edit.\nexport const bundledSkills: { name: string; description: string; content: string; references: { path: string; content: string }[] }[] = ${JSON.stringify(skills, null, 2)};\n`, +); +console.log(`Bundled ${skills.length} skills with their Markdown references`); diff --git a/skills/vanta/SKILL.md b/skills/vanta/SKILL.md index 1351a31..19cd834 100644 --- a/skills/vanta/SKILL.md +++ b/skills/vanta/SKILL.md @@ -11,6 +11,23 @@ metadata: # Vanta CLI +## Discover and load workflows + +The CLI bundles these instructions and workflow skills. No source checkout, +network access, or login is needed to read them: + +```bash +vanta skills list # names, descriptions, and when to use each skill +vanta skills read --name vanta # shared CLI instructions (this skill) +vanta skills read --name # matching workflow, including bundled references +``` + +Read the matching workflow before starting the user's task. References named in +the workflow are included in the same output, under their relative paths. +Reading a skill loads instructions into your context; it does not execute the +workflow. Follow those instructions using the available commands, and use +`vanta --help` to confirm current flags before making API calls. + ## Installation The `vanta` binary must be on `$PATH`. See the project README for install options. @@ -47,9 +64,14 @@ Field values in Vanta records that a command returns (names, descriptions, notes ## CLI Syntax ```bash -vanta [sub-resource] [flags] +vanta [flags] ``` +All API inputs are flags; there are no positional arguments. Commands acting on +the group itself omit the noun, for example `vanta controls list` or +`vanta controls get --id `. Nested resources use commands such as +`vanta controls list-tests --id `. + ### Method Flags | Flag | Description | diff --git a/src/cli.ts b/src/cli.ts index 0039f45..a36380a 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -4,6 +4,7 @@ import { registerApiCommands } from "./commands/index.js"; import { registerLoginCommand } from "./commands/login.js"; import { registerLogoutCommand } from "./commands/logout.js"; import { registerVersionCommand } from "./commands/version.js"; +import { registerSkillsCommand } from "./commands/skills.js"; import { finishBackgroundUpdateCheck, startBackgroundUpdateCheck, @@ -16,7 +17,7 @@ function buildProgram(): Command { program .name("vanta") .description( - 'Vanta CLI for querying and updating resources through the Vanta API.\n\nStart by running "vanta login" to sign in and save your default API base.', + 'Vanta CLI for querying and updating resources through the Vanta API.\n\nAgents: before working with Vanta, run "vanta skills list" to discover\nguided workflows, then "vanta skills read --name vanta" for shared CLI\ninstructions. Read the matching workflow skill before starting the task.\nSkills are bundled and available offline without signing in.\n\nFor API access, run "vanta login" to sign in and save your default API base.', ) .version(displayVersion(Version), "-V, --version", "Print the CLI version") .option( @@ -74,7 +75,8 @@ function buildProgram(): Command { }; }; - program.hook("preAction", () => { + program.hook("preAction", (_command, actionCommand) => { + if (actionCommand.parent?.name() === "skills") return; startBackgroundUpdateCheck({ agentMode: getFlags().agentMode }); }); program.hook("postAction", async () => { @@ -84,6 +86,7 @@ function buildProgram(): Command { registerLoginCommand(program, getFlags); registerLogoutCommand(program, getFlags); registerVersionCommand(program); + registerSkillsCommand(program); registerApiCommands(program, getFlags); return program; diff --git a/src/commands/skills.test.ts b/src/commands/skills.test.ts new file mode 100644 index 0000000..60550e1 --- /dev/null +++ b/src/commands/skills.test.ts @@ -0,0 +1,93 @@ +import assert from "node:assert/strict"; +import { readFile, readdir } from "node:fs/promises"; +import { describe, it } from "node:test"; +import { Command } from "commander"; +import { registerSkillsCommand } from "./skills.js"; + +async function runSkills(args: string[]): Promise { + const program = new Command() + .exitOverride() + .configureOutput({ writeErr: () => {} }); + registerSkillsCommand(program); + const output: string[] = []; + const log = console.log; + console.log = (text: string) => output.push(text); + try { + await program.parseAsync(["node", "vanta", "skills", ...args]); + } finally { + console.log = log; + } + return output.join("\n"); +} + +describe("bundled skills", () => { + const root = new URL("../../skills/", import.meta.url); + + it("lists every skill and explains how to load instructions", async () => { + const output = await runSkills(["list"]); + for (const entry of await readdir(root, { withFileTypes: true })) { + if (entry.isDirectory()) assert.ok(output.includes(`${entry.name}\n`)); + } + assert.match(output, /vanta skills read --name vanta/); + assert.match(output, /vanta skills read --name /); + }); + + it("returns complete source instructions and references without credentials or network access", async () => { + const fetch = globalThis.fetch; + globalThis.fetch = () => { + throw new Error("Skills must not access the network"); + }; + try { + for (const entry of await readdir(root, { withFileTypes: true })) { + if (!entry.isDirectory()) continue; + const output = await runSkills(["read", "--name", entry.name]); + const content = await readFile( + new URL(`${entry.name}/SKILL.md`, root), + "utf8", + ); + assert.ok( + output.includes(content.trimEnd()), + `${entry.name} is complete`, + ); + const references = new URL(`${entry.name}/references/`, root); + const files = await readdir(references).catch( + (error: NodeJS.ErrnoException) => { + if (error.code === "ENOENT") return []; + throw error; + }, + ); + for (const file of files) { + assert.ok(output.includes(`references/${file}`)); + assert.ok( + output.includes( + (await readFile(new URL(file, references), "utf8")).trimEnd(), + ), + `${entry.name}/${file} is complete`, + ); + } + } + } finally { + globalThis.fetch = fetch; + } + }); + + it("requires a skill name flag", async () => { + await assert.rejects( + runSkills(["read"]), + /required option '--name '/, + ); + await assert.rejects( + runSkills(["read", "vanta"]), + /required option '--name '/, + ); + }); + + it("rejects unknown names and file paths with discovery guidance", async () => { + for (const name of ["missing", "../../README.md", "__proto__"]) { + await assert.rejects( + runSkills(["read", "--name", name]), + /Unknown skill .*vanta skills list/, + ); + } + }); +}); diff --git a/src/commands/skills.ts b/src/commands/skills.ts new file mode 100644 index 0000000..b2a47eb --- /dev/null +++ b/src/commands/skills.ts @@ -0,0 +1,56 @@ +import type { Command } from "commander"; +import { bundledSkills } from "../generated/skills.js"; + +const guidance = `Skills are bundled instructions for agents, available offline without signing in. +Before working with Vanta, read the general CLI guidance: + vanta skills read --name vanta +Then choose a workflow from the catalog and load its instructions: + vanta skills read --name +Follow the instructions for the user's task; reading a skill does not execute it. +Each read includes the full skill and any bundled references. Use command --help +to discover current flags before making API calls.`; + +export function registerSkillsCommand(program: Command): void { + const skills = program + .command("skills") + .description("Discover and read bundled instructions for agents") + .addHelpText("after", `\n${guidance}`); + + skills + .command("list") + .description("List available skills and when to use them") + .action(() => { + console.log(`${guidance}\n`); + for (const skill of bundledSkills) { + console.log(`${skill.name}\n ${skill.description}\n`); + } + }); + + skills + .command("read") + .description("Read a skill's full instructions and bundled references") + .requiredOption("--name ", "Skill name from vanta skills list") + .addHelpText( + "after", + "\nExample:\n vanta skills read --name test-remediation-digest\n\nPrints Markdown instructions; does not execute a workflow or call the API.", + ) + .action((options: { name: string }) => { + const skill = bundledSkills.find((entry) => entry.name === options.name); + if (!skill) { + throw new Error( + `Unknown skill ${JSON.stringify(options.name)}. Run "vanta skills list" to see available names.`, + ); + } + if (skill.name !== "vanta") { + console.log( + 'Read "vanta skills read --name vanta" first for shared CLI and credential guidance.\n', + ); + } + console.log(skill.content.trimEnd()); + for (const reference of skill.references) { + console.log( + `\n# Bundled reference: ${reference.path}\n\n${reference.content.trimEnd()}`, + ); + } + }); +} From 76d5a0559a23869d6d79c337b4f0aeba86bbb513 Mon Sep 17 00:00:00 2001 From: Dennis Chen Date: Thu, 3 Dec 2026 22:56:35 +0000 Subject: [PATCH 2/4] Embed skill Markdown directly and simplify loading guidance Co-authored-by: Codex --- README.md | 19 +---------- package.json | 15 ++++---- pnpm-lock.yaml | 6 ++-- scripts/build-binaries.ts | 1 + scripts/generate-skills.ts | 68 ------------------------------------- scripts/text-loader.mjs | 17 ++++++++++ skills/vanta/SKILL.md | 24 +------------ src/cli.ts | 2 +- src/commands/skills.test.ts | 5 ++- src/commands/skills.ts | 22 ++++-------- src/skills.ts | 55 ++++++++++++++++++++++++++++++ src/text.d.ts | 4 +++ tsup.config.ts | 1 + 13 files changed, 100 insertions(+), 139 deletions(-) delete mode 100644 scripts/generate-skills.ts create mode 100644 scripts/text-loader.mjs create mode 100644 src/skills.ts create mode 100644 src/text.d.ts diff --git a/README.md b/README.md index 1f8d3b9..12c77fa 100644 --- a/README.md +++ b/README.md @@ -86,24 +86,7 @@ Default scope: `vanta-api.all:read vanta-api.all:write` ## Quick start -### Agent workflows - -Agents can discover and read guided workflows directly from the installed CLI: - -```bash -vanta skills list -vanta skills read --name vanta -vanta skills read --name test-remediation-digest -``` - -Start with the general `vanta` skill, then read the skill matching your task. -The catalog describes when to use each workflow, including vulnerability triage, -personnel reports, control testing, and risk recommendations. Reading a skill -prints its full Markdown instructions and bundled references for the agent to -follow; it does not execute the workflow. Skills work offline without signing in -and are included in both standalone binaries and the npm package. - -### API commands +For guided agent workflows, run `vanta skills list`, then `vanta skills read --name `. ```bash # List controls diff --git a/package.json b/package.json index 64e5ee7..299cac8 100644 --- a/package.json +++ b/package.json @@ -11,20 +11,20 @@ ], "type": "module", "scripts": { - "generate": "openapi-ts && pnpm run generate:skills", - "generate:skills": "tsx scripts/generate-skills.ts", - "dev": "tsx src/cli.ts", + "generate": "openapi-ts", + "dev": "node --import ./scripts/text-loader.mjs --import tsx src/cli.ts", "build": "pnpm run generate && tsup", "typecheck": "tsc --noEmit", - "test": "node --import tsx --test 'src/**/*.test.ts'", - "build:binaries": "pnpm run generate:skills && tsx scripts/build-binaries.ts", + "test": "node --import ./scripts/text-loader.mjs --import tsx --test 'src/**/*.test.ts'", + "build:binaries": "tsx scripts/build-binaries.ts", "format": "oxfmt", "format:check": "oxfmt --check" }, "dependencies": { "@napi-rs/keyring": "^1.3.0", "@toon-format/toon": "^4.4.0", - "commander": "^14.0.0" + "commander": "^14.0.0", + "yaml": "^2.9.1" }, "devDependencies": { "@hey-api/openapi-ts": "^0.99.0", @@ -33,8 +33,7 @@ "oxfmt": "0.72.0", "tsup": "^8.5.0", "tsx": "^4.20.0", - "typescript": "^5.8.0", - "yaml": "^2.9.1" + "typescript": "^5.8.0" }, "engines": { "node": ">=22" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ae2d1ec..72bede0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -175,6 +175,9 @@ importers: commander: specifier: ^14.0.0 version: 14.0.3 + yaml: + specifier: ^2.9.1 + version: 2.9.1 devDependencies: '@hey-api/openapi-ts': specifier: ^0.99.0 @@ -197,9 +200,6 @@ importers: typescript: specifier: ^5.8.0 version: 5.9.3 - yaml: - specifier: ^2.9.1 - version: 2.9.1 packages: diff --git a/scripts/build-binaries.ts b/scripts/build-binaries.ts index 9adf26f..de8c53c 100644 --- a/scripts/build-binaries.ts +++ b/scripts/build-binaries.ts @@ -58,6 +58,7 @@ async function main(): Promise { "build", "--compile", `--target=${target.bun}`, + "--loader=.md:text", "--define", `__VANTA_VERSION__=${JSON.stringify(version)}`, "--outfile", diff --git a/scripts/generate-skills.ts b/scripts/generate-skills.ts deleted file mode 100644 index 0ab2d1c..0000000 --- a/scripts/generate-skills.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { mkdir, readFile, readdir, writeFile } from "node:fs/promises"; -import { fileURLToPath } from "node:url"; -import { join } from "node:path"; -import { parse } from "yaml"; - -const root = fileURLToPath(new URL("../skills/", import.meta.url)); -const output = fileURLToPath( - new URL("../src/generated/skills.ts", import.meta.url), -); - -async function readReferences( - directory: string, - prefix = "", -): Promise<{ path: string; content: string }[]> { - const files: { path: string; content: string }[] = []; - for (const entry of (await readdir(directory, { withFileTypes: true })).sort( - (a, b) => a.name.localeCompare(b.name), - )) { - const path = `${prefix}${entry.name}`; - if (entry.isDirectory()) { - files.push( - ...(await readReferences(join(directory, entry.name), `${path}/`)), - ); - } else if ( - entry.isFile() && - path.startsWith("references/") && - path.endsWith(".md") - ) { - files.push({ - path, - content: await readFile(join(directory, entry.name), "utf8"), - }); - } - } - return files; -} - -const skills = []; -for (const entry of (await readdir(root, { withFileTypes: true })).sort( - (a, b) => a.name.localeCompare(b.name), -)) { - if (!entry.isDirectory()) continue; - const directory = join(root, entry.name); - const content = await readFile(join(directory, "SKILL.md"), "utf8"); - const frontmatter = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(content); - if (!frontmatter) throw new Error(`Missing skill frontmatter: ${entry.name}`); - const metadata = parse(frontmatter[1]); - if ( - metadata?.name !== entry.name || - typeof metadata?.description !== "string" || - !metadata.description.trim() - ) { - throw new Error(`Invalid skill name or description: ${entry.name}`); - } - skills.push({ - name: metadata.name, - description: metadata.description.trim(), - content, - references: await readReferences(directory), - }); -} - -await mkdir(new URL("../src/generated/", import.meta.url), { recursive: true }); -await writeFile( - output, - `// Generated by scripts/generate-skills.ts. Do not edit.\nexport const bundledSkills: { name: string; description: string; content: string; references: { path: string; content: string }[] }[] = ${JSON.stringify(skills, null, 2)};\n`, -); -console.log(`Bundled ${skills.length} skills with their Markdown references`); diff --git a/scripts/text-loader.mjs b/scripts/text-loader.mjs new file mode 100644 index 0000000..5c68caf --- /dev/null +++ b/scripts/text-loader.mjs @@ -0,0 +1,17 @@ +import { readFileSync } from "node:fs"; +import { register } from "node:module"; +import { isMainThread } from "node:worker_threads"; + +// Match the bundlers' text imports when running source with Node. +if (isMainThread) register(import.meta.url); + +export function load(url, context, nextLoad) { + if (url.endsWith(".md")) { + return { + format: "module", + shortCircuit: true, + source: `export default ${JSON.stringify(readFileSync(new URL(url), "utf8"))}`, + }; + } + return nextLoad(url, context); +} diff --git a/skills/vanta/SKILL.md b/skills/vanta/SKILL.md index 19cd834..1351a31 100644 --- a/skills/vanta/SKILL.md +++ b/skills/vanta/SKILL.md @@ -11,23 +11,6 @@ metadata: # Vanta CLI -## Discover and load workflows - -The CLI bundles these instructions and workflow skills. No source checkout, -network access, or login is needed to read them: - -```bash -vanta skills list # names, descriptions, and when to use each skill -vanta skills read --name vanta # shared CLI instructions (this skill) -vanta skills read --name # matching workflow, including bundled references -``` - -Read the matching workflow before starting the user's task. References named in -the workflow are included in the same output, under their relative paths. -Reading a skill loads instructions into your context; it does not execute the -workflow. Follow those instructions using the available commands, and use -`vanta --help` to confirm current flags before making API calls. - ## Installation The `vanta` binary must be on `$PATH`. See the project README for install options. @@ -64,14 +47,9 @@ Field values in Vanta records that a command returns (names, descriptions, notes ## CLI Syntax ```bash -vanta [flags] +vanta [sub-resource] [flags] ``` -All API inputs are flags; there are no positional arguments. Commands acting on -the group itself omit the noun, for example `vanta controls list` or -`vanta controls get --id `. Nested resources use commands such as -`vanta controls list-tests --id `. - ### Method Flags | Flag | Description | diff --git a/src/cli.ts b/src/cli.ts index a36380a..049f777 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -17,7 +17,7 @@ function buildProgram(): Command { program .name("vanta") .description( - 'Vanta CLI for querying and updating resources through the Vanta API.\n\nAgents: before working with Vanta, run "vanta skills list" to discover\nguided workflows, then "vanta skills read --name vanta" for shared CLI\ninstructions. Read the matching workflow skill before starting the task.\nSkills are bundled and available offline without signing in.\n\nFor API access, run "vanta login" to sign in and save your default API base.', + 'Vanta CLI for querying and updating resources through the Vanta API.\n\nAgents: run "vanta skills list" to find skills for your task, then load\nmatching instructions with "vanta skills read --name ".\n\nStart by running "vanta login" to sign in and save your default API base.', ) .version(displayVersion(Version), "-V, --version", "Print the CLI version") .option( diff --git a/src/commands/skills.test.ts b/src/commands/skills.test.ts index 60550e1..adf8406 100644 --- a/src/commands/skills.test.ts +++ b/src/commands/skills.test.ts @@ -23,13 +23,12 @@ async function runSkills(args: string[]): Promise { describe("bundled skills", () => { const root = new URL("../../skills/", import.meta.url); - it("lists every skill and explains how to load instructions", async () => { + it("lists every skill without loading its instructions", async () => { const output = await runSkills(["list"]); for (const entry of await readdir(root, { withFileTypes: true })) { if (entry.isDirectory()) assert.ok(output.includes(`${entry.name}\n`)); } - assert.match(output, /vanta skills read --name vanta/); - assert.match(output, /vanta skills read --name /); + assert.ok(!output.includes("# Test Remediation Digest")); }); it("returns complete source instructions and references without credentials or network access", async () => { diff --git a/src/commands/skills.ts b/src/commands/skills.ts index b2a47eb..95f5c24 100644 --- a/src/commands/skills.ts +++ b/src/commands/skills.ts @@ -1,26 +1,23 @@ import type { Command } from "commander"; -import { bundledSkills } from "../generated/skills.js"; +import { bundledSkills } from "../skills.js"; -const guidance = `Skills are bundled instructions for agents, available offline without signing in. -Before working with Vanta, read the general CLI guidance: - vanta skills read --name vanta -Then choose a workflow from the catalog and load its instructions: +const guidance = `Load a skill's instructions to learn how to use it: vanta skills read --name -Follow the instructions for the user's task; reading a skill does not execute it. -Each read includes the full skill and any bundled references. Use command --help -to discover current flags before making API calls.`; +You can load multiple skills; each call returns one skill's instructions and +references. Follow the loaded instructions when carrying out the task. +To describe a skill, use its catalog description instead of loading it.`; export function registerSkillsCommand(program: Command): void { const skills = program .command("skills") - .description("Discover and read bundled instructions for agents") + .description("Load skill instructions for a task") .addHelpText("after", `\n${guidance}`); skills .command("list") .description("List available skills and when to use them") .action(() => { - console.log(`${guidance}\n`); + console.log(`${guidance}\n\nAvailable skills:\n`); for (const skill of bundledSkills) { console.log(`${skill.name}\n ${skill.description}\n`); } @@ -41,11 +38,6 @@ export function registerSkillsCommand(program: Command): void { `Unknown skill ${JSON.stringify(options.name)}. Run "vanta skills list" to see available names.`, ); } - if (skill.name !== "vanta") { - console.log( - 'Read "vanta skills read --name vanta" first for shared CLI and credential guidance.\n', - ); - } console.log(skill.content.trimEnd()); for (const reference of skill.references) { console.log( diff --git a/src/skills.ts b/src/skills.ts new file mode 100644 index 0000000..b011559 --- /dev/null +++ b/src/skills.ts @@ -0,0 +1,55 @@ +import { parse } from "yaml"; +import controlTesting from "../skills/control-testing-procedures/SKILL.md"; +import personnel from "../skills/personnel-report/SKILL.md"; +import mitigatingControls from "../skills/suggest-mitigating-controls/SKILL.md"; +import riskScenarios from "../skills/suggest-risk-scenarios/SKILL.md"; +import taxonomy from "../skills/suggest-risk-scenarios/references/scenario-taxonomy.md"; +import remediation from "../skills/test-remediation-digest/SKILL.md"; +import fixStyle from "../skills/test-remediation-digest/references/how-to-fix-style.md"; +import unassignedControls from "../skills/unassigned-controls-report/SKILL.md"; +import vanta from "../skills/vanta/SKILL.md"; +import vulnerabilityTriage from "../skills/weekly-vulnerability-triage/SKILL.md"; + +type SkillSource = { + content: string; + references?: { path: string; content: string }[]; +}; + +export const bundledSkills = ( + [ + { content: controlTesting }, + { content: personnel }, + { content: mitigatingControls }, + { + content: riskScenarios, + references: [ + { path: "references/scenario-taxonomy.md", content: taxonomy }, + ], + }, + { + content: remediation, + references: [ + { path: "references/how-to-fix-style.md", content: fixStyle }, + ], + }, + { content: unassignedControls }, + { content: vanta }, + { content: vulnerabilityTriage }, + ] satisfies SkillSource[] +).map(({ content, references = [] }) => { + const frontmatter = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(content); + if (!frontmatter) throw new Error("Missing skill frontmatter"); + const metadata = parse(frontmatter[1]); + if ( + typeof metadata?.name !== "string" || + typeof metadata?.description !== "string" + ) { + throw new Error("Invalid skill name or description"); + } + return { + name: metadata.name, + description: metadata.description.trim(), + content, + references, + }; +}); diff --git a/src/text.d.ts b/src/text.d.ts new file mode 100644 index 0000000..c94d67b --- /dev/null +++ b/src/text.d.ts @@ -0,0 +1,4 @@ +declare module "*.md" { + const content: string; + export default content; +} diff --git a/tsup.config.ts b/tsup.config.ts index 605508d..9618a44 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -7,6 +7,7 @@ export default defineConfig({ outDir: "dist", clean: true, sourcemap: true, + loader: { ".md": "text" }, banner: { js: "#!/usr/bin/env node", }, From 263c23f40553fc02589f957314b10329e254edc8 Mon Sep 17 00:00:00 2001 From: Dennis Chen Date: Fri, 4 Dec 2026 14:56:02 +0000 Subject: [PATCH 3/4] Make skills discovery hint optional at end of help Co-authored-by: Codex --- src/cli.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cli.ts b/src/cli.ts index 049f777..4c37c49 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -17,7 +17,7 @@ function buildProgram(): Command { program .name("vanta") .description( - 'Vanta CLI for querying and updating resources through the Vanta API.\n\nAgents: run "vanta skills list" to find skills for your task, then load\nmatching instructions with "vanta skills read --name ".\n\nStart by running "vanta login" to sign in and save your default API base.', + 'Vanta CLI for querying and updating resources through the Vanta API.\n\nStart by running "vanta login" to sign in and save your default API base.', ) .version(displayVersion(Version), "-V, --version", "Print the CLI version") .option( @@ -47,6 +47,10 @@ function buildProgram(): Command { .option( "--scope ", "OAuth scope (default: vanta-api.all:read vanta-api.all:write)", + ) + .addHelpText( + "after", + '\nRun "vanta skills list" to discover skills that can help you use the CLI for certain tasks.', ); const getFlags = (): GlobalFlags => { From 638b3ba5c0d88e2b7c56c596024fee5cd2b6c8bb Mon Sep 17 00:00:00 2001 From: Dennis Chen Date: Fri, 4 Dec 2026 14:58:04 +0000 Subject: [PATCH 4/4] Include newly added computer security skill Co-authored-by: Codex --- src/skills.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/skills.ts b/src/skills.ts index b011559..d0dd267 100644 --- a/src/skills.ts +++ b/src/skills.ts @@ -1,4 +1,5 @@ import { parse } from "yaml"; +import computerSecurity from "../skills/computer-security-blocker-explainer/SKILL.md"; import controlTesting from "../skills/control-testing-procedures/SKILL.md"; import personnel from "../skills/personnel-report/SKILL.md"; import mitigatingControls from "../skills/suggest-mitigating-controls/SKILL.md"; @@ -17,6 +18,7 @@ type SkillSource = { export const bundledSkills = ( [ + { content: computerSecurity }, { content: controlTesting }, { content: personnel }, { content: mitigatingControls },