{"_id":"@agent-lang/spec-flow","_rev":"3-dc6e0b103661791383545fc3c43dd628","name":"@agent-lang/spec-flow","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"@agent-lang/spec-flow","version":"0.1.0","keywords":["specification","spec-driven","testing","vitest","code-generation","mcp","model-context-protocol","llm"],"license":"SEE LICENSE IN LICENSE","_id":"@agent-lang/spec-flow@0.1.0","maintainers":[{"name":"eduard.moskvin","email":"ed@moskvin.ca"}],"homepage":"https://gitlab.com/agent-lang/spec-flow#readme","bugs":{"url":"https://gitlab.com/agent-lang/spec-flow/issues"},"bin":{"agent-lang":"bin/spec-flow.mjs"},"dist":{"shasum":"2dab1ac3303f89695dda30149f0b2d9302fd0c80","tarball":"https://registry.npmjs.org/@agent-lang/spec-flow/-/spec-flow-0.1.0.tgz","fileCount":112,"integrity":"sha512-wZHlGcPKd+EmXGdmDe0dn1JGZ9BHGgqUhNEOCh+oQk+x2cK+meQUjFYdvemUHRLyiUvR3jdMrotVofz3IQ0a9g==","signatures":[{"sig":"MEQCIA6vdaSckS66NE3GvK7xCV4Af3oe8ovcHueeLlsFipemAiAJn44hm7hidfUv9hxI7L0e90++jq1MJu/8QoyrfEXyLQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":196322},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"be24eaf29584f20a50967a611768501e80df2afc","scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json && cp src/schema/*.schema.json dist/schema/","start":"tsx src/main.ts","build:dev":"tsc","test:watch":"vitest","prepublishOnly":"npm run build && npm test","validate:schema":"tsx src/schema/validate.ts"},"_npmUser":{"name":"eduard.moskvin","email":"ed@moskvin.ca"},"repository":{"url":"git+https://gitlab.com/agent-lang/spec-flow.git","type":"git"},"_npmVersion":"11.6.2","description":"Specification-Driven Development: human prompt to structured spec pipeline","directories":{},"_nodeVersion":"24.13.0","dependencies":{"ajv":"^8.17.1","zod":"^3.24.1","yaml":"^2.6.1","fast-check":"^3.22.0","ajv-formats":"^3.0.1","@anthropic-ai/sdk":"^0.39.0","@modelcontextprotocol/sdk":"^1.12.1"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","vitest":"^2.1.8","typescript":"^5.7.2"},"_npmOperationalInternal":{"tmp":"tmp/spec-flow_0.1.0_1774679950540_0.31818385079352485","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@agent-lang/spec-flow","version":"0.2.0","keywords":["specification","spec-driven","testing","vitest","code-generation","mcp","model-context-protocol","llm"],"license":"SEE LICENSE IN LICENSE","_id":"@agent-lang/spec-flow@0.2.0","maintainers":[{"name":"eduard.moskvin","email":"ed@moskvin.ca"}],"homepage":"https://gitlab.com/agent-lang/spec-flow#readme","bugs":{"url":"https://gitlab.com/agent-lang/spec-flow/issues"},"bin":{"agent-lang":"bin/spec-flow.mjs"},"dist":{"shasum":"defb6fa4ffe0d46edeb37d6e5837c0c75e5021b6","tarball":"https://registry.npmjs.org/@agent-lang/spec-flow/-/spec-flow-0.2.0.tgz","fileCount":132,"integrity":"sha512-XTAi1jSNeJ7iKdkeAbk4gy97o0mFPmY3jOlv8QFTVYvesnjNMIY6xLOmPZGLf7n9wi/PScZT0QnYVz/cxHKRFA==","signatures":[{"sig":"MEQCIDsgINLPH0hZEJBD/GrcXtPYMYYK2VniXQBLtzxnAfrYAiAWiavPNbzPuvCzVFYkssxjQA0hC0/IMty3jalf0nV3hQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":215504},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"d23b8e5efe141e1b4eeaea97b1432736febc6887","scripts":{"test":"vitest run","build":"rm -rf dist && tsc -p tsconfig.build.json && cp src/schema/*.schema.json dist/schema/","start":"tsx src/main.ts","build:dev":"tsc","test:watch":"vitest","prepublishOnly":"npm run build && npm test","validate:schema":"tsx src/schema/validate.ts"},"_npmUser":{"name":"eduard.moskvin","email":"ed@moskvin.ca"},"repository":{"url":"git+https://gitlab.com/agent-lang/spec-flow.git","type":"git"},"_npmVersion":"11.6.2","description":"Specification-Driven Development: human prompt to structured spec pipeline","directories":{},"_nodeVersion":"24.13.0","dependencies":{"ajv":"^8.17.1","zod":"^3.24.1","yaml":"^2.6.1","fast-check":"^3.22.0","ajv-formats":"^3.0.1","@anthropic-ai/sdk":"^0.39.0","@modelcontextprotocol/sdk":"^1.12.1"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","vitest":"^2.1.8","typescript":"^5.7.2"},"_npmOperationalInternal":{"tmp":"tmp/spec-flow_0.2.0_1774831650618_0.4817565361843059","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@agent-lang/spec-flow","version":"0.3.0","description":"Specification-Driven Development: human prompt to structured spec pipeline","type":"module","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"bin":{"agent-lang":"bin/spec-flow.mjs"},"scripts":{"build":"rm -rf dist && tsc -p tsconfig.build.json && cp src/schema/*.schema.json dist/schema/","build:dev":"tsc","test":"vitest run","test:watch":"vitest","validate:schema":"tsx src/schema/validate.ts","start":"tsx src/main.ts","prepublishOnly":"npm run build && npm test"},"keywords":["specification","spec-driven","testing","vitest","code-generation","mcp","model-context-protocol","llm"],"license":"SEE LICENSE IN LICENSE","repository":{"type":"git","url":"git+https://gitlab.com/agent-lang/spec-flow.git"},"engines":{"node":">=18"},"dependencies":{"@anthropic-ai/sdk":"^0.39.0","@modelcontextprotocol/sdk":"^1.12.1","ajv":"^8.17.1","ajv-formats":"^3.0.1","fast-check":"^3.22.0","yaml":"^2.6.1","zod":"^3.24.1"},"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.2","vitest":"^2.1.8"},"gitHead":"e3a868ed0b364286dfb3ea9b03ae97430a57796f","_id":"@agent-lang/spec-flow@0.3.0","bugs":{"url":"https://gitlab.com/agent-lang/spec-flow/issues"},"homepage":"https://gitlab.com/agent-lang/spec-flow#readme","_nodeVersion":"24.13.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-lkXCz4xOG2k2muExsFy5X06EOApHOXgKIDSVjp0MvbVtcsRz1pper4Yzhin9GN+YClcZ1oJx0IGhQpal8vXGrQ==","shasum":"d2ec5b0bbd2e99d8e4cb8b71c03d103ee95f243a","tarball":"https://registry.npmjs.org/@agent-lang/spec-flow/-/spec-flow-0.3.0.tgz","fileCount":134,"unpackedSize":230339,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDMPKUrx5l17YQfHF2lvGdht36nmuIAly63gJYjfD/TTAIgRVttxsCMryhGKQVfN50kyO32h9mMN6yMEeaGN7cAFCk="}]},"_npmUser":{"name":"eduard.moskvin","email":"ed@moskvin.ca"},"directories":{},"maintainers":[{"name":"eduard.moskvin","email":"ed@moskvin.ca"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/spec-flow_0.3.0_1780527552639_0.6380820394443398"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-28T06:39:10.415Z","modified":"2026-06-03T22:59:12.951Z","0.1.0":"2026-03-28T06:39:10.685Z","0.2.0":"2026-03-30T00:47:30.765Z","0.3.0":"2026-06-03T22:59:12.792Z"},"bugs":{"url":"https://gitlab.com/agent-lang/spec-flow/issues"},"license":"SEE LICENSE IN LICENSE","homepage":"https://gitlab.com/agent-lang/spec-flow#readme","keywords":["specification","spec-driven","testing","vitest","code-generation","mcp","model-context-protocol","llm"],"repository":{"type":"git","url":"git+https://gitlab.com/agent-lang/spec-flow.git"},"description":"Specification-Driven Development: human prompt to structured spec pipeline","maintainers":[{"name":"eduard.moskvin","email":"ed@moskvin.ca"}],"readme":"# AGENT-LANG/spec-flow\n\nSpecification-driven development pipeline: natural language prompt &rarr; structured YAML spec &rarr; compiled test suite &rarr; generated implementation.\n\nAn LLM drafts a formal spec from your description, validates it, presents it for human approval, compiles it into a [Vitest](https://vitest.dev/) test file, then generates implementation code and auto-revises until all tests pass.\n\n## Pipeline\n\n```\nPrompt ──▸ Draft spec ──▸ Validate ──▸ Human review ──▸ Compile tests ──▸ Generate code\n               ▲              │           │  ▲   ▲             │                 │\n               └── auto-fix ──┘           │  │   │             │                 │\n                                          │  │   └── reject ───┘                 │\nYAML file ──▸ Load spec ─── validate ─────┘  │                            run tests\n                                             │                            ▲     │\n                                          Approve                         │     ▼\n                                             │                            └ auto-revise\n                                             └──────────────▸ Lock\n```\n\nThe spec is the single source of truth. Tests are derived from it, code is written to satisfy the tests, and the human stays in the loop as gatekeeper.\n\n## Installation\n\n```bash\nnpm install @agent-lang/spec-flow\n```\n\n### As an MCP server\n\nThe quickest way to use spec-flow is as an MCP server with Claude Code or Claude Desktop:\n\n```bash\n# Anthropic (default)\nexport ANTHROPIC_API_KEY=sk-ant-...\nnpx @agent-lang/spec-flow\n\n# OpenRouter\nexport LLM_PROVIDER=openrouter\nexport OPENROUTER_API_KEY=sk-or-...\nnpx @agent-lang/spec-flow\n```\n\nOr configure it in Claude Code / Claude Desktop settings:\n\n```json\n{\n  \"mcpServers\": {\n    \"spec-flow\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@agent-lang/spec-flow\"],\n      \"env\": {\n        \"LLM_PROVIDER\": \"anthropic\",\n        \"ANTHROPIC_API_KEY\": \"sk-ant-...\"\n      }\n    }\n  }\n}\n```\n\nTo use OpenRouter instead, swap the provider and key:\n\n```json\n{\n  \"mcpServers\": {\n    \"spec-flow\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@agent-lang/spec-flow\"],\n      \"env\": {\n        \"LLM_PROVIDER\": \"openrouter\",\n        \"OPENROUTER_API_KEY\": \"sk-or-...\",\n        \"AGENT_LANG_MODEL\": \"~anthropic/claude-sonnet-latest\"\n      }\n    }\n  }\n}\n```\n\n`AGENT_LANG_MODEL` is optional — each provider has a sensible default.\n\n### As a library\n\n```typescript\nimport {\n  Orchestrator,\n  AnthropicProvider,\n  OpenRouterProvider,\n  validate,\n  compile,\n  emit,\n} from \"@agent-lang/spec-flow\";\n\n// Anthropic\nconst provider = new AnthropicProvider({\n  apiKey: process.env.ANTHROPIC_API_KEY!,\n  model: \"claude-sonnet-4-6\",\n});\n\n// OpenRouter\nconst provider = new OpenRouterProvider({\n  apiKey: process.env.OPENROUTER_API_KEY!,\n  model: \"~anthropic/claude-sonnet-latest\", // any OpenRouter model ID\n});\n\nconst orchestrator = new Orchestrator(provider);\n```\n\nThe server runs over stdio and exposes tools that any MCP-compatible client (Claude Desktop, Claude Code, etc.) can call.\n\n## MCP tools\n\n| Tool | Description |\n|---|---|\n| `generate_spec` | Draft + validate + auto-revise a spec from a prompt |\n| `load_spec` | Load a spec from a YAML file, validate, and enter review |\n| `save_spec` | Write the current spec to disk as YAML |\n| `approve_spec` | Approve and lock the spec for compilation |\n| `reject_spec` | Revise the spec based on human feedback |\n| `reopen_spec` | Return an approved/locked spec to review |\n| `compile_tests` | Emit a Vitest test file from the locked spec |\n| `generate_code` | Generate implementation, run tests, auto-revise until passing |\n| `run_tests` | Run tests against generated or provided code |\n| `get_status` | Current pipeline state, revision count, errors |\n| `diff_specs` | Compare two specs with breaking-change flags |\n| `update_spec` | LLM-assisted targeted spec modification |\n| `patch_spec` | Programmatic spec operations (add/remove/update) |\n| `check_impact` | Analyze impact of spec changes on tests and code |\n| `list_specs` | List all specs with summary info |\n| `spec_history` | List version history of a named spec |\n\n## Multi-runtime support\n\nSpecs can target different runtimes via a pluggable architecture. Each runtime is a self-contained plugin implementing the `RuntimePlugin` interface:\n\n- **`module`** (default) &mdash; TypeScript/JavaScript function. Tests import it directly.\n- **`cli`** &mdash; Executable script (bash, node, python, etc.). Tests spawn it as a subprocess, capturing stdout/stderr/exit code.\n- **`hugo`** &mdash; Hugo template (shortcode, partial, or layout). Tests scaffold a Hugo project, run `hugo --cleanDestinationDir --quiet`, and assert on rendered HTML.\n\n```yaml\n# CLI runtime\nruntime:\n  type: cli\n  shell: node\n  entrypoint: ./my-app\n\n# Hugo runtime\nruntime:\n  type: hugo\n  template_kind: shortcode   # shortcode, partial, or layout\n  entrypoint: my-widget       # optional template name\n```\n\n### Adding custom runtimes\n\nNew runtimes can be added by implementing `RuntimePlugin` and registering it &mdash; no changes to core files required:\n\n```typescript\nimport { defaultRegistry } from \"@agent-lang/spec-flow\";\nimport { myPlugin } from \"./my-runtime/plugin.js\";\n\ndefaultRegistry.register(myPlugin);\n```\n\n## Configuration\n\n| Variable | Description | Default |\n|---|---|---|\n| `LLM_PROVIDER` | Provider to use: `anthropic` or `openrouter` | `anthropic` |\n| `ANTHROPIC_API_KEY` | Required when `LLM_PROVIDER=anthropic` | &mdash; |\n| `OPENROUTER_API_KEY` | Required when `LLM_PROVIDER=openrouter` | &mdash; |\n| `AGENT_LANG_MODEL` | Model override (provider-specific ID) | `claude-sonnet-4-6` / `~anthropic/claude-sonnet-latest` |\n\n## Development\n\n```bash\nnpm run build      # Build for publishing (tsconfig.build.json)\nnpm run build:dev  # TypeScript compilation (includes tests)\nnpm test           # Run all tests\nnpm run test:watch # Watch mode\n```\n\n## Project structure\n\n```\nsrc/\n  schema/        # JSON Schema definitions for the spec format\n  validator/     # Structural + semantic validation (8 rules)\n  dialogue/      # State machine, orchestrator, system prompts\n  compiler/      # Spec → Vitest test file\n  runtime/       # Runtime plugin system (module/, cli/, hugo/)\n  runner/        # Spawns Vitest to run generated tests\n  gating/        # Tool registry + guard (blocks code-gen until approved)\n  interfaces/    # LlmProvider and ToolBridge abstractions\n  providers/     # AnthropicProvider, OpenRouterProvider (concrete LLM adapters)\n  versioning/    # Spec evolution: metadata, diffing, impact analysis, registry\n  adapters/      # MCP server (16 tools over stdio)\n  index.ts       # Public API barrel export\n  main.ts        # MCP server entry point\nbin/\n  spec-flow.mjs  # CLI entry point (npx @agent-lang/spec-flow)\n```\n","readmeFilename":"README.md"}