@agentproto/corpus-presets
v0.1.1
Published
@agentproto/corpus-presets — catalog of starter workspaces for the AIP-10 corpus runtime. Subpath exports per vertical (marketing, sales, …). Each preset is pure TS data — host iterates `files` and writes via FsPort. Mirrors @agentproto/role-catalog.
Maintainers
Readme
@agentproto/corpus-presets
Catalog of starter workspaces for the AIP-10 corpus runtime. Subpath exports per vertical — pure TS data, no filesystem dependency. Host iterates files and writes via FsPort.
Discovery
The corpus CLI discovers presets via the agentproto/corpus-preset/v1 manifest declared in this package's package.json#agentproto-corpus-preset. Third-party packages following the same convention can be added to the discovery set via corpusPresetPackages[] in ~/.agentproto/config.json.
Direct usage
import { MarketingCorpusPreset } from "@agentproto/corpus-presets/marketing"
for (const [rel, content] of Object.entries(MarketingCorpusPreset.files)) {
await fs.writeFile(path.join(workspaceRoot, rel), content)
}Or via the CLI, which uses the manifest to resolve the slug:
corpus init marketing ./my-corpus
corpus init --list # show every discoverable presetSource of truth
The fixture dir at @agentproto/corpus/test/fixtures/<slug>/ is the single source of truth. The TS file src/<slug>/files.ts is a build artifact — gitignored, regenerated by this package's prebuild / precheck-types / pretest / predev hooks. The conformance test enforces those .md files validate against the actual AgentProto JSON Schemas, so what ships here is always AIP-conformant by construction.
To edit a preset:
- Edit
packages/corpus/test/fixtures/<vertical>/... - Run
pnpm --filter @agentproto/corpus testto confirm conformance still holds - Build (or check-types, or test) the preset — the regen runs automatically:
pnpm --filter @agentproto/corpus-presets build
The standalone pnpm gen:marketing script still exists for explicit regen but isn't needed in the normal flow.
Adding a new vertical to this package
- Add fixtures:
packages/corpus/test/fixtures/<slug>/ - Extend
packages/corpus/src/__tests__/conformance.test.tsto cover them - Copy
scripts/gen-marketing.mjs→scripts/gen-<slug>.mjs - Add
gen-<slug>to each pre-hook inpackage.json(or fold it into a single bootstrap script that runs all generators) - Add
src/<slug>/index.tsexporting<Slug>CorpusPreset: CorpusPreset - Add
./<slug>subpath topackage.json#exports - Add
"<slug>/index"entry totsup.config.ts - Append an entry to
package.json#agentproto-corpus-preset.presets[]with the slug + entry + export - Add the generated file to the root
.gitignore
Shipping a preset from a third-party package
Create your own npm package (@vendor/corpus-presets, <name>-corpus-presets, …) and add the same manifest block to its package.json:
{
"agentproto-corpus-preset": {
"schema": "agentproto/corpus-preset/v1",
"presets": [
{ "slug": "<your-slug>", "entry": "./dist/index.mjs", "export": "<YourPreset>" }
]
}
}Then point the CLI at it:
// ~/.agentproto/config.json
{
"corpusPresetPackages": [
"@agentproto/corpus-presets",
"@vendor/corpus-presets"
]
}corpus init --list will show every discovered preset.
