jsgui3-server 0.0.151 → 0.0.155
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/README.md +21 -0
- package/admin-ui/v1/controls/admin_shell.js +33 -0
- package/admin-ui/v1/server.js +14 -1
- package/docs/agi/skills/README.md +23 -0
- package/docs/agi/skills/agent-output-control/SKILL.md +56 -0
- package/docs/agi/skills/ai-deep-research/SKILL.md +52 -0
- package/docs/agi/skills/autonomous-ui-inspection/SKILL.md +102 -0
- package/docs/agi/skills/deep-research/SKILL.md +156 -0
- package/docs/agi/skills/endurance/SKILL.md +53 -0
- package/docs/agi/skills/exploring-other-codebases/SKILL.md +56 -0
- package/docs/agi/skills/instruction-adherence/SKILL.md +73 -0
- package/docs/agi/skills/jsgui3-activation-debug/SKILL.md +94 -0
- package/docs/agi/skills/jsgui3-context-menu-patterns/SKILL.md +94 -0
- package/docs/agi/skills/puppeteer-efficient-ui-verification/SKILL.md +65 -0
- package/docs/agi/skills/runaway-process-guard/SKILL.md +49 -0
- package/docs/agi/skills/session-discipline/SKILL.md +40 -0
- package/docs/agi/skills/skill-writing/SKILL.md +211 -0
- package/docs/agi/skills/static-analysis/SKILL.md +58 -0
- package/docs/agi/skills/targeted-testing/SKILL.md +63 -0
- package/docs/agi/skills/understanding-jsgui3/SKILL.md +85 -0
- package/docs/api-reference.md +120 -2
- package/docs/books/jsgui3-bundling-research-book/06-unused-module-elimination-strategy.md +1 -0
- package/docs/books/jsgui3-bundling-research-book/07-jsgui3-html-control-and-mixin-pruning.md +33 -0
- package/docs/books/website-design/01-introduction.md +73 -0
- package/docs/books/website-design/02-current-state.md +195 -0
- package/docs/books/website-design/03-base-class.md +181 -0
- package/docs/books/website-design/04-webpage.md +307 -0
- package/docs/books/website-design/05-website.md +456 -0
- package/docs/books/website-design/06-pages-storage.md +170 -0
- package/docs/books/website-design/07-api-layer.md +285 -0
- package/docs/books/website-design/08-server-integration.md +271 -0
- package/docs/books/website-design/09-cross-agent-review.md +190 -0
- package/docs/books/website-design/10-open-questions.md +196 -0
- package/docs/books/website-design/11-converged-recommendation.md +205 -0
- package/docs/books/website-design/12-content-model.md +395 -0
- package/docs/books/website-design/13-webpage-module-spec.md +404 -0
- package/docs/books/website-design/14-website-module-spec.md +541 -0
- package/docs/books/website-design/15-multi-repo-plan.md +275 -0
- package/docs/books/website-design/16-minimal-first.md +203 -0
- package/docs/books/website-design/17-implementation-report-codex.md +81 -0
- package/docs/books/website-design/README.md +43 -0
- package/docs/bundling-system-deep-dive.md +112 -3
- package/docs/configuration-reference.md +84 -0
- package/docs/proposals/jsgui3-website-and-webpage-design-jsgui3-server-support.md +257 -0
- package/docs/proposals/jsgui3-website-and-webpage-design-review.md +73 -0
- package/docs/proposals/jsgui3-website-and-webpage-design.md +732 -0
- package/docs/swagger.md +316 -0
- package/examples/controls/1) window/server.js +6 -1
- package/examples/controls/21) mvvm and declarative api/check.js +94 -0
- package/examples/controls/21) mvvm and declarative api/check_output.txt +25 -0
- package/examples/controls/21) mvvm and declarative api/check_output_2.txt +27 -0
- package/examples/controls/21) mvvm and declarative api/client.js +241 -0
- declarative api/e2e-screenshot-1-name-change.png +0 -0
- declarative api/e2e-screenshot-2-toggled.png +0 -0
- declarative api/e2e-screenshot-3-final.png +0 -0
- declarative api/e2e-screenshot-final.png +0 -0
- package/examples/controls/21) mvvm and declarative api/e2e-test.js +175 -0
- package/examples/controls/21) mvvm and declarative api/out.html +1 -0
- package/examples/controls/21) mvvm and declarative api/page_out.html +1 -0
- package/examples/controls/21) mvvm and declarative api/server.js +18 -0
- package/examples/data-views/01) query-endpoint/server.js +61 -0
- package/labs/website-design/001-base-class-overhead/check.js +162 -0
- package/labs/website-design/002-pages-storage/check.js +244 -0
- package/labs/website-design/002-pages-storage/results.txt +0 -0
- package/labs/website-design/003-type-detection/check.js +193 -0
- package/labs/website-design/003-type-detection/results.txt +0 -0
- package/labs/website-design/004-two-stage-validation/check.js +314 -0
- package/labs/website-design/004-two-stage-validation/results.txt +0 -0
- package/labs/website-design/005-normalize-input/check.js +303 -0
- package/labs/website-design/006-serve-website-spike/check.js +290 -0
- package/labs/website-design/README.md +34 -0
- package/labs/website-design/manifest.json +68 -0
- package/labs/website-design/run-all.js +60 -0
- package/middleware/json-body.js +126 -0
- package/openapi.js +474 -0
- package/package.json +13 -7
- package/publishers/Publishers.js +6 -5
- package/publishers/http-function-publisher.js +135 -126
- package/publishers/http-webpage-publisher.js +89 -11
- package/publishers/query-publisher.js +116 -0
- package/publishers/swagger-publisher.js +203 -0
- package/publishers/swagger-ui.js +578 -0
- package/resources/adapters/array-adapter.js +143 -0
- package/resources/processors/bundlers/js/esbuild/Advanced_JS_Bundler_Using_ESBuild.js +90 -22
- package/resources/processors/bundlers/js/esbuild/Core_JS_Non_Minifying_Bundler_Using_ESBuild.js +50 -14
- package/resources/processors/bundlers/js/esbuild/Core_JS_Single_File_Minifying_Bundler_Using_ESBuild.js +48 -14
- package/resources/processors/bundlers/js/esbuild/JSGUI3_HTML_Control_Optimizer.js +396 -44
- package/resources/query-resource.js +131 -0
- package/serve-factory.js +677 -18
- package/server.js +585 -167
- package/tests/README.md +86 -2
- package/tests/admin-ui-jsgui-controls.test.js +16 -1
- package/tests/bundling-default-control-elimination.puppeteer.test.js +32 -1
- package/tests/control-elimination-root-feature-pruning.test.js +440 -0
- package/tests/control-elimination-static-bracket-access.test.js +245 -0
- package/tests/control-scan-manifest-regression.test.js +2 -0
- package/tests/end-to-end.test.js +22 -21
- package/tests/fixtures/control_scan_manifest_expectations.json +4 -2
- package/tests/helpers/playwright-e2e-harness.js +326 -0
- package/tests/helpers/puppeteer-e2e-harness.js +62 -1
- package/tests/openapi.test.js +319 -0
- package/tests/playwright-smoke.test.js +134 -0
- package/tests/project-local-controls-bundling.puppeteer.test.js +462 -0
- package/tests/publish-enhancements.test.js +673 -0
- package/tests/query-publisher.test.js +430 -0
- package/tests/quick-json-body-test.js +169 -0
- package/tests/serve.test.js +425 -122
- package/tests/swagger-publisher.test.js +1076 -0
- package/tests/test-runner.js +4 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
# Chapter 15: Multi-Repo Implementation Plan
|
|
2
|
+
|
|
3
|
+
This chapter coordinates the implementation across three repositories. The `jsgui3-webpage` and `jsgui3-website` packages are separate npm modules; `jsgui3-server` consumes them.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 15.1 Dependency Graph
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
jsgui3-html (Evented_Class)
|
|
11
|
+
↑
|
|
12
|
+
jsgui3-webpage (Webpage class)
|
|
13
|
+
↑
|
|
14
|
+
jsgui3-website (Website class, depends on Webpage for page creation)
|
|
15
|
+
↑
|
|
16
|
+
jsgui3-server (consumes Website/Webpage, normalization layer, publisher)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Each arrow means "depends on". Implementation order follows this graph **bottom-up**.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 15.2 Current State
|
|
24
|
+
|
|
25
|
+
| Package | Version | Lines | What Exists |
|
|
26
|
+
|---------|---------|-------|-------------|
|
|
27
|
+
| `jsgui3-html` | (stable) | large | `Evented_Class`, `Control`, `Page_Context` — all stable, no changes needed |
|
|
28
|
+
| `jsgui3-webpage` | 0.0.8 (npm) | 14 → ~200 | Skeleton on npm; full implementation in repo (see Ch.17) |
|
|
29
|
+
| `jsgui3-website` | 0.0.8 (npm) | 14 → ~200 | Skeleton on npm; full implementation in repo (see Ch.17) |
|
|
30
|
+
| `jsgui3-server` | (active) | large | Server integration complete: `normalize_serve_input`, `website_manifest`, `publication_summary` added to `serve-factory.js` |
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 15.3 Implementation Phases
|
|
35
|
+
|
|
36
|
+
This plan uses two aligned tracks:
|
|
37
|
+
|
|
38
|
+
1. **Minimal-first track** (v0.1.x) from Chapter 16
|
|
39
|
+
2. **Full-spec track** (v0.3.x) from Chapters 13 and 14
|
|
40
|
+
|
|
41
|
+
### Phase 1: jsgui3-webpage → v0.1.0 (minimal-first) ✅ COMPLETE
|
|
42
|
+
|
|
43
|
+
**Repo**: `jsgui3-webpage`
|
|
44
|
+
|
|
45
|
+
**Deliverables**:
|
|
46
|
+
1. Implement minimal `Webpage.js` per Chapter 16 (`path`, `name`, `title`, `ctrl`, `content`, `meta`, assets)
|
|
47
|
+
2. Include migration bridge: accept legacy `content: Function` as renderer alias when `ctrl` is missing
|
|
48
|
+
3. Write focused unit tests for constructor behavior + alias normalization
|
|
49
|
+
4. Update `README.md` with minimal-first examples
|
|
50
|
+
5. Update `package.json`: version 0.1.0, add `main: "index.js"`
|
|
51
|
+
6. Publish to npm
|
|
52
|
+
|
|
53
|
+
**Acceptance criteria**:
|
|
54
|
+
1. Minimal constructor behaviors pass
|
|
55
|
+
2. Legacy renderer alias (`content: Function`) works for compatibility
|
|
56
|
+
3. `require('jsgui3-webpage')` returns the new Webpage class
|
|
57
|
+
|
|
58
|
+
**No other repo needs to change for this phase to succeed.**
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
### Phase 2: jsgui3-website → v0.1.0 (minimal-first) ✅ COMPLETE
|
|
63
|
+
|
|
64
|
+
**Repo**: `jsgui3-website`
|
|
65
|
+
|
|
66
|
+
**Prerequisites**: jsgui3-webpage v0.1.0 published
|
|
67
|
+
|
|
68
|
+
**Deliverables**:
|
|
69
|
+
1. Implement minimal `Website.js` per Chapter 16 (Map-backed pages + core methods)
|
|
70
|
+
2. Add `jsgui3-webpage` as dependency
|
|
71
|
+
3. Write focused unit tests for page registry and duplicate detection
|
|
72
|
+
4. Update `README.md` with minimal-first examples
|
|
73
|
+
5. Update `package.json`: version 0.1.0, dependencies, main field
|
|
74
|
+
6. Publish to npm
|
|
75
|
+
|
|
76
|
+
**Acceptance criteria**:
|
|
77
|
+
1. Page registry methods (`add_page`, `get_page`, `has_page`) pass
|
|
78
|
+
2. Duplicate path detection passes
|
|
79
|
+
3. `require('jsgui3-website')` returns the new Website class
|
|
80
|
+
4. Lab 002 (pages storage) assumptions hold against real module usage
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
### Phase 3: jsgui3-server integration against v0.1.x primitives ✅ COMPLETE
|
|
85
|
+
|
|
86
|
+
**Repo**: `jsgui3-server`
|
|
87
|
+
|
|
88
|
+
**Prerequisites**: jsgui3-webpage v0.1.0 and jsgui3-website v0.1.0 published
|
|
89
|
+
|
|
90
|
+
**Deliverables**:
|
|
91
|
+
1. Update `package.json` to depend on `jsgui3-webpage@^0.1.0` and `jsgui3-website@^0.1.0`
|
|
92
|
+
2. Add `normalize_serve_input()` function (per Lab 005 design)
|
|
93
|
+
3. Integrate into `serve-factory.js` publisher pipeline
|
|
94
|
+
4. Add compatibility bridge for renderer field (`page.ctrl` canonical, legacy `page.content` function still accepted)
|
|
95
|
+
5. Add integration tests
|
|
96
|
+
6. Ensure all existing server tests still pass (backward compatibility)
|
|
97
|
+
|
|
98
|
+
**Acceptance criteria**:
|
|
99
|
+
- Lab 005 (input normalization) passes against the real modules
|
|
100
|
+
- Lab 006 (server integration spike) passes against the real modules
|
|
101
|
+
- Legacy `Server.serve(MyCtrl)` and `Server.serve({pages, api})` still work
|
|
102
|
+
- A real Website with pages serves correctly on localhost
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
### Phase 4: primitives upgrade to full-spec track (v0.3.0) ⏳ NOT STARTED
|
|
107
|
+
|
|
108
|
+
**Repos**: `jsgui3-webpage`, `jsgui3-website`
|
|
109
|
+
|
|
110
|
+
**Prerequisites**: Phase 3 complete and stable in integration
|
|
111
|
+
|
|
112
|
+
**Deliverables**:
|
|
113
|
+
1. Implement full `Webpage` contract from Chapter 13 (Evented_Class, finalize, i18n helpers, type marker, toJSON)
|
|
114
|
+
2. Implement full `Website` contract from Chapter 14 (API registry, finalize cascade, richer serialization)
|
|
115
|
+
3. Keep migration bridge for legacy renderer shape during upgrade window
|
|
116
|
+
4. Publish `jsgui3-webpage@0.3.0` and `jsgui3-website@0.3.0`
|
|
117
|
+
|
|
118
|
+
**Acceptance criteria**:
|
|
119
|
+
1. Chapter 13 and Chapter 14 unit test plans pass
|
|
120
|
+
2. Lab 001, 003, and 004 assumptions pass against real modules
|
|
121
|
+
3. No regressions in Phase 3 server integration tests
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
### Phase 5: Content integration (stretch) ⏳ NOT STARTED
|
|
126
|
+
|
|
127
|
+
**All repos**
|
|
128
|
+
|
|
129
|
+
**Deliverables**:
|
|
130
|
+
1. Add content-aware rendering to the server (resolve locale, pass content to Controls)
|
|
131
|
+
2. Create an example multi-language Webpage with real i18n content
|
|
132
|
+
3. Demonstrate content loading from JSON files
|
|
133
|
+
4. Update lab experiments to test content flow end-to-end
|
|
134
|
+
|
|
135
|
+
**Acceptance criteria**:
|
|
136
|
+
- A page with translated content renders correctly in multiple locales
|
|
137
|
+
- `get_string()` and `resolve_content()` are exercised in integration tests
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## 15.4 Version Pinning Strategy
|
|
142
|
+
|
|
143
|
+
| Consumer | Dependency | Version Constraint |
|
|
144
|
+
|----------|-----------|-------------------|
|
|
145
|
+
| `jsgui3-website` | `jsgui3-webpage` | `^0.1.0` during minimal-first track |
|
|
146
|
+
| `jsgui3-server` | `jsgui3-webpage` | `^0.1.0` initially, move to `^0.3.0` after Phase 4 |
|
|
147
|
+
| `jsgui3-server` | `jsgui3-website` | `^0.1.0` initially, move to `^0.3.0` after Phase 4 |
|
|
148
|
+
|
|
149
|
+
### Semver policy
|
|
150
|
+
|
|
151
|
+
- **0.x.y**: pre-stable; minor bumps may include breaking changes
|
|
152
|
+
- **1.0.0**: stable contract; breaking changes require major bump
|
|
153
|
+
- Target stable at 1.0.0 after Phase 4+5 contracts are validated in production
|
|
154
|
+
|
|
155
|
+
### npm link during development
|
|
156
|
+
|
|
157
|
+
During development, use `npm link` for cross-repo testing:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# In jsgui3-webpage directory
|
|
161
|
+
npm link
|
|
162
|
+
|
|
163
|
+
# In jsgui3-website directory
|
|
164
|
+
npm link jsgui3-webpage
|
|
165
|
+
npm link
|
|
166
|
+
|
|
167
|
+
# In jsgui3-server directory
|
|
168
|
+
npm link jsgui3-webpage
|
|
169
|
+
npm link jsgui3-website
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Lab 003 confirmed that the `Symbol.for()` detection strategy works across linked packages (unlike `instanceof`).
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## 15.5 Testing Strategy
|
|
177
|
+
|
|
178
|
+
### Per-repo unit tests
|
|
179
|
+
|
|
180
|
+
Each repo has its own test suite that runs independently:
|
|
181
|
+
|
|
182
|
+
| Repo | Test Path | What It Tests |
|
|
183
|
+
|------|-----------|---------------|
|
|
184
|
+
| `jsgui3-webpage` | `test/webpage.test.js` | Webpage class in isolation |
|
|
185
|
+
| `jsgui3-website` | `test/website.test.js` | Website class with Webpage dependency |
|
|
186
|
+
| `jsgui3-server` | Existing test suite + new | Server integration with Website/Webpage |
|
|
187
|
+
|
|
188
|
+
### Cross-repo integration (in jsgui3-server)
|
|
189
|
+
|
|
190
|
+
The lab experiments in `labs/website-design/` serve as cross-repo integration tests:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
# From jsgui3-server, after npm linking or installing new versions
|
|
194
|
+
node labs/website-design/run-all.js
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
All 6 experiments should pass against the real modules — currently they use prototype classes that mirror the spec.
|
|
198
|
+
|
|
199
|
+
### When to run what
|
|
200
|
+
|
|
201
|
+
| When | Run |
|
|
202
|
+
|------|-----|
|
|
203
|
+
| Editing Webpage class | `cd jsgui3-webpage && npm test` |
|
|
204
|
+
| Editing Website class | `cd jsgui3-website && npm test` |
|
|
205
|
+
| Editing server integration | `cd jsgui3-server && npm test && node labs/website-design/run-all.js` |
|
|
206
|
+
| Before publishing any package | All of the above |
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## 15.6 npm Publish Workflow
|
|
211
|
+
|
|
212
|
+
### Pre-publish checklist
|
|
213
|
+
|
|
214
|
+
1. All per-repo tests pass
|
|
215
|
+
2. Version in `package.json` updated
|
|
216
|
+
3. README reflects current API
|
|
217
|
+
4. Cross-repo lab experiments pass in jsgui3-server
|
|
218
|
+
5. Git tag created for current phase (`v0.1.0` minimal-first, `v0.3.0` full-spec)
|
|
219
|
+
|
|
220
|
+
### Publish order
|
|
221
|
+
|
|
222
|
+
1. `jsgui3-webpage` first (no upstream dependency)
|
|
223
|
+
2. `jsgui3-website` second (depends on webpage)
|
|
224
|
+
3. `jsgui3-server` — update `package.json` dependencies, commit, no separate publish needed
|
|
225
|
+
|
|
226
|
+
### Rollback
|
|
227
|
+
|
|
228
|
+
If a publish reveals issues:
|
|
229
|
+
1. `npm unpublish jsgui3-XXX@<version>` (within 72 hours)
|
|
230
|
+
2. Or publish a patch release with the fix (`0.1.1`, `0.3.1`, etc.)
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## 15.7 Agent Assignment Considerations
|
|
235
|
+
|
|
236
|
+
| Phase | Repos Touched | Best Agent |
|
|
237
|
+
|-------|--------------|------------|
|
|
238
|
+
| Phase 1: Webpage | `jsgui3-webpage` only | Codex (single repo) or Antigravity |
|
|
239
|
+
| Phase 2: Website | `jsgui3-website` (+ webpage as dependency) | Codex or Antigravity |
|
|
240
|
+
| Phase 3: Server | `jsgui3-server` (+ webpage/website) | Antigravity (multi-repo context) |
|
|
241
|
+
| Phase 4: Full-spec primitives | `jsgui3-webpage`, `jsgui3-website` | Codex or Antigravity |
|
|
242
|
+
| Phase 5: Content | All three repos | Antigravity (cross-repo coordination) |
|
|
243
|
+
|
|
244
|
+
Phases 1 and 2 are independent single-repo tasks. Phase 3 requires multi-repo awareness. Phase 4 should start only after Phase 3 stability is confirmed.
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## 15.8 Risk Register
|
|
249
|
+
|
|
250
|
+
| Risk | Likelihood | Impact | Mitigation |
|
|
251
|
+
|------|-----------|--------|------------|
|
|
252
|
+
| Evented_Class API changes in jsgui3-html | Low | High | Pin jsgui3-html version; test on update |
|
|
253
|
+
| Circular dependency between webpage ↔ website | Medium | Medium | Website depends on Webpage, never the reverse |
|
|
254
|
+
| Breaking change in Webpage API affects Website | Medium | Medium | Freeze shared contract at each phase boundary (`v0.1.x` then `v0.3.x`) |
|
|
255
|
+
| Lab experiments diverge from real implementation | Medium | Low | Re-run labs against real modules in Phase 3 |
|
|
256
|
+
| npm link issues during development | Low | Low | Symbol.for() detection handles cross-install (Lab 003) |
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## 15.9 Timeline Estimate
|
|
261
|
+
|
|
262
|
+
| Phase | Effort | Dependencies |
|
|
263
|
+
|-------|--------|-------------|
|
|
264
|
+
| Phase 1: Webpage minimal | 1–2 hours | None | ✅ Complete |
|
|
265
|
+
| Phase 2: Website minimal | 1–2 hours | Phase 1 published | ✅ Complete |
|
|
266
|
+
| Phase 3: Server integration | 4–6 hours | Phase 2 published | ✅ Complete |
|
|
267
|
+
| Phase 4: Full-spec primitives | 4–6 hours | Phase 3 stable | ⏳ Not started |
|
|
268
|
+
| Phase 5: Content integration | 2–4 hours | Phase 4 complete | ⏳ Not started |
|
|
269
|
+
| **Total** | **12–20 hours** | | **~50% complete** |
|
|
270
|
+
|
|
271
|
+
Phases 1 and 2 can be parallelized only if the minimal Webpage constructor contract is frozen first.
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
*See [Chapter 17](17-implementation-report-codex.md) for the implementation report. See the [README](README.md) for the full chapter index.*
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# Chapter 16: Minimal First Implementation
|
|
2
|
+
|
|
3
|
+
Chapters 12–14 describe the full vision. This chapter defines the **smallest useful version** — what to build first, what to defer, and when to promote deferred features.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 16.1 The Problem with the Full Spec
|
|
8
|
+
|
|
9
|
+
The full spec across Chapters 12–14 includes ~30 features. Both packages are currently 14 lines each. Jumping from 14 lines to a full Evented_Class-based, i18n-aware, finalize-cascading, event-emitting, Symbol-marked module is a big leap that introduces risk:
|
|
10
|
+
|
|
11
|
+
- Features built before they have consumers
|
|
12
|
+
- Dependencies added before they're justified
|
|
13
|
+
- Complexity that makes the first real usage harder to debug
|
|
14
|
+
|
|
15
|
+
**Principle**: ship the thinnest version that supports real usage, then grow it.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 16.2 v0.1 — Store Data, Nothing More
|
|
20
|
+
|
|
21
|
+
### Webpage (~15 lines)
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
class Webpage {
|
|
25
|
+
constructor(spec = {}) {
|
|
26
|
+
const has_legacy_ctrl = typeof spec.content === 'function' && spec.ctrl === undefined;
|
|
27
|
+
|
|
28
|
+
this.path = spec.path;
|
|
29
|
+
this.name = spec.name;
|
|
30
|
+
this.title = spec.title;
|
|
31
|
+
this.ctrl = spec.ctrl || (has_legacy_ctrl ? spec.content : undefined);
|
|
32
|
+
this.content = has_legacy_ctrl ? undefined : spec.content;
|
|
33
|
+
this.render_mode = spec.render_mode;
|
|
34
|
+
this.scripts = spec.scripts || [];
|
|
35
|
+
this.stylesheets = spec.stylesheets || [];
|
|
36
|
+
this.meta = spec.meta || {};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
module.exports = Webpage;
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Website (~30 lines)
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
const Webpage = require('jsgui3-webpage');
|
|
47
|
+
|
|
48
|
+
class Website {
|
|
49
|
+
constructor(spec = {}) {
|
|
50
|
+
this.name = spec.name;
|
|
51
|
+
this.meta = spec.meta || {};
|
|
52
|
+
this._pages = new Map();
|
|
53
|
+
|
|
54
|
+
if (Array.isArray(spec.pages)) {
|
|
55
|
+
for (const p of spec.pages) this.add_page(p);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
add_page(page_or_spec) {
|
|
60
|
+
const page = page_or_spec instanceof Webpage
|
|
61
|
+
? page_or_spec
|
|
62
|
+
: new Webpage(page_or_spec);
|
|
63
|
+
if (page.path && this._pages.has(page.path)) {
|
|
64
|
+
throw new Error(`Duplicate page path: "${page.path}"`);
|
|
65
|
+
}
|
|
66
|
+
this._pages.set(page.path, page);
|
|
67
|
+
return page;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
get_page(path) { return this._pages.get(path); }
|
|
71
|
+
has_page(path) { return this._pages.has(path); }
|
|
72
|
+
get pages() { return [...this._pages.values()]; }
|
|
73
|
+
get page_count() { return this._pages.size; }
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
module.exports = Website;
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### What this gets you
|
|
80
|
+
|
|
81
|
+
- ✅ Webpage holds path, title, content, ctrl, meta, scripts, stylesheets
|
|
82
|
+
- ✅ Website stores pages in a Map (O(1) lookup, duplicate detection — Lab 002)
|
|
83
|
+
- ✅ `add_page()` / `get_page()` / `has_page()` API
|
|
84
|
+
- ✅ Structured content objects are supported
|
|
85
|
+
- ✅ Legacy renderer input (`content: Function`) remains accepted as an alias for `ctrl`
|
|
86
|
+
- ✅ Zero dependencies (no jsgui3-html needed)
|
|
87
|
+
- ✅ ~45 lines total across both packages
|
|
88
|
+
|
|
89
|
+
### What this doesn't have
|
|
90
|
+
|
|
91
|
+
- ❌ No `Evented_Class` base (no events)
|
|
92
|
+
- ❌ No `finalize()` validation
|
|
93
|
+
- ❌ No `toJSON()` serialization
|
|
94
|
+
- ❌ No `Symbol.for()` type markers
|
|
95
|
+
- ❌ No i18n resolution (`get_string`, `resolve_content`)
|
|
96
|
+
- ❌ No API endpoint registry
|
|
97
|
+
- ❌ No path normalization
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## 16.3 Layered Growth Plan
|
|
102
|
+
|
|
103
|
+
Each layer adds one area of functionality. Only add a layer when there's a real consumer.
|
|
104
|
+
|
|
105
|
+
### v0.2 — When you need server integration
|
|
106
|
+
|
|
107
|
+
**Trigger**: `jsgui3-server` needs to detect and route Website/Webpage inputs.
|
|
108
|
+
|
|
109
|
+
**Add**:
|
|
110
|
+
- Path normalization (leading slash)
|
|
111
|
+
- `toJSON()` for admin/debug
|
|
112
|
+
- API endpoint registry on Website (`add_endpoint`, `get_endpoint`)
|
|
113
|
+
- Normalize renderer field (`ctrl` canonical, legacy `content: Function` normalized)
|
|
114
|
+
- Duck-typing detection (check for `add_page` / `get_page`)
|
|
115
|
+
|
|
116
|
+
**Dependencies**: still none. Duck typing doesn't need `Symbol.for()`.
|
|
117
|
+
|
|
118
|
+
### v0.3 — When you need lifecycle safety
|
|
119
|
+
|
|
120
|
+
**Trigger**: bugs from serving incomplete pages, or need to gate publication.
|
|
121
|
+
|
|
122
|
+
**Add**:
|
|
123
|
+
- `finalize()` on Webpage (require path + ctrl)
|
|
124
|
+
- `finalize()` cascade on Website
|
|
125
|
+
- `Evented_Class` base (enables `'finalized'` event)
|
|
126
|
+
|
|
127
|
+
**Dependencies**: adds `jsgui3-html` (for `Evented_Class`).
|
|
128
|
+
|
|
129
|
+
### v0.4 — When you need cross-install safety
|
|
130
|
+
|
|
131
|
+
**Trigger**: npm link / monorepo setups where `instanceof` breaks.
|
|
132
|
+
|
|
133
|
+
**Add**:
|
|
134
|
+
- `Symbol.for('jsgui3.webpage')` / `Symbol.for('jsgui3.website')` markers
|
|
135
|
+
- `isWebpage()` / `isWebsite()` utility functions
|
|
136
|
+
|
|
137
|
+
### v0.5 — When you need i18n
|
|
138
|
+
|
|
139
|
+
**Trigger**: a real site with multi-language content.
|
|
140
|
+
|
|
141
|
+
**Add**:
|
|
142
|
+
- `get_string(key, locale)` with dotted path resolution
|
|
143
|
+
- `get_title(locale)`
|
|
144
|
+
- `resolve_content(locale)` for Controls
|
|
145
|
+
- Locale fallback chains
|
|
146
|
+
- `locales` computed property
|
|
147
|
+
|
|
148
|
+
**Dependencies**: no new deps — just methods on Webpage.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 16.4 Decision Matrix
|
|
153
|
+
|
|
154
|
+
Use this table to decide which version you need:
|
|
155
|
+
|
|
156
|
+
| You want to... | Minimum version |
|
|
157
|
+
|----------------|-----------------|
|
|
158
|
+
| Create a Website with pages and serve it | v0.1 |
|
|
159
|
+
| Have the server detect Website vs legacy input | v0.2 |
|
|
160
|
+
| Define API endpoints on a Website | v0.2 |
|
|
161
|
+
| Validate pages before publishing | v0.3 |
|
|
162
|
+
| Subscribe to page-added / finalized events | v0.3 |
|
|
163
|
+
| Use npm link across packages safely | v0.4 |
|
|
164
|
+
| Serve pages in multiple languages | v0.5 |
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## 16.5 What the Labs Tell Us
|
|
169
|
+
|
|
170
|
+
The lab experiments tested the full-featured design. They remain valid as specs for future versions:
|
|
171
|
+
|
|
172
|
+
| Lab | Tests | Relevant from |
|
|
173
|
+
|-----|-------|---------------|
|
|
174
|
+
| 001 (Base class overhead) | Evented_Class perf | v0.3 onward |
|
|
175
|
+
| 002 (Pages storage) | Map vs Array | **v0.1** (already using Map) |
|
|
176
|
+
| 003 (Type detection) | Symbol + duck typing | v0.4 |
|
|
177
|
+
| 004 (Two-stage validation) | finalize() | v0.3 |
|
|
178
|
+
| 005 (Input normalization) | Manifest shape | v0.2 |
|
|
179
|
+
| 006 (Server integration) | End-to-end | v0.2 |
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## 16.6 Recommendation
|
|
184
|
+
|
|
185
|
+
Start with **v0.1**. Build a real site with it. Discover what's missing through usage, not speculation. The full spec (Ch.12–14) is the *roadmap*, not the *first commit*.
|
|
186
|
+
|
|
187
|
+
The implementation effort for v0.1 is under an hour. Each subsequent layer is 1–2 hours. The total work is the same as implementing the full spec upfront — but each step is validated by a real need.
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## 16.7 Version Track Alignment
|
|
192
|
+
|
|
193
|
+
To keep this chapter consistent with Chapters 13–15:
|
|
194
|
+
|
|
195
|
+
1. **v0.1.x** is the minimal-first release line described here.
|
|
196
|
+
2. **v0.3.x** is the full-spec line from Chapters 13 and 14.
|
|
197
|
+
3. Migration between lines keeps compatibility for legacy `content: Function` renderer inputs until server normalization is fully in place.
|
|
198
|
+
|
|
199
|
+
**Implementation note (Feb 2026)**: Codex implemented the full v0.3 spec directly (see [Ch.17](17-implementation-report-codex.md)), bypassing the minimal-first track. This chapter remains useful as a reference for understanding which features are foundational vs. which are convenience layers — and as a fallback plan if a simpler restart is ever needed.
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
*This chapter complements [Chapter 13](13-webpage-module-spec.md), [Chapter 14](14-website-module-spec.md), and [Chapter 15](15-multi-repo-plan.md), which describe the full target.*
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Chapter 17: Implementation Report (Codex)
|
|
2
|
+
|
|
3
|
+
Date: 2026-02-16
|
|
4
|
+
|
|
5
|
+
## Summary
|
|
6
|
+
|
|
7
|
+
This implementation cycle completed the core multi-repo work proposed in the book:
|
|
8
|
+
|
|
9
|
+
1. Implemented full `Webpage` primitives in `jsgui3-webpage`.
|
|
10
|
+
2. Implemented full `Website` and `Website_Api` primitives in `jsgui3-website`.
|
|
11
|
+
3. Integrated Website/Webpage normalization and serving support into `jsgui3-server`.
|
|
12
|
+
4. Added and ran focused tests for the new input shapes and behavior.
|
|
13
|
+
|
|
14
|
+
## What Was Implemented
|
|
15
|
+
|
|
16
|
+
### 1. `jsgui3-webpage`
|
|
17
|
+
|
|
18
|
+
Main outcomes:
|
|
19
|
+
|
|
20
|
+
1. Replaced skeleton `Webpage` with a full class based on `Evented_Class`.
|
|
21
|
+
2. Added canonical renderer handling (`ctrl`) with legacy compatibility (`content: Function`).
|
|
22
|
+
3. Added path normalization, i18n/content helpers, locale collection, `finalize()`, and `toJSON()`.
|
|
23
|
+
4. Added marker-based type detection support (`Symbol.for('jsgui3.webpage')`).
|
|
24
|
+
5. Added module exports and helper:
|
|
25
|
+
- `index.js`
|
|
26
|
+
- `is_webpage.js`
|
|
27
|
+
6. Added test suite: `test/webpage.test.js`.
|
|
28
|
+
|
|
29
|
+
### 2. `jsgui3-website`
|
|
30
|
+
|
|
31
|
+
Main outcomes:
|
|
32
|
+
|
|
33
|
+
1. Implemented `Website_Api` endpoint registry in `API.js` (fixing previous export bug and missing behavior).
|
|
34
|
+
2. Replaced skeleton `Website` with Map-backed page registry and API integration.
|
|
35
|
+
3. Added page and endpoint lifecycle methods (`add_page`, `remove_page`, `replace_page`, `add_endpoint`, etc.).
|
|
36
|
+
4. Added `finalize()` cascade and `toJSON()` serialization.
|
|
37
|
+
5. Added marker-based type detection support (`Symbol.for('jsgui3.website')`).
|
|
38
|
+
6. Added module exports and helper:
|
|
39
|
+
- `index.js`
|
|
40
|
+
- `is_website.js`
|
|
41
|
+
7. Added test suite: `test/website.test.js`.
|
|
42
|
+
|
|
43
|
+
### 3. `jsgui3-server`
|
|
44
|
+
|
|
45
|
+
Main outcomes in `serve-factory.js`:
|
|
46
|
+
|
|
47
|
+
1. Added Website/Webpage-like input detection and normalization.
|
|
48
|
+
2. Added route/base-path normalization with duplicate-route protection.
|
|
49
|
+
3. Added endpoint normalization supporting metadata (`name`, `path`, `method`, `description`, handler).
|
|
50
|
+
4. Supported direct webpage-like and website-like inputs in `Server.serve(...)`.
|
|
51
|
+
5. Supported non-root page sets through manual page publication path.
|
|
52
|
+
6. Added server-side manifest visibility:
|
|
53
|
+
- `server_instance.website_manifest`
|
|
54
|
+
- `server_instance.publication_summary`
|
|
55
|
+
7. Improved route preparation robustness for API/manual-page servers by resolving router from either `server.router` or `server.server_router`.
|
|
56
|
+
|
|
57
|
+
Main outcomes in tests:
|
|
58
|
+
|
|
59
|
+
1. Added integration coverage in `tests/serve.test.js` for:
|
|
60
|
+
- webpage-like input serving on declared path
|
|
61
|
+
- website-like input with `base_path` and endpoint metadata
|
|
62
|
+
- duplicate normalized route rejection
|
|
63
|
+
|
|
64
|
+
## Validation Results
|
|
65
|
+
|
|
66
|
+
Executed successfully:
|
|
67
|
+
|
|
68
|
+
1. `jsgui3-server`: `npm run test:serve`
|
|
69
|
+
2. `jsgui3-server`: `npm run test:serve:resources`
|
|
70
|
+
3. `jsgui3-webpage`: `npm test`
|
|
71
|
+
4. `jsgui3-website`: `npm test`
|
|
72
|
+
|
|
73
|
+
Note: `jsgui3-website` tests were run in this workspace using local sibling dependency installation for `jsgui3-webpage`, because `jsgui3-webpage@^0.3.0` is not yet published to npm.
|
|
74
|
+
|
|
75
|
+
## Current Limitation
|
|
76
|
+
|
|
77
|
+
Endpoint `method` metadata is preserved in normalization/manifests, but runtime request handling is still method-agnostic because endpoint publishing currently routes through `server.publish(...)`.
|
|
78
|
+
|
|
79
|
+
## Practical Next Step
|
|
80
|
+
|
|
81
|
+
Introduce method-aware API publishing in server/router integration so `GET/POST/...` metadata is enforced, not only stored.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Designing jsgui3-website & jsgui3-webpage
|
|
2
|
+
|
|
3
|
+
A design book covering the full lifecycle from design exploration through implementation of abstract website and webpage representations for the jsgui3 ecosystem.
|
|
4
|
+
|
|
5
|
+
> **Status**: Core implementation complete (see Ch.17) — packages not yet published to npm
|
|
6
|
+
> **Date**: February 2026
|
|
7
|
+
|
|
8
|
+
## Chapters
|
|
9
|
+
|
|
10
|
+
| # | Chapter | Focus |
|
|
11
|
+
|---|---------|-------|
|
|
12
|
+
| 01 | [Introduction & Vision](01-introduction.md) | What we're building, why, and the core design tension |
|
|
13
|
+
| 02 | [Current State](02-current-state.md) | Exact code in both repos today, and how jsgui3-server uses them |
|
|
14
|
+
| 03 | [The Base Class Question](03-base-class.md) | Plain class vs obext vs Evented_Class — the foundational choice |
|
|
15
|
+
| 04 | [Designing the Webpage](04-webpage.md) | Three proposals for jsgui3-webpage, with tradeoffs |
|
|
16
|
+
| 05 | [Designing the Website](05-website.md) | Three proposals for jsgui3-website, with tradeoffs |
|
|
17
|
+
| 06 | [Pages Storage](06-pages-storage.md) | Array vs Collection vs Map — how a website holds its pages |
|
|
18
|
+
| 07 | [The API Layer](07-api-layer.md) | How websites describe their API endpoints |
|
|
19
|
+
| 08 | [Server Integration](08-server-integration.md) | How jsgui3-server would consume these abstractions |
|
|
20
|
+
| 09 | [Cross-Agent Review](09-cross-agent-review.md) | An OpenAI agent's review, and responses to it |
|
|
21
|
+
| 10 | [Open Questions](10-open-questions.md) | Unresolved design decisions for future discussion |
|
|
22
|
+
| 11 | [Converged Recommendation](11-converged-recommendation.md) | A concrete baseline proposal and phased delivery plan |
|
|
23
|
+
| 12 | [The Content Model](12-content-model.md) | Webpage as content container — strings, i18n, locale fallback |
|
|
24
|
+
| 13 | [jsgui3-webpage Module Spec](13-webpage-module-spec.md) | Complete implementation blueprint for the Webpage package |
|
|
25
|
+
| 14 | [jsgui3-website Module Spec](14-website-module-spec.md) | Complete implementation blueprint for the Website package |
|
|
26
|
+
| 15 | [Multi-Repo Plan](15-multi-repo-plan.md) | Cross-repo coordination, versioning, testing, publish workflow |
|
|
27
|
+
| 16 | [Minimal First Implementation](16-minimal-first.md) | Pragmatic v0.1 (~45 lines) + layered growth plan |
|
|
28
|
+
| 17 | [Implementation Report](17-implementation-report-codex.md) | What Codex built, validation results, known gaps |
|
|
29
|
+
|
|
30
|
+
## Suggested Reading Paths
|
|
31
|
+
|
|
32
|
+
- **Quick strategic summary**: 01 → 09 → 11
|
|
33
|
+
- **Implementation-oriented**: 02 → 04 → 05 → 08 → 11
|
|
34
|
+
- **Deep design debate**: 03 → 06 → 07 → 09 → 10
|
|
35
|
+
- **Module specs (full design)**: 12 → 13 → 14 → 15
|
|
36
|
+
- **What was built**: 16 → 17 (minimal-first rationale, then implementation report)
|
|
37
|
+
|
|
38
|
+
## Related Documents
|
|
39
|
+
|
|
40
|
+
- [Original proposals](../../proposals/jsgui3-website-and-webpage-design.md)
|
|
41
|
+
- [OpenAI review](../../proposals/jsgui3-website-and-webpage-design-review.md)
|
|
42
|
+
- [Server support proposal](../../proposals/jsgui3-website-and-webpage-design-jsgui3-server-support.md)
|
|
43
|
+
- [Lab experiments](../../labs/website-design/README.md) — empirical validation of design decisions (179 checks passing)
|