create-nisc 0.8.1 → 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 +16 -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-6FL5A3LS.js +0 -174
  77. package/dist/chunk-6FL5A3LS.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
@@ -1,38 +0,0 @@
1
- import { renderDocument } from '@niscorp/moss';
2
- import { boot } from '../server/boot';
3
- import { drawing } from '../server/document';
4
-
5
- let failures = 0;
6
- const check = (name: string, passed: boolean, detail = ''): void => {
7
- console.log(`${passed ? '[pass]' : '[fail]'} ${name}${!passed && detail !== '' ? ` — ${detail}` : ''}`);
8
- if (!passed) failures += 1;
9
- };
10
-
11
- const tick = (ms = 20): Promise<void> => new Promise((done) => setTimeout(done, ms));
12
-
13
- const { server } = await boot();
14
- try {
15
- const shells = server.shells;
16
- if (shells === undefined) throw new Error('the manifest has no shell');
17
- const snapshot = await shells.snapshot(null, null);
18
- const main = JSON.stringify(snapshot.trees['main'] ?? []);
19
- check('the anonymous principal is served the welcome action', main.includes('"definitionId":"welcome"'), main.slice(0, 200));
20
- check('its screen has a button to press', main.includes('"ref":"press"'));
21
-
22
- const template = '<!doctype html><html><head></head><body><div id="root"></div></body></html>';
23
- const page = await renderDocument({ ...drawing, server, template, request: { path: '/', cookie: null } });
24
- check('the page arrives drawn', page.drawn && page.html.includes('k-heading'), page.html.slice(0, 200));
25
- check('a page drawn for nobody may be kept by a cache', page.headers['cache-control'] === 'no-cache');
26
-
27
- const session = await shells.session(null, null);
28
- session.dispatch('main', { type: 'ui:click', ref: 'press' });
29
- await tick();
30
- const active = session.shell.getState().canvases['main']?.active?.id ?? '';
31
- const presses = session.shell.getRuntime(active)?.getData()['presses'];
32
- check('a press reaches the shell on the server', presses === 1, `presses is ${String(presses)}`);
33
- } finally {
34
- server.close();
35
- }
36
-
37
- console.log(failures === 0 ? '[pass] welcome: all checks passed' : `[fail] welcome: ${failures} check(s) failed`);
38
- process.exit(failures === 0 ? 0 : 1);
@@ -1,6 +0,0 @@
1
- import { createServer } from '@niscorp/moss';
2
- import type { MossServer } from '@niscorp/moss';
3
- import { app } from '../app/app';
4
- import { runtime } from './runtime';
5
-
6
- export const boot = async (): Promise<{ server: MossServer }> => ({ server: await createServer(app, await runtime()) });
@@ -1,13 +0,0 @@
1
- import { PGlite } from '@electric-sql/pglite';
2
- import { createPostgresCache } from '@niscorp/vex';
3
- import { createPglitePool, RAW_DATE_PARSERS } from '@niscorp/vex/pglite';
4
- import type { NiscRuntime } from '@niscorp/moss';
5
-
6
- export const runtime = async (): Promise<NiscRuntime> => {
7
- const db = new PGlite();
8
- // Two pools over one database: app queries get raw date strings (Prism
9
- // formats them), the cache keeps Dates.
10
- const cache = createPostgresCache({ pool: createPglitePool(db) });
11
- await cache.init();
12
- return { db, pool: createPglitePool(db, RAW_DATE_PARSERS), cache, session: 'sessions' };
13
- };
@@ -1,42 +0,0 @@
1
- /* The look — the only place it lives. A different look is a different
2
- stylesheet over the same layouts. */
3
-
4
- :root {
5
- --k-bg: #f6f4ef;
6
- --k-ink: #1d1d1f;
7
- --k-muted: #6b6a66;
8
- --k-accent: #2f5bea;
9
- --k-accent-ink: #ffffff;
10
- --k-radius: 10px;
11
- font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
12
- color: var(--k-ink);
13
- background: var(--k-bg);
14
- }
15
-
16
- html, body, #root { margin: 0; min-height: 100%; }
17
-
18
- .k-page {
19
- max-width: 640px;
20
- margin: 0 auto;
21
- padding: 64px 24px;
22
- display: flex;
23
- flex-direction: column;
24
- gap: 16px;
25
- }
26
-
27
- .k-row { display: flex; align-items: center; gap: 16px; }
28
- .k-heading { margin: 0; font-size: 32px; letter-spacing: -0.01em; }
29
- .k-text { margin: 0; line-height: 1.55; }
30
- .k-muted { color: var(--k-muted); }
31
-
32
- .k-button {
33
- border: 0;
34
- border-radius: var(--k-radius);
35
- padding: 10px 18px;
36
- font: inherit;
37
- font-weight: 600;
38
- background: var(--k-accent);
39
- color: var(--k-accent-ink);
40
- cursor: pointer;
41
- }
42
- .k-button:active { transform: translateY(1px); }
@@ -1,39 +0,0 @@
1
- import { z } from 'zod';
2
- import { useNovaDispatch } from '@niscorp/nova/adapters/react';
3
- import type { NovaComponent } from '@niscorp/nova/adapters/react';
4
-
5
- const parsed = <T,>(schema: z.ZodType<T>, props: unknown, fallback: T): T => {
6
- const result = schema.safeParse(props);
7
- return result.success ? result.data : fallback;
8
- };
9
-
10
- const PageProps = z.object({}).describe('The page: a centred column with the app’s background.');
11
- export const Page: NovaComponent = ({ children }) => <main className="k-page">{children}</main>;
12
- Page.meta = { description: 'The page: a centred column.', propsSchema: PageProps };
13
-
14
- const RowProps = z.object({}).describe('Children side by side, centred.');
15
- export const Row: NovaComponent = ({ children }) => <div className="k-row">{children}</div>;
16
- Row.meta = { description: 'Children side by side.', propsSchema: RowProps };
17
-
18
- const HeadingProps = z.object({}).describe('The page’s title.');
19
- export const Heading: NovaComponent = ({ children }) => <h1 className="k-heading">{children}</h1>;
20
- Heading.meta = { description: 'The page’s title.', propsSchema: HeadingProps };
21
-
22
- const TextProps = z.object({ tone: z.enum(['default', 'muted']).optional().describe('default | muted') });
23
- export const Text: NovaComponent = ({ children, novaRef: _ref, novaModel: _model, ...props }) => {
24
- const { tone } = parsed(TextProps, props, {});
25
- return <p className={tone === 'muted' ? 'k-text k-muted' : 'k-text'}>{children}</p>;
26
- };
27
- Text.meta = { description: 'A paragraph.', propsSchema: TextProps };
28
-
29
- const ButtonProps = z.object({ label: z.string().optional().describe('What the button says; falls back to its children.') });
30
- export const Button: NovaComponent = ({ children, novaRef, novaModel: _model, ...props }) => {
31
- const dispatch = useNovaDispatch();
32
- const { label } = parsed(ButtonProps, props, {});
33
- return (
34
- <button type="button" className="k-button" data-ref={novaRef} onClick={() => dispatch({ type: 'ui:click', ...(novaRef !== undefined ? { ref: novaRef } : {}) })}>
35
- {label ?? children}
36
- </button>
37
- );
38
- };
39
- Button.meta = { description: 'A button; dispatches ui:click with its ref.', propsSchema: ButtonProps };
@@ -1,6 +0,0 @@
1
- {
2
- "grammar": {
3
- "nisc.nova": 2,
4
- "nisc.prism": 3
5
- }
6
- }
@@ -1,12 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>nisc-template-shell-dom</title>
7
- </head>
8
- <body>
9
- <div id="root"></div>
10
- <script type="module" src="/src/main.ts"></script>
11
- </body>
12
- </html>
@@ -1,35 +0,0 @@
1
- {
2
- "name": "nisc-template-shell-dom",
3
- "private": true,
4
- "version": "0.0.0",
5
- "type": "module",
6
- "engines": {
7
- "node": ">=22.12"
8
- },
9
- "scripts": {
10
- "dev": "nisc dev",
11
- "build": "tsc --noEmit && nisc build",
12
- "export": "nisc export",
13
- "start": "nisc start",
14
- "check": "nisc check",
15
- "test": "nisc check",
16
- "typecheck": "tsc --noEmit",
17
- "strata": "tsx src/dev/strata.ts"
18
- },
19
- "dependencies": {
20
- "@niscorp/nova": "workspace:^",
21
- "@niscorp/prism": "workspace:^",
22
- "@niscorp/strata": "workspace:^",
23
- "zod": "^4.6.5"
24
- },
25
- "devDependencies": {
26
- "@niscorp/cli": "workspace:^",
27
- "@niscorp/nisc": "workspace:^",
28
- "@types/jsdom": "^30.0.0",
29
- "@types/node": "^26.6.4",
30
- "jsdom": "^25.0.1",
31
- "tsx": "^4.23.1",
32
- "typescript": "^6.0.2",
33
- "vite": "^7.1.12"
34
- }
35
- }
@@ -1,6 +0,0 @@
1
- import type { ActionDefinition } from '@niscorp/nova';
2
- import { welcomeAction } from './actions/surfaces/welcome.action';
3
-
4
- export const actions: Record<string, ActionDefinition> = {
5
- [welcomeAction.id]: welcomeAction,
6
- };
@@ -1,10 +0,0 @@
1
- import type { ActionDefinition } from '@niscorp/nova';
2
- import { welcomeLayout } from './welcome.layout';
3
-
4
- export const welcomeAction: ActionDefinition = {
5
- id: 'welcome',
6
- title: 'Welcome',
7
- data: { name: 'nisc-template-shell-dom', presses: 0 },
8
- layout: welcomeLayout,
9
- triggers: [{ event: 'ui:click', ref: 'press', do: [{ increment: 'presses' }] }],
10
- };
@@ -1,32 +0,0 @@
1
- import type { LayoutNode } from '@niscorp/nova';
2
-
3
- export const welcomeLayout: LayoutNode = {
4
- component: 'Page',
5
- children: [
6
- {
7
- component: 'nova:head',
8
- children: [
9
- { component: 'nova:title', children: '{{$.name}}' },
10
- { component: 'nova:meta', props: { name: 'description', content: 'A nisc app with its own shell.' } },
11
- ],
12
- },
13
- { component: 'Heading', children: '{{$.name}}' },
14
- {
15
- component: 'Text',
16
- props: { tone: 'muted' },
17
- children: 'A nisc app with its own shell, drawn with plain DOM — no server. This screen is an action on a canvas; the page arrived drawn (nisc export wrote it), and the shell in this page picked it up.',
18
- },
19
- {
20
- component: 'Row',
21
- children: [
22
- { component: 'Button', ref: 'press', props: { label: 'Press' } },
23
- { component: 'Text', children: 'Presses: {{$.presses}}' },
24
- ],
25
- },
26
- {
27
- component: 'Text',
28
- props: { tone: 'muted' },
29
- children: 'Start in PLAN.md. The rules this app is built by are in AGENTS.md.',
30
- },
31
- ],
32
- };
@@ -1,3 +0,0 @@
1
- import type { LayoutNode } from '@niscorp/nova';
2
-
3
- export const frameLayout: LayoutNode = { component: 'CanvasSlot', props: { canvasId: 'main' } };
@@ -1,42 +0,0 @@
1
- /* The look — the only place it lives. A different look is a different
2
- stylesheet over the same layouts. */
3
-
4
- :root {
5
- --k-bg: #f6f4ef;
6
- --k-ink: #1d1d1f;
7
- --k-muted: #6b6a66;
8
- --k-accent: #2f5bea;
9
- --k-accent-ink: #ffffff;
10
- --k-radius: 10px;
11
- font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
12
- color: var(--k-ink);
13
- background: var(--k-bg);
14
- }
15
-
16
- html, body, #root { margin: 0; min-height: 100%; }
17
-
18
- .k-page {
19
- max-width: 640px;
20
- margin: 0 auto;
21
- padding: 64px 24px;
22
- display: flex;
23
- flex-direction: column;
24
- gap: 16px;
25
- }
26
-
27
- .k-row { display: flex; align-items: center; gap: 16px; }
28
- .k-heading { margin: 0; font-size: 32px; letter-spacing: -0.01em; }
29
- .k-text { margin: 0; line-height: 1.55; }
30
- .k-muted { color: var(--k-muted); }
31
-
32
- .k-button {
33
- border: 0;
34
- border-radius: var(--k-radius);
35
- padding: 10px 18px;
36
- font: inherit;
37
- font-weight: 600;
38
- background: var(--k-accent);
39
- color: var(--k-accent-ink);
40
- cursor: pointer;
41
- }
42
- .k-button:active { transform: translateY(1px); }
@@ -1,35 +0,0 @@
1
- import { z } from 'zod';
2
- import type { DomComponent } from '@niscorp/nova/adapters/dom';
3
-
4
- // nova's DOM adapter wires the clicks of an element with a `ref` itself, so
5
- // `Button` adds no listener.
6
-
7
- const parsed = <T>(schema: z.ZodType<T>, props: unknown, fallback: T): T => {
8
- const result = schema.safeParse(props);
9
- return result.success ? result.data : fallback;
10
- };
11
-
12
- const element = (tag: string, className: string, children: Node[]): HTMLElement => {
13
- const el = document.createElement(tag);
14
- el.className = className;
15
- el.append(...children);
16
- return el;
17
- };
18
-
19
- export const Page: DomComponent = ({ children }) => element('main', 'k-page', children);
20
- export const Row: DomComponent = ({ children }) => element('div', 'k-row', children);
21
- export const Heading: DomComponent = ({ children }) => element('h1', 'k-heading', children);
22
-
23
- const TextProps = z.object({ tone: z.enum(['default', 'muted']).optional() });
24
- export const Text: DomComponent = ({ props, children }) => {
25
- const { tone } = parsed(TextProps, props, {});
26
- return element('p', tone === 'muted' ? 'k-text k-muted' : 'k-text', children);
27
- };
28
-
29
- const ButtonProps = z.object({ label: z.string().optional() });
30
- export const Button: DomComponent = ({ props, children }) => {
31
- const { label } = parsed(ButtonProps, props, {});
32
- const button = element('button', 'k-button', label !== undefined ? [document.createTextNode(label)] : children);
33
- button.setAttribute('type', 'button');
34
- return button;
35
- };
@@ -1,6 +0,0 @@
1
- {
2
- "grammar": {
3
- "nisc.nova": 2,
4
- "nisc.prism": 3
5
- }
6
- }
@@ -1,5 +0,0 @@
1
- // A default export, which the style guide otherwise bans: vite reads its config
2
- // from one, so this file has to match vite's shape (AGENTS.md rule 16, a shim).
3
- import { defineConfig } from 'vite';
4
-
5
- export default defineConfig({});
@@ -1,16 +0,0 @@
1
- # nisc-template-shell-react
2
-
3
- A [nisc](https://github.com/moccadroid/niscorp) application with its own shell — it runs in the page, with no server.
4
-
5
- | | |
6
- |---|---|
7
- | `npm run dev` | the app, in vite |
8
- | `npm run build` | typecheck, bundle, draw every path and say how it is served |
9
- | `npm run export` | write the site as a folder (`out/`) — any static host serves it |
10
- | `npm start` | serve the built app, each first screen drawn per request |
11
- | `npm run check` | the checks in `src/dev/` |
12
- | `npm run strata status` | which grammar versions the source is written at |
13
-
14
- **Before building anything:** [PLAN.md](PLAN.md) — what was decided when this app
15
- was made and what is still open — and [AGENTS.md](AGENTS.md), which says where
16
- the rules are.
@@ -1,12 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>nisc-template-shell-react</title>
7
- </head>
8
- <body>
9
- <div id="root"></div>
10
- <script type="module" src="/src/main.tsx"></script>
11
- </body>
12
- </html>
@@ -1,40 +0,0 @@
1
- {
2
- "name": "nisc-template-shell-react",
3
- "private": true,
4
- "version": "0.0.0",
5
- "type": "module",
6
- "engines": {
7
- "node": ">=22.12"
8
- },
9
- "scripts": {
10
- "dev": "nisc dev",
11
- "build": "tsc --noEmit && nisc build",
12
- "export": "nisc export",
13
- "start": "nisc start",
14
- "check": "nisc check",
15
- "test": "nisc check",
16
- "typecheck": "tsc --noEmit",
17
- "strata": "tsx src/dev/strata.ts"
18
- },
19
- "dependencies": {
20
- "@niscorp/nova": "workspace:^",
21
- "@niscorp/prism": "workspace:^",
22
- "@niscorp/strata": "workspace:^",
23
- "react": "^19.2.4",
24
- "react-dom": "^19.2.4",
25
- "zod": "^4.6.5"
26
- },
27
- "devDependencies": {
28
- "@niscorp/cli": "workspace:^",
29
- "@niscorp/nisc": "workspace:^",
30
- "@types/jsdom": "^30.0.0",
31
- "@types/node": "^26.6.4",
32
- "@types/react": "^19.2.14",
33
- "@types/react-dom": "^19.2.3",
34
- "@vitejs/plugin-react": "^5.0.4",
35
- "jsdom": "^25.0.1",
36
- "tsx": "^4.23.1",
37
- "typescript": "^6.0.2",
38
- "vite": "^7.1.12"
39
- }
40
- }
@@ -1,6 +0,0 @@
1
- import type { ActionDefinition } from '@niscorp/nova';
2
- import { welcomeAction } from './actions/surfaces/welcome.action';
3
-
4
- export const actions: Record<string, ActionDefinition> = {
5
- [welcomeAction.id]: welcomeAction,
6
- };
@@ -1,10 +0,0 @@
1
- import type { ActionDefinition } from '@niscorp/nova';
2
- import { welcomeLayout } from './welcome.layout';
3
-
4
- export const welcomeAction: ActionDefinition = {
5
- id: 'welcome',
6
- title: 'Welcome',
7
- data: { name: 'nisc-template-shell-react', presses: 0 },
8
- layout: welcomeLayout,
9
- triggers: [{ event: 'ui:click', ref: 'press', do: [{ increment: 'presses' }] }],
10
- };
@@ -1,3 +0,0 @@
1
- import type { LayoutNode } from '@niscorp/nova';
2
-
3
- export const frameLayout: LayoutNode = { component: 'CanvasSlot', props: { canvasId: 'main' } };
@@ -1,7 +0,0 @@
1
- import type { CanvasConfig, LayoutNode } from '@niscorp/nova';
2
- import { frameLayout } from './frame.layout';
3
-
4
- export const shell: { canvases: CanvasConfig[]; canvasLayout: LayoutNode } = {
5
- canvases: [{ id: 'main', initial: 'welcome' }],
6
- canvasLayout: frameLayout,
7
- };
@@ -1,13 +0,0 @@
1
- import { createShell } from '@niscorp/nova';
2
- import type { Shell } from '@niscorp/nova';
3
- import { actions } from './app/action-catalog';
4
- import { shell } from './app/shell/shell';
5
- import { buildRegistry } from './ui/registry';
6
-
7
- // A fresh shell on every call: a build boots more than one and checks what
8
- // they draw against each other, so nothing may be shared between calls.
9
- // Instance ids are counted, not random, so two boots draw the same markup.
10
- export const boot = (): Shell => {
11
- let minted = 0;
12
- return createShell({ ...shell, actions, registry: buildRegistry(), instanceIdFn: () => `i${(minted += 1)}` });
13
- };
@@ -1,17 +0,0 @@
1
- import { spawnSync } from 'node:child_process';
2
-
3
- const CHECKS: readonly (readonly [name: string, what: string, args?: readonly string[]])[] = [
4
- ['artifacts-check', 'src/app is data: pure JSON, and every artifact parses its schema'],
5
- ['strata', 'the source is written at the installed grammars (strata.lock.json)', ['status', '--check']],
6
- ['welcome-check', 'the welcome screen: whole, and pressed'],
7
- ];
8
-
9
- let failed = 0;
10
- for (const [name, what, args = []] of CHECKS) {
11
- console.log(`\n── ${name} — ${what}`);
12
- const run = spawnSync(process.execPath, ['--import', 'tsx', `src/dev/${name}.ts`, ...args], { stdio: 'inherit' });
13
- if (run.status !== 0) failed += 1;
14
- }
15
-
16
- console.log(failed === 0 ? `\nAll ${CHECKS.length} checks pass.` : `\n${failed} of ${CHECKS.length} checks failed.`);
17
- process.exit(failed === 0 ? 0 : 1);
@@ -1,45 +0,0 @@
1
- import { ActionDefinitionSchema, LayoutNodeSchema } from '@niscorp/nova';
2
- import { actions } from '../app/action-catalog';
3
- import { shell } from '../app/shell/shell';
4
-
5
- let failures = 0;
6
- const check = (name: string, passed: boolean, detail = ''): void => {
7
- console.log(`${passed ? '[pass]' : '[fail]'} ${name}${!passed && detail !== '' ? ` — ${detail}` : ''}`);
8
- if (!passed) failures += 1;
9
- };
10
-
11
- const impurity = (value: unknown, path: string): string => {
12
- if (value === null || typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') return '';
13
- if (Array.isArray(value)) return value.map((item, at) => impurity(item, `${path}[${at}]`)).find((found) => found !== '') ?? '';
14
- if (typeof value !== 'object') return `${path} is a ${typeof value}`;
15
- if (Object.getPrototypeOf(value) !== Object.prototype) return `${path} is not a plain object`;
16
- return Object.entries(value).map(([key, inner]) => impurity(inner, path === '' ? key : `${path}.${key}`)).find((found) => found !== '') ?? '';
17
- };
18
- const pure = (name: string, value: unknown): void => {
19
- const found = impurity(value, '');
20
- check(`${name} is pure JSON`, found === '', found);
21
- };
22
- const parses = (name: string, parse: () => unknown): void => {
23
- try {
24
- parse();
25
- check(`${name} parses its schema`, true);
26
- } catch (error) {
27
- check(`${name} parses its schema`, false, error instanceof Error ? error.message.slice(0, 300) : String(error));
28
- }
29
- };
30
- const isRecord = (value: unknown): value is Record<string, unknown> => typeof value === 'object' && value !== null && !Array.isArray(value);
31
-
32
- pure('the action catalog', actions);
33
- pure('the shell', shell);
34
- parses('the shell’s frame', () => LayoutNodeSchema.parse(shell.canvasLayout));
35
-
36
- for (const [id, definition] of Object.entries(actions)) {
37
- check(`action "${id}" is catalogued under its own id`, definition.id === id, `its id is "${definition.id}"`);
38
- parses(`action "${id}"`, () => ActionDefinitionSchema.parse(definition));
39
- const properties = isRecord(definition.input) && isRecord(definition.input['properties']) ? Object.keys(definition.input['properties']) : [];
40
- const unknown = properties.filter((key) => !(key in (definition.data ?? {})));
41
- check(`action "${id}" declares only inputs its data has`, unknown.length === 0, unknown.join(', '));
42
- }
43
-
44
- console.log(failures === 0 ? '[pass] artifacts: all checks passed' : `[fail] artifacts: ${failures} check(s) failed`);
45
- process.exit(failures === 0 ? 0 : 1);
@@ -1,21 +0,0 @@
1
- import { fileURLToPath } from 'node:url';
2
- import { NOVA_SCHEMAS, NOVA_SEQUENCE } from '@niscorp/nova/migrations';
3
- import { evaluate } from '@niscorp/prism';
4
- import { PRISM_SCHEMAS, PRISM_SEQUENCE } from '@niscorp/prism/migrations';
5
- import { runSourceUpgrade } from '@niscorp/strata/node';
6
- import { actions } from '../app/action-catalog';
7
-
8
- const root = fileURLToPath(new URL('../..', import.meta.url));
9
-
10
- process.exit(
11
- await runSourceUpgrade(
12
- {
13
- root,
14
- grammars: [NOVA_SEQUENCE, PRISM_SEQUENCE],
15
- transform: evaluate,
16
- schemas: { ...NOVA_SCHEMAS, ...PRISM_SCHEMAS },
17
- documents: async () => Object.values(actions).map((document) => ({ kind: 'nisc.nova/action', id: document.id, document })),
18
- },
19
- process.argv.slice(2),
20
- ),
21
- );
@@ -1,21 +0,0 @@
1
- import { shellSettled } from '@niscorp/nova';
2
- import { boot } from '../boot';
3
-
4
- let failures = 0;
5
- const check = (name: string, passed: boolean, detail = ''): void => {
6
- console.log(`${passed ? '[pass]' : '[fail]'} ${name}${!passed && detail !== '' ? ` — ${detail}` : ''}`);
7
- if (!passed) failures += 1;
8
- };
9
-
10
- const shell = boot();
11
- check('the first screen is whole', await shellSettled(shell));
12
- const active = shell.getState().canvases['main']?.active;
13
- check('the welcome action opens on the main canvas', active?.definitionId === 'welcome', String(active?.definitionId));
14
-
15
- shell.dispatch({ type: 'ui:click', ref: 'press', ...(active !== undefined ? { origin: active.id } : {}) });
16
- await new Promise((done) => setTimeout(done, 20));
17
- const presses = shell.getRuntime(active?.id ?? '')?.getData()['presses'];
18
- check('a press reaches the shell', presses === 1, `presses is ${String(presses)}`);
19
-
20
- console.log(failures === 0 ? '[pass] welcome: all checks passed' : `[fail] welcome: ${failures} check(s) failed`);
21
- process.exit(failures === 0 ? 0 : 1);
@@ -1,42 +0,0 @@
1
- /* The look — the only place it lives. A different look is a different
2
- stylesheet over the same layouts. */
3
-
4
- :root {
5
- --k-bg: #f6f4ef;
6
- --k-ink: #1d1d1f;
7
- --k-muted: #6b6a66;
8
- --k-accent: #2f5bea;
9
- --k-accent-ink: #ffffff;
10
- --k-radius: 10px;
11
- font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
12
- color: var(--k-ink);
13
- background: var(--k-bg);
14
- }
15
-
16
- html, body, #root { margin: 0; min-height: 100%; }
17
-
18
- .k-page {
19
- max-width: 640px;
20
- margin: 0 auto;
21
- padding: 64px 24px;
22
- display: flex;
23
- flex-direction: column;
24
- gap: 16px;
25
- }
26
-
27
- .k-row { display: flex; align-items: center; gap: 16px; }
28
- .k-heading { margin: 0; font-size: 32px; letter-spacing: -0.01em; }
29
- .k-text { margin: 0; line-height: 1.55; }
30
- .k-muted { color: var(--k-muted); }
31
-
32
- .k-button {
33
- border: 0;
34
- border-radius: var(--k-radius);
35
- padding: 10px 18px;
36
- font: inherit;
37
- font-weight: 600;
38
- background: var(--k-accent);
39
- color: var(--k-accent-ink);
40
- cursor: pointer;
41
- }
42
- .k-button:active { transform: translateY(1px); }