create-nisc 0.8.0 → 0.8.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.
Files changed (163) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +89 -13
  3. package/dist/chunk-B3L4UJDN.js +316 -0
  4. package/dist/chunk-B3L4UJDN.js.map +1 -0
  5. package/dist/cli.js +86 -42
  6. package/dist/cli.js.map +1 -1
  7. package/dist/index.d.ts +61 -6
  8. package/dist/index.js +1 -1
  9. package/package.json +1 -1
  10. package/templates/base/files/src/ui/kit.css +232 -0
  11. package/templates/base/item.json +31 -0
  12. package/templates/{moss-dom → classic/files}/src/app/actions/surfaces/welcome.action.ts +1 -1
  13. package/templates/classic/item.json +32 -0
  14. package/templates/{moss-dom → dom/files}/index.html +1 -1
  15. package/templates/dom/files/src/ui/kit.ts +109 -0
  16. package/templates/{shell-dom → dom/files}/src/ui/registry.ts +2 -2
  17. package/templates/{shell-dom → dom/files}/tsconfig.json +3 -14
  18. package/templates/dom/item.json +24 -0
  19. package/templates/model-first/agents-section.md +42 -0
  20. package/templates/model-first/files/src/app/action-catalog.ts +10 -0
  21. package/templates/model-first/files/src/app/actions/answer/text.action.ts +17 -0
  22. package/templates/model-first/files/src/app/actions/answer/text.layout.ts +3 -0
  23. package/templates/model-first/files/src/app/actions/ask/dock.action.ts +58 -0
  24. package/templates/model-first/files/src/app/actions/ask/dock.layout.ts +59 -0
  25. package/templates/model-first/files/src/app/actions/guide/checklist.action.ts +24 -0
  26. package/templates/model-first/files/src/app/actions/guide/checklist.layout.ts +17 -0
  27. package/templates/model-first/files/src/app/actions/guide/counter.action.ts +22 -0
  28. package/templates/model-first/files/src/app/actions/guide/counter.layout.ts +19 -0
  29. package/templates/model-first/files/src/app/actions/guide/guide.actions.ts +144 -0
  30. package/templates/model-first/files/src/app/actions/guide/guide.layouts.ts +31 -0
  31. package/templates/model-first/files/src/app/actions/guide/quiz.action.ts +25 -0
  32. package/templates/model-first/files/src/app/actions/guide/quiz.layout.ts +33 -0
  33. package/templates/model-first/files/src/app/app.ts +11 -0
  34. package/templates/model-first/files/src/app/arrangements.ts +17 -0
  35. package/templates/model-first/files/src/app/charter/assignments.ts +1 -0
  36. package/templates/model-first/files/src/app/charter/charter.ts +10 -0
  37. package/templates/model-first/files/src/app/screens.ts +87 -0
  38. package/templates/model-first/files/src/app/shell/areas.ts +3 -0
  39. package/templates/model-first/files/src/app/shell/frame.layout.ts +6 -0
  40. package/templates/model-first/files/src/app/shell/shell.ts +20 -0
  41. package/templates/model-first/files/src/app/vex/index.ts +3 -0
  42. package/templates/model-first/files/src/db/schema.ts +3 -0
  43. package/templates/{moss-react → model-first/files}/src/dev/all-checks.ts +3 -2
  44. package/templates/model-first/files/src/dev/artifacts-check.ts +95 -0
  45. package/templates/model-first/files/src/dev/checks.ts +13 -0
  46. package/templates/model-first/files/src/dev/compose-check.ts +191 -0
  47. package/templates/model-first/files/src/dev/guide-check.ts +90 -0
  48. package/templates/model-first/files/src/dev/live-ask.ts +185 -0
  49. package/templates/model-first/files/src/dev/scripted.ts +208 -0
  50. package/templates/{shell-dom → model-first/files}/src/dev/strata.ts +7 -1
  51. package/templates/model-first/files/src/server/boot.ts +24 -0
  52. package/templates/model-first/files/src/server/compose/answer.ts +145 -0
  53. package/templates/model-first/files/src/server/compose/catalog.ts +46 -0
  54. package/templates/model-first/files/src/server/compose/composer.agent.ts +18 -0
  55. package/templates/model-first/files/src/server/compose/history.ts +45 -0
  56. package/templates/model-first/files/src/server/compose/index.ts +170 -0
  57. package/templates/model-first/files/src/server/compose/knowledge.ts +57 -0
  58. package/templates/model-first/files/src/server/compose/layout.ts +70 -0
  59. package/templates/model-first/files/src/server/compose/pick.ts +44 -0
  60. package/templates/model-first/files/src/server/compose/plan.ts +45 -0
  61. package/templates/model-first/files/src/server/compose/record.ts +3 -0
  62. package/templates/model-first/files/src/server/compose/reply.schema.ts +70 -0
  63. package/templates/model-first/files/src/server/compose/screen.ts +40 -0
  64. package/templates/model-first/files/src/server/models/index.ts +35 -0
  65. package/templates/model-first/files/src/server/runs/index.ts +20 -0
  66. package/templates/model-first/item.json +84 -0
  67. package/templates/{moss-dom → moss/files}/README.md +1 -1
  68. package/templates/moss/item.json +40 -0
  69. package/templates/{shell-dom → page/files}/README.md +1 -1
  70. package/templates/page/item.json +37 -0
  71. package/templates/questions.json +5 -0
  72. package/templates/{moss-react → react/files}/index.html +1 -1
  73. package/templates/react/files/src/ui/kit.tsx +221 -0
  74. package/templates/{moss-react → react/files}/src/ui/registry.ts +2 -2
  75. package/templates/react/item.json +31 -0
  76. package/dist/chunk-RU5ATATK.js +0 -174
  77. package/dist/chunk-RU5ATATK.js.map +0 -1
  78. package/templates/moss-dom/package.json +0 -39
  79. package/templates/moss-dom/src/app/actions/surfaces/welcome.layout.ts +0 -25
  80. package/templates/moss-dom/src/ui/kit.css +0 -42
  81. package/templates/moss-dom/src/ui/kit.ts +0 -35
  82. package/templates/moss-dom/src/ui/registry.ts +0 -15
  83. package/templates/moss-dom/tsconfig.json +0 -27
  84. package/templates/moss-react/README.md +0 -15
  85. package/templates/moss-react/nisc.config.ts +0 -11
  86. package/templates/moss-react/package.json +0 -42
  87. package/templates/moss-react/src/app/action-catalog.ts +0 -6
  88. package/templates/moss-react/src/app/actions/surfaces/welcome.action.ts +0 -10
  89. package/templates/moss-react/src/app/app.ts +0 -7
  90. package/templates/moss-react/src/app/charter/assignments.ts +0 -2
  91. package/templates/moss-react/src/app/charter/charter.ts +0 -5
  92. package/templates/moss-react/src/app/shell/frame.layout.ts +0 -3
  93. package/templates/moss-react/src/app/shell/shell.ts +0 -7
  94. package/templates/moss-react/src/dev/artifacts-check.ts +0 -49
  95. package/templates/moss-react/src/dev/strata.ts +0 -21
  96. package/templates/moss-react/src/dev/welcome-check.ts +0 -38
  97. package/templates/moss-react/src/server/boot.ts +0 -6
  98. package/templates/moss-react/src/server/runtime.ts +0 -13
  99. package/templates/moss-react/src/ui/kit.css +0 -42
  100. package/templates/moss-react/src/ui/kit.tsx +0 -39
  101. package/templates/moss-react/strata.lock.json +0 -6
  102. package/templates/shell-dom/index.html +0 -12
  103. package/templates/shell-dom/package.json +0 -35
  104. package/templates/shell-dom/src/app/action-catalog.ts +0 -6
  105. package/templates/shell-dom/src/app/actions/surfaces/welcome.action.ts +0 -10
  106. package/templates/shell-dom/src/app/actions/surfaces/welcome.layout.ts +0 -32
  107. package/templates/shell-dom/src/app/shell/frame.layout.ts +0 -3
  108. package/templates/shell-dom/src/ui/kit.css +0 -42
  109. package/templates/shell-dom/src/ui/kit.ts +0 -35
  110. package/templates/shell-dom/strata.lock.json +0 -6
  111. package/templates/shell-dom/vite.config.ts +0 -5
  112. package/templates/shell-react/README.md +0 -16
  113. package/templates/shell-react/index.html +0 -12
  114. package/templates/shell-react/package.json +0 -40
  115. package/templates/shell-react/src/app/action-catalog.ts +0 -6
  116. package/templates/shell-react/src/app/actions/surfaces/welcome.action.ts +0 -10
  117. package/templates/shell-react/src/app/shell/frame.layout.ts +0 -3
  118. package/templates/shell-react/src/app/shell/shell.ts +0 -7
  119. package/templates/shell-react/src/boot.ts +0 -13
  120. package/templates/shell-react/src/dev/all-checks.ts +0 -17
  121. package/templates/shell-react/src/dev/artifacts-check.ts +0 -45
  122. package/templates/shell-react/src/dev/strata.ts +0 -21
  123. package/templates/shell-react/src/dev/welcome-check.ts +0 -21
  124. package/templates/shell-react/src/ui/kit.css +0 -42
  125. package/templates/shell-react/src/ui/kit.tsx +0 -39
  126. package/templates/shell-react/src/ui/registry.ts +0 -12
  127. package/templates/shell-react/strata.lock.json +0 -6
  128. package/templates/shell-react/tsconfig.json +0 -28
  129. package/templates/shell-react/vite.config.ts +0 -8
  130. /package/templates/{moss-dom → base/files}/strata.lock.json +0 -0
  131. /package/templates/{moss-dom → classic/files}/src/app/action-catalog.ts +0 -0
  132. /package/templates/{moss-dom → classic/files}/src/app/shell/frame.layout.ts +0 -0
  133. /package/templates/{moss-dom → classic/files}/src/dev/strata.ts +0 -0
  134. /package/templates/{moss-react → classic/with/moss}/src/app/actions/surfaces/welcome.layout.ts +0 -0
  135. /package/templates/{moss-dom → classic/with/moss}/src/app/app.ts +0 -0
  136. /package/templates/{moss-dom → classic/with/moss}/src/app/charter/assignments.ts +0 -0
  137. /package/templates/{moss-dom → classic/with/moss}/src/app/charter/charter.ts +0 -0
  138. /package/templates/{moss-dom → classic/with/moss}/src/app/shell/shell.ts +0 -0
  139. /package/templates/{moss-dom → classic/with/moss}/src/dev/all-checks.ts +0 -0
  140. /package/templates/{moss-dom → classic/with/moss}/src/dev/artifacts-check.ts +0 -0
  141. /package/templates/{moss-dom → classic/with/moss}/src/dev/welcome-check.ts +0 -0
  142. /package/templates/{moss-dom → classic/with/moss}/src/server/boot.ts +0 -0
  143. /package/templates/{shell-react → classic/with/page}/src/app/actions/surfaces/welcome.layout.ts +0 -0
  144. /package/templates/{shell-dom → classic/with/page}/src/app/shell/shell.ts +0 -0
  145. /package/templates/{shell-dom → classic/with/page}/src/boot.ts +0 -0
  146. /package/templates/{shell-dom → classic/with/page}/src/dev/all-checks.ts +0 -0
  147. /package/templates/{shell-dom → classic/with/page}/src/dev/artifacts-check.ts +0 -0
  148. /package/templates/{shell-dom → classic/with/page}/src/dev/welcome-check.ts +0 -0
  149. /package/templates/{moss-dom → dom/files}/vite.config.ts +0 -0
  150. /package/templates/{moss-dom → dom/with/moss}/src/main.ts +0 -0
  151. /package/templates/{moss-dom → dom/with/moss}/src/server/document.ts +0 -0
  152. /package/templates/{shell-dom → dom/with/page}/nisc.config.ts +0 -0
  153. /package/templates/{shell-dom → dom/with/page}/src/main.ts +0 -0
  154. /package/templates/{shell-dom → dom/with/page}/src/ui/screen.ts +0 -0
  155. /package/templates/{moss-dom → moss/files}/nisc.config.ts +0 -0
  156. /package/templates/{moss-dom → moss/files}/src/server/runtime.ts +0 -0
  157. /package/templates/{moss-react → react/files}/tsconfig.json +0 -0
  158. /package/templates/{moss-react → react/files}/vite.config.ts +0 -0
  159. /package/templates/{moss-react → react/with/moss}/src/main.tsx +0 -0
  160. /package/templates/{moss-react → react/with/moss}/src/server/document.ts +0 -0
  161. /package/templates/{shell-react → react/with/page}/nisc.config.ts +0 -0
  162. /package/templates/{shell-react → react/with/page}/src/main.tsx +0 -0
  163. /package/templates/{shell-react → react/with/page}/src/ui/screen.tsx +0 -0
package/dist/cli.js CHANGED
@@ -1,23 +1,29 @@
1
- import { validName, generate, testedSet } from './chunk-RU5ATATK.js';
1
+ import { readCatalog, TEMPLATES, validName, offered, itemsOf, envOf, isChoice, generate, testedSet } from './chunk-B3L4UJDN.js';
2
2
  import { existsSync, readdirSync } from 'fs';
3
3
  import { basename, resolve, relative } from 'path';
4
- import { intro, text, confirm, cancel, select, note, outro, isCancel } from '@clack/prompts';
4
+ import { intro, text, confirm, cancel, select, note, outro, isCancel, password } from '@clack/prompts';
5
5
 
6
- var USAGE = `npm create nisc [dir] [--moss | --page] [--react | --dom] [--yes]
7
-
8
- dir where the app goes (default: my-nisc-app); its name is the folder's
9
- --moss the shell runs on a server (moss) \u2014 the default
10
- --page the shell runs in the page, no server (offline, static hosting)
11
- --react React draws the screen \u2014 the default
12
- --dom plain DOM draws the screen, no framework in the page
13
- --yes take the defaults for anything not given, and ask nothing`;
14
- var FLAGS = /* @__PURE__ */ new Set(["--moss", "--page", "--react", "--dom", "--yes", "--help", "-h"]);
15
6
  var DEFAULT_DIR = "my-nisc-app";
16
- var refuse = (message) => {
17
- console.error(`create-nisc: ${message}
7
+ var OWN_FLAGS = ["--yes", "--workspace", "--help", "-h"];
8
+ var defaultFirst = (items) => [...items].sort((one, other) => Number(other.default === true) - Number(one.default === true));
9
+ var answering = (catalog, question) => defaultFirst(catalog.items.filter((item) => item.answers === question.id));
10
+ var usageOf = (catalog) => {
11
+ const rows = [
12
+ ["dir", `where the app goes (default: ${DEFAULT_DIR}); its name is the folder's`],
13
+ ...catalog.questions.flatMap(
14
+ (question) => answering(catalog, question).map((item) => {
15
+ const needs = Object.values(item.requires ?? {}).map((id) => `--${id}`);
16
+ return [`--${item.id}`, `${item.usage ?? item.label ?? item.id}${item.default === true ? " \u2014 the default" : ""}${needs.length > 0 ? ` (with ${needs.join(", ")})` : ""}`];
17
+ })
18
+ ),
19
+ ["--yes", "take the defaults for anything not given, and ask nothing"],
20
+ ["--workspace", "depend on the nisc packages of the workspace it is made in \u2014 for an app inside the nisc repository"]
21
+ ];
22
+ const width = Math.max(...rows.map(([flag]) => flag.length)) + 2;
23
+ const choices = catalog.questions.map((question) => `[${answering(catalog, question).map((item) => `--${item.id}`).join(" | ")}]`).join(" ");
24
+ return `npm create nisc [dir] ${choices} [--yes]
18
25
 
19
- ${USAGE}`);
20
- process.exit(1);
26
+ ${rows.map(([flag, what]) => ` ${flag.padEnd(width)}${what}`).join("\n")}`;
21
27
  };
22
28
  var answered = (value) => {
23
29
  if (typeof value === "symbol" || isCancel(value)) {
@@ -31,18 +37,38 @@ var manager = () => {
31
37
  return ["pnpm", "yarn", "bun"].find((name) => agent.startsWith(name)) ?? "npm";
32
38
  };
33
39
  var main = async () => {
40
+ const catalog = readCatalog(TEMPLATES);
41
+ const usage = usageOf(catalog);
42
+ const refuse = (message) => {
43
+ console.error(`create-nisc: ${message}
44
+
45
+ ${usage}`);
46
+ process.exit(1);
47
+ };
34
48
  const args = process.argv.slice(2);
35
49
  if (args.includes("--help") || args.includes("-h")) {
36
- console.log(USAGE);
50
+ console.log(usage);
37
51
  return;
38
52
  }
39
53
  const flags = args.filter((arg) => arg.startsWith("-"));
40
54
  const positional = args.filter((arg) => !arg.startsWith("-"));
41
- const unknown = flags.filter((flag) => !FLAGS.has(flag));
55
+ const byFlag = new Map(catalog.items.filter((item) => item.answers !== void 0).map((item) => [`--${item.id}`, item]));
56
+ const unknown = flags.filter((flag) => !OWN_FLAGS.includes(flag) && !byFlag.has(flag));
42
57
  if (unknown.length > 0) refuse(`unknown option ${unknown.join(", ")}`);
43
58
  if (positional.length > 1) refuse(`one folder at a time \u2014 got ${positional.join(", ")}`);
44
- if (flags.includes("--moss") && flags.includes("--page")) refuse("--moss and --page are two different apps; pick one");
45
- if (flags.includes("--react") && flags.includes("--dom")) refuse("--react and --dom are two different kits; pick one");
59
+ const picks = {};
60
+ for (const item of flags.flatMap((flag) => byFlag.get(flag) ?? [])) {
61
+ const question = item.answers ?? "";
62
+ const before = picks[question];
63
+ if (before !== void 0 && before !== item.id) refuse(`--${before} and --${item.id} are two different apps; pick one`);
64
+ picks[question] = item.id;
65
+ }
66
+ for (const id of Object.values(picks)) {
67
+ for (const [question, wanted] of Object.entries(byFlag.get(`--${id}`)?.requires ?? {})) {
68
+ const other = picks[question];
69
+ if (other !== void 0 && other !== wanted) refuse(`--${id} needs --${wanted}, not --${other}`);
70
+ }
71
+ }
46
72
  const ask = process.stdout.isTTY === true && process.stdin.isTTY === true && !flags.includes("--yes");
47
73
  if (ask) intro("a new nisc app");
48
74
  const given = positional[0];
@@ -67,33 +93,51 @@ var main = async () => {
67
93
  process.exit(1);
68
94
  }
69
95
  }
70
- const posture = flags.includes("--page") ? "page" : flags.includes("--moss") || !ask ? "moss" : answered(
71
- await select({
72
- message: "Where does the shell run?",
73
- options: [
74
- { value: "moss", label: "On a server \u2014 moss", hint: "one shell per person on the server; the charter is enforced there" },
75
- { value: "page", label: "In the page \u2014 no server", hint: "offline, static hosting; the charter is not a security boundary" }
76
- ],
77
- initialValue: "moss"
78
- })
79
- );
80
- const ui = flags.includes("--dom") ? "dom" : flags.includes("--react") || !ask ? "react" : answered(
81
- await select({
82
- message: "What draws the screen?",
83
- options: [
84
- { value: "react", label: "React" },
85
- { value: "dom", label: "Plain DOM", hint: "no framework in the page" }
86
- ],
87
- initialValue: "react"
88
- })
89
- );
90
- const made = generate({ dir, name, posture, ui, versions: testedSet(), today: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10) });
96
+ for (const question of catalog.questions) {
97
+ if (picks[question.id] !== void 0) continue;
98
+ const choices = defaultFirst(offered(catalog, question.id, picks));
99
+ const preferred = choices.find((item) => item.default === true) ?? choices[0];
100
+ if (preferred === void 0) refuse(`nothing can answer "${question.message}" beside ${Object.values(picks).map((id) => `--${id}`).join(" ")}`);
101
+ picks[question.id] = ask && choices.length > 1 ? answered(
102
+ await select({
103
+ message: question.message,
104
+ options: choices.map((item) => ({ value: item.id, label: item.label ?? item.id, ...item.hint !== void 0 ? { hint: item.hint } : {} })),
105
+ initialValue: preferred?.id ?? ""
106
+ })
107
+ ) : preferred?.id ?? "";
108
+ }
109
+ const items = itemsOf(catalog, picks);
110
+ const env = {};
111
+ const empty = [];
112
+ const keyed = async (key) => {
113
+ const value = ask ? answered(await password({ message: `${key.message}${key.required === true ? "" : " \u2014 optional"} \xB7 empty: fill it in .env later` })) : process.env[key.name] ?? "";
114
+ env[key.name] = value.trim();
115
+ if (key.required === true && env[key.name] === "") empty.push(key.name);
116
+ };
117
+ for (const spec of envOf(items)) {
118
+ if (!isChoice(spec)) {
119
+ await keyed(spec);
120
+ continue;
121
+ }
122
+ const value = ask ? answered(
123
+ await select({
124
+ message: spec.message,
125
+ options: spec.options.map((option) => ({ value: option.value, label: option.label, ...option.hint !== void 0 ? { hint: option.hint } : {} })),
126
+ initialValue: spec.options[0]?.value ?? ""
127
+ })
128
+ ) : process.env[spec.choose] ?? spec.options[0]?.value ?? "";
129
+ env[spec.choose] = value;
130
+ for (const key of spec.options.find((option) => option.value === value)?.keys ?? []) await keyed(key);
131
+ }
132
+ const made = generate({ dir, name, picks, env, versions: testedSet(), workspace: flags.includes("--workspace"), today: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10) });
91
133
  const run = manager();
92
134
  const where = relative(process.cwd(), dir) || ".";
93
135
  const next = [...where === "." ? [] : [`cd ${where}`], `${run} install`, `${run} run dev`].join("\n");
94
136
  const left = [...made.kept.map((file) => `kept your ${file}`), ...made.extended.map((file) => `added to your ${file}`)];
95
- const summary = `${name} \u2014 ${posture === "moss" ? "behind moss" : "its own shell"}, ${ui === "react" ? "React" : "plain DOM"} \u2014 ${made.files.length} files${left.length > 0 ? ` (${left.join("; ")})` : ""}`;
96
- const after = "Before building anything: PLAN.md \u2014 what is still open \u2014 and AGENTS.md.";
137
+ const what = items.flatMap((item) => item.summary ?? []).join(", ");
138
+ const summary = `${name} \u2014 ${what} \u2014 ${made.files.length} files${left.length > 0 ? ` (${left.join("; ")})` : ""}`;
139
+ const keys = empty.length > 0 ? ` .env needs ${empty.join(", ")} before it runs.` : "";
140
+ const after = `Before building anything: PLAN.md \u2014 what is still open \u2014 and AGENTS.md.${keys}`;
97
141
  if (ask) {
98
142
  note(next, "Next");
99
143
  outro(`${summary}. ${after}`);
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cli.ts"],"names":[],"mappings":";;;;;AAOA,IAAM,KAAA,GAAQ,CAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sEAAA,CAAA;AASd,IAAM,KAAA,mBAAQ,IAAI,GAAA,CAAI,CAAC,QAAA,EAAU,QAAA,EAAU,SAAA,EAAW,OAAA,EAAS,OAAA,EAAS,QAAA,EAAU,IAAI,CAAC,CAAA;AACvF,IAAM,WAAA,GAAc,aAAA;AAEpB,IAAM,MAAA,GAAS,CAAC,OAAA,KAA2B;AACzC,EAAA,OAAA,CAAQ,KAAA,CAAM,gBAAgB,OAAO;;AAAA,EAAO,KAAK,CAAA,CAAE,CAAA;AACnD,EAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAChB,CAAA;AAEA,IAAM,QAAA,GAAW,CAA6B,KAAA,KAAyB;AACrE,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,QAAA,CAAS,KAAK,CAAA,EAAG;AAChD,IAAA,MAAA,CAAO,mBAAmB,CAAA;AAC1B,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,EAChB;AACA,EAAA,OAAO,KAAA;AACT,CAAA;AAEA,IAAM,UAAU,MAAc;AAC5B,EAAA,MAAM,KAAA,GAAQ,OAAA,C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A,CAAM,CAAA,EAAG,OAAO,CAAA,EAAA,EAAK,KAAK,CAAA,CAAE,CAAA;AAAA,EAC9B,CAAA,MAAO;AACL,IAAA,OAAA,CAAQ,GAAA,CAAI,gBAAgB,OAAO;;AAAA,EAAO,IAAI;;AAAA,EAAO,KAAK,CAAA,CAAE,CAAA;AAAA,EAC9D;AACF,CAAA;AAEA,IAAA,EAAK,CAAE,KAAA,CAAM,CAAC,KAAA,KAAmB;AAC/B,EAAA,OAAA,CAAQ,MAAM,KAAA,YAAiB,KAAA,GAAQ,MAAM,OAAA,GAAU,MAAA,CAAO,KAAK,CAAC,CAAA;AACpE,EAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAChB,CAAC,CAAA","file":"cli.js","sourcesContent":["import { existsSync, readdirSync } from 'node:fs';\nimport { basename, relative, resolve } from 'node:path';\nimport { cancel, confirm, intro, isCancel, note, outro, select, text } from '@clack/prompts';\nimport { generate, validName } from './generate';\nimport type { Posture, Ui } from './generate';\nimport { testedSet } from './set';\n\nconst USAGE = `npm create nisc [dir] [--moss | --page] [--react | --dom] [--yes]\n\n dir where the app goes (default: my-nisc-app); its name is the folder's\n --moss the shell runs on a server (moss) — the default\n --page the shell runs in the page, no server (offline, static hosting)\n --react React draws the screen — the default\n --dom plain DOM draws the screen, no framework in the page\n --yes take the defaults for anything not given, and ask nothing`;\n\nconst FLAGS = new Set(['--moss', '--page', '--react', '--dom', '--yes', '--help', '-h']);\nconst DEFAULT_DIR = 'my-nisc-app';\n\nconst refuse = (message: string): never => {\n console.error(`create-nisc: ${message}\\n\\n${USAGE}`);\n process.exit(1);\n};\n\nconst answered = <T extends string | boolean>(value: T | symbol): T => {\n if (typeof value === 'symbol' || isCancel(value)) {\n cancel('Nothing was made.');\n process.exit(1);\n }\n return value;\n};\n\nconst manager = (): string => {\n const agent = process.env['npm_config_user_agent'] ?? '';\n return ['pnpm', 'yarn', 'bun'].find((name) => agent.startsWith(name)) ?? 'npm';\n};\n\nconst main = async (): Promise<void> => {\n const args = process.argv.slice(2);\n if (args.includes('--help') || args.includes('-h')) {\n console.log(USAGE);\n return;\n }\n const flags = args.filter((arg) => arg.startsWith('-'));\n const positional = args.filter((arg) => !arg.startsWith('-'));\n const unknown = flags.filter((flag) => !FLAGS.has(flag));\n if (unknown.length > 0) refuse(`unknown option ${unknown.join(', ')}`);\n if (positional.length > 1) refuse(`one folder at a time — got ${positional.join(', ')}`);\n if (flags.includes('--moss') && flags.includes('--page')) refuse('--moss and --page are two different apps; pick one');\n if (flags.includes('--react') && flags.includes('--dom')) refuse('--react and --dom are two different kits; pick one');\n\n const ask = process.stdout.isTTY === true && process.stdin.isTTY === true && !flags.includes('--yes');\n if (ask) intro('a new nisc app');\n\n const given = positional[0];\n const dirInput =\n given ??\n (ask\n ? answered<string>(\n await text({\n message: 'Where should it go?',\n placeholder: DEFAULT_DIR,\n defaultValue: DEFAULT_DIR,\n validate: (value) =>\n validName(basename(resolve(value === undefined || value === '' ? DEFAULT_DIR : value))) ? undefined : 'the folder’s name becomes the package name: lowercase letters, digits, - . _',\n }),\n )\n : DEFAULT_DIR);\n const dir = resolve(dirInput === '' ? DEFAULT_DIR : dirInput);\n const name = basename(dir);\n if (!validName(name)) refuse(`\"${name}\" cannot be a package name — the folder’s name becomes it: lowercase letters, digits, - . _`);\n\n const holds = existsSync(dir) ? readdirSync(dir).length : 0;\n if (holds > 0 && ask) {\n const proceed = answered<boolean>(\n await confirm({ message: `${relative(process.cwd(), dir) || '.'} already holds ${holds} ${holds === 1 ? 'thing' : 'things'}. Nothing there will be overwritten — make the app in it?`, initialValue: true }),\n );\n if (!proceed) {\n cancel('Nothing was made.');\n process.exit(1);\n }\n }\n\n const posture: Posture = flags.includes('--page')\n ? 'page'\n : flags.includes('--moss') || !ask\n ? 'moss'\n : answered<Posture>(\n await select<Posture>({\n message: 'Where does the shell run?',\n options: [\n { value: 'moss', label: 'On a server — moss', hint: 'one shell per person on the server; the charter is enforced there' },\n { value: 'page', label: 'In the page — no server', hint: 'offline, static hosting; the charter is not a security boundary' },\n ],\n initialValue: 'moss',\n }),\n );\n\n const ui: Ui = flags.includes('--dom')\n ? 'dom'\n : flags.includes('--react') || !ask\n ? 'react'\n : answered<Ui>(\n await select<Ui>({\n message: 'What draws the screen?',\n options: [\n { value: 'react', label: 'React' },\n { value: 'dom', label: 'Plain DOM', hint: 'no framework in the page' },\n ],\n initialValue: 'react',\n }),\n );\n\n const made = generate({ dir, name, posture, ui, versions: testedSet(), today: new Date().toISOString().slice(0, 10) });\n\n const run = manager();\n const where = relative(process.cwd(), dir) || '.';\n const next = [...(where === '.' ? [] : [`cd ${where}`]), `${run} install`, `${run} run dev`].join('\\n');\n const left = [...made.kept.map((file) => `kept your ${file}`), ...made.extended.map((file) => `added to your ${file}`)];\n const summary = `${name} — ${posture === 'moss' ? 'behind moss' : 'its own shell'}, ${ui === 'react' ? 'React' : 'plain DOM'} — ${made.files.length} files${left.length > 0 ? ` (${left.join('; ')})` : ''}`;\n const after = 'Before building anything: PLAN.md — what is still open — and AGENTS.md.';\n if (ask) {\n note(next, 'Next');\n outro(`${summary}. ${after}`);\n } else {\n console.log(`create-nisc: ${summary}\\n\\n${next}\\n\\n${after}`);\n }\n};\n\nmain().catch((error: unknown) => {\n console.error(error instanceof Error ? error.message : String(error));\n process.exit(1);\n});\n"]}
1
+ {"version":3,"sources":["../src/cli.ts"],"names":[],"mappings":";;;;;AAQA,IAAM,WAAA,GAAc,aAAA;AACpB,IAAM,SAAA,GAAY,CAAC,OAAA,EAAS,aAAA,EAAe,UAAU,IAAI,CAAA;AAGzD,IAAM,YAAA,GAAe,CAAC,KAAA,KAAmC,CAAC,GAAG,KAAK,CAAA,CAAE,KAAK,CAAC,GAAA,EAAK,UAAU,MAAA,CAAO,KAAA,CAAM,YAAY,IAAI,CAAA,GAAI,OAAO,GAAA,CAAI,OAAA,KAAY,IAAI,CAAC,CAAA;AAEtJ,IAAM,SAAA,GAAY,CAAC,OAAA,EAAkB,QAAA,KAA+B,aA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} from 'node:path';\nimport { cancel, confirm, intro, isCancel, note, outro, password, select, text } from '@clack/prompts';\nimport { envOf, isChoice, itemsOf, offered, readCatalog } from './catalog';\nimport type { Catalog, EnvKey, Item, Question } from './catalog';\nimport { TEMPLATES, generate, validName } from './generate';\nimport { testedSet } from './set';\n\nconst DEFAULT_DIR = 'my-nisc-app';\nconst OWN_FLAGS = ['--yes', '--workspace', '--help', '-h'];\n\n// The default first, then the rest in the order of their folders.\nconst defaultFirst = (items: readonly Item[]): Item[] => [...items].sort((one, other) => Number(other.default === true) - Number(one.default === true));\n\nconst answering = (catalog: Catalog, question: Question): Item[] => defaultFirst(catalog.items.filter((item) => item.answers === question.id));\n\n// Written from the templates, so a new kit, shell or kind of app is in it without a line here changing.\nconst usageOf = (catalog: Catalog): string => {\n const rows: [string, string][] = [\n ['dir', `where the app goes (default: ${DEFAULT_DIR}); its name is the folder's`],\n ...catalog.questions.flatMap((question) =>\n answering(catalog, question).map((item): [string, string] => {\n const needs = Object.values(item.requires ?? {}).map((id) => `--${id}`);\n return [`--${item.id}`, `${item.usage ?? item.label ?? item.id}${item.default === true ? ' — the default' : ''}${needs.length > 0 ? ` (with ${needs.join(', ')})` : ''}`];\n }),\n ),\n ['--yes', 'take the defaults for anything not given, and ask nothing'],\n ['--workspace', 'depend on the nisc packages of the workspace it is made in — for an app inside the nisc repository'],\n ];\n const width = Math.max(...rows.map(([flag]) => flag.length)) + 2;\n const choices = catalog.questions.map((question) => `[${answering(catalog, question).map((item) => `--${item.id}`).join(' | ')}]`).join(' ');\n return `npm create nisc [dir] ${choices} [--yes]\\n\\n${rows.map(([flag, what]) => ` ${flag.padEnd(width)}${what}`).join('\\n')}`;\n};\n\nconst answered = <T extends string | boolean>(value: T | symbol): T => {\n if (typeof value === 'symbol' || isCancel(value)) {\n cancel('Nothing was made.');\n process.exit(1);\n }\n return value;\n};\n\nconst manager = (): string => {\n const agent = process.env['npm_config_user_agent'] ?? '';\n return ['pnpm', 'yarn', 'bun'].find((name) => agent.startsWith(name)) ?? 'npm';\n};\n\nconst main = async (): Promise<void> => {\n const catalog = readCatalog(TEMPLATES);\n const usage = usageOf(catalog);\n const refuse = (message: string): never => {\n console.error(`create-nisc: ${message}\\n\\n${usage}`);\n process.exit(1);\n };\n\n const args = process.argv.slice(2);\n if (args.includes('--help') || args.includes('-h')) {\n console.log(usage);\n return;\n }\n const flags = args.filter((arg) => arg.startsWith('-'));\n const positional = args.filter((arg) => !arg.startsWith('-'));\n const byFlag = new Map(catalog.items.filter((item) => item.answers !== undefined).map((item) => [`--${item.id}`, item]));\n const unknown = flags.filter((flag) => !OWN_FLAGS.includes(flag) && !byFlag.has(flag));\n if (unknown.length > 0) refuse(`unknown option ${unknown.join(', ')}`);\n if (positional.length > 1) refuse(`one folder at a time — got ${positional.join(', ')}`);\n\n const picks: Record<string, string> = {};\n for (const item of flags.flatMap((flag) => byFlag.get(flag) ?? [])) {\n const question = item.answers ?? '';\n const before = picks[question];\n if (before !== undefined && before !== item.id) refuse(`--${before} and --${item.id} are two different apps; pick one`);\n picks[question] = item.id;\n }\n for (const id of Object.values(picks)) {\n for (const [question, wanted] of Object.entries(byFlag.get(`--${id}`)?.requires ?? {})) {\n const other = picks[question];\n if (other !== undefined && other !== wanted) refuse(`--${id} needs --${wanted}, not --${other}`);\n }\n }\n\n const ask = process.stdout.isTTY === true && process.stdin.isTTY === true && !flags.includes('--yes');\n if (ask) intro('a new nisc app');\n\n const given = positional[0];\n const dirInput =\n given ??\n (ask\n ? answered<string>(\n await text({\n message: 'Where should it go?',\n placeholder: DEFAULT_DIR,\n defaultValue: DEFAULT_DIR,\n validate: (value) =>\n validName(basename(resolve(value === undefined || value === '' ? DEFAULT_DIR : value))) ? undefined : 'the folder’s name becomes the package name: lowercase letters, digits, - . _',\n }),\n )\n : DEFAULT_DIR);\n const dir = resolve(dirInput === '' ? DEFAULT_DIR : dirInput);\n const name = basename(dir);\n if (!validName(name)) refuse(`\"${name}\" cannot be a package name — the folder’s name becomes it: lowercase letters, digits, - . _`);\n\n const holds = existsSync(dir) ? readdirSync(dir).length : 0;\n if (holds > 0 && ask) {\n const proceed = answered<boolean>(\n await confirm({ message: `${relative(process.cwd(), dir) || '.'} already holds ${holds} ${holds === 1 ? 'thing' : 'things'}. Nothing there will be overwritten — make the app in it?`, initialValue: true }),\n );\n if (!proceed) {\n cancel('Nothing was made.');\n process.exit(1);\n }\n }\n\n for (const question of catalog.questions) {\n if (picks[question.id] !== undefined) continue;\n const choices = defaultFirst(offered(catalog, question.id, picks));\n const preferred = choices.find((item) => item.default === true) ?? choices[0];\n if (preferred === undefined) refuse(`nothing can answer \"${question.message}\" beside ${Object.values(picks).map((id) => `--${id}`).join(' ')}`);\n picks[question.id] =\n ask && choices.length > 1\n ? answered<string>(\n await select<string>({\n message: question.message,\n options: choices.map((item) => ({ value: item.id, label: item.label ?? item.id, ...(item.hint !== undefined ? { hint: item.hint } : {}) })),\n initialValue: preferred?.id ?? '',\n }),\n )\n : (preferred?.id ?? '');\n }\n const items = itemsOf(catalog, picks);\n\n // A key is asked for masked, or read from the environment when there is no terminal to ask in — never a flag,\n // which would leave it in the shell's history.\n const env: Record<string, string> = {};\n const empty: string[] = [];\n const keyed = async (key: EnvKey): Promise<void> => {\n const value = ask\n ? answered<string>(await password({ message: `${key.message}${key.required === true ? '' : ' — optional'} · empty: fill it in .env later` }))\n : (process.env[key.name] ?? '');\n env[key.name] = value.trim();\n if (key.required === true && env[key.name] === '') empty.push(key.name);\n };\n for (const spec of envOf(items)) {\n if (!isChoice(spec)) {\n await keyed(spec);\n continue;\n }\n const value = ask\n ? answered<string>(\n await select<string>({\n message: spec.message,\n options: spec.options.map((option) => ({ value: option.value, label: option.label, ...(option.hint !== undefined ? { hint: option.hint } : {}) })),\n initialValue: spec.options[0]?.value ?? '',\n }),\n )\n : (process.env[spec.choose] ?? spec.options[0]?.value ?? '');\n env[spec.choose] = value;\n for (const key of spec.options.find((option) => option.value === value)?.keys ?? []) await keyed(key);\n }\n\n const made = generate({ dir, name, picks, env, versions: testedSet(), workspace: flags.includes('--workspace'), today: new Date().toISOString().slice(0, 10) });\n\n const run = manager();\n const where = relative(process.cwd(), dir) || '.';\n const next = [...(where === '.' ? [] : [`cd ${where}`]), `${run} install`, `${run} run dev`].join('\\n');\n const left = [...made.kept.map((file) => `kept your ${file}`), ...made.extended.map((file) => `added to your ${file}`)];\n const what = items.flatMap((item) => item.summary ?? []).join(', ');\n const summary = `${name} — ${what} — ${made.files.length} files${left.length > 0 ? ` (${left.join('; ')})` : ''}`;\n const keys = empty.length > 0 ? ` .env needs ${empty.join(', ')} before it runs.` : '';\n const after = `Before building anything: PLAN.md — what is still open — and AGENTS.md.${keys}`;\n if (ask) {\n note(next, 'Next');\n outro(`${summary}. ${after}`);\n } else {\n console.log(`create-nisc: ${summary}\\n\\n${next}\\n\\n${after}`);\n }\n};\n\nmain().catch((error: unknown) => {\n console.error(error instanceof Error ? error.message : String(error));\n process.exit(1);\n});\n"]}
package/dist/index.d.ts CHANGED
@@ -1,12 +1,68 @@
1
- type Posture = 'moss' | 'page';
2
- type Ui = 'react' | 'dom';
1
+ type EnvKey = {
2
+ name: string;
3
+ message: string;
4
+ required?: boolean;
5
+ };
6
+ type EnvOption = {
7
+ value: string;
8
+ label: string;
9
+ hint?: string;
10
+ keys?: readonly EnvKey[];
11
+ };
12
+ type EnvChoice = {
13
+ choose: string;
14
+ message: string;
15
+ options: readonly EnvOption[];
16
+ };
17
+ type EnvSpec = EnvKey | EnvChoice;
18
+ type Docs = {
19
+ is?: string;
20
+ where?: readonly string[];
21
+ runs?: readonly string[];
22
+ decisions?: readonly string[];
23
+ answered?: readonly string[];
24
+ open?: readonly string[];
25
+ order?: readonly string[];
26
+ };
27
+ type Part = {
28
+ package?: Readonly<Record<string, unknown>>;
29
+ env?: readonly EnvSpec[];
30
+ docs?: Docs;
31
+ };
32
+ type Item = Part & {
33
+ id: string;
34
+ answers?: string;
35
+ label?: string;
36
+ hint?: string;
37
+ usage?: string;
38
+ summary?: string;
39
+ default?: boolean;
40
+ requires?: Readonly<Record<string, string>>;
41
+ with?: Readonly<Record<string, Part>>;
42
+ };
43
+ type Question = {
44
+ id: string;
45
+ message: string;
46
+ };
47
+ type Catalog = {
48
+ root: string;
49
+ questions: readonly Question[];
50
+ items: readonly Item[];
51
+ };
52
+ declare const readCatalog: (root: string) => Catalog;
53
+
54
+ type Picks = Readonly<Record<string, string>>;
55
+ declare const completed: (catalog: Catalog, picks: Picks) => Record<string, string>;
56
+
3
57
  type CreateOptions = {
4
58
  dir: string;
5
59
  name: string;
6
- posture: Posture;
7
- ui: Ui;
60
+ picks: Picks;
61
+ env?: Readonly<Record<string, string>>;
8
62
  versions: Readonly<Record<string, string>>;
63
+ workspace?: boolean;
9
64
  today: string;
65
+ templates?: string;
10
66
  };
11
67
  type Created = {
12
68
  files: string[];
@@ -14,10 +70,9 @@ type Created = {
14
70
  extended: string[];
15
71
  };
16
72
  declare const TEMPLATES: string;
17
- declare const templateOf: (posture: Posture, ui: Ui) => string;
18
73
  declare const validName: (name: string) => boolean;
19
74
  declare const generate: (options: CreateOptions) => Created;
20
75
 
21
76
  declare const testedSet: () => Readonly<Record<string, string>>;
22
77
 
23
- export { type CreateOptions, type Created, type Posture, TEMPLATES, type Ui, generate, templateOf, testedSet, validName };
78
+ export { type Catalog, type CreateOptions, type Created, type Item, type Picks, type Question, TEMPLATES, completed, generate, readCatalog, testedSet, validName };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { TEMPLATES, generate, templateOf, testedSet, validName } from './chunk-RU5ATATK.js';
1
+ export { TEMPLATES, completed, generate, readCatalog, testedSet, validName } from './chunk-B3L4UJDN.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.8.0",
3
+ "version": "0.8.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,232 @@
1
+ :root {
2
+ --k-bg: #f6f4ef;
3
+ --k-surface: #ffffff;
4
+ --k-ink: #1d1d1f;
5
+ --k-muted: #6b6a66;
6
+ --k-line: #e4e1d9;
7
+ --k-accent: #2f5bea;
8
+ --k-accent-ink: #ffffff;
9
+ --k-accent-soft: #e8edfd;
10
+ --k-error: #b42318;
11
+ --k-right: #17804b;
12
+ --k-right-soft: #e2f4ea;
13
+ --k-wrong: #b42318;
14
+ --k-wrong-soft: #fdeceb;
15
+ --k-radius: 10px;
16
+ font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
17
+ color: var(--k-ink);
18
+ background: var(--k-bg);
19
+ }
20
+
21
+ html, body, #root { margin: 0; min-height: 100%; }
22
+
23
+ .k-page {
24
+ max-width: 640px;
25
+ margin: 0 auto;
26
+ padding: 64px 24px;
27
+ display: flex;
28
+ flex-direction: column;
29
+ gap: 16px;
30
+ }
31
+
32
+ .k-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
33
+ .k-heading { margin: 0; font-size: 32px; letter-spacing: -0.01em; }
34
+ .k-text { margin: 0; line-height: 1.55; }
35
+ .k-muted { color: var(--k-muted); }
36
+ .k-strong { font-weight: 650; }
37
+ .k-lead { font-size: 17px; line-height: 1.5; }
38
+ .k-display { font-size: 64px; font-weight: 700; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
39
+ .k-text.k-right { color: var(--k-right); }
40
+ .k-text.k-wrong { color: var(--k-wrong); }
41
+
42
+ .k-code {
43
+ margin: 0;
44
+ padding: 14px 16px;
45
+ overflow-x: auto;
46
+ border-radius: var(--k-radius);
47
+ background: #1d1f27;
48
+ color: #e6e8f0;
49
+ font: 13px/1.55 ui-monospace, 'SF Mono', Consolas, monospace;
50
+ }
51
+
52
+ .k-points { margin: 0; display: grid; gap: 12px; }
53
+ .k-point { display: grid; grid-template-columns: 170px 1fr; gap: 12px; padding-top: 12px; border-top: 1px solid var(--k-line); }
54
+ .k-point dt { font-weight: 650; }
55
+ .k-point dd { margin: 0; color: var(--k-muted); line-height: 1.5; }
56
+
57
+ .k-steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 10px; }
58
+ .k-steps li { counter-increment: step; display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; line-height: 1.5; }
59
+ .k-steps li::before {
60
+ content: counter(step);
61
+ width: 24px;
62
+ height: 24px;
63
+ border-radius: 50%;
64
+ display: grid;
65
+ place-items: center;
66
+ font-size: 13px;
67
+ font-weight: 650;
68
+ background: var(--k-accent-soft);
69
+ color: var(--k-accent);
70
+ }
71
+ .k-error { color: var(--k-error); }
72
+
73
+ .k-button {
74
+ border: 0;
75
+ border-radius: var(--k-radius);
76
+ padding: 10px 18px;
77
+ font: inherit;
78
+ font-weight: 600;
79
+ background: var(--k-accent);
80
+ color: var(--k-accent-ink);
81
+ cursor: pointer;
82
+ }
83
+ .k-button:active { transform: translateY(1px); }
84
+ .k-button.k-suggestion, .k-button.k-choice, .k-button.k-chosen, .k-button.k-summary, .k-button.k-step {
85
+ padding: 5px 12px;
86
+ border-radius: 999px;
87
+ font-weight: 500;
88
+ white-space: nowrap;
89
+ flex-shrink: 0;
90
+ }
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-summary, .k-button.k-step { background: var(--k-surface); color: var(--k-ink); border: 1px solid var(--k-line); }
93
+ .k-button.k-summary { flex-shrink: 1; min-width: 0; max-width: 42vw; overflow: hidden; text-overflow: ellipsis; }
94
+ .k-button.k-step { padding: 5px 10px; }
95
+ .k-button.k-link { padding: 0; background: none; color: var(--k-accent); font-weight: 600; }
96
+ .k-button.k-link:hover { text-decoration: underline; }
97
+
98
+ /* A set to pick one from, one under the other in its card. */
99
+ .k-card > .k-button { padding: 10px 14px; border-radius: var(--k-radius); text-align: left; font-weight: 500; white-space: normal; }
100
+ .k-card > .k-button.k-choice { background: var(--k-surface); color: var(--k-ink); border: 1px solid var(--k-line); }
101
+ .k-card > .k-button.k-choice:hover { border-color: var(--k-accent); }
102
+ .k-button.k-right { background: var(--k-right-soft); color: var(--k-right); border: 1px solid var(--k-right); }
103
+ .k-button.k-wrong { background: var(--k-wrong-soft); color: var(--k-wrong); border: 1px solid var(--k-wrong); }
104
+
105
+ .k-check {
106
+ display: flex;
107
+ align-items: center;
108
+ gap: 12px;
109
+ width: 100%;
110
+ padding: 10px 2px;
111
+ border: 0;
112
+ border-top: 1px solid var(--k-line);
113
+ background: none;
114
+ font: inherit;
115
+ color: inherit;
116
+ text-align: left;
117
+ cursor: pointer;
118
+ }
119
+ .k-card > .k-check + .k-check { margin-top: -12px; }
120
+ .k-box { width: 18px; height: 18px; flex-shrink: 0; box-sizing: border-box; display: grid; place-items: center; border: 1.5px solid var(--k-muted); border-radius: 5px; }
121
+ .k-checked .k-box { background: var(--k-accent); border-color: var(--k-accent); }
122
+ .k-checked .k-box::after { content: '✓'; color: var(--k-accent-ink); font-size: 12px; font-weight: 700; }
123
+ .k-checked .k-check-label { color: var(--k-muted); text-decoration: line-through; }
124
+
125
+ .k-frame { min-height: 100vh; display: flex; flex-direction: column; }
126
+
127
+ .k-dock {
128
+ position: sticky;
129
+ bottom: 0;
130
+ z-index: 1;
131
+ display: flex;
132
+ flex-direction: column;
133
+ gap: 8px;
134
+ padding: 10px 24px;
135
+ background: var(--k-bg);
136
+ border-top: 1px solid var(--k-line);
137
+ }
138
+ .k-dock > .k-row { justify-content: space-between; flex-wrap: nowrap; gap: 12px; }
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); }
164
+
165
+ .k-area-changed .k-card { box-shadow: 0 0 0 2px var(--k-accent); }
166
+
167
+ /* 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 areas lay out the same under either kit. */
169
+ [data-canvas], [data-component='ActionSlot'] { display: contents; }
170
+
171
+ .k-grid {
172
+ flex: 1;
173
+ width: 100%;
174
+ max-width: 1080px;
175
+ margin: 0 auto;
176
+ box-sizing: border-box;
177
+ padding: 24px;
178
+ display: grid;
179
+ align-content: start;
180
+ gap: 16px;
181
+ }
182
+ .k-columns-1 { grid-template-columns: minmax(0, 1fr); }
183
+ .k-columns-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
184
+ .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
+
191
+ .k-card {
192
+ display: flex;
193
+ flex-direction: column;
194
+ gap: 12px;
195
+ padding: 20px;
196
+ background: var(--k-surface);
197
+ border: 1px solid var(--k-line);
198
+ border-radius: calc(var(--k-radius) + 4px);
199
+ }
200
+ .k-card-title { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: 0.01em; }
201
+ .k-hero { padding: 32px; gap: 16px; border-color: transparent; background: linear-gradient(135deg, var(--k-accent-soft), var(--k-surface) 75%); }
202
+ .k-hero > .k-card-title { font-size: 30px; letter-spacing: -0.015em; }
203
+ .k-hero > .k-lead { font-size: 18px; max-width: 62ch; }
204
+
205
+ .k-input {
206
+ flex: 1;
207
+ min-width: 0;
208
+ box-sizing: border-box;
209
+ padding: 10px 14px;
210
+ font: inherit;
211
+ color: inherit;
212
+ background: var(--k-surface);
213
+ border: 1px solid var(--k-line);
214
+ border-radius: var(--k-radius);
215
+ outline: none;
216
+ }
217
+ .k-input:focus { border-color: var(--k-accent); box-shadow: 0 0 0 3px var(--k-accent-soft); }
218
+
219
+ .k-prompt { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
220
+ .k-prompt > .k-input { flex: 1 1 240px; }
221
+ .k-prompt > .k-text { flex-basis: 100%; }
222
+
223
+ @media (max-width: 720px) {
224
+ .k-point { grid-template-columns: 1fr; gap: 4px; }
225
+ .k-grid { grid-template-columns: 1fr; padding: 16px; }
226
+ .k-area { grid-column: auto; }
227
+ .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
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "id": "base",
3
+ "package": {
4
+ "private": true,
5
+ "version": "0.0.0",
6
+ "type": "module",
7
+ "engines": { "node": ">=22.12" },
8
+ "dependencies": {
9
+ "@niscorp/nova": "workspace:^",
10
+ "@niscorp/prism": "workspace:^",
11
+ "@niscorp/strata": "workspace:^",
12
+ "zod": "^4.6.5"
13
+ },
14
+ "devDependencies": {
15
+ "@niscorp/cli": "workspace:^",
16
+ "@niscorp/nisc": "workspace:^",
17
+ "@types/node": "^26.6.4",
18
+ "tsx": "^4.23.1",
19
+ "typescript": "^6.0.2",
20
+ "vite": "^7.1.12"
21
+ }
22
+ },
23
+ "docs": {
24
+ "where": [
25
+ "src/dev/ the checks (`npm run check`) — a new feature adds its own",
26
+ "nisc.config.ts how the app boots and how its screens are drawn, for the `nisc` command",
27
+ "strata.lock.json the grammar versions the source is written at (rule 20) — moved only",
28
+ " by `npm run strata verify`, never by hand"
29
+ ]
30
+ }
31
+ }
@@ -4,7 +4,7 @@ import { welcomeLayout } from './welcome.layout';
4
4
  export const welcomeAction: ActionDefinition = {
5
5
  id: 'welcome',
6
6
  title: 'Welcome',
7
- data: { name: 'nisc-template-moss-dom', presses: 0 },
7
+ data: { name: 'nisc-template-app', presses: 0 },
8
8
  layout: welcomeLayout,
9
9
  triggers: [{ event: 'ui:click', ref: 'press', do: [{ increment: 'presses' }] }],
10
10
  };
@@ -0,0 +1,32 @@
1
+ {
2
+ "id": "classic",
3
+ "answers": "kind",
4
+ "label": "You — classic",
5
+ "hint": "you build the screens; a first one that works is there",
6
+ "usage": "you build the screens",
7
+ "default": true,
8
+ "docs": {
9
+ "decisions": [
10
+ "| D3 Reads | **open** | Vex entries (`{ fingerprint, context }`, the shape an AI feature can reach later) or plain endpoints with hand-written handlers. |",
11
+ "| D4 Writes | **open** | Vex mutation entries or plain endpoint handlers. Either way a write is an endpoint, never inline. |"
12
+ ],
13
+ "open": [
14
+ "The entities, and how they relate.",
15
+ "Expected scale.",
16
+ "Who uses it: one person, or roles. More than one principal sketches its roles and charter now, not later.",
17
+ "AI features: now, later, never. (Later still shapes D3.)",
18
+ "Look and feel.",
19
+ "Where it is deployed.",
20
+ "What happens to the data long-term."
21
+ ],
22
+ "order": [
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).",
25
+ "**Kit** — the primitives, against a kitchen-sink action; lock the look before any feature.",
26
+ "**Data layer** — per D2/D3: schema, seed, entries; one read end to end.",
27
+ "**Actions** — domain by domain: list → detail → form.",
28
+ "**Writes** — per D4; one round trip: create → announce → re-read.",
29
+ "**Checks and polish** — a check per feature in `src/dev/`; empty states and transitions last."
30
+ ]
31
+ }
32
+ }
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>nisc-template-moss-dom</title>
6
+ <title>nisc-template-app</title>
7
7
  </head>
8
8
  <body>
9
9
  <div id="root"></div>