konpeki 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.
Files changed (167) hide show
  1. package/AGENTS.md +21 -28
  2. package/AUTHORING.md +68 -229
  3. package/CONTRIBUTING.md +10 -23
  4. package/README.md +98 -106
  5. package/SETUP.md +49 -129
  6. package/docs/development.md +43 -256
  7. package/docs/workflow.md +6 -108
  8. package/html/README.md +140 -0
  9. package/html/browser.ts +103 -0
  10. package/html/document.ts +38 -0
  11. package/html/floor.ts +34 -0
  12. package/html/index.html +5 -0
  13. package/html/inspect.ts +313 -0
  14. package/html/preview.css +62 -0
  15. package/html/preview.tsx +463 -0
  16. package/html/review-hints.ts +63 -0
  17. package/html/server.ts +99 -0
  18. package/html/source.ts +104 -0
  19. package/html/starter.ts +6 -0
  20. package/html/theme-authoring.md +176 -0
  21. package/html/theme.md +61 -0
  22. package/index.html +9 -9
  23. package/package.json +21 -37
  24. package/plugin.json +1 -1
  25. package/public/og.png +0 -0
  26. package/runtime/browser-B-29TH1a.mjs +595 -0
  27. package/runtime/floor-Cmk7G3pU.mjs +41 -0
  28. package/runtime/konpeki.mjs +90 -1410
  29. package/runtime/server-BAqC_5WD.mjs +2 -0
  30. package/runtime/server-DfRpfcY9.mjs +205 -0
  31. package/runtime/source-B_Ui9tMp.mjs +141 -0
  32. package/runtime/source-CZQq9GUO.mjs +2 -0
  33. package/skills/konpeki/SKILL.md +88 -172
  34. package/skills/konpeki/assets/blank.html +17 -0
  35. package/skills/konpeki/floor.md +76 -0
  36. package/skills/konpeki/references/cover.md +27 -0
  37. package/skills/konpeki/references/long-document.md +40 -0
  38. package/skills/konpeki/references/one-pager.md +27 -0
  39. package/skills/konpeki/references/patterns.md +118 -0
  40. package/skills/konpeki/references/resume.md +28 -0
  41. package/skills/konpeki/references/slides.md +28 -0
  42. package/skills/konpeki/scripts/ensure-runtime.mjs +10 -31
  43. package/skills/konpeki/scripts/prepare-document.mjs +25 -14
  44. package/src/components/PageBoard.tsx +156 -0
  45. package/src/lib/alignment.ts +21 -0
  46. package/src/lib/page-board.ts +25 -0
  47. package/src/lib/review-position.ts +19 -0
  48. package/src/styles/base.css +1 -10
  49. package/src/styles/feedback.css +2 -1
  50. package/src/styles/shell.css +94 -354
  51. package/theme-base.css +90 -0
  52. package/theme.css +56 -0
  53. package/vite.config.ts +2 -5
  54. package/composition/README.md +0 -156
  55. package/composition/compile.ts +0 -227
  56. package/composition/document.ts +0 -600
  57. package/composition/schema.json +0 -3001
  58. package/composition/schema.ts +0 -437
  59. package/composition/theme-tokens.ts +0 -16
  60. package/composition/types.ts +0 -269
  61. package/composition/validate.ts +0 -226
  62. package/composition/vector.ts +0 -143
  63. package/composition/visualizations.ts +0 -319
  64. package/design/README.md +0 -17
  65. package/design/palettes/README.md +0 -14
  66. package/design/palettes/base.ts +0 -14
  67. package/design/palettes/candidates.ts +0 -19
  68. package/design/palettes/index.ts +0 -78
  69. package/design/review/color-theme.md +0 -44
  70. package/design/review/layout.md +0 -16
  71. package/design/review/text.md +0 -18
  72. package/design/review/typography.md +0 -15
  73. package/design/review/visuals.md +0 -31
  74. package/design/semantic-patterns.md +0 -43
  75. package/design/themes/README.md +0 -40
  76. package/design/themes/index.ts +0 -24
  77. package/design/visual-languages/technical-product.md +0 -17
  78. package/design/visual-review.md +0 -88
  79. package/lib/assets.d.ts +0 -8
  80. package/lib/charts.ts +0 -18
  81. package/lib/contrast.ts +0 -16
  82. package/lib/layouts.ts +0 -50
  83. package/lib/slide.tsx +0 -42
  84. package/lib/taste.ts +0 -17
  85. package/lib/text.tsx +0 -89
  86. package/lib/typeface.ts +0 -44
  87. package/scripts/migrate-react-page.ts +0 -120
  88. package/skills/konpeki/assets/blank.json +0 -23
  89. package/slides/README.md +0 -56
  90. package/slides/architecture/PROMPT.md +0 -31
  91. package/slides/architecture/index.tsx +0 -102
  92. package/slides/article-brief/PROMPT.md +0 -35
  93. package/slides/article-brief/index.tsx +0 -71
  94. package/slides/bar-chart/PROMPT.md +0 -39
  95. package/slides/bar-chart/index.tsx +0 -97
  96. package/slides/comparison/PROMPT.md +0 -29
  97. package/slides/comparison/index.tsx +0 -95
  98. package/slides/decision-memo/PROMPT.md +0 -34
  99. package/slides/decision-memo/index.tsx +0 -85
  100. package/slides/delivery-plan/PROMPT.md +0 -45
  101. package/slides/delivery-plan/index.tsx +0 -105
  102. package/slides/drawing-references.md +0 -32
  103. package/slides/experiment/PROMPT.md +0 -44
  104. package/slides/experiment/index.tsx +0 -127
  105. package/slides/github-cover/PROMPT.md +0 -21
  106. package/slides/github-cover/README.md +0 -21
  107. package/slides/github-cover/author.ts +0 -67
  108. package/slides/github-cover/composition.json +0 -595
  109. package/slides/incident-workflow/PROMPT.md +0 -57
  110. package/slides/incident-workflow/index.tsx +0 -78
  111. package/slides/introducing-konpeki/PROMPT.md +0 -30
  112. package/slides/introducing-konpeki/README.md +0 -44
  113. package/slides/introducing-konpeki/SOURCE.md +0 -19
  114. package/slides/introducing-konpeki/author.ts +0 -165
  115. package/slides/introducing-konpeki/composition.json +0 -3270
  116. package/slides/line-chart/PROMPT.md +0 -40
  117. package/slides/line-chart/index.tsx +0 -72
  118. package/slides/migration/PROMPT.md +0 -38
  119. package/slides/migration/index.tsx +0 -89
  120. package/slides/og-images/PROMPT.md +0 -21
  121. package/slides/og-images/index.tsx +0 -76
  122. package/slides/product-introduction/PROMPT.md +0 -24
  123. package/slides/product-introduction/index.tsx +0 -105
  124. package/slides/research-brief/PROMPT.md +0 -40
  125. package/slides/research-brief/index.tsx +0 -104
  126. package/slides/results-explanation/PROMPT.md +0 -32
  127. package/slides/results-explanation/index.tsx +0 -96
  128. package/slides/retrospective/PROMPT.md +0 -43
  129. package/slides/retrospective/index.tsx +0 -105
  130. package/slides/sankey/PROMPT.md +0 -11
  131. package/slides/sankey/index.tsx +0 -93
  132. package/slides/teaching/PROMPT.md +0 -45
  133. package/slides/teaching/index.tsx +0 -124
  134. package/slides/vertical-bar-charts/PROMPT.md +0 -13
  135. package/slides/vertical-bar-charts/index.tsx +0 -97
  136. package/src/app/App.tsx +0 -845
  137. package/src/components/BuildOrb.tsx +0 -40
  138. package/src/components/Canvas.tsx +0 -1191
  139. package/src/components/DiagramTypeIcon.tsx +0 -78
  140. package/src/components/InspectorPanel.tsx +0 -757
  141. package/src/components/LeftPanel.tsx +0 -120
  142. package/src/components/PageSizePicker.tsx +0 -30
  143. package/src/components/Presentation.tsx +0 -105
  144. package/src/components/RevisionNotes.tsx +0 -55
  145. package/src/components/RightPanel.tsx +0 -233
  146. package/src/components/VectorOverflowWarning.tsx +0 -73
  147. package/src/components/WorkspaceChrome.tsx +0 -316
  148. package/src/components/ui.tsx +0 -147
  149. package/src/lib/examples/react-page-migration.json +0 -1295
  150. package/src/lib/examples.ts +0 -42
  151. package/src/lib/export-png.ts +0 -104
  152. package/src/lib/file-session.ts +0 -87
  153. package/src/lib/history.ts +0 -53
  154. package/src/lib/model.ts +0 -188
  155. package/src/lib/page-size.ts +0 -24
  156. package/src/lib/presentation.ts +0 -17
  157. package/src/lib/review.ts +0 -26
  158. package/src/lib/storage.ts +0 -71
  159. package/src/lib/theme.ts +0 -25
  160. package/src/lib/use-file-session.ts +0 -249
  161. package/src/main.tsx +0 -29
  162. package/src/styles/canvas.css +0 -299
  163. package/src/styles/chrome.css +0 -475
  164. package/src/styles/component-previews.css +0 -386
  165. package/src/styles/left-panel.css +0 -187
  166. package/src/styles/presentation.css +0 -72
  167. package/src/styles/right-panel.css +0 -1298
@@ -1,265 +1,52 @@
1
1
  # Development
2
2
 
3
- Clone `https://github.com/vcfgdev/konpeki.git` with the required repository access.
4
- Use [mise](https://mise.jdx.dev/getting-started.html) to install the Node.js and
5
- pnpm versions pinned in `mise.toml`. On macOS, install mise with `brew install mise`.
6
- From the repository root:
3
+ Use the versions pinned by `mise.toml`, run commands through `mise exec --`, and
4
+ preserve `pnpm-lock.yaml`.
7
5
 
8
- ```sh
9
- mise trust
10
- mise install
11
- mise exec -- pnpm install --frozen-lockfile
12
- ```
13
-
14
- Mise manages the toolchain; pnpm manages dependencies through `pnpm-lock.yaml`.
15
- Run the commands below from that repository root with an activated mise shell,
16
- or prefix them with `mise exec --` (for example, `mise exec -- pnpm test`).
17
- No global Node.js or pnpm installation is required. npm for packing and publishing
18
- comes with the pinned Node.js; use `mise exec -- npm pack` to select it explicitly.
19
-
20
- Development and regression checks require a repository checkout, not an npm
21
- tarball, which excludes tests and review scripts.
22
-
23
- ## Development server and demo hosting
24
-
25
- ```sh
26
- pnpm dev
27
- ```
28
-
29
- For a production preview, run `pnpm build` then `pnpm preview`. The build produces
30
- a static site in `dist` for a root or subdirectory. Use
31
- `?example=introducing-konpeki` or `?example=custom-visual` to open a bundled editable
32
- example. Each example has an isolated browser-local working copy that survives
33
- reload. The Demo Mode menu supports JSON import/download, starting blank and
34
- resetting the example. These actions never replace another example or the normal
35
- local draft. Invalid stored data remains untouched until an explicit reset.
36
-
37
- Deploy only the static `dist` output for the public playground, not a file-session
38
- server. Imported documents stay in that browser; there is no account, cloud sync,
39
- AI generation or Build/notes handoff in standalone mode. Downloaded JSON can be
40
- opened in a file-backed session with a coding agent. Browser storage is not a
41
- backup. Hosting shares bundled examples, not private drafts or an AI service.
42
- No deployment is automatic. In a remote environment, expose a review server
43
- through its authenticated preview mechanism, not a loopback address.
44
-
45
- The source CLI's `preview` chooses the next available port if its default is
46
- occupied. An explicit `--port <number>` fails rather than silently changing the
47
- requested port; `--port 0` asks the OS for a free port. `--json` prints one readiness
48
- record with `type`, `compositionPath` and the exact session-bearing `url` after
49
- listening. Treat that URL as a capability, not public logging data. This is a
50
- startup signal, not proof that the browser loaded the right composition.
51
-
52
- ### GitHub Pages
53
-
54
- The public playground is hosted at
55
- [vcfgdev.github.io/konpeki](https://vcfgdev.github.io/konpeki/?example=introducing-konpeki).
56
- The example query opens the introduction; the root URL opens the ordinary local
57
- draft. Each visitor's edits stay in their own browser, not in the deployed site.
58
-
59
- `.github/workflows/pages.yml` deploys only when explicitly dispatched on `main`:
60
-
61
- ```sh
62
- gh workflow run pages.yml --repo vcfgdev/konpeki --ref main
63
- ```
64
-
65
- The workflow uses the pinned mise/pnpm toolchain, runs typecheck and tests, builds
66
- with the Pages base path, and uploads only `dist`. The deployment job publishes
67
- that artifact to the `github-pages` environment. Repository **Settings → Pages →
68
- Source** must be **GitHub Actions**. Ordinary pushes run CI but do not redeploy;
69
- package releases remain separate. Inspect the public example after deployment,
70
- including reload, fonts, editing, JSON download and Present.
71
-
72
- Existing example working copies survive deployments. Download any edits before
73
- choosing **Demo Mode → Reset example** to load a newly published example.
74
-
75
- ## Skill and plugin packaging
76
-
77
- `skills/konpeki/` is the canonical portable skill. The repo's
78
- `.agents/skills/konpeki` symlink enables local discovery without a second
79
- copy. The root Agent Plugins `plugin.json` and repo marketplace expose the same
80
- skill to compatible Codex clients; no MCP, hook or hosted AI is involved. Review
81
- native-client installation separately from the npm smoke test.
82
-
83
- The skill dispatches `init` (open only) and `generate` (create/revise, including
84
- implicit setup). These are agent modes, not CLI subcommands. Its portable
85
- `scripts/prepare-document.mjs` validates through the resolved CLI and exclusively
86
- creates a blank file, or validates an existing file without rewriting it. The
87
- bundled `assets/blank.json` matches `initialDraft(true)` in
88
- `composition/document.ts`; onboarding tests enforce that contract. Keep scripts
89
- and assets when copying the skill. No TypeScript import from `node_modules` is
90
- needed, so a copied skill also supports the existing published runtime.
91
-
92
- Its `scripts/ensure-runtime.mjs` pins the release runtime. It performs
93
- no installation without `--install`, and never updates project dependencies.
94
- When preparing a new release, deliberately update its pin and the plugin version
95
- together with the package version after testing the target runtime. The current
96
- pin is 0.3.1; local CLI/playground changes do not republish that npm version.
97
-
98
- ## Implementation reference
99
-
100
- - `src/` contains the shared canvas application for editing and presentation.
101
- The [versioned composition contract](../composition/README.md) preserves
102
- content, relationships and visual intent across human and agent revisions.
103
- - `bin/` contains the file-session CLI and its revision-checked persistence.
104
- - [AUTHORING.md](../AUTHORING.md) owns design defaults, factual fidelity and review.
105
- [Design resources](../design/README.md) provide palettes, themes and semantic
106
- patterns; these are choices, not mandatory layouts.
107
- - `lib/text.tsx` supplies measured `Text` and `Paragraphs` with string or rich-text
108
- runs. Overset content is flagged, not automatically shrunk or hidden. Await
109
- `fontsReady` from `lib/typeface.ts` before measuring.
110
- - `lib/slide.tsx` supplies specimen `Panel`, `Relationship` and 1920×1080 `Sheet`
111
- components. `Panel` shares one heading/body size; `Relationship` is a short
112
- directional glyph. Convert their SVG output to composition vectors for the canvas.
113
- - `lib/layouts.ts` supplies fixed-gutter regions, not a content-fitting solver.
114
- - Retained React chart references use Nivo `Bar`, `Line` and `Sankey` with
115
- `chartDefaults(palette)` from `lib/charts.ts` spread before chart-specific props.
116
- Keep data, dimensions, scales and semantic colors in the deck. Use explicit
117
- label colors and `linkBlendMode="normal"` for Sankey.
118
-
119
- ### React/SVG drawing references
120
-
121
- The retained `slides/*/index.tsx` files are presentation-runtime-independent
122
- drawing references. They are checked as source but are not discovered as routes
123
- or executed by a second presentation runtime. New decks use composition JSON;
124
- a trusted build may render React to SVG, then convert supported elements into
125
- the owning component's editable vector payload.
126
-
127
- To migrate the retained architecture reference into the shared canvas:
128
-
129
- ```sh
130
- pnpm example:migrate-page slides/architecture/index.tsx all /tmp/architecture-composition.json
131
- ```
132
-
133
- Drag the resulting JSON onto the canvas, edit its vectors, and use **Present**.
134
- Replace `all` with a zero-based page index for one page. This command executes
135
- trusted local React source; never use it on untrusted JSX. It rejects unsupported
136
- SVG elements rather than silently flattening them. Review converted typography
137
- and geometry in the browser; conversion is not a fidelity guarantee.
138
- The bundled `?example=react-page-migration` preview uses the same format.
139
- Its working copy autosaves in that browser. Download JSON or use a file-backed
140
- session to retain edits outside browser storage.
141
-
142
- ## Package contents
143
-
144
- `package.json` explicitly allowlists the npm payload: the source-based Vite
145
- runtime and file-session CLI, authoring guidance and design resources, and named
146
- curated examples with editable source and prompts. New example directories are
147
- not included automatically. Gallery screenshots, tests, research fixtures,
148
- browser review scripts, original branding assets, lockfiles and UI build output
149
- stay in the repository.
150
-
151
- `npm pack` builds the JavaScript CLI in `runtime/` automatically because Node
152
- cannot load its TypeScript source from inside `node_modules`. That generated
153
- CLI is included in the package.
154
-
155
- Run `pnpm check:package` before preparing a release. It checks npm's file selection,
156
- required resources, excluded development files and relative imports. For an
157
- installation smoke test, use `npm pack --pack-destination <temporary-dir>`, install
158
- the tarball in an empty project, then run its `konpeki validate` and `konpeki preview`
159
- commands against a composition outside the installed package. Do not publish
160
- until that isolated preview works. Publish the tested tarball rather than
161
- rebuilding during publication. Packing locally does not publish anything.
162
-
163
- ## Tag releases
164
-
165
- `.github/workflows/publish.yml` stages releases on bare version tags such as `0.2.1`
166
- (no `v` prefix). The tag must equal `package.json`'s version.
167
- The workflow installs the mise toolchain and frozen dependencies, runs typecheck,
168
- tests, build and package checks, then installs a tarball in an isolated directory
169
- to validate a composition and build the packaged canvas. It stages that same
170
- tarball for maintainer approval; it does not publish directly. Browser review
171
- remains a pre-release responsibility.
6
+ ## Architecture
172
7
 
173
- Before the first tag release, configure **Trusted publishing → GitHub Actions**
174
- in the `konpeki` package settings on npmjs.com:
8
+ Static HTML and CSS are the only document source. `html/source.ts` validates and
9
+ revises source, `html/server.ts` exposes the authenticated preview and local
10
+ assets, and `html/browser.ts` uses Playwright for inspection and PNG/PDF export.
11
+ The React preview UI lives in `html/preview.tsx`; its small shared board,
12
+ alignment, positioning, and style modules live under `src/`.
175
13
 
176
- - Organization or user: `vcfgdev`
177
- - Repository: `konpeki`
178
- - Workflow filename: `publish.yml`
179
- - Environment name: leave empty
180
- - Leave **Allow npm publish** unchecked (staged publishing only)
181
-
182
- The workflow uses GitHub-hosted runners and OIDC (`id-token: write`); no npm
183
- token secret is needed. Staged publishing requires npm 11.15.0 or newer and
184
- Node 22.14.0 or newer; the pinned toolchain meets both requirements.
185
- npm generates provenance automatically for public repositories;
186
- private repositories do not receive provenance.
187
-
188
- After updating the package version, completing release checks and pushing the
189
- release commit, explicitly create and push its matching tag:
190
-
191
- ```sh
192
- VERSION=0.2.1
193
- git tag "$VERSION"
194
- git push origin "$VERSION"
195
- ```
196
-
197
- Replace `0.2.1` with the version in `package.json`. Published versions cannot be
198
- republished. Pushing a matching tag submits the tested package to npm's staging
199
- area. After the workflow succeeds, review the release in npmjs.com's **Staged
200
- Packages** tab and click **Approve**, completing 2FA to publish it. Alternatively,
201
- use an authenticated local CLI:
202
-
203
- ```sh
204
- mise exec -- npm stage list konpeki
205
- mise exec -- npm stage view <stage-id>
206
- mise exec -- npm stage approve <stage-id>
207
- ```
208
-
209
- Approval makes the version public. Reject an incorrect staged release instead
210
- of approving it (`npm stage reject <stage-id>`).
14
+ `bin/konpeki.mjs` is the HTML-only CLI entry. `scripts/build-cli.mjs` bundles it
15
+ to `runtime/konpeki.mjs` so npm consumers can run it without TypeScript support.
211
16
 
212
17
  ## Verification
213
18
 
214
19
  ```sh
215
- pnpm check
216
- pnpm test
217
- pnpm build
218
- pnpm check:package
219
- ```
220
-
221
- With the dev server running and `agent-browser` installed:
222
-
223
- ```sh
224
- node scripts/check-canvas.mjs http://localhost:4318 .amp/in/artifacts
225
- node scripts/check-pages.mjs http://localhost:4318 .amp/in/artifacts/pages
226
- ```
227
-
228
- For the Build it lifecycle, `node scripts/check-build.mjs` starts its own
229
- disposable file session. It checks pending requests, agent refresh, failure
230
- recovery and reduced motion, and captures the affected states. Add an output
231
- directory and `--record` to also record the animation.
232
-
233
- `node scripts/check-notes.mjs` checks page/vector note scopes, draft isolation,
234
- reload persistence, CLI claim/finish, clarification and cancellation in a disposable
235
- file-backed browser session. It accepts a screenshot directory as its first argument.
236
-
237
- `node scripts/check-feedback.mjs <output-directory>` checks invalid numeric input,
238
- blank-canvas commits, page renaming, stable panel geometry, native/vector overflow targets,
239
- note-save recovery, and file-save/conflict recovery with delayed opens and stale polls
240
- in a disposable session with injected service failures. It
241
- also checks notification exits, interrupted re-entry, inert hidden controls and reduced
242
- motion, and records screenshots and measurements. Run with `--before` on a baseline checkout
243
- to record the same failure states without asserting the revised behavior.
244
-
245
- These checks exercise all five component kinds, empty slides, JSON round trips,
246
- vector editing/history and fitted line dragging. They capture editor and
247
- presentation states at two sizes; inspect the images because assertions alone
248
- do not establish visual correctness.
249
-
250
- Documentation changes need link and instruction checks. Deck changes need
251
- typecheck, build, relevant fixture checks and actual visual inspection. Shared
252
- component, theme or dependency changes also need the full test suite and
253
- representative affected decks. A build can report a large-framework-chunk advisory.
254
-
255
- Render affected pages at presentation and review sizes after fonts load. Inspect
256
- text, clipping, relationships, contrast and cross-page consistency. Repair issues
257
- and inspect fresh captures. Keep browser checks scoped to factual and layout
258
- contracts, not universal taste. Record untested outputs and limitations with
259
- the example; screenshots do not prove PDF/PPTX or cross-application fidelity.
260
-
261
- When adding examples, preserve the exact creative requests, editable source,
262
- source facts and reviewed images as described in [AUTHORING.md](../AUTHORING.md).
263
- Examples demonstrate capabilities; there is no separate benchmark suite or
264
- aesthetic score. Check font language subsets and license notices when
265
- redistributing assets; dependencies retain their own licenses.
20
+ mise exec -- pnpm install --frozen-lockfile
21
+ mise exec -- pnpm exec playwright install chromium
22
+ mise exec -- pnpm check
23
+ mise exec -- pnpm test
24
+ mise exec -- pnpm build
25
+ mise exec -- pnpm check:package
26
+ mise exec -- pnpm audit --prod
27
+ ```
28
+
29
+ Before a release, install the generated tarball in a disposable directory and
30
+ exercise runtime discovery, starter preparation, HTML validation, inspection,
31
+ PNG/PDF export, and preview. Audit the installed package too: npm consumers can
32
+ resolve dependencies differently from the repository lockfile. Exercise the
33
+ preview's comment and copy-and-clear flow from that installation, not only a
34
+ source checkout.
35
+
36
+ ## Release
37
+
38
+ 1. Finish the verification above and commit the exact release candidate. Keep
39
+ `package.json`, `plugin.json` and the skill's runtime version aligned. Describe
40
+ breaking changes in the README's upgrade section and the release notes.
41
+ 2. Obtain explicit approval before pushing or tagging. The release tag must
42
+ exactly match the package version (`0.4.0`, not `v0.4.0`).
43
+ 3. Pushing the approved tag starts **Stage package release**. It checks the code,
44
+ installs and exercises the tarball, then stages that tarball on npm. A green
45
+ workflow means staged, not published.
46
+ 4. The maintainer reviews and approves the staged package through npm's approval
47
+ flow. Verify the published version with `npm view konpeki@0.4.0 version` and
48
+ smoke-test a registry installation before announcing availability.
49
+
50
+ GitHub release creation and the manual Pages deployment are separate actions;
51
+ neither is authorized by permission to push a tag. Never publish, push, deploy,
52
+ or tag without explicit permission for that action.
package/docs/workflow.md CHANGED
@@ -1,110 +1,8 @@
1
- # Canvas workflow
1
+ # Workflow
2
2
 
3
- Start with [Use with your agent](../README.md#use-with-your-agent) and give your
4
- coding agent a brief in its prompt field. Install the complete skill directory;
5
- its bootstrap script finds or installs the runtime separately. Skill discovery
6
- varies by agent: Codex CLI/IDE uses `$konpeki`, while the standalone Claude Code
7
- skill uses `/konpeki`. Other clients may use skill selection or natural language.
8
- `init` opens a blank or existing file-backed editor without generating; `generate`
9
- creates or revises a visual, opens its preview and inspects it, with setup implicit.
10
- A creation brief without a mode selects generate. Follow-up reviews continue the
11
- same document without repeating a command. These are skill modes, not terminal
12
- subcommands. **Build it** is an optional revision handoff, not a required first-run
13
- step; opening the editor does not start a review listener.
3
+ The canonical authoring and revision loop lives in the
4
+ [Konpeki skill](../skills/konpeki/SKILL.md).
14
5
 
15
- ## Documents and exports
16
-
17
- New documents live in `slides/<name>/composition.json`, with `PROMPT.md`, source
18
- notes and reviewed images alongside. Keep the editable composition under version
19
- control. The canvas is the source of truth for editing and presentation; download
20
- its JSON for handoff and drag returned JSON onto the canvas to continue.
21
-
22
- One page is a complete creation. Presets cover Presentation (1920×1080), Square
23
- post (1080×1080), Portrait post (1080×1350), Link preview / OG (1200×630), and
24
- Article header (1600×600). The document contract supports 256–4096 pixels per side.
25
- Pages in one document may use different sizes. Changing size never stretches
26
- content and is refused when existing components would fall outside the page.
27
- Recompose for a new aspect ratio instead of stretching or cropping.
28
-
29
- **Export PNG** saves the active page at its declared dimensions without editor
30
- controls. JSON remains the editable source; PNG is an image. Fresh documents and
31
- added pages are empty. **Present** uses the same renderer for any page sequence.
32
-
33
- Standard Chart, Diagram and Table illustrations are structural drafts. Finished
34
- artwork can remain owned by its semantic component as editable vector elements.
35
- Retained React/SVG examples are drawing references, not another deck runtime.
36
-
37
- ## File-backed editing with an agent
38
-
39
- The CLI interface is `konpeki <command>`. After local installation, use
40
- `npm exec --no -- konpeki <command>` from your workspace. In a repository checkout,
41
- use the development shim `pnpm konpeki <command>` instead:
42
-
43
- ```sh
44
- npm exec --no -- konpeki validate slides/my-visual/composition.json
45
- npm exec --no -- konpeki preview slides/my-visual/composition.json
46
- ```
47
-
48
- `preview` prints a capability-bearing local URL. Open that exact URL. Valid
49
- browser edits are saved atomically to the composition file; a revision hash
50
- prevents overwriting concurrent external changes. When an agent updates the same
51
- file, the canvas loads the valid revision and keeps the previous document in Undo.
52
-
53
- An agent waiting for a person's revision request runs:
54
-
55
- ```sh
56
- npm exec --no -- konpeki wait slides/my-visual/composition.json
57
- ```
58
-
59
- In the file-backed canvas, select a component or an inner vector element and
60
- write a **Revision note** in the left panel's **Notes** tab. With nothing selected, the note targets
61
- the page. **Add note** saves feedback without starting a build; add notes to several
62
- targets, then choose **Build it** to submit them together. Numbered canvas pins
63
- return to their note and selection. Pins and notes never appear in presentations
64
- or PNG exports. Direct text, geometry and attribute edits still save normally.
65
-
66
- **Build it** saves the composition and submits its exact revision, selected page,
67
- component and optional vector-element ID, plus all unresolved notes. Without notes,
68
- it requests a build from the saved composition and selected scope as before.
69
- `wait` atomically claims one submitted request, marks it working, prints the
70
- machine-readable v2 request and exits. It does not launch or wake an agent.
71
- Until claimed, the canvas asks you to contact your coding agent and offers
72
- **Copy prompt** for the handoff. “Agent working” means claimed, not a live
73
- agent heartbeat. Only one request per document can be active. Connection errors
74
- keep an active request locked until completion or cancellation.
75
-
76
- The agent must reread the named composition and preserve newer human edits.
77
- Follow each note's target IDs, not just the active page; never silently retarget
78
- a deleted element. After validating, rendering and inspecting all requested
79
- changes, explicitly finish using the ID returned by `wait`:
80
-
81
- ```sh
82
- npm exec --no -- konpeki finish slides/my-visual/composition.json <request-id> --message "Updated and checked"
83
- ```
84
-
85
- Only this acknowledgement resolves the submitted notes and unlocks editing.
86
- File changes alone do not complete the request; explicit no-op completion is
87
- valid when the requested result is already present. If blocked, finish with
88
- `--status needs-clarification --message "What needs clarification?"` or
89
- `--status failed --message "What failed"`. Notes stay unresolved for a retry.
90
- Do not mark a partly applied batch done. **Cancel request** unlocks the editor
91
- and keeps notes, but cannot stop an agent process; stop that agent before retrying.
92
-
93
- Feedback is stored next to the document as `composition.json.review.json`, separate
94
- from artwork and exports. Retain that file with the composition when moving work.
95
- Browser reloads and preview restarts preserve notes and request status. To inspect
96
- or recover an already claimed request after an interruption, run:
97
-
98
- ```sh
99
- npm exec --no -- konpeki request slides/my-visual/composition.json
100
- ```
101
-
102
- Coordinate with the previous worker before resuming; `wait` does not claim an
103
- already working request a second time. Do not edit the sidecar manually while a
104
- preview or agent is updating it. Existing v1 temporary requests are not migrated;
105
- finish them before upgrading, then resubmit if needed. Browser-local drafts and
106
- hosted examples do not expose revision notes or **Build it** because no local
107
- agent owns their files.
108
-
109
- Browser screenshots do not establish PDF/PPTX editability, font embedding or
110
- cross-application fidelity. Inspect every requested export separately.
6
+ Use the [HTML, files, theme, and CLI reference](../html/README.md) for document
7
+ rules and tool behavior, the [authoring floor](../skills/konpeki/floor.md) for
8
+ bans and the review checklist, and [AUTHORING.md](../AUTHORING.md) for judgment.
package/html/README.md ADDED
@@ -0,0 +1,140 @@
1
+ # HTML, files, theme, and CLI
2
+
3
+ This is the reference for Konpeki's source contract and runtime behavior. The
4
+ [skill](../skills/konpeki/SKILL.md) owns workflow, its [floor](../skills/konpeki/floor.md)
5
+ owns bans and defaults, and [AUTHORING.md](../AUTHORING.md) owns editorial and
6
+ visual judgment.
7
+
8
+ ## Document and file contract
9
+
10
+ - Author static HTML/CSS and inline SVG. Do not author JavaScript, applications,
11
+ interactive controls, or remote resources.
12
+ - Each page is an explicit direct child of `<body>` with `data-page` and a
13
+ globally unique, stable `id`. Targetable HTML and SVG elements also need
14
+ globally unique, stable IDs.
15
+ - CSS defines fixed page width and height, at most 8192 CSS px per side. Pages
16
+ may differ in size. Page breaks are explicit; overflow is not paginated.
17
+ - Keep images, stylesheets, and licensed fonts beside the HTML with relative
18
+ paths, or embed them. The only remote exception is Google Fonts from
19
+ `fonts.googleapis.com/css2` and `fonts.gstatic.com`; it requires network access.
20
+
21
+ ```html
22
+ <!doctype html>
23
+ <html lang="en">
24
+ <head>
25
+ <meta charset="utf-8">
26
+ <link rel="stylesheet" href="theme.css">
27
+ </head>
28
+ <body>
29
+ <main id="page-1" data-page data-size="link">
30
+ <h1 id="title">A clear headline</h1>
31
+ </main>
32
+ </body>
33
+ </html>
34
+ ```
35
+
36
+ ## Themes
37
+
38
+ Link `theme.css` for the default light-blue theme. Read [Use a theme](theme.md)
39
+ for its `--kp-`-prefixed public tokens, complete type roles, page presets, and asset
40
+ requirements. A compatible entry point sets `--kp-theme: 1`; the base alone does
41
+ not. Keep the imported `theme-base.css` and referenced fonts beside the entry
42
+ point. Adapt a copy of the default when a brief brings its own look.
43
+
44
+ For deliberately unthemed content, set `data-theme="custom"` on its ancestor.
45
+ This skips theme-value checks in that subtree and definition checks on an
46
+ opted-out page, but keeps layout and resource checks. An alternative implementing
47
+ the contract does not need this opt-out.
48
+
49
+ ## Diagnostics
50
+
51
+ `inspect` detects page and text overflow, clipped text, missing resources,
52
+ inter-element text line-box overlap, and opaque sRGB HTML text contrast against
53
+ solid ancestor backgrounds. Contrast thresholds are 3:1 for large text and
54
+ 4.5:1 otherwise. Contrast inspection skips SVG text, gradients, images,
55
+ transparency, and compositing it cannot evaluate reliably.
56
+
57
+ Floor warnings use the rule ID from the [authoring floor](../skills/konpeki/floor.md)
58
+ as their code. `label-above-headline` flags a short, smaller line directly above
59
+ a title, display or section heading in the same column; running heads repeated
60
+ across A4 pages, full sentences and metric figures are not flagged, and
61
+ `data-kp-allow="label-above-headline"` on the label records a deliberate
62
+ exception. `stranded-word` flags a headline line that holds one word after a fuller
63
+ line, within each `<br>`-separated part; a line a `<br>` isolates is deliberate. The base balances headline roles and
64
+ sets `text-wrap: pretty` on pages to avoid most stranded words.
65
+
66
+ `small-text` warns below 24 CSS px on screen presets and 11 CSS px on A4,
67
+ including unthemed HTML and SVG text. The default preset is presentation.
68
+ These are computed font-size floors, not a guarantee of legibility after SVG
69
+ viewBox scaling, CSS transforms, or reduction to the final viewing size. Unknown
70
+ custom presets have no assumed floor. Review screen graphics at their intended
71
+ size and print pages at actual size; warnings do not block export.
72
+
73
+ For opted-in themes, it also checks the active definition and compares used
74
+ size/leading pairs, colors and shape treatments to its tokens. See the [theme diagnostics](theme-authoring.md#verify-a-theme)
75
+ for required roles and contrast pairs. `inspect` includes each page's resolved
76
+ type treatments under `theme.type`, so authors can plan with the actual sizes.
77
+
78
+ CLI inspection checks which fonts actually drew the text. Installed-font fallback
79
+ is an error, including on unthemed pages. Both CLI and preview check declared
80
+ weight/style coverage; only CLI can audit actual glyph fallback. Load the required
81
+ licensed faces and subsets from Google Fonts, local files, or embedded data
82
+ instead of relying on the machine. The default theme uses Google Fonts and needs
83
+ network access during preview and export; finished PNGs and PDFs do not.
84
+
85
+ HTML overlap uses estimated line-height boxes rather than raw font rectangles;
86
+ SVG, normal leading and transformed text retain range bounds. These are not glyph
87
+ ink measurements, and automated checks cannot establish factual
88
+ correctness or visual quality. Inspect rendered output. A render with diagnostic
89
+ errors exits nonzero and writes no output.
90
+
91
+ ## CLI
92
+
93
+ ```text
94
+ konpeki validate document.html
95
+ konpeki inspect document.html [--page N] [--details]
96
+ konpeki check document.html
97
+ konpeki render document.html [--page N] [--format png|pdf] [--scale 2] [--output file]
98
+ konpeki preview document.html [--host host] [--port port] [--json]
99
+ konpeki browser install
100
+ ```
101
+
102
+ Pages are one-based. HTML export supports PNG and PDF only. PNG defaults to page
103
+ 1; PDF includes all pages unless `--page N` is supplied and preserves mixed page
104
+ sizes. `--scale` affects PNG only. Outputs are exclusive and never overwritten.
105
+
106
+ Inspection and export require the pinned Chromium installed by `browser install`;
107
+ preview does not. Preview chooses another available port when its default is
108
+ busy, while an explicit `--port` is strict.
109
+
110
+ Preview comments remain browser-local. **Copy & clear** copies the full local
111
+ document path, comments, and target IDs for pasting into an agent conversation.
112
+ Small moves edit translation only; they do not reorder source. Deletion may
113
+ reflow content. Reread current source and preserve unrelated edits when applying
114
+ feedback.
115
+
116
+ ## Keyboard review
117
+
118
+ Open **Keyboard shortcuts** (`?`) and enable **Vim review mode**. The preference
119
+ is remembered in this browser. With it off, the existing mouse and comment
120
+ shortcuts are unchanged.
121
+
122
+ | Context | Keys | Action |
123
+ | --- | --- | --- |
124
+ | Canvas | `f`, then hint letters | Comment on a visible element of the current page |
125
+ | Canvas | `c` / `Shift+C` | Comment on the selection / entire current page |
126
+ | Canvas | `h j k l` | Pan left, down, up, right |
127
+ | Canvas | `[` / `]`, `gg` / `G` | Previous / next page, first / last page; keep zoom |
128
+ | Canvas | `+` or `=`, `-`, `0` | Zoom in, zoom out, fit and center current page |
129
+ | Canvas | `q` | Open all pending comments |
130
+ | Comment | `⌘/Ctrl+Enter` | Add and return to the canvas without changing the viewport |
131
+ | Pending comments | `j` / `k`, `Enter` | Select a comment, reveal its target and notes |
132
+ | Pending comments | `⌘/Ctrl+Enter` | Copy & clear; comments stay intact if copying fails |
133
+ | Review | `Esc` | Back one level, preserving unfinished drafts until reload |
134
+
135
+ The current page follows navigation and panning. Hints use stable element IDs,
136
+ exclude hidden/offscreen targets, and keep their codes while filtering.
137
+ `Backspace` corrects a hint prefix; `Esc` cancels. Moving the viewport or updating
138
+ the source cancels hints rather than reusing stale geometry. Letter shortcuts are
139
+ suspended inside text inputs and during IME composition. Review mode does not
140
+ add Vim text editing or bare-letter source-deletion commands.