the package-authoring round: fork is the verb, the scaffold flag is the ready-to-run gate, the package editor is the owner's surface, and /packages is the launchpad

The design conversation settled the verb question (developer, 2026-11-19): a "create new package" with a base selector is fork under another name, so the SPA gains one list at /packages with three acts per card -- start (the run-create flow, unchanged), fork (any package, system or user, by anyone: the copy lands in state/packages owned by the forker, pc stripped, display name asked inline, the fork landing straight in the editor -- nobody forks to immediately start), and edit (the owner's own user packages only). /new retires to a redirect onto /packages; the source link (code.fleshless.org/hackmaster/tiny-worlds) rides the header.

The template's unplayability became machinery instead of a naming special-case: settings.json carries the "scaffold" flag (the records-bool precedent -- authored content carries the marker, machinery reads it). Create refuses a scaffold loudly on both ends ("fork it to author, then flip scaffold off in the editor"), the listing marks it, the SPA disables its start. The developer's ruling over my clear-the-flag draft: the flag RIDES FORKS UNTOUCHED -- a scaffold fork stays a scaffold until its author flips it off, so the flag is the package's doneness state, and publishing your own scaffold for others to fork is free. The settings editor is raw JSON for now (native UI later, the developer's "ready to run" toggle its eventual shape), with a hint teaching the keys.

The package editor (/packages/:name): every file of a user package is authoring material -- settings included -- with the cheap save lints (memory.json and settings.json must parse as JSON objects; the carryover passes the authored lint, the run surface's exact gate), the deep checks staying at the start gate where they already lived. The gates mirror the run precedent: system packages are repo-side and refuse ("fork to edit"); an ownerless user package is readable, forkable, never editable -- and an ownerless package IS forkable, the copy is yours.

The refactor the editor forced: the setup view's file-editor machinery (nav, textarea + the sigil/var highlight overlay, drafts, dirty marks, the save flow) extracted into widgets.mjs's fileEditor factory, parameterized over DOM ids and a PUT call -- setup keeps its run-side couplings (the phase-gated rw, the addressed session), the package editor is the simpler parameterization, and the editor CSS generalized from id selectors to classes so both surfaces share it.

En-route bug found and fixed: cmdCreate always copied the REPO's handbook.md into the run, so a user package's handbook -- which save-package faithfully copies out -- was silently ignored on re-create; the author's craft edit died in the round-trip. Create now prefers the package's own handbook when it carries one, else the repo's shared copy. The smoke proves the round-trip: a handbook marker authored through the package editor surfaces in the created run's files.

Browser-pass find: the pkgedit header state span and the editor's save-state span shared the id pkgedit-state, so the widget's select() wiped the header line -- the editor's span renamed (pkgedit-edit-state), verified rendering.

Verified: typecheck green both programs; smoke ALL PASS (+20 -- the fork battery: the template fork owner-stamped scaffold-preserved pc-stripped, create refusing the scaffold on both ends, the playable fork carrying no scaffold, fork validation, the editor gates owner-200/non-owner-403/system-repo-side-403/unknown-404, the raw-JSON and carryover save lints, the ready-to-run flip, create from the flipped fork, the handbook round-trip; and the ownerless pair: the editor refuses, the fork succeeds); restart + reminder checks green (6 runs); a browser pass on --mock --debug end to end -- the paste token re-landing after the state wipe, /new redirecting with the URL honest, the template card disabled with the scaffold note, boutique disabled as incomplete, the fork form prefill and submit landing in the editor, the scaffold state line, the settings flip and save making the card startable, the start-form flow intact, zero console errors; check-repo clean; the debug server back on the real state. Docs: README's packages passage (fork, scaffold, the editor, the gates), the booting flow, the layout tree (the clerk's fork-package verb, the view list, widgets.mjs); DICTIONARY's package, scaffold, and fork entries. The developer's queue line ('"create new package" in SPA') is struck by them in the same round. packages/detention stays untracked WIP, untouched.
This commit is contained in:
2026-11-19 11:11:23 +00:00
parent 4b8fbd7471
commit 0ddb9a218d
19 changed files with 782 additions and 245 deletions
+14 -10
View File
@@ -226,7 +226,7 @@ h1 { font-size: 15px; letter-spacing: 0.1em; color: var(--dim); font-weight: nor
height: calc(100vh - 130px);
}
#setup-files { overflow-y: auto; }
.files-nav { overflow-y: auto; }
.file-item {
display: flex;
justify-content: space-between;
@@ -245,11 +245,11 @@ h1 { font-size: 15px; letter-spacing: 0.1em; color: var(--dim); font-weight: nor
.file-item.ro { color: var(--dim); }
.file-item.dirty .file-dirty { color: var(--accent); }
#setup-editor { display: flex; flex-direction: column; min-width: 0; }
#edit-stack { position: relative; flex: 1; min-height: 0; }
.edit-col { display: flex; flex-direction: column; min-width: 0; }
.edit-stack { position: relative; flex: 1; min-height: 0; }
/* the highlight overlay: a pre behind a transparent-text textarea,
identical metrics, scroll-synced -- sigils and vars light up in place */
#edit-hl, #setup-edit {
.edit-hl, .edit-area {
position: absolute;
inset: 0;
margin: 0;
@@ -260,20 +260,24 @@ h1 { font-size: 15px; letter-spacing: 0.1em; color: var(--dim); font-weight: nor
border: 1px solid var(--line);
border-radius: 4px;
}
#edit-hl { pointer-events: none; overflow: hidden; color: var(--text); border-color: transparent; }
#setup-edit {
.edit-hl { pointer-events: none; overflow: hidden; color: var(--text); border-color: transparent; }
.edit-area {
background: transparent;
color: transparent;
caret-color: var(--text);
resize: none;
overflow-y: auto;
}
#setup-edit::selection { background: rgba(201, 162, 109, 0.3); }
.edit-area::selection { background: rgba(201, 162, 109, 0.3); }
.tok-sigil { color: var(--accent); }
.tok-var { color: var(--ok); }
#setup-edit-bar { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
#setup-edit-state { color: var(--dim); font-size: 12px; }
#edit-hint { color: var(--dim); font-size: 12px; margin-top: 8px; }
.edit-bar { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.edit-state { color: var(--dim); font-size: 12px; }
.edit-hint { color: var(--dim); font-size: 12px; margin-top: 8px; }
.pkg-actions { margin-top: 6px; }
.pkg-fork-form { display: flex; gap: 8px; margin-top: 8px; }
.pkg-fork-form input { flex: 1; }
#source-link { font-size: 11px; color: var(--dim); }
/* --- transcript (play) --- */