@divithselvam/jokebook 1.1.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 CHANGED
@@ -2,6 +2,25 @@
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
+
5
24
  ## [1.1.0] - 2026-12-01
6
25
 
7
26
  ### Added
@@ -60,5 +79,6 @@ All notable changes to Jokebook are documented here. The format follows [Keep a
60
79
  - Existing non-empty destinations are refused.
61
80
  - A staged product is moved into place only after dependency installation, recipe checks and both skill verifications succeed.
62
81
 
82
+ [1.2.0]: https://github.com/Divith123/jokebook/releases/tag/v1.2.0
63
83
  [1.1.0]: https://github.com/Divith123/jokebook/releases/tag/v1.1.0
64
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, and moved into place only after dependency installation and skill verification succeed. Existing products can merge a newer bundled starter with `jokebook upgrade` without discarding local edits.
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
 
@@ -68,7 +68,7 @@ The command exits `0` on success, `1` on failure and `130` on cancellation. `--j
68
68
 
69
69
  ### `stack`
70
70
 
71
- `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.
72
72
 
73
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.
74
74
 
@@ -84,7 +84,7 @@ Automated recipes require the current starter revision. If the product is older,
84
84
 
85
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
86
 
87
- A completed upgrade writes a report under `.jokebook/`, updates the product marker and moves the pinned catalog when needed. 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.
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.
88
88
 
89
89
  ## What a product contains
90
90
 
@@ -94,37 +94,44 @@ my-product/
94
94
  apps/desktop/ Tauri desktop client (desktop and full)
95
95
  apps/mobile/ Shared Swift core, SwiftUI iOS app and Jetpack Compose Android app
96
96
  (mobile and full; see apps/mobile/README.md)
97
- services/api/ Rust/Axum HTTP API
98
- packages/ Shared workspace packages
99
- STACK.md Pinned architecture and package catalog
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
100
104
  AGENTS.md Agent guidance for the catalog and update workflow
101
105
  skills-lock.json Skills CLI provenance for both project skills
102
106
  pnpm-workspace.yaml One pnpm workspace and root lockfile
103
- Cargo.toml Rust workspace
104
107
  package.json Product marker, preset, catalog revision and catalog hash
108
+ .git/ Repository initialized with an initial commit
105
109
  ```
106
110
 
107
- The generated `README.md` covers development commands, the API and readiness endpoints, production static hosting, native prerequisites, catalog lookup and the upgrade workflow.
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.
108
114
 
109
115
  ## How generation works
110
116
 
111
117
  1. Resolve flags and prompts into one validated configuration.
112
118
  2. Reject a non-empty destination before touching the filesystem.
113
119
  3. Extract the versioned starter into a staging directory alongside the destination.
114
- 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.
115
121
  5. Run `pnpm install --frozen-lockfile` in the staged workspace.
116
122
  6. Apply selected recipes and install both project-local agent skills.
117
- 7. Re-check the destination and rename the completed staging directory into place.
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.
118
125
 
119
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.
120
127
 
121
128
  ## Catalog and recipes
122
129
 
123
- The canonical catalog lives at `catalogs/<revision>/STACK.md`. Catalog `1.1.0` is the current revision, with SHA-256 `14f8bf06942076bf593e89e20f6413677fbf8f0cf4aee9151fbe87e604150e17`. Catalog `1.0.0` remains bundled as the frozen upgrade base at SHA-256 `850953320cc8e9093b9c3286e4279596dbdd274319e2b60ab648977ae4e90307`.
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`.
124
131
 
125
- The `1.1.0` catalog adds a machine-readable `jokebook-catalog` block that declares section ownership, table headers and recipes. Its Markdown content is otherwise identical to `1.0.0`. The frozen `1.0.0` catalog predates that block, so the CLI keeps a clearly marked legacy section map for it only.
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.
126
133
 
127
- Every generated product gets a byte-for-byte copy of the catalog bundled with its starter. The CLI refuses to continue if a product's `STACK.md` no longer matches the hash recorded in its `package.json`. The published package contains only the current catalog at `dist/catalog/STACK.md`; bundled starter revisions live under `dist/starters/<revision>/<surface>.tgz`.
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`.
128
135
 
129
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.
130
137
 
@@ -135,7 +142,7 @@ Every real `init` installs these two skills with the pinned Skills CLI 1.9.1, fr
135
142
  - `Divith123/skills` → `blame-the-intern`
136
143
  - `googlechrome/modern-web-guidance` → `modern-web-guidance`
137
144
 
138
- 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 `STACK.md` before scaffolding or changing dependencies, and use `jokebook upgrade --check` before `--apply`.
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`.
139
146
 
140
147
  No agent command or global skill installation is required after generation.
141
148
 
@@ -154,7 +161,7 @@ npm ci
154
161
  npm run verify
155
162
  ```
156
163
 
157
- `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, conflict refusal, catalog parsing and archive contents. `npm run verify:package` runs only the package check.
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.
158
165
 
159
166
  Before a release, inspect the package and run a publish dry run:
160
167
 
@@ -163,11 +170,11 @@ npm pack
163
170
  npm publish --access public --dry-run
164
171
  ```
165
172
 
166
- `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 old `1.0.0` revision stays available as the upgrade base.
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.
167
174
 
168
175
  ## Starter provenance
169
176
 
170
- Starter **1.1.0** reuses the verified `1.0.0` application sources. It updates `AGENTS.md` and the generated READMEs for the catalog and upgrade contract, and removes the placeholder catalog marker from `package.json` so generation writes the real marker. Starter **1.0.0** remains frozen with the 30 November 2026 catalog at SHA-256 `850953320cc8e9093b9c3286e4279596dbdd274319e2b60ab648977ae4e90307`.
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`.
171
178
 
172
179
  | Source | Generation |
173
180
  | --- | --- |
@@ -182,7 +189,7 @@ Starter **1.1.0** reuses the verified `1.0.0` application sources. It updates `A
182
189
 
183
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.
184
191
 
185
- Release verification for 1.1.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.1.0 verification matrix. The generated README lists the host-specific prerequisites.
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.
186
193
 
187
194
  ## Contributing
188
195
 
@@ -18,12 +18,12 @@
18
18
  "sections": [
19
19
  {"heading": "The decision", "header": "Surface", "workspace": "Root architecture and platform foundations"},
20
20
  {"heading": "Web package catalog", "header": "Capability", "workspace": "apps/web"},
21
- {"heading": "Rust API and worker packages", "header": "Capability", "workspace": "services/api and Cargo workspace"},
21
+ {"heading": "Rust API and worker packages", "header": "Capability", "workspace": "api and Cargo workspace"},
22
22
  {"heading": "Desktop packages and operating-system integration", "header": "Capability", "workspace": "apps/desktop"},
23
23
  {"heading": "Mobile packages and operating-system integration", "header": "Capability", "workspace": "apps/mobile"},
24
- {"heading": "Data, synchronization, search, analytics and AI", "header": "Capability", "workspace": "services and infrastructure, with client integration as specified"},
24
+ {"heading": "Data, synchronization, search, analytics and AI", "header": "Capability", "workspace": "api and infrastructure, with client integration as specified"},
25
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 infrastructure"}
26
+ {"heading": "Monorepo, delivery and operations", "header": "Capability", "workspace": "Workspace root, tooling and devops"}
27
27
  ]
28
28
  }
29
29
  -->
@@ -234,15 +234,17 @@ The request path stays small. Decode and authorize at the boundary, apply domain
234
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.
235
235
 
236
236
  ```text
237
- products/<product>/{web,desktop,mobile}
238
- services/{api,worker}
239
- crates/{core,db,contracts,agent-host}
240
- packages/{tokens,web-ui,web-sdk}
237
+ apps/{web,desktop,mobile}
238
+ api/{Cargo.toml,crates/{core,server}}
239
+ packages/{ui,tokens,web-sdk}
240
+ docs/{STACK.md,architecture}
241
241
  contracts/{openapi,fixtures}
242
- infra/{tofu,containers,otel}
242
+ devops/{local,aws}/{frontend,backend}
243
243
  tooling/{codegen,checks}
244
244
  ```
245
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
+
246
248
  | Capability | Selection | Implementation boundary |
247
249
  |---|---|---|
248
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>) |
@@ -1,4 +1,4 @@
1
1
  {
2
- "catalog": "1.1.0",
3
- "sha256": "14f8bf06942076bf593e89e20f6413677fbf8f0cf4aee9151fbe87e604150e17"
2
+ "catalog": "1.2.0",
3
+ "sha256": "7dbbc7f0a44a1d424646e9ce6c51598e69c4738d2772ed17db3844aa2d1282e5"
4
4
  }
@@ -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>>;
@@ -1,8 +1,8 @@
1
1
  import * as prompts from '@clack/prompts';
2
2
  import { Args, Command, Flags } from '@oclif/core';
3
- import { lstat, mkdtemp, readFile, rename, rm, rmdir, writeFile } from 'node:fs/promises';
3
+ import { lstat, mkdir, mkdtemp, readFile, rename, rm, rmdir, writeFile } from 'node:fs/promises';
4
4
  import path from 'node:path';
5
- import { assertDestination, catalogDocument, Issue, isUnattended, presets, readJson, release, resolveDestination, skills, Workflow, } from '../index.js';
5
+ import { assertDestination, catalogDocument, catalogPath, Issue, isUnattended, presets, readJson, release, resolveDestination, skills, Workflow, } from '../index.js';
6
6
  import { extractStarter } from '../starter.js';
7
7
  import { applyRecipe, catalogRecipes, resolveRecipe } from './add.js';
8
8
  const usage = 'Try: jokebook init my-product --preset web --dir ./my-product --no-interactive';
@@ -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) {
@@ -100,6 +101,17 @@ async function applyRecipes(workflow, stage, recipes, index = 0) {
100
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);
@@ -108,7 +120,8 @@ async function materialize(workflow, settings) {
108
120
  try {
109
121
  await extractStarter(release.revision, preset, stage);
110
122
  const { digest, text } = await catalogDocument();
111
- await writeFile(path.join(stage, 'STACK.md'), text);
123
+ await mkdir(path.join(stage, path.dirname(catalogPath)), { recursive: true });
124
+ await writeFile(path.join(stage, catalogPath), text);
112
125
  const manifest = path.join(stage, 'package.json');
113
126
  const starterManifest = await readJson(manifest);
114
127
  const marker = { catalog: release.catalog, preset, stackSha256: digest, starter: release.revision };
@@ -125,6 +138,8 @@ async function materialize(workflow, settings) {
125
138
  await workflow.command('pnpm', ['install', '--frozen-lockfile'], { cwd: stage, deliverable: 'product dependencies' });
126
139
  await applyRecipes(workflow, stage, recipes);
127
140
  await installSkills(workflow, stage);
141
+ workflow.stage = 'repository';
142
+ await initializeRepository(workflow, stage);
128
143
  workflow.stage = 'finalize';
129
144
  workflow.checkCancelled();
130
145
  await assertDestination(destination);
@@ -203,6 +218,6 @@ export default class Init extends Command {
203
218
  return { created: settings.destination, dryRun: false, skills: skills.map(({ name }) => name) };
204
219
  }, (result) => result.dryRun
205
220
  ? result.plan
206
- : `Created ${result.created}\nRun pnpm dev from the project root. See README.md for the API and native targets.`);
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.`);
207
222
  }
208
223
  }
@@ -34,11 +34,11 @@ export type CatalogRow = {
34
34
  workspace: string;
35
35
  };
36
36
  export declare function catalogMetadata(markdown: string): CatalogMetadata | undefined;
37
- export declare function compileCatalog(markdown: string): {
37
+ export declare function compileCatalog(markdown: string, document?: string): {
38
38
  metadata: CatalogMetadata | undefined;
39
39
  rows: CatalogRow[];
40
40
  };
41
- export declare function entries(markdown: string): CatalogRow[];
41
+ export declare function entries(markdown: string, document?: string): CatalogRow[];
42
42
  export declare function recipeVersion(rows: CatalogRow[], recipe: CatalogRecipe): string;
43
43
  export declare function lookup(catalog: ReturnType<typeof entries>, capability: string): CatalogRow;
44
44
  export default class List extends Command {
@@ -1,6 +1,6 @@
1
1
  import { Command, Flags } from '@oclif/core';
2
2
  import path from 'node:path';
3
- import { catalogDocument, findProduct, Issue, slug, Workflow } from '../../index.js';
3
+ import { catalogDocument, catalogPath, findProduct, Issue, slug, Workflow } from '../../index.js';
4
4
  // Catalog 1.0.0 shipped before the machine-readable block. It is frozen, so its
5
5
  // section ownership can only live here; every newer catalog must declare it.
6
6
  const legacySections = [
@@ -8,7 +8,7 @@ const legacySections = [
8
8
  { header: 'Capability', heading: 'Desktop packages and operating-system integration', workspace: 'apps/desktop' },
9
9
  { header: 'Capability', heading: 'Mobile packages and operating-system integration', workspace: 'apps/mobile' },
10
10
  { header: 'Capability', heading: 'Monorepo, delivery and operations', workspace: 'Workspace root, tooling and infrastructure' },
11
- { header: 'Capability', heading: 'Rust API and worker packages', workspace: 'services/api and Cargo workspace' },
11
+ { header: 'Capability', heading: 'Rust API and worker packages', workspace: 'api and Cargo workspace' },
12
12
  { header: 'Capability', heading: 'Smaller packages that matter in specialized products', workspace: 'Depends on capability. See setup.' },
13
13
  { header: 'Surface', heading: 'The decision', workspace: 'Root architecture and platform foundations' },
14
14
  { header: 'Capability', heading: 'Web package catalog', workspace: 'apps/web' },
@@ -119,10 +119,10 @@ function packagePin(selection, packageName) {
119
119
  '@(\\d+(?:\\.\\d+)+(?:[\\-+][\\w.]+)?)`', 'v');
120
120
  const match = pattern.exec(selection);
121
121
  if (!match)
122
- throw new Issue(`STACK.md does not pin ${packageName} for its automated recipe.`);
122
+ throw new Issue(`The catalog does not pin ${packageName} for its automated recipe.`);
123
123
  return match[1];
124
124
  }
125
- export function compileCatalog(markdown) {
125
+ export function compileCatalog(markdown, document = catalogPath) {
126
126
  const metadata = catalogMetadata(markdown);
127
127
  const sections = metadata?.sections ?? legacySections;
128
128
  const byHeading = new Map(sections.map((section) => [section.heading, section]));
@@ -140,7 +140,7 @@ export function compileCatalog(markdown) {
140
140
  }
141
141
  for (const section of sections) {
142
142
  if (!headings.has(section.heading))
143
- throw new Issue(`STACK.md is missing the declared section "${section.heading}".`);
143
+ throw new Issue(`The catalog is missing the declared section "${section.heading}".`);
144
144
  }
145
145
  const declaredHeaders = new Set(sections.map(({ header }) => header));
146
146
  const seenSections = new Set();
@@ -183,7 +183,7 @@ export function compileCatalog(markdown) {
183
183
  section,
184
184
  selection: withoutReferences(selected),
185
185
  setup: withoutReferences(notes),
186
- source: { document: 'STACK.md', line: index + 1, links: references(line) },
186
+ source: { document, line: index + 1, links: references(line) },
187
187
  status: recipe ? `Automated recipe: ${recipe.id}` : 'Catalog recommendation; verify before adopting',
188
188
  versions: versionList(selected),
189
189
  workspace: byHeading.get(section)?.workspace ?? 'See catalog setup',
@@ -192,11 +192,11 @@ export function compileCatalog(markdown) {
192
192
  }
193
193
  for (const declaredSection of sections) {
194
194
  if (!seenSections.has(declaredSection.heading)) {
195
- throw new Issue(`STACK.md section "${declaredSection.heading}" has no "${declaredSection.header}" table.`);
195
+ throw new Issue(`The catalog section "${declaredSection.heading}" has no "${declaredSection.header}" table.`);
196
196
  }
197
197
  }
198
198
  if (rows.length === 0)
199
- throw new Issue('No capability rows were found in STACK.md.');
199
+ throw new Issue('No capability rows were found in the catalog.');
200
200
  for (const recipe of metadata?.recipes ?? []) {
201
201
  const row = rows.find(({ id }) => id === recipe.capability);
202
202
  if (!row)
@@ -205,8 +205,8 @@ export function compileCatalog(markdown) {
205
205
  }
206
206
  return { metadata, rows };
207
207
  }
208
- export function entries(markdown) {
209
- return compileCatalog(markdown).rows;
208
+ export function entries(markdown, document) {
209
+ return compileCatalog(markdown, document).rows;
210
210
  }
211
211
  export function recipeVersion(rows, recipe) {
212
212
  const row = rows.find(({ id }) => id === recipe.capability);
@@ -226,7 +226,7 @@ export function lookup(catalog, capability) {
226
226
  return packages[0];
227
227
  }
228
228
  export default class List extends Command {
229
- static description = 'List package and platform capabilities from STACK.md';
229
+ static description = 'List package and platform capabilities from the catalog';
230
230
  static flags = { json: Flags.boolean({ description: 'Emit JSON' }) };
231
231
  async run() {
232
232
  const workflow = new Workflow('stack list');
@@ -236,8 +236,8 @@ export default class List extends Command {
236
236
  const product = await findProduct();
237
237
  if (product)
238
238
  workflow.starterRevision = product.marker.starter;
239
- const { digest, text } = await catalogDocument(product);
240
- return { capabilities: entries(text), stackSha256: digest };
239
+ const { digest, file, text } = await catalogDocument(product);
240
+ return { capabilities: entries(text, file), stackSha256: digest };
241
241
  }, (result) => result.capabilities.map(({ capability, id }) => `${id} ${capability}`).join('\n'));
242
242
  }
243
243
  }
@@ -13,8 +13,8 @@ export default class Show extends Command {
13
13
  const product = await findProduct();
14
14
  if (product)
15
15
  workflow.starterRevision = product.marker.starter;
16
- const { digest, text } = await catalogDocument(product);
17
- const capability = lookup(entries(text), args.capability);
16
+ const { digest, file, text } = await catalogDocument(product);
17
+ const capability = lookup(entries(text, file), args.capability);
18
18
  if (!capability)
19
19
  throw new Issue(`Unknown capability "${args.capability}". Run jokebook stack list.`);
20
20
  return { capability, stackSha256: digest };
@@ -24,9 +24,9 @@ export default class Upgrade extends Command {
24
24
  workflow.destination = product.cwd;
25
25
  workflow.starterRevision = product.marker.starter;
26
26
  workflow.stage = 'catalog';
27
- const { digest } = await catalogDocument(product);
27
+ const { digest, file } = await catalogDocument(product);
28
28
  workflow.stage = 'upgrade';
29
- const plan = await planUpgrade(product, digest);
29
+ const plan = await planUpgrade(product, digest, file);
30
30
  if (flags.apply && plan.status !== 'up-to-date') {
31
31
  const report = await applyUpgrade(product, plan);
32
32
  workflow.stage = 'complete';
package/dist/index.d.ts CHANGED
@@ -12,6 +12,8 @@ export declare const release: Readonly<{
12
12
  version: string;
13
13
  }>;
14
14
  export declare const skills: Skill[];
15
+ export declare const catalogPath = "docs/STACK.md";
16
+ export declare const legacyCatalogPath = "STACK.md";
15
17
  export declare const presets: {
16
18
  desktop: string;
17
19
  full: string;
@@ -73,6 +75,7 @@ export declare function readJson<T>(file: string): Promise<T>;
73
75
  export declare function findProduct(start?: string): Promise<Product | undefined>;
74
76
  export declare function catalogDocument(product?: Product): Promise<{
75
77
  digest: string;
78
+ file: string;
76
79
  text: string;
77
80
  }>;
78
81
  export declare function slug(value: string): string;
package/dist/index.js CHANGED
@@ -22,6 +22,8 @@ export const release = Object.freeze({
22
22
  version: manifest.version,
23
23
  });
24
24
  export const { skills } = config;
25
+ export const catalogPath = 'docs/STACK.md';
26
+ export const legacyCatalogPath = 'STACK.md';
25
27
  export const presets = {
26
28
  desktop: 'Web foundation and Tauri desktop',
27
29
  full: 'Web, Tauri desktop and shared-Swift mobile',
@@ -217,21 +219,25 @@ async function readCatalog(file) {
217
219
  }
218
220
  export async function catalogDocument(product) {
219
221
  if (product) {
220
- let text;
221
- try {
222
- text = await readFile(path.resolve(product.cwd, 'STACK.md'), 'utf8');
223
- }
224
- catch (error) {
225
- if (error.code === 'ENOENT') {
226
- throw new Issue('STACK.md is missing from this product. Restore the catalog recorded in package.json before continuing.');
222
+ const candidates = await Promise.all([catalogPath, legacyCatalogPath].map(async (candidate) => {
223
+ try {
224
+ return { file: candidate, text: await readFile(path.resolve(product.cwd, candidate), 'utf8') };
227
225
  }
228
- throw error;
226
+ catch (error) {
227
+ if (error.code === 'ENOENT')
228
+ return undefined;
229
+ throw error;
230
+ }
231
+ }));
232
+ const found = candidates.find((candidate) => candidate !== undefined);
233
+ if (!found) {
234
+ throw new Issue(`${catalogPath} is missing from this product. Restore the catalog recorded in package.json before continuing.`);
229
235
  }
230
- const digest = createHash('sha256').update(text).digest('hex');
236
+ const digest = createHash('sha256').update(found.text).digest('hex');
231
237
  if (digest !== product.marker.stackSha256) {
232
- throw new Issue('STACK.md differs from the recorded revision. Restore the original catalog before continuing.');
238
+ throw new Issue(`${found.file} differs from the recorded revision. Restore the original catalog before continuing.`);
233
239
  }
234
- return { digest, text };
240
+ return { ...found, digest };
235
241
  }
236
242
  const index = await readJson(packageFile('../dist/catalog/index.json')).catch((error) => {
237
243
  if (error.code === 'ENOENT') {
@@ -247,7 +253,7 @@ export async function catalogDocument(product) {
247
253
  if (digest !== index.sha256) {
248
254
  throw new Issue('The bundled catalog does not match its recorded SHA-256. Reinstall Jokebook.');
249
255
  }
250
- return { digest, text };
256
+ return { digest, file: catalogPath, text };
251
257
  }
252
258
  export function slug(value) {
253
259
  return value.toLowerCase().replaceAll(/[^a-z0-9]+/gv, '-').replaceAll(/^-|-$/gv, '');
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,10 +1,11 @@
1
1
  {
2
- "catalog": "1.1.0",
3
- "catalogSha256": "14f8bf06942076bf593e89e20f6413677fbf8f0cf4aee9151fbe87e604150e17",
4
- "current": "1.1.0",
2
+ "catalog": "1.2.0",
3
+ "catalogSha256": "7dbbc7f0a44a1d424646e9ce6c51598e69c4738d2772ed17db3844aa2d1282e5",
4
+ "current": "1.2.0",
5
5
  "revisions": [
6
6
  "1.0.0",
7
- "1.1.0"
7
+ "1.1.0",
8
+ "1.2.0"
8
9
  ],
9
10
  "surfaces": {
10
11
  "1.0.0": [
@@ -16,6 +17,11 @@
16
17
  "desktop",
17
18
  "mobile",
18
19
  "web"
20
+ ],
21
+ "1.2.0": [
22
+ "desktop",
23
+ "mobile",
24
+ "web"
19
25
  ]
20
26
  }
21
27
  }
package/dist/upgrade.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type Product, type ProductMarker } from './index.js';
2
- type Action = 'add' | 'conflict' | 'merge' | 'remove' | 'update';
2
+ type Action = 'add' | 'conflict' | 'merge' | 'move' | 'remove' | 'update';
3
3
  type Content = Uint8Array;
4
4
  type Write = {
5
5
  content: Content;
@@ -25,6 +25,6 @@ export type UpgradePlan = {
25
25
  };
26
26
  export type UpgradeResult = Omit<UpgradePlan, 'marker' | 'writes'>;
27
27
  export declare function publicPlan(plan: UpgradePlan): UpgradeResult;
28
- export declare function planUpgrade(product: Product, currentDigest: string): Promise<UpgradePlan>;
28
+ export declare function planUpgrade(product: Product, currentDigest: string, currentCatalogFile: string): Promise<UpgradePlan>;
29
29
  export declare function applyUpgrade(product: Product, plan: UpgradePlan): Promise<string>;
30
30
  export {};
package/dist/upgrade.js CHANGED
@@ -5,7 +5,7 @@ import { lstat, mkdir, mkdtemp, readdir, readFile, rename, rm, stat, writeFile }
5
5
  import { tmpdir } from 'node:os';
6
6
  import path from 'node:path';
7
7
  import { isDeepStrictEqual } from 'node:util';
8
- import { catalogDocument, Issue, presets, release } from './index.js';
8
+ import { catalogDocument, catalogPath, Issue, presets, release } from './index.js';
9
9
  import { extractStarter, starterIndex } from './starter.js';
10
10
  const missing = Symbol('missing');
11
11
  const revisionPattern = /^\d+(?:\.\d+)*$/v;
@@ -176,6 +176,52 @@ async function mergeText(work, current, base, next, name) {
176
176
  function isBinary(content) {
177
177
  return content.includes(0);
178
178
  }
179
+ // Starter 1.2.0 moved the Rust workspace into api/ and local Compose under devops/.
180
+ const movedFiles = new Map([
181
+ ['Cargo.lock', 'api/Cargo.lock'],
182
+ ['Cargo.toml', 'api/Cargo.toml'],
183
+ ['compose.yaml', 'devops/local/backend/compose.yaml'],
184
+ ['services/api/Cargo.toml', 'api/crates/server/Cargo.toml'],
185
+ ['services/api/src/main.rs', 'api/crates/server/src/main.rs'],
186
+ ['src/lib.rs', 'api/crates/core/src/lib.rs'],
187
+ ]);
188
+ async function planMove(from, to, plan, counter) {
189
+ const currentPath = path.join(plan.currentRoot, from);
190
+ const [current, base, next] = await Promise.all([
191
+ readOptional(currentPath),
192
+ readOptional(path.join(plan.baseRoot, from)),
193
+ readOptional(path.join(plan.nextRoot, to)),
194
+ ]);
195
+ if (!current || !base || !next)
196
+ return false;
197
+ const target = path.join(plan.currentRoot, to);
198
+ if (await readOptional(target)) {
199
+ plan.conflicts.push(change('conflict', to, `A local file already occupies the destination of the moved starter file ${from}.`));
200
+ return true;
201
+ }
202
+ let content = next;
203
+ let reason = `Moved from ${from}.`;
204
+ if (digest(current) !== digest(base) && digest(base) !== digest(next)) {
205
+ if (isBinary(current) || isBinary(base) || isBinary(next)) {
206
+ plan.conflicts.push(change('conflict', to, `The moved starter file ${from} changed in both the product and the new starter.`));
207
+ return true;
208
+ }
209
+ const merged = await mergeText(plan.work, current, base, next, `move-${counter}`);
210
+ if (merged.conflict) {
211
+ plan.conflicts.push(change('conflict', to, `The moved starter file ${from} changed in both the product and the new starter.`));
212
+ return true;
213
+ }
214
+ content = merged.content;
215
+ reason = `Moved from ${from} and merged with local edits; review the result.`;
216
+ }
217
+ else if (digest(current) !== digest(base)) {
218
+ content = current;
219
+ }
220
+ const mode = (await stat(currentPath)).mode % 0o1000;
221
+ plan.writes.set(to, { content, mode });
222
+ plan.actions.push(change('move', to, reason), change('remove', from, `Moved to ${to}.`));
223
+ return true;
224
+ }
179
225
  async function planFile(file, currentPath, basePath, nextPath, write, actions, conflicts, work, counter) {
180
226
  const [current, base, next] = await Promise.all([
181
227
  readOptional(currentPath),
@@ -267,7 +313,7 @@ function report(plan) {
267
313
  lines.push('- Review `git diff`, run the product checks, and commit the result.', '');
268
314
  return lines.join('\n');
269
315
  }
270
- export async function planUpgrade(product, currentDigest) {
316
+ export async function planUpgrade(product, currentDigest, currentCatalogFile) {
271
317
  const from = product.marker.starter;
272
318
  if (!revisionPattern.test(from))
273
319
  throw new Issue(`The product records an invalid starter revision: ${from}.`);
@@ -284,16 +330,21 @@ export async function planUpgrade(product, currentDigest) {
284
330
  status: 'up-to-date', to, warnings: [], writes: new Map(),
285
331
  };
286
332
  if (currentDigest !== stackSha256 && product.marker.catalog === release.catalog) {
287
- throw new Issue(`The product records catalog ${release.catalog}, but its STACK.md does not match the bundled catalog.`);
333
+ throw new Issue(`The product records catalog ${release.catalog}, but its ${currentCatalogFile} does not match the bundled catalog.`);
288
334
  }
289
335
  if (from === to) {
290
- if (currentDigest === stackSha256 && product.marker.catalog === release.catalog)
336
+ const isCatalogMoved = currentCatalogFile !== catalogPath;
337
+ if (!isCatalogMoved && currentDigest === stackSha256 && product.marker.catalog === release.catalog)
291
338
  return basePlan;
292
339
  const writes = new Map();
293
340
  const actions = [];
294
- if (currentDigest !== stackSha256) {
295
- writes.set('STACK.md', { content: bytes(catalog), mode: 0o644 });
296
- actions.push(change('update', 'STACK.md', `Catalog updated from ${product.marker.catalog ?? 'an earlier revision'} to ${release.catalog}.`));
341
+ if (isCatalogMoved || currentDigest !== stackSha256) {
342
+ writes.set(catalogPath, { content: bytes(catalog), mode: 0o644 });
343
+ actions.push(isCatalogMoved
344
+ ? change('move', catalogPath, `Moved from ${currentCatalogFile}.`)
345
+ : change('update', catalogPath, `Catalog updated from ${product.marker.catalog ?? 'an earlier revision'} to ${release.catalog}.`));
346
+ if (isCatalogMoved)
347
+ actions.push(change('remove', currentCatalogFile, `Moved to ${catalogPath}.`));
297
348
  }
298
349
  if (product.marker.catalog !== release.catalog) {
299
350
  const manifestFile = path.join(product.cwd, 'package.json');
@@ -306,7 +357,7 @@ export async function planUpgrade(product, currentDigest) {
306
357
  ...basePlan,
307
358
  actions,
308
359
  status: 'ready',
309
- warnings: ['Review the catalog diff and commit the updated STACK.md and package.json marker.'],
360
+ warnings: [`Review the catalog diff and commit the updated ${catalogPath} and package.json marker.`],
310
361
  writes,
311
362
  };
312
363
  }
@@ -333,8 +384,22 @@ export async function planUpgrade(product, currentDigest) {
333
384
  const writes = new Map();
334
385
  const actions = [];
335
386
  const conflicts = [];
387
+ const moved = new Set();
336
388
  let counter = 0;
389
+ for (const [source, destination] of movedFiles) {
390
+ if (!oldFiles.has(source) || !newFiles.has(destination))
391
+ continue;
392
+ counter += 1;
393
+ if (await planMove(source, destination, {
394
+ actions, baseRoot: oldRoot, conflicts, currentRoot: product.cwd, nextRoot: newRoot, work, writes,
395
+ }, counter)) {
396
+ moved.add(source);
397
+ moved.add(destination);
398
+ }
399
+ }
337
400
  for (const file of paths) {
401
+ if (file === catalogPath || file === currentCatalogFile || moved.has(file))
402
+ continue;
338
403
  const currentPath = safeTarget(product.cwd, file);
339
404
  const write = (content) => {
340
405
  writes.set(file, { content, mode: 0o644 });
@@ -396,9 +461,14 @@ export async function planUpgrade(product, currentDigest) {
396
461
  }
397
462
  }
398
463
  }
399
- if (currentDigest !== stackSha256) {
400
- writes.set('STACK.md', { content: bytes(catalog), mode: 0o644 });
401
- actions.push(change('update', 'STACK.md', `Catalog updated to ${release.catalog}.`));
464
+ const isCatalogMoved = currentCatalogFile !== catalogPath;
465
+ if (isCatalogMoved || currentDigest !== stackSha256) {
466
+ writes.set(catalogPath, { content: bytes(catalog), mode: 0o644 });
467
+ actions.push(isCatalogMoved
468
+ ? change('move', catalogPath, `Moved from ${currentCatalogFile}.`)
469
+ : change('update', catalogPath, `Catalog updated to ${release.catalog}.`));
470
+ if (isCatalogMoved)
471
+ actions.push(change('remove', currentCatalogFile, `Moved to ${catalogPath}.`));
402
472
  }
403
473
  const warnings = [];
404
474
  if (actions.some((entry) => entry.path === 'package.json' || entry.path === 'pnpm-lock.yaml')) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@divithselvam/jokebook",
3
3
  "description": "Versioned project generator for SvelteKit, Rust/Axum, PostgreSQL, Tauri and shared-Swift native mobile monorepos",
4
- "version": "1.1.0",
4
+ "version": "1.2.0",
5
5
  "author": "Divithselvam",
6
6
  "type": "module",
7
7
  "bin": {
@@ -48,8 +48,8 @@
48
48
  "CHANGELOG.md"
49
49
  ],
50
50
  "jokebook": {
51
- "catalog": "1.1.0",
52
- "starter": "1.1.0",
51
+ "catalog": "1.2.0",
52
+ "starter": "1.2.0",
53
53
  "pnpm": "12.25.1",
54
54
  "skillsCli": "1.9.1",
55
55
  "skills": [