@usenaive-sdk/blueprints 0.10.0 → 0.11.0
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/chunk-CVZ2DY27.js +50 -0
- package/dist/chunk-CVZ2DY27.js.map +1 -0
- package/dist/define-DiOsp5oY.d.ts +846 -0
- package/dist/index.d.ts +3 -836
- package/dist/index.js +1194 -923
- package/dist/index.js.map +1 -1
- package/dist/template.d.ts +2 -0
- package/dist/template.js +9 -0
- package/dist/template.js.map +1 -0
- package/package.json +6 -2
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// src/template.ts
|
|
2
|
+
var BLUEPRINTS = {
|
|
3
|
+
/** Clients, pipeline, deliverables, calendar. */
|
|
4
|
+
agency: { templates: ["blank", "seo-geo"], default: "blank" },
|
|
5
|
+
/**
|
|
6
|
+
* Post queue, accounts, calendar, analytics. The wire ids are frozen: `install.template` is a
|
|
7
|
+
* stored string on every provisioned org, so the display names moved ("Naive Short Form v1",
|
|
8
|
+
* "Naive Long Form v1", "Naive Clipping v1") and these did not.
|
|
9
|
+
*
|
|
10
|
+
* The first three are the base crews. The six after them are NICHE CHANNEL TEMPLATES (ADR-1115,
|
|
11
|
+
* ADR-1119): each is a thin template that reuses a base crew (`gaming-clips`/`news`/`sports` on
|
|
12
|
+
* `clipping`; `ufc`/`history`/`animal-feast` on `faceless`) and pins `naive/channel-template-<niche>`
|
|
13
|
+
* in every seat's `skills[]`. They are ordinary templates of this blueprint, so they publish, install
|
|
14
|
+
* and switch through the exact paths the base three do — the whole point of a template being data.
|
|
15
|
+
*/
|
|
16
|
+
media: { templates: ["faceless", "longform", "clipping", "gaming-clips", "news", "sports", "ufc", "history", "animal-feast"] },
|
|
17
|
+
/** Pages, posts, forms, analytics — a published site with a crew behind it (`usenaive/web-blueprint`). */
|
|
18
|
+
web: { templates: ["publisher"], default: "publisher" }
|
|
19
|
+
};
|
|
20
|
+
var list = (names) => names.join(", ");
|
|
21
|
+
function chooseTemplate(blueprint, template) {
|
|
22
|
+
if (blueprint === void 0) {
|
|
23
|
+
if (template === void 0) return { ok: true, template: void 0 };
|
|
24
|
+
return {
|
|
25
|
+
ok: false,
|
|
26
|
+
message: `template "${template}" names no blueprint \u2014 a template belongs to one, so add \`blueprint: "\u2026"\` (${list(Object.keys(BLUEPRINTS))})`
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const known = BLUEPRINTS[blueprint];
|
|
30
|
+
if (known === void 0) {
|
|
31
|
+
return { ok: false, message: `blueprint "${blueprint}" is not a blueprint \u2014 the blueprints are ${list(Object.keys(BLUEPRINTS))}` };
|
|
32
|
+
}
|
|
33
|
+
if (template === void 0) {
|
|
34
|
+
if (known.default !== void 0) return { ok: true, template: known.default };
|
|
35
|
+
return {
|
|
36
|
+
ok: false,
|
|
37
|
+
message: `blueprint "${blueprint}" needs a template \u2014 choose one of ${list(known.templates)}. Its crews spend money in different ways, so there is no default to fall back to.`
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
if (!known.templates.includes(template)) {
|
|
41
|
+
return { ok: false, message: `template "${template}" is not a template of blueprint "${blueprint}" \u2014 its templates are ${list(known.templates)}` };
|
|
42
|
+
}
|
|
43
|
+
return { ok: true, template };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
BLUEPRINTS,
|
|
48
|
+
chooseTemplate
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=chunk-CVZ2DY27.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/template.ts"],"sourcesContent":["/**\n * Blueprints and their templates.\n *\n * A **blueprint** is the machine: screens, `/api/*`, the store, build and deploy, the approval\n * flow — or, for a data-only blueprint, none of those. It is one repository, and it is shared across\n * its templates. A **template** is DATA — the crew and its prompts, the tool allow-lists and its\n * schedules. What a blueprint's own screens print per template is the blueprint's business, and\n * the engine never reads it (ADR-0903). One repo carries every template its blueprint has, so\n * switching is an edit plus `naive up`: never a re-clone, never a new app.\n *\n * The pair is checked here and refused at define time (`define.ts`), in the author's own\n * vocabulary, for the same reason every other refusal is: a wrong pair discovered at apply time is\n * discovered against a half-provisioned organization.\n */\nimport type { AgentDecl } from \"./define\";\n\n/**\n * The data module a blueprint repo exports, one per template it carries. Everything here is data:\n * nothing in it is a function, a component or a route, because those are the blueprint's and are\n * shared. `agents` is the config's own `agents` shape, so a template declares a crew exactly as a\n * hand-written config would — prompts, tool allow-lists and schedules included.\n */\nexport interface Template {\n /** Spelled exactly as `defineProject({ template })` and `naive template --template` name it. */\n name: string;\n /** One line for the operator: what this crew does. */\n description: string;\n agents: AgentDecl[];\n}\n\n/**\n * Every blueprint and the templates it carries. `agency` defaults to `blank` — a working agency\n * with no specialism is a safe thing to get by accident. `media` has NO default on purpose: its\n * three crews spend money in different ways — a long-form piece renders a minute-plus of video\n * where a clip only cuts one — so defaulting any of them is a bill the operator did not choose.\n * `web` carries one crew today, so `publisher` is its default for the reason `blank` is\n * `agency`'s: the only thing you can get is the thing you meant.\n */\nexport const BLUEPRINTS: Record<string, { templates: readonly string[]; default?: string }> = {\n /** Clients, pipeline, deliverables, calendar. */\n agency: { templates: [\"blank\", \"seo-geo\"], default: \"blank\" },\n /**\n * Post queue, accounts, calendar, analytics. The wire ids are frozen: `install.template` is a\n * stored string on every provisioned org, so the display names moved (\"Naive Short Form v1\",\n * \"Naive Long Form v1\", \"Naive Clipping v1\") and these did not.\n *\n * The first three are the base crews. The six after them are NICHE CHANNEL TEMPLATES (ADR-1115,\n * ADR-1119): each is a thin template that reuses a base crew (`gaming-clips`/`news`/`sports` on\n * `clipping`; `ufc`/`history`/`animal-feast` on `faceless`) and pins `naive/channel-template-<niche>`\n * in every seat's `skills[]`. They are ordinary templates of this blueprint, so they publish, install\n * and switch through the exact paths the base three do — the whole point of a template being data.\n */\n media: { templates: [\"faceless\", \"longform\", \"clipping\", \"gaming-clips\", \"news\", \"sports\", \"ufc\", \"history\", \"animal-feast\"] },\n /** Pages, posts, forms, analytics — a published site with a crew behind it (`usenaive/web-blueprint`). */\n web: { templates: [\"publisher\"], default: \"publisher\" },\n};\n\n/** Resolved (a default may have filled it in), or the refusal's own words for the caller to raise. */\nexport type TemplateChoice = { ok: true; template: string | undefined } | { ok: false; message: string };\n\nconst list = (names: readonly string[]): string => names.join(\", \");\n\n/** The one place a `blueprint` / `template` pair is judged — `defineProject` and the CLI share it. */\nexport function chooseTemplate(blueprint: string | undefined, template: string | undefined): TemplateChoice {\n if (blueprint === undefined) {\n if (template === undefined) return { ok: true, template: undefined };\n return {\n ok: false,\n message: `template \"${template}\" names no blueprint — a template belongs to one, so add \\`blueprint: \"…\"\\` (${list(Object.keys(BLUEPRINTS))})`,\n };\n }\n const known = BLUEPRINTS[blueprint];\n if (known === undefined) {\n return { ok: false, message: `blueprint \"${blueprint}\" is not a blueprint — the blueprints are ${list(Object.keys(BLUEPRINTS))}` };\n }\n if (template === undefined) {\n if (known.default !== undefined) return { ok: true, template: known.default };\n return {\n ok: false,\n message: `blueprint \"${blueprint}\" needs a template — choose one of ${list(known.templates)}. Its crews spend money in different ways, so there is no default to fall back to.`,\n };\n }\n if (!known.templates.includes(template)) {\n return { ok: false, message: `template \"${template}\" is not a template of blueprint \"${blueprint}\" — its templates are ${list(known.templates)}` };\n }\n return { ok: true, template };\n}\n"],"mappings":";AAsCO,IAAM,aAAiF;AAAA;AAAA,EAE5F,QAAQ,EAAE,WAAW,CAAC,SAAS,SAAS,GAAG,SAAS,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAY5D,OAAO,EAAE,WAAW,CAAC,YAAY,YAAY,YAAY,gBAAgB,QAAQ,UAAU,OAAO,WAAW,cAAc,EAAE;AAAA;AAAA,EAE7H,KAAK,EAAE,WAAW,CAAC,WAAW,GAAG,SAAS,YAAY;AACxD;AAKA,IAAM,OAAO,CAAC,UAAqC,MAAM,KAAK,IAAI;AAG3D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