@intentius/chant-lexicon-fountain 0.124.97 → 0.124.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acp/command-line.d.ts +0 -1
- package/dist/acp/host.d.ts +0 -1
- package/dist/acp/index.d.ts +0 -1
- package/dist/acp/jsonrpc.d.ts +0 -1
- package/dist/acp/output.d.ts +0 -1
- package/dist/acp/protocol.d.ts +0 -1
- package/dist/acp/serve.d.ts +0 -1
- package/dist/acp/server.d.ts +0 -1
- package/dist/acp/turn.d.ts +0 -1
- package/dist/allowlist-refs.d.ts +0 -1
- package/dist/audit-entities.d.ts +0 -1
- package/dist/codegen/docs-cli.d.ts +0 -1
- package/dist/codegen/docs.d.ts +0 -1
- package/dist/codegen/generate-cli.d.ts +0 -1
- package/dist/codegen/generate-lexicon.d.ts +0 -1
- package/dist/codegen/generate-typescript.d.ts +0 -1
- package/dist/codegen/generate.d.ts +0 -1
- package/dist/codegen/naming.d.ts +0 -1
- package/dist/codegen/package.d.ts +0 -1
- package/dist/composites/box.d.ts +0 -1
- package/dist/composites/concierge-stack.d.ts +0 -1
- package/dist/composites/steward.d.ts +0 -1
- package/dist/config.d.ts +0 -1
- package/dist/coverage.d.ts +0 -1
- package/dist/deep-observe-hooks.d.ts +0 -1
- package/dist/deep-observe.d.ts +0 -1
- package/dist/describe-resources.d.ts +0 -1
- package/dist/detect.d.ts +0 -1
- package/dist/entity-props.d.ts +0 -1
- package/dist/export-resources.d.ts +0 -1
- package/dist/generated/index.d.ts +0 -1
- package/dist/generated/runtime.d.ts +0 -1
- package/dist/import/generator.d.ts +0 -1
- package/dist/import/local-agents.d.ts +0 -1
- package/dist/import/parser.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/init-templates.d.ts +0 -1
- package/dist/integrity.json +2 -2
- package/dist/lint/audit-catalog.d.ts +0 -1
- package/dist/lint/audit-lineage.d.ts +0 -1
- package/dist/lint/post-synth/ftn010-networking-explicit.d.ts +0 -1
- package/dist/lint/post-synth/ftn011-no-unrestricted-networking.d.ts +0 -1
- package/dist/lint/post-synth/ftn012-no-cloud-credential-env.d.ts +0 -1
- package/dist/lint/post-synth/ftn013-substitution-resolvable.d.ts +0 -1
- package/dist/lint/post-synth/ftn014-vault-shadowing.d.ts +0 -1
- package/dist/lint/post-synth/ftn015-mcp-secret-env-substitution.d.ts +0 -1
- package/dist/lint/post-synth/ftn016-runtime-model-valid.d.ts +0 -1
- package/dist/lint/post-synth/ftn017-unique-resource-names.d.ts +0 -1
- package/dist/lint/post-synth/ftn023-acp-runtime-command.d.ts +0 -1
- package/dist/lint/post-synth/ftn024-setup-timeout-range.d.ts +0 -1
- package/dist/lint/post-synth/ftn025-removed-upstream.d.ts +0 -1
- package/dist/lint/post-synth/index.d.ts +0 -1
- package/dist/lint/rules/ftn001-no-secret-literals.d.ts +0 -1
- package/dist/lint/rules/index.d.ts +0 -1
- package/dist/live-identity.d.ts +0 -1
- package/dist/lsp/completions.d.ts +0 -1
- package/dist/lsp/hover.d.ts +0 -1
- package/dist/lsp/lexicon-index.d.ts +0 -1
- package/dist/manifest.json +1 -1
- package/dist/op/activities/fountain-apply.d.ts +0 -1
- package/dist/op/activities/fountain-prompt.d.ts +0 -1
- package/dist/op/activities/fountain-run.d.ts +0 -1
- package/dist/op/activities/index.d.ts +0 -1
- package/dist/op/run-prompt.d.ts +0 -1
- package/dist/op/runtime.d.ts +0 -1
- package/dist/package-cli.d.ts +0 -1
- package/dist/plugin.d.ts +0 -1
- package/dist/reference-catalog.d.ts +0 -1
- package/dist/retired.d.ts +0 -1
- package/dist/serializer.d.ts +0 -1
- package/dist/spec/fetch.d.ts +0 -1
- package/dist/spec/parse.d.ts +0 -1
- package/dist/validate-cli.d.ts +0 -1
- package/dist/validate.d.ts +0 -1
- package/package.json +3 -4
- package/dist/acp/command-line.d.ts.map +0 -1
- package/dist/acp/host.d.ts.map +0 -1
- package/dist/acp/index.d.ts.map +0 -1
- package/dist/acp/jsonrpc.d.ts.map +0 -1
- package/dist/acp/output.d.ts.map +0 -1
- package/dist/acp/protocol.d.ts.map +0 -1
- package/dist/acp/serve.d.ts.map +0 -1
- package/dist/acp/server.d.ts.map +0 -1
- package/dist/acp/turn.d.ts.map +0 -1
- package/dist/allowlist-refs.d.ts.map +0 -1
- package/dist/audit-entities.d.ts.map +0 -1
- package/dist/codegen/docs-cli.d.ts.map +0 -1
- package/dist/codegen/docs.d.ts.map +0 -1
- package/dist/codegen/generate-cli.d.ts.map +0 -1
- package/dist/codegen/generate-lexicon.d.ts.map +0 -1
- package/dist/codegen/generate-typescript.d.ts.map +0 -1
- package/dist/codegen/generate.d.ts.map +0 -1
- package/dist/codegen/naming.d.ts.map +0 -1
- package/dist/codegen/package.d.ts.map +0 -1
- package/dist/composites/box.d.ts.map +0 -1
- package/dist/composites/concierge-stack.d.ts.map +0 -1
- package/dist/composites/steward.d.ts.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/coverage.d.ts.map +0 -1
- package/dist/deep-observe-hooks.d.ts.map +0 -1
- package/dist/deep-observe.d.ts.map +0 -1
- package/dist/describe-resources.d.ts.map +0 -1
- package/dist/detect.d.ts.map +0 -1
- package/dist/entity-props.d.ts.map +0 -1
- package/dist/export-resources.d.ts.map +0 -1
- package/dist/generated/index.d.ts.map +0 -1
- package/dist/generated/runtime.d.ts.map +0 -1
- package/dist/import/generator.d.ts.map +0 -1
- package/dist/import/local-agents.d.ts.map +0 -1
- package/dist/import/parser.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/init-templates.d.ts.map +0 -1
- package/dist/lint/audit-catalog.d.ts.map +0 -1
- package/dist/lint/audit-lineage.d.ts.map +0 -1
- package/dist/lint/post-synth/ftn010-networking-explicit.d.ts.map +0 -1
- package/dist/lint/post-synth/ftn011-no-unrestricted-networking.d.ts.map +0 -1
- package/dist/lint/post-synth/ftn012-no-cloud-credential-env.d.ts.map +0 -1
- package/dist/lint/post-synth/ftn013-substitution-resolvable.d.ts.map +0 -1
- package/dist/lint/post-synth/ftn014-vault-shadowing.d.ts.map +0 -1
- package/dist/lint/post-synth/ftn015-mcp-secret-env-substitution.d.ts.map +0 -1
- package/dist/lint/post-synth/ftn016-runtime-model-valid.d.ts.map +0 -1
- package/dist/lint/post-synth/ftn017-unique-resource-names.d.ts.map +0 -1
- package/dist/lint/post-synth/ftn023-acp-runtime-command.d.ts.map +0 -1
- package/dist/lint/post-synth/ftn024-setup-timeout-range.d.ts.map +0 -1
- package/dist/lint/post-synth/ftn025-removed-upstream.d.ts.map +0 -1
- package/dist/lint/post-synth/index.d.ts.map +0 -1
- package/dist/lint/rules/ftn001-no-secret-literals.d.ts.map +0 -1
- package/dist/lint/rules/index.d.ts.map +0 -1
- package/dist/live-identity.d.ts.map +0 -1
- package/dist/lsp/completions.d.ts.map +0 -1
- package/dist/lsp/hover.d.ts.map +0 -1
- package/dist/lsp/lexicon-index.d.ts.map +0 -1
- package/dist/op/activities/fountain-apply.d.ts.map +0 -1
- package/dist/op/activities/fountain-prompt.d.ts.map +0 -1
- package/dist/op/activities/fountain-run.d.ts.map +0 -1
- package/dist/op/activities/index.d.ts.map +0 -1
- package/dist/op/run-prompt.d.ts.map +0 -1
- package/dist/op/runtime.d.ts.map +0 -1
- package/dist/package-cli.d.ts.map +0 -1
- package/dist/plugin.d.ts.map +0 -1
- package/dist/reference-catalog.d.ts.map +0 -1
- package/dist/retired.d.ts.map +0 -1
- package/dist/serializer.d.ts.map +0 -1
- package/dist/spec/fetch.d.ts.map +0 -1
- package/dist/spec/parse.d.ts.map +0 -1
- package/dist/validate-cli.d.ts.map +0 -1
- package/dist/validate.d.ts.map +0 -1
- package/src/acp/acp.test.ts +0 -850
- package/src/acp/command-line.ts +0 -192
- package/src/acp/gate-resolution.test.ts +0 -81
- package/src/acp/host.ts +0 -121
- package/src/acp/index.ts +0 -64
- package/src/acp/jsonrpc.ts +0 -239
- package/src/acp/output.ts +0 -59
- package/src/acp/protocol.ts +0 -164
- package/src/acp/serve.ts +0 -67
- package/src/acp/server.ts +0 -376
- package/src/acp/turn.ts +0 -349
- package/src/allowlist-refs.ts +0 -138
- package/src/audit-entities.test.ts +0 -157
- package/src/audit-entities.ts +0 -43
- package/src/codegen/docs-cli.ts +0 -7
- package/src/codegen/docs.ts +0 -139
- package/src/codegen/generate-cli.ts +0 -8
- package/src/codegen/generate-lexicon.ts +0 -70
- package/src/codegen/generate-typescript.ts +0 -69
- package/src/codegen/generate.ts +0 -109
- package/src/codegen/naming.ts +0 -45
- package/src/codegen/package.ts +0 -36
- package/src/composites/box.ts +0 -321
- package/src/composites/composites.test.ts +0 -530
- package/src/composites/concierge-stack.ts +0 -71
- package/src/composites/steward.ts +0 -285
- package/src/config.test.ts +0 -160
- package/src/config.ts +0 -148
- package/src/coverage.test.ts +0 -127
- package/src/coverage.ts +0 -278
- package/src/deep-observe-hooks.ts +0 -238
- package/src/deep-observe.test.ts +0 -684
- package/src/deep-observe.ts +0 -346
- package/src/describe-resources.test.ts +0 -215
- package/src/describe-resources.ts +0 -181
- package/src/detect.ts +0 -43
- package/src/entity-props.ts +0 -22
- package/src/export-resources.ts +0 -159
- package/src/generated/index.d.ts +0 -87
- package/src/generated/index.ts +0 -10
- package/src/generated/runtime.ts +0 -4
- package/src/import/generator.ts +0 -128
- package/src/import/local-agents.test.ts +0 -216
- package/src/import/local-agents.ts +0 -364
- package/src/import/parser.ts +0 -90
- package/src/import/roundtrip.test.ts +0 -256
- package/src/index.ts +0 -68
- package/src/init-templates.e2e.test.ts +0 -171
- package/src/init-templates.ts +0 -223
- package/src/lint/audit-catalog.ts +0 -145
- package/src/lint/audit-lineage.ts +0 -15
- package/src/lint/post-synth/ftn010-networking-explicit.ts +0 -37
- package/src/lint/post-synth/ftn011-no-unrestricted-networking.ts +0 -36
- package/src/lint/post-synth/ftn012-no-cloud-credential-env.ts +0 -58
- package/src/lint/post-synth/ftn013-substitution-resolvable.ts +0 -93
- package/src/lint/post-synth/ftn014-vault-shadowing.ts +0 -61
- package/src/lint/post-synth/ftn015-mcp-secret-env-substitution.ts +0 -49
- package/src/lint/post-synth/ftn016-runtime-model-valid.ts +0 -89
- package/src/lint/post-synth/ftn017-unique-resource-names.ts +0 -43
- package/src/lint/post-synth/ftn023-acp-runtime-command.ts +0 -58
- package/src/lint/post-synth/ftn024-setup-timeout-range.ts +0 -48
- package/src/lint/post-synth/ftn025-removed-upstream.ts +0 -65
- package/src/lint/post-synth/index.ts +0 -27
- package/src/lint/post-synth/post-synth.test.ts +0 -261
- package/src/lint/rules/ftn001-no-secret-literals.ts +0 -126
- package/src/lint/rules/index.ts +0 -7
- package/src/lint/rules/rules.test.ts +0 -161
- package/src/live-identity.ts +0 -153
- package/src/lsp/completions.test.ts +0 -67
- package/src/lsp/completions.ts +0 -11
- package/src/lsp/hover.test.ts +0 -65
- package/src/lsp/hover.ts +0 -68
- package/src/lsp/lexicon-index.ts +0 -46
- package/src/op/activities/fountain-apply.test.ts +0 -666
- package/src/op/activities/fountain-apply.ts +0 -458
- package/src/op/activities/fountain-prompt.test.ts +0 -117
- package/src/op/activities/fountain-prompt.ts +0 -197
- package/src/op/activities/fountain-run.test.ts +0 -295
- package/src/op/activities/fountain-run.ts +0 -292
- package/src/op/activities/index.ts +0 -38
- package/src/op/activities/op-runtime.test.ts +0 -194
- package/src/op/run-prompt.ts +0 -118
- package/src/op/runtime.test.ts +0 -1471
- package/src/op/runtime.ts +0 -1464
- package/src/package-cli.ts +0 -26
- package/src/plugin.test.ts +0 -88
- package/src/plugin.ts +0 -234
- package/src/reference-catalog.ts +0 -27
- package/src/retired.ts +0 -55
- package/src/serializer.test.ts +0 -262
- package/src/serializer.ts +0 -191
- package/src/skills/chant-fountain-locked-sandboxes.md +0 -34
- package/src/skills/chant-fountain-ops.md +0 -166
- package/src/skills/chant-fountain-secrets.md +0 -29
- package/src/skills/chant-fountain.md +0 -69
- package/src/spec/fetch.ts +0 -113
- package/src/spec/parse.ts +0 -484
- package/src/spec/spec.e2e.test.ts +0 -171
- package/src/validate-cli.ts +0 -13
- package/src/validate.ts +0 -39
- /package/{src → dist}/generated/lexicon-fountain.json +0 -0
- /package/{src → dist}/spec/fountain-openapi.snapshot.json +0 -0
package/src/codegen/docs-cli.ts
DELETED
package/src/codegen/docs.ts
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* fountain documentation generator.
|
|
3
|
-
*
|
|
4
|
-
* Calls the core docsPipeline with fountain-specific config. The reference
|
|
5
|
-
* pages (resources, composites, ops, adoption, skills) live as authored MDX
|
|
6
|
-
* under `docs/pages/`, each tagged with its Diátaxis quadrant; the sidebar is
|
|
7
|
-
* grouped from that field (chant #1731 / #1733).
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { dirname, join } from "path";
|
|
11
|
-
import { fileURLToPath } from "url";
|
|
12
|
-
import { docsPipeline, writeDocsSite, type DocsConfig } from "@intentius/chant/codegen/docs";
|
|
13
|
-
|
|
14
|
-
const pkgDir = dirname(dirname(dirname(fileURLToPath(import.meta.url))));
|
|
15
|
-
|
|
16
|
-
const overview = `The **fountain** lexicon declares [Managoat](https://github.com/managoat/managoat)'s workload layer (formerly fountain) as typed chant resources. Managoat runs coding agents in sandboxed VMs. Three kinds are declarable, the three \`fountain apply\` reconciles: \`Environment\` (sandbox baseline), \`Vault\` (env-var overrides) and \`Agent\` (a runnable agent config). Conversations are runs, not resources: start them with the \`fountainRun\` op.
|
|
17
|
-
|
|
18
|
-
\`Teammate\`, \`Schedule\` and \`Webhook\` are still exported, but Managoat removed the team, its scheduler and webhooks (managoat/managoat#2793): declaring one fails the build with FTN025, which names what replaced it. A long-lived thread is one conversation resumed by \`channel_id\` (what a \`Steward\`'s runs use), and a cadence is a clock outside Managoat running \`chant run <op> --on fountain\`. See [Coming from the team kinds](#coming-from-the-team-kinds) below.
|
|
19
|
-
|
|
20
|
-
Types are generated from a pinned fountain release's OpenAPI spec, so they track the real API.
|
|
21
|
-
|
|
22
|
-
Install it with:
|
|
23
|
-
|
|
24
|
-
\`\`\`bash
|
|
25
|
-
npm install --save-dev @intentius/chant-lexicon-fountain
|
|
26
|
-
\`\`\`
|
|
27
|
-
|
|
28
|
-
## Quick Start
|
|
29
|
-
|
|
30
|
-
\`\`\`typescript
|
|
31
|
-
import { Environment, Agent } from "@intentius/chant-lexicon-fountain";
|
|
32
|
-
|
|
33
|
-
export const env = new Environment({
|
|
34
|
-
name: "team-env",
|
|
35
|
-
networking_type: "limited", // FTN010 requires explicit intent
|
|
36
|
-
networking_config: { allowed_hosts: ["github.com"] },
|
|
37
|
-
metadata: { "managed-by": "chant" }, // enables owned-only reconcile/prune
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
export const helper = new Agent({
|
|
41
|
-
name: "helper",
|
|
42
|
-
model: "anthropic/claude-sonnet-4-6",
|
|
43
|
-
runtime: "claude",
|
|
44
|
-
environment: env, // typed ref, serialized by name
|
|
45
|
-
});
|
|
46
|
-
\`\`\`
|
|
47
|
-
|
|
48
|
-
## The loop
|
|
49
|
-
|
|
50
|
-
1. \`chant build\` — synthesize and lint. The FTN rules catch open networking, credential literals, and unresolvable \`\${VAR}\` references before review. The same rules run via [\`chant audit\`](/chant/cli/audit/) over a repo of hand-written \`fountain apply\` manifests — no chant project needed; the documents are parsed back into the entity graph.
|
|
51
|
-
2. \`chant run <apply op>\` or call \`fountainApply\` — reconcile against the API. Idempotent by name.
|
|
52
|
-
3. \`chant lifecycle diff --live\` — drift. A UI edit to an owned Environment shows up here.
|
|
53
|
-
4. \`chant import --from\` — adopt UI-built resources into typed files.
|
|
54
|
-
|
|
55
|
-
## Endpoint and auth
|
|
56
|
-
|
|
57
|
-
\`FOUNTAIN_ENDPOINT\` (defaults to the hosted instance) and \`FOUNTAIN_TOKEN\`. Mint a token via \`POST /api/auth/token\` with email and password, or from the account UI. The same code applies to a local \`mix phx.server\` fountain by pointing \`FOUNTAIN_ENDPOINT\` at it — registration and token mint work headless, so CI needs no browser.
|
|
58
|
-
|
|
59
|
-
## Coming from the team kinds
|
|
60
|
-
|
|
61
|
-
Managoat removed these between v0.21.0 and v0.29.0, the pinned spec. Each now fails the build with FTN025, and \`chant import\` skips its documents:
|
|
62
|
-
|
|
63
|
-
| Was | Now |
|
|
64
|
-
|---|---|
|
|
65
|
-
| \`Teammate\` (an agent on the team, with a thread) | One conversation resumed by \`channel_id\`. A \`Steward\`'s runs go to \`chant:steward:<name>\`; its sandbox keeps its disk across park and wake. Or \`--on e2b\`, a sandbox of your own. |
|
|
66
|
-
| \`Schedule\` (a cron prompt into that thread) | A clock outside Managoat (a CI \`schedule:\`, a CronJob) running \`chant run <op> --on fountain\`. The cadence stays on the Op. |
|
|
67
|
-
| \`Webhook\` | Nothing upstream. Read a run's outcome from \`chant run\`, or the conversation's event stream. |
|
|
68
|
-
| Agent \`sandbox_mode: "persistent"\` | Drop it: every conversation gets a sandbox of its own, and \`persistent\` is a 422. |
|
|
69
|
-
| \`sandbox_provider\` \`daytona\` or \`runner\` | \`sprites\` or \`e2b\`, or unset for the instance default. |
|
|
70
|
-
| \`runtime: "opencode"\` | \`claude\`, \`codex\`, \`gemini\` or \`acp\`. |
|
|
71
|
-
| \`fountain.profiles.<name>.team\` | \`steward\`, the steward's name. |`;
|
|
72
|
-
|
|
73
|
-
const outputFormat = `The fountain lexicon serializes to fountain's own manifest YAML — nothing else. \`fountainApply\` reads that same YAML, so there is no sidecar to keep in sync with it.
|
|
74
|
-
|
|
75
|
-
## Manifests
|
|
76
|
-
|
|
77
|
-
Each declared resource becomes a manifest document with \`apiVersion: fountain.dev/v1\`:
|
|
78
|
-
|
|
79
|
-
\`\`\`yaml
|
|
80
|
-
apiVersion: fountain.dev/v1
|
|
81
|
-
kind: Environment
|
|
82
|
-
metadata:
|
|
83
|
-
name: team-env
|
|
84
|
-
spec:
|
|
85
|
-
networking_type: limited
|
|
86
|
-
networking_config:
|
|
87
|
-
allowed_hosts:
|
|
88
|
-
- github.com
|
|
89
|
-
\`\`\`
|
|
90
|
-
|
|
91
|
-
Documents come out in dependency order — Environment, Vault, Agent — whatever order the file declared them in, so the manifest reads the way it applies. Within one kind, declaration order is kept.
|
|
92
|
-
|
|
93
|
-
\`metadata.name\` is the resource's declared \`name\`, not the name of the variable you exported it as. fountain reconciles by that name, so renaming the variable does not orphan the resource. An entity declared without a \`name\` falls back to the export name. The name appears only in \`metadata\`; it is not repeated under \`spec\`, so the apply request carries one name per resource.
|
|
94
|
-
|
|
95
|
-
The output is ejectable — \`fountain apply -f\` accepts it verbatim, so adopting chant here does not trap the manifests behind chant.
|
|
96
|
-
|
|
97
|
-
## Applying the manifest
|
|
98
|
-
|
|
99
|
-
\`fountainApply\` parses this same YAML and sends it to fountain's bulk \`POST /api/apply\` endpoint in one request — the server reconciles by name, Environment then Vault then Agent, and resolves an agent's \`environment\` reference itself, against the manifest or the tenant's existing environments. See the Ops page for the activity's own behavior (prune, secrets, failure reporting).
|
|
100
|
-
|
|
101
|
-
A \`Teammate\`, \`Schedule\` or \`Webhook\` is never written to the manifest: Managoat removed them, and FTN025 fails the build that declares one.
|
|
102
|
-
|
|
103
|
-
## Ownership
|
|
104
|
-
|
|
105
|
-
Resources carrying \`metadata."managed-by": chant\` are chant-owned. That marker gates the opt-in prune (\`fountainApply\` deletes only owned resources absent from the manifest) and the \`--owned\` filter on drift and live export. Set it on every declaration you want reconciled.
|
|
106
|
-
|
|
107
|
-
## Secrets
|
|
108
|
-
|
|
109
|
-
\`spec.secrets\` is authored as an ordered \`{key, value}[]\`, same as any other typed prop. \`fountainApply\` converts it to the \`{KEY: value}\` map fountain's bulk apply expects on the wire; the server upserts it through the encrypted envelope path. Values are write-only upstream, so this is upsert-always — a changed value cannot be detected, only overwritten.`;
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Generate documentation site for the fountain lexicon.
|
|
113
|
-
*/
|
|
114
|
-
export async function generateDocs(options?: { verbose?: boolean }): Promise<void> {
|
|
115
|
-
const config: DocsConfig = {
|
|
116
|
-
name: "fountain",
|
|
117
|
-
displayName: "Fountain",
|
|
118
|
-
description: "Fountain workload primitives (Environment, Vault, Agent) as typed estate.",
|
|
119
|
-
distDir: join(pkgDir, "dist"),
|
|
120
|
-
outDir: join(pkgDir, "docs"),
|
|
121
|
-
srcDir: join(pkgDir, "src"),
|
|
122
|
-
basePath: process.env.DOCS_BASE_PATH ?? "/chant/lexicons/fountain/",
|
|
123
|
-
overview,
|
|
124
|
-
outputFormat,
|
|
125
|
-
serviceFromType: (type: string) => type.split("::")[1] ?? type,
|
|
126
|
-
// No `resourceTypeUrl` key: DocsConfig has none, so passing it was a
|
|
127
|
-
// silent no-op. The upstream reference link lives in the resources page
|
|
128
|
-
// content, where it actually renders.
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
const result = docsPipeline(config);
|
|
132
|
-
writeDocsSite(config, result);
|
|
133
|
-
|
|
134
|
-
if (options?.verbose) {
|
|
135
|
-
console.error(
|
|
136
|
-
`Generated docs: ${result.stats.resources} resources, ${result.stats.properties} properties, ${result.stats.services} services, ${result.stats.rules} rules`,
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env tsx
|
|
2
|
-
import { generate, writeGeneratedFiles } from "./generate";
|
|
3
|
-
import { dirname } from "path";
|
|
4
|
-
import { fileURLToPath } from "url";
|
|
5
|
-
|
|
6
|
-
const pkgDir = dirname(dirname(dirname(fileURLToPath(import.meta.url))));
|
|
7
|
-
const result = await generate({ verbose: true });
|
|
8
|
-
writeGeneratedFiles(result, pkgDir);
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Lexicon JSON generator — produces lexicon-fountain.json with metadata for the
|
|
3
|
-
* fly resource and property types.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type { PropertyConstraints } from "@intentius/chant/codegen/json-schema";
|
|
7
|
-
import type { FountainParseResult } from "../spec/parse";
|
|
8
|
-
import { fountainShortName } from "../spec/parse";
|
|
9
|
-
import type { NamingStrategy } from "./naming";
|
|
10
|
-
import { buildRegistry, serializeRegistry, type RegistryResource } from "@intentius/chant/codegen/generate-registry";
|
|
11
|
-
|
|
12
|
-
export interface FountainLexiconEntry {
|
|
13
|
-
resourceType: string;
|
|
14
|
-
kind: "resource" | "property";
|
|
15
|
-
lexicon: "fountain";
|
|
16
|
-
/**
|
|
17
|
-
* Every authored prop name, sorted.
|
|
18
|
-
*
|
|
19
|
-
* `propertyConstraints` is the only prop list core's `LexiconIndex` reads,
|
|
20
|
-
* and it carries a prop only when upstream constrained it — so an `Agent`
|
|
21
|
-
* would complete `runtime` and `model` but not `system` or
|
|
22
|
-
* `allowed_vault_ids`, which the spec documents without a pattern or an
|
|
23
|
-
* enum. This field is the full list; `src/lsp/lexicon-index.ts` merges it in.
|
|
24
|
-
*/
|
|
25
|
-
props?: string[];
|
|
26
|
-
/**
|
|
27
|
-
* Per-property constraints. Named to match core's `LexiconEntry`
|
|
28
|
-
* contract (and the aws/azure peers) — core reserves bare `constraints`
|
|
29
|
-
* for the extension-constraint array, and the LSP providers read
|
|
30
|
-
* property names off this key.
|
|
31
|
-
*/
|
|
32
|
-
propertyConstraints?: Record<string, PropertyConstraints>;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Generate the lexicon-fountain.json content.
|
|
37
|
-
*/
|
|
38
|
-
export function generateLexiconJSON(results: FountainParseResult[], naming: NamingStrategy): string {
|
|
39
|
-
const registryResources: RegistryResource[] = results.map((r) => ({
|
|
40
|
-
typeName: r.resource.typeName,
|
|
41
|
-
attributes: r.resource.attributes,
|
|
42
|
-
properties: r.resource.properties,
|
|
43
|
-
propertyTypes: [],
|
|
44
|
-
}));
|
|
45
|
-
|
|
46
|
-
const entries = buildRegistry<FountainLexiconEntry>(registryResources, naming, {
|
|
47
|
-
shortName: fountainShortName,
|
|
48
|
-
buildEntry: (resource, _tsName, _attrs, propConstraints) => {
|
|
49
|
-
const r = results.find((res) => res.resource.typeName === resource.typeName);
|
|
50
|
-
const entry: FountainLexiconEntry = {
|
|
51
|
-
resourceType: resource.typeName,
|
|
52
|
-
kind: r?.isProperty ? "property" : "resource",
|
|
53
|
-
lexicon: "fountain",
|
|
54
|
-
};
|
|
55
|
-
const propNames = (r?.resource.properties ?? []).map((p) => p.name).sort();
|
|
56
|
-
if (propNames.length > 0) entry.props = propNames;
|
|
57
|
-
if (propConstraints && Object.keys(propConstraints).length > 0) {
|
|
58
|
-
entry.propertyConstraints = propConstraints;
|
|
59
|
-
}
|
|
60
|
-
return entry;
|
|
61
|
-
},
|
|
62
|
-
buildPropertyEntry: (resourceType, propertyType) => ({
|
|
63
|
-
resourceType: `${resourceType}.${propertyType}`,
|
|
64
|
-
kind: "property",
|
|
65
|
-
lexicon: "fountain",
|
|
66
|
-
}),
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
return serializeRegistry(entries);
|
|
70
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TypeScript declaration file generator — produces index.d.ts with the fly
|
|
3
|
-
* resource classes (App, Machine, Volume) and their property-type classes.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type { FountainParseResult } from "../spec/parse";
|
|
7
|
-
import type { NamingStrategy } from "./naming";
|
|
8
|
-
import {
|
|
9
|
-
writeResourceClass,
|
|
10
|
-
writePropertyClass,
|
|
11
|
-
type DtsProperty,
|
|
12
|
-
type DtsAttribute,
|
|
13
|
-
} from "@intentius/chant/codegen/generate-typescript";
|
|
14
|
-
|
|
15
|
-
interface Entry {
|
|
16
|
-
tsName: string;
|
|
17
|
-
isProperty: boolean;
|
|
18
|
-
properties: DtsProperty[];
|
|
19
|
-
attributes: DtsAttribute[];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Generate the complete .d.ts file content.
|
|
24
|
-
*/
|
|
25
|
-
export function generateTypeScriptDeclarations(results: FountainParseResult[], naming: NamingStrategy): string {
|
|
26
|
-
const lines: string[] = [];
|
|
27
|
-
lines.push("// Code generated by chant fly generate. DO NOT EDIT.");
|
|
28
|
-
|
|
29
|
-
const entries: Entry[] = [];
|
|
30
|
-
|
|
31
|
-
for (const r of results) {
|
|
32
|
-
const tsName = naming.resolve(r.resource.typeName);
|
|
33
|
-
if (!tsName) continue;
|
|
34
|
-
|
|
35
|
-
const properties: DtsProperty[] = r.resource.properties.map((p) => ({
|
|
36
|
-
name: p.name,
|
|
37
|
-
type: p.tsType,
|
|
38
|
-
required: p.required,
|
|
39
|
-
description: p.description,
|
|
40
|
-
}));
|
|
41
|
-
const attributes: DtsAttribute[] = r.resource.attributes.map((a) => ({ name: a.name, type: a.tsType }));
|
|
42
|
-
|
|
43
|
-
entries.push({ tsName, isProperty: !!r.isProperty, properties, attributes });
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
entries.sort((a, b) => a.tsName.localeCompare(b.tsName));
|
|
47
|
-
|
|
48
|
-
const resources = entries.filter((e) => !e.isProperty);
|
|
49
|
-
const propertyTypes = entries.filter((e) => e.isProperty);
|
|
50
|
-
|
|
51
|
-
if (resources.length > 0) {
|
|
52
|
-
lines.push("");
|
|
53
|
-
lines.push("// --- Fly Resource classes ---");
|
|
54
|
-
for (const re of resources) {
|
|
55
|
-
writeResourceClass(lines, re.tsName, re.properties, re.attributes);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (propertyTypes.length > 0) {
|
|
60
|
-
lines.push("");
|
|
61
|
-
lines.push("// --- Property type classes ---");
|
|
62
|
-
for (const pe of propertyTypes) {
|
|
63
|
-
writePropertyClass(lines, pe.tsName, pe.properties);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
lines.push("");
|
|
68
|
-
return lines.join("\n");
|
|
69
|
-
}
|
package/src/codegen/generate.ts
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fountain generation pipeline — uses core generatePipeline with
|
|
3
|
-
* fountain-specific fetch, parse, naming, and generation callbacks.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
generatePipeline,
|
|
8
|
-
writeGeneratedArtifacts,
|
|
9
|
-
type GenerateOptions,
|
|
10
|
-
type GenerateResult,
|
|
11
|
-
type GeneratePipelineConfig,
|
|
12
|
-
} from "@intentius/chant/codegen/generate";
|
|
13
|
-
import { fetchSchemas } from "../spec/fetch";
|
|
14
|
-
import { parseFountainOpenAPI, type FountainParseResult } from "../spec/parse";
|
|
15
|
-
import { NamingStrategy } from "./naming";
|
|
16
|
-
import { generateLexiconJSON } from "./generate-lexicon";
|
|
17
|
-
import { generateTypeScriptDeclarations } from "./generate-typescript";
|
|
18
|
-
import {
|
|
19
|
-
generateRuntimeIndex as coreGenerateRuntimeIndex,
|
|
20
|
-
type RuntimeIndexEntry,
|
|
21
|
-
type RuntimeIndexPropertyEntry,
|
|
22
|
-
} from "@intentius/chant/codegen/generate-runtime-index";
|
|
23
|
-
import { dirname } from "path";
|
|
24
|
-
import { fileURLToPath } from "url";
|
|
25
|
-
|
|
26
|
-
export type { GenerateResult };
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Run the full fountain generation pipeline.
|
|
30
|
-
*/
|
|
31
|
-
export async function generate(opts: GenerateOptions = {}): Promise<GenerateResult> {
|
|
32
|
-
// The fountain spec is a single document — parseFountainOpenAPI returns
|
|
33
|
-
// multiple results. The pipeline calls parseSchema once, so we return the
|
|
34
|
-
// first result and inject the rest via augmentResults.
|
|
35
|
-
let pendingResults: FountainParseResult[] = [];
|
|
36
|
-
|
|
37
|
-
const config: GeneratePipelineConfig<FountainParseResult> = {
|
|
38
|
-
fetchSchemas: (fetchOpts) => fetchSchemas({ force: fetchOpts.force }),
|
|
39
|
-
|
|
40
|
-
parseSchema: (_typeName, data) => {
|
|
41
|
-
const results = parseFountainOpenAPI(data);
|
|
42
|
-
if (results.length === 0) return null;
|
|
43
|
-
pendingResults = results.slice(1);
|
|
44
|
-
return results[0];
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
createNaming: (results) => new NamingStrategy(results),
|
|
48
|
-
|
|
49
|
-
augmentResults: (results, _opts, log) => {
|
|
50
|
-
if (pendingResults.length > 0) {
|
|
51
|
-
results.push(...pendingResults);
|
|
52
|
-
log(`Added ${pendingResults.length} additional fountain schemas from OpenAPI spec`);
|
|
53
|
-
pendingResults = [];
|
|
54
|
-
}
|
|
55
|
-
log(`Total: ${results.length} fountain resource/property schemas`);
|
|
56
|
-
return { results };
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
generateRegistry: (results, naming) => generateLexiconJSON(results, naming as NamingStrategy),
|
|
60
|
-
|
|
61
|
-
generateTypes: (results, naming) => generateTypeScriptDeclarations(results, naming as NamingStrategy),
|
|
62
|
-
|
|
63
|
-
generateRuntimeIndex: (results, naming) => generateRuntimeIndex(results, naming as NamingStrategy),
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
return generatePipeline(config, opts);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Write generated artifacts to disk.
|
|
71
|
-
*/
|
|
72
|
-
export function writeGeneratedFiles(result: GenerateResult, pkgDir?: string): void {
|
|
73
|
-
const baseDir = pkgDir ?? dirname(dirname(dirname(fileURLToPath(import.meta.url))));
|
|
74
|
-
writeGeneratedArtifacts({
|
|
75
|
-
baseDir,
|
|
76
|
-
files: {
|
|
77
|
-
"lexicon-fountain.json": result.lexiconJSON,
|
|
78
|
-
"index.d.ts": result.typesDTS,
|
|
79
|
-
"index.ts": result.indexTS,
|
|
80
|
-
"runtime.ts": `/**\n * Runtime factory constructors — re-exported from core.\n */\nexport { createResource, createProperty } from "@intentius/chant/runtime";\n`,
|
|
81
|
-
},
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Generate the runtime index.ts with factory constructor exports.
|
|
87
|
-
*/
|
|
88
|
-
function generateRuntimeIndex(results: FountainParseResult[], naming: NamingStrategy): string {
|
|
89
|
-
const resourceEntries: RuntimeIndexEntry[] = [];
|
|
90
|
-
const propertyEntries: RuntimeIndexPropertyEntry[] = [];
|
|
91
|
-
|
|
92
|
-
for (const r of results) {
|
|
93
|
-
const typeName = r.resource.typeName;
|
|
94
|
-
const tsName = naming.resolve(typeName);
|
|
95
|
-
if (!tsName) continue;
|
|
96
|
-
|
|
97
|
-
if (r.isProperty) {
|
|
98
|
-
propertyEntries.push({ tsName, resourceType: typeName });
|
|
99
|
-
} else {
|
|
100
|
-
const attrs: Record<string, string> = {};
|
|
101
|
-
for (const attr of r.resource.attributes) {
|
|
102
|
-
attrs[attr.name] = attr.name;
|
|
103
|
-
}
|
|
104
|
-
resourceEntries.push({ tsName, resourceType: typeName, attrs });
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return coreGenerateRuntimeIndex(resourceEntries, propertyEntries, { lexiconName: "fountain" });
|
|
109
|
-
}
|
package/src/codegen/naming.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fountain naming strategy — maps Fountain::V1::{Kind} type names to
|
|
3
|
-
* user-friendly TypeScript class names.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
NamingStrategy as CoreNamingStrategy,
|
|
8
|
-
type NamingConfig,
|
|
9
|
-
type NamingInput,
|
|
10
|
-
} from "@intentius/chant/codegen/naming";
|
|
11
|
-
import { fountainShortName, fountainServiceName, type FountainParseResult } from "../spec/parse";
|
|
12
|
-
|
|
13
|
-
export { propertyTypeName, extractDefName } from "@intentius/chant/codegen/naming";
|
|
14
|
-
|
|
15
|
-
const flyNamingConfig: NamingConfig = {
|
|
16
|
-
priorityNames: {
|
|
17
|
-
"Fountain::V1::Environment": "Environment",
|
|
18
|
-
"Fountain::V1::Agent": "Agent",
|
|
19
|
-
"Fountain::V1::Vault": "Vault",
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
priorityAliases: {},
|
|
23
|
-
|
|
24
|
-
priorityPropertyAliases: {},
|
|
25
|
-
|
|
26
|
-
serviceAbbreviations: {
|
|
27
|
-
V1: "V1",
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
shortName: fountainShortName,
|
|
31
|
-
serviceName: fountainServiceName,
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Fountain-specific naming strategy. Extends the core strategy with the fountain config.
|
|
36
|
-
*/
|
|
37
|
-
export class NamingStrategy extends CoreNamingStrategy {
|
|
38
|
-
constructor(results: FountainParseResult[]) {
|
|
39
|
-
const inputs: NamingInput[] = results.map((r) => ({
|
|
40
|
-
typeName: r.resource.typeName,
|
|
41
|
-
propertyTypes: r.propertyTypes,
|
|
42
|
-
}));
|
|
43
|
-
super(inputs, flyNamingConfig);
|
|
44
|
-
}
|
|
45
|
-
}
|
package/src/codegen/package.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { packagePipeline, collectSkills } from "@intentius/chant/codegen/package";
|
|
2
|
-
import { generate } from "./generate";
|
|
3
|
-
import { fountainPlugin } from "../plugin";
|
|
4
|
-
import { dirname, join } from "path";
|
|
5
|
-
import { moduleSourceDir } from "@intentius/chant/module-source";
|
|
6
|
-
import { readFileSync } from "fs";
|
|
7
|
-
import { FOUNTAIN_SPEC_VERSION } from "../spec/fetch";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Package the fountain lexicon for distribution.
|
|
11
|
-
*/
|
|
12
|
-
export async function packageLexicon(options?: { verbose?: boolean; force?: boolean }) {
|
|
13
|
-
// This file is src/codegen/package.ts — rules and skills are collected
|
|
14
|
-
// relative to src/, so srcDir must be the parent of this directory.
|
|
15
|
-
const srcDir = dirname(moduleSourceDir(import.meta.url));
|
|
16
|
-
const pkgJson = JSON.parse(readFileSync(join(srcDir, "..", "package.json"), "utf-8"));
|
|
17
|
-
|
|
18
|
-
const { spec, stats } = await packagePipeline({
|
|
19
|
-
generate: (opts) => generate({ verbose: opts?.verbose, force: opts?.force }),
|
|
20
|
-
buildManifest: (_genResult) => ({
|
|
21
|
-
name: "fountain",
|
|
22
|
-
version: pkgJson.version ?? "0.0.0",
|
|
23
|
-
chantVersion: ">=0.1.0",
|
|
24
|
-
namespace: "Fountain",
|
|
25
|
-
// Which upstream API this surface was generated from. Without it a built
|
|
26
|
-
// lexicon cannot say what it was built against.
|
|
27
|
-
specVersion: FOUNTAIN_SPEC_VERSION,
|
|
28
|
-
}),
|
|
29
|
-
srcDir,
|
|
30
|
-
collectSkills: () => collectSkills(fountainPlugin.skills?.() ?? []),
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
// Both callers (the plugin's package() and package-cli) print their own
|
|
34
|
-
// summary — don't double-report here.
|
|
35
|
-
return { spec, stats };
|
|
36
|
-
}
|