create-nisc 0.9.3 → 0.9.4
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 +13 -0
- package/README.md +20 -22
- package/dist/{chunk-IJ5E5SA2.js → chunk-2W7KLXCO.js} +3 -3
- package/dist/{chunk-IJ5E5SA2.js.map → chunk-2W7KLXCO.js.map} +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/templates/base/files/src/ui/kit.css +8 -41
- package/templates/dom/files/src/ui/kit.ts +2 -8
- package/templates/dom/files/src/ui/registry.ts +2 -2
- package/templates/model-first/agents-section.md +31 -25
- package/templates/model-first/files/src/app/action-catalog.ts +4 -3
- package/templates/model-first/files/src/app/actions/answer/turn.action.ts +23 -0
- package/templates/model-first/files/src/app/actions/ask/dock.action.ts +10 -33
- package/templates/model-first/files/src/app/actions/ask/dock.layout.ts +7 -39
- package/templates/model-first/files/src/app/actions/guide/guide.actions.ts +16 -19
- package/templates/model-first/files/src/app/app.ts +4 -3
- package/templates/model-first/files/src/app/charter/charter.ts +1 -1
- package/templates/model-first/files/src/app/screens.ts +27 -48
- package/templates/model-first/files/src/app/shell/frame.layout.ts +5 -1
- package/templates/model-first/files/src/app/shell/shell.ts +7 -10
- package/templates/model-first/files/src/dev/all-checks.ts +3 -3
- package/templates/model-first/files/src/dev/artifacts-check.ts +14 -25
- package/templates/model-first/files/src/dev/compose-check.ts +87 -136
- package/templates/model-first/files/src/dev/guide-check.ts +41 -58
- package/templates/model-first/files/src/dev/live-ask.ts +43 -138
- package/templates/model-first/files/src/dev/scripted.ts +24 -102
- package/templates/model-first/files/src/dev/shape-check.ts +2 -6
- package/templates/model-first/files/src/dev/strata.ts +2 -2
- package/templates/model-first/files/src/server/boot.ts +2 -2
- package/templates/model-first/files/src/server/compose/catalog.ts +10 -28
- package/templates/model-first/files/src/server/compose/composer.agent.ts +13 -11
- package/templates/model-first/files/src/server/compose/index.ts +55 -132
- package/templates/model-first/files/src/server/compose/knowledge.ts +22 -43
- package/templates/model-first/files/src/server/compose/turn.schema.ts +55 -0
- package/templates/model-first/files/src/server/models/index.ts +5 -23
- package/templates/model-first/item.json +28 -38
- package/templates/react/files/src/ui/kit.tsx +14 -25
- package/templates/react/files/src/ui/registry.ts +2 -2
- package/templates/model-first/files/src/app/arrangements.ts +0 -17
- package/templates/model-first/files/src/app/shell/areas.ts +0 -3
- package/templates/model-first/files/src/server/compose/answer.ts +0 -145
- package/templates/model-first/files/src/server/compose/history.ts +0 -45
- package/templates/model-first/files/src/server/compose/layout.ts +0 -70
- package/templates/model-first/files/src/server/compose/pick.ts +0 -44
- package/templates/model-first/files/src/server/compose/plan.ts +0 -45
- package/templates/model-first/files/src/server/compose/reply.schema.ts +0 -70
- package/templates/model-first/files/src/server/compose/screen.ts +0 -40
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# create-nisc
|
|
2
2
|
|
|
3
|
+
## 0.9.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fddbeaf: A model-first app answers each message with a turn of a conversation: a sentence, and up to three of the app's cards under it, filled in. It no longer rewrites the screen area by area.
|
|
8
|
+
- **One run of the model a message.** gpt-oss-120b on Groq, as a cortex agent, is told the cards the person may be shown, the last four turns and the message. The answer is checked — every card one the app has, its input one its schema takes, nothing shown twice — and sent back when it fails, five tries in all. Jev and the TypeSafe key are gone, and so are streaming, the reads, writes and arrangements in the prompt, and the bypass around moss that swapped layouts.
|
|
9
|
+
- **The conversation is in the dock**, above the screens and the line to ask in. The question shows at once, still being answered; messages are answered one at a time, in order; a turn and its cards never take a step Back. The conversation lasts as long as the person's shell. An answer that does not come is a turn saying why.
|
|
10
|
+
- **A screen is its cards, one under another**, the ones the person's roles reach, opened from the dock or by a card's link. The arrangements, the six areas and the answer stack with back and forward are gone.
|
|
11
|
+
- **The kits** lose `Area`, `Menu` and the `summary` button tone, which only the old model-first used, and gain `Talk`, the conversation's scroll box.
|
|
12
|
+
- **AGENTS.md** says how the assistant answers, how to remove the tour, and the first steps from there to a full app. `live-ask` fails on a miss.
|
|
13
|
+
|
|
14
|
+
**What to change:** nothing. An app already made keeps its files; this is what `npm create nisc --model-first` makes from now on.
|
|
15
|
+
|
|
3
16
|
## 0.9.3
|
|
4
17
|
|
|
5
18
|
No changes in this release.
|
package/README.md
CHANGED
|
@@ -10,28 +10,27 @@ Four questions, because they are what shape the files:
|
|
|
10
10
|
|
|
11
11
|
1. **Where should it go?** The folder's name becomes the app's name.
|
|
12
12
|
2. **Who leads?** You — classic: you build the screens, and a first one that
|
|
13
|
-
works is there. Or a model — model-first:
|
|
14
|
-
|
|
15
|
-
(below).
|
|
13
|
+
works is there. Or a model — model-first: a person types a message, and the
|
|
14
|
+
answer is a sentence and the app's own cards, in a conversation (below).
|
|
16
15
|
3. **Where does the shell run?** On a server — moss: one shell per person on
|
|
17
16
|
the server, the charter enforced there. Or in the page — no server: offline,
|
|
18
17
|
static hosting, and the charter is not a security boundary. A model-first
|
|
19
18
|
app is behind moss, and is not asked.
|
|
20
19
|
4. **What draws the screen?** React, or plain DOM (no framework in the page).
|
|
21
20
|
|
|
22
|
-
A model-first app then asks for its
|
|
23
|
-
gpt-oss-120b
|
|
21
|
+
A model-first app then asks for its key, masked (see "Keys" below): Groq for
|
|
22
|
+
gpt-oss-120b.
|
|
24
23
|
|
|
25
24
|
```bash
|
|
26
25
|
npm create nisc my-app -- --page --dom # flags answer the questions
|
|
27
|
-
npm create nisc my-app -- --model-first # a model leads; the
|
|
26
|
+
npm create nisc my-app -- --model-first # a model leads; the key is asked
|
|
28
27
|
npm create nisc my-app -- --yes # the defaults: classic, moss, React
|
|
29
28
|
```
|
|
30
29
|
|
|
31
30
|
| | |
|
|
32
31
|
|---|---|
|
|
33
32
|
| `dir` | where the app goes (default `my-nisc-app`) |
|
|
34
|
-
| `--classic` / `--model-first` | you build the screens (the default), or a model
|
|
33
|
+
| `--classic` / `--model-first` | you build the screens (the default), or a model answers every message with the app's cards |
|
|
35
34
|
| `--moss` / `--page` | the shell on a server (the default), or in the page |
|
|
36
35
|
| `--react` / `--dom` | React draws the screen (the default), or plain DOM |
|
|
37
36
|
| `--yes` | take the defaults for anything not given, and ask nothing |
|
|
@@ -63,25 +62,24 @@ The structure the rulebook describes, and a first screen that works:
|
|
|
63
62
|
|
|
64
63
|
A model-first app has, instead of the welcome screen:
|
|
65
64
|
|
|
66
|
-
- a frame: the
|
|
67
|
-
the
|
|
68
|
-
|
|
69
|
-
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
was left;
|
|
65
|
+
- a frame: the screen — cards one under another — and one dock at the bottom
|
|
66
|
+
with the conversation, the screens and the line to ask in;
|
|
67
|
+
- **the message loop** (`src/server/compose/`), one run of the model a message:
|
|
68
|
+
gpt-oss-120b, as a cortex agent, is told the cards the person may be shown
|
|
69
|
+
and the conversation so far, and answers with one sentence and up to three
|
|
70
|
+
cards, filled in. The answer is checked against the app's actions and their
|
|
71
|
+
input schemas, and sent back inside the run when it fails. The turn
|
|
72
|
+
goes into the conversation; the screen behind is never changed by an answer.
|
|
73
|
+
The conversation lasts as long as the person's shell;
|
|
76
74
|
- **a tour of nisc** to start from: five screens of cards to read, and a
|
|
77
75
|
counter, a checklist and a quick check to use, which the model can fill in
|
|
78
76
|
too. A card's link opens a screen at once; only what is typed, or a thing to
|
|
79
77
|
ask pressed, goes to the model. Its `AGENTS.md` says how to remove the tour —
|
|
80
|
-
a folder, a check, its vex entries and its migration, and edits in
|
|
81
|
-
and the two documents — and
|
|
82
|
-
- checks that run the loop offline with a scripted
|
|
83
|
-
|
|
84
|
-
|
|
78
|
+
a folder, a check, its vex entries and its migration, and edits in seven
|
|
79
|
+
files and the two documents — and the first steps from there to a full app;
|
|
80
|
+
- checks that run the loop offline with a scripted model, one for the loop and
|
|
81
|
+
one for the tour, and `src/dev/live-ask.ts`, which asks the real model a run
|
|
82
|
+
of cases and fails on a miss.
|
|
85
83
|
|
|
86
84
|
And the documents:
|
|
87
85
|
|
|
@@ -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.5", "@niscorp/cli": "0.9.1", "@niscorp/cortex": "0.1.6", "@niscorp/loom": "0.5.0", "@niscorp/moss": "0.9.2", "@niscorp/nisc": "0.9.
|
|
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.2", "@niscorp/nisc": "0.9.4", "@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.11", "@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 {
|
|
@@ -313,5 +313,5 @@ var testedSet = () => {
|
|
|
313
313
|
};
|
|
314
314
|
|
|
315
315
|
export { TEMPLATES, completed, envOf, generate, isChoice, itemsOf, offered, readCatalog, testedSet, validName };
|
|
316
|
-
//# sourceMappingURL=chunk-
|
|
317
|
-
//# sourceMappingURL=chunk-
|
|
316
|
+
//# sourceMappingURL=chunk-2W7KLXCO.js.map
|
|
317
|
+
//# sourceMappingURL=chunk-2W7KLXCO.js.map
|
|
@@ -1 +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":";;;;;AA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,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-IJ5E5SA2.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.2\",\"@niscorp/nisc\":\"0.9.3\",\"@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"]}
|
|
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,K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A;AAChJ,EAAA,OAAO,uBAAA;AACT","file":"chunk-2W7KLXCO.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.2\",\"@niscorp/nisc\":\"0.9.4\",\"@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.11\",\"@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-
|
|
1
|
+
import { readCatalog, TEMPLATES, validName, offered, itemsOf, envOf, isChoice, generate, testedSet } from './chunk-2W7KLXCO.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-
|
|
1
|
+
export { TEMPLATES, completed, generate, readCatalog, testedSet, validName } from './chunk-2W7KLXCO.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.
|
|
3
|
+
"version": "0.9.4",
|
|
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": {
|
|
@@ -81,7 +81,7 @@ html, body, #root { margin: 0; min-height: 100%; }
|
|
|
81
81
|
cursor: pointer;
|
|
82
82
|
}
|
|
83
83
|
.k-button:active { transform: translateY(1px); }
|
|
84
|
-
.k-button.k-suggestion, .k-button.k-choice, .k-button.k-chosen, .k-button.k-
|
|
84
|
+
.k-button.k-suggestion, .k-button.k-choice, .k-button.k-chosen, .k-button.k-step {
|
|
85
85
|
padding: 5px 12px;
|
|
86
86
|
border-radius: 999px;
|
|
87
87
|
font-weight: 500;
|
|
@@ -89,8 +89,7 @@ html, body, #root { margin: 0; min-height: 100%; }
|
|
|
89
89
|
flex-shrink: 0;
|
|
90
90
|
}
|
|
91
91
|
.k-button.k-suggestion, .k-button.k-chosen { background: var(--k-accent-soft); color: var(--k-accent); }
|
|
92
|
-
.k-button.k-choice, .k-button.k-
|
|
93
|
-
.k-button.k-summary { flex-shrink: 1; min-width: 0; max-width: 42vw; overflow: hidden; text-overflow: ellipsis; }
|
|
92
|
+
.k-button.k-choice, .k-button.k-step { background: var(--k-surface); color: var(--k-ink); border: 1px solid var(--k-line); }
|
|
94
93
|
.k-button.k-step { padding: 5px 10px; }
|
|
95
94
|
.k-button.k-link { padding: 0; background: none; color: var(--k-accent); font-weight: 600; }
|
|
96
95
|
.k-button.k-link:hover { text-decoration: underline; }
|
|
@@ -135,37 +134,15 @@ html, body, #root { margin: 0; min-height: 100%; }
|
|
|
135
134
|
background: var(--k-bg);
|
|
136
135
|
border-top: 1px solid var(--k-line);
|
|
137
136
|
}
|
|
138
|
-
.k-dock > .k-row {
|
|
139
|
-
.k-dock > .k-row > .k-row { flex-wrap: nowrap; gap: 6px; min-width: 0; }
|
|
140
|
-
.k-dock > .k-row > .k-row:first-child { overflow-x: auto; scrollbar-width: none; }
|
|
141
|
-
|
|
142
|
-
.k-menu {
|
|
143
|
-
position: absolute;
|
|
144
|
-
bottom: calc(100% + 6px);
|
|
145
|
-
right: 24px;
|
|
146
|
-
z-index: 2;
|
|
147
|
-
width: min(380px, calc(100vw - 32px));
|
|
148
|
-
max-height: 60vh;
|
|
149
|
-
overflow-y: auto;
|
|
150
|
-
box-sizing: border-box;
|
|
151
|
-
display: flex;
|
|
152
|
-
flex-direction: column;
|
|
153
|
-
gap: 4px;
|
|
154
|
-
padding: 8px;
|
|
155
|
-
background: var(--k-surface);
|
|
156
|
-
border: 1px solid var(--k-line);
|
|
157
|
-
border-radius: calc(var(--k-radius) + 4px);
|
|
158
|
-
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
|
|
159
|
-
}
|
|
160
|
-
.k-menu .k-button { text-align: left; overflow: hidden; text-overflow: ellipsis; border-radius: var(--k-radius); }
|
|
161
|
-
.k-menu > .k-text { padding: 0 10px; }
|
|
162
|
-
.k-menu > .k-text + .k-button, .k-menu > .k-muted { margin-bottom: 4px; }
|
|
163
|
-
.k-menu > .k-muted { padding-bottom: 10px; border-bottom: 1px solid var(--k-line); }
|
|
137
|
+
.k-dock > .k-row { flex-wrap: nowrap; gap: 6px; overflow-x: auto; scrollbar-width: none; }
|
|
164
138
|
|
|
165
|
-
|
|
139
|
+
/* The conversation: it scrolls inside the dock, and a reversed column keeps its newest turn in view. */
|
|
140
|
+
.k-talk { max-height: 45vh; overflow-y: auto; display: flex; flex-direction: column-reverse; }
|
|
141
|
+
.k-talk > div { display: flex; flex-direction: column; gap: 10px; padding-bottom: 4px; }
|
|
142
|
+
.k-talk:not(:has(.k-card)) { display: none; }
|
|
166
143
|
|
|
167
144
|
/* nova's DOM adapter wraps a canvas and an action in elements of its own; React does not. They take no room, so the
|
|
168
|
-
dock sticks and the
|
|
145
|
+
dock sticks and the cards lay out the same under either kit. */
|
|
169
146
|
[data-canvas], [data-component='ActionSlot'] { display: contents; }
|
|
170
147
|
|
|
171
148
|
.k-grid {
|
|
@@ -182,11 +159,6 @@ html, body, #root { margin: 0; min-height: 100%; }
|
|
|
182
159
|
.k-columns-1 { grid-template-columns: minmax(0, 1fr); }
|
|
183
160
|
.k-columns-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
184
161
|
.k-columns-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
185
|
-
.k-area { min-width: 0; }
|
|
186
|
-
.k-span-2 { grid-column: span 2; }
|
|
187
|
-
.k-span-3 { grid-column: span 3; }
|
|
188
|
-
/* An area with nothing in it takes no room. */
|
|
189
|
-
.k-area:not(:has(.k-card)) { display: none; }
|
|
190
162
|
|
|
191
163
|
.k-card {
|
|
192
164
|
display: flex;
|
|
@@ -223,10 +195,5 @@ html, body, #root { margin: 0; min-height: 100%; }
|
|
|
223
195
|
@media (max-width: 720px) {
|
|
224
196
|
.k-point { grid-template-columns: 1fr; gap: 4px; }
|
|
225
197
|
.k-grid { grid-template-columns: 1fr; padding: 16px; }
|
|
226
|
-
.k-area { grid-column: auto; }
|
|
227
198
|
.k-dock { padding-left: 16px; padding-right: 16px; }
|
|
228
|
-
.k-dock > .k-row { flex-wrap: wrap; gap: 8px; }
|
|
229
|
-
.k-dock > .k-row > .k-row { width: 100%; }
|
|
230
|
-
.k-button.k-summary { flex: 1; max-width: none; }
|
|
231
|
-
.k-menu { right: 16px; }
|
|
232
199
|
}
|
|
@@ -36,7 +36,7 @@ export const Heading: DomComponent = ({ children }) => element('h1', 'k-heading'
|
|
|
36
36
|
const TextProps = z.object({ tone: z.enum(['default', 'lead', 'muted', 'strong', 'display', 'right', 'wrong', 'error']).optional() });
|
|
37
37
|
export const Text: DomComponent = ({ props, children }) => element('p', toned('k-text', parsed(TextProps, props, {}).tone, 'default'), children);
|
|
38
38
|
|
|
39
|
-
const ButtonProps = z.object({ label: z.string().optional(), tone: z.enum(['primary', 'suggestion', 'link', 'choice', 'chosen', 'right', 'wrong', '
|
|
39
|
+
const ButtonProps = z.object({ label: z.string().optional(), tone: z.enum(['primary', 'suggestion', 'link', 'choice', 'chosen', 'right', 'wrong', 'step']).optional() });
|
|
40
40
|
export const Button: DomComponent = ({ props, children }) => {
|
|
41
41
|
const { label, tone } = parsed(ButtonProps, props, {});
|
|
42
42
|
const button = element('button', toned('k-button', tone, 'primary'), label !== undefined ? [text(label)] : children);
|
|
@@ -46,17 +46,11 @@ export const Button: DomComponent = ({ props, children }) => {
|
|
|
46
46
|
|
|
47
47
|
export const Frame: DomComponent = ({ children }) => element('div', 'k-frame', children);
|
|
48
48
|
export const Dock: DomComponent = ({ children }) => element('footer', 'k-dock', children);
|
|
49
|
-
export const
|
|
49
|
+
export const Talk: DomComponent = ({ children }) => element('section', 'k-talk', [element('div', '', children)]);
|
|
50
50
|
|
|
51
51
|
const GridProps = z.object({ columns: z.number().int().min(1).max(3).optional() });
|
|
52
52
|
export const Grid: DomComponent = ({ props, children }) => element('main', `k-grid k-columns-${parsed(GridProps, props, {}).columns ?? 2}`, children);
|
|
53
53
|
|
|
54
|
-
const AreaProps = z.object({ name: z.string(), span: z.number().int().min(1).max(3).optional(), changed: z.boolean().optional() });
|
|
55
|
-
export const Area: DomComponent = ({ props, children }) => {
|
|
56
|
-
const { span, changed } = parsed(AreaProps, props, { name: '' });
|
|
57
|
-
return element('section', `k-area k-span-${span ?? 1}${changed === true ? ' k-area-changed' : ''}`, children);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
54
|
const CardProps = z.object({ title: z.string().optional(), tone: z.enum(['default', 'hero']).optional() });
|
|
61
55
|
export const Card: DomComponent = ({ props, children }) => {
|
|
62
56
|
const { title, tone } = parsed(CardProps, props, {});
|
|
@@ -2,7 +2,7 @@ import { createComponentRegistry, ACTION_SLOT_NAME, CANVAS_SLOT_NAME } from '@ni
|
|
|
2
2
|
import type { ComponentRegistry } from '@niscorp/nova';
|
|
3
3
|
import type { DomComponent } from '@niscorp/nova/adapters/dom';
|
|
4
4
|
import { fallback } from '@niscorp/nova/adapters/dom/components';
|
|
5
|
-
import {
|
|
5
|
+
import { Button, Card, Check, Code, Dock, Frame, Grid, Heading, Input, Page, Points, Prompt, Row, Steps, Talk, Text } from './kit';
|
|
6
6
|
|
|
7
7
|
// The adapter resolves a canvas slot itself, and an action slot is a plain
|
|
8
8
|
// wrapper: `fallback` does for both.
|
|
@@ -10,6 +10,6 @@ export const buildRegistry = (): ComponentRegistry<DomComponent> => {
|
|
|
10
10
|
const registry = createComponentRegistry<DomComponent>();
|
|
11
11
|
registry.register(CANVAS_SLOT_NAME, fallback);
|
|
12
12
|
registry.register(ACTION_SLOT_NAME, fallback);
|
|
13
|
-
registry.registerAll({ Page, Row, Heading, Text, Button, Frame, Dock,
|
|
13
|
+
registry.registerAll({ Page, Row, Heading, Text, Button, Frame, Dock, Talk, Grid, Card, Code, Points, Steps, Check, Input, Prompt });
|
|
14
14
|
return registry;
|
|
15
15
|
};
|
|
@@ -1,28 +1,26 @@
|
|
|
1
|
-
## How the
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
- **The message loop is `src/server/compose/`**, the function `ask
|
|
6
|
-
1. **The
|
|
7
|
-
2. **
|
|
8
|
-
3. **
|
|
9
|
-
4. **The
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
- **
|
|
13
|
-
- **
|
|
14
|
-
- **
|
|
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
|
-
- **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`.
|
|
1
|
+
## How the assistant answers
|
|
2
|
+
|
|
3
|
+
The screen fills the page and scrolls; one dock stays at the bottom (`src/app/actions/ask/dock.action.ts`). Read from the top down, the dock has **the conversation** — each turn: what was asked, the sentence the model answered with, and the cards under it — then **the screens** (`src/app/screens.ts`: cards one under another, opened without asking, as a card's link opens one), and **the line to ask in**, which is empty again as soon as a message is sent. Asking never changes the screen behind.
|
|
4
|
+
|
|
5
|
+
- **The message loop is `src/server/compose/`**, the function `ask`, one run of the model a message:
|
|
6
|
+
1. **The question goes into the conversation at once**, as a turn still being answered (`answer.turn`, on the shell's `talk` canvas). Messages are answered one at a time, in the order they were sent.
|
|
7
|
+
2. **gpt-oss-120b answers, as a cortex agent** (`composer.agent.ts`, `knowledge.ts`, `turn.schema.ts`). It is told, in the part of the prompt that never changes, its instructions — the first paragraph is the app's own, who the assistant is and what it answers about (`ABOUT`) — and the cards the person may be shown (`placeable`, each with its input's JSON Schema, only the ones the person's roles reach); then, for each message, the conversation so far (its last four turns) and the message. It answers with cortex's envelope: its `response`, one sentence it is told to keep to 120 characters, and its `data`, up to three cards — one of the app's actions opened with an input, or words (`say`). What each field means is said on the schema (`.describe()`, nisc rule 15).
|
|
8
|
+
3. **The answer is checked** by the agent's `output.validate` (`turnRefusals`): every card one the app has, its input one its schema takes, exactly one of a card or words, nothing shown twice. An answer that fails is sent back with what is wrong, inside the same run: five tries in all.
|
|
9
|
+
4. **The turn is finished:** its sentence written in, then its cards after it, none of it a step Back takes. A card is opened with its whole input: what the model leaves out is its action's default (`opened`, in `catalog.ts`).
|
|
10
|
+
- **An answer that does not come is a turn that says so:** the model could not be reached, its answers kept failing the check, or there is no key. The line under the dock only says something when the call itself fails.
|
|
11
|
+
- **The conversation lives as long as the person's shell** (PLAN.md D8): the turns on its `talk` canvas, and what they said, beside the function. For somebody not signed in that is one connection.
|
|
12
|
+
- **Every message is recorded as a run** through moss (`session.recordRun`): `nisc-template-app.compose`, with its provider and model, the tokens it spent (`reported: false` where signal estimated them), its steps and how long it took, and whether it ended in an answer. The server logs a line for each (`src/server/runs/`).
|
|
13
|
+
- **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; 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 counter that starts at 100", "quiz me on the charter"). A card in the conversation works as it does on a screen. Its check is `src/dev/guide-check.ts`.
|
|
14
|
+
- **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`). The ones the model may show are `placeable`, in `src/app/action-catalog.ts`, each granted in the charter.
|
|
17
15
|
- **The model never presses anything.** It opens cards with an input — a form filled in — and only the person saves.
|
|
18
|
-
- **The
|
|
19
|
-
- **`src/dev/compose-check.ts` runs the loop offline**, with a scripted
|
|
16
|
+
- **The key is in `.env`:** `GROQ_API_KEY`; without it, every message is answered with a turn saying so.
|
|
17
|
+
- **`src/dev/compose-check.ts` runs the loop offline**, with a scripted model (`src/dev/scripted.ts`), on words and on cards the app does not have — so it passes whatever actions the app ships. **`src/dev/live-ask.ts` asks the real model** its cases (`CASES`) and fails on a miss (`--runs=<n>`, `--why`, `--prompts` for everything the model was sent, or messages of your own). It costs a call a message, and is not part of `npm run check`.
|
|
20
18
|
|
|
21
19
|
## How to proceed from here
|
|
22
20
|
|
|
23
21
|
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
22
|
|
|
25
|
-
**Remove the tour.** It lives in four places and is named in
|
|
23
|
+
**Remove the tour.** It lives in four places and is named in seven:
|
|
26
24
|
|
|
27
25
|
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
26
|
2. `src/app/action-catalog.ts`: drop the `GUIDE` import; `placeable` is `[]` until your own actions are in it.
|
|
@@ -31,13 +29,21 @@ The tour is a starting point, there to be deleted. First the interview: PLAN.md'
|
|
|
31
29
|
5. `src/dev/all-checks.ts`: drop the `guide-check` line.
|
|
32
30
|
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:
|
|
33
31
|
```ts
|
|
34
|
-
export const SCREENS: readonly [Screen, ...Screen[]] = [
|
|
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' }] },
|
|
36
|
-
];
|
|
32
|
+
export const SCREENS: readonly [Screen, ...Screen[]] = [{ id: 'start', label: 'Start', cards: [{ action: 'answer.text', input: { title: 'The app', text: 'What it is, in a sentence.' } }] }];
|
|
37
33
|
```
|
|
38
|
-
7. `src/dev/live-ask.ts`: your cases in `
|
|
34
|
+
7. `src/server/compose/knowledge.ts`: `ABOUT`, the assistant's paragraph — who it is in your app, and what it answers about. `src/dev/live-ask.ts`: your cases in `CASES` instead of the tour's.
|
|
39
35
|
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.
|
|
40
36
|
|
|
41
|
-
What stays is the app: the message loop, the dock
|
|
37
|
+
What stays is the app: the message loop, the dock and the conversation, the kit, and `compose-check`, which needs nothing of the tour.
|
|
42
38
|
|
|
43
|
-
|
|
39
|
+
## From here to a full app
|
|
40
|
+
|
|
41
|
+
What the template leaves out, so that it starts small. None of it is required, and the order is yours: take a step when the app needs it, each checked before the next (PLAN.md's order of work).
|
|
42
|
+
|
|
43
|
+
- **Your data, and cards that show it.** A table in `src/db/schema.ts`, a read in `src/app/vex/`, an action that replays it — as `guide.packages` does — in `placeable`, granted in the charter, with a `live-ask` case for the question it answers. The model is told what a card shows, never the rows: to answer about your data, it shows the card.
|
|
44
|
+
- **Writes.** A form card the model may open filled in (D4); the person saves it, through a vex mutation, never the model.
|
|
45
|
+
- **Sign-in and roles.** Once more than one person uses the app, or anything in it is somebody's own: who is signed in is moss's (`runtime.session`), what each role may reach is the charter's. The model is offered, and a screen opens with, only the cards the person's roles reach — that filter is already there (`session.actions`). The dock lists every screen: when roles see different ones, give each person their own list through moss's `inputs`.
|
|
46
|
+
- **A conversation that outlives the shell** (D8, once there is sign-in). The turns become rows the person owns, written by the server as a machine role at the person's own reach (`executeAs`), read back when their shell is built (`seeds`); `place` and `said` in `src/server/compose/index.ts` are where it goes.
|
|
47
|
+
- **Facts the model can rely on,** as the cards need them. When a card takes a date, tell the model today's date, in the app's time zone, in `messageInput`. When it opens a record by its id, tell it the ids that exist, and refuse in `turnRefusals` an id it was not told: a model that makes up an id shows a card of nothing.
|
|
48
|
+
- **Asking back, and what to ask next.** A card of choices, each one a message emitted on `ask` when tapped — as the tour's examples are — for when the message could mean two things, or to offer the next question.
|
|
49
|
+
- **Deploying.** A real Postgres in `src/server/runtime.ts`, its tables applied by `nisc migrate`, never at boot (rule 17).
|