@divithselvam/jokebook 1.0.0 → 1.2.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/CHANGELOG.md +55 -0
- package/README.md +41 -28
- package/bin/run.js +4 -1
- package/{docs → dist/catalog}/STACK.md +33 -5
- package/dist/catalog/index.json +4 -0
- package/dist/commands/add.d.ts +12 -4
- package/dist/commands/add.js +29 -24
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.js +30 -25
- package/dist/commands/stack/list.d.ts +26 -15
- package/dist/commands/stack/list.js +190 -30
- package/dist/commands/stack/show.js +3 -2
- package/dist/commands/upgrade.d.ts +10 -0
- package/dist/commands/upgrade.js +55 -0
- package/dist/index.d.ts +18 -14
- package/dist/index.js +78 -21
- package/dist/starter.d.ts +14 -0
- package/dist/starter.js +38 -0
- package/dist/starters/1.0.0/desktop.tgz +0 -0
- package/dist/starters/1.0.0/mobile.tgz +0 -0
- package/dist/{starter-1.0.0-web.tgz → starters/1.0.0/web.tgz} +0 -0
- package/dist/starters/1.1.0/desktop.tgz +0 -0
- package/dist/starters/1.1.0/mobile.tgz +0 -0
- package/dist/starters/1.1.0/web.tgz +0 -0
- package/dist/starters/1.2.0/desktop.tgz +0 -0
- package/dist/starters/1.2.0/mobile.tgz +0 -0
- package/dist/starters/1.2.0/web.tgz +0 -0
- package/dist/starters/index.json +27 -0
- package/dist/upgrade.d.ts +30 -0
- package/dist/upgrade.js +574 -0
- package/package.json +20 -5
- package/dist/starter-1.0.0-desktop.tgz +0 -0
- package/dist/starter-1.0.0-mobile.tgz +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,59 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to Jokebook are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
4
4
|
|
|
5
|
+
## [1.2.0] - 2026-12-01
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `packages/ui`, a real shared Svelte component package used by both the web and desktop clients.
|
|
10
|
+
- Generated `dev:web`, `dev:desktop` and `dev:mobile` commands. `dev:web` runs the API with the web app, `dev:desktop` adds the Tauri client, and `dev:mobile` binds the API to the local network and launches a native mobile app.
|
|
11
|
+
- Generated Git repositories. `jokebook init` runs `git init` in the completed staging directory, stages the product and creates an initial commit authored by Jokebook.
|
|
12
|
+
- `/target` and `/api/target` ignore rules in the generated `.gitignore`.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- The pinned catalog now lives at `docs/STACK.md`; generated agent guidance, README files, catalog lookup and upgrades use that path.
|
|
17
|
+
- The Rust workspace moved to `api/Cargo.toml`, with the domain core at `api/crates/core` and the Axum API at `api/crates/server`. The Tauri host joins the workspace from `apps/desktop/src-tauri`.
|
|
18
|
+
- Local Compose services moved to `devops/local/backend/compose.yaml`; the `db:start` and `db:stop` scripts reference that path. Generated READMEs document `devops/<platform>/<frontend|backend>` for hosted environments.
|
|
19
|
+
- Starter and catalog revisions are 1.2.0. Catalog 1.2.0 updates the workspace metadata and repository tree.
|
|
20
|
+
- `jokebook upgrade` moves the catalog, Rust workspace and local Compose file from 1.0.0 and 1.1.0 layouts while preserving local edits through three-way merges.
|
|
21
|
+
- The mobile overlay is generated at `apps/mobile` for the `mobile` and `full` presets.
|
|
22
|
+
- Documentation, archive tests and upgrade tests cover the new layout and development commands.
|
|
23
|
+
|
|
24
|
+
## [1.1.0] - 2026-12-01
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- `jokebook upgrade` with `--check` and `--apply`: three-way merge against the bundled old and new starters, structural merges for `package.json` and `tauri.conf.json`, automatic text merges with `git merge-file`, and conflict refusal.
|
|
29
|
+
- Atomic upgrade writes with per-file backups, rollback after a failed write, path validation, and a report under `.jokebook/`.
|
|
30
|
+
- Catalog-only updates when the catalog changes without a starter revision bump.
|
|
31
|
+
- Machine-readable `jokebook-catalog` metadata in catalog 1.1.0, declaring section ownership, table headers and automated recipes.
|
|
32
|
+
- A bundled starter index at `dist/starters/index.json` and per-revision archive paths at `dist/starters/<revision>/<surface>.tgz`.
|
|
33
|
+
- Catalog-driven recipe resolution: ids, aliases, package, version, capability, summary and workspace come from the catalog instead of constants in commands.
|
|
34
|
+
- Packed-package verification of the tarball layout, catalog hash, starter index, version output, `stack list`, `stack show`, `init --dry-run` and outside-product `upgrade` refusal.
|
|
35
|
+
- Tests for catalog metadata, legacy catalog fallback, archive layout, clean upgrades, conflict refusal and catalog-only updates.
|
|
36
|
+
|
|
37
|
+
### Changed
|
|
38
|
+
|
|
39
|
+
- Package version and catalog/starter revisions are 1.1.0. Starter 1.1.0 reuses the verified 1.0.0 application sources; it updates agent guidance and generated READMEs and removes the placeholder catalog marker.
|
|
40
|
+
- The npm package ships only the current catalog at `dist/catalog/STACK.md`; every bundled starter revision remains available for upgrades.
|
|
41
|
+
- Generated `AGENTS.md` now explains the catalog contract, the upgrade check/apply workflow, conflict refusal and post-upgrade checks.
|
|
42
|
+
- Recipe and archive selection no longer hardcode versioned packument strings, archive filenames, catalog hashes, workspace paths or status text.
|
|
43
|
+
- `add` requires the current starter revision and tells older products to upgrade first.
|
|
44
|
+
- Documentation, `CONTRIBUTING.md` and release checks describe the new build layout and upgrade lifecycle.
|
|
45
|
+
|
|
46
|
+
### Fixed
|
|
47
|
+
|
|
48
|
+
- Skill installation no longer fails when Jokebook itself runs through `npm exec --package=@divithselvam/jokebook`: the nested `npx` call no longer inherits npm's outer package selection.
|
|
49
|
+
- Upgrade plans no longer report success while unresolved conflicts remain, and a failed apply no longer leaves a half-updated marker.
|
|
50
|
+
- Starter extraction creates its destination before reading archives.
|
|
51
|
+
- Previously stale release metadata in `package.json`, `bin/run.js` and the verify script is derived from the package manifest and generated indexes.
|
|
52
|
+
|
|
53
|
+
### Security
|
|
54
|
+
|
|
55
|
+
- Upgrade refuses absolute paths, paths that escape the product, and non-file replacement targets.
|
|
56
|
+
- Upgrade restores every touched file when an application step fails.
|
|
57
|
+
|
|
5
58
|
## [1.0.0] - 2026-11-30
|
|
6
59
|
|
|
7
60
|
### Added
|
|
@@ -26,4 +79,6 @@ All notable changes to Jokebook are documented here. The format follows [Keep a
|
|
|
26
79
|
- Existing non-empty destinations are refused.
|
|
27
80
|
- A staged product is moved into place only after dependency installation, recipe checks and both skill verifications succeed.
|
|
28
81
|
|
|
82
|
+
[1.2.0]: https://github.com/Divith123/jokebook/releases/tag/v1.2.0
|
|
83
|
+
[1.1.0]: https://github.com/Divith123/jokebook/releases/tag/v1.1.0
|
|
29
84
|
[1.0.0]: https://github.com/Divith123/jokebook/releases/tag/v1.0.0
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
Jokebook is a versioned project generator for production-minded web products. One command creates a pnpm workspace with a SvelteKit web app, a Rust/Axum API, PostgreSQL development configuration, and optional Tauri desktop and shared-Swift native mobile clients.
|
|
7
7
|
|
|
8
|
-
Every generated product carries a byte-for-byte copy of the architecture and package catalog it was built from, plus two project-local agent skills whose source commits are recorded in `skills-lock.json`. Generation is staged, checked,
|
|
8
|
+
Every generated product carries a byte-for-byte copy of the architecture and package catalog it was built from, plus two project-local agent skills whose source commits are recorded in `skills-lock.json`. Generation is staged, checked, moved into place only after dependency installation and skill verification succeed, and initializes a Git repository with an initial commit. Existing products can merge a newer bundled starter with `jokebook upgrade` without discarding local edits.
|
|
9
9
|
|
|
10
10
|
## Requirements
|
|
11
11
|
|
|
@@ -51,6 +51,7 @@ jokebook init [product] [--preset web|desktop|mobile|full] [--dir <path>] [--wit
|
|
|
51
51
|
jokebook stack list [--json]
|
|
52
52
|
jokebook stack show <capability> [--json]
|
|
53
53
|
jokebook add <recipe> [--no-interactive] [--json] [--dry-run]
|
|
54
|
+
jokebook upgrade [--check | --apply] [--json]
|
|
54
55
|
jokebook --help
|
|
55
56
|
jokebook --version
|
|
56
57
|
```
|
|
@@ -67,15 +68,23 @@ The command exits `0` on success, `1` on failure and `130` on cancellation. `--j
|
|
|
67
68
|
|
|
68
69
|
### `stack`
|
|
69
70
|
|
|
70
|
-
`stack list` and `stack show` are read-only. Inside a generated product they read that product's pinned `STACK.md` and verify its SHA-256. Elsewhere they read the catalog bundled with the CLI.
|
|
71
|
+
`stack list` and `stack show` are read-only. Inside a generated product they read that product's pinned `docs/STACK.md` and verify its SHA-256. Elsewhere they read the catalog bundled with the CLI.
|
|
71
72
|
|
|
72
|
-
`stack show` accepts a capability slug from `stack list` or a unique backticked package name. It reports the recommendation,
|
|
73
|
+
Capability rows, sections, table headers, workspace ownership and automated recipes come from the catalog's machine-readable metadata. `stack show` accepts a capability slug from `stack list` or a unique backticked package name. It reports the recommendation, versions, owning workspace, source row and links, setup notes and recipe status.
|
|
73
74
|
|
|
74
75
|
### `add`
|
|
75
76
|
|
|
76
|
-
`add runtime-validation` (alias `valibot`) resolves the
|
|
77
|
+
`add runtime-validation` (alias `valibot`) resolves the package and exact version declared by the catalog recipe, installs it in the recipe's workspace with the product's pnpm workspace, and verifies a real import. It can also be selected with `init --with runtime-validation`. Repeating the recipe verifies the existing installation and makes no change.
|
|
77
78
|
|
|
78
|
-
Catalog capabilities without an automated recipe return their documented setup guidance and leave the product untouched. Run `add` from the product directory or any of its subdirectories.
|
|
79
|
+
Automated recipes require the current starter revision. If the product is older, run `jokebook upgrade --apply` first. Catalog capabilities without an automated recipe return their documented setup guidance and leave the product untouched. Run `add` from the product directory or any of its subdirectories.
|
|
80
|
+
|
|
81
|
+
### `upgrade`
|
|
82
|
+
|
|
83
|
+
`upgrade --check` plans a three-way merge between the bundled old and new starters and reports added, updated, merged and removed files. It writes nothing. `upgrade --apply` writes the same plan only when there are no conflicts.
|
|
84
|
+
|
|
85
|
+
Jokebook keeps local edits. Text files use `git merge-file`; `package.json` and `tauri.conf.json` use a semantic three-way merge; new and removed files are compared against the bundled old starter. A conflict blocks the whole plan: `--apply` refuses to change any file and exits non-zero. Applied writes are atomic, and a failed write restores every touched file from its backup.
|
|
86
|
+
|
|
87
|
+
A completed upgrade writes a report under `.jokebook/`, updates the product marker and moves the pinned catalog, Rust workspace and local Compose file when upgrading from an older layout. Moved files keep local edits through the same three-way merge. A catalog-only release is handled without changing the starter revision. Review the report and `git diff`, run `pnpm install` if dependencies changed, then run the product checks.
|
|
79
88
|
|
|
80
89
|
## What a product contains
|
|
81
90
|
|
|
@@ -85,37 +94,46 @@ my-product/
|
|
|
85
94
|
apps/desktop/ Tauri desktop client (desktop and full)
|
|
86
95
|
apps/mobile/ Shared Swift core, SwiftUI iOS app and Jetpack Compose Android app
|
|
87
96
|
(mobile and full; see apps/mobile/README.md)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
97
|
+
api/Cargo.toml Rust workspace
|
|
98
|
+
api/crates/core/ Shared Rust domain core
|
|
99
|
+
api/crates/server/ Rust/Axum HTTP API
|
|
100
|
+
packages/ui/ Shared Svelte components for web and desktop
|
|
101
|
+
devops/local/backend/ Local Compose services (PostgreSQL)
|
|
102
|
+
docs/STACK.md Pinned architecture and package catalog
|
|
103
|
+
scripts/dev.mjs Combined web, desktop and mobile development commands
|
|
104
|
+
AGENTS.md Agent guidance for the catalog and update workflow
|
|
92
105
|
skills-lock.json Skills CLI provenance for both project skills
|
|
93
106
|
pnpm-workspace.yaml One pnpm workspace and root lockfile
|
|
94
|
-
|
|
95
|
-
|
|
107
|
+
package.json Product marker, preset, catalog revision and catalog hash
|
|
108
|
+
.git/ Repository initialized with an initial commit
|
|
96
109
|
```
|
|
97
110
|
|
|
98
|
-
|
|
111
|
+
Local containers live under `devops/local/<frontend|backend>`; hosted deployment definitions use the provider name, such as `devops/aws/backend` or `devops/cloudflare/frontend`.
|
|
112
|
+
|
|
113
|
+
The generated `README.md` covers development commands, the API and readiness endpoints, production static hosting, native prerequisites, catalog lookup and the upgrade workflow. `pnpm dev:web` starts the API and web app, `pnpm dev:desktop` adds the Tauri client, and `pnpm dev:mobile` binds the API to the local network and launches a native mobile app.
|
|
99
114
|
|
|
100
115
|
## How generation works
|
|
101
116
|
|
|
102
117
|
1. Resolve flags and prompts into one validated configuration.
|
|
103
118
|
2. Reject a non-empty destination before touching the filesystem.
|
|
104
119
|
3. Extract the versioned starter into a staging directory alongside the destination.
|
|
105
|
-
4. Write the product marker, copy the pinned catalog and configure desktop identifiers when needed.
|
|
120
|
+
4. Write the product marker, copy the pinned catalog to `docs/STACK.md` and configure desktop identifiers when needed.
|
|
106
121
|
5. Run `pnpm install --frozen-lockfile` in the staged workspace.
|
|
107
122
|
6. Apply selected recipes and install both project-local agent skills.
|
|
108
|
-
7.
|
|
123
|
+
7. Initialize a Git repository in the staging directory and create the initial commit.
|
|
124
|
+
8. Re-check the destination and rename the completed staging directory into place.
|
|
109
125
|
|
|
110
126
|
If any step fails, the staging directory is removed and an existing empty destination is left untouched. Child processes receive closed stdin, a non-interactive environment and a cancellation signal.
|
|
111
127
|
|
|
112
128
|
## Catalog and recipes
|
|
113
129
|
|
|
114
|
-
`
|
|
130
|
+
The canonical catalog lives at `catalogs/<revision>/STACK.md`. Catalog `1.2.0` is the current revision, with SHA-256 `7dbbc7f0a44a1d424646e9ce6c51598e69c4738d2772ed17db3844aa2d1282e5`. Catalog `1.1.0` remains bundled as a frozen upgrade base at SHA-256 `14f8bf06942076bf593e89e20f6413677fbf8f0cf4aee9151fbe87e604150e17`, and catalog `1.0.0` at `850953320cc8e9093b9c3286e4279596dbdd274319e2b60ab648977ae4e90307`.
|
|
115
131
|
|
|
116
|
-
|
|
132
|
+
The `1.1.0` catalog added a machine-readable `jokebook-catalog` block that declares section ownership, table headers and recipes. The `1.2.0` catalog updates the workspace metadata and repository tree for `api/`, `packages/ui`, `devops/` and `docs/STACK.md`. The frozen `1.0.0` catalog predates the metadata block, so the CLI keeps a clearly marked legacy section map for it only.
|
|
117
133
|
|
|
118
|
-
|
|
134
|
+
Every generated product gets a byte-for-byte copy of the catalog bundled with its starter at `docs/STACK.md`. The CLI refuses to continue if that file no longer matches the hash recorded in `package.json`; older products that still keep the catalog at the root remain readable. The published package contains only the current catalog at `dist/catalog/STACK.md`; bundled starter revisions live under `dist/starters/<revision>/<surface>.tgz`.
|
|
135
|
+
|
|
136
|
+
`runtime-validation` is the only automated recipe because it has a real, repeatable integration check. Other capabilities remain documented recommendations; they are not installed blindly. Recipe aliases, implementation, package, summary, workspace and capability target all come from the catalog metadata.
|
|
119
137
|
|
|
120
138
|
## Agent skills
|
|
121
139
|
|
|
@@ -124,12 +142,7 @@ Every real `init` installs these two skills with the pinned Skills CLI 1.9.1, fr
|
|
|
124
142
|
- `Divith123/skills` → `blame-the-intern`
|
|
125
143
|
- `googlechrome/modern-web-guidance` → `modern-web-guidance`
|
|
126
144
|
|
|
127
|
-
Both use the project-local `universal` target and copy mode. Jokebook verifies each `SKILL.md` identity and the source repository and commit recorded by the Skills CLI.
|
|
128
|
-
|
|
129
|
-
```text
|
|
130
|
-
Use `blame-the-intern` from `.agents/skills/blame-the-intern/SKILL.md` and read `STACK.md` before scaffolding or changing dependencies.
|
|
131
|
-
Use `modern-web-guidance` from `.agents/skills/modern-web-guidance/SKILL.md` for browser UI, accessibility, and web performance.
|
|
132
|
-
```
|
|
145
|
+
Both use the project-local `universal` target and copy mode. Jokebook verifies each `SKILL.md` identity and the source repository and commit recorded by the Skills CLI. The starter's `AGENTS.md` then tells agents to load both skills, read `docs/STACK.md` before scaffolding or changing dependencies, and use `jokebook upgrade --check` before `--apply`.
|
|
133
146
|
|
|
134
147
|
No agent command or global skill installation is required after generation.
|
|
135
148
|
|
|
@@ -148,7 +161,7 @@ npm ci
|
|
|
148
161
|
npm run verify
|
|
149
162
|
```
|
|
150
163
|
|
|
151
|
-
`npm run verify` runs ESLint, the test suite and a packed-package smoke test. The smoke test
|
|
164
|
+
`npm run verify` runs ESLint, the test suite and a packed-package smoke test. The smoke test packs the npm tarball, inspects its contents, checks the bundled catalog and starter indexes, then runs `jokebook --version`, `stack list`, `stack show`, an `init --dry-run` and an `upgrade` refusal outside a product. It also covers catalog-only and starter upgrades, moved paths, conflict refusal, catalog parsing and archive contents. `npm run verify:package` runs only the package check.
|
|
152
165
|
|
|
153
166
|
Before a release, inspect the package and run a publish dry run:
|
|
154
167
|
|
|
@@ -157,11 +170,11 @@ npm pack
|
|
|
157
170
|
npm publish --access public --dry-run
|
|
158
171
|
```
|
|
159
172
|
|
|
160
|
-
`prepublishOnly` runs `npm run verify`, so a publish cannot bypass the local gate. `npm run build`
|
|
173
|
+
`prepublishOnly` runs `npm run verify`, so a publish cannot bypass the local gate. `npm run build` compiles the CLI, copies the current catalog to `dist/catalog/` and creates a `web`, `desktop` and `mobile` archive for every bundled starter revision under `dist/starters/`. The `1.0.0` and `1.1.0` revisions stay available as upgrade bases.
|
|
161
174
|
|
|
162
175
|
## Starter provenance
|
|
163
176
|
|
|
164
|
-
Starter **1.0.0**
|
|
177
|
+
Starter **1.2.0** moves the pinned catalog to `docs/STACK.md`, the Rust workspace to `api/` and the local Compose file to `devops/local/backend/`, adds a shared `packages/ui` Svelte package used by both web clients, generates the mobile overlay at `apps/mobile`, ignores Rust `target/` output and initializes a Git repository with an initial commit. It also adds `dev:web`, `dev:desktop` and `dev:mobile` product commands that combine the API with the selected surface. Starter **1.1.0** added the catalog and upgrade contract. Starter **1.0.0** remains frozen with the 30 November 2026 catalog at SHA-256 `850953320cc8e9093b9c3286e4279596dbdd274319e2b60ab648977ae4e90307`.
|
|
165
178
|
|
|
166
179
|
| Source | Generation |
|
|
167
180
|
| --- | --- |
|
|
@@ -174,9 +187,9 @@ Starter **1.0.0** preserves the 30 November 2026 catalog at SHA-256 `850953320cc
|
|
|
174
187
|
| Mobile | Hand-written SwiftPM `MobileCore` and `MobileCoreAndroid` targets, SwiftUI app, Jetpack Compose app, swift-java 0.7.0 JNI bindings, Swift 6.4.3, Kotlin 2.4.21, Compose BOM 2026.09.00, Gradle 9.5.0 and NDK r30 |
|
|
175
188
|
| Skills | Vercel Skills CLI 1.9.1, run locally with `--agent universal --copy --yes` |
|
|
176
189
|
|
|
177
|
-
Refresh starter sources with the upstream generators, verify the resulting workspace locks and target builds, then
|
|
190
|
+
Refresh starter sources with the upstream generators, verify the resulting workspace locks and target builds, then publish a new starter revision and catalog metadata before packing. The Jokebook source repository uses npm to build and distribute the CLI; each generated product uses pnpm.
|
|
178
191
|
|
|
179
|
-
Release verification for 1.
|
|
192
|
+
Release verification for 1.2.0 runs on macOS on Apple silicon. The CLI and starter use cross-platform Node APIs, but Linux and Windows native builds are not part of the 1.2.0 verification matrix. The generated README lists the host-specific prerequisites.
|
|
180
193
|
|
|
181
194
|
## Contributing
|
|
182
195
|
|
package/bin/run.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
import {readFile} from 'node:fs/promises'
|
|
4
|
+
|
|
3
5
|
if (Object.hasOwn(process.env, 'NO_COLOR')) delete process.env.FORCE_COLOR
|
|
6
|
+
const manifest = JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8'))
|
|
4
7
|
const {run, flush, Errors} = await import('@oclif/core')
|
|
5
8
|
try {
|
|
6
9
|
await run(process.argv.slice(2), import.meta.url)
|
|
@@ -14,7 +17,7 @@ try {
|
|
|
14
17
|
stage: 'arguments',
|
|
15
18
|
settings: null,
|
|
16
19
|
destination: null,
|
|
17
|
-
starterRevision:
|
|
20
|
+
starterRevision: manifest.jokebook?.starter ?? null,
|
|
18
21
|
installedSkills: [],
|
|
19
22
|
error: {message: error.message},
|
|
20
23
|
usage: 'Try: jokebook --help',
|
|
@@ -2,6 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
30 November 2026 · Web, desktop, mobile, collaboration, AI, data, and production infrastructure
|
|
4
4
|
|
|
5
|
+
<!-- jokebook-catalog
|
|
6
|
+
{
|
|
7
|
+
"recipes": [
|
|
8
|
+
{
|
|
9
|
+
"aliases": ["valibot"],
|
|
10
|
+
"capability": "runtime-validation",
|
|
11
|
+
"id": "runtime-validation",
|
|
12
|
+
"implementation": "valibot",
|
|
13
|
+
"package": "valibot",
|
|
14
|
+
"summary": "Browser-side input validation",
|
|
15
|
+
"workspace": "apps/web"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"sections": [
|
|
19
|
+
{"heading": "The decision", "header": "Surface", "workspace": "Root architecture and platform foundations"},
|
|
20
|
+
{"heading": "Web package catalog", "header": "Capability", "workspace": "apps/web"},
|
|
21
|
+
{"heading": "Rust API and worker packages", "header": "Capability", "workspace": "api and Cargo workspace"},
|
|
22
|
+
{"heading": "Desktop packages and operating-system integration", "header": "Capability", "workspace": "apps/desktop"},
|
|
23
|
+
{"heading": "Mobile packages and operating-system integration", "header": "Capability", "workspace": "apps/mobile"},
|
|
24
|
+
{"heading": "Data, synchronization, search, analytics and AI", "header": "Capability", "workspace": "api and infrastructure, with client integration as specified"},
|
|
25
|
+
{"heading": "Smaller packages that matter in specialized products", "header": "Capability", "workspace": "Depends on capability. See setup."},
|
|
26
|
+
{"heading": "Monorepo, delivery and operations", "header": "Capability", "workspace": "Workspace root, tooling and devops"}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
-->
|
|
30
|
+
|
|
5
31
|
## The decision
|
|
6
32
|
|
|
7
33
|
**Build the web application in Svelte 5 and SvelteKit 3, with Vite+ for web tooling. Keep Rust in the backend and desktop core. Use Tauri for the general desktop client, GPUI for a desktop-first product that warrants its own renderer, and a shared Swift core with native SwiftUI and Jetpack Compose shells for mobile.** PostgreSQL owns durable server state. Add SQLite and PowerSync when the product promises offline writes. Use a CRDT for the collaborative document itself when independent clients must merge edits. [1](<https://www.npmjs.com/package/svelte?activeTab=versions>) [2](<https://www.npmjs.com/package/%40sveltejs/kit?activeTab=versions>) [3](<https://voidzero.dev/posts/announcing-vite-plus-1-0>) [4](<https://v2.tauri.app/release>) [5](<https://zed.dev/blog/zed-1-0>) [6](<https://github.com/swiftlang/swift/releases/tag/swift-6.4.3-RELEASE>) [7](<https://powersync.com/blog/moving-the-powersync-service-to-apache>) [8](<https://github.com/loro-dev/loro>)
|
|
@@ -208,15 +234,17 @@ The request path stays small. Decode and authorize at the boundary, apply domain
|
|
|
208
234
|
Organize the repo around actual products. Use package dependencies and contract files to make ownership visible. A product with no mobile client does not need one to fit this layout.
|
|
209
235
|
|
|
210
236
|
```text
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
237
|
+
apps/{web,desktop,mobile}
|
|
238
|
+
api/{Cargo.toml,crates/{core,server}}
|
|
239
|
+
packages/{ui,tokens,web-sdk}
|
|
240
|
+
docs/{STACK.md,architecture}
|
|
215
241
|
contracts/{openapi,fixtures}
|
|
216
|
-
|
|
242
|
+
devops/{local,aws}/{frontend,backend}
|
|
217
243
|
tooling/{codegen,checks}
|
|
218
244
|
```
|
|
219
245
|
|
|
246
|
+
Keep local Compose and deployment files under `devops/local/<frontend|backend>`. Use the provider name for hosted environments, such as `devops/aws/backend` or `devops/cloudflare/frontend`.
|
|
247
|
+
|
|
220
248
|
| Capability | Selection | Implementation boundary |
|
|
221
249
|
|---|---|---|
|
|
222
250
|
| JS environment | Vite+ **1.8.0**, pnpm **12.25.1**, Node LTS | Lock runner and project CLI, set package age and install-script policy, cache only safe outputs. Pin exact optional native packages through the lockfile. [9](<https://www.npmjs.com/package/vite-plus>) [13](<https://pnpm.io/blog/releases/12.25.1>) [3](<https://voidzero.dev/posts/announcing-vite-plus-1-0>) |
|
package/dist/commands/add.d.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
2
|
import { findProduct, Workflow } from '../index.js';
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { type CatalogRecipe, type CatalogRow } from './stack/list.js';
|
|
4
|
+
export type RecipeSpec = CatalogRecipe & {
|
|
5
|
+
version: string;
|
|
6
|
+
};
|
|
7
|
+
type Catalog = {
|
|
8
|
+
recipes: CatalogRecipe[];
|
|
9
|
+
rows: CatalogRow[];
|
|
10
|
+
};
|
|
11
|
+
export declare function catalogRecipes(markdown: string): Catalog;
|
|
12
|
+
export declare function resolveRecipe(name: string, product?: Awaited<ReturnType<typeof findProduct>>): Promise<RecipeSpec>;
|
|
13
|
+
export declare function applyRecipe(workflow: Workflow, cwd: string, recipe: RecipeSpec, isDryRun: boolean): Promise<{
|
|
7
14
|
alreadyApplied: boolean;
|
|
8
15
|
changed: boolean;
|
|
9
16
|
dryRun: boolean;
|
|
@@ -23,3 +30,4 @@ export default class Add extends Command {
|
|
|
23
30
|
};
|
|
24
31
|
run(): Promise<void>;
|
|
25
32
|
}
|
|
33
|
+
export {};
|
package/dist/commands/add.js
CHANGED
|
@@ -2,23 +2,28 @@ import { Args, Command, Flags } from '@oclif/core';
|
|
|
2
2
|
import { lstat, mkdir, readFile, rmdir, writeFile } from 'node:fs/promises';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { catalogDocument, findProduct, Issue, readJson, release, slug, Workflow } from '../index.js';
|
|
5
|
-
import {
|
|
6
|
-
export const recipeName = 'runtime-validation';
|
|
7
|
-
export const recipePackage = 'valibot';
|
|
8
|
-
const recipeVersion = '1.5.0';
|
|
5
|
+
import { compileCatalog, lookup, recipeVersion } from './stack/list.js';
|
|
9
6
|
const usage = 'Try: jokebook add runtime-validation --no-interactive (from a Jokebook product)';
|
|
7
|
+
export function catalogRecipes(markdown) {
|
|
8
|
+
const catalog = compileCatalog(markdown);
|
|
9
|
+
return { recipes: catalog.metadata?.recipes ?? [], rows: catalog.rows };
|
|
10
|
+
}
|
|
10
11
|
export async function resolveRecipe(name, product) {
|
|
11
|
-
if ([recipeName, recipePackage].includes(slug(name)))
|
|
12
|
-
return recipeName;
|
|
13
12
|
const { text } = await catalogDocument(product);
|
|
14
|
-
const
|
|
13
|
+
const catalog = catalogRecipes(text);
|
|
14
|
+
const id = slug(name);
|
|
15
|
+
const recipe = catalog.recipes.find(({ aliases, id: recipeId }) => recipeId === id || aliases.includes(id));
|
|
16
|
+
if (recipe) {
|
|
17
|
+
return { ...recipe, version: recipeVersion(catalog.rows, recipe) };
|
|
18
|
+
}
|
|
19
|
+
const capability = lookup(catalog.rows, name);
|
|
15
20
|
if (capability) {
|
|
16
21
|
throw new Issue('This capability requires manual integration. Follow the catalog setup instructions.', { capability });
|
|
17
22
|
}
|
|
18
23
|
throw new Issue(`Unknown recipe "${name}". Run jokebook stack list to find a capability.`);
|
|
19
24
|
}
|
|
20
|
-
async function inspect(cwd) {
|
|
21
|
-
const workspace = path.join(cwd,
|
|
25
|
+
async function inspect(cwd, recipe) {
|
|
26
|
+
const workspace = path.join(cwd, recipe.workspace);
|
|
22
27
|
const manifest = path.join(workspace, 'package.json');
|
|
23
28
|
const lockfile = path.join(cwd, 'pnpm-lock.yaml');
|
|
24
29
|
const root = path.join(cwd, 'package.json');
|
|
@@ -33,27 +38,27 @@ async function inspect(cwd) {
|
|
|
33
38
|
const contents = await readFile(manifest, 'utf8');
|
|
34
39
|
const data = JSON.parse(contents);
|
|
35
40
|
const declarations = ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies']
|
|
36
|
-
.filter((group) => data[group]?.[
|
|
41
|
+
.filter((group) => data[group]?.[recipe.package] !== undefined);
|
|
37
42
|
const isApplied = declarations.length === 1 && declarations[0] === 'dependencies' &&
|
|
38
|
-
data.dependencies?.[
|
|
43
|
+
data.dependencies?.[recipe.package] === recipe.version;
|
|
39
44
|
if (!isApplied && declarations.length > 0) {
|
|
40
|
-
throw new Issue(
|
|
45
|
+
throw new Issue(`${recipe.workspace} already declares ${recipe.package} in a conflicting form. Review that declaration before applying this recipe.`);
|
|
41
46
|
}
|
|
42
47
|
return { contents, isApplied, lockfile, manifest };
|
|
43
48
|
}
|
|
44
49
|
export async function applyRecipe(workflow, cwd, recipe, isDryRun) {
|
|
45
50
|
workflow.stage = 'recipe-inspection';
|
|
46
|
-
if (recipe !==
|
|
47
|
-
throw new Issue(`Unknown
|
|
48
|
-
const current = await inspect(cwd);
|
|
49
|
-
const spec = `${
|
|
51
|
+
if (recipe.implementation !== 'valibot')
|
|
52
|
+
throw new Issue(`Unknown recipe implementation "${recipe.implementation}".`);
|
|
53
|
+
const current = await inspect(cwd, recipe);
|
|
54
|
+
const spec = `${recipe.package}@${recipe.version}`;
|
|
50
55
|
const result = {
|
|
51
56
|
alreadyApplied: current.isApplied,
|
|
52
57
|
changed: !current.isApplied && !isDryRun,
|
|
53
58
|
dryRun: isDryRun,
|
|
54
59
|
package: spec,
|
|
55
|
-
recipe,
|
|
56
|
-
workspace:
|
|
60
|
+
recipe: recipe.id,
|
|
61
|
+
workspace: recipe.workspace,
|
|
57
62
|
};
|
|
58
63
|
if (isDryRun)
|
|
59
64
|
return result;
|
|
@@ -68,22 +73,22 @@ export async function applyRecipe(workflow, cwd, recipe, isDryRun) {
|
|
|
68
73
|
throw error;
|
|
69
74
|
}
|
|
70
75
|
try {
|
|
71
|
-
const { contents, isApplied, lockfile, manifest } = await inspect(cwd);
|
|
76
|
+
const { contents, isApplied, lockfile, manifest } = await inspect(cwd, recipe);
|
|
72
77
|
const previousLock = await readFile(lockfile);
|
|
73
78
|
workflow.stage = 'recipe-installation';
|
|
74
79
|
try {
|
|
75
80
|
if (!isApplied) {
|
|
76
|
-
await workflow.command('pnpm', ['--filter',
|
|
81
|
+
await workflow.command('pnpm', ['--filter', `./${recipe.workspace}`, 'add', '--save-exact', '--lockfile-only', spec], {
|
|
77
82
|
cwd,
|
|
78
|
-
deliverable: `resolve ${spec} for
|
|
83
|
+
deliverable: `resolve ${spec} for ${recipe.workspace}`,
|
|
79
84
|
});
|
|
80
85
|
}
|
|
81
86
|
await workflow.command('pnpm', ['install', '--frozen-lockfile'], { cwd, deliverable: 'install recipe dependencies' });
|
|
82
87
|
workflow.stage = 'recipe-verification';
|
|
83
|
-
await workflow.command('pnpm', ['--filter',
|
|
84
|
-
'-e',
|
|
88
|
+
await workflow.command('pnpm', ['--filter', `./${recipe.workspace}`, 'exec', 'node', '--input-type=module',
|
|
89
|
+
'-e', `import {parse, string} from '${recipe.package}'; if (parse(string(), 'ready') !== 'ready') process.exit(1)`], {
|
|
85
90
|
cwd,
|
|
86
|
-
deliverable: `verify ${spec} from
|
|
91
|
+
deliverable: `verify ${spec} from ${recipe.workspace}`,
|
|
87
92
|
});
|
|
88
93
|
return { ...result, alreadyApplied: isApplied, changed: !isApplied };
|
|
89
94
|
}
|
package/dist/commands/init.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
|
+
import { Workflow } from '../index.js';
|
|
3
|
+
export declare function initializeRepository(workflow: Workflow, directory: string): Promise<void>;
|
|
2
4
|
export default class Init extends Command {
|
|
3
5
|
static args: {
|
|
4
6
|
product: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
package/dist/commands/init.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as prompts from '@clack/prompts';
|
|
2
2
|
import { Args, Command, Flags } from '@oclif/core';
|
|
3
|
-
import {
|
|
3
|
+
import { lstat, mkdir, mkdtemp, readFile, rename, rm, rmdir, writeFile } from 'node:fs/promises';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { applyRecipe,
|
|
5
|
+
import { assertDestination, catalogDocument, catalogPath, Issue, isUnattended, presets, readJson, release, resolveDestination, skills, Workflow, } from '../index.js';
|
|
6
|
+
import { extractStarter } from '../starter.js';
|
|
7
|
+
import { applyRecipe, catalogRecipes, resolveRecipe } from './add.js';
|
|
8
8
|
const usage = 'Try: jokebook init my-product --preset web --dir ./my-product --no-interactive';
|
|
9
9
|
const presetNames = Object.keys(presets);
|
|
10
10
|
function productError(value = '') {
|
|
@@ -43,10 +43,10 @@ async function promptPreset() {
|
|
|
43
43
|
})),
|
|
44
44
|
}));
|
|
45
45
|
}
|
|
46
|
-
async function promptRecipes() {
|
|
46
|
+
async function promptRecipes(recipes) {
|
|
47
47
|
return answered(await prompts.multiselect({
|
|
48
48
|
message: 'Optional recipes',
|
|
49
|
-
options:
|
|
49
|
+
options: recipes.map(({ id, package: packageName, summary }) => ({ hint: summary, label: packageName, value: id })),
|
|
50
50
|
required: false,
|
|
51
51
|
}));
|
|
52
52
|
}
|
|
@@ -57,6 +57,7 @@ function plan(settings) {
|
|
|
57
57
|
'Starter ' + release.revision,
|
|
58
58
|
'Recipes: ' + (settings.recipes.join(', ') || 'none'),
|
|
59
59
|
'Skills: ' + skills.map(({ name }) => name).join(', '),
|
|
60
|
+
'Git: initialize a repository and create an initial commit',
|
|
60
61
|
].join('\n');
|
|
61
62
|
}
|
|
62
63
|
async function installSkill(workflow, stage, index) {
|
|
@@ -97,32 +98,33 @@ async function applyRecipes(workflow, stage, recipes, index = 0) {
|
|
|
97
98
|
const recipe = recipes[index];
|
|
98
99
|
if (!recipe)
|
|
99
100
|
return;
|
|
100
|
-
await applyRecipe(workflow, stage, recipe, false);
|
|
101
|
+
await applyRecipe(workflow, stage, await resolveRecipe(recipe), false);
|
|
101
102
|
await applyRecipes(workflow, stage, recipes, index + 1);
|
|
102
103
|
}
|
|
104
|
+
export async function initializeRepository(workflow, directory) {
|
|
105
|
+
const options = { cwd: directory, deliverable: 'product Git repository' };
|
|
106
|
+
await workflow.command('git', ['init', '--quiet'], options);
|
|
107
|
+
await workflow.command('git', ['add', '--all'], { ...options, deliverable: 'product Git index' });
|
|
108
|
+
await workflow.command('git', [
|
|
109
|
+
'-c', 'user.name=Jokebook',
|
|
110
|
+
'-c', 'user.email=jokebook@localhost',
|
|
111
|
+
'-c', 'commit.gpgsign=false',
|
|
112
|
+
'commit', '--quiet', '--no-verify', '-m', 'Initialize product with Jokebook',
|
|
113
|
+
], { ...options, deliverable: 'product initial commit' });
|
|
114
|
+
}
|
|
103
115
|
async function materialize(workflow, settings) {
|
|
104
116
|
const { destination, preset, product, recipes } = settings;
|
|
105
117
|
const isDesktop = ['desktop', 'full'].includes(preset);
|
|
106
|
-
const isMobile = ['full', 'mobile'].includes(preset);
|
|
107
118
|
workflow.stage = 'generation';
|
|
108
119
|
const stage = await mkdtemp(path.join(path.dirname(destination), '.jokebook-'));
|
|
109
120
|
try {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
await mkdir(apps, { recursive: true });
|
|
115
|
-
await extract({
|
|
116
|
-
cwd: apps,
|
|
117
|
-
file: packageFile(`./starter-${release.revision}-mobile.tgz`),
|
|
118
|
-
strict: true,
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
await catalogDocument();
|
|
122
|
-
await copyFile(packageFile('../docs/STACK.md'), path.join(stage, 'STACK.md'));
|
|
121
|
+
await extractStarter(release.revision, preset, stage);
|
|
122
|
+
const { digest, text } = await catalogDocument();
|
|
123
|
+
await mkdir(path.join(stage, path.dirname(catalogPath)), { recursive: true });
|
|
124
|
+
await writeFile(path.join(stage, catalogPath), text);
|
|
123
125
|
const manifest = path.join(stage, 'package.json');
|
|
124
126
|
const starterManifest = await readJson(manifest);
|
|
125
|
-
const marker = { preset, stackSha256:
|
|
127
|
+
const marker = { catalog: release.catalog, preset, stackSha256: digest, starter: release.revision };
|
|
126
128
|
await writeFile(manifest, JSON.stringify({ ...starterManifest, jokebook: marker, name: product }, null, 2) + '\n');
|
|
127
129
|
if (isDesktop) {
|
|
128
130
|
const configFile = path.join(stage, 'apps/desktop/src-tauri/tauri.conf.json');
|
|
@@ -136,6 +138,8 @@ async function materialize(workflow, settings) {
|
|
|
136
138
|
await workflow.command('pnpm', ['install', '--frozen-lockfile'], { cwd: stage, deliverable: 'product dependencies' });
|
|
137
139
|
await applyRecipes(workflow, stage, recipes);
|
|
138
140
|
await installSkills(workflow, stage);
|
|
141
|
+
workflow.stage = 'repository';
|
|
142
|
+
await initializeRepository(workflow, stage);
|
|
139
143
|
workflow.stage = 'finalize';
|
|
140
144
|
workflow.checkCancelled();
|
|
141
145
|
await assertDestination(destination);
|
|
@@ -166,7 +170,7 @@ export default class Init extends Command {
|
|
|
166
170
|
json: Flags.boolean({ description: 'Emit a single JSON result without prompts' }),
|
|
167
171
|
'no-interactive': Flags.boolean({ description: 'Resolve input without prompts' }),
|
|
168
172
|
preset: Flags.string({ description: 'Surface preset (default: web)', options: presetNames }),
|
|
169
|
-
with: Flags.string({ description:
|
|
173
|
+
with: Flags.string({ description: 'Apply an automated catalog recipe (repeat for each recipe)', multiple: true }),
|
|
170
174
|
};
|
|
171
175
|
async run() {
|
|
172
176
|
const workflow = new Workflow('init');
|
|
@@ -177,6 +181,7 @@ export default class Init extends Command {
|
|
|
177
181
|
throw new Issue('--interactive requires a usable terminal outside CI and conflicts with --no-interactive and --json.');
|
|
178
182
|
}
|
|
179
183
|
await Promise.all((flags.with ?? []).map(async (recipe) => resolveRecipe(recipe)));
|
|
184
|
+
const catalog = catalogRecipes((await catalogDocument()).text);
|
|
180
185
|
const product = args.product ?? (canPrompt ? await promptProduct() : undefined);
|
|
181
186
|
if (!product)
|
|
182
187
|
throw new Issue('Supply a product name in non-interactive mode.');
|
|
@@ -185,7 +190,7 @@ export default class Init extends Command {
|
|
|
185
190
|
throw new Issue(invalid);
|
|
186
191
|
const dir = flags.dir ?? (canPrompt ? await promptDestination(product) : product);
|
|
187
192
|
const preset = flags.preset ?? (canPrompt ? await promptPreset() : 'web');
|
|
188
|
-
const recipes = flags.with ?? (canPrompt ? await promptRecipes() : []);
|
|
193
|
+
const recipes = flags.with ?? (canPrompt ? await promptRecipes(catalog.recipes) : []);
|
|
189
194
|
workflow.stage = 'destination';
|
|
190
195
|
const settings = {
|
|
191
196
|
destination: await resolveDestination(dir),
|
|
@@ -213,6 +218,6 @@ export default class Init extends Command {
|
|
|
213
218
|
return { created: settings.destination, dryRun: false, skills: skills.map(({ name }) => name) };
|
|
214
219
|
}, (result) => result.dryRun
|
|
215
220
|
? result.plan
|
|
216
|
-
: `Created ${result.created}\
|
|
221
|
+
: `Created ${result.created}\nInitialized Git with an initial commit. Run pnpm dev from the project root. See README.md for the API and native targets.`);
|
|
217
222
|
}
|
|
218
223
|
}
|