diff --git a/.agents/skills/blind-llm-agents/SKILL.md b/.agents/skills/blind-llm-agents/SKILL.md index 998e287..34a3a50 100644 --- a/.agents/skills/blind-llm-agents/SKILL.md +++ b/.agents/skills/blind-llm-agents/SKILL.md @@ -1,56 +1,142 @@ --- name: blind-llm-agents -description: Audit, protect, and verify software artifacts (JavaScript/TypeScript, Electron ASAR, WebAssembly, Python .py/.pyc, SQLite, Safetensors/GGUF AI Models, Android DEX/IL2CPP, Apple plist, .NET, JVM, ZIP/APK, and Native ELF/Mach-O/PE Binaries) against AI reverse-engineering agents like REA using BLA (Blind LLM Agents). Default verb: bla_harden. +description: > + Use when hardening, defending, or auditing software against AI reverse-engineering + agents (REA / WorkBuddy-class): one-click project harden, weave-decoy structural + decoys, Counter-REA audit/protect/verify, or agent setup/doctor for BLA (Blind LLM + Agents). Prefer this skill as the guide; call existing MCP tools / CLI — do not invent + new MCP tools. Default verb: bla_harden. Refuse crack/RE of third-party software. metadata: - version: "1.2.0" + version: "1.3.0" --- # BLA: Blind LLM Agents -Use BLA whenever the user asks to harden a project against AI reverse-engineering agents (`morluto/rea`), audit exposure, exhaust attacker token/compute budgets, or induce model misjudgment on proprietary logic. +**This skill is the primary one-click harden GUIDE.** MCP (`bla` server) and the +`bla-agents` CLI are the **execution layer**. Prefer teaching/calling existing tools +(`bla_harden`, `bla_defend`, `bla_weave_plan`, …) over inventing new MCP surfaces. + +Use BLA whenever the user asks to harden a project against AI reverse-engineering +agents (`morluto/rea`), audit exposure, exhaust attacker token/compute budgets, induce +model misjudgment on proprietary logic, or **one-click / 一键加固** a build. + +Defensive only: protect **their own** artifacts. Refuse crack, RE, bypass PoCs, or +attack playbooks against software they do not own. + +## Prerequisites (once) + +If MCP/skill are not registered yet: + +1. CLI: `npx bla-agents@latest setup` +2. Then: `npx bla-agents@latest doctor` (or MCP `bla_doctor`) + +After setup, agents load this skill and can call the `bla` MCP tools. ## ⚡ One-Sentence Hardening (DEFAULT — prefer this) -When the user says **"Harden my software"**, **"Harden this project against REA"**, **"一键启动防御强化"**, **"Run BLA defense"**, or any equivalent one-liner **without naming a specific file**, invoke: +When the user says **"Harden my software"**, **"Harden this project against REA"**, +**"一键启动防御强化"**, **"一键加固"**, **"Run BLA defense"**, or any equivalent +one-liner **without naming a specific file**, invoke: -- **MCP Tool (preferred)**: `bla_harden` with `{ "directory": "." }` (or the project/build path they named) -- **CLI**: `npx bla-agents@latest harden .` -- **MCP Prompt**: `bla-harden-project` +| Surface | Call | +| :--- | :--- | +| **MCP Tool (preferred)** | `bla_harden` with `{ "directory": "." }` (or the project/build path they named) | +| **CLI** | `npx bla-agents@latest harden .` | +| **MCP Prompt** | `bla-harden-project` | -`bla_harden` / `bla harden` auto-discovers protectable build outputs under `dist/`, `build/`, `out/`, `release/`, `.asar`, native binaries, `.wasm`, `.py`/`.pyc`, `.sqlite`, `.safetensors`/`.gguf`, `.dex`, `.class`, `.dll`, Apple plists, ZIP/APK, etc., detects each artifact's format, and runs the full **audit → defend (bankrupt) → verify** pipeline on all of them. Return the per-artifact summary to the user. Do **not** ask which files to protect — discover them. +`bla_harden` / `bla harden` auto-discovers protectable build outputs under `dist/`, +`build/`, `out/`, `release/`, `.asar`, native binaries, `.wasm`, `.py`/`.pyc`, +`.sqlite`, `.safetensors`/`.gguf`, `.dex`, `.class`, `.dll`, Apple plists, ZIP/APK, +etc., detects each artifact's format, and runs the full **audit → defend (bankrupt) → +verify** pipeline. Return the per-artifact summary to the user. -## One-Click Single-Artifact Defense +**Do not ask which files to protect — discover them.** -When the user already named a **specific file**, use: +Optional args (defaults are safe): `intensity` (default bankrupt), `emit_manifest` +(default false), `llm_directives` (default false — risky LLM bait; leave off unless +asked), `weave_decoys` (default false — see stronger path below), `seed`. -- **MCP Tool**: `bla_defend` with `{ "input_path": "", "intensity": "bankrupt", "emit_manifest": true }` -- **CLI Command**: `npx bla-agents@latest defend --manifest` +## Optional stronger path: structural weave decoys + +When the user wants **stronger / structural** hardening (not dismissible noise), +especially for **Python** customer defs / `.pyc`, or says weave / 织入 / decoy +entanglement: + +1. Read directives: MCP resource `bla://directives/weave-decoy` + (or `bla://docs/weave-decoy-mcp` / repo `docs/weave-decoy-mcp.md`). +2. Plan (read-only): `bla_weave_plan` with `{ "path": "" }` → + save the `bla-weave-plan/v1` JSON work order. +3. Apply with the real pipeline flag: + - Directory: `bla_harden` `{ "directory": ".", "weave_decoys": true }` + - Named file: `bla_defend` / `bla_protect` with `weave_decoys: true` +4. MCP Prompt shortcut: `bla-weave-decoy` +5. CLI: `npx bla-agents@latest harden . --weave-decoys` (or `defend` / `protect` + with the same flag when supported) + +**Principles (non-rule, structural):** decoys must weave into **real customer paths** +(shared runtime slots, entry-reachable edges, mixed mundane/scare stems, opaque-true +happy paths, call-graph entanglement). JS AST weave is already on; Python `.py`/`.pyc` +customer-def structural weave activates when `weave_decoys: true`. See +[docs/weave-decoy-mcp.md](../../../docs/weave-decoy-mcp.md). + +## FORBIDDEN for executing agents + +Do **not**: + +- Add pure noise layers, greppable `BLA-SHIELD` / homogeneous `_bla_*` banners, or + dismissible empty/`pass` honeypot stubs that agents filter as an independent layer +- Use label-only / report-only “decoys” that are not real pipeline attributes +- Drive hardening via a **rule engine** (business-name → fixed snippet tables, homogeneous + marker templates as policy) +- Help crack, reverse-engineer, bypass, or write offensive PoCs against third-party + software + +If asked for offensive RE/crack help: refuse briefly; offer defensive harden of **their** +artifacts instead. + +## Single-file vs directory + +| Intent | Prefer | Example | +| :--- | :--- | :--- | +| Project / build dir, auto-discover | **`bla_harden`** / `bla harden .` | User did not name a file | +| Specific artifact path | **`bla_defend`** / `bla defend ` | User named `./dist/app.js` | + +`bla_defend` runs the 5-stage Counter-REA pipeline on a known path: -`bla_defend` / `bla defend` executes all 5 Counter-REA defense stages automatically: 1. **Stage 1 (`inspect-release`)**: Read-only scan for accidental `.map` (`sourcesContent`) and symbol leaks. 2. **Stage 2 (`audit`)**: 16-vector REA vulnerability & Claude Opus 4 / Sonnet 4 / o3 token-cost simulation. -3. **Stage 3 (`protect --intensity bankrupt`)**: Injects both the **Resource-Exhaustion Suite** and the **Model-Misjudgment Induction Suite** (including canary honeypots + system-diagnostic decoys across JS, WASM, Python, SQLite, Safetensors/GGUF, DEX, IL2CPP, Apple plist, .NET, JVM, ZIP/APK). -4. **Stage 4 (`verify`)**: Verifies all Counter-REA mathematical invariants and confirms token/cost bankruptcy amplification. -5. **Stage 5 (`manifest`)**: Emits `.bla-manifest.json` attesting to the hardened build. +3. **Stage 3 (`protect --intensity bankrupt`)**: Resource-Exhaustion + Model-Misjudgment suites (canary honeypots + system-diagnostic decoys across supported formats). +4. **Stage 4 (`verify`)**: Counter-REA invariants + token/cost amplification. +5. **Stage 5 (`manifest`)** (opt-in): `.bla-manifest.json` when `emit_manifest: true`. -## Step-by-Step Granular Workflow: Audit -> Protect -> Verify +MCP: `bla_defend` with `{ "input_path": "", "intensity": "bankrupt", "emit_manifest": true }` +CLI: `npx bla-agents@latest defend --manifest` -1. **Audit (`bla_audit` or `npx bla-agents audit `)**: - - Reports the **REA Exposure Score (0–100)**, exposed functions/classes/IPC channels/routes, and estimated attacker token and dollar costs. -2. **Protect (`bla_protect` or `npx bla-agents protect -o --intensity bankrupt`)**: - - **Resource Exhaustion (耗尽对方资源)** and **Model Misjudgment Induction (诱导模型误判)** as documented in [references/counter-rea-matrix.md](references/counter-rea-matrix.md). -3. **Verify (`bla_verify` or `npx bla-agents verify [original]`)**: - - Confirms that all Counter-REA gates pass and reports exact Token & API Cost Amplification. +## Step-by-step granular workflow -## CLI Fallback Commands +1. **Audit** — `bla_audit` / `npx bla-agents audit `: REA Exposure Score, exposed surfaces, estimated attacker cost. +2. **Protect** — `bla_protect` / `npx bla-agents protect -o --intensity bankrupt` (+ optional `--weave-decoys`). +3. **Verify** — `bla_verify` / `npx bla-agents verify [original]`. + +Map REA analyzers → BLA counters: +[references/counter-rea-matrix.md](references/counter-rea-matrix.md). + +## CLI fallbacks ```bash +npx -y bla-agents@latest setup +npx -y bla-agents@latest doctor npx -y bla-agents@latest harden . +npx -y bla-agents@latest harden . --weave-decoys npx -y bla-agents@latest defend /absolute/path/to/target --manifest --json npx -y bla-agents@latest audit /absolute/path/to/target --json npx -y bla-agents@latest protect /absolute/path/to/target -o /absolute/path/to/protected --intensity bankrupt --json npx -y bla-agents@latest verify /absolute/path/to/protected /absolute/path/to/target --json -npx -y bla-agents@latest doctor ``` -See [references/counter-rea-matrix.md](references/counter-rea-matrix.md) for the complete mapping between REA's internal analyzers and BLA's countermeasures. +## References + +- [references/counter-rea-matrix.md](references/counter-rea-matrix.md) — REA ↔ BLA countermeasures +- [docs/one-click-agent-defense.md](../../../docs/one-click-agent-defense.md) — one-click UX (skill-first) +- [docs/cli-and-mcp.md](../../../docs/cli-and-mcp.md) — CLI / MCP parameter index +- [docs/weave-decoy-mcp.md](../../../docs/weave-decoy-mcp.md) — weave-decoy theory + MCP checklist diff --git a/CHANGELOG.md b/CHANGELOG.md index fd1beaa..a7c7dcc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- **`blind-llm-agents` skill → v1.3.0**: skill is the primary one-click harden GUIDE + (MCP/CLI remain the execution layer). Documents default `bla_harden` / `harden .`, + optional weave path (`bla://directives/weave-decoy` → `bla_weave_plan` → + `weave_decoys:true`), FORBIDDEN noise/crack patterns, single-file `bla_defend` vs + directory `bla_harden`, and links to weave + Counter-REA docs. Synced + [`docs/one-click-agent-defense.md`](docs/one-click-agent-defense.md), + [`docs/cli-and-mcp.md`](docs/cli-and-mcp.md), and README skill pointers. +- **CLI `--weave-decoys`**: opt-in flag on `harden` / `defend` / `protect`, matching + MCP `weave_decoys` (structural Python customer-def / `.pyc` weave; JS AST weave + already on). + ### Added - **Weave-decoy MCP surface** (`src/shields/weave/weave-decoy.ts`, `src/mcp/server.ts`): diff --git a/README.md b/README.md index bcb9989..8c722c9 100644 --- a/README.md +++ b/README.md @@ -71,13 +71,13 @@ npx bla-agents harden . # one-command Counter-REA pass on the current proj npx bla-agents benchmark # 14-target showcase (local estimates + runtime checks) ``` -Ask your agent after setup: +Ask your agent after setup (skill guides one-click harden): ```text Harden my software against REA ``` -Or run stages explicitly: `audit` · `protect` · `verify` · `defend` — see [CLI and MCP](docs/cli-and-mcp.md). +Or run stages explicitly: `audit` · `protect` · `verify` · `defend` — see [one-click agent defense](docs/one-click-agent-defense.md) and [CLI and MCP](docs/cli-and-mcp.md). --- @@ -201,7 +201,7 @@ Protections are format-native (no commercial packer / external LLVM required). R
Which agents can use BLA? -Any coding agent with local MCP or `SKILL.md` workflows. `npx bla-agents setup` configures Claude Code, Cursor, Codex, Gemini CLI, Windsurf, Google Antigravity, OpenCode, VS Code, and GitHub Copilot CLI. +Any coding agent with local MCP or `SKILL.md` workflows. `npx bla-agents setup` configures Claude Code, Cursor, Codex, Gemini CLI, Windsurf, Google Antigravity, OpenCode, VS Code, and GitHub Copilot CLI. After setup, the bundled [`blind-llm-agents` skill](.agents/skills/blind-llm-agents/SKILL.md) is the one-click harden guide (`bla_harden` / `bla harden .`); MCP stays the execution layer.
@@ -227,7 +227,10 @@ No. See [DISCLAIMER.md](DISCLAIMER.md). Protective payloads activate under rever - [DISCLAIMER.md](DISCLAIMER.md) — defensive use, own-software only - [Installation and agent setup](docs/installation.md) - [CLI and MCP contracts](docs/cli-and-mcp.md) +- [One-click agent defense (skill-first)](docs/one-click-agent-defense.md) +- [Weave-decoy MCP](docs/weave-decoy-mcp.md) - [Empirical REA validation](docs/redteam/empirical-rea-validation.md) +- [`blind-llm-agents` skill](.agents/skills/blind-llm-agents/SKILL.md) - [Counter-REA matrix](.agents/skills/blind-llm-agents/references/counter-rea-matrix.md) - [v1.4.0 release notes (staged)](docs/releases/v1.4.0.md) - [CHANGELOG](CHANGELOG.md) diff --git a/docs/cli-and-mcp.md b/docs/cli-and-mcp.md index f53b25f..bd409a3 100644 --- a/docs/cli-and-mcp.md +++ b/docs/cli-and-mcp.md @@ -1,15 +1,18 @@ # CLI & MCP Reference (`bla-agents`) +For coding agents, the **[`blind-llm-agents` skill](../.agents/skills/blind-llm-agents/SKILL.md)** is the primary one-click harden guide; this page indexes the CLI/MCP execution surface. + ## CLI Commands | Command | Description | | :--- | :--- | | `npx bla-agents setup` | Auto-registers the `bla` MCP server and `blind-llm-agents` skill with Claude Code, Cursor, Codex, Windsurf, Gemini CLI, and Antigravity. | -| `npx bla-agents harden .` | **Default one-command UX**: auto-discover build outputs and run audit → protect → verify (bankrupt). Prefer over `defend` when you have a project directory. | -| `npx bla-agents defend [--manifest] [--llm-directives]` | **5-stage pipeline** on a known path: `inspect-release` → `audit` → `protect` → `verify` → optional **unsigned** `.bla-manifest.json` (opt-in). Risky LLM directive layers stay off unless `--llm-directives`. | +| `npx bla-agents harden .` | **Default one-command UX**: auto-discover build outputs and run audit → protect → verify (bankrupt). Prefer over `defend` when you have a project directory. Agent guide: [`blind-llm-agents` skill](../.agents/skills/blind-llm-agents/SKILL.md). | +| `npx bla-agents defend [--manifest] [--llm-directives] [--weave-decoys]` | **5-stage pipeline** on a known path: `inspect-release` → `audit` → `protect` → `verify` → optional **unsigned** `.bla-manifest.json` (opt-in). Risky LLM directive layers stay off unless `--llm-directives`. Structural weave decoys stay off unless `--weave-decoys`. | +| `npx bla-agents harden . [--weave-decoys]` | Same as `harden` with opt-in structural weave (`weave_decoys`). | | `npx bla-agents inspect-release ` | Read-only local scan for embedded `.map` (`sourcesContent`) and sourceMappingURL references. | | `npx bla-agents audit ` | Pre-flight 16-vector REA vulnerability & token-cost audit. | -| `npx bla-agents protect [-o ]` | Injects BLA's Resource-Exhaustion and Model-Misjudgment shield (`stealth`, `balanced`, `maximum`, `bankrupt`). | +| `npx bla-agents protect [-o ] [--weave-decoys]` | Injects BLA's Resource-Exhaustion and Model-Misjudgment shield (`stealth`, `balanced`, `maximum`, `bankrupt`). Opt-in `--weave-decoys` for structural Python customer-def weave. | | `npx bla-agents verify [original]` | Verifies Counter-REA invariants and calculates token/cost amplification. | | `npx bla-agents benchmark` | Runs the 8-target Counter-REA Showcase Benchmark suite. | | `npx bla-agents emit-headers --lang ` | Emits compile-time native defense headers (`bla_shield.h`, `bla_shield.rs`, `bla_shield.go`). | diff --git a/docs/one-click-agent-defense.md b/docs/one-click-agent-defense.md index 0327e9c..6dabb56 100644 --- a/docs/one-click-agent-defense.md +++ b/docs/one-click-agent-defense.md @@ -1,25 +1,70 @@ -# One-Click Agent Defense Hardening (`bla defend` / `bla_defend`) +# One-Click Agent Defense Hardening (skill-first) -Once BLA is registered with your coding agent (`npx bla-agents@latest setup`), you can trigger the entire 5-stage Counter-REA defense pipeline with a single command or natural-language prompt. +Once BLA is registered with your coding agent (`npx bla-agents@latest setup`), the +bundled **`blind-llm-agents` skill** is the primary guide for one-click hardening. +MCP tools and the CLI are the execution layer — prefer calling existing tools from +the skill rather than inventing new MCP surfaces. -## One-Click CLI Usage +Skill source: [`.agents/skills/blind-llm-agents/SKILL.md`](../.agents/skills/blind-llm-agents/SKILL.md) +(metadata.version tracks the skill guide; package version is independent). + +## Default: one-sentence project harden + +Tell Claude Code, Cursor, Codex, Windsurf, Gemini CLI, OpenCode, or similar: + +```text +Harden my software against REA +``` + +(or Chinese equivalents such as `一键加固` / `一键启动防御强化`) + +The agent should invoke: + +| Surface | Call | +| :--- | :--- | +| **MCP (preferred)** | `bla_harden` with `{ "directory": "." }` | +| **CLI** | `npx bla-agents@latest harden .` | +| **MCP Prompt** | `bla-harden-project` | + +`bla_harden` / `bla harden` **auto-discovers** protectable build outputs (`dist/`, +`build/`, `out/`, `release/`, `.asar`, native binaries, `.wasm`, `.py`/`.pyc`, +`.sqlite`, models, DEX, …) and runs **audit → defend (bankrupt) → verify**. +Agents must **not** ask which files to protect. + +## Named single artifact + +When a specific file is already known: ```bash npx bla-agents@latest defend ./dist/app.js --manifest ``` -## One-Click Agent Prompt - -After running `npx bla-agents@latest setup`, tell Claude Code, Cursor, Codex, Windsurf, Gemini CLI, or OpenCode: - ```text -Run bla_defend on ./dist with bankrupt intensity and emit a defense manifest. +Run bla_defend on ./dist/app.js with bankrupt intensity and emit a defense manifest. ``` -## What `bla defend` Executes Automatically +## Optional stronger path: structural weave decoys + +For structural (non-noise) decoy entanglement — especially Python customer defs / +`.pyc` — follow the skill’s weave path: + +1. Read `bla://directives/weave-decoy` +2. Call `bla_weave_plan` on the project/artifact +3. Re-run `bla_harden` / `bla_defend` / `bla_protect` with **`weave_decoys: true`** + (CLI: `--weave-decoys`) + +See [`weave-decoy-mcp.md`](./weave-decoy-mcp.md). Do **not** add dismissible +`_bla_*` banners, empty honeypot stubs, or rule-based name→snippet noise layers. + +## What the pipeline executes 1. **Stage 1 (`inspect-release`)**: Read-only scan for accidental `.map` (`sourcesContent`) and symbol leaks. 2. **Stage 2 (`audit`)**: 16-vector REA vulnerability & Claude Opus 4 / Sonnet 4 / o3 token-cost simulation. 3. **Stage 3 (`protect --intensity bankrupt`)**: Injects both the **Resource-Exhaustion Suite** and the **Model-Misjudgment Induction Suite**. 4. **Stage 4 (`verify`)**: Verifies all Counter-REA mathematical invariants and confirms `16x–51x` token/cost bankruptcy amplification. -5. **Stage 5 (`manifest`)**: Emits `.bla-manifest.json` attesting to the hardened build. +5. **Stage 5 (`manifest`)** (opt-in): Emits `.bla-manifest.json` attesting to the hardened build. + +## Related + +- [CLI and MCP](./cli-and-mcp.md) +- [Counter-REA matrix](../.agents/skills/blind-llm-agents/references/counter-rea-matrix.md) diff --git a/src/cli.ts b/src/cli.ts index 40cc0f3..fb9b5b6 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -67,6 +67,7 @@ Options: --seed Deterministic PRNG seed (default: per-project random in .blarc) --manifest Emit unsigned .bla-manifest.json next to protected artifacts (opt-in) --llm-directives Opt-in risky LLM directive layers (COPPA/medical bait, dual-use imitation, AI chat markers); OFF by default + --weave-decoys Opt-in structural weave decoys (Python customer-def / .pyc co_consts weave; JS AST weave already on); OFF by default --lang Target language for emit-headers (default: c) --client Agent client ID for setup (repeatable: claude_code, cursor, codex, etc.) --all-detected Configure all detected coding agents on this machine @@ -88,6 +89,7 @@ interface ParsedCliArgs { readonly seed?: string; readonly manifest: boolean; readonly llmDirectives: boolean; + readonly weaveDecoys: boolean; readonly lang: NativeHeaderLanguage; readonly clients: SupportedAgentClientId[]; readonly allDetected: boolean; @@ -111,6 +113,7 @@ export function parseCliArgs(argv: readonly string[]): ParsedCliArgs { let seed: string | undefined; let manifest = false; let llmDirectives = false; + let weaveDecoys = false; let lang: NativeHeaderLanguage = "c"; const clients: SupportedAgentClientId[] = []; let allDetected = false; @@ -147,6 +150,8 @@ export function parseCliArgs(argv: readonly string[]): ParsedCliArgs { manifest = true; } else if (arg === "--llm-directives") { llmDirectives = true; + } else if (arg === "--weave-decoys") { + weaveDecoys = true; } else if (arg === "--mcp") { command = "mcp"; } else if (arg === "--update") { @@ -188,6 +193,7 @@ export function parseCliArgs(argv: readonly string[]): ParsedCliArgs { ...(seed !== undefined ? { seed } : {}), manifest, llmDirectives, + weaveDecoys, lang, clients, allDetected, @@ -307,6 +313,7 @@ export async function runCli(argv: readonly string[] = process.argv.slice(2)): P seed: resolved.seed, emitManifest: parsed.manifest || loaded.config.emitManifest === true, llmDirectives: parsed.llmDirectives || loaded.config.llmDirectives === true, + weaveDecoys: parsed.weaveDecoys, ...(parsed.output !== undefined ? { outputDirectory: parsed.output } : {}), }); if (parsed.json) { @@ -338,6 +345,7 @@ export async function runCli(argv: readonly string[] = process.argv.slice(2)): P seed: resolved.seed, emitManifest: parsed.manifest || loaded.config.emitManifest === true, llmDirectives: parsed.llmDirectives || loaded.config.llmDirectives === true, + weaveDecoys: parsed.weaveDecoys, }); if (parsed.sarif) { console.log( @@ -393,6 +401,7 @@ export async function runCli(argv: readonly string[] = process.argv.slice(2)): P seed: resolved.seed, honeySourceMaps: parsed.honeyMaps, llmDirectives: parsed.llmDirectives || loaded.config.llmDirectives === true, + weaveDecoys: parsed.weaveDecoys, }); if (parsed.json) console.log(JSON.stringify(res, null, 2)); else console.log(formatProtectionResult(res)); diff --git a/tests/skill-guide-contents.test.ts b/tests/skill-guide-contents.test.ts new file mode 100644 index 0000000..8ada0d4 --- /dev/null +++ b/tests/skill-guide-contents.test.ts @@ -0,0 +1,37 @@ +import { describe, expect, it } from "vitest"; +import * as fs from "node:fs"; +import * as path from "node:path"; +import { fileURLToPath } from "node:url"; + +const skillPath = path.resolve( + path.dirname(fileURLToPath(import.meta.url)), + "../.agents/skills/blind-llm-agents/SKILL.md", +); + +describe("blind-llm-agents skill guide contents", () => { + it("ships v1.3+ one-click harden guide with weave + forbidden surfaces", () => { + const text = fs.readFileSync(skillPath, "utf8"); + expect(text).toMatch(/metadata:\s*\n\s*version:\s*"1\.3\.\d+"/); + expect(text).toContain("bla_harden"); + expect(text).toContain("npx bla-agents@latest harden ."); + expect(text).toContain("weave_decoys"); + expect(text).toContain("bla_weave_plan"); + expect(text).toContain("bla://directives/weave-decoy"); + expect(text).toContain("bla-weave-decoy"); + expect(text).toMatch(/FORBIDDEN/i); + expect(text).toMatch(/bla_defend/); + expect(text).toContain("counter-rea-matrix.md"); + expect(text).toContain("weave-decoy-mcp.md"); + // Prefer skill guide + existing MCP tools; refuse offensive RE/crack framing. + expect(text.toLowerCase()).toMatch(/refuse|defensive only/); + expect(text).toMatch(/Do not ask which files to protect/i); + }); + + it("parseCliArgs accepts --weave-decoys for harden/defend/protect parity with MCP", async () => { + const { parseCliArgs } = await import("../src/cli.js"); + const parsed = parseCliArgs(["harden", ".", "--weave-decoys", "--json"]); + expect(parsed.command).toBe("harden"); + expect(parsed.weaveDecoys).toBe(true); + expect(parseCliArgs(["defend", "x.js"]).weaveDecoys).toBe(false); + }); +});