create-nisc 0.9.0 → 0.9.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # create-nisc
2
2
 
3
+ ## 0.9.2
4
+
5
+ ### Patch Changes
6
+
7
+ - af2ea3c: The README says a new app runs four checks (the shape check included), what removing the model-first tour takes, and that every app gets a README and the `nisc-reviewer` agent. A classic app's PLAN.md names the shape check among its checks.
8
+
9
+ **What to change:** nothing. Documentation only.
10
+
11
+ ## 0.9.1
12
+
13
+ ### Patch Changes
14
+
15
+ - a7b2a05: A shape check, `runShapeCheck` from the new entry `@niscorp/cli/shape`: it reads an app's source and its actions for what its own checks cannot see — rule 16 by the TypeScript compiler, formatting outside Prism, roles read in server code, the kit reading files, the address or the document, code in `src/app` called while the app runs — and fails on every server function an action calls that the app has not named with why it is not a vex read or write. What an app allows, it names per rule and per file, each with its reason. It reads with the app's own TypeScript (6.x) and adds no dependency.
16
+
17
+ `create-nisc` writes it into every app as `src/dev/shape-check.ts`, run by `npm run check`. The rulebook's "Verification" and `REVIEW.md` say what it does.
18
+
19
+ **What to change:** nothing; an app that does not call it is not checked. To check an app made before this, copy `src/dev/shape-check.ts` from a new one, add it to `src/dev/all-checks.ts`, and name what it reports.
20
+
21
+ - 8fa42d1: Every app it makes ships a reviewer: `.claude/agents/nisc-reviewer.md`, a Claude Code agent with read-only tools that follows `node_modules/@niscorp/nisc/REVIEW.md` and reports by rule number. The app's `AGENTS.md` says to run it after each step of the order of work.
22
+
23
+ The model-first tour now reads data the way an app should: its new packages card replays the vex read `guide/packages` over the app's own `packages` table, whose rows a migration step writes, and the read's Prism `mapping` words each row. The charter grants `packages.read` to `public`, the reads-and-writes card shows that entry, and "Remove the tour" in the app's `AGENTS.md` lists what goes with it.
24
+
25
+ **What to change:** nothing. An app made before this can copy `.claude/agents/nisc-reviewer.md` from a new one.
26
+
3
27
  ## 0.9.0
4
28
 
5
29
  ### Patch Changes
package/README.md CHANGED
@@ -52,9 +52,10 @@ The structure the rulebook describes, and a first screen that works:
52
52
  - `npm run dev`, `build`, `check` and `start` — and, with the shell in the
53
53
  page, `export` — all the `nisc` command; `nisc dev` runs a moss app's server inside vite, so its
54
54
  `vite.config.ts` holds nothing but the framework's plugin;
55
- - three checks: the artifacts are pure, schema-valid JSON; the source is at the
56
- installed grammars (`strata.lock.json`); the welcome screen is served, drawn
57
- and pressed;
55
+ - four checks: the artifacts are pure, schema-valid JSON; the app keeps nisc's
56
+ shape (`shape-check`); the source is at the installed grammars
57
+ (`strata.lock.json`); the welcome screen is served, drawn and pressed — with
58
+ the shell in the page, whole and pressed;
58
59
  - every `@niscorp` package at **the release this create-nisc was built and
59
60
  checked against** — a caret range from each one's version (such as `^0.2.0`), not
60
61
  whatever is newest — and `@niscorp/nisc` itself, which pins that set
@@ -76,18 +77,23 @@ A model-first app has, instead of the welcome screen:
76
77
  counter, a checklist and a quick check to use, which the model can fill in
77
78
  too. A card's link opens a screen at once; only what is typed, or a thing to
78
79
  ask pressed, goes to the model. Its `AGENTS.md` says how to remove the tour —
79
- a folder, a check, and edits in five files — and what to build next;
80
+ a folder, a check, its vex entries and its migration, and edits in six files
81
+ and the two documents — and what to build next;
80
82
  - checks that run the loop offline with a scripted decision model and chat
81
83
  model, one for the loop and one for the tour, and `src/dev/live-ask.ts`,
82
84
  which asks the real models a run of cases.
83
85
 
84
- And two documents:
86
+ And the documents:
85
87
 
88
+ - **`README.md`** — the app's commands, and what to read before building.
86
89
  - **`PLAN.md`** — what was decided when it was made (the posture with its
87
90
  consequences, the renderer), and everything else the rulebook's interview
88
91
  asks, written down as **open**. Nothing gets built on an open decision.
89
92
  - **`AGENTS.md`** — where the rules are: `node_modules/@niscorp/nisc/AGENTS.md`,
90
93
  the rulebook for the version installed. It does not copy them.
94
+ - **`.claude/agents/nisc-reviewer.md`** — an agent that reviews the app against
95
+ nisc's rules and reports findings by rule number, changing nothing; for after
96
+ each step of PLAN.md's order of work.
91
97
 
92
98
  ## A folder that already exists
93
99
 
@@ -3,7 +3,7 @@ import { join, extname, dirname } from 'path';
3
3
  import { fileURLToPath } from 'url';
4
4
 
5
5
  // <define:__NISC_SET__>
6
- var define_NISC_SET_default = { "@niscorp/charter": "0.1.4", "@niscorp/cli": "0.9.0", "@niscorp/cortex": "0.1.5", "@niscorp/loom": "0.5.0", "@niscorp/moss": "0.9.0", "@niscorp/nisc": "0.9.0", "@niscorp/nova": "0.5.1", "@niscorp/prism": "0.3.2", "@niscorp/signal": "0.1.8", "@niscorp/solid": "0.1.2", "@niscorp/strata": "0.1.8", "@niscorp/tide": "0.1.9", "@niscorp/vex": "0.4.3" };
6
+ var define_NISC_SET_default = { "@niscorp/charter": "0.1.5", "@niscorp/cli": "0.9.1", "@niscorp/cortex": "0.1.6", "@niscorp/loom": "0.5.0", "@niscorp/moss": "0.9.1", "@niscorp/nisc": "0.9.2", "@niscorp/nova": "0.5.2", "@niscorp/prism": "0.3.3", "@niscorp/signal": "0.1.9", "@niscorp/solid": "0.1.3", "@niscorp/strata": "0.1.9", "@niscorp/tide": "0.1.10", "@niscorp/vex": "0.4.4" };
7
7
  var isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
8
8
  var json = (path) => {
9
9
  try {
@@ -112,6 +112,7 @@ ${all(facts.parts, "where").join("\n")}
112
112
  \`\`\`
113
113
 
114
114
  - **How it runs:** ${all(facts.parts, "runs").join(", ")} \u2014 all of them the \`nisc\` command \u2014 and \`npm run strata status\` for the grammars.
115
+ - **How it is reviewed:** by the \`nisc-reviewer\` agent (\`.claude/agents/nisc-reviewer.md\`), which follows \`node_modules/@niscorp/nisc/REVIEW.md\` \u2014 after each step of PLAN.md's order of work, not only at the end. \`npm run check\` passing says the app does what it should; a review says it is still built the nisc way.
115
116
  ${sections(facts.agents)}`;
116
117
  };
117
118
  var planDoc = (facts) => `# PLAN \u2014 ${facts.name}
@@ -312,5 +313,5 @@ var testedSet = () => {
312
313
  };
313
314
 
314
315
  export { TEMPLATES, completed, envOf, generate, isChoice, itemsOf, offered, readCatalog, testedSet, validName };
315
- //# sourceMappingURL=chunk-T7O6E5WE.js.map
316
- //# sourceMappingURL=chunk-T7O6E5WE.js.map
316
+ //# sourceMappingURL=chunk-RUHOVTHF.js.map
317
+ //# sourceMappingURL=chunk-RUHOVTHF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["%3Cdefine:__NISC_SET__%3E","../src/catalog/items.ts","../src/catalog/choose.ts","../src/docs.ts","../src/generate.ts","../src/set.ts"],"names":["offered","existsSync","join","readdirSync","isRecord","readFileSync","sections"],"mappings":";;;;;AAAA,IAAA,uBAAA,GAAA,EAAC,kBAAA,EAAmB,OAAA,EAAQ,cAAA,EAAe,OAAA,EAAQ,iBAAA,EAAkB,SAAQ,eAAA,EAAgB,OAAA,EAAQ,eAAA,EAAgB,OAAA,EAAQ,eAAA,EAAgB,OAAA,EAAQ,iBAAgB,OAAA,EAAQ,gBAAA,EAAiB,OAAA,EAAQ,iBAAA,EAAkB,OAAA,EAAQ,gBAAA,EAAiB,OAAA,EAAQ,iBAAA,EAAkB,OAAA,EAAQ,eAAA,EAAgB,QAAA,EAAS,cAAA,EAAe,OAAA,EAAO;ACwClU,IAAM,QAAA,GAAW,CAAC,KAAA,KAAqD,KAAA,KAAU,IAAA,IAAQ,OAAO,KAAA,KAAU,QAAA,IAAY,CAAC,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA;AAE1I,IAAM,IAAA,GAAO,CAAC,IAAA,KAA0B;AACtC,EAAA,IAAI;AACF,IAAA,OAAO,IAAA,CAAK,KAAA,CAAM,YAAA,CAAa,IAAA,EAAM,MAAM,CAAC,CAAA;AAAA,EAC9C,SAAS,KAAA,EAAO;AACd,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,aAAA,EAAgB,IAAI,CAAA,oBAAA,EAAkB,KAAA,YAAiB,KAAA,GAAQ,KAAA,CAAM,OAAA,GAAU,MAAA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AA,GAAI,CAAC,CAAA;AAC3E,IAAA,KAAA,CAAM,MAAA,EAAQ,KAAK,GAAA,EAAK,IAAA,CAAK,UAAU,CAAC,IAAA,EAAM,SAAS,CAAC,GAAG,IAAI,CAAA,CAAE,IAAA,CAAK,CAAC,MAAA,KAAW,MAAA,CAAO,WAAW,KAAA,CAAM,IAAI,CAAC,CAAC,CAAC,CAAA;AAAA,EACnH;AAEA,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,OAAO,CAAA,IAAK,OAAA,EAAS;AACpC,IAAA,MAAM,EAAA,GAAKH,IAAAA,CAAK,OAAA,CAAQ,GAAA,EAAK,GAAG,CAAA;AAChC,IAAA,SAAA,CAAU,QAAQ,EAAE,CAAA,EAAG,EAAE,SAAA,EAAW,MAAM,CAAA;AAC1C,IAAA,aAAA,CAAc,IAAI,OAAO,CAAA;AAAA,EAC3B;AACA,EAAA,OAAO,EAAE,OAAO,CAAC,GAAG,QAAQ,IAAA,EAAM,EAAE,MAAA,CAAO,CAAC,QAAQ,CAAC,QAAA,CAAS,SAAS,GAAG,CAAC,EAAE,IAAA,EAAK,EAAG,MAAM,QAAA,EAAS;AACtG;;;AClNO,IAAM,YAAY,MAAwC;AAC/D,EAAA,IAAI,OAAO,uBAAA,KAAiB,WAAA,EAAa,MAAM,IAAI,MAAM,4FAAuF,CAAA;AAChJ,EAAA,OAAO,uBAAA;AACT","file":"chunk-RUHOVTHF.js","sourcesContent":["{\"@niscorp/charter\":\"0.1.5\",\"@niscorp/cli\":\"0.9.1\",\"@niscorp/cortex\":\"0.1.6\",\"@niscorp/loom\":\"0.5.0\",\"@niscorp/moss\":\"0.9.1\",\"@niscorp/nisc\":\"0.9.2\",\"@niscorp/nova\":\"0.5.2\",\"@niscorp/prism\":\"0.3.3\",\"@niscorp/signal\":\"0.1.9\",\"@niscorp/solid\":\"0.1.3\",\"@niscorp/strata\":\"0.1.9\",\"@niscorp/tide\":\"0.1.10\",\"@niscorp/vex\":\"0.4.4\"}","import { existsSync, readdirSync, readFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nexport type EnvKey = { name: string; message: string; required?: boolean };\nexport type EnvOption = { value: string; label: string; hint?: string; keys?: readonly EnvKey[] };\nexport type EnvChoice = { choose: string; message: string; options: readonly EnvOption[] };\nexport type EnvSpec = EnvKey | EnvChoice;\n\nexport type Docs = {\n is?: string;\n where?: readonly string[];\n runs?: readonly string[];\n decisions?: readonly string[];\n answered?: readonly string[];\n open?: readonly string[];\n order?: readonly string[];\n};\n\nexport type Part = {\n package?: Readonly<Record<string, unknown>>;\n env?: readonly EnvSpec[];\n docs?: Docs;\n};\n\nexport type Item = Part & {\n id: string;\n answers?: string;\n label?: string;\n hint?: string;\n usage?: string;\n summary?: string;\n default?: boolean;\n requires?: Readonly<Record<string, string>>;\n with?: Readonly<Record<string, Part>>;\n};\n\nexport type Question = { id: string; message: string };\n\nexport type Catalog = { root: string; questions: readonly Question[]; items: readonly Item[] };\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => value !== null && typeof value === 'object' && !Array.isArray(value);\n\nconst json = (path: string): unknown => {\n try {\n return JSON.parse(readFileSync(path, 'utf8'));\n } catch (error) {\n throw new Error(`create-nisc: ${path} is not JSON — ${error instanceof Error ? error.message : String(error)}`);\n }\n};\n\nexport const isChoice = (spec: EnvSpec): spec is EnvChoice => 'choose' in spec;\n\n// The templates are ours, so a mistake in them is a bug: it is refused here with a sentence, before anything is written.\nexport const readCatalog = (root: string): Catalog => {\n const questions = json(join(root, 'questions.json'));\n if (!Array.isArray(questions) || !questions.every((q) => isRecord(q) && typeof q['id'] === 'string' && typeof q['message'] === 'string')) {\n throw new Error(`create-nisc: ${root}/questions.json is not a list of { id, message }`);\n }\n const items: Item[] = readdirSync(root, { withFileTypes: true })\n .filter((entry) => entry.isDirectory() && existsSync(join(root, entry.name, 'item.json')))\n .map((entry) => {\n const item = json(join(root, entry.name, 'item.json'));\n if (!isRecord(item) || item['id'] !== entry.name) throw new Error(`create-nisc: ${entry.name}/item.json must say \"id\": \"${entry.name}\"`);\n return item as Item;\n });\n\n const asked = new Set((questions as Question[]).map((q) => q.id));\n const known = new Set(items.map((item) => item.id));\n const answering = (question: string): Item[] => items.filter((item) => item.answers === question);\n for (const item of items) {\n if (item.answers !== undefined && !asked.has(item.answers)) throw new Error(`create-nisc: item \"${item.id}\" answers \"${item.answers}\", which questions.json does not ask`);\n if (item.answers !== undefined && item.label === undefined) throw new Error(`create-nisc: item \"${item.id}\" answers a question but has no label to offer`);\n for (const [question, wanted] of Object.entries(item.requires ?? {})) {\n if (!answering(question).some((other) => other.id === wanted)) throw new Error(`create-nisc: item \"${item.id}\" requires \"${wanted}\" for \"${question}\", which no item answering it is`);\n }\n for (const other of Object.keys(item.with ?? {})) if (!known.has(other)) throw new Error(`create-nisc: item \"${item.id}\" has a part for \"${other}\", which is no item`);\n }\n for (const question of questions as Question[]) {\n const offered = answering(question.id);\n if (offered.length === 0) throw new Error(`create-nisc: nothing answers \"${question.id}\"`);\n if (offered.filter((item) => item.default === true).length !== 1) throw new Error(`create-nisc: exactly one item answering \"${question.id}\" is its default`);\n }\n return { root, questions: questions as Question[], items };\n};\n","import type { Catalog, EnvSpec, Item, Part } from './items';\n\n// Question id → the id of the item that answers it.\nexport type Picks = Readonly<Record<string, string>>;\n\nconst itemNamed = (catalog: Catalog, id: string): Item | undefined => catalog.items.find((item) => item.id === id);\n\n// What the items picked so far say other questions must be answered with.\nexport const impliedBy = (catalog: Catalog, picks: Picks): Record<string, string> => {\n const implied: Record<string, string> = {};\n for (const id of Object.values(picks)) Object.assign(implied, itemNamed(catalog, id)?.requires ?? {});\n return implied;\n};\n\n// The items that can still answer a question, beside what is picked.\nexport const offered = (catalog: Catalog, question: string, picks: Picks): Item[] => {\n const implied = impliedBy(catalog, picks)[question];\n return catalog.items.filter(\n (item) =>\n item.answers === question &&\n (implied === undefined || implied === item.id) &&\n Object.entries(item.requires ?? {}).every(([other, wanted]) => picks[other] === undefined || picks[other] === wanted),\n );\n};\n\n// Answers every question the picks leave open the way a person who takes the defaults would.\nexport const completed = (catalog: Catalog, picks: Picks): Record<string, string> => {\n const done: Record<string, string> = { ...picks };\n for (const question of catalog.questions) {\n if (done[question.id] !== undefined) continue;\n const choices = offered(catalog, question.id, done);\n const chosen = choices.find((item) => item.default === true) ?? choices[0];\n if (chosen === undefined) throw new Error(`create-nisc: nothing can answer \"${question.message}\" beside ${Object.values(done).join(', ')}`);\n done[question.id] = chosen.id;\n }\n return done;\n};\n\n// The items an app is made of: the one answering each question, in the order they are asked, then the ones every\n// app has. Refused when a question is unanswered or an item's requirement is not met.\nexport const itemsOf = (catalog: Catalog, picks: Picks): Item[] => {\n const answering = catalog.questions.map((question) => {\n const id = picks[question.id];\n const item = id === undefined ? undefined : itemNamed(catalog, id);\n if (item === undefined || item.answers !== question.id) throw new Error(`create-nisc: \"${question.message}\" has no answer${id === undefined ? '' : ` — \"${id}\" does not answer it`}`);\n return item;\n });\n for (const item of answering) {\n for (const [question, wanted] of Object.entries(item.requires ?? {})) {\n if (picks[question] !== wanted) throw new Error(`create-nisc: \"${item.id}\" needs \"${wanted}\", not \"${picks[question] ?? 'nothing'}\"`);\n }\n }\n return [...answering, ...catalog.items.filter((item) => item.answers === undefined)];\n};\n\n// Each item's own part, followed by its part for every other item the app is made of.\nexport const partsOf = (items: readonly Item[]): Part[] => {\n const ids = new Set(items.map((item) => item.id));\n return items.flatMap((item) => [item, ...Object.entries(item.with ?? {}).flatMap(([other, part]) => (ids.has(other) ? [part] : []))]);\n};\n\nexport const envOf = (items: readonly Item[]): EnvSpec[] => partsOf(items).flatMap((part) => part.env ?? []);\n","import type { Part } from './catalog';\n\nexport type DocFacts = {\n name: string;\n today: string;\n nisc: string;\n parts: readonly Part[];\n // The sections items add to AGENTS.md, each from its own agents-section.md.\n agents: readonly string[];\n};\n\nconst all = <K extends 'is' | 'where' | 'runs' | 'decisions' | 'answered' | 'open' | 'order'>(parts: readonly Part[], key: K): string[] =>\n parts.flatMap((part) => {\n const value = part.docs?.[key];\n return value === undefined ? [] : typeof value === 'string' ? [value] : [...value];\n });\n\nconst decisionNumber = (row: string): number => Number(/^\\| D(\\d+) /.exec(row)?.[1] ?? Number.POSITIVE_INFINITY);\n\nconst sections = (texts: readonly string[]): string => texts.map((text) => `\\n${text.trim()}\\n`).join('');\n\nexport const agentsDoc = (facts: DocFacts): string => {\n const [first = 'a nisc application', ...rest] = all(facts.parts, 'is');\n return `# ${facts.name}\n\nA nisc application. **The rules it is built by are \\`node_modules/@niscorp/nisc/AGENTS.md\\`** — read all of it before changing anything here (it is there once the app's dependencies are installed). It is the rulebook for the nisc version this app has installed, and \\`STYLE_GUIDE.md\\` sits beside it. The grammars it names — a layout node, an \\`ActionDefinition\\`, a Prism config, a charter, a Vex DSL — are in each package's own \\`README.md\\` and \\`DESIGN.md\\`, under \\`node_modules/@niscorp/<name>/\\`.\n\nWhat is particular to this app:\n\n- **Its decisions are in PLAN.md.** What was answered when it was made, what was derived, and what is still open. An open decision point is asked before anything is built on it, never resolved silently.\n- **It is ${first}**${rest.map((clause) => `, ${clause}`).join('')}.\n- **Where things go:**\n\n\\`\\`\\`\n${all(facts.parts, 'where').join('\\n')}\n\\`\\`\\`\n\n- **How it runs:** ${all(facts.parts, 'runs').join(', ')} — all of them the \\`nisc\\` command — and \\`npm run strata status\\` for the grammars.\n- **How it is reviewed:** by the \\`nisc-reviewer\\` agent (\\`.claude/agents/nisc-reviewer.md\\`), which follows \\`node_modules/@niscorp/nisc/REVIEW.md\\` — after each step of PLAN.md's order of work, not only at the end. \\`npm run check\\` passing says the app does what it should; a review says it is still built the nisc way.\n${sections(facts.agents)}`;\n};\n\nexport const planDoc = (facts: DocFacts): string => `# PLAN — ${facts.name}\n\nMade ${facts.today} by \\`npm create nisc\\`, on nisc ${facts.nisc}. This is the record AGENTS.md's interview asks for (\"Before any code\"). The walkthrough asked what shapes the files; everything else is **open**, and an open decision blocks the build that depends on it until it is answered by the user or delegated by name. A blanket \"go\" delegates nothing.\n\n## Decision points\n\n| | Tier | |\n|---|---|---|\n${all(facts.parts, 'decisions')\n .sort((a, b) => decisionNumber(a) - decisionNumber(b))\n .join('\\n')}\n\n## Answered when it was made\n\n${all(facts.parts, 'answered')\n .map((line) => `- ${line}`)\n .join('\\n')}\n\n## The dial-in — open\n\n${all(facts.parts, 'open')\n .map((line) => `- ${line}`)\n .join('\\n')}\n\n## Order of work\n\n${all(facts.parts, 'order')\n .map((line, at) => `${at + 1}. ${line}`)\n .join('\\n')}\n`;\n\nexport const gitignoreLines = ['node_modules/', 'dist/', 'out/', '.strata/', '*.tsbuildinfo', '.env', '.env.*', '!.env.example'];\n","import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';\nimport { dirname, extname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { envOf, isChoice, itemsOf, partsOf, readCatalog } from './catalog';\nimport type { EnvKey, EnvSpec, Item, Part, Picks } from './catalog';\nimport { agentsDoc, gitignoreLines, planDoc } from './docs';\n\nexport type CreateOptions = {\n dir: string;\n name: string;\n picks: Picks;\n // The values given for the keys the items ask for, by variable name. A key left out is written empty.\n env?: Readonly<Record<string, string>>;\n versions: Readonly<Record<string, string>>;\n // Depend on the nisc packages of the workspace the app is made in, for an app inside the nisc repository.\n workspace?: boolean;\n // YYYY-MM-DD\n today: string;\n templates?: string;\n};\n\nexport type Created = {\n files: string[];\n kept: string[];\n extended: string[];\n};\n\nexport const TEMPLATES = fileURLToPath(new URL('../templates', import.meta.url));\n\nconst TOKEN = 'nisc-template-app';\nconst SKIP = new Set(['node_modules', 'dist', 'out', '.turbo']);\nconst TEXT = new Set(['.ts', '.tsx', '.json', '.html', '.css', '.md']);\nconst KEEP_THEIRS = new Set(['README.md']);\nconst DEPENDENCIES = ['dependencies', 'devDependencies'] as const;\n\n// npm's rule for a package name.\nexport const validName = (name: string): boolean => /^[a-z0-9][a-z0-9._-]*$/.test(name) && name.length <= 214;\n\nconst filesIn = (dir: string, base = ''): string[] =>\n existsSync(join(dir, base))\n ? readdirSync(join(dir, base), { withFileTypes: true }).flatMap((entry) => {\n if (SKIP.has(entry.name)) return [];\n const rel = base === '' ? entry.name : `${base}/${entry.name}`;\n return entry.isDirectory() ? filesIn(dir, rel) : [rel];\n })\n : [];\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => value !== null && typeof value === 'object' && !Array.isArray(value);\n\n// An item's files, then its files for each other item the app is made of (`with/<other>/`).\nconst sourcesOf = (root: string, items: readonly Item[]): Map<string, { item: string; from: string }> => {\n const ids = new Set(items.map((item) => item.id));\n const sources = new Map<string, { item: string; from: string }>();\n for (const item of items) {\n const withDir = join(root, item.id, 'with');\n const others = existsSync(withDir) ? readdirSync(withDir) : [];\n for (const other of others) if (!existsSync(join(root, other, 'item.json'))) throw new Error(`create-nisc: ${item.id}/with/${other} is for \"${other}\", which is no item`);\n const dirs = [join(root, item.id, 'files'), ...others.filter((other) => ids.has(other)).map((other) => join(withDir, other))];\n for (const dir of dirs) {\n for (const rel of filesIn(dir)) {\n const there = sources.get(rel);\n if (there !== undefined) throw new Error(`create-nisc: ${rel} is written by both \"${there.item}\" and \"${item.id}\"`);\n sources.set(rel, { item: item.id, from: join(dir, rel) });\n }\n }\n }\n return sources;\n};\n\nconst pin = (name: string, spec: string, options: CreateOptions): string => {\n if (!spec.startsWith('workspace:') || options.workspace === true) return spec;\n const version = options.versions[name];\n if (version === undefined) throw new Error(`create-nisc: the nisc release has no ${name} — the set it was given is incomplete`);\n return `^${version}`;\n};\n\n// The parts' package fragments as one manifest: fields in the order they come, then the scripts, then the\n// dependencies sorted. Two parts that disagree about one field, script or dependency is a mistake in the templates.\nconst manifestOf = (parts: readonly Part[], options: CreateOptions): Record<string, unknown> => {\n const fields: Record<string, unknown> = {};\n const scripts: Record<string, string> = {};\n const deps: Record<(typeof DEPENDENCIES)[number], Record<string, string>> = { dependencies: {}, devDependencies: {} };\n const agree = (where: string, key: string, have: unknown, value: unknown): void => {\n if (have !== undefined && JSON.stringify(have) !== JSON.stringify(value)) throw new Error(`create-nisc: two items disagree about ${where} \"${key}\"`);\n };\n for (const fragment of parts.map((part) => part.package ?? {})) {\n for (const [key, value] of Object.entries(fragment)) {\n if (key === 'scripts' || key === 'dependencies' || key === 'devDependencies') {\n if (!isRecord(value)) throw new Error(`create-nisc: a package fragment's ${key} is not an object`);\n const into = key === 'scripts' ? scripts : deps[key];\n for (const [name, spec] of Object.entries(value)) {\n if (typeof spec !== 'string') throw new Error(`create-nisc: ${name} in ${key} is not a string`);\n agree(key, name, into[name], spec);\n into[name] = spec;\n }\n } else {\n agree('the package field', key, fields[key], value);\n fields[key] = value;\n }\n }\n }\n const sorted = (from: Record<string, string>): Record<string, string> =>\n Object.fromEntries(\n Object.keys(from)\n .sort()\n .map((name) => [name, pin(name, from[name] ?? '', options)]),\n );\n return {\n name: options.name,\n ...fields,\n ...(Object.keys(scripts).length > 0 ? { scripts } : {}),\n dependencies: sorted(deps.dependencies),\n devDependencies: sorted(deps.devDependencies),\n };\n};\n\nconst envValue = (name: string, options: CreateOptions): string => {\n const value = (options.env?.[name] ?? '').trim();\n if (/\\s/.test(value)) throw new Error(`create-nisc: the value given for ${name} has a space or a line break in it`);\n return value;\n};\n\n// `.env` with the values given, `.env.example` with the names alone. A choice keeps its value in both: it is not a\n// secret, and it says which keys follow.\nconst envFiles = (specs: readonly EnvSpec[], options: CreateOptions): { env: string; example: string; assigned: string[] } => {\n const env: string[] = [];\n const example: string[] = [];\n const assigned: string[] = [];\n const key = (spec: EnvKey): void => {\n const comment = `# ${spec.message}${spec.required === true ? ' (required)' : ''}`;\n const line = `${spec.name}=${envValue(spec.name, options)}`;\n env.push(comment, line);\n example.push(comment, `${spec.name}=`);\n assigned.push(line);\n };\n for (const spec of specs) {\n if (!isChoice(spec)) {\n key(spec);\n continue;\n }\n const value = envValue(spec.choose, options) || (spec.options[0]?.value ?? '');\n const option = spec.options.find((candidate) => candidate.value === value);\n if (option === undefined) throw new Error(`create-nisc: ${spec.choose} is one of ${spec.options.map((candidate) => candidate.value).join(', ')} — not \"${value}\"`);\n const comment = `# ${spec.message} (${spec.options.map((candidate) => candidate.value).join(' | ')})`;\n env.push(comment, `${spec.choose}=${value}`);\n example.push(comment, `${spec.choose}=${value}`);\n assigned.push(`${spec.choose}=${value}`);\n for (const inner of option.keys ?? []) key(inner);\n }\n return { env: `${env.join('\\n')}\\n`, example: `${example.join('\\n')}\\n`, assigned };\n};\n\nexport const generate = (options: CreateOptions): Created => {\n const catalog = readCatalog(options.templates ?? TEMPLATES);\n const items = itemsOf(catalog, options.picks);\n const parts = partsOf(items);\n if (!validName(options.name)) throw new Error(`create-nisc: \"${options.name}\" is not a package name (lowercase letters, digits, - . _)`);\n if (existsSync(options.dir) && !statSync(options.dir).isDirectory()) throw new Error(`create-nisc: ${options.dir} is a file`);\n\n const planned = new Map<string, string | Buffer>();\n for (const [rel, { from }] of sourcesOf(catalog.root, items)) {\n planned.set(rel, TEXT.has(extname(rel)) ? readFileSync(from, 'utf8').split(TOKEN).join(options.name) : readFileSync(from));\n }\n planned.set('package.json', `${JSON.stringify(manifestOf(parts, options), null, 2)}\\n`);\n\n const sections = items.flatMap((item) => {\n const path = join(catalog.root, item.id, 'agents-section.md');\n return existsSync(path) ? [readFileSync(path, 'utf8').split(TOKEN).join(options.name)] : [];\n });\n const facts = { name: options.name, today: options.today, nisc: options.versions['@niscorp/nisc'] ?? 'unknown', parts, agents: sections };\n planned.set('AGENTS.md', agentsDoc(facts));\n planned.set('PLAN.md', planDoc(facts));\n\n const specs = envOf(items);\n const envs = specs.length > 0 ? envFiles(specs, options) : undefined;\n if (envs !== undefined) planned.set('.env.example', envs.example);\n\n const there = (rel: string): boolean => existsSync(join(options.dir, rel));\n const kept = [...planned.keys()].filter((rel) => KEEP_THEIRS.has(rel) && there(rel));\n const collisions = [...planned.keys()].filter((rel) => !KEEP_THEIRS.has(rel) && there(rel)).sort();\n if (collisions.length > 0) {\n throw new Error(\n `create-nisc: ${options.dir} already has ${collisions.length === 1 ? 'a file' : 'files'} a new app would write — nothing was written:\\n ${collisions.join('\\n ')}\\nMake the app in an empty folder, or in a subfolder of this one.`,\n );\n }\n for (const rel of kept) planned.delete(rel);\n\n // A .gitignore or .env that is there is added to, never replaced: what it holds is theirs.\n const extended: string[] = [];\n const addTo = (rel: string, fresh: string, lines: readonly string[], has: (line: string, theirs: ReadonlySet<string>) => boolean): void => {\n const path = join(options.dir, rel);\n if (!existsSync(path)) {\n planned.set(rel, fresh);\n return;\n }\n const theirs = readFileSync(path, 'utf8');\n const have = new Set(theirs.split('\\n').map((line) => line.trim()));\n const missing = lines.filter((line) => !has(line, have));\n if (missing.length === 0) return;\n planned.set(rel, `${theirs.replace(/\\n*$/, '\\n')}${missing.join('\\n')}\\n`);\n extended.push(rel);\n };\n addTo('.gitignore', `${gitignoreLines.join('\\n')}\\n`, gitignoreLines, (line, have) => have.has(line));\n if (envs !== undefined) {\n const named = (line: string): string => line.slice(0, line.indexOf('=') + 1);\n addTo('.env', envs.env, envs.assigned, (line, have) => [...have].some((theirs) => theirs.startsWith(named(line))));\n }\n\n for (const [rel, content] of planned) {\n const to = join(options.dir, rel);\n mkdirSync(dirname(to), { recursive: true });\n writeFileSync(to, content);\n }\n return { files: [...planned.keys()].filter((rel) => !extended.includes(rel)).sort(), kept, extended };\n};\n","// Written in when this package is built (tsup.config.ts), never looked up:\n// \"whatever is newest on npm\" would be a set nobody tested the templates with.\ndeclare const __NISC_SET__: Readonly<Record<string, string>> | undefined;\n\nexport const testedSet = (): Readonly<Record<string, string>> => {\n if (typeof __NISC_SET__ === 'undefined') throw new Error('create-nisc: this copy was not built — it carries no nisc release to pin a new app to');\n return __NISC_SET__;\n};\n"]}
package/dist/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- import { readCatalog, TEMPLATES, validName, offered, itemsOf, envOf, isChoice, generate, testedSet } from './chunk-T7O6E5WE.js';
1
+ import { readCatalog, TEMPLATES, validName, offered, itemsOf, envOf, isChoice, generate, testedSet } from './chunk-RUHOVTHF.js';
2
2
  import { existsSync, readdirSync } from 'fs';
3
3
  import { basename, resolve, relative } from 'path';
4
4
  import { intro, text, confirm, cancel, select, note, outro, isCancel, password } from '@clack/prompts';
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { TEMPLATES, completed, generate, readCatalog, testedSet, validName } from './chunk-T7O6E5WE.js';
1
+ export { TEMPLATES, completed, generate, readCatalog, testedSet, validName } from './chunk-RUHOVTHF.js';
2
2
  //# sourceMappingURL=index.js.map
3
3
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nisc",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "description": "npm create nisc — a new nisc application: a few questions, then an app with the right structure, its rulebook, and a first screen that works.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -0,0 +1,15 @@
1
+ ---
2
+ name: nisc-reviewer
3
+ description: Reviews this nisc app against nisc's rules — reads replayed as vex entries, words in Prism, the charter gating what a person reaches, the kit domain-blind — and reports findings by rule number. Use it after each step of PLAN.md's order of work, and before a change is called done. Give it the output of `npm run typecheck` and `npm run check`, and say what changed since the last review.
4
+ tools: Read, Grep, Glob
5
+ ---
6
+
7
+ You review a nisc application. You read; you change nothing.
8
+
9
+ 1. Read `node_modules/@niscorp/nisc/REVIEW.md` in full. It is the guide for the nisc version this app has installed, and it says what to read, in what order, and how to report. Then read this app's `PLAN.md` and `AGENTS.md`.
10
+ 2. The gates come first. If the request holds the output of `npm run typecheck` and `npm run check`, a failure in it is your first finding. If it does not, say at the top of your report that the gates were not run, and review anyway.
11
+ 3. Take the counts in REVIEW.md's "Measure first" with Grep, and let them say where to read.
12
+ 4. Go through REVIEW.md's checklist and "What to look for". Where a finding needs a rule's exact words, read it in `node_modules/@niscorp/nisc/AGENTS.md`, or in a package's own docs under `node_modules/@niscorp/<name>/`.
13
+ 5. Verify every finding in the code before you report it: open the file and quote the line. A finding you could not verify is left out, or reported as a question.
14
+
15
+ Report in REVIEW.md's form: a verdict, then the findings ranked strong, medium, minor, each as `[rule] file:line — evidence — cost`, then briefly what is done right. If a review has been asked for a part of the app, review that part and say what you did not read.
@@ -23,6 +23,7 @@
23
23
  "docs": {
24
24
  "where": [
25
25
  "src/dev/ the checks (`npm run check`) — a new feature adds its own",
26
+ " shape-check.ts reads the app's shape (rulebook, \"Verification\"): each server function an action calls is named there with why, and each allowance with why",
26
27
  "nisc.config.ts how the app boots and how its screens are drawn, for the `nisc` command",
27
28
  "strata.lock.json the grammar versions the source is written at (rule 20) — moved only",
28
29
  " by `npm run strata verify`, never by hand"
@@ -0,0 +1,14 @@
1
+ import { fileURLToPath } from 'node:url';
2
+ import { runShapeCheck } from '@niscorp/cli/shape';
3
+ import { actions } from '../app/action-catalog';
4
+
5
+ process.exit(
6
+ runShapeCheck({
7
+ root: fileURLToPath(new URL('../..', import.meta.url)),
8
+ actions: Object.values(actions),
9
+ // Every server function an action calls (an `fn:` endpoint), and what it does that a vex read or write cannot.
10
+ functions: {},
11
+ // What the app is allowed, per rule, per file, each with why: { formatting: { 'src/server/today.ts': '…' } }.
12
+ allow: {},
13
+ }),
14
+ );
@@ -21,7 +21,7 @@
21
21
  ],
22
22
  "order": [
23
23
  "**The interview** — every open item above, answered or delegated by name. ← here",
24
- "**Scaffold** — done: the files `npm create nisc` wrote, one action rendering, and its checks (the artifacts, the grammar lock, the welcome screen).",
24
+ "**Scaffold** — done: the files `npm create nisc` wrote, one action rendering, and its checks (the artifacts, the shape, the grammar lock, the welcome screen).",
25
25
  "**Kit** — the primitives, against a kitchen-sink action; lock the look before any feature.",
26
26
  "**Data layer** — per D2/D3: schema, seed, entries; one read end to end.",
27
27
  "**Actions** — domain by domain: list → detail → form.",
@@ -2,6 +2,7 @@ import { spawnSync } from 'node:child_process';
2
2
 
3
3
  const CHECKS: readonly (readonly [name: string, what: string, args?: readonly string[]])[] = [
4
4
  ['artifacts-check', 'src/app is data: pure JSON, and every artifact parses its schema'],
5
+ ['shape-check', 'the app keeps nisc’s shape: no style-guide breaks, words in Prism, every server function an action calls named with its reason, src/app data, the kit within its own elements'],
5
6
  ['strata', 'the source is written at the installed grammars (strata.lock.json)', ['status', '--check']],
6
7
  ['welcome-check', 'the welcome screen: served, drawn, and pressed'],
7
8
  ];
@@ -2,6 +2,7 @@ import { spawnSync } from 'node:child_process';
2
2
 
3
3
  const CHECKS: readonly (readonly [name: string, what: string, args?: readonly string[]])[] = [
4
4
  ['artifacts-check', 'src/app is data: pure JSON, and every artifact parses its schema'],
5
+ ['shape-check', 'the app keeps nisc’s shape: no style-guide breaks, words in Prism, every server function an action calls named with its reason, src/app data, the kit within its own elements'],
5
6
  ['strata', 'the source is written at the installed grammars (strata.lock.json)', ['status', '--check']],
6
7
  ['welcome-check', 'the welcome screen: whole, and pressed'],
7
8
  ];
@@ -12,7 +12,7 @@ There is no chat history: the screen open when a message arrives is the conversa
12
12
  - **A message that gets no screen leaves the screen as it is,** and the line says why: the model's reply did not fit, it could not be reached, or there is no key.
13
13
  - **Jev may take 2 s and the model 8 s.** A Jev pass given up leaves the model to answer alone.
14
14
  - **Every message is recorded as a run for each model it went to,** through moss (`session.recordRun`): `nisc-template-app.jev` and `nisc-template-app.compose`, each with its provider and model, the tokens it spent (`reported: false` where signal estimated them), its steps and how long it took — for the composer, cortex's run meta — and whether it ended in an answer. The server logs a line for each (`src/server/runs/`).
15
- - **The app starts as a tour of nisc** (`src/app/actions/guide/`): five screens in the dock — a start, three lessons, and how to make it yours. Cards to read — points, an example in code, or steps, the text in the action's own data, no input — and cards to use: a counter, a checklist and a quick check, each with an input the model can fill. A card's link opens another screen at once, as the dock's buttons do; only what is typed, or a thing to ask pressed, goes to the model. What a person presses, ticks and picks stays on the screen; the model sees it, and can change it: "tick off the first step", "a counter that starts at 100", "quiz me on the charter". Its check is `src/dev/guide-check.ts`.
15
+ - **The app starts as a tour of nisc** (`src/app/actions/guide/`): five screens in the dock — a start, three lessons, and how to make it yours. Cards to read — points, an example in code, or steps, the text in the action's own data, no input; and one whose rows are read from a table, `guide.packages`, the shape your own reads take: a table whose rows a migration step writes (`src/db/schema.ts`), an entry whose Prism `mapping` words them (`src/app/vex/guide.entries.ts`), replayed by the action that shows them, granted in the charter — and cards to use: a counter, a checklist and a quick check, each with an input the model can fill. A card's link opens another screen at once, as the dock's buttons do; only what is typed, or a thing to ask pressed, goes to the model. What a person presses, ticks and picks stays on the screen; the model sees it, and can change it: "tick off the first step", "a counter that starts at 100", "quiz me on the charter". Its check is `src/dev/guide-check.ts`.
16
16
  - **An action you add is small, with one purpose:** it says what it shows (`description`), and declares what the model may open it with as a JSON Schema written with zod, every field described; the model's answers are checked against that same schema (`z.fromJSONSchema`). A read or a write it names must be one the app ships, asked with the values it takes. The ones the model may place are `placeable`, in `src/app/action-catalog.ts`.
17
17
  - **The model never presses anything.** It opens cards with an input — a form filled in — and only the person saves.
18
18
  - **The keys are in `.env`:** `GROQ_API_KEY` (gpt-oss-120b; without it, a message is answered with a notice saying so), and `TYPESAFE_API_KEY` (Jev; without it there is no Jev pass).
@@ -22,20 +22,21 @@ There is no chat history: the screen open when a message arrives is the conversa
22
22
 
23
23
  The tour is a starting point, there to be deleted. First the interview: PLAN.md's open items, each answered or delegated by name (the rulebook's "Before any code").
24
24
 
25
- **Remove the tour.** It lives in two places and is named in five:
25
+ **Remove the tour.** It lives in four places and is named in six:
26
26
 
27
- 1. Delete `src/app/actions/guide/` and `src/dev/guide-check.ts`.
27
+ 1. Delete `src/app/actions/guide/`, `src/dev/guide-check.ts` and `src/app/vex/guide.entries.ts`; in `src/db/schema.ts`, the tour's migration. Deleting a migration is safe only because no database that lasts has run it — the app runs on PGlite, which starts empty every boot. Once one has, the migration is history, and a table goes by appending a migration that drops it (rule 17).
28
28
  2. `src/app/action-catalog.ts`: drop the `GUIDE` import; `placeable` is `[]` until your own actions are in it.
29
- 3. `src/app/charter/charter.ts`: drop `'guide.*'`.
30
- 4. `src/dev/all-checks.ts`: drop the `guide-check` line.
31
- 5. `src/app/screens.ts`: everything below its two types — your screens instead of the tour's. Until there are actions, one screen of words will do:
29
+ 3. `src/app/charter/charter.ts`: drop `'guide.*'` and `'packages.read'`.
30
+ 4. `src/app/vex/index.ts`: drop the `guidePackages` import; `ENTRIES` is `[]` until your own entries are in it.
31
+ 5. `src/dev/all-checks.ts`: drop the `guide-check` line.
32
+ 6. `src/app/screens.ts`: everything below its two types — your screens instead of the tour's. Until there are actions, one screen of words will do:
32
33
  ```ts
33
34
  export const SCREENS: readonly [Screen, ...Screen[]] = [
34
35
  { id: 'start', label: 'Start', description: 'What this app is.', arrangement: 'single', canvases: [{ action: 'answer.text', input: { title: 'The app', text: 'What it is, in a sentence.' }, intent: 'what this app is' }] },
35
36
  ];
36
37
  ```
37
- 6. `src/dev/live-ask.ts`: your cases in `RUN` instead of the tour's, and the helpers only its cases use (`at`, `listOf`, `tour`).
38
- 7. This file: the tour's rows under "Where things go", its paragraph above, and this list; PLAN.md: the tour in D3 and in the order of work. `npm run check` passes again.
38
+ 7. `src/dev/live-ask.ts`: your cases in `RUN` instead of the tour's, and the helpers only its cases use (`at`, `listOf`, `tour`).
39
+ 8. This file: the tour's rows under "Where things go", its paragraph above, and this list; PLAN.md: the tour in D3 and in the order of work. `npm run check` passes again.
39
40
 
40
41
  What stays is the app: the message loop, the dock, the arrangements, the kit, and `compose-check`, which needs nothing of the tour.
41
42
 
@@ -2,6 +2,7 @@ import type { ActionDefinition, LayoutNode, TriggerConfig } from '@niscorp/nova'
2
2
  import { checklistAction } from './checklist.action';
3
3
  import { counterAction } from './counter.action';
4
4
  import { askLayout, exampleLayout, pointsLayout, stepsLayout, welcomeLayout } from './guide.layouts';
5
+ import { packagesAction } from './packages.action';
5
6
  import { quizAction } from './quiz.action';
6
7
 
7
8
  type Link = { label: string; screen: string };
@@ -92,21 +93,23 @@ export const GUIDE: readonly ActionDefinition[] = [
92
93
  { title: 'Rules on the server', text: 'What you may do is decided there, never in the browser.' },
93
94
  ],
94
95
  }),
95
- card('guide.data', 'Reads and writes: vex queries and mutations written as JSON, replayed by their fingerprint and run under the person’s policy; an example read.', exampleLayout, {
96
+ card('guide.data', 'Reads and writes: vex queries and mutations written as JSON, replayed by their fingerprint and run under the person’s policy; the read behind the packages card as the example.', exampleLayout, {
96
97
  title: 'Reads and writes',
97
98
  lead: 'Data comes through vex: a read is a query written as JSON, replayed by its fingerprint.',
98
99
  example: [
99
100
  '{',
100
- ' "fingerprint": "notes/list",',
101
- ' "intent": "Every note, newest first",',
101
+ ' "fingerprint": "guide/packages",',
102
+ ' "intent": "Every nisc package with what it is for",',
102
103
  ' "dsl": {',
103
- ' "from": ["notes"],',
104
- ' "sort": [{ "field": "notes.created_at", "dir": "desc" }],',
105
- ' "limit": 100',
106
- ' }',
104
+ ' "from": ["packages"],',
105
+ ' "fields": ["packages.name", "packages.purpose"],',
106
+ ' "sort": [{ "field": "packages.position", "dir": "asc" }],',
107
+ ' "limit": 20',
108
+ ' },',
109
+ ' "mapping": { "$map": { … "@niscorp/{{name}}" … } }',
107
110
  '}',
108
111
  ].join('\n'),
109
- text: 'A write is the same, as a mutation. Both run under the person’s policy; yours go in src/app/vex/.',
112
+ text: 'That is the read behind the packages card, in src/app/vex/; its mapping, in Prism, words each row. A write is the same, as a mutation. Both run under the person’s policy.',
110
113
  }),
111
114
  card('guide.charter', 'The charter: which actions, data and server functions each role may reach, decided on the server; this app’s own charter as the example.', exampleLayout, {
112
115
  title: 'The charter',
@@ -115,7 +118,7 @@ export const GUIDE: readonly ActionDefinition[] = [
115
118
  '{',
116
119
  ' "public": {',
117
120
  ' "actions": ["ask.*", "answer.*", "guide.*"],',
118
- ' "data": [],',
121
+ ' "data": ["packages.read"],',
119
122
  ' "functions": [',
120
123
  ' "ask", "screens.open", "answers.current",',
121
124
  ' "answers.back", "answers.forward", "answers.go"',
@@ -138,6 +141,7 @@ export const GUIDE: readonly ActionDefinition[] = [
138
141
  ],
139
142
  links: [{ label: 'Back to the start →', screen: 'start' }],
140
143
  }),
144
+ packagesAction,
141
145
  counterAction,
142
146
  checklistAction,
143
147
  quizAction,
@@ -0,0 +1,18 @@
1
+ import type { ActionDefinition } from '@niscorp/nova';
2
+ import { guidePackages } from '../../vex/guide.entries';
3
+ import { pointsLayout } from './guide.layouts';
4
+
5
+ export const packagesAction: ActionDefinition = {
6
+ id: 'guide.packages',
7
+ title: 'nisc’s packages',
8
+ description: 'nisc’s packages, each with what it is for: a read of this app’s own table, replayed through vex, each row worded by the read’s Prism mapping.',
9
+ data: {
10
+ title: 'nisc’s packages',
11
+ lead: 'This card is a read: the rows come from the packages table through vex, worded by the read’s mapping.',
12
+ points: [],
13
+ links: [],
14
+ },
15
+ layout: pointsLayout,
16
+ endpoints: { load: { url: '/api/vex', method: 'POST', request: { fingerprint: guidePackages.fingerprint, context: {} }, target: 'points' } },
17
+ lifecycle: { mount: [{ call: 'load' }] },
18
+ };
@@ -4,7 +4,7 @@ import type { Charter } from '@niscorp/charter';
4
4
  export const charter: Charter = {
5
5
  public: {
6
6
  actions: ['ask.*', 'answer.*', 'guide.*'],
7
- data: [],
7
+ data: ['packages.read'],
8
8
  functions: ['ask', 'screens.open', 'answers.back', 'answers.forward', 'answers.go', 'answers.current'],
9
9
  },
10
10
  };
@@ -61,12 +61,13 @@ export const SCREENS: readonly [Screen, ...Screen[]] = [
61
61
  {
62
62
  id: 'rules',
63
63
  label: 'Rules',
64
- description: 'Lesson 3: the charter, the shell on the server, reads and writes, and a quick check.',
64
+ description: 'Lesson 3: the charter, the shell on the server, reads and writes, a read from a table, and a quick check.',
65
65
  arrangement: 'grid',
66
66
  canvases: [
67
67
  card('guide.charter', 'what the charter decides'),
68
68
  card('guide.shell', 'what the shell and moss are'),
69
69
  card('guide.data', 'how reads and writes work'),
70
+ card('guide.packages', 'a read from a table: nisc’s packages'),
70
71
  quiz('Where is it decided what you may do?', ['In the browser', 'On the server, by the charter', 'In each card'], 1, 'Your browser only draws; the charter decides, on the server, what a role may reach.'),
71
72
  ],
72
73
  },
@@ -0,0 +1,23 @@
1
+ import type { SeedEntry } from '@niscorp/vex';
2
+
3
+ export const guidePackages: SeedEntry = {
4
+ fingerprint: 'guide/packages',
5
+ intent: 'Every nisc package with what it is for, in the order the tour names them',
6
+ shape: [{ title: '', text: '' }],
7
+ dsl: {
8
+ from: ['packages'],
9
+ fields: ['packages.name', 'packages.purpose'],
10
+ sort: [{ field: 'packages.position', dir: 'asc' }],
11
+ limit: 20,
12
+ },
13
+ mapping: {
14
+ $map: {
15
+ over: { $ref: '$.result' },
16
+ as: 'package',
17
+ body: {
18
+ title: { $interpolate: { template: '@niscorp/{{name}}', values: { $var: 'package' } } },
19
+ text: { $get: { from: { $var: 'package' }, path: ['purpose'] } },
20
+ },
21
+ },
22
+ },
23
+ };
@@ -1,3 +1,4 @@
1
1
  import type { SeedEntry, SeedMutation } from '@niscorp/vex';
2
+ import { guidePackages } from './guide.entries';
2
3
 
3
- export const ENTRIES: readonly (SeedEntry | SeedMutation)[] = [];
4
+ export const ENTRIES: readonly (SeedEntry | SeedMutation)[] = [guidePackages];
@@ -1,3 +1,29 @@
1
+ import { sqlSteps } from '@niscorp/strata';
1
2
  import type { Sequence } from '@niscorp/strata';
2
3
 
3
- export const APP_SEQUENCE: Sequence = { id: 'nisc-template-app.app', migrations: [] };
4
+ const GUIDE_PACKAGES = /* sql */ `
5
+ CREATE TABLE packages (
6
+ package_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
7
+ name TEXT NOT NULL UNIQUE,
8
+ purpose TEXT NOT NULL,
9
+ position INTEGER NOT NULL
10
+ );
11
+ INSERT INTO packages (name, purpose, position) VALUES
12
+ ('nova', 'The screen: shells, canvases, actions and their layouts.', 1),
13
+ ('moss', 'The app server: a shell for each person, the charter enforced, the socket.', 2),
14
+ ('vex', 'Reads and writes written as JSON, replayed by their fingerprint.', 3),
15
+ ('prism', 'Every transform: data shaped and worded, as JSON.', 4),
16
+ ('charter', 'Who may reach which actions, data and functions.', 5),
17
+ ('strata', 'Versions: tables and documents moved forward by migrations.', 6),
18
+ ('tide', 'Automations: the clock, a write or a signal turned into one effect.', 7),
19
+ ('loom', 'A form compiled from a schema.', 8),
20
+ ('signal', 'Calls to a model.', 9),
21
+ ('cortex', 'Agents: a model call checked, retried and recorded.', 10),
22
+ ('solid', 'A model’s structured answer streamed onto the screen.', 11),
23
+ ('cli', 'The nisc command: dev, build, start and check.', 12);
24
+ `;
25
+
26
+ export const APP_SEQUENCE: Sequence = {
27
+ id: 'nisc-template-app.app',
28
+ migrations: [{ description: 'The tour’s packages: nisc’s packages, each with what it is for', steps: sqlSteps(GUIDE_PACKAGES) }],
29
+ };
@@ -2,6 +2,7 @@ import { spawnSync } from 'node:child_process';
2
2
 
3
3
  const CHECKS: readonly (readonly [name: string, what: string, args?: readonly string[]])[] = [
4
4
  ['artifacts-check', 'src/app is data: pure JSON, every artifact parses its schema, every screen canvas opens an action with an input it takes'],
5
+ ['shape-check', 'the app keeps nisc’s shape: no style-guide breaks, words in Prism, every server function an action calls named with its reason, src/app data, the kit within its own elements'],
5
6
  ['strata', 'the source is written at the installed grammars (strata.lock.json)', ['status', '--check']],
6
7
  ['compose-check', 'a message is answered with a screen: the open screen read, picked, composed, checked, placed, written, and back again'],
7
8
  ['guide-check', 'the tour: its cards pressed, ticked and picked, its links, and what the model sees and changes of them'],
@@ -67,6 +67,12 @@ try {
67
67
  check('a screen gone back to is as the person left it', on('b').data['count'] === 2 && rows('d', 'done').join() === 'Press the counter' && on('c').data['picked'] === 1, `${JSON.stringify(on('b').data)} ${JSON.stringify(on('d').data)}`);
68
68
  await app.openScreen('asking');
69
69
  check('another quick check where an answered one was opens unanswered', on('c').action === 'guide.quiz' && on('c').data['picked'] === -1, JSON.stringify(on('c').data));
70
+ await app.openScreen('rules');
71
+ check(
72
+ 'the packages card replays its read: every row of the table, in order, worded by the read’s mapping',
73
+ on('d').action === 'guide.packages' && (await until(() => rows('d', 'points').length === 12)) && JSON.stringify(rows('d', 'points')[0]) === JSON.stringify({ title: '@niscorp/nova', text: 'The screen: shells, canvases, actions and their layouts.' }),
74
+ JSON.stringify(on('d').data).slice(0, 300),
75
+ );
70
76
  await app.openScreen('start');
71
77
 
72
78
  const counterId = on('b').id;
@@ -0,0 +1,23 @@
1
+ import { fileURLToPath } from 'node:url';
2
+ import { runShapeCheck } from '@niscorp/cli/shape';
3
+ import { actions } from '../app/action-catalog';
4
+ import { ENTRIES } from '../app/vex';
5
+
6
+ process.exit(
7
+ runShapeCheck({
8
+ root: fileURLToPath(new URL('../..', import.meta.url)),
9
+ actions: Object.values(actions),
10
+ entries: ENTRIES,
11
+ // Every server function an action calls (an `fn:` endpoint), and what it does that a vex read or write cannot.
12
+ functions: {
13
+ ask: 'the model composes the answer to a message',
14
+ 'screens.open': 'the screens shown live in the person’s shell, not in rows',
15
+ 'answers.back': 'the answers given live in the person’s shell, not in rows',
16
+ 'answers.forward': 'the answers given live in the person’s shell, not in rows',
17
+ 'answers.go': 'the answers given live in the person’s shell, not in rows',
18
+ 'answers.current': 'the answers given live in the person’s shell, not in rows',
19
+ },
20
+ // What the app is allowed, per rule, per file, each with why: { formatting: { 'src/server/today.ts': '…' } }.
21
+ allow: {},
22
+ }),
23
+ );
@@ -46,10 +46,11 @@
46
46
  " index.ts the functions the dock calls",
47
47
  "src/server/models/ the models, from .env",
48
48
  "src/server/runs/ each model's part in a message recorded as a run, and the line the server logs for it",
49
- "src/db/ your tables, as a strata sequence (none yet)"
49
+ "src/app/vex/ your reads and writes, one file of entries per entity — the tour's read, `guide/packages`, until the tour goes",
50
+ "src/db/ your tables, as a strata sequence — the tour's `packages` until the tour goes"
50
51
  ],
51
52
  "decisions": [
52
- "| D3 Reads | answered | **Vex entries**, read by an action by its fingerprint (`/api/vex`), under the person's policy. None yet: the tour the app starts with is text in its actions. |",
53
+ "| D3 Reads | answered | **Vex entries**, read by an action by its fingerprint (`/api/vex`), under the person's policy. One so far: the tour's packages card replays `guide/packages`, its rows worded by the entry's Prism mapping (`src/app/vex/guide.entries.ts`). |",
53
54
  "| D4 Writes | answered | **Vex mutation entries**, posted to `/api/vex` by a form the person saves, never by the model. None yet. |",
54
55
  "| D6 Who answers a message | answered | Jev reads the message and the open screen (`TYPESAFE_API_KEY`), then gpt-oss-120b on Groq composes the screen as a cortex agent (`GROQ_API_KEY`), with what Jev picked as a hint. Without a TypeSafe key there is no Jev pass. Jev may take 2 s and the model 8 s; past that, the model answers alone, or the line says it could not be reached and the screen stays as it is. Measured on the tour's cases (`src/dev/live-ask.ts --runs=2`): 30/32 right with Jev, 31/32 without, and about 200 ms slower with it. |",
55
56
  "| D7 What a screen is made of | answered | Canvases: an action the model may place (`placeable`, in `src/app/action-catalog.ts`), opened with an input its schema takes, and why it is there; or words. Up to six, on the areas `a`–`f`; the screens in the dock are canvases too (`src/app/screens.ts`). |",
@@ -73,8 +74,8 @@
73
74
  ],
74
75
  "order": [
75
76
  "**The interview** — every open item above, answered or delegated by name. ← here",
76
- "**Scaffold** — done: the frame, the message loop, the dock, a tour of nisc in five screens — cards to read, and a counter, a checklist and a quick check to use, which the model can fill in too — and their checks.",
77
- "**Data** — the tour goes first (AGENTS.md, \"How to proceed from here\"); then, per D2/D3, your tables in `src/db/schema.ts`, your reads in `src/app/vex/`.",
77
+ "**Scaffold** — done: the frame, the message loop, the dock, a tour of nisc in five screens — cards to read, one of them a read of a table through vex, and a counter, a checklist and a quick check to use, which the model can fill in too — and their checks.",
78
+ "**Data** — the tour goes first (AGENTS.md, \"How to proceed from here\"); then, per D2/D3, your tables in `src/db/schema.ts`, your reads in `src/app/vex/`, each replayed by the action that shows it, its words in the entry's `mapping` — as the tour's packages card does.",
78
79
  "**Actions** — your own, small: one purpose each, a description that says what it shows, an `input` schema for what the model fills in; the ones the model may place in `placeable`, each granted in the charter.",
79
80
  "**Screens** — the ones a person will want in the dock, each its canvases; the first the one the app opens on.",
80
81
  "**Writes** — per D4; a form an answer opens, filled in by the model, saved by the person.",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["%3Cdefine:__NISC_SET__%3E","../src/catalog/items.ts","../src/catalog/choose.ts","../src/docs.ts","../src/generate.ts","../src/set.ts"],"names":["offered","existsSync","join","readdirSync","isRecord","readFileSync","sections"],"mappings":";;;;;AAAA,IAAA,uBAAA,GAAA,EAAC,kBAAA,EAAmB,OAAA,EAAQ,cAAA,EAAe,OAAA,EAAQ,iBAAA,EAAkB,SAAQ,eAAA,EAAgB,OAAA,EAAQ,eAAA,EAAgB,OAAA,EAAQ,eAAA,EAAgB,OAAA,EAAQ,iBAAgB,OAAA,EAAQ,gBAAA,EAAiB,OAAA,EAAQ,iBAAA,EAAkB,OAAA,EAAQ,gBAAA,EAAiB,OAAA,EAAQ,iBAAA,EAAkB,OAAA,EAAQ,eAAA,EAAgB,OAAA,EAAQ,cAAA,EAAe,OAAA,EAAO;ACwCjU,IAAM,QAAA,GAAW,CAAC,KAAA,KAAqD,KAAA,KAAU,IAAA,IAAQ,OAAO,KAAA,KAAU,QAAA,IAAY,CAAC,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA;AAE1I,IAAM,IAAA,GAAO,CAAC,IAAA,KAA0B;AACtC,EAAA,IAAI;AACF,IAAA,OAAO,IAAA,CAAK,KAAA,CAAM,YAAA,CAAa,IAAA,EAAM,MAAM,CAAC,CAAA;AAAA,EAC9C,SAAS,KAAA,EAAO;AACd,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,aAAA,EAAgB,IAAI,CAAA,oBAAA,EAAkB,KAAA,YAAiB,KAAA,GAAQ,KAAA,CAAM,OAAA,GAAU,MAAA,CAAO,KAAK,CAAC,CAAA,CAAE,CAAA;AAAA,EAChH;AACF,CAAA;AAEO,IAAM,QAAA,GAAW,CAAC,IAAA,KAAqC,QAAA,IAAY;AAGnE,IAAM,WAAA,GAAc,CAAC,IAAA,KAA0B;AACpD,EAAA,MAAM,SAAA,GAAY,IAAA,CAAK,IAAA,CAAK,IAAA,EAAM,gBAAgB,CAAC,CAAA;AACnD,EAAA,IA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A,MAAW,CAAC,GAAA,EAAK,OAAO,CAAA,IAAK,OAAA,EAAS;AACpC,IAAA,MAAM,EAAA,GAAKH,IAAAA,CAAK,OAAA,CAAQ,GAAA,EAAK,GAAG,CAAA;AAChC,IAAA,SAAA,CAAU,QAAQ,EAAE,CAAA,EAAG,EAAE,SAAA,EAAW,MAAM,CAAA;AAC1C,IAAA,aAAA,CAAc,IAAI,OAAO,CAAA;AAAA,EAC3B;AACA,EAAA,OAAO,EAAE,OAAO,CAAC,GAAG,QAAQ,IAAA,EAAM,EAAE,MAAA,CAAO,CAAC,QAAQ,CAAC,QAAA,CAAS,SAAS,GAAG,CAAC,EAAE,IAAA,EAAK,EAAG,MAAM,QAAA,EAAS;AACtG;;;AClNO,IAAM,YAAY,MAAwC;AAC/D,EAAA,IAAI,OAAO,uBAAA,KAAiB,WAAA,EAAa,MAAM,IAAI,MAAM,4FAAuF,CAAA;AAChJ,EAAA,OAAO,uBAAA;AACT","file":"chunk-T7O6E5WE.js","sourcesContent":["{\"@niscorp/charter\":\"0.1.4\",\"@niscorp/cli\":\"0.9.0\",\"@niscorp/cortex\":\"0.1.5\",\"@niscorp/loom\":\"0.5.0\",\"@niscorp/moss\":\"0.9.0\",\"@niscorp/nisc\":\"0.9.0\",\"@niscorp/nova\":\"0.5.1\",\"@niscorp/prism\":\"0.3.2\",\"@niscorp/signal\":\"0.1.8\",\"@niscorp/solid\":\"0.1.2\",\"@niscorp/strata\":\"0.1.8\",\"@niscorp/tide\":\"0.1.9\",\"@niscorp/vex\":\"0.4.3\"}","import { existsSync, readdirSync, readFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nexport type EnvKey = { name: string; message: string; required?: boolean };\nexport type EnvOption = { value: string; label: string; hint?: string; keys?: readonly EnvKey[] };\nexport type EnvChoice = { choose: string; message: string; options: readonly EnvOption[] };\nexport type EnvSpec = EnvKey | EnvChoice;\n\nexport type Docs = {\n is?: string;\n where?: readonly string[];\n runs?: readonly string[];\n decisions?: readonly string[];\n answered?: readonly string[];\n open?: readonly string[];\n order?: readonly string[];\n};\n\nexport type Part = {\n package?: Readonly<Record<string, unknown>>;\n env?: readonly EnvSpec[];\n docs?: Docs;\n};\n\nexport type Item = Part & {\n id: string;\n answers?: string;\n label?: string;\n hint?: string;\n usage?: string;\n summary?: string;\n default?: boolean;\n requires?: Readonly<Record<string, string>>;\n with?: Readonly<Record<string, Part>>;\n};\n\nexport type Question = { id: string; message: string };\n\nexport type Catalog = { root: string; questions: readonly Question[]; items: readonly Item[] };\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => value !== null && typeof value === 'object' && !Array.isArray(value);\n\nconst json = (path: string): unknown => {\n try {\n return JSON.parse(readFileSync(path, 'utf8'));\n } catch (error) {\n throw new Error(`create-nisc: ${path} is not JSON — ${error instanceof Error ? error.message : String(error)}`);\n }\n};\n\nexport const isChoice = (spec: EnvSpec): spec is EnvChoice => 'choose' in spec;\n\n// The templates are ours, so a mistake in them is a bug: it is refused here with a sentence, before anything is written.\nexport const readCatalog = (root: string): Catalog => {\n const questions = json(join(root, 'questions.json'));\n if (!Array.isArray(questions) || !questions.every((q) => isRecord(q) && typeof q['id'] === 'string' && typeof q['message'] === 'string')) {\n throw new Error(`create-nisc: ${root}/questions.json is not a list of { id, message }`);\n }\n const items: Item[] = readdirSync(root, { withFileTypes: true })\n .filter((entry) => entry.isDirectory() && existsSync(join(root, entry.name, 'item.json')))\n .map((entry) => {\n const item = json(join(root, entry.name, 'item.json'));\n if (!isRecord(item) || item['id'] !== entry.name) throw new Error(`create-nisc: ${entry.name}/item.json must say \"id\": \"${entry.name}\"`);\n return item as Item;\n });\n\n const asked = new Set((questions as Question[]).map((q) => q.id));\n const known = new Set(items.map((item) => item.id));\n const answering = (question: string): Item[] => items.filter((item) => item.answers === question);\n for (const item of items) {\n if (item.answers !== undefined && !asked.has(item.answers)) throw new Error(`create-nisc: item \"${item.id}\" answers \"${item.answers}\", which questions.json does not ask`);\n if (item.answers !== undefined && item.label === undefined) throw new Error(`create-nisc: item \"${item.id}\" answers a question but has no label to offer`);\n for (const [question, wanted] of Object.entries(item.requires ?? {})) {\n if (!answering(question).some((other) => other.id === wanted)) throw new Error(`create-nisc: item \"${item.id}\" requires \"${wanted}\" for \"${question}\", which no item answering it is`);\n }\n for (const other of Object.keys(item.with ?? {})) if (!known.has(other)) throw new Error(`create-nisc: item \"${item.id}\" has a part for \"${other}\", which is no item`);\n }\n for (const question of questions as Question[]) {\n const offered = answering(question.id);\n if (offered.length === 0) throw new Error(`create-nisc: nothing answers \"${question.id}\"`);\n if (offered.filter((item) => item.default === true).length !== 1) throw new Error(`create-nisc: exactly one item answering \"${question.id}\" is its default`);\n }\n return { root, questions: questions as Question[], items };\n};\n","import type { Catalog, EnvSpec, Item, Part } from './items';\n\n// Question id → the id of the item that answers it.\nexport type Picks = Readonly<Record<string, string>>;\n\nconst itemNamed = (catalog: Catalog, id: string): Item | undefined => catalog.items.find((item) => item.id === id);\n\n// What the items picked so far say other questions must be answered with.\nexport const impliedBy = (catalog: Catalog, picks: Picks): Record<string, string> => {\n const implied: Record<string, string> = {};\n for (const id of Object.values(picks)) Object.assign(implied, itemNamed(catalog, id)?.requires ?? {});\n return implied;\n};\n\n// The items that can still answer a question, beside what is picked.\nexport const offered = (catalog: Catalog, question: string, picks: Picks): Item[] => {\n const implied = impliedBy(catalog, picks)[question];\n return catalog.items.filter(\n (item) =>\n item.answers === question &&\n (implied === undefined || implied === item.id) &&\n Object.entries(item.requires ?? {}).every(([other, wanted]) => picks[other] === undefined || picks[other] === wanted),\n );\n};\n\n// Answers every question the picks leave open the way a person who takes the defaults would.\nexport const completed = (catalog: Catalog, picks: Picks): Record<string, string> => {\n const done: Record<string, string> = { ...picks };\n for (const question of catalog.questions) {\n if (done[question.id] !== undefined) continue;\n const choices = offered(catalog, question.id, done);\n const chosen = choices.find((item) => item.default === true) ?? choices[0];\n if (chosen === undefined) throw new Error(`create-nisc: nothing can answer \"${question.message}\" beside ${Object.values(done).join(', ')}`);\n done[question.id] = chosen.id;\n }\n return done;\n};\n\n// The items an app is made of: the one answering each question, in the order they are asked, then the ones every\n// app has. Refused when a question is unanswered or an item's requirement is not met.\nexport const itemsOf = (catalog: Catalog, picks: Picks): Item[] => {\n const answering = catalog.questions.map((question) => {\n const id = picks[question.id];\n const item = id === undefined ? undefined : itemNamed(catalog, id);\n if (item === undefined || item.answers !== question.id) throw new Error(`create-nisc: \"${question.message}\" has no answer${id === undefined ? '' : ` — \"${id}\" does not answer it`}`);\n return item;\n });\n for (const item of answering) {\n for (const [question, wanted] of Object.entries(item.requires ?? {})) {\n if (picks[question] !== wanted) throw new Error(`create-nisc: \"${item.id}\" needs \"${wanted}\", not \"${picks[question] ?? 'nothing'}\"`);\n }\n }\n return [...answering, ...catalog.items.filter((item) => item.answers === undefined)];\n};\n\n// Each item's own part, followed by its part for every other item the app is made of.\nexport const partsOf = (items: readonly Item[]): Part[] => {\n const ids = new Set(items.map((item) => item.id));\n return items.flatMap((item) => [item, ...Object.entries(item.with ?? {}).flatMap(([other, part]) => (ids.has(other) ? [part] : []))]);\n};\n\nexport const envOf = (items: readonly Item[]): EnvSpec[] => partsOf(items).flatMap((part) => part.env ?? []);\n","import type { Part } from './catalog';\n\nexport type DocFacts = {\n name: string;\n today: string;\n nisc: string;\n parts: readonly Part[];\n // The sections items add to AGENTS.md, each from its own agents-section.md.\n agents: readonly string[];\n};\n\nconst all = <K extends 'is' | 'where' | 'runs' | 'decisions' | 'answered' | 'open' | 'order'>(parts: readonly Part[], key: K): string[] =>\n parts.flatMap((part) => {\n const value = part.docs?.[key];\n return value === undefined ? [] : typeof value === 'string' ? [value] : [...value];\n });\n\nconst decisionNumber = (row: string): number => Number(/^\\| D(\\d+) /.exec(row)?.[1] ?? Number.POSITIVE_INFINITY);\n\nconst sections = (texts: readonly string[]): string => texts.map((text) => `\\n${text.trim()}\\n`).join('');\n\nexport const agentsDoc = (facts: DocFacts): string => {\n const [first = 'a nisc application', ...rest] = all(facts.parts, 'is');\n return `# ${facts.name}\n\nA nisc application. **The rules it is built by are \\`node_modules/@niscorp/nisc/AGENTS.md\\`** — read all of it before changing anything here (it is there once the app's dependencies are installed). It is the rulebook for the nisc version this app has installed, and \\`STYLE_GUIDE.md\\` sits beside it. The grammars it names — a layout node, an \\`ActionDefinition\\`, a Prism config, a charter, a Vex DSL — are in each package's own \\`README.md\\` and \\`DESIGN.md\\`, under \\`node_modules/@niscorp/<name>/\\`.\n\nWhat is particular to this app:\n\n- **Its decisions are in PLAN.md.** What was answered when it was made, what was derived, and what is still open. An open decision point is asked before anything is built on it, never resolved silently.\n- **It is ${first}**${rest.map((clause) => `, ${clause}`).join('')}.\n- **Where things go:**\n\n\\`\\`\\`\n${all(facts.parts, 'where').join('\\n')}\n\\`\\`\\`\n\n- **How it runs:** ${all(facts.parts, 'runs').join(', ')} — all of them the \\`nisc\\` command — and \\`npm run strata status\\` for the grammars.\n${sections(facts.agents)}`;\n};\n\nexport const planDoc = (facts: DocFacts): string => `# PLAN — ${facts.name}\n\nMade ${facts.today} by \\`npm create nisc\\`, on nisc ${facts.nisc}. This is the record AGENTS.md's interview asks for (\"Before any code\"). The walkthrough asked what shapes the files; everything else is **open**, and an open decision blocks the build that depends on it until it is answered by the user or delegated by name. A blanket \"go\" delegates nothing.\n\n## Decision points\n\n| | Tier | |\n|---|---|---|\n${all(facts.parts, 'decisions')\n .sort((a, b) => decisionNumber(a) - decisionNumber(b))\n .join('\\n')}\n\n## Answered when it was made\n\n${all(facts.parts, 'answered')\n .map((line) => `- ${line}`)\n .join('\\n')}\n\n## The dial-in — open\n\n${all(facts.parts, 'open')\n .map((line) => `- ${line}`)\n .join('\\n')}\n\n## Order of work\n\n${all(facts.parts, 'order')\n .map((line, at) => `${at + 1}. ${line}`)\n .join('\\n')}\n`;\n\nexport const gitignoreLines = ['node_modules/', 'dist/', 'out/', '.strata/', '*.tsbuildinfo', '.env', '.env.*', '!.env.example'];\n","import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';\nimport { dirname, extname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { envOf, isChoice, itemsOf, partsOf, readCatalog } from './catalog';\nimport type { EnvKey, EnvSpec, Item, Part, Picks } from './catalog';\nimport { agentsDoc, gitignoreLines, planDoc } from './docs';\n\nexport type CreateOptions = {\n dir: string;\n name: string;\n picks: Picks;\n // The values given for the keys the items ask for, by variable name. A key left out is written empty.\n env?: Readonly<Record<string, string>>;\n versions: Readonly<Record<string, string>>;\n // Depend on the nisc packages of the workspace the app is made in, for an app inside the nisc repository.\n workspace?: boolean;\n // YYYY-MM-DD\n today: string;\n templates?: string;\n};\n\nexport type Created = {\n files: string[];\n kept: string[];\n extended: string[];\n};\n\nexport const TEMPLATES = fileURLToPath(new URL('../templates', import.meta.url));\n\nconst TOKEN = 'nisc-template-app';\nconst SKIP = new Set(['node_modules', 'dist', 'out', '.turbo']);\nconst TEXT = new Set(['.ts', '.tsx', '.json', '.html', '.css', '.md']);\nconst KEEP_THEIRS = new Set(['README.md']);\nconst DEPENDENCIES = ['dependencies', 'devDependencies'] as const;\n\n// npm's rule for a package name.\nexport const validName = (name: string): boolean => /^[a-z0-9][a-z0-9._-]*$/.test(name) && name.length <= 214;\n\nconst filesIn = (dir: string, base = ''): string[] =>\n existsSync(join(dir, base))\n ? readdirSync(join(dir, base), { withFileTypes: true }).flatMap((entry) => {\n if (SKIP.has(entry.name)) return [];\n const rel = base === '' ? entry.name : `${base}/${entry.name}`;\n return entry.isDirectory() ? filesIn(dir, rel) : [rel];\n })\n : [];\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => value !== null && typeof value === 'object' && !Array.isArray(value);\n\n// An item's files, then its files for each other item the app is made of (`with/<other>/`).\nconst sourcesOf = (root: string, items: readonly Item[]): Map<string, { item: string; from: string }> => {\n const ids = new Set(items.map((item) => item.id));\n const sources = new Map<string, { item: string; from: string }>();\n for (const item of items) {\n const withDir = join(root, item.id, 'with');\n const others = existsSync(withDir) ? readdirSync(withDir) : [];\n for (const other of others) if (!existsSync(join(root, other, 'item.json'))) throw new Error(`create-nisc: ${item.id}/with/${other} is for \"${other}\", which is no item`);\n const dirs = [join(root, item.id, 'files'), ...others.filter((other) => ids.has(other)).map((other) => join(withDir, other))];\n for (const dir of dirs) {\n for (const rel of filesIn(dir)) {\n const there = sources.get(rel);\n if (there !== undefined) throw new Error(`create-nisc: ${rel} is written by both \"${there.item}\" and \"${item.id}\"`);\n sources.set(rel, { item: item.id, from: join(dir, rel) });\n }\n }\n }\n return sources;\n};\n\nconst pin = (name: string, spec: string, options: CreateOptions): string => {\n if (!spec.startsWith('workspace:') || options.workspace === true) return spec;\n const version = options.versions[name];\n if (version === undefined) throw new Error(`create-nisc: the nisc release has no ${name} — the set it was given is incomplete`);\n return `^${version}`;\n};\n\n// The parts' package fragments as one manifest: fields in the order they come, then the scripts, then the\n// dependencies sorted. Two parts that disagree about one field, script or dependency is a mistake in the templates.\nconst manifestOf = (parts: readonly Part[], options: CreateOptions): Record<string, unknown> => {\n const fields: Record<string, unknown> = {};\n const scripts: Record<string, string> = {};\n const deps: Record<(typeof DEPENDENCIES)[number], Record<string, string>> = { dependencies: {}, devDependencies: {} };\n const agree = (where: string, key: string, have: unknown, value: unknown): void => {\n if (have !== undefined && JSON.stringify(have) !== JSON.stringify(value)) throw new Error(`create-nisc: two items disagree about ${where} \"${key}\"`);\n };\n for (const fragment of parts.map((part) => part.package ?? {})) {\n for (const [key, value] of Object.entries(fragment)) {\n if (key === 'scripts' || key === 'dependencies' || key === 'devDependencies') {\n if (!isRecord(value)) throw new Error(`create-nisc: a package fragment's ${key} is not an object`);\n const into = key === 'scripts' ? scripts : deps[key];\n for (const [name, spec] of Object.entries(value)) {\n if (typeof spec !== 'string') throw new Error(`create-nisc: ${name} in ${key} is not a string`);\n agree(key, name, into[name], spec);\n into[name] = spec;\n }\n } else {\n agree('the package field', key, fields[key], value);\n fields[key] = value;\n }\n }\n }\n const sorted = (from: Record<string, string>): Record<string, string> =>\n Object.fromEntries(\n Object.keys(from)\n .sort()\n .map((name) => [name, pin(name, from[name] ?? '', options)]),\n );\n return {\n name: options.name,\n ...fields,\n ...(Object.keys(scripts).length > 0 ? { scripts } : {}),\n dependencies: sorted(deps.dependencies),\n devDependencies: sorted(deps.devDependencies),\n };\n};\n\nconst envValue = (name: string, options: CreateOptions): string => {\n const value = (options.env?.[name] ?? '').trim();\n if (/\\s/.test(value)) throw new Error(`create-nisc: the value given for ${name} has a space or a line break in it`);\n return value;\n};\n\n// `.env` with the values given, `.env.example` with the names alone. A choice keeps its value in both: it is not a\n// secret, and it says which keys follow.\nconst envFiles = (specs: readonly EnvSpec[], options: CreateOptions): { env: string; example: string; assigned: string[] } => {\n const env: string[] = [];\n const example: string[] = [];\n const assigned: string[] = [];\n const key = (spec: EnvKey): void => {\n const comment = `# ${spec.message}${spec.required === true ? ' (required)' : ''}`;\n const line = `${spec.name}=${envValue(spec.name, options)}`;\n env.push(comment, line);\n example.push(comment, `${spec.name}=`);\n assigned.push(line);\n };\n for (const spec of specs) {\n if (!isChoice(spec)) {\n key(spec);\n continue;\n }\n const value = envValue(spec.choose, options) || (spec.options[0]?.value ?? '');\n const option = spec.options.find((candidate) => candidate.value === value);\n if (option === undefined) throw new Error(`create-nisc: ${spec.choose} is one of ${spec.options.map((candidate) => candidate.value).join(', ')} — not \"${value}\"`);\n const comment = `# ${spec.message} (${spec.options.map((candidate) => candidate.value).join(' | ')})`;\n env.push(comment, `${spec.choose}=${value}`);\n example.push(comment, `${spec.choose}=${value}`);\n assigned.push(`${spec.choose}=${value}`);\n for (const inner of option.keys ?? []) key(inner);\n }\n return { env: `${env.join('\\n')}\\n`, example: `${example.join('\\n')}\\n`, assigned };\n};\n\nexport const generate = (options: CreateOptions): Created => {\n const catalog = readCatalog(options.templates ?? TEMPLATES);\n const items = itemsOf(catalog, options.picks);\n const parts = partsOf(items);\n if (!validName(options.name)) throw new Error(`create-nisc: \"${options.name}\" is not a package name (lowercase letters, digits, - . _)`);\n if (existsSync(options.dir) && !statSync(options.dir).isDirectory()) throw new Error(`create-nisc: ${options.dir} is a file`);\n\n const planned = new Map<string, string | Buffer>();\n for (const [rel, { from }] of sourcesOf(catalog.root, items)) {\n planned.set(rel, TEXT.has(extname(rel)) ? readFileSync(from, 'utf8').split(TOKEN).join(options.name) : readFileSync(from));\n }\n planned.set('package.json', `${JSON.stringify(manifestOf(parts, options), null, 2)}\\n`);\n\n const sections = items.flatMap((item) => {\n const path = join(catalog.root, item.id, 'agents-section.md');\n return existsSync(path) ? [readFileSync(path, 'utf8').split(TOKEN).join(options.name)] : [];\n });\n const facts = { name: options.name, today: options.today, nisc: options.versions['@niscorp/nisc'] ?? 'unknown', parts, agents: sections };\n planned.set('AGENTS.md', agentsDoc(facts));\n planned.set('PLAN.md', planDoc(facts));\n\n const specs = envOf(items);\n const envs = specs.length > 0 ? envFiles(specs, options) : undefined;\n if (envs !== undefined) planned.set('.env.example', envs.example);\n\n const there = (rel: string): boolean => existsSync(join(options.dir, rel));\n const kept = [...planned.keys()].filter((rel) => KEEP_THEIRS.has(rel) && there(rel));\n const collisions = [...planned.keys()].filter((rel) => !KEEP_THEIRS.has(rel) && there(rel)).sort();\n if (collisions.length > 0) {\n throw new Error(\n `create-nisc: ${options.dir} already has ${collisions.length === 1 ? 'a file' : 'files'} a new app would write — nothing was written:\\n ${collisions.join('\\n ')}\\nMake the app in an empty folder, or in a subfolder of this one.`,\n );\n }\n for (const rel of kept) planned.delete(rel);\n\n // A .gitignore or .env that is there is added to, never replaced: what it holds is theirs.\n const extended: string[] = [];\n const addTo = (rel: string, fresh: string, lines: readonly string[], has: (line: string, theirs: ReadonlySet<string>) => boolean): void => {\n const path = join(options.dir, rel);\n if (!existsSync(path)) {\n planned.set(rel, fresh);\n return;\n }\n const theirs = readFileSync(path, 'utf8');\n const have = new Set(theirs.split('\\n').map((line) => line.trim()));\n const missing = lines.filter((line) => !has(line, have));\n if (missing.length === 0) return;\n planned.set(rel, `${theirs.replace(/\\n*$/, '\\n')}${missing.join('\\n')}\\n`);\n extended.push(rel);\n };\n addTo('.gitignore', `${gitignoreLines.join('\\n')}\\n`, gitignoreLines, (line, have) => have.has(line));\n if (envs !== undefined) {\n const named = (line: string): string => line.slice(0, line.indexOf('=') + 1);\n addTo('.env', envs.env, envs.assigned, (line, have) => [...have].some((theirs) => theirs.startsWith(named(line))));\n }\n\n for (const [rel, content] of planned) {\n const to = join(options.dir, rel);\n mkdirSync(dirname(to), { recursive: true });\n writeFileSync(to, content);\n }\n return { files: [...planned.keys()].filter((rel) => !extended.includes(rel)).sort(), kept, extended };\n};\n","// Written in when this package is built (tsup.config.ts), never looked up:\n// \"whatever is newest on npm\" would be a set nobody tested the templates with.\ndeclare const __NISC_SET__: Readonly<Record<string, string>> | undefined;\n\nexport const testedSet = (): Readonly<Record<string, string>> => {\n if (typeof __NISC_SET__ === 'undefined') throw new Error('create-nisc: this copy was not built — it carries no nisc release to pin a new app to');\n return __NISC_SET__;\n};\n"]}