2.4 KiB
2.4 KiB
name, description
| name | description |
|---|---|
| sp-create-suaveplan-plugin | Interactive scaffold for new Suaveplan API plugins — generates plugin.json, definePlugin body, tests, vitest configs, migrations, and README. |
sp-create-suaveplan-plugin
| Symbol | Kind | Responsibility |
|---|---|---|
scaffold |
Function | Interactive CLI that prompts for isolation tier, capabilities, DB engine, then generates the full plugin skeleton |
generate |
Function | Programmatic variant of scaffold; returns an in-memory list of GeneratedFile records |
PromptAnswersSchema / validateAnswers |
Function | Zod schema + validator for scaffold inputs (IsolationTier, CapabilitySelection, DatabaseEngine) |
answersForFixture |
Function | Pre-canned prompt answers for test fixtures |
renderTree |
Function | Renders the scaffolded file tree as a visual tree string |
SCAFFOLD_CODES |
Constant | Error-code registry via @suaveplan/error defineCodes |
File Structure: packages/api-stack/api/create-suaveplan-plugin/src/{bin,generator,prompt,templates}/
Sibling packages:
@suaveplan/wasm-compiler-javy— WASM compiler for compiled plugins@suaveplan/testing-integration-postgres— Postgres fixture for integration tests@suaveplan/testing-integration-surrealdb— SurrealDB fixture for integration tests
Patterns:
Quick Start (CLI):
npx create-suaveplan-plugin
# interactive prompts → generates complete plugin skeleton
Programmatic generation:
import { generate, validateAnswers } from "create-suaveplan-plugin/generator";
const answers = validateAnswers({ isolationTier: "sandboxed", capabilities: ["rest"], databaseEngine: "sqlite" });
const files = generate(answers);
Constraints:
- CLI entrypoint:
create-suaveplan-pluginbin - Subpath exports:
/error-codes,/prompt,/generator - Generates
plugin.json,definePluginbody, host test, integration test, vitest configs, migrations, README - Integration tests wired to matching
testing-integration-{postgres,sqlite,surrealdb}fixture - No
@suaveplan/*runtime dependencies other than@suaveplan/error
Checklist:
scaffoldgenerates a testable plugin skeleton from interactive promptsgeneratereturns in-memoryGeneratedFilerecords without writing to diskvalidateAnswersrejects invalid isolation tiers or capability combinations- Output includes
plugin.json, host test, and integration test