create-kdna-web-app 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,17 +1,202 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
1
 
5
- Copyright 2026 KDNA Authors
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
6
5
 
7
- Licensed under the Apache License, Version 2.0 (the "License");
8
- you may not use this file except in compliance with the License.
9
- You may obtain a copy of the License at
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
10
7
 
11
- http://www.apache.org/licenses/LICENSE-2.0
8
+ 1. Definitions.
12
9
 
13
- Unless required by applicable law or agreed to in writing, software
14
- distributed under the License is distributed on an "AS IS" BASIS,
15
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- See the License for the specific language governing permissions and
17
- limitations under the License.
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2025-2026 AIKDNA Contributors
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE CHANGED
@@ -6,7 +6,7 @@ https://github.com/aikdna/create-kdna-web-app
6
6
 
7
7
  create-kdna-web-app is a project scaffolding CLI for KDNA-integrated
8
8
  web applications. Generated projects include the KDNA packages each
9
- template imports at runtime, pre-configured with a working validate
9
+ template imports at runtime, pre-configured with a working inspect
10
10
  plan-load → load → consume flow.
11
11
 
12
12
  See LICENSE for the full Apache 2.0 license text.
package/README.md CHANGED
@@ -8,10 +8,10 @@ cd my-app
8
8
  npm run dev
9
9
  ```
10
10
 
11
- The Next.js templates include `@aikdna/kdna-web-server` and
12
- `@aikdna/kdna-react` pre-configured with a validate -> inspect ->
13
- plan-load -> load demo. The Express template includes the server adapter
14
- and a minimal static HTML demo.
11
+ Node.js 20 or later is required. Every template binds KDNA Core 0.20.0 and
12
+ Web Server 0.3.0. The Next.js templates additionally bind React 0.3.0.
13
+ Generated apps execute the same inspect -> LoadPlan -> load -> Runtime Capsule
14
+ flow; they do not decode `.kdna` containers directly.
15
15
 
16
16
  [![npm](https://img.shields.io/npm/v/create-kdna-web-app)](https://www.npmjs.com/package/create-kdna-web-app)
17
17
  [![License](https://img.shields.io/badge/license-Apache%202.0-blue)](LICENSE)
@@ -32,6 +32,11 @@ npx create-kdna-web-app <project-name> [options]
32
32
  | `--package-manager` | auto-detected | `npm`, `pnpm`, or `yarn` |
33
33
  | `--no-install` | — | Scaffold files without running install |
34
34
 
35
+ The release gate verifies npm across all three templates. It also runs the
36
+ packed CLI's real install and Next.js production build with pnpm 11.14.0 and
37
+ Yarn 1.22.22, so the advertised package-manager paths are executable rather
38
+ than parser-only options.
39
+
35
40
  ### Examples
36
41
 
37
42
  ```bash
@@ -66,7 +71,7 @@ npx create-kdna-web-app my-app --template nextjs-pages
66
71
 
67
72
  - Express with ESM
68
73
  - `src/server.js` — KDNA router mounted at `/api/kdna`
69
- - `public/index.html` — minimal HTML demo page
74
+ - `public/index.html` — browser demo with the complete LoadPlan flow
70
75
  - `.env.example` for local configuration
71
76
 
72
77
  ---
@@ -75,9 +80,9 @@ npx create-kdna-web-app my-app --template nextjs-pages
75
80
 
76
81
  | Template | KDNA packages |
77
82
  |----------|---------------|
78
- | `nextjs` | `@aikdna/kdna-core`, `@aikdna/kdna-web-server`, `@aikdna/kdna-react` |
79
- | `nextjs-pages` | `@aikdna/kdna-core`, `@aikdna/kdna-web-server`, `@aikdna/kdna-react` |
80
- | `express` | `@aikdna/kdna-core`, `@aikdna/kdna-web-server` |
83
+ | `nextjs` | Core 0.20.0, Web Server 0.3.0, React 0.3.0 |
84
+ | `nextjs-pages` | Core 0.20.0, Web Server 0.3.0, React 0.3.0 |
85
+ | `express` | Core 0.20.0, Web Server 0.3.0 |
81
86
 
82
87
  ## Pre-configured flow
83
88
 
@@ -91,12 +96,14 @@ The Next.js templates provide the full React flow:
91
96
  6. The loaded content is displayed.
92
97
 
93
98
  The Express template mounts the same `/api/kdna` server endpoints and includes
94
- a minimal HTML page that uploads, inspects, and loads an open `.kdna` asset.
99
+ a static page that explicitly calls inspect, plan-load, and load in order.
100
+ All templates render projected objects with `JSON.stringify`; React objects are
101
+ never passed directly as JSX children.
95
102
 
96
103
  ### Environment variables
97
104
 
98
105
  ```bash
99
- # Optional
106
+ # Optional; the server uses an OS temporary directory when omitted
100
107
  KDNA_STORAGE_DIR=/tmp/kdna
101
108
 
102
109
  # Optional — only needed for licensed-mode assets
@@ -111,7 +118,7 @@ KDNA_ACTIVATION_URL=https://your-activation-server.example.com
111
118
  cd my-app
112
119
  cp .env.local.example .env.local # Next.js templates
113
120
  # or: cp .env.example .env # Express template, if you load env files locally
114
- npm test # smoke-test KDNA package imports
121
+ npm test # smoke-test exact package entrypoints
115
122
  npm run dev
116
123
  # Open http://localhost:3000 and drop a .kdna file
117
124
  ```
@@ -119,7 +126,7 @@ npm run dev
119
126
  To get a `.kdna` file for testing:
120
127
 
121
128
  ```bash
122
- npm install -g @aikdna/kdna-cli
129
+ npm install -g @aikdna/kdna-cli@0.34.0
123
130
  kdna demo judgment ./demo-judgment
124
131
  kdna pack ./demo-judgment ./demo-judgment.kdna
125
132
  ```
@@ -134,6 +141,14 @@ kdna pack ./demo-judgment ./demo-judgment.kdna
134
141
  | [`@aikdna/kdna-web-server`](https://github.com/aikdna/kdna-web-server) | Server-side adapter |
135
142
  | [`@aikdna/kdna-react`](https://github.com/aikdna/kdna-react) | React components and hooks |
136
143
 
144
+ ## What this release verifies
145
+
146
+ The scaffolder release gate packs the CLI, generates each template from that
147
+ archive into an empty directory, performs a clean install, starts the actual
148
+ production server, and uses Chromium with the accepted public Laozi asset to
149
+ observe successful `/inspect`, `/plan-load`, and `/load` responses. A template
150
+ is not accepted by import-only smoke tests.
151
+
137
152
  ---
138
153
 
139
154
  ## License
package/SECURITY.md CHANGED
@@ -20,9 +20,10 @@ pre-release and the canonical KDNA protocol/runtime surfaces.
20
20
 
21
21
  | Component | Supported Versions |
22
22
  |-----------|-------------------|
23
- | KDNA Protocol | Latest tagged release |
24
- | kdna-cli | Latest minor release |
25
- | create-kdna-web-app | Latest mainline pre-release |
23
+ | KDNA Core | 0.20.0 |
24
+ | KDNA Web Server | 0.3.0 |
25
+ | KDNA React | 0.3.0 |
26
+ | create-kdna-web-app | 0.4.0 |
26
27
 
27
28
  Older pre-release versions may receive critical security patches on a
28
29
  case-by-case basis.
@@ -33,6 +34,12 @@ case-by-case basis.
33
34
  templates must consume the public KDNA package contracts rather than define
34
35
  protocol validity, access modes, LoadPlan states, or crypto policy.
35
36
 
37
+ The selected `.kdna` file exists briefly in browser memory while it is
38
+ uploaded. Validation, authorization, decryption, profile selection, and
39
+ Runtime Capsule projection happen on the server. Password and license inputs
40
+ may exist briefly in browser form state; generated code must not log, persist,
41
+ or reflect them. Raw license keys go to `/activate`, not `/load`.
42
+
36
43
  For the KDNA Protocol security architecture, see
37
44
  [GOVERNANCE.md](https://github.com/aikdna/kdna/blob/main/docs/GOVERNANCE.md)
38
45
  in the main protocol repository.
@@ -20,7 +20,8 @@ cd my-app
20
20
  cp .env.local.example .env.local
21
21
  ```
22
22
 
23
- Open `.env.local`. The only required variable is `KDNA_STORAGE_DIR`:
23
+ `KDNA_STORAGE_DIR` is optional; set it when you want a stable upload directory
24
+ instead of the operating-system temporary directory:
24
25
 
25
26
  ```bash
26
27
  KDNA_STORAGE_DIR=/tmp/kdna
@@ -46,7 +47,7 @@ Open [http://localhost:3000](http://localhost:3000).
46
47
  Install the KDNA CLI and generate a current example asset:
47
48
 
48
49
  ```bash
49
- npm install -g @aikdna/kdna-cli
50
+ npm install -g @aikdna/kdna-cli@0.34.0
50
51
  kdna demo judgment ./demo-judgment
51
52
  kdna pack ./demo-judgment ./demo-judgment.kdna
52
53
  ```
@@ -54,8 +55,12 @@ kdna pack ./demo-judgment ./demo-judgment.kdna
54
55
  Drop the file onto the page. You should see:
55
56
 
56
57
  1. The manifest metadata (domain, version, title).
57
- 2. A "Load" button or automatic loading for public assets.
58
- 3. The formatted payload content.
58
+ 2. The LoadPlan state produced before loading.
59
+ 3. The formatted Runtime Capsule context after a public asset loads.
60
+
61
+ The browser demo does not parse the container. The selected file is uploaded
62
+ to Web Server 0.3.0, and KDNA Core 0.20.0 performs validation, planning,
63
+ authorization, and projection on the server.
59
64
 
60
65
  ---
61
66
 
@@ -11,6 +11,8 @@ template.
11
11
  - Environment example file for storage and activation settings.
12
12
  - `scripts/smoke.mjs` that imports the KDNA package entrypoints used by
13
13
  the generated project.
14
+ - A generated-project `README.md` that names the exact KDNA coordinates and
15
+ the inspect -> LoadPlan -> load boundary.
14
16
 
15
17
  ## Runtime boundaries
16
18
 
@@ -23,8 +25,16 @@ template.
23
25
 
24
26
  ## Verification
25
27
 
26
- - `npm test` passes in this repository.
28
+ - `npm run ci:static` passes in this repository.
27
29
  - A generated project includes the expected route, page, env example, and
28
30
  smoke script.
29
31
  - The generated template package uses bounded dependency ranges.
30
32
  - Public docs and package metadata mention only templates that exist.
33
+ - The packed CLI cold-generates all three templates; each clean install starts
34
+ its real production server and completes inspect -> plan-load -> load in
35
+ Chromium with both an accepted public asset and the pinned Core password
36
+ test vector.
37
+ - The advertised npm, pnpm, and Yarn paths execute a real packed-CLI install;
38
+ the reference non-npm versions also complete a Next.js production build.
39
+ - Browser output contains structured Runtime Capsule context, never
40
+ `[object Object]` or a server filesystem path.
package/docs/templates.md CHANGED
@@ -9,14 +9,14 @@
9
9
  **When to use:** You are starting a new Next.js project or want the
10
10
  most up-to-date template.
11
11
 
12
- **Framework:** Next.js 14+ (App Router)
12
+ **Framework:** Next.js 16+ (App Router)
13
13
 
14
14
  **What it includes:**
15
15
 
16
16
  | File | Purpose |
17
17
  |------|---------|
18
18
  | `app/api/kdna/[...route]/route.js` | All KDNA endpoints (catch-all App Router route) |
19
- | `app/page.jsx` | Demo page: file drop, inspect, load, display |
19
+ | `app/page.jsx` | Demo page: file drop, inspect, LoadPlan, load, display |
20
20
  | `.env.local.example` | Environment variable template |
21
21
 
22
22
  **Start:**
@@ -40,7 +40,7 @@ Router project, or prefer the Pages Router.
40
40
  | File | Purpose |
41
41
  |------|---------|
42
42
  | `pages/api/kdna/[...route].js` | All KDNA endpoints |
43
- | `pages/index.jsx` | Demo page |
43
+ | `pages/index.jsx` | Demo page with the same complete Runtime Capsule flow |
44
44
  | `.env.local.example` | Environment variable template |
45
45
 
46
46
  **Start:**
@@ -64,7 +64,7 @@ Next.js, or are integrating into an existing Express application.
64
64
  | File | Purpose |
65
65
  |------|---------|
66
66
  | `src/server.js` | Express server with KDNA router at `/api/kdna` |
67
- | `public/index.html` | Minimal HTML demo page |
67
+ | `public/index.html` | Static demo with explicit inspect, plan-load, and load calls |
68
68
  | `.env.example` | Environment variable template |
69
69
 
70
70
  **Start:**
@@ -82,8 +82,9 @@ cd my-app && npm start
82
82
  | | `nextjs` | `nextjs-pages` | `express` |
83
83
  |-|----------|----------------|-----------|
84
84
  | KDNA API route included | Yes | Yes | Yes |
85
- | Edge runtime (Vercel) | No* | No* | No |
85
+ | Edge runtime | No | No | No |
86
86
  | Browser demo included | React page | React page | Static HTML |
87
87
  | React dependency included | Yes | Yes | No |
88
88
 
89
- \* Use `@aikdna/kdna-web-server/cloudflare` for edge deployments.
89
+ Web Server 0.3.0 is verified on Node.js runtimes. These templates do not claim
90
+ an Edge or Worker adapter.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-kdna-web-app",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Scaffold a KDNA-integrated web application with Next.js App Router, Next.js Pages Router, or Express templates.",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -17,16 +17,24 @@
17
17
  "SECURITY.md"
18
18
  ],
19
19
  "scripts": {
20
- "ci": "npm test && npm run test:templates && npm run lint && npm pack --dry-run --json",
21
- "test": "node --test tests/scaffold.test.js",
20
+ "ci": "npm run ci:static && npm run test:templates && npm pack --dry-run --json",
21
+ "ci:static": "npm test && npm run lint && npm run public:check && npm run naming:check && npm run package:check",
22
+ "test": "node --test tests/scaffold.test.js tests/release-context.test.cjs tests/dco.test.cjs",
22
23
  "test:templates": "node scripts/test-templates.js",
23
24
  "lint": "node scripts/lint.js",
25
+ "public:check": "node scripts/check-public-surface.js",
26
+ "naming:check": "node scripts/check-naming-integrity.js",
27
+ "package:check": "node scripts/check-packed-boundary.js",
28
+ "release:context": "node scripts/verify-release-context.cjs",
24
29
  "prepublishOnly": "npm run ci"
25
30
  },
26
31
  "engines": {
27
- "node": ">=18"
32
+ "node": ">=20"
28
33
  },
29
34
  "dependencies": {},
35
+ "devDependencies": {
36
+ "playwright": "1.61.1"
37
+ },
30
38
  "license": "Apache-2.0",
31
39
  "repository": {
32
40
  "type": "git",
package/src/scaffold.js CHANGED
@@ -32,15 +32,33 @@ function parseArgs(args) {
32
32
  if (arg === '--help' || arg === '-h') {
33
33
  options.help = true;
34
34
  } else if (arg === '--template') {
35
- options.template = args[++index];
35
+ const value = args[index + 1];
36
+ if (!value || value.startsWith('-')) {
37
+ const error = new Error('--template requires a value.');
38
+ error.exitCode = 1;
39
+ throw error;
40
+ }
41
+ options.template = value;
42
+ index += 1;
36
43
  } else if (arg.startsWith('--template=')) {
37
44
  options.template = arg.slice('--template='.length);
38
45
  } else if (arg === '--package-manager') {
39
- options.packageManager = args[++index];
46
+ const value = args[index + 1];
47
+ if (!value || value.startsWith('-')) {
48
+ const error = new Error('--package-manager requires a value.');
49
+ error.exitCode = 1;
50
+ throw error;
51
+ }
52
+ options.packageManager = value;
53
+ index += 1;
40
54
  } else if (arg.startsWith('--package-manager=')) {
41
55
  options.packageManager = arg.slice('--package-manager='.length);
42
56
  } else if (arg === '--no-install') {
43
57
  options.install = false;
58
+ } else if (arg.startsWith('-')) {
59
+ const error = new Error(`Unknown option: ${arg}\n\n${usage()}`);
60
+ error.exitCode = 1;
61
+ throw error;
44
62
  } else if (!options.projectName) {
45
63
  options.projectName = arg;
46
64
  } else {
@@ -60,6 +78,14 @@ function validateOptions(options) {
60
78
  error.exitCode = 1;
61
79
  throw error;
62
80
  }
81
+ const packageName = path.basename(path.resolve(options.projectName));
82
+ if (!/^[a-z0-9][a-z0-9._-]{0,213}$/u.test(packageName)) {
83
+ const error = new Error(
84
+ 'Project directory name must be a lowercase npm package name (letters, numbers, dots, hyphens, or underscores).',
85
+ );
86
+ error.exitCode = 1;
87
+ throw error;
88
+ }
63
89
  if (!VALID_TEMPLATES.has(options.template)) {
64
90
  const error = new Error(`Unknown template: ${options.template}`);
65
91
  error.exitCode = 1;
@@ -0,0 +1,18 @@
1
+ # KDNA Express starter
2
+
3
+ This generated Node.js 20+ application binds KDNA Core 0.20.0 and Web Server
4
+ 0.3.0. The static browser page uploads a selected `.kdna` file and explicitly
5
+ executes inspect, plan-load, and load before rendering Runtime Capsule context.
6
+ If LoadPlan requires a password, the page clears the password field around the
7
+ request and renders the authorized Runtime context only after unlock succeeds.
8
+
9
+ ```bash
10
+ cp .env.example .env
11
+ npm test
12
+ npm start
13
+ ```
14
+
15
+ Open `http://localhost:3000` and choose a `.kdna` file. The sample server reads
16
+ environment variables from its process; use your deployment environment or a
17
+ local environment loader if you need `.env` file loading. Do not log or persist
18
+ passwords, license keys, signed entitlements, or server error internals.
@@ -7,9 +7,12 @@
7
7
  "start": "node src/server.js",
8
8
  "test": "node scripts/smoke.mjs"
9
9
  },
10
+ "engines": {
11
+ "node": ">=20"
12
+ },
10
13
  "dependencies": {
11
- "@aikdna/kdna-core": "0.17.0",
12
- "@aikdna/kdna-web-server": "0.2.3",
14
+ "@aikdna/kdna-core": "0.20.0",
15
+ "@aikdna/kdna-web-server": "0.3.0",
13
16
  "express": "^5.2.1"
14
17
  }
15
18
  }
@@ -0,0 +1,5 @@
1
+ allowBuilds:
2
+ cbor-extract: true
3
+ minimumReleaseAgeExclude:
4
+ - '@aikdna/kdna-core@0.20.0'
5
+ - '@aikdna/kdna-web-server@0.3.0'
@@ -7,22 +7,108 @@
7
7
  </head>
8
8
  <body>
9
9
  <main>
10
+ <h1>KDNA Runtime Capsule viewer</h1>
10
11
  <input id="file" type="file" accept=".kdna">
12
+ <p id="kdna-status">Choose a .kdna file</p>
11
13
  <pre id="output">Choose a .kdna file</pre>
14
+ <form id="kdna-password-form" hidden>
15
+ <label for="kdna-password">Password</label>
16
+ <input id="kdna-password" type="password" autocomplete="current-password">
17
+ <button type="submit">Unlock</button>
18
+ </form>
12
19
  </main>
13
20
  <script>
14
21
  const file = document.querySelector('#file')
22
+ const status = document.querySelector('#kdna-status')
15
23
  const output = document.querySelector('#output')
24
+ const passwordForm = document.querySelector('#kdna-password-form')
25
+ const passwordInput = document.querySelector('#kdna-password')
26
+ let pendingUnlock = null
27
+
28
+ async function readJson(response) {
29
+ const body = await response.json()
30
+ if (!response.ok) {
31
+ throw new Error(body?.error?.message || `KDNA request failed (${response.status})`)
32
+ }
33
+ return body
34
+ }
35
+
16
36
  file.addEventListener('change', async () => {
17
- const form = new FormData()
18
- form.set('file', file.files[0])
19
- const inspect = await fetch('/api/kdna/inspect', { method: 'POST', body: form }).then((r) => r.json())
20
- const loaded = await fetch('/api/kdna/load', {
21
- method: 'POST',
22
- headers: { 'content-type': 'application/json' },
23
- body: JSON.stringify({ fileId: inspect.fileId, profile: 'compact' }),
24
- }).then((r) => r.json())
25
- output.textContent = loaded.content || JSON.stringify(loaded, null, 2)
37
+ try {
38
+ pendingUnlock = null
39
+ passwordInput.value = ''
40
+ passwordForm.hidden = true
41
+ output.id = 'output'
42
+ status.textContent = 'inspecting'
43
+ const form = new FormData()
44
+ form.set('file', file.files[0])
45
+ const inspect = await readJson(await fetch('/api/kdna/inspect', {
46
+ method: 'POST',
47
+ body: form,
48
+ }))
49
+
50
+ status.textContent = 'planning'
51
+ const plan = await readJson(await fetch('/api/kdna/plan-load', {
52
+ method: 'POST',
53
+ headers: { 'content-type': 'application/json' },
54
+ body: JSON.stringify({ fileId: inspect.fileId, context: {} }),
55
+ }))
56
+ if (!plan.canProceed) {
57
+ status.textContent = 'locked'
58
+ output.textContent = JSON.stringify({ inspect, plan }, null, 2)
59
+ if (plan.plan?.state === 'needs_password' || plan.plan?.required_action === 'enter_password') {
60
+ pendingUnlock = { fileId: inspect.fileId, inspect, plan }
61
+ passwordForm.hidden = false
62
+ }
63
+ return
64
+ }
65
+
66
+ status.textContent = 'loading'
67
+ const loaded = await readJson(await fetch('/api/kdna/load', {
68
+ method: 'POST',
69
+ headers: { 'content-type': 'application/json' },
70
+ body: JSON.stringify({ fileId: inspect.fileId, profile: 'compact' }),
71
+ }))
72
+ status.textContent = 'loaded'
73
+ output.id = 'kdna-runtime-capsule'
74
+ output.textContent = JSON.stringify({ inspect, plan: plan.plan, content: loaded.content }, null, 2)
75
+ } catch (error) {
76
+ status.textContent = 'error'
77
+ output.textContent = error.message
78
+ }
79
+ })
80
+
81
+ passwordForm.addEventListener('submit', async (event) => {
82
+ event.preventDefault()
83
+ if (!pendingUnlock) return
84
+ const password = passwordInput.value
85
+ passwordInput.value = ''
86
+ try {
87
+ status.textContent = 'loading'
88
+ const loaded = await readJson(await fetch('/api/kdna/load', {
89
+ method: 'POST',
90
+ headers: { 'content-type': 'application/json' },
91
+ body: JSON.stringify({
92
+ fileId: pendingUnlock.fileId,
93
+ profile: 'compact',
94
+ password,
95
+ }),
96
+ }))
97
+ status.textContent = 'loaded'
98
+ passwordForm.hidden = true
99
+ output.id = 'kdna-runtime-capsule'
100
+ output.textContent = JSON.stringify({
101
+ inspect: pendingUnlock.inspect,
102
+ plan: pendingUnlock.plan.plan,
103
+ content: loaded.content,
104
+ }, null, 2)
105
+ pendingUnlock = null
106
+ } catch (error) {
107
+ status.textContent = 'locked'
108
+ output.textContent = error.message
109
+ } finally {
110
+ passwordInput.value = ''
111
+ }
26
112
  })
27
113
  </script>
28
114
  </body>
@@ -0,0 +1,16 @@
1
+ # KDNA Next.js App Router starter
2
+
3
+ This generated Node.js 20+ application binds KDNA Core 0.20.0, Web Server
4
+ 0.3.0, and React 0.3.0. The browser uploads a selected `.kdna` file; the server
5
+ then performs inspect, LoadPlan evaluation, authorization, and Runtime Capsule
6
+ projection.
7
+
8
+ ```bash
9
+ cp .env.local.example .env.local
10
+ npm test
11
+ npm run dev
12
+ ```
13
+
14
+ Open `http://localhost:3000` and choose a `.kdna` file. Storage and activation
15
+ configuration are documented in `.env.local.example`. Do not log or persist
16
+ passwords, license keys, signed entitlements, or server error internals.
@@ -8,31 +8,54 @@ import {
8
8
  } from '@aikdna/kdna-react'
9
9
  import { useState } from 'react'
10
10
 
11
+ function AssetFlow({ fileId, inspect }) {
12
+ const [unlockedContent, setUnlockedContent] = useState(null)
13
+
14
+ return (
15
+ <section>
16
+ <KDNAAssetInspector inspect={inspect} />
17
+ <KDNALoadPlanGate fileId={fileId} endpoint="/api/kdna">
18
+ {({ status, content, error }) => {
19
+ if (status === 'locked' && !unlockedContent) {
20
+ return (
21
+ <KDNAPasswordUnlockDialog
22
+ fileId={fileId}
23
+ endpoint="/api/kdna"
24
+ onUnlock={(result) => setUnlockedContent(result.content)}
25
+ />
26
+ )
27
+ }
28
+ const visibleContent = unlockedContent ?? content
29
+ return (
30
+ <>
31
+ <p id="kdna-status">{visibleContent ? 'loaded' : status}</p>
32
+ {error ? <p role="alert">{error.message}</p> : null}
33
+ {visibleContent ? (
34
+ <pre id="kdna-runtime-capsule">
35
+ {JSON.stringify(visibleContent, null, 2)}
36
+ </pre>
37
+ ) : null}
38
+ </>
39
+ )
40
+ }}
41
+ </KDNALoadPlanGate>
42
+ </section>
43
+ )
44
+ }
45
+
11
46
  export default function Page() {
12
- const [unlock, setUnlock] = useState(null)
47
+ const [uploadError, setUploadError] = useState(null)
13
48
 
14
49
  return (
15
50
  <main>
16
- <KDNAFileDropzone endpoint="/api/kdna" onError={console.error}>
51
+ <h1>KDNA Runtime Capsule viewer</h1>
52
+ <KDNAFileDropzone endpoint="/api/kdna" onError={setUploadError}>
17
53
  {({ fileId, inspect, loading }) => (
18
54
  <section>
19
55
  <p>{loading ? 'Uploading...' : 'Drop or choose a .kdna file'}</p>
20
- {inspect ? <KDNAAssetInspector inspect={inspect} /> : null}
21
- {fileId ? (
22
- <KDNALoadPlanGate fileId={fileId} endpoint="/api/kdna">
23
- {({ status, content }) => {
24
- if (status === 'locked') {
25
- return (
26
- <KDNAPasswordUnlockDialog
27
- fileId={fileId}
28
- endpoint="/api/kdna"
29
- onUnlock={(result) => setUnlock(result.content)}
30
- />
31
- )
32
- }
33
- return <pre>{unlock || content || status}</pre>
34
- }}
35
- </KDNALoadPlanGate>
56
+ {uploadError ? <p role="alert">{uploadError.message}</p> : null}
57
+ {fileId && inspect ? (
58
+ <AssetFlow key={fileId} fileId={fileId} inspect={inspect} />
36
59
  ) : null}
37
60
  </section>
38
61
  )}
@@ -8,23 +8,21 @@
8
8
  "start": "next start",
9
9
  "test": "node scripts/smoke.mjs"
10
10
  },
11
+ "engines": {
12
+ "node": ">=20"
13
+ },
11
14
  "dependencies": {
12
- "@aikdna/kdna-core": "0.17.0",
13
- "@aikdna/kdna-react": "0.2.0",
14
- "@aikdna/kdna-web-server": "0.2.3",
15
+ "@aikdna/kdna-core": "0.20.0",
16
+ "@aikdna/kdna-react": "0.3.0",
17
+ "@aikdna/kdna-web-server": "0.3.0",
15
18
  "next": "^16.2.10",
16
19
  "react": "^19.2.7",
17
20
  "react-dom": "^19.2.7"
18
21
  },
19
22
  "overrides": {
20
- "postcss": "^8.5.10"
21
- },
22
- "pnpm": {
23
- "overrides": {
24
- "postcss": "^8.5.10"
25
- }
23
+ "postcss": "8.5.10"
26
24
  },
27
25
  "resolutions": {
28
- "postcss": "^8.5.10"
26
+ "postcss": "8.5.10"
29
27
  }
30
28
  }
@@ -0,0 +1,10 @@
1
+ overrides:
2
+ postcss: 8.5.10
3
+ allowBuilds:
4
+ cbor-extract: true
5
+ sharp: true
6
+ minimumReleaseAgeExclude:
7
+ - '@aikdna/kdna-core@0.20.0'
8
+ - '@aikdna/kdna-react@0.3.0'
9
+ - '@aikdna/kdna-web-client@0.2.2'
10
+ - '@aikdna/kdna-web-server@0.3.0'
@@ -0,0 +1,16 @@
1
+ # KDNA Next.js Pages Router starter
2
+
3
+ This generated Node.js 20+ application binds KDNA Core 0.20.0, Web Server
4
+ 0.3.0, and React 0.3.0. The browser uploads a selected `.kdna` file; the server
5
+ then performs inspect, LoadPlan evaluation, authorization, and Runtime Capsule
6
+ projection.
7
+
8
+ ```bash
9
+ cp .env.local.example .env.local
10
+ npm test
11
+ npm run dev
12
+ ```
13
+
14
+ Open `http://localhost:3000` and choose a `.kdna` file. Storage and activation
15
+ configuration are documented in `.env.local.example`. Do not log or persist
16
+ passwords, license keys, signed entitlements, or server error internals.
@@ -8,23 +8,21 @@
8
8
  "start": "next start",
9
9
  "test": "node scripts/smoke.mjs"
10
10
  },
11
+ "engines": {
12
+ "node": ">=20"
13
+ },
11
14
  "dependencies": {
12
- "@aikdna/kdna-core": "0.17.0",
13
- "@aikdna/kdna-react": "0.2.0",
14
- "@aikdna/kdna-web-server": "0.2.3",
15
+ "@aikdna/kdna-core": "0.20.0",
16
+ "@aikdna/kdna-react": "0.3.0",
17
+ "@aikdna/kdna-web-server": "0.3.0",
15
18
  "next": "^16.2.10",
16
19
  "react": "^19.2.7",
17
20
  "react-dom": "^19.2.7"
18
21
  },
19
22
  "overrides": {
20
- "postcss": "^8.5.10"
21
- },
22
- "pnpm": {
23
- "overrides": {
24
- "postcss": "^8.5.10"
25
- }
23
+ "postcss": "8.5.10"
26
24
  },
27
25
  "resolutions": {
28
- "postcss": "^8.5.10"
26
+ "postcss": "8.5.10"
29
27
  }
30
28
  }
@@ -12,6 +12,13 @@ const handler = createKDNARouter({
12
12
  activationServerUrl: process.env.KDNA_ACTIVATION_URL,
13
13
  })
14
14
 
15
- export default function kdna(req, res) {
16
- return handler(req, res)
15
+ export default async function kdna(req, res) {
16
+ const incomingUrl = req.url
17
+ const route = Array.isArray(req.query.route) ? req.query.route : []
18
+ req.url = `/${route.join('/')}`
19
+ try {
20
+ await handler(req, res)
21
+ } finally {
22
+ req.url = incomingUrl
23
+ }
17
24
  }
@@ -6,31 +6,54 @@ import {
6
6
  } from '@aikdna/kdna-react'
7
7
  import { useState } from 'react'
8
8
 
9
+ function AssetFlow({ fileId, inspect }) {
10
+ const [unlockedContent, setUnlockedContent] = useState(null)
11
+
12
+ return (
13
+ <section>
14
+ <KDNAAssetInspector inspect={inspect} />
15
+ <KDNALoadPlanGate fileId={fileId} endpoint="/api/kdna">
16
+ {({ status, content, error }) => {
17
+ if (status === 'locked' && !unlockedContent) {
18
+ return (
19
+ <KDNAPasswordUnlockDialog
20
+ fileId={fileId}
21
+ endpoint="/api/kdna"
22
+ onUnlock={(result) => setUnlockedContent(result.content)}
23
+ />
24
+ )
25
+ }
26
+ const visibleContent = unlockedContent ?? content
27
+ return (
28
+ <>
29
+ <p id="kdna-status">{visibleContent ? 'loaded' : status}</p>
30
+ {error ? <p role="alert">{error.message}</p> : null}
31
+ {visibleContent ? (
32
+ <pre id="kdna-runtime-capsule">
33
+ {JSON.stringify(visibleContent, null, 2)}
34
+ </pre>
35
+ ) : null}
36
+ </>
37
+ )
38
+ }}
39
+ </KDNALoadPlanGate>
40
+ </section>
41
+ )
42
+ }
43
+
9
44
  export default function Page() {
10
- const [unlock, setUnlock] = useState(null)
45
+ const [uploadError, setUploadError] = useState(null)
11
46
 
12
47
  return (
13
48
  <main>
14
- <KDNAFileDropzone endpoint="/api/kdna" onError={console.error}>
49
+ <h1>KDNA Runtime Capsule viewer</h1>
50
+ <KDNAFileDropzone endpoint="/api/kdna" onError={setUploadError}>
15
51
  {({ fileId, inspect, loading }) => (
16
52
  <section>
17
53
  <p>{loading ? 'Uploading...' : 'Drop or choose a .kdna file'}</p>
18
- {inspect ? <KDNAAssetInspector inspect={inspect} /> : null}
19
- {fileId ? (
20
- <KDNALoadPlanGate fileId={fileId} endpoint="/api/kdna">
21
- {({ status, content }) => {
22
- if (status === 'locked') {
23
- return (
24
- <KDNAPasswordUnlockDialog
25
- fileId={fileId}
26
- endpoint="/api/kdna"
27
- onUnlock={(result) => setUnlock(result.content)}
28
- />
29
- )
30
- }
31
- return <pre>{unlock || content || status}</pre>
32
- }}
33
- </KDNALoadPlanGate>
54
+ {uploadError ? <p role="alert">{uploadError.message}</p> : null}
55
+ {fileId && inspect ? (
56
+ <AssetFlow key={fileId} fileId={fileId} inspect={inspect} />
34
57
  ) : null}
35
58
  </section>
36
59
  )}
@@ -0,0 +1,10 @@
1
+ overrides:
2
+ postcss: 8.5.10
3
+ allowBuilds:
4
+ cbor-extract: true
5
+ sharp: true
6
+ minimumReleaseAgeExclude:
7
+ - '@aikdna/kdna-core@0.20.0'
8
+ - '@aikdna/kdna-react@0.3.0'
9
+ - '@aikdna/kdna-web-client@0.2.2'
10
+ - '@aikdna/kdna-web-server@0.3.0'