diff --git a/.changeset/app-json-wording.md b/.changeset/app-json-wording.md new file mode 100644 index 00000000..d90ec91e --- /dev/null +++ b/.changeset/app-json-wording.md @@ -0,0 +1,5 @@ +--- +'@_linked/cli': patch +--- + +Comments and the architecture notes name `linked.app.json`, not the removed `linked.config.js`. diff --git a/.changeset/app-settings-in-linked-app-json.md b/.changeset/app-settings-in-linked-app-json.md new file mode 100644 index 00000000..89f36056 --- /dev/null +++ b/.changeset/app-settings-in-linked-app-json.md @@ -0,0 +1,16 @@ +--- +"@_linked/cli": major +--- + +`linked.app.json` holds every setting of an app; `linked.config.js` is no longer read. + +**Breaking.** + +- An app with a `linked.config.js` (or `lincd.config.js`) is refused when its server starts (`linked start`, `linked serve-app`, a compiled server) and when it is built (`linked build-app`); the error shows the JSON to move its settings into. Move them into `linked.app.json` and delete the file. +- Schema version 1 gains `cssMode` (`tailwind` | `postcss`), `syncShapesOnBoot`, `datasetCloneScript`, `publish` (`staticAssets`, `releasePrefix`) and `server` (`rpcExposure`, `rawQueries`, `apiOnly`, `cachePaths`, `cacheTimeout`). Each is checked; an unknown key, also inside `server` or `publish`, is refused. `linked prefixes` keeps them when it adds prefixes. +- `LINKED_RPC_EXPOSURE`, when set, wins over `server.rpcExposure`; a value other than `warn` or `enforce` is refused at start. +- `defineConfig` (`@_linked/cli/defineConfig` and the package entry) is removed: nothing reads a settings module any more. +- Types: `ModuleConfig`, `AdjustedModuleConfig` (the old webpack build's) and `LinkedServerConfig.multiCore` are removed; `LinkedConfig` is the configuration the cli gives `LinkedServer` (`cssMode`, `syncShapesOnBoot`, `server`), and loses `datasetCloneScript`. New: `AppServerSettings`, `CssMode`, `RpcExposureMode`, `RawQueriesMode`. `server.loadAppComponent` and `server.loadRoutes` are set by the cli only. +- `resolveLinkedConfigPath` and `LINKED_CONFIG_FILES` (`@_linked/cli/commands/start`) are removed; `readDatasetCloneScript` is synchronous. + +**Fixed.** `linked generate-ontology` replaces a side-effect import of a `src/ontologies/.register.js` that no longer exists (a register module deleted by hand) with the import of the ontology index, as it does for the register modules it removes itself. diff --git a/.changeset/dataset-clone-script.md b/.changeset/dataset-clone-script.md new file mode 100644 index 00000000..7dc2f1a6 --- /dev/null +++ b/.changeset/dataset-clone-script.md @@ -0,0 +1,13 @@ +--- +"@_linked/cli": minor +--- + +`linked worktree add --dataset ` and `linked branch start --worktree --dataset ` now print how to fill the new dataset from the app's own clone script instead of fixed script paths: + +- The app adds an npm script `clone-dataset` to its root `package.json` that copies its data into the dataset named by its one argument. The hint is then `Clone the data into first (from ): npm run clone-dataset -- `. +- To use another script name, set `datasetCloneScript` in `linked.config.js`: `defineConfig({datasetCloneScript: 'data:clone'})` (new optional `LinkedConfig` key). +- Without the script (or when `datasetCloneScript` names a script `package.json` lacks), a warning says the dataset starts empty unless it is cloned by hand, and how to add the script. + +New exports from the worktree command module: `datasetCloneHint`, `datasetCloneMessages`, `readDatasetCloneScript`, `DEFAULT_DATASET_CLONE_SCRIPT`, `appPort`; `DEFAULT_APP_PORT` (4040) from the start command. + +Wording: `worktree add` without `--port` names the app's own port (its `.env` `PORT`, else 4040) as the main checkout's, and `branch land` says "Restart the app on …". See `docs/integration-branches-and-worktrees.md`, "Cloning a dataset". diff --git a/.changeset/debuginfo-stale-todo.md b/.changeset/debuginfo-stale-todo.md new file mode 100644 index 00000000..e7a03db7 --- /dev/null +++ b/.changeset/debuginfo-stale-todo.md @@ -0,0 +1,5 @@ +--- +'@_linked/cli': patch +--- + +Removes a stale commented-out TODO about `linked.config.json` from `debugInfo`. diff --git a/.changeset/host-app-generic.md b/.changeset/host-app-generic.md new file mode 100644 index 00000000..51927aaa --- /dev/null +++ b/.changeset/host-app-generic.md @@ -0,0 +1,5 @@ +--- +"@_linked/cli": patch +--- + +Comments and docs describe the host app generically. diff --git a/.changeset/land-build-order.md b/.changeset/land-build-order.md new file mode 100644 index 00000000..d01ad6d9 --- /dev/null +++ b/.changeset/land-build-order.md @@ -0,0 +1,5 @@ +--- +'@_linked/cli': patch +--- + +One dependency order for release PRs, `checkout` and `branch land`, with the build tool ordered as `linked build-all` orders it: the build tool's own dependencies, then the build tool (`@_linked/cli`), then everything else. The packages that devDepend on the build tool while it depends on one of them (`@_linked/core`) formed a cycle, which fell back to name order and could put a package before the build tool. `branch land` therefore built such a package with the old build tool. When the build tool fails to build in `branch land`, the packages after it are not built (and so not pushed). diff --git a/.changeset/namespace-iri-characters.md b/.changeset/namespace-iri-characters.md new file mode 100644 index 00000000..656dc554 --- /dev/null +++ b/.changeset/namespace-iri-characters.md @@ -0,0 +1,5 @@ +--- +"@_linked/cli": patch +--- + +`linkedOntologies` namespaces and the namespaces of `linked.app.json` prefixes refuse the characters that cannot appear in a SPARQL or Turtle IRI (`<`, `>`, `"`, `{`, `}`, `|`, `^`, backtick, backslash, whitespace and control characters). `NAMESPACE_IRI` is exported from `utils/ontologyConfig`. diff --git a/.changeset/ontology-index-and-app-prefixes.md b/.changeset/ontology-index-and-app-prefixes.md new file mode 100644 index 00000000..03866bb1 --- /dev/null +++ b/.changeset/ontology-index-and-app-prefixes.md @@ -0,0 +1,23 @@ +--- +"@_linked/cli": major +--- + +One ontology index per package, and an app's own prefix map in `linked.app.json`. + +**Ontology modules (breaking).** `linked generate-ontology` writes, per package: + +- `src/ontologies/.ts` for each generated ontology: only its terms, each `export const Term = {id: 'Term'};` (the value `createNameSpace(namespace)('Term')` returns). It imports nothing; use `createNameSpace` from `@_linked/core/utils/NameSpace` where code needs a namespace function. +- `src/ontologies/index.ts`: imports every ontology module of the package (those with `"generated": false` too) and registers them all with one `registerOntologies([{name, namespace, terms, data, suggestedPrefix}], import.meta.url)` call. `registerOntologies` comes from the package's `src/package.ts` (`linkedPackage(...)`), so it needs the `@_linked/core` major that provides it. +- The package entry (`src/index.ts[x]`) imports `./ontologies/index.js`; side-effect imports of a removed `.register.js` become an import of the index. +- `.data.ts` and `.register.ts` are no longer generated: the command removes the ones it wrote before. Their exports (`ns`, `dataFiles`, `loadData`, `_ontologyResource`) are gone; import `createNameSpace` from core instead of `ns`. +- `linked build`'s ontology check also fails when the entry does not import the index or such a file is left. Run `linked generate-ontology` and commit the result. +- A module written by hand (`"generated": false`) no longer registers itself: the index does. +- `create-package --kind ontology` and `create-ontology` write this layout; the package template's `src/package.ts` exports `registerOntologies` instead of `linkedOntology`. +- The build's shape check expects a package's ontologies to register through `ontologies/index.js` (or `src/ontologies/index.ts` before it is built). +- `@_linked/cli/utils/ontologyModules`: `generateOntologyModules(specs, handWritten?)` returns every module of a package (terms modules and `src/ontologies/index.ts`); new `generateOntologyIndexModule`; `generateOntologyDataModule` and `generateOntologyRegisterModule` are removed; `OntologyModuleSpec.ontology` is removed. `generatePackageOntologies` returns `{ontologies, files, edits, remove}`. + +**`linked.app.json` (new).** An app's declarative settings at its root: `{"$schema": "https://linked.cm/schema/app/1.json", "schemaVersion": 1, "prefixes": {"": ""}}`. The schema ships as `schema/app/1.json`; an unknown `schemaVersion` or key is refused; a prefix is `^[A-Za-z][A-Za-z0-9_]*$`. + +- `linked prefixes` adds a prefix for every installed ontology whose namespace the map lacks: its suggested prefix (from its vann data), or `_2`, `_3`, … when taken. It never changes or removes an entry, and creates the file when the app has none. `linked generate-ontology` runs it for the app the package belongs to (same git repository). +- The map is loaded into core (`Prefix.load`) at server start (`linked start` and a compiled server) and in the browser bundle (the `linked:app-prefixes` Vite plugin of `createViteConfig`; the client entry imports it first). An app with no `linked.app.json` loads nothing; a core without `Prefix.load` is warned about and left as it is. +- `linked create-app` writes `linked.app.json` and fills it after the install; the React Native template's API service has one. diff --git a/.changeset/ontology-module-and-hand-written.md b/.changeset/ontology-module-and-hand-written.md new file mode 100644 index 00000000..926950bb --- /dev/null +++ b/.changeset/ontology-module-and-hand-written.md @@ -0,0 +1,17 @@ +--- +"@_linked/cli": minor +--- + +A `linkedOntologies` entry names its module and may keep its modules written by hand. + +- `"module"` (optional, the same pattern as a name, default the name) is the modules' file name in `src/ontologies/`: a generated ontology's files are `.ts`, `.data.ts` and `.register.ts`, imported as `/ontologies/`. The registration still uses the name: `linkedOntology(terms, ns, '', …)`. Two entries with one module are refused. +- `"generated": false` (default `true`) declares an ontology whose modules hold more than the generator writes. `linked generate-ontology` writes nothing for it and `linked build` skips its staleness check, but its data must carry the same vann triples, and the build refuses it without them: + + ```json + "linkedOntologies": { + "core": {"namespace": "https://example.org/core/", "module": "linked-core", "generated": false} + } + ``` + +- New pure module `@_linked/cli/utils/ontologyConfig`: `readOntologyConfigs(pkgJson)` returns `{name, namespace, module, generated, data}` per ontology, sorted by name. `OntologyConfig`, `ONTOLOGIES_KEY`, `ONTOLOGY_NAMESPACE` and `readOntologyConfigs` move there from `@_linked/cli/utils/generateOntology`. +- `OntologyModuleSpec.module` (optional) names the generated files. diff --git a/.changeset/ontology-names-and-vann-prefix.md b/.changeset/ontology-names-and-vann-prefix.md new file mode 100644 index 00000000..d6784519 --- /dev/null +++ b/.changeset/ontology-names-and-vann-prefix.md @@ -0,0 +1,22 @@ +--- +"@_linked/cli": minor +--- + +Ontologies are keyed by their name within the package, and their suggested prefix is data. + +- `package.json` `"linkedOntologies"` is keyed by the ontology's **name** (lowercase letters and digits, single `-` or `_` between them). The name names the modules (`src/ontologies/.ts`, `.data.ts`, `.register.ts`) and is the third argument of the generated `linkedOntology(terms, ns, '', loadData, dataFiles)`. It is no longer a prefix. +- `linked generate-ontology` reads the suggested prefix from the `vann:preferredNamespacePrefix` of the ontology's `owl:Ontology` node and writes `Prefix.add('', '')` in `.data.ts`. +- **A package without vann data now fails its build** (and `linked generate-ontology`): every ontology's `owl:Ontology` node must carry exactly one `vann:preferredNamespacePrefix` and one `vann:preferredNamespaceUri` equal to its configured `namespace`. The message names the package, the ontology and its files, and shows the triples to add. To fix it, add to one of the ontology's data files (for a published vocabulary shipped unedited, a `src/data/-added.ttl` listed in its `data`): + + ```turtle + @prefix owl: . + @prefix vann: . + + a owl:Ontology ; + vann:preferredNamespacePrefix "ex" ; + vann:preferredNamespaceUri "http://example.org/ont/" . + ``` + + Write the prefix the package registers today, so its Turtle output does not change, then run `linked generate-ontology`. +- `create-package --kind ontology` and `create-ontology ` write both triples (the name as the prefix). +- API of `@_linked/cli/utils/ontologyModules` and `ontologyTerms`: `OntologyModuleSpec.prefix` is replaced by `name` and `suggestedPrefix`; `ONTOLOGY_PREFIX` by `ONTOLOGY_NAME` (lowercase only) and `SUGGESTED_PREFIX`; `OntologyConfig.prefix` by `name`; `OntologyNameCollisionError.prefix` by `ontologyName`. `ontologyTermsFromQuads` also returns `preferredPrefixes` and `preferredNamespaces`; new `ontologySuggestedPrefix(result, namespace)` and `OntologyVannError`. diff --git a/CHANGELOG.md b/CHANGELOG.md index 0072854f..484e5f65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -462,14 +462,14 @@ update`, which refuses a keyed branch the target does not contain yet. `MergeRes - **Two kinds of package.** An ontology package `-ont` holds exactly one ontology (`src/ontologies/.ts` and its register sibling) and no shapes, components or backend. Its ontology slug is ``, without `-ont`, so its terms mint `https://linked.cm/ont//{Term}` (or `{Term}` when a namespace is given). An asset package `-assets` holds shapes, components and a backend (`src/shapes`, `src/backend.ts`, the barrels) and no ontology. Both are ordinary linked packages (`linkedPackage: true`). - **`linked create-ont-package `** and **`linked create-asset-package `** create one kind each. **`linked create-package `** asks which on a terminal; `--kind ontology|assets|both` answers it, and `both` creates the pair. Without a terminal and without `--kind` it exits 1 and names the flag, as `--location` does. `--kind both` refuses `--remote`: one repository cannot hold two packages. `--location`, `--remote` and `--push` work for all three commands, and `--skip-install` writes the files only. - - **With `--kind both --location packages` the asset package depends on the ontology package:** a regular `dependencies` entry `"-ont": "^"`, as Create Now's project scaffold writes, which npm workspaces link locally. With `packages-local` or outside an app it gets no such entry (`npm install` would fail with E404 on the unpublished `-ont` package); one line says to run `npm install -ont` once it is published. A package created on its own gets no such entry. + - **With `--kind both --location packages` the asset package depends on the ontology package:** a regular `dependencies` entry `"-ont": "^"`, as the host app's project scaffold writes, which npm workspaces link locally. With `packages-local` or outside an app it gets no such entry (`npm install` would fail with E404 on the unpublished `-ont` package); one line says to run `npm install -ont` once it is published. A package created on its own gets no such entry. - **The suffix is never doubled:** `create-ont-package foo-ont` creates `foo-ont`, and `@acme/foo` becomes `@acme/foo-ont`. - **`linked create-app` no longer rewrites `src/package.ts`.** A new app is a `linkedApp`, not a linked package: its root registers no package, so `create-app` stamps `package.json`, the env files and the process names and leaves `src/` alone. - **Every created package has `"linkedPackage": true`.** - **A package created inside an app is minted under the app's root:** `linkedPackage(name, {baseUri})`, and an ontology package's namespace is `{baseUri}ont//`. The root comes from `--base-uri `, else `LINKED_BASE_URI` in the shell, else the app's `.env.local`, else its `.env`. A malformed root is refused before anything is written. With no root the package declares none and mints under `https://linked.cm/`, the normal default; that is no warning, one informational line says so: `Shapes and terms in mint under https://linked.cm/. They resolve once the package is published (npx linked publish, coming soon).` - - **`create-shape`, `create-component`, `create-set-component` and `create-ontology` refuse where there is no `src/package.ts`** (a new app root has none) with `run this inside a package (packages/)`, instead of writing a file whose `../package.js` import cannot resolve. An app with its own root `src/package.ts` (create-now) is served as before. + - **`create-shape`, `create-component`, `create-set-component` and `create-ontology` refuse where there is no `src/package.ts`** (a new app root has none) with `run this inside a package (packages/)`, instead of writing a file whose `../package.js` import cannot resolve. An app with its own root `src/package.ts` is served as before. - **The `create-shape` template compiles:** it imported `NamedNode` from `@_linked/core`, which core does not export (TS2305). It is the getter-only shape form now. - - The templates moved with the kinds: `defaults/package/` is the asset package, whose manifest, tsconfigs, dotfiles and `src/package.ts` every kind shares, and `defaults/package-ontology/` holds the example ontology. The template files create-now reads from `defaults/package/` (`package.json`, the tsconfigs, `src/shapes/index.ts`, `src/backend.ts`) are where they were. + - The templates moved with the kinds: `defaults/package/` is the asset package, whose manifest, tsconfigs, dotfiles and `src/package.ts` every kind shares, and `defaults/package-ontology/` holds the example ontology. The template files a host app reads from `defaults/package/` (`package.json`, the tsconfigs, `src/shapes/index.ts`, `src/backend.ts`) are where they were. - `create-component` and `create-set-component` resolve their templates from the built CLI again (they looked one directory too high). - [#234](https://github.com/linked-fw/cli/pull/234) [`362f890`](https://github.com/linked-fw/cli/commit/362f890941c973d257bcbd1218f0b78ffcf3ea23) Thanks [@flyon](https://github.com/flyon)! - Apps now get a `dependencies` relink hook next to `postinstall`, so `npm update`, `npm install `, `npm uninstall` and `npm dedupe` keep localized links. npm runs a root `postinstall` only on a bare `npm install` / `npm ci`, but runs a root `dependencies` script after any command that changes `node_modules`. `linked create-package` sets up both scripts, and `linked localize` / `--adopt` add whichever is missing when they record a package (an existing script is kept and the command appended with `&&`; a script that already relinks, including the old `linked-localize --relink` spelling, is left alone). @@ -574,7 +574,7 @@ update`, which refuses a keyed branch the target does not contain yet. `MergeRes ### Minor Changes -- [#202](https://github.com/linked-fw/cli/pull/202) [`a05333d`](https://github.com/linked-fw/cli/commit/a05333d7e3bc6b69878e07608eb5165d49437635) Thanks [@flyon](https://github.com/flyon)! - `create-package` and `create-ontology` scaffold new ontologies at `https://linked.cm/ont/{slug}/` instead of the legacy `http://lincd.org/ont/{name}/`, matching the first-party packages (arch-02). The slug is derived the way core derives a package's publicSlug: the npm scope is dropped and the rest kebab-cased, so `linked create-package @_linked/foo` now gets `https://linked.cm/ont/foo/` (it used to get `http://lincd.org/ont/@_linked/foo/`). An explicit `uri_base` argument still wins, which is how a private package gets its workspace-scoped root (`https://{workspaceSlug}.id.create.now/ont/{slug}/`); a `uri_base` that already ends in `/` or `#` is no longer given a second `/`. +- [#202](https://github.com/linked-fw/cli/pull/202) [`a05333d`](https://github.com/linked-fw/cli/commit/a05333d7e3bc6b69878e07608eb5165d49437635) Thanks [@flyon](https://github.com/flyon)! - `create-package` and `create-ontology` scaffold new ontologies at `https://linked.cm/ont/{slug}/` instead of the legacy `http://lincd.org/ont/{name}/`, matching the first-party packages. The slug is derived the way core derives a package's publicSlug: the npm scope is dropped and the rest kebab-cased, so `linked create-package @_linked/foo` now gets `https://linked.cm/ont/foo/` (it used to get `http://lincd.org/ont/@_linked/foo/`). An explicit `uri_base` argument still wins, which is how a private package gets its workspace-scoped root (`https://{workspaceSlug}.example.org/ont/{slug}/`); a `uri_base` that already ends in `/` or `#` is no longer given a second `/`. ## 1.37.0 @@ -759,7 +759,7 @@ update`, which refuses a keyed branch the target does not contain yet. `MergeRes A property that names its value shape by `[package, name]` (`shape: ['@_linked/schema', 'ImageObject']`) does not load that shape, and consumers deep-import single shape modules. So a package could ship a module whose query `workspace.image.contentUrl` threw `Shape class not found for …/ImageObject` in a - production bundle where nothing else happened to load ImageObject — which is how Create Now came to + production bundle where nothing else happened to load ImageObject — which is how the host app came to show "No organizations found". `@_linked/sioc` also named shapes under its old package name (`lincd-sioc`), which could never resolve. @@ -805,7 +805,7 @@ update`, which refuses a keyed branch the target does not contain yet. `MergeRes - [#162](https://github.com/linked-fw/cli/pull/162) [`e965600`](https://github.com/linked-fw/cli/commit/e9656005679f137b023d811fc057409071109d27) Thanks [@flyon](https://github.com/flyon)! - `createViteConfig` now keeps compiled decorated classes named as written. Vite re-prints any published module that mentions `process.env` or `import.meta.env` (client build) or `process.env.NODE_ENV` (dev client) with esbuild, which renamed tsc's `let Foo = class Foo` to `class Foo2` — and an unnamed shape's IRI is its class name. A new `linked:pin-compiled-class-names` plugin pins each such class's name right after its declaration, before its decorators run. -- [#170](https://github.com/linked-fw/cli/pull/170) [`7a9e465`](https://github.com/linked-fw/cli/commit/7a9e465d498ff01247967d586b17e81c29536e08) Thanks [@flyon](https://github.com/flyon)! - `createViteConfig` now bundles `@_linked/server` in the dev SSR runner (`ssr.noExternal`), in workspace and standalone mode alike. `linked start` loads `LinkedServer` through `vite.ssrLoadModule`, so Vite already evaluated that entry and every file it reaches by relative import, while bare `@_linked/server/...` imports from the app and its storage config went to Node. The package was split across two loaders, and which one evaluated a given file depended on import order: in Create Now, `package.js` and `ontologies/lincd-server.js` evaluated once in each, and `shapes/filestores/LocalFileStore.js` too once the package's `backend` loaded. Vite is now the only loader for it. The new `SSR_ENTRY_PACKAGES` export names the packages this applies to. +- [#170](https://github.com/linked-fw/cli/pull/170) [`7a9e465`](https://github.com/linked-fw/cli/commit/7a9e465d498ff01247967d586b17e81c29536e08) Thanks [@flyon](https://github.com/flyon)! - `createViteConfig` now bundles `@_linked/server` in the dev SSR runner (`ssr.noExternal`), in workspace and standalone mode alike. `linked start` loads `LinkedServer` through `vite.ssrLoadModule`, so Vite already evaluated that entry and every file it reaches by relative import, while bare `@_linked/server/...` imports from the app and its storage config went to Node. The package was split across two loaders, and which one evaluated a given file depended on import order: in the host app, `package.js` and `ontologies/lincd-server.js` evaluated once in each, and `shapes/filestores/LocalFileStore.js` too once the package's `backend` loaded. Vite is now the only loader for it. The new `SSR_ENTRY_PACKAGES` export names the packages this applies to. ## 1.28.1 @@ -837,7 +837,7 @@ update`, which refuses a keyed branch the target does not contain yet. `MergeRes `build-all` discovered only packages declaring `linkedPackage: true`, only inside the `workspaces` globs, and printed nothing about anything it passed over. Measured against - Create Now, that meant `Found 3 total LINCD packages in use by this app` and `exit 0` for a + the host app, that meant `Found 3 total LINCD packages in use by this app` and `exit 0` for a workspace of six tracked members plus 25 localized checkouts — with `@_linked/maps`, a shipped dependency that had simply never been given the flag, dropped from a green build in silence. @@ -982,7 +982,7 @@ update`, which refuses a keyed branch the target does not contain yet. `MergeRes The declared range was wide enough that the resolved core depended on whatever the consumer — or this repo's own CI, via `package-lock.json` — happened to install. Core decides how a shape's IRI is minted, so a stale core made this package emit legacy - `data.lincd.org` IRIs instead of the arch-02 `linked.cm` scheme. Which IRIs a published + `data.lincd.org` IRIs instead of the `linked.cm` scheme. Which IRIs a published package produces should not be a function of the installer's dependency tree. Minor rather than patch: this raises the minimum core a consumer must resolve, so it @@ -1747,7 +1747,7 @@ update`, which refuses a keyed branch the target does not contain yet. `MergeRes - [#59](https://github.com/linked-cm/cli/pull/59) [`647417b`](https://github.com/linked-cm/cli/commit/647417bdcfbd5603daeb02ffd9ddc94f702a960e) Thanks [@flyon](https://github.com/flyon)! - Standalone dev + template git-clone scaffolding: - **Standalone dev resolution** — `createViteConfig` now detects when an app is NOT inside a workspace (lib-only npm install of `@_linked/*`) and resolves those deps via `import → lib/esm` (conditions `['module','node']`) instead of the `development → src` export they don't ship. Fixes "Failed to load `@_linked/server/shapes/LinkedServer`" on a clean install. Monorepo/workspace dev is unchanged. - - **`create-app` clones the template repo** — new apps are scaffolded by `git clone`-ing `linked-cm/app-template` (single source of truth, same repo CN's server-side project creation uses) instead of copying a bundled defaults tree. The bundled `defaults/app-with-backend` is removed. + - **`create-app` clones the template repo** — new apps are scaffolded by `git clone`-ing `linked-cm/app-template` (single source of truth, same repo the host app's server-side project creation uses) instead of copying a bundled defaults tree. The bundled `defaults/app-with-backend` is removed. - Removed the orphaned tsx `register`/`register-css-only` loaders (+ `tsx` dep); apps run plain `linked start` (Vite handles TS transform). ## 1.8.2 @@ -1777,8 +1777,6 @@ update`, which refuses a keyed branch the target does not contain yet. `MergeRes in scaffolded files, you've hit the documented gap. The fix path is the template rewrite, not reverting to legacy lincd. - Context: see create-now plan-011 report (docs/reports/009-legacy-lincd-eradication.md). - ## 1.8.1 ### Patch Changes @@ -1938,7 +1936,7 @@ update`, which refuses a keyed branch the target does not contain yet. `MergeRes - `@_linked/react: ^1.3` (needs the loader/errorElement resolution chain + `_refresh` on `linkedSetComponent`) - `@_linked/cli: ^1.4` (template uses the loader bin) - Also: `theme.css` top-comment no longer references the colours as "CN-branded" — they're just the default palette; users override `--color-primary-*` / `--color-secondary-*` to brand. README workspace-note generalized to "another repo's `packages/`" instead of a specific path. + Also: `theme.css` top-comment no longer references the colours as brand colours — they're just the default palette; users override `--color-primary-*` / `--color-secondary-*` to brand. README workspace-note generalized to "another repo's `packages/`" instead of a specific path. ## 1.4.0 @@ -1948,9 +1946,9 @@ update`, which refuses a keyed branch the target does not contain yet. `MergeRes Plus: CLI command help text refresh (`LINCD app` → `Linked app`, etc.). Config file name `lincd.config.{js,json}` → `linked.config.{js,json}` (hard cut, no fallback) — was previously rolled out separately. -- [#23](https://github.com/linked-cm/cli/pull/23) [`a00168d`](https://github.com/linked-cm/cli/commit/a00168d0e55a3f7f8164df1ea90e8fe52aefd5d4) Thanks [@flyon](https://github.com/flyon)! - Starter template: CN-branded CSS theme + `@_linked/react` integration in the example components. +- [#23](https://github.com/linked-cm/cli/pull/23) [`a00168d`](https://github.com/linked-cm/cli/commit/a00168d0e55a3f7f8164df1ea90e8fe52aefd5d4) Thanks [@flyon](https://github.com/flyon)! - Starter template: a branded CSS theme + `@_linked/react` integration in the example components. - **Brand defaults.** The `app-with-backend` template now ships with the CN palette (`--color-primary-*` mapped to a teal-blue ramp, `--color-secondary-*` to mint green) as a default-branded baseline. Apps override `@theme { --color-primary-500: ... }` to swap brand. + **Brand defaults.** The `app-with-backend` template now ships with a default palette (`--color-primary-*` mapped to a teal-blue ramp, `--color-secondary-*` to mint green) as a default-branded baseline. Apps override `@theme { --color-primary-500: ... }` to swap brand. **Semantic-token shell.** `App.module.css`, `DefaultLayout.module.css`, `Header.module.css` rewritten using `@_linked/css` semantic tokens (`--bg-page`, `--bg-card`, `--color-primary-*`) instead of hardcoded hex. Module CSS files using `--spacing(N)` import `@_linked/css/package.css` per the documented pattern. @@ -1974,7 +1972,7 @@ update`, which refuses a keyed branch the target does not contain yet. `MergeRes The exports entry `"./preflight.css": "./preflight.css"` is also removed from `package.json`. -- [`2b40588`](https://github.com/linked-cm/cli/commit/2b405880cbb21992c5005cb048f910df79c32145) - Relax `typescript` dep from `^5.7.3` to `^5.4.0` so consumers that pin a lower 5.x version (e.g. CN at 5.4.5) don't end up with a nested `typescript@5.9.x` install in `packages/cli/node_modules/`. The nested 5.9.x was incompatible with `react-refresh-typescript@2.0.12`'s AST walk — crashed frontend builds with `TypeError: Cannot read properties of undefined (reading 'declarations')` inside `VariableStatement.declarationList.declarations` traversal. +- [`2b40588`](https://github.com/linked-cm/cli/commit/2b405880cbb21992c5005cb048f910df79c32145) - Relax `typescript` dep from `^5.7.3` to `^5.4.0` so consumers that pin a lower 5.x version (e.g. the host app at 5.4.5) don't end up with a nested `typescript@5.9.x` install in `packages/cli/node_modules/`. The nested 5.9.x was incompatible with `react-refresh-typescript@2.0.12`'s AST walk — crashed frontend builds with `TypeError: Cannot read properties of undefined (reading 'declarations')` inside `VariableStatement.declarationList.declarations` traversal. ## 1.3.3 diff --git a/README.md b/README.md index d584ab5a..bcd2f348 100644 --- a/README.md +++ b/README.md @@ -40,13 +40,15 @@ live in its packages. A linked package is one of two kinds: - an **ontology package**, `-ont` — exactly one ontology (`src/ontologies/.ts`), no shapes, components or backend. Its ontology slug is `` (without `-ont`), so its terms mint `https://linked.cm/ont//{Term}`, or `{Term}` when a namespace is given. - Its data is Turtle, `src/data/.ttl` (starting as ` a owl:Ontology .`), which + Its data is Turtle, `src/data/.ttl` (starting as ` a owl:Ontology` with its + suggested prefix, ``, and its namespace as `vann:preferredNamespacePrefix` and + `vann:preferredNamespaceUri`), which `loadData` reads on the server through `@_linked/core/ontology/loadOntologyFiles`. The package - declares it in `package.json` `"linkedOntologies"`, and its accessor modules - (`src/ontologies/.ts`, `.data.ts`, `.register.ts`) are the ones `linked - generate-ontology` writes (see [Ontology accessor modules](#ontology-accessor-modules)): add terms - to the Turtle and run it. `create-ontology` scaffolds the same files and entry in an existing - package. + declares it in `package.json` `"linkedOntologies"`, and its modules (`src/ontologies/.ts`, + its terms, and `src/ontologies/index.ts`, which registers it; `src/index.ts` imports the index) + are the ones `linked generate-ontology` writes (see [Ontology modules](#ontology-modules)): add + terms to the Turtle and run it. `create-ontology` adds an ontology to an existing package the same + way. - an **asset package**, `-assets` — shapes, components and a backend, and no ontology. `create-package` asks which on a terminal; `--kind ontology|assets|both` answers it (`both` @@ -124,7 +126,7 @@ to the backend build and read their own `lib/esm/data/`. After compiling, `linked build` checks the package's shapes against the class hierarchy (**Checking shape hierarchy**). In one `node` process it loads the built package's `package.js`, -`shapes/index.js` and ontology data (`ontologies/*.register.js`), and the ontology data of every +`shapes/index.js` and ontology data (`ontologies/index.js`), and the ontology data of every linked dependency (dependencies and peerDependencies, transitively), then runs `@_linked/core/shapes/checkShapeHierarchy`. It reports a shape that extends another whose class its data does not make a superclass (`extends-without-subclass`), a subclass whose shape does not extend @@ -154,7 +156,7 @@ its export name, start shape, query shape and query wire format; other exports a `node` process loads the built `package.js`, `shapes/index.js` and `components/index.js` (asset imports such as `.css` and `.svg` stubbed) and calls `componentIndexTurtle(, )` from the `@_linked/react/utils/componentIndex` that the package resolves. The bytes are -deterministic: Create Now stores the file's triples and replaces them when its hash changes. No +deterministic: a host app that stores the file's triples and replaces them when its hash changes can rely on that. No `components/index`, no `@_linked/react` dependency or no linked component gives no file (one left by an earlier build is removed); a react without `utils/componentIndex` warns and writes none; a component whose query does not serialize is left out with a warning; a module that throws fails the @@ -165,16 +167,17 @@ reserved names in `src/data/`: the build writes over them. in a package without a package `linked.kind` (it used to exit 0 there). A build that finishes with warnings still exits 0. -### Ontology accessor modules +### Ontology modules ```bash -linked generate-ontology # write src/ontologies/.ts, .data.ts and .register.ts from src/data/*.ttl +linked generate-ontology # write src/ontologies/.ts and src/ontologies/index.ts from src/data/*.ttl linked generate-ontology --check # write nothing; exit 1 when a module is out of date ``` -A package declares its ontologies in `package.json`, one entry per prefix. `data` names files in -`src/data/` and defaults to `[".ttl"]`; a package with several namespaces has several -entries: +A package declares its ontologies in `package.json`, one entry per ontology, keyed by its **name +within the package** (lowercase letters and digits, single `-` or `_` between them). `data` names +files in `src/data/` and defaults to `[".ttl"]`; a package with several namespaces has +several entries: ```json "linkedOntologies": { @@ -184,19 +187,42 @@ entries: } ``` -Each prefix gets three committed modules in `src/ontologies/`: +The name is how the ontology is found: it names its module and is what it is registered under. It +is not a prefix. The **suggested prefix** is data: the ontology's `owl:Ontology` node carries it, +with its namespace, in one of its data files: -- `.ts`: one `export const Term = /*#__PURE__*/ ns('Term')` per subject of its data files - in its namespace (enumeration members and individuals included), sorted by name, each with a - one-line JSDoc from `rdfs:comment` (else `rdfs:label`). Nothing else, so consumers write +```turtle +@prefix owl: . +@prefix vann: . + + a owl:Ontology ; + vann:preferredNamespacePrefix "schema" ; + vann:preferredNamespaceUri "http://schema.org/" . +``` + +A published vocabulary shipped unedited gets these triples in a file of its own, +`src/data/-added.ttl`, listed in its `data`. `vann:preferredNamespaceUri` (a literal or an +IRI) must be the entry's `namespace`. A package registers no prefix: an app's prefixes are its own +(see [`linked.app.json`](#linkedappjson)). + +The committed modules in `src/ontologies/`: + +- `.ts` per generated ontology (the module is its name by default, below): one + `export const Term = {id: 'Term'}` per subject of its data files in its namespace + (enumeration members and individuals included), sorted by name, each with a one-line JSDoc from + `rdfs:comment` (else `rdfs:label`). It imports nothing and holds nothing else, so consumers write `import * as schema from '@_linked/schema/ontologies/schema'` and `schema.Person`, and a bundler keeps only the terms used. A subject whose remainder after the namespace holds `/`, `#` or `?` - is not a term, and the command lists it. -- `.data.ts`: `ns`, `dataFiles`, `loadData`, `_ontologyResource` and `Prefix.add`. - `_ontologyResource` is the ontology's own IRI as its data declares it with `a owl:Ontology`: the - namespace, else the namespace without its trailing `#` or `/` (`http://www.w3.org/2002/07/owl`), - else the only declaration the namespace starts with; otherwise the namespace. -- `.register.ts`: the `linkedOntology(...)` call; `src/index.ts` imports it. + is not a term, and the command lists it. Code that needs a namespace function uses core's + `createNameSpace(namespace)`. +- `index.ts`, one per package: imports every ontology module of the package and registers them all + with one call, `registerOntologies([{name, namespace, terms, data, suggestedPrefix}, …], + import.meta.url)` (`registerOntologies` from the package's `src/package.ts`; `data` lists the + data files relative to the index, `['../data/schema.ttl']`). The package's entry (`src/index.ts` or + `src/index.tsx`) imports it; `linked generate-ontology` adds that import, and turns any + `import './ontologies/.register.js';` left from an earlier generator into an import of + the index. It removes the `.data.ts` and `.register.ts` files the generator wrote + before (only files that start with its header). A term's export name is its local name made a valid identifier by one rule: a character that cannot appear in an identifier becomes `_` (`ISO639-2` → `ISO639_2`), a leading digit gets a leading @@ -205,11 +231,98 @@ no alias map. Two terms that the rule gives one name are refused, naming both. T deterministic: the same Turtle gives the same bytes. `linked build` starts with **Checking ontology modules**: when a module differs from what the data -generates, or is missing, the build fails and says to run `linked generate-ontology`. A package -without `linkedOntologies` is not checked. +generates or is missing, the entry does not import the index, or a file the generator no longer +writes is left, the build fails and says to run `linked generate-ontology`. It also fails +when an ontology's data has no `owl:Ontology` node for its namespace, no single +`vann:preferredNamespacePrefix` or `vann:preferredNamespaceUri` on it, or a vann namespace other +than the configured one; the message names the package, the ontology and its files, and shows the +triples to add. `linked generate-ontology` refuses the same. A package without `linkedOntologies` +is not checked. + +An entry has two more optional keys. `"module"` is the modules' file name in `src/ontologies/` +without extension (same pattern as a name; defaults to the name), so the ontology's terms import +as `/ontologies/`. `"generated": false` (the default is `true`) is for an ontology +whose module holds more than the generator writes (grouping objects, extra exports) and stays +written by hand: + +```json +"linkedOntologies": { + "core": {"namespace": "https://example.org/core/", "module": "linked-core", "generated": false} +} +``` + +Such an entry still declares the ontology: its name, namespace, module and data. `linked +generate-ontology` writes no module for it and the staleness check does not compare it, but the +index imports and registers it like a generated one, and its data must carry the same vann triples +(the build refuses it without them). Its module does not register itself. Two entries with one +`module`, or the module `index`, are refused. + +Inside an app (the package is the app, or a package in the app's folder within the same git +repository), `linked generate-ontology` then runs `linked prefixes` for that app. The generator itself is `@_linked/cli/utils/ontologyModules` (pure, browser-safe: it takes the -terms as data) and `@_linked/cli/utils/ontologyTerms` (reads them from Turtle with `n3`). +terms as data; `generateOntologyModules(specs, handWritten)` gives every module of a package) and `@_linked/cli/utils/ontologyTerms` (reads them from Turtle with `n3`). +`@_linked/cli/utils/ontologyConfig`'s `readOntologyConfigs(pkgJson)` (pure) reads a package's +declarations: `{name, namespace, module, generated, data}` per ontology, sorted by name. + +### `linked.app.json` + +```bash +linked prefixes # add a prefix for every installed ontology the app's map lacks +``` + +An app's declarative settings, JSON, at the app root (apps only; a package never has one): + +```json +{ + "$schema": "https://linked.cm/schema/app/1.json", + "schemaVersion": 1, + "prefixes": {"schema": "http://schema.org/", "rdfs": "http://www.w3.org/2000/01/rdf-schema#"}, + "cssMode": "tailwind", + "syncShapesOnBoot": true, + "datasetCloneScript": "clone-dataset", + "publish": {"staticAssets": ["fonts/**"], "releasePrefix": "releases"}, + "server": {"rpcExposure": "enforce", "rawQueries": "off", "apiOnly": false, "cachePaths": ["/"], "cacheTimeout": 300000} +} +``` + +Every key but `schemaVersion` is optional: + +| Key | Meaning | Default | +|---|---|---| +| `prefixes` | the app's prefix map (below) | `{}` | +| `cssMode` | CSS for server-side rendering in development: `tailwind` (Tailwind CSS v4) or `postcss` | `postcss` | +| `syncShapesOnBoot` | write the app's registered shapes into its store as SHACL on boot; `false` for a server whose default dataset routes data per context | `true` | +| `datasetCloneScript` | the npm script `linked worktree add --dataset` prints for copying the app's data into a dataset | `clone-dataset` | +| `publish.staticAssets`, `publish.releasePrefix` | see [App release](#app-release--production-runtime) | `[]`, `releases` | +| `server.rpcExposure` | `enforce`: only provider methods declared callable are reachable over `/call` (others answer 501); `warn` runs them with a warning. **`LINKED_RPC_EXPOSURE`, when set, wins** (a break-glass switch for diagnosing a refused call) | `warn` | +| `server.rawQueries` | raw SPARQL on `/api/select-raw`: `off`, or `session` (signed in) | `session` (or `LINKED_RAW_QUERIES`) | +| `server.apiOnly` | serve only the backend API (see [API-only backend](#api-only-backend)) | `false` | +| `server.cachePaths`, `server.cacheTimeout` | pages whose server-side rendering is cached in memory, and for how many milliseconds | none, `300000` | + +**`linked.config.js` is no longer read.** An app that still has one (or `lincd.config.js`) is +refused when its server starts or it is built, with the JSON to move its settings into. A +value it computed from the environment becomes the environment variable; `webpack` and +`server.multiCore` are gone; `server.loadAppComponent` and `server.loadRoutes` were never settings +(the server loads `src/App` and `src/routes`). + +The schema ships with this package, `schema/app/1.json`. A tool refuses a `schemaVersion` it does +not know and a key the schema does not have. A prefix is a Turtle and SPARQL prefix name that is +also a JavaScript identifier, `^[A-Za-z][A-Za-z0-9_]*$`; it maps to a namespace IRI. + +`prefixes` is the app's prefix map: one per app, used by its server, its browser bundle and its +store queries. **Tools only add to it.** `linked prefixes` reads every ontology the app has +installed (the `linkedOntologies` of the app and of every linked package it depends on, +recursively, with the suggested prefix from each one's data) and, for each namespace the map does +not have, adds the suggested prefix, or `_2`, `_3`, … when it is taken (a suggested +prefix with other characters, `server-utils`, becomes `server_utils`). It never changes or removes +an entry: renaming or removing one is the app owner's. Without a `linked.app.json` it creates one. +`linked create-app` writes one and fills it after the install. + +The map is loaded into core (`Prefix.load`) at server start (`linked start`, through the SSR +runner, and a compiled server) and in the browser: the Vite config's `linked:app-prefixes` plugin +makes the client entry import `virtual:linked-app-prefixes` first, which loads it. An app writes +no code for it. Without a `linked.app.json` nothing is loaded. ### App release / production runtime @@ -275,7 +388,7 @@ the file. **Every release gets its own prefix.** Object keys are `releases/-/`, so publishing a new release cannot overwrite the previous one and a rollback means pointing at an older prefix. Set `publish.releasePrefix` in -`linked.config.js` to change the `releases` base. A manifest may only upload to its own prefix: every +`linked.app.json` to change the `releases` base. A manifest may only upload to its own prefix: every `objectKey` is recomputed from the prefix and the source path before anything is written, so an edited or foreign manifest cannot reach into another release. @@ -333,7 +446,7 @@ declared `publish.staticAssets` and the release manifest — gets `og-image-1200x630.png` and `sw-v20260101.js` read as hashed, and a year of immutable caching on those cannot be undone without renaming the file.) -**Extra static assets.** `publish.staticAssets` in `linked.config.js` lists globs of files under +**Extra static assets.** `publish.staticAssets` in `linked.app.json` lists globs of files under `public/` to ship besides the bundle. Both the pattern and every match must resolve inside `public/`, so brace expansion and symlinks cannot pull in files from elsewhere in the repo. @@ -490,6 +603,7 @@ farm in which the worktree's own checkouts win), and land locally with linked branch start overhaul --target main core # app + packages-local/_linked-core on `overhaul` linked branch status # per repo: branch, target, dirty, ahead/behind, off-branch linked worktree add agent1 --with core --port 4041 # ../wt/agent1 with its own core worktree; Vite, tsc and Node load it +linked worktree add agent2 --dataset wt-agent2 # its own dataset: prints `npm run clone-dataset -- wt-agent2` (or the script linked.app.json names with datasetCloneScript), else warns it starts empty linked worktree relink # in a worktree: rebuild its node_modules link farm (after npm install in the main checkout) linked worktree list # agent worktrees and whether each branch has landed linked worktree remove agent1 # refuses while a branch has not landed (--force, --delete-unlanded) @@ -507,7 +621,7 @@ linked release plan # per repo: commits, reports, linked doctor resolve # where Vite and Node load each @_linked package; exit 1 on two copies ``` -**Branch checkouts** (a server making one checkout per project branch, such as Create Now): +**Branch checkouts** (a server making one checkout per project branch, such as a hosting app): `linked checkout ` in a projects root makes one bare base clone per repo (`/.repos//.git`), the app as a worktree on `` (created from `--from` and pushed when the remote lacks it) and each package of `linked.unpublishedPackages` as a @@ -554,7 +668,7 @@ sync, Vite's dependency exclusion and `build-all`'s dependency order find it. An (`@_linked/server/utils/linkedDependencies` has a byte-identical twin). A package can also declare its ontologies under `"linkedOntologies"` (see -[Ontology accessor modules](#ontology-accessor-modules)). +[Ontology modules](#ontology-modules)). The `lincd`, `lincdApp`, `linkedPackage` and `linkedApp` flags are not read. @@ -576,16 +690,13 @@ that reach outside the package source root, and for imports into another linked ## API-only backend -`linked start --api-only`, or `server.apiOnly: true` in `linked.config.js`, serves only the backend API +`linked start --api-only`, or `"server": {"apiOnly": true}` in `linked.app.json`, serves only the backend API (`/call/...`, `/api/...` and provider routes). There is no server-side page rendering, page requests get a 404, and no `vite.config.*` is required. Use it for a backend whose frontend lives elsewhere, such as a React Native app: -```js -// linked.config.js -export default { - server: {apiOnly: true}, -}; +```json +{"schemaVersion": 1, "server": {"apiOnly": true}} ``` API-only mode is never inferred: a web app without a `vite.config.*` and without the flag still fails at startup. @@ -618,7 +729,7 @@ Templates live in `defaults/`: - `defaults/app-with-backend/` — used by `linked create-app` - `defaults/app-static/` — minimal static app - `defaults/package/` — the asset package of `linked create-package` / `create-asset-package`; its manifest, tsconfigs, dotfiles and `src/package.ts` are shared by every kind -- `defaults/package-ontology/` — what an ontology package (`create-ont-package`) gets on top of the shared files: the example ontology, its register sibling and its data +- `defaults/package-ontology/` — what an ontology package (`create-ont-package`) gets on top of the shared files: the entry importing `./ontologies/index.js` and the example ontology's data (its modules are generated) - `defaults/setup-publish/` — caller workflows + changeset files written by `linked setup-publish` (`main`-only; `--dual-branch` is a deprecated no-op) ### `linked create-app` template structure diff --git a/defaults/app-react-native/services/api/linked.app.json b/defaults/app-react-native/services/api/linked.app.json new file mode 100644 index 00000000..0f12ffd0 --- /dev/null +++ b/defaults/app-react-native/services/api/linked.app.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://linked.cm/schema/app/1.json", + "schemaVersion": 1, + "prefixes": {} +} diff --git a/defaults/package-ontology/src/data/example-ontology.ttl b/defaults/package-ontology/src/data/example-ontology.ttl index 8d7a6b69..f13a695b 100644 --- a/defaults/package-ontology/src/data/example-ontology.ttl +++ b/defaults/package-ontology/src/data/example-ontology.ttl @@ -2,6 +2,9 @@ @prefix owl: . @prefix rdf: . @prefix rdfs: . +@prefix vann: . @prefix ${hyphen_name}: <${uri_base}> . -<${uri_base}> a owl:Ontology . +<${uri_base}> a owl:Ontology ; + vann:preferredNamespacePrefix "${hyphen_name}" ; + vann:preferredNamespaceUri "${uri_base}" . diff --git a/defaults/package-ontology/src/index.ts b/defaults/package-ontology/src/index.ts index 38ac61eb..3ba5f54b 100644 --- a/defaults/package-ontology/src/index.ts +++ b/defaults/package-ontology/src/index.ts @@ -1,8 +1,6 @@ -// Registers the ontology. This MUST be the `.register.js` sibling, not the terms module -// itself: importing the terms module alone never calls `linkedOntology()`, so the ontology -// is silently never registered. See the comment in the register file for why registration -// cannot live in the terms module. -import './ontologies/${hyphen_name}.register.js'; +// Registers the package's ontologies: `src/ontologies/index.ts` is generated by +// `linked generate-ontology` from package.json "linkedOntologies" and the data in src/data/. +import './ontologies/index.js'; // An ontology package holds exactly one ontology and nothing else: no shapes, no // components, no backend. Those belong in an asset package (`linked create-asset-package`). diff --git a/defaults/package/package.json b/defaults/package/package.json index b9517226..e8646f13 100644 --- a/defaults/package/package.json +++ b/defaults/package/package.json @@ -56,11 +56,11 @@ } }, "dependencies": { - "@_linked/core": "^2.41.0" + "@_linked/core": "^3.0.0" }, "devDependencies": { "@types/node": "^22.13.14", - "@_linked/cli": "^1.57.0", + "@_linked/cli": "^2.0.0", "typescript": "^5.7.3" } } diff --git a/defaults/package/src/package.ts b/defaults/package/src/package.ts index 4cb7d7f1..429c5359 100644 --- a/defaults/package/src/package.ts +++ b/defaults/package/src/package.ts @@ -7,7 +7,7 @@ import {linkedPackage} from '@_linked/core/utils/Package'; export const { linkedShape, linkedUtil, - linkedOntology, + registerOntologies, registerPackageExport, packageExports, packageName, diff --git a/docs/architecture/vite-runtime-config.md b/docs/architecture/vite-runtime-config.md index c84c7bf4..60261729 100644 --- a/docs/architecture/vite-runtime-config.md +++ b/docs/architecture/vite-runtime-config.md @@ -95,7 +95,7 @@ Under `linked start`, Node itself (not the SSR runner) loads: - `@_linked/cli` from its `lib/esm` (the bin, and every import of it from Vite-loaded code); - the app's `vite.config.*` and every `@_linked/*` package it imports, at Vite start-up; -- `linked.config.js` and env loading, which hold no `@_linked` state; +- the reading of `linked.app.json` and the env loading, which hold no `@_linked` state; - in standalone mode, `@_linked/core` and the packages left external; - packages a provider imports natively from a registry install (`LinkedServer.indexPackageBackendProviders` uses `ssrLoadModule` for a bundled package). diff --git a/docs/backlog/006-css-module-ambients-in-packages-that-import-no-css.md b/docs/backlog/006-css-module-ambients-in-packages-that-import-no-css.md index bce9e122..c322ba88 100644 --- a/docs/backlog/006-css-module-ambients-in-packages-that-import-no-css.md +++ b/docs/backlog/006-css-module-ambients-in-packages-that-import-no-css.md @@ -35,7 +35,7 @@ now, so this is a change to the published type surface and belongs in a coordina in a drive-by sweep. Nobody has measured whether anything actually imports `/types`. That measurement — a search -across the fleet and CN for `from '@_linked/*/types'` — is the first step, and may turn this into +across the fleet and the apps built on it for `from '@_linked/*/types'` — is the first step, and may turn this into a trivially safe removal. ## Scoping note diff --git a/docs/backlog/009-build-check-skips-unbuilt-linked-dependencies.md b/docs/backlog/009-build-check-skips-unbuilt-linked-dependencies.md index db752633..089887b7 100644 --- a/docs/backlog/009-build-check-skips-unbuilt-linked-dependencies.md +++ b/docs/backlog/009-build-check-skips-unbuilt-linked-dependencies.md @@ -10,7 +10,7 @@ status: Open -- the partly stale lib case; the main case is fixed (report 035) # 009 — The build check skips a dependency's register modules its `lib/` lacks -Source: CN plan 070, independent review of `store-inference` (report 025). The unbuilt-dependency +Source: independent review of `store-inference` (report 025). The unbuilt-dependency case is fixed in report 035: `collectShapeCheckInputs` sets `tsLoader` when a dependency has register modules only in `src/`, and the check's child passes core an `importModule` through the cli's TS loader. diff --git a/docs/backlog/011-worktree-app-workspace-members-link-to-main.md b/docs/backlog/011-worktree-app-workspace-members-link-to-main.md index ab653c9c..b43e537f 100644 --- a/docs/backlog/011-worktree-app-workspace-members-link-to-main.md +++ b/docs/backlog/011-worktree-app-workspace-members-link-to-main.md @@ -1,6 +1,6 @@ --- -summary: In an agent worktree the link farm points the app's own workspace members (CN's `packages/*`) at the main checkout, so a change to one of their `package.json` files is invisible to the worktree's server, build-all and tests. Found when step RK changed `linked.kind` in CN's `packages/*`. -source: CN master plan 057, steps LK and RK (cli reports 032, 033), 27 Oct 2026 +summary: In an agent worktree the link farm points the app's own workspace members (e.g. `packages/*`) at the main checkout, so a change to one of their `package.json` files is invisible to the worktree's server, build-all and tests. Found when step RK changed `linked.kind` in the app's `packages/*`. +source: steps LK and RK (cli reports 032, 033), 27 Oct 2026 --- # Worktree: the app's own workspace members link to the main checkout @@ -10,7 +10,7 @@ source: CN master plan 057, steps LK and RK (cli reports 032, 033), 27 Oct 2026 `linked worktree add` links `node_modules/` of the app's own workspace members (`packages/access`, `packages/maps`, `my-app`, …) to the main checkout's entries, which resolve to the main checkout's `packages/`. Report 031 lists it under Limitations. When a worktree -changes one of those directories, the worktree's CN, `build-all` and `discoverLinkedDependencies` +changes one of those directories, the worktree's app server, `build-all` and `discoverLinkedDependencies` read the main checkout's copy instead. Seen in step RK: the worktree's `packages/{access,documents,maps,execution-gateway}` had diff --git a/docs/backlog/012-drop-the-retired-flag-fallback.md b/docs/backlog/012-drop-the-retired-flag-fallback.md index afe512df..68e7079b 100644 --- a/docs/backlog/012-drop-the-retired-flag-fallback.md +++ b/docs/backlog/012-drop-the-retired-flag-fallback.md @@ -8,7 +8,7 @@ packages: [cli, server] # Drop the retired-flag fallback -The release of CN plans 057/070 had to bridge two CLIs: +The release of the `linked.kind` flags and store inference had to bridge two CLIs: - The published CLI (1.57.x) builds a package only with `linkedPackage: true`, and CI and the publish workflow build every package with the published CLI. So this package's own diff --git a/docs/backlog/013-master-worktrees-remaining.md b/docs/backlog/013-master-worktrees-remaining.md index 7428c237..5c5c44a8 100644 --- a/docs/backlog/013-master-worktrees-remaining.md +++ b/docs/backlog/013-master-worktrees-remaining.md @@ -37,20 +37,20 @@ relinks every worktree after an install. What still blocks running them side by worktree's farm links `.bin/linked` to that same unbuilt CLI. The first build there runs the main checkout's bin (`
/node_modules/.bin/linked build`); `worktree add`/`branch start` could print that, or fall back to it. -- **`worktree remove ` does not find a master's step by its agent name** (step SY of CN - plan 282). Run from the app's main checkout: +- **`worktree remove ` does not find a master's step by its agent name** (step SY of a + master). Run from the app's main checkout: `npx linked worktree remove sy` → - ``No worktree of /Users/rene/web/create_now for sy: none on dev--sy, nor at /Users/rene/web/wt/sy. + ``No worktree of
for sy: none on dev--sy, nor at /Users/rene/web/wt/sy. Pass its directory with --dir; `linked worktree list` shows the worktrees.`` while `linked worktree list` showed `step sy /Users/rene/web/wt/hub-imports--sy`. It worked with `npx linked worktree remove sy --dir /Users/rene/web/wt/hub-imports--sy` (and then kept the landed `hub-imports--sy` branches: `@_linked/core: kept hub-imports--sy (not dev--sy).`). `remove` should look up `--` steps as `list` does. -- **A step with its own framework package loads two copies of it.** The link farm points CN's +- **A step with its own framework package loads two copies of it.** The link farm points the app's `@_linked/core` at the step's checkout, while the main install's other `@_linked/*` packages - (`@_linked/fuseki`, `@_linked/access`, …) resolve core from the main checkout. CN's + (`@_linked/fuseki`, `@_linked/access`, …) resolve core from the main checkout. The app's `npm run typecheck:gate` in step SY's worktree reported 117 errors, every one between - `…/hub-imports--sy/packages-local/_linked-core/…` and `…/create_now/packages-local/_linked-core/…` + `…/hub-imports--sy/packages-local/_linked-core/…` and `…/
/packages-local/_linked-core/…` types (e.g. `FusekiStore` not assignable to `IDataset`); with `paths` mapping `@_linked/core` to the step's build, `tsc` gave 0 errors. The farm could link every package that depends on a `--with` package so it resolves the step's copy, or `worktree add` could print the `paths` @@ -58,7 +58,7 @@ relinks every worktree after an install. What still blocks running them side by - **A master with core, server or react needs every localized dependent in it too.** Master `hub-imports` started `--with core,server,react,cli`; its farm linked those to its checkouts while the other localized packages (auth, fuseki, server-utils, schema, …) resolved core from the main - checkout: two cores, and CN's `npm run typecheck:gate` there reported ~117 errors. Fixed by hand + checkout: two cores, and the app's `npm run typecheck:gate` there reported ~117 errors. Fixed by hand with `branch add-package hub-imports` of the 19 localized packages that depend on them (transitively), `linked build-all` in the master (26 packages, 6 min), `worktree relink`: `doctor resolve` then showed every `@_linked/*` but css in the master, and the gate gave `No new type diff --git a/docs/backlog/014-checking-components-index.md b/docs/backlog/014-checking-components-index.md index 1c161b5e..d59913e8 100644 --- a/docs/backlog/014-checking-components-index.md +++ b/docs/backlog/014-checking-components-index.md @@ -10,7 +10,7 @@ status: open `linked build` indexes only the linked components exported from `src/components/index.ts` (`Writing components.ttl`, report 042). A component defined in a module that the index does not -export is silently absent from the component index, so Create Now's builder never offers it. +export is silently absent from the component index, so a host app's builder never offers it. **Idea.** A step `Checking components/index`, next to `Checking shapes/index` (`src/utils/shapesIndex.ts` is the precedent): load each compiled module under diff --git a/docs/backlog/016-branch-key-follow-ups.md b/docs/backlog/016-branch-key-follow-ups.md index f4443111..56560b47 100644 --- a/docs/backlog/016-branch-key-follow-ups.md +++ b/docs/backlog/016-branch-key-follow-ups.md @@ -17,8 +17,8 @@ status: open refusal. 2. **Formatting.** The strip parses `package.json`, deletes the keys and writes it with the file's indent and trailing newline (and CRLF when the file has it). An object the file kept on one line - (`{"repo": "…"}`) comes back expanded. npm and Create Now write `JSON.stringify(…, null, 2)`, so + (`{"repo": "…"}`) comes back expanded. npm and the usual tools write `JSON.stringify(…, null, 2)`, so in practice nothing moves; a text-level edit would keep any layout. -3. **Setting a key.** Nothing in the cli writes a `branch` key; Create Now edits `package.json` +3. **Setting a key.** Nothing in the cli writes a `branch` key; a host app edits `package.json` itself. A `linked use --branch ` (and `--clear`) would give developers the same, if wanted. diff --git a/docs/backlog/017-worktree-link-farm-loads-two-core-copies.md b/docs/backlog/017-worktree-link-farm-loads-two-core-copies.md index e0bddc06..575156ea 100644 --- a/docs/backlog/017-worktree-link-farm-loads-two-core-copies.md +++ b/docs/backlog/017-worktree-link-farm-loads-two-core-copies.md @@ -1,11 +1,11 @@ --- summary: > - A CN worktree made with `linked worktree add ct --with @_linked/core` loads core from the + An app worktree made with `linked worktree add ct --with @_linked/core` loads core from the worktree's checkout, while installed `@_linked/*` packages still resolve the main checkout's - core. CN runs two copies, and `typecheck:gate` reports 118 errors between the two `IDataset` + core. The app runs two copies, and `typecheck:gate` reports 118 errors between the two `IDataset` types, although both `lib` .d.ts trees are identical. May overlap backlog 013 ("Refusing a second copy"). -source: CN master side-225 (step ct), 30 Oct 2026 +source: an app master (step ct), 30 Oct 2026 status: open --- @@ -13,19 +13,19 @@ status: open ## Observed -A CN worktree `wt/ct`, made with `npx linked worktree add ct --with @_linked/core`, during -`npm run test:regular` (log: `ct-regular.log` in the side-225 master's scratchpad): +An app worktree `wt/ct`, made with `npx linked worktree add ct --with @_linked/core`, during +`npm run test:regular` (log: `ct-regular.log` in the master's scratchpad): ``` -[CN-err] [localize] drift: second copy of localized @_linked/core@2.45.0 at node_modules/@_linked/core -[CN-err] [linked] @_linked/core is installed 2 times (2.45.0 at /Users/rene/web/create_now/packages-local/_linked-core, 2.45.0 at /Users/rene/web/wt/ct/packages-local/_linked-core); loaded /Users/rene/web/wt/ct/packages-local/_linked-core. +[app-err] [localize] drift: second copy of localized @_linked/core@2.45.0 at node_modules/@_linked/core +[app-err] [linked] @_linked/core is installed 2 times (2.45.0 at
/packages-local/_linked-core, 2.45.0 at /Users/rene/web/wt/ct/packages-local/_linked-core); loaded /Users/rene/web/wt/ct/packages-local/_linked-core. ``` `typecheck:gate` then failed: ``` NEW type error(s) not in the baseline: 118 - src/backend/people/displayNames.ts: TS2345: Argument of type 'import("/Users/rene/web/wt/ct/packages-local/_linked-core/lib/esm/interfaces/IDataset").IDataset' is not assignable to parameter of type 'import("/Users/rene/web/create_now/packages-local/_linked-core/lib/esm/interfaces/IDataset").… + src/backend/people/displayNames.ts: TS2345: Argument of type 'import("/Users/rene/web/wt/ct/packages-local/_linked-core/lib/esm/interfaces/IDataset").IDataset' is not assignable to parameter of type 'import("
/packages-local/_linked-core/lib/esm/interfaces/IDataset").… src/backend/shapes/BranchProvider.ts: TS2416: Property 'shape' in type 'BranchProvider' is not assignable to the same property in base type 'ShapeProvider'. src/backend/shapes/OntologyTermSearchProvider.ts: TS2322: Type 'FusekiStore' is not assignable to type 'IDataset'. ``` @@ -38,7 +38,7 @@ paths), not from a change in core. The farm links `@_linked/core` to the worktree's checkout, but the other installed `@_linked/*` packages (`server-utils`, `server`, …) are links to their real paths in the main checkout's `node_modules`. Node and `tsc` resolve their own `import '@_linked/core'` from that real path, so -they climb to `create_now/node_modules/@_linked/core`, the main checkout's core. Every package +they climb to `
/node_modules/@_linked/core`, the main checkout's core. Every package that depends on a `--with` package, and is not itself in the worktree, keeps the main copy. ## First questions @@ -52,7 +52,7 @@ that depends on a `--with` package, and is not itself in the worktree, keeps the ## Seen again: master `one-read-method` (core plan 111), 1 Nov 2026 -Evidence in CN report 397 ("Two copies of core: the evidence"). Here the second copy was not a +Here the second copy was not a stale duplicate but an older core: the master changed `IDataset`, and the main checkout's core still had the old read methods, so the failures looked like real bugs. @@ -61,7 +61,7 @@ had the old read methods, so the failures looked like real bugs. `packages-local/`: `@_linked/css`, `dcat`, `dcmi`, `icons`, `npm`, `org`, `owl`, `primitives`, `rdfs`, `s3`, `schema`, `sentry`, `sioc`, `translation`, `xsd`, `@linked.cm/zoho-cpaas` and `@semantu/webid-email`. Their own `import '@_linked/core'` climbs from their real path to - `/Users/rene/web/create_now/packages-local/_linked-core`. + `
/packages-local/_linked-core`. - tsc: `NEW type error(s) not in the baseline: 63`, all of them `IDataset`/`Transaction`/ `FusekiStore` identity errors between the two copies. `tsc --explainFiles` named the importers of the main copy: `_linked-schema` (3038 imports), `_linked-translation` (200), `_linked-dcmi` (113), diff --git a/docs/backlog/018-app-prefix-map-follow-ups.md b/docs/backlog/018-app-prefix-map-follow-ups.md new file mode 100644 index 00000000..e07ad1a1 --- /dev/null +++ b/docs/backlog/018-app-prefix-map-follow-ups.md @@ -0,0 +1,32 @@ +--- +summary: > + After the ontology index and `linked.app.json` (reports 052, 053): publish the schema at its + `$schema` URL, merge the app template's `linked.app.json` branch with the release, raise the + cli's `@_linked/core` range to the major with `Prefix.load` and then drop the warning for an + older core, and settle how a suggested prefix with a hyphen (`server-utils`) reads in an app's + map. +source: report 052, 10 Nov 2026 +status: open +--- + +# 018 — App prefix map follow-ups + +1. **Schema URL.** `linked.app.json` names `"$schema": "https://linked.cm/schema/app/1.json"`; + the file ships in this package (`schema/app/1.json`) but is not served at that URL yet. Serve + it there (the site that hosts `linked.cm`), so editors validate the file. +2. **App template repo.** `linked create-app` clones `linked-fw/app-template`'s `main`. Its + branch `linked-app-json` moves the template's settings into `linked.app.json` and deletes + `linked.config.js` (report 053). Merge it together with the release of this cli major: before + it, the published cli would not read the template's settings; after the release, a template + with `linked.config.js` is refused. Until then this repo's e2e (`create-app.spec.ts`, + `dual-copy.spec.ts`, `build-app.spec.ts`) fails against `main`; report 053 ran it against the + branch. A host app that writes a `linked.config.js` into the apps it creates must write + `linked.app.json` (`server.rawQueries`) instead before the merge, or its new apps are refused. +3. **Core range.** The cli depends on `@_linked/core` `^2.39.0`. Loading the map needs + `Prefix.load` (the next core major). When that major is the cli's range, remove the tolerance + in `loadAppPrefixes` / `appPrefixesModuleCode` (an older core is warned about and left as it + is) so a map is always loaded. +4. **Hyphenated suggested prefixes.** A map prefix is `^[A-Za-z][A-Za-z0-9_]*$`, so the builder + turns `server-utils` into `server_utils`. An app that wrote Turtle with `server-utils:` before + writes `server_utils:` once its map is loaded. Either the package's suggested prefix changes to + a map-legal one, or the app owner picks the prefix by hand; decide per package. diff --git a/docs/backlog/019-host-app-env-var-names.md b/docs/backlog/019-host-app-env-var-names.md new file mode 100644 index 00000000..f481bfe2 --- /dev/null +++ b/docs/backlog/019-host-app-env-var-names.md @@ -0,0 +1,60 @@ +--- +summary: > + The worktree and master commands hard-code two env var names of one host app + (`CN_PROJECTS_ROOT`, `CN_TEST_PORT`). Replace them with generic names: either the app declares + the names of its projects-root and test-port variables, or the cli uses `LINKED_*` names and the + app reads its old names as a fallback. +source: the scrub of host-app mentions, 10 Nov 2026 +status: open +--- + +# 019 — Generic names for the host app's env vars + +## Problem + +`linked worktree add` (preview command of a master) and `linked branch start --worktree` print or +set two env vars whose names belong to one particular host app, not to the framework: + +- `CN_PROJECTS_ROOT`: where the app keeps its clones of managed apps. A master's preview overrides + it to `/apps` when the app's `.env` sets it, so the preview's clones are its own. +- `CN_TEST_PORT`: the port the app's test runner uses. The master command prints it as the port + after the preview's. + +Every other app has no use for these names, and the names leak a private app into a public +package. Renaming them now would break that app's preview and test commands, so behaviour stays +as is until this item is done. + +## Options + +1. **The app declares the names.** `linked.app.json` (or the app's `package.json`) lists the env + var for its projects root and for its test port, e.g. + `{"worktree": {"projectsRootVar": "MY_PROJECTS_ROOT", "testPortVar": "MY_TEST_PORT"}}`. The cli + sets or prints only what the app declares; an app declaring nothing gets neither. +2. **Framework names.** The cli uses `LINKED_PROJECTS_ROOT` and `LINKED_TEST_PORT`; the host app + reads them, falling back to its old names for a while. Simpler, but presumes every app has a + projects root and a test runner reading a port. + +Option 1 keeps the cli free of any app's conventions; option 2 is less configuration. + +## Where the names occur + +Code (behaviour): + +- `src/commands/worktree.ts:391` (doc comment), `:399` (reads it from `.env`), `:400` (sets it) +- `src/commands/master.ts:235` (prints `CN_TEST_PORT=`) +- `src/cli.ts:767` (help text of `branch start`) +- `tests/unit/integration/master.test.ts:82` (fixture `.env`), `:173` (asserted preview command) + +Docs quoting them: + +- `CHANGELOG.md:39` +- `docs/integration-branches-and-worktrees.md:414`, `:419` +- `docs/plans/003-master-worktrees.md:37`, `:105` +- `docs/reports/040-master-worktrees.md:6`, `:66`, `:117` +- `docs/reports/041-master-worktrees-part-one.md:128`, `:130` + +## Done when + +No `CN_` name is left in `src/`, `tests/` or the current docs (`docs/integration-branches-and-worktrees.md`); +the host app's preview and test commands still work; historical reports and the CHANGELOG may +keep the old names as history. diff --git a/docs/integration-branches-and-worktrees.md b/docs/integration-branches-and-worktrees.md index 353bd7a4..57488779 100644 --- a/docs/integration-branches-and-worktrees.md +++ b/docs/integration-branches-and-worktrees.md @@ -264,8 +264,8 @@ when it has none (then agents land straight into that branch). |---|---| | `--with ` | comma-separated `packages-local/` checkouts the agent changes (`@_linked/core`, `core` or `_linked-core`) | | `--app-detached` | check the app out detached at the base tip, for work that changes only packages; needs `--with` | -| `--port ` | the port in the printed start command (default ``; the main checkout uses 4040) | -| `--dataset ` | adds `FUSEKI_DATASET=` to the printed start command, and the clone commands when the app has them | +| `--port ` | the port in the printed start command (default ``; the hint names the main checkout's port: its `.env` `PORT`, else 4040) | +| `--dataset ` | adds `FUSEKI_DATASET=` to the printed start command, and how to clone the app's data into it (see Cloning a dataset) | | `--dir ` | where to put it; default `/wt/`; refused anywhere inside the app root | | `--from ` | a step of master `` (see Masters); implied when run in the master's worktree | @@ -396,7 +396,7 @@ and `branch..linked-worktree` (that repo's worktree), and in the app repo of a repo, so the records are read from anywhere in the app. The preview port is the first of 4510, 4520, … 4590 no master on this machine holds (outside a -CN's live-app band 4000-4399, inside the 4000-4999 a local webid.email signs clients in from; +host app's live-app band 4000-4399, inside the 4000-4999 a local webid.email signs clients in from; `port + 1` is for the master's test runs, `port + 2` to `port + 9` for its steps), or `--port`. "On this machine" means this app's masters (its git config) and the **port registry** `~/.linked/master-ports.json` (`$LINKED_HOME` overrides `~/.linked`), which maps each port to @@ -417,10 +417,32 @@ cd ../wt/m1 && PORT=4510 SITE_ROOT=http://localhost:4510 CN_PROJECTS_ROOT=../wt/ `SITE_ROOT` is set when the linked `.env` sets it (the server writes absolute asset URLs from it, so without it a second server serves the first one's bundles; every `worktree add` start command sets it too), `CN_PROJECTS_ROOT` when the `.env` sets it (so the preview's app clones are its -own), `FUSEKI_DATASET` with `--dataset`. Refuses, making nothing, when `` exists in a repo, +own), `FUSEKI_DATASET` with `--dataset` (plus the clone hint, see Cloning a dataset). Refuses, making nothing, when `` exists in a repo, contains `--`, equals a target, the directory exists, the port is another master's, or it runs outside the main checkout. Without `--worktree`, `branch start` is unchanged. +### Cloning a dataset + +A worktree or master started with `--dataset ` runs on a dataset of its own, which starts +empty. The cli does not know the app's store, so the app supplies the copy as an npm script in its +root `package.json` that takes the target dataset as its one argument: `clone-dataset` by +default, or the script `datasetCloneScript` names in the app's `linked.app.json`: + +```json +{"schemaVersion": 1, "datasetCloneScript": "data:clone"} +``` + +`worktree add --dataset` and `branch start --worktree --dataset` then print the command to run +before starting it: + +``` +Clone the data into wt-a1 first (from /path/to/app): npm run clone-dataset -- wt-a1 +``` + +Without the script (or when `datasetCloneScript` names one `package.json` lacks) they print a +warning instead: the dataset starts empty unless it is cloned by hand, and how to add the script. +The script should refuse to overwrite the app's own datasets. + ### Steps: `linked worktree add --from ` A step of master `` (`--from` is implied when run in the master's worktree): the app worktree @@ -504,7 +526,7 @@ target}], relinked: [], messages}`. ## `linked checkout ` A branch checkout of an app and the packages it lists in `linked.unpublishedPackages`, made for a -server that keeps one checkout per project branch (Create Now) — not for a developer's app (one +server that keeps one checkout per project branch (a hosting app) — not for a developer's app (one clone with [`linked localize --listed`](localize.md#commands)) nor an agent's worktree (`linked worktree add`, which shares the main checkout's install). @@ -565,8 +587,8 @@ Re-runs in either pins mode: a detached pinned worktree fast-forwards to `origin a clean worktree whose head origin has moves to its new target when the pins change (`switched`: to another pin, or back to `origin/`); one with uncommitted changes or commits origin lacks is `kept`. In pins mode `--add` reads a package's -name on its default branch. Without a pin (flag or key) and `--pins-only` nothing of this applies. Create Now -passes `--pins-only` and no `--pin`: the app branch's keys are its pins. +name on its default branch. Without a pin (flag or key) and `--pins-only` nothing of this applies. A hosting app +may pass `--pins-only` and no `--pin`: the app branch's keys are its pins. **The list, transitively.** From the app worktree's committed `package.json`, breadth first: each listed package's worktree is made, then its own `package.json` (on its branch, or its @@ -593,7 +615,7 @@ pushed. its npm name is what its `package.json` declares on `` (else on its default branch), its worktree is `packages-local/` by the same branch rule, under its base clone's lock, and the result marks it `"added": true`. It never makes the install run and is never built, so adding it -leaves the app's `package.json` and lock as committed (Create Now edits a workspace ontology the app +leaves the app's `package.json` and lock as committed (a hosting app can edit a workspace ontology the app does not use this way). It is still in the `packages-local/*` glob: an install a later run makes for a listed package links it like every checkout there, and the app's lock-at-rest hook puts the committed lockfile back. Its npm name must be one (a name that would leave `packages-local/` is @@ -718,7 +740,7 @@ Exits 1 when any row is `two-copies`, 0 otherwise. `--json` prints the rows package gets the main checkout's copy in Node and `tsc` (Vite gives it the worktree's). - **Dependency changes** need a worktree with its own install (see Shared install). - **Data is shared.** Worktrees use the same data store unless started with a dataset of their - own (`--dataset`). + own (`--dataset`, filled by the app's clone script: see Cloning a dataset). - **`linked checkout` does not lock.** Concurrent runs on one base clone are the caller's to serialise. - **`linked worktree remove --branch` reads a squash merge as not landed**; use `--force`. diff --git a/docs/plans/001-store-inference.md b/docs/plans/001-store-inference.md index 61bd5b97..68a41289 100644 --- a/docs/plans/001-store-inference.md +++ b/docs/plans/001-store-inference.md @@ -1,6 +1,6 @@ --- summary: > - Sub-plan of CN plan 070 (the store infers; ontology data in every app dataset) for + Sub-plan of the host app's plan (the store infers; ontology data in every app dataset) for `linked-fw/cli`: L1, the package build ships Turtle (`src/**/*.ttl` copied to `lib/esm/`, the app backend build copies the app's own `src/**/*.ttl` next to its compiled modules, the ontology scaffold in Turtle, the CLI e2e on the inferring Fuseki image); L2 (post-build shape check) is @@ -10,20 +10,20 @@ status: Plan # 001 — Store inference: Turtle in the build -Sub-plan of CN's master plan -[070](https://github.com/Semantu/create-now/blob/store-inference/docs/plans/070-store-inference-and-ontology-data.md) -(local: `~/web/wt/070/docs/plans/070-store-inference-and-ontology-data.md`). The master plan's +Sub-plan of the host app's master plan (store inference and ontology data, in the app's +repository). The master plan's §Decisions, §How to use, §Rules and §Contracts govern; this file repeats the contracts this repository provides or consumes and adds the plan-mode detail (Files, Pitfalls, Tests) of the cli steps. Step agents start at tasks mode, seed their own plan doc from their section here, and do not redesign: when the code contradicts this file, stop and report. -Integration branch: `store-inference` (worktree `~/web/wt/070/packages-local/_linked-cli`). +Integration branch: `store-inference` (worktree `/packages-local/_linked-cli`, where `` is +the master's worktree of the app). Records: L1 → report 024, L2 → report 025. Every step adds a **minor** changeset (`npx changeset`) at landing. -**Shared files.** L1 runs in wave 1; L2 runs in wave 4. Plan 067's commands (G1) left this plan on -2026-10-21: another agent runs plan 067; the work started here is on the pushed branch +**Shared files.** L1 runs in wave 1; L2 runs in wave 4. Another of the app's plans took over the G1 +commands on 2026-10-21 and another agent runs it; the work started here is on the pushed branch `store-inference--G1` (tip 7e68bea, P0-P6 committed, not landed). | File | L1 | L2 | @@ -47,7 +47,7 @@ landing. - `ghcr.io/linked-fw/fuseki:-` (first: `6.2.0-1`), `FROM secoresearch/fuseki:6.2.0`; until the release, built locally from `linked-fw/fuseki`'s `server/Dockerfile` (compose - `build:` pointing at `~/web/wt/070/packages-local/_linked-fuseki/server`, tag + `build:` pointing at `/packages-local/_linked-fuseki/server`, tag `linked-fuseki:dev`). Same env as the base image (`ADMIN_PASSWORD`, `ENABLE_DATA_WRITE`, `ENABLE_UPDATE`, `ENABLE_SHACL`, `QUERY_TIMEOUT`), `FUSEKI_BASE=/fuseki-base`, uid 9008. - Dataset type `lf:DatasetRDFSLive` (`PREFIX lf: `), declared in an @@ -68,7 +68,7 @@ landing. - The module rewrites `$FUSEKI_BASE/templates/config-tdb2` at start when it is missing or different, with a warning (Fuseki copies its stock template only when the file is missing, so a persisted volume would otherwise create plain datasets silently). -- `templates/config-tdb2` (baked in) declares the service with the endpoints CN uses today +- `templates/config-tdb2` (baked in) declares the service with the endpoints the host app uses today (`""`/`sparql`/`query`, `""`/`update`, `""`/`data` GSP read-write, `upload`, `get`) over `lf:DatasetRDFSLive`, plus `stored` and `shacl` (store validation, decision 23). A form-created dataset (`POST $/datasets`, `dbName`, `dbType=tdb2`) gets it. **Only `dbType=tdb2` datasets infer**; `mem` (`config-mem`) @@ -82,7 +82,7 @@ landing. - `DELETE $/datasets/` removes the TDB2 files too (a module filter finishes what Fuseki skips for a wrapped dataset); a re-created name starts empty. - `arq:httpServiceAllowed=false` set by the module for every dataset. -- *pending F1:* whether `text:TextDataset` (pg-test) works over `lf:DatasetRDFSLive`. +- *pending F1:* whether `text:TextDataset` (another app's dataset) works over `lf:DatasetRDFSLive`. ### Ontology data files and loader (provider K1 + L1; consumers N1, N2, P1, C2, C3, T1, every package) @@ -125,7 +125,7 @@ Reads registered shapes, registered ontologies (parsed through the reader unless given) and `linkedPackage(..., {mirrors})`. `@linkedShape({sharedTargetClass: true})` exempts a shape from `borrowed-target-class`; shape sync stores it as `core:sharedTargetClass` so data-only shapes keep it. Boot and sync log findings; `npx linked build` fails on any -`error` (L2); CN's builder refuses or offers the fix (C3). +`error` (L2); the host app's builder refuses or offers the fix (C3). ### CLI build check (provider L2; consumers every package) @@ -144,9 +144,9 @@ the package's own directory and its `@_linked/*` dependencies' (transitive). ## Which CLI runs in the layout -Every `npx linked …` in plan 070's layout runs the **main checkout's** CLI: -`~/web/wt/070/node_modules` is a symlink to `~/web/create_now/node_modules`, whose `.bin/linked` -resolves to `~/web/create_now/packages-local/_linked-cli/lib/esm/launch.js` (on `main`). A +Every `npx linked …` in the master's layout runs the **main checkout's** CLI: +`/node_modules` is a symlink to `
/node_modules` (the app's checkout), whose `.bin/linked` +resolves to `
/packages-local/_linked-cli/lib/esm/launch.js` (on `main`). A step's own CLI changes run only through its worktree's built bin: ```sh @@ -157,7 +157,7 @@ LINKED="node $PWD/lib/esm/launch.js" # then: (cd && $LINKE So L1's Verify exercises fixtures with `$LINKED`, never `npx linked`; and until the release, packages that need L1's Turtle copy (N1, N2, P1, C2, T1) must be built with the integration CLI, -`node ~/web/wt/070/packages-local/_linked-cli/lib/esm/launch.js build` (reported to the master as +`node /packages-local/_linked-cli/lib/esm/launch.js build` (reported to the master as a contradiction with §How to use, 2). ## L1 — the package build ships Turtle @@ -232,9 +232,9 @@ master plan** in its own wording (the last bullet of §Ontology data files and l - M1-M5 above (commands and output quoted). - Phase 2: in a tmp dir, `$LINKED create-package probe --kind ontology`, then `npm install ` (`npm pack` in - `~/web/wt/070-L1/packages-local/_linked-core`, built), then `(cd probe-ont && $LINKED build)`: + `-L1/packages-local/_linked-core`, built), then `(cd probe-ont && $LINKED build)`: exit 0 and `lib/esm/data/probe.ttl` present. -- Phase 3: `docker build -t linked-fuseki:dev ~/web/wt/070/packages-local/_linked-fuseki/server`, +- Phase 3: `docker build -t linked-fuseki:dev /packages-local/_linked-fuseki/server`, then `npx playwright test --config playwright.config.ts tests/e2e/create-app.spec.ts`. - Full: `npm run test:unit`; `npx playwright test --config playwright.config.ts` (all three specs). @@ -266,9 +266,9 @@ changeset are in. - `tests/e2e/create-app.spec.ts:40` `new GenericContainer('stain/jena-fuseki')`; `:63` `dbType=mem`; the app is cloned from app-template's GitHub `main` (`src/cli-methods.ts:253`) and installed from npm (`tests/e2e/helpers/app.ts:55-66`). -- CN: `src/backend/provisioners/appProjectPackages.test.ts:63` expects - `'../data/lego-elevated-planning.json'`; CN builds project packages through `buildPackageFiles` - (cli report 023), so the scaffold change reaches CN's generated packages at once. +- The host app: its project-package test expects a `'../data/.json'` data path; the app + builds project packages through `buildPackageFiles` (cli report 023), so the scaffold change + reaches its generated packages at once. **Pitfalls:** - `npx linked` runs main's CLI (above). Exercise every fixture with `$LINKED`. @@ -281,9 +281,9 @@ changeset are in. - The scaffold's `loadData` imports `@_linked/core/ontology/loadOntologyFiles`, which npm's core lacks until the release: `tests/template/package.full.test.ts` (installs from npm) fails until then. Run it at R; L1 verifies the scaffold with core's packed integration build instead. -- CN's `appProjectPackages.test.ts:63` turns red on CN's `store-inference` the moment L1 lands - (Vitest resolves `@_linked/cli` to the nested checkout's source). L1 lands its one-line CN - update right after the cli landing (CN last). +- The host app's project-package test turns red on its `store-inference` branch the moment L1 + lands (Vitest resolves `@_linked/cli` to the nested checkout's source). L1 lands its one-line + update in the app right after the cli landing (the app last). - The image's inferring template is `config-tdb2` only: a `dbType=mem` dataset would not infer. - The e2e cannot show "a template app reads its Turtle" before T1 and the release: the template comes from GitHub `main` and npm. L1's e2e asserts inference on the image directly; the @@ -292,8 +292,8 @@ changeset are in. ` a owl:Ontology .`, no blank nodes) so the first write by the generator or builder is a no-op diff. -**Architecture:** CN arch-04 §RDF file formats; arch-03 §Layering; arch-05 (the generator writes -package data); arch-10 (package layout); core `docs/architecture/ontologies.md`; cli reports 001 +**Architecture:** the host app's architecture docs (RDF file formats, layering, the generator +writing package data, package layout); core `docs/architecture/ontologies.md`; cli reports 001 (Vite backend build), 016 (standalone SSR bundling), 020 (`build-app` needs no data server), 023 (`buildPackageFiles`). @@ -312,12 +312,12 @@ package data); arch-10 (package layout); core `docs/architecture/ontologies.md`; - Quick gate (1-2 min), after each phase: `npx linked build` in the cli worktree, then the jest line under Verify. - Full gate, before landing: `npm run test:unit`; `npx playwright test --config playwright.config.ts` - (create-app needs Docker and `linked-fuseki:dev`); CN's - `npx vitest run src/backend/provisioners/appProjectPackages.test.ts` in `~/web/wt/070-L1/`. + (create-app needs Docker and `linked-fuseki:dev`); the host app's project-package test in + `-L1/`. **Size:** small, **3 phases** (the master says 2; phase 3 waits for F1 and phase 2 for K1): 1. Turtle in the package build and the app backend build; M1-M5 verify the contract text. -2. The scaffold in Turtle (needs K1's `loadOntologyFiles`); CN's test line. +2. The scaffold in Turtle (needs K1's `loadOntologyFiles`); the host app's test line. 3. The CLI e2e on the image (needs F1). **Changeset:** minor. **Record:** report 024. @@ -337,9 +337,9 @@ register form `linkedOntology(terms, ns, '', loadData, ['../data/.tt and `.json.d.ts` example files are gone. Verify passed: `$LINKED create-package probe --kind ontology`, core's packed `store-inference` (944b6d0) installed, `$LINKED build` exit 0 with `lib/esm/data/probe.ttl`, and core's registry loads it. Gate: build 9.3 s; Verify jest line 130 -tests, 4.9 s; `npm run test:unit` 870 tests, 21.8 s; CN's `appProjectPackages.test.ts` 25 passed, -5.4 s. CN's landing changes two assertions in that test (lines 56 and 63, not one) and arch-03's -package tree. Report 024. +tests, 4.9 s; `npm run test:unit` 870 tests, 21.8 s; the host app's project-package test 25 +passed, 5.4 s. The app's landing changes two assertions in that test, not one, and the package +tree in its architecture docs. Report 024. **Outcome (phase 3 of 3).** `create-app.spec.ts` runs Fuseki from `FUSEKI_IMAGE` (default `linked-fuseki:dev`) with a `tdb2` dataset; a new test inserts `A rdfs:subClassOf B . a a A`, @@ -403,7 +403,7 @@ reuses the probe's child-process pattern and asset hook (exported from `shapeRef after landing with the integration CLI. - Resolve dependencies from the package, not from the CLI: in the layout a package's own `node_modules` holds no `@_linked` (it links to the main checkout's nested one), so the walk goes - up to `~/web/wt/070/node_modules/@_linked/`. A dependency's `exports` may not expose + up to `/node_modules/@_linked/`. A dependency's `exports` may not expose `package.json`, so walk `node_modules` directories rather than `require.resolve`. - Import by real path (`fs.realpathSync`): Node resolves the dependency's own imports through the real path, and a symlinked URL would evaluate its modules a second time. @@ -430,7 +430,7 @@ against the repository's core via `fixtureNodeModules`):** - Full gate (before landing): `npm run test:unit` and the build. **Verify:** every package the plan changed builds clean with the worktree's CLI in its -`~/web/wt/070/packages-local/` copy: core, server, server-utils, schema, xsd, rdfs, dcmi, +`/packages-local/` copy: core, server, server-utils, schema, xsd, rdfs, dcmi, owl, sioc, dcat, org, auth, fuseki; quote each result; `git status` clean after each. **Size:** 2 phases: (1) the `depCheck` fix; (2) the shape check, its flag and its tests; docs at @@ -444,7 +444,7 @@ landing. through core's `registerInstalledOntologies` (V2, core c3a5ef4), and runs `checkShapeHierarchy({dependencies})`; every finding is printed, an error fails the build. `--skip-shape-check ""` skips it. `depCheck` keeps the last missing entry. Deviations: -dependencies are followed when they are `@_linked/*` **or** `linkedPackage: true` (a CN or app +dependencies are followed when they are `@_linked/*` **or** `linkedPackage: true` (an app's own package depending on another linked package needs its data too); a register module that throws (core only warns) fails the check with that warning; a core without `shapes/checkShapeHierarchy` or `ontology/registerInstalled` warns and skips. The `depCheck` fix surfaces one formerly hidden @@ -457,7 +457,7 @@ the quick jest line 5 suites / 111 tests, 14.5 s; `npm run test:unit` 82 suites - [ ] Sub-plan reviewed by the master; contradictions routed into the master's §Contracts - [x] L1 phase 1 — Turtle in the package and app backend builds; the contract verified, M1-M5 (report 024) -- [x] L1 phase 2 — scaffold in Turtle; CN's `appProjectPackages.test.ts` updated +- [x] L1 phase 2 — scaffold in Turtle; the host app's project-package test updated - [x] L1 phase 3 — CLI e2e on the image - [ ] L1 landed on `store-inference` (commit: ) - [x] L2 detail written (wave 4) diff --git a/docs/plans/002-package-repos-cli-steps.md b/docs/plans/002-package-repos-cli-steps.md index a7d23d0e..7ac5e255 100644 --- a/docs/plans/002-package-repos-cli-steps.md +++ b/docs/plans/002-package-repos-cli-steps.md @@ -1,10 +1,10 @@ --- summary: > - Sub-plan of Create Now master plan 057 (package repos) for `linked-fw/cli`: LK — one + Sub-plan of the host app's plan (package repos) for `linked-fw/cli`: LK — one `linkedKind(json)` helper and `linked.kind` replacing `linkedPackage`/`linkedApp` in the CLI, - `@_linked/server` and CN; RK — `linked.kind` in every `package.json` of the CN tree and in - `linked-fw/app-template`; CO — `linked checkout`, `branch fork`, `branch merge`, credentials - through the environment, `--json`, docs and skills. Lands on `dev`. + `@_linked/server` and the host app; RK — `linked.kind` in every `package.json` of the app's + tree and in `linked-fw/app-template`; CO — `linked checkout`, `branch fork`, `branch merge`, + credentials through the environment, `--json`, docs and skills. Lands on `dev`. status: Plan --- @@ -12,16 +12,15 @@ status: Plan ## Master plan -[CN plan 057](../../../../docs/plans/057-package-repo-creation.md) — -`/Users/rene/web/create_now/docs/plans/057-package-repo-creation.md` (rules for every step, +The host app's master plan for package repos, in the app's repository (rules for every step, status table, numbers, starter prompt). Steps land on integration branch `dev`. ## Contracts -Copied verbatim from plan 057; the rest are there. A step that changes one updates it here and in -057 in the same landing. +Copied verbatim from the master plan; the rest are there. A step that changes one updates it here +and in the master plan in the same landing. -- **K-kind** (provider LK; consumers RK, PC, CO, CN, server): every `package.json` carries +- **K-kind** (provider LK; consumers RK, PC, CO, the host app, server): every `package.json` carries `"linked": { "kind": "app" | "ontology" | "assets" | "library" }`, merged into an existing `linked` object (e.g. `linked.serverOnly`), never replacing it. `linkedPackage` and `linkedApp` are gone; no reader accepts them. One helper, `linkedKind(json)` → @@ -29,7 +28,7 @@ Copied verbatim from plan 057; the rest are there. A step that changes one updat (with `LinkedKind`, `LINKED_KINDS`, `isLinkedPackageJson`); `@_linked/server` keeps a byte-identical copy in `@_linked/server/utils/linkedDependencies`, between marker comments that name the twin. `discoverLinkedDependencies(appDir, pkg, isLinked?)` takes an optional test; only - CN's `appPackagesOf` passes one (accepting `linkedPackage: true` too, until the release). A linked package is `kind !== undefined && kind !== 'app'`. + the host app's graph-access reader passes one (accepting `linkedPackage: true` too, until the release). A linked package is `kind !== undefined && kind !== 'app'`. `ontology` packages may carry shapes for their own terms; `library` is framework code. - **K-unpublished** (provider CO; consumers PC, BC, RK): an app or package lists the packages it uses that are not on npm in its committed `package.json`: @@ -54,10 +53,10 @@ Copied verbatim from plan 057; the rest are there. A step that changes one updat `{code, branch, root, app: {name, repo, dir, branch, created, head, status, reason?}, packages: [{name, repo, dir, branch, detached, fellBack, head, requiredBy, status, reason?, unlisted?, added?}], install: {ran, ok}, builds: [{name, result: ok|failed|skipped}], messages}`; - `--add ` (added by plan 070 NO) checks out one more package no list names into + `--add ` (added by a later app plan) checks out one more package no list names into `packages-local/` by the same branch rule (`added: true`), its name from its `package.json`; it never triggers the install and is never built; a later run without it reports it `unlisted`; - `--pin =` (added for CN plan 225 OB) puts that package on `` instead of the + `--pin =` (added for a later app plan) puts that package on `` instead of the rule (`pin` in its entry; detached at `origin/` while another worktree holds it, fast- forwarded and attached later), `--pins-only` drops the same-name rule (no pin = detached at `origin/`), and in either mode a clean worktree whose head origin has moves when the @@ -78,22 +77,22 @@ Copied verbatim from plan 057; the rest are there. A step that changes one updat `linked.unpublishedPackages` edges), then the app; fetch; `push` (default) merges `origin/` `--no-ff` into `origin/` in a temporary worktree and pushes ``; `update` (protected default branches) merges `origin/` into `` and - pushes the branch, and CN (step BC) then opens and merges one PR per repo whose `landed` is + pushes the branch, and the host app then opens and merges one PR per repo whose `landed` is false, in the order returned, with its GitHub App (0 approvals); stop at the first conflict or refused push. `{code, branch, into, mode, repos: [{name, dir, repo, result: merged|up-to-date|conflict|push-refused|skipped, sha?, files?, landed}], messages}`. `linked worktree remove --branch [--dir ] [--force] [--json]`: remove the checkout once every repo has landed in `origin/` (an ancestor of it: a squash merge - reads as not landed, so CN lands with merge commits); `{code, removed, kept: [{dir, + reads as not landed, so the host app lands with merge commits); `{code, removed, kept: [{dir, reason}], branches: [{repo, branch, deleted, sha}], messages}`. Credentials only through the environment: `LINKED_GIT_TOKEN` (and `LINKED_GIT_USERNAME`, default `x-access-token`), used by remote git calls through `GIT_ASKPASS` with credential helpers and git hooks off; local git, the install and builds run without it; no token is ever written to `.git/config` or any file. - **K-repos** (provider PC; consumers BC, CS): package repos `{ws}-ont-{slug}` and - `{ws}-assets-{slug}` in `GITHUB_TARGET_ORG` (production `create-now-repos`, dev/test + `{ws}-assets-{slug}` in `GITHUB_TARGET_ORG` (production `example-org`, dev/test `linked-cm-testing`); npm names `{slug}-ont`, `{slug}-assets`; created with `linked.kind` and the asset package listing the ontology package in its `linked.unpublishedPackages`. The app is created - from the template and works without its packages; CN then opens and merges (as its GitHub App, + from the template and works without its packages; the host app then opens and merges (as its GitHub App, 0 approvals) a PR adding both to the app's `linked.unpublishedPackages`. Failure leaves a working app and a retry path. The app's `packages/` directory is no longer used for packages. @@ -103,24 +102,24 @@ Copied verbatim from plan 057; the rest are there. A step that changes one updat After LK, the CLI and `@_linked/server` read only `linked.kind`. Every local checkout whose `package.json` still says `"linkedPackage": true` then stops being a linked package for the -owner's running CN: it drops out of boot loading, the ontology sync -(CN `src/backend/infra/cnMainOntologySync.ts:20-27`), Vite's dependency exclusion and +owner's running host app: it drops out of boot loading, the app's ontology sync, Vite's +dependency exclusion and `build-all`. So **RK runs right after LK in the same wave, and LK does not land until RK is ready.** The master spawns both together; RK works on a worktree branch rebased on LK's branch, and they land back to back (LK first, RK immediately after, then the main-checkout rebuilds and -one CN restart). Neither lands alone. +one restart of the app). Neither lands alone. ## LK — `linked.kind` through one helper **Depends on:** nothing (wave 1, parallel with CK and WC); lands only together with RK (above). -**Repos:** cli, server, CN (its readers and tests of the flags). **Plan doc:** cli +**Repos:** cli, server, the host app (its readers and tests of the flags). **Plan doc:** cli `docs/plans/003-…`. **Reports:** cli `docs/reports/032-…`, server `docs/reports/020-…`. **Test port:** 4342. **Size:** medium, 2 phases: (1) the helper and every reader in the CLI and -server, with tests; (2) the writers (templates, `buildPackageFiles`, the identity stampers), CN's +server, with tests; (2) the writers (templates, `buildPackageFiles`, the identity stampers), the app's reader and tests, docs. **Goal.** K-kind: `linkedKind(json)` is the only way anything decides what a package is; nothing -reads `linkedPackage` or `linkedApp`; everything the CLI or CN scaffolds writes `linked.kind`. +reads `linkedPackage` or `linkedApp`; everything the CLI or the app scaffolds writes `linked.kind`. **Scope.** - `linkedKind(json)` in the CLI (next to today's `isLinkedPackageJson`, @@ -137,26 +136,26 @@ reads `linkedPackage` or `linkedApp`; everything the CLI or CN scaffolds writes `"linked": {"kind": "ontology"}` / `{"kind": "assets"}`; the react-native template writes `assets` for `packages/app-shapes` (shapes only, no ontology) and `app` for `services/api`. The app identity stampers write `"linked": {"kind": "app"}` and drop `linkedApp`, merging into an existing `linked` object: CLI `applyAppIdentity` - (`src/cli-methods.ts:608`) and CN `stampAppIdentity` (`src/backend/provisioners/appTemplateIdentity.ts`). + (`src/cli-methods.ts:608`) and the host app's own template-identity stamper. That way an app made from the published `linked-fw/app-template` (which keeps `linkedApp: true` until RK's template branch is released) is right from the start. -- CN: `appTemplateIdentity.ts:92-94` refuses a template whose kind is not `app`/absent the way it - refuses `linkedPackage` today; CN tests that write or assert the flags (Files). -- Changesets: cli (minor), server (minor). CN has none. +- The host app: its template-identity stamper refuses a template whose kind is not `app`/absent + the way it refuses `linkedPackage` today; its tests that write or assert the flags (Files). +- Changesets: cli (minor), server (minor). The app has none. - Not here: the `package.json` of existing packages (RK); `linked.unpublishedPackages` (CO). **Verify.** - `git -C packages-local/_linked-cli grep -nE '\.linkedPackage\b|linkedPackage ?(===|:) ?true|"linkedPackage"|linkedApp' -- src defaults` - and the same in `_linked-server/src` and CN `src` find only `linkedPackage(` registration calls + and the same in `_linked-server/src` and the app's `src` find only `linkedPackage(` registration calls and comments that explain the old field is not read. -- cli `npm run test:unit` and `npm run test:template`; server's jest suite; CN gate (Tests). +- cli `npm run test:unit` and `npm run test:template`; server's jest suite; the app's gate (Tests). - With RK applied (the joint landing), in the main checkout: `npx linked build-all` builds every - package it built before (compare the package list with one taken before LK); restart CN on + package it built before (compare the package list with one taken before LK); restart the app on :4040 and check the boot log lists the same linked packages and ontology sync packages as before; the owner's path (sign in, open a project and its Ontology Manager) works. **Done when.** One helper and its server twin; zero readers of the old fields; scaffolds and both -identity stampers write `linked.kind`; cli, server and CN gates green; changesets in cli and +identity stampers write `linked.kind`; cli, server and app gates green; changesets in cli and server; landed back to back with RK. ### Files (found in the code) @@ -203,45 +202,41 @@ Server (`packages-local/_linked-server`, on `dev`): - Tests: `src/tests/boot-installed-providers.test.ts`, `nested-linked-packages.test.ts`, `shape-graphs-live.test.ts`, `fatal-provider-errors.test.ts`, `has-module-entry.test.ts`. - `package.json:93` already has `"linked": {"serverOnly": […]}` (also `_linked-server-utils` - `package.json:41`, read by CN `src/__tests__/clientBoundary.test.ts:100`): RK merges `kind` + `package.json:41`, read by the app's client-boundary test): RK merges `kind` into these. -CN (`/Users/rene/web/create_now`): -- `src/backend/provisioners/appTemplateIdentity.ts:18,38,82,92-94` (the refusal and comments). -- `src/backend/infra/cnMainOntologySync.ts:20-27` and `src/backend/gateway/graphAccess.ts:155-168` - (`appPackagesOf`) — use the server's `discoverLinkedDependencies`; no change, but they are what - breaks if RK is missing (above) — and see Pitfalls for app clones. -- `src/backend/provisioners/appProjectPackages.ts:22,51,57,118,132-133,299` — uses - `buildPackageFiles`; its scaffolds get `linked.kind` from the CLI. -- Tests: `appTemplateIdentity.test.ts:9,33,40-41,93-94,104`, - `appProjectPackages.test.ts:30,48,111,191-230`, `ProjectCreationOrchestrator.test.ts:510-550`, - `gateway/graphAccess.test.ts:136-147`. +The host app (the app's checkout): +- Its template-identity stamper (the refusal and comments). +- Its ontology sync and its graph-access reader — use the server's `discoverLinkedDependencies`; + no change, but they are what breaks if RK is missing (above) — and see Pitfalls for app clones. +- Its project-package provisioner — uses `buildPackageFiles`; its scaffolds get `linked.kind` + from the CLI. +- Tests: the template-identity, project-package, project-creation and graph-access tests. ### Pitfalls - **Merge, never replace, the `linked` object**: server and server-utils already have `linked.serverOnly`. `buildPackageFiles` and the stampers must spread an existing `linked`. - **LK and RK land together** (§Landing LK and RK together). Do not land LK alone, even with green - tests: the tests use fixtures, the owner's CN uses the real checkouts. -- **App clones install `@_linked/*` from npm.** CN's managed app clones (`CN_PROJECTS_ROOT`) get - their framework packages from npm, published with `linkedPackage: true` only until the release. - CN's own `@_linked/server` (localized, with LK) runs `discoverLinkedDependencies` over a clone in - `graphAccess.appPackagesOf` (`graphAccess.ts:158-168`), so it finds none of the clone's npm - framework packages until they are republished. The clone's own server (from npm) is unaffected. - Check what `appPackagesOf` loses on the owner's project (the framework packages' graph roots) + tests: the tests use fixtures, the owner's host app uses the real checkouts. +- **App clones install `@_linked/*` from npm.** The host app's managed app clones get their + framework packages from npm, published with `linkedPackage: true` only until the release. + The app's own `@_linked/server` (localized, with LK) runs `discoverLinkedDependencies` over a + clone in its graph-access reader, so it finds none of the clone's npm framework packages until + they are republished. The clone's own server (from npm) is unaffected. + Check what that reader loses on the owner's project (the framework packages' graph roots) before landing; if the owner's path breaks, stop and report — the master decides (K-kind says no reader accepts the old fields). - `isFrameworkPkg(name)` in `client-dep-includes.ts:683` is a separate name check; keep it. - `localize/app-root.ts` keeps `linkedPackage: boolean` as a field name of its own manifest type; rename it (`isPackage`) so no field of that name survives. -- Build the CLI and server with `npx linked build`, never `tsc`; the CN worktree loads them from +- Build the CLI and server with `npx linked build`, never `tsc`; the app's worktree loads them from the nested worktrees (`npx linked doctor resolve` shows `overlay`). ### Architecture -- CN arch-03 §Package types (`docs/architecture/03-packages-and-governance.md:15`), §The CN - workspace model and §Local development with `linked localize` (`:684,719`): the `linked` - object; update where it names `linkedPackage`/`linkedApp`. +- The host app's architecture docs (package types, its workspace model, local development with + `linked localize`): the `linked` object; update where they name `linkedPackage`/`linkedApp`. - cli `docs/architecture/vite-runtime-config.md` (Vite exclusion of linked packages), server `docs/architecture/01-server-only-surface.md` (`linked.serverOnly`). - CLI README (`linked build` / `create-package` sections) and `docs/localize.md`. @@ -252,10 +247,10 @@ CN (`/Users/rene/web/create_now`): `npx jest --config jest.config.cjs tests/unit/createPackageScaffold.test.ts tests/unit/createPackageLocation.test.ts tests/unit/buildAllDiscovery.test.ts tests/unit/clientDepIncludes.test.ts tests/unit/shapeHierarchy.test.ts tests/unit/packageFiles.test.ts tests/unit/createInsidePackage.test.ts`; server `NODE_OPTIONS=--experimental-vm-modules npx jest --config jest.config.cjs src/tests/boot-installed-providers.test.ts src/tests/nested-linked-packages.test.ts`; - CN `npx vitest run src/backend/provisioners/appTemplateIdentity.test.ts src/backend/provisioners/appProjectPackages.test.ts src/backend/gateway/graphAccess.test.ts`. + the app's template-identity, project-package and graph-access tests. - **Full gate:** cli `npm run test:unit`, `npm run test:template`, `npx linked build`; server - full jest suite and `npx linked build`; CN `npm run typecheck:gate` and - `CN_TEST_PORT=4342 npm run test:regular`. + full jest suite and `npx linked build`; the app's `npm run typecheck:gate` and its regular + test set on port 4342. - New tests: `linkedKind` for each kind, absent, a non-string, and the old fields alone (→ `undefined`); `buildPackageFiles` keeps an existing `linked` key; both stampers turn `linkedApp: true` into `linked.kind: "app"`. @@ -263,16 +258,16 @@ CN (`/Users/rene/web/create_now`): ## RK — `linked.kind` in every `package.json` **Depends on:** LK (runs with it in the same wave; rebases on LK's branch; lands right after it). -**Repos:** every `_linked-*` checkout, CN, `semantu-webid-email`, `linked-fw/app-template`. +**Repos:** every `_linked-*` checkout, the host app, `semantu-webid-email`, `linked-fw/app-template`. **Plan doc:** cli `docs/plans/004-…`. **Report:** cli `docs/reports/033-…`. **Test port:** 4344. **Size:** medium (wide, mechanical), 2 phases. *Plan-mode detail is added when its wave starts.* -**Goal.** K-kind holds for every `package.json` in the CN tree and in the app template: the old -fields gone, `linked.kind` set, so the owner's CN after LK loads exactly what it loaded before. +**Goal.** K-kind holds for every `package.json` in the app's tree and in the app template: the +old fields gone, `linked.kind` set, so the owner's app after LK loads exactly what it loaded before. **Scope.** -- `linkedApp` → `app` (3): CN root, `packages/my-app`, `packages-local/semantu-webid-email`. -- CN `packages/` (4) → `library`: access, documents, maps, execution-gateway. `packages/editor-chrome` +- `linkedApp` → `app` (3): the app's root, `packages/my-app`, `packages-local/semantu-webid-email`. +- The app's `packages/` (4) → `library`: access, documents, maps, execution-gateway. `packages/editor-chrome` has neither field today: leave it unmarked unless the agent finds a reader needs it (report). - `packages-local/_linked-*` (22): ontology — dcat, dcmi, org, owl, rdfs, schema, sioc, xsd (and npm, whose `linkedPackage: true` CK added); library — core, react, server, server-utils, cli, @@ -281,16 +276,16 @@ fields gone, `linked.kind` set, so the owner's CN after LK loads exactly what it - On `dev` already: auth, cli, core, dcat, fuseki, primitives, server, server-utils, and `semantu-webid-email`. The other 13 `_linked-*` checkouts (css, dcmi, icons, org, owl, rdfs, react, s3, schema, sentry, shape-ui, sioc, translation, xsd) join `dev` - (`npx linked branch start dev --target main` from CN's main checkout), plus npm (local). + (`npx linked branch start dev --target main` from the app's main checkout), plus npm (local). - `linked-fw/app-template` (remote only) → `app`: clone it to a working dir, branch `dev` from its `main`, commit, never push (the release opens its PR). - One changeset per framework repo (patch: metadata only). -- pg-cn and its `@linked.cm/*` packages: a backlog item in pg-cn - (`/Users/rene/web/pg-cn/docs/backlog/`, next free number), no changes. +- Another app and its `@linked.cm/*` packages: a backlog item in that app's repository, no + changes. **Done when.** `git grep -nE '"linkedPackage"|"linkedApp"' -- '*package.json'` finds nothing in -the CN tree (outside `node_modules`) or the template branch; every checkout has its changeset; -build-all and the boot log list the same packages as before LK; the pg-cn backlog item exists. +the app's tree (outside `node_modules`) or the template branch; every checkout has its changeset; +build-all and the boot log list the same packages as before LK; the other app's backlog item exists. **Known files and pitfalls.** - 29 `package.json` carry a flag today (`grep -l '"linkedPackage"\|"linkedApp"' package.json packages/*/package.json packages-local/*/package.json`). @@ -301,9 +296,9 @@ build-all and the boot log list the same packages as before LK; the pg-cn backlo ## CO — `linked checkout`, `branch fork`, `branch merge` -**Depends on:** LK and RK (landed; CO rebases on them, all touch the CLI). **Repo:** cli (+ CN +**Depends on:** LK and RK (landed; CO rebases on them, all touch the CLI). **Repo:** cli (+ the host app's docs, semantu-agents skills PR). **Plan doc:** cli `docs/plans/005-…`. **Report:** cli -`docs/reports/034-…`. **Test port:** 4345 (only if a CN run is needed; the CLI gates need none). +`docs/reports/034-…`. **Test port:** 4345 (only if a run of the app is needed; the CLI gates need none). **Size:** large, 4 phases (below). **Sensitive** (credentials): independent review before landing. **Goal.** K-unpublished and K-checkout: one command makes a branch checkout of an app and its @@ -339,9 +334,10 @@ cleans such a checkout up once it has landed. - `dependencyOrder` (`src/commands/release.ts:182`) also follows `linked.unpublishedPackages` edges (an asset package lists its ontology package there, not in `dependencies`); `release plan`'s order gains the same edges. -- Docs and skills (Architecture). K-checkout here and in CN 057/180 gets the final flag names and - JSON shape in the same landing. -- Not here: creating repos (PC), CN's `CheckoutProvisioner` switch (BC), opening PRs on GitHub. +- Docs and skills (Architecture). K-checkout here and in the master plan gets the final flag names + and JSON shape in the same landing. +- Not here: creating repos (PC), switching the host app's checkout provisioner over, opening PRs on + GitHub. ### Design (proposal; the step agent may refine it inside K-checkout, K-unpublished, K-kind) @@ -364,8 +360,8 @@ app checkout (it is that checkout's `origin`). `` is matched like `bran ///packages-local// package worktree, = checkoutNameFor(npm name) ``` `/` from the normalized URL path (two orgs never collide); `` is the -branch with `/` → `__` (the CN caller passes `--dir` with its own `branchClonePath`, so CN's -layout stays CN's). A base clone is a plain `git clone --bare` (not a partial clone: that needs +branch with `/` → `__` (the host app passes `--dir` with its own clone path, so its layout +stays its own). A base clone is a plain `git clone --bare` (not a partial clone: that needs the remote at every later checkout); then `git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'`, delete the copied local heads, `git fetch --prune origin`, `git remote set-head origin --auto`. Every worktree's branch is @@ -398,7 +394,7 @@ app worktree has its own `node_modules` (never the link farm: `refuseSharedInsta restores the committed `package-lock.json`, so `git status` in the app worktree stays clean while `packages-local/*` members exist; `checkout` installs the localize git hooks (`installGitHooks`) in the app's base clone so they cover its worktrees (check `core.hooksPath` -and worktree-shared hooks in a test). The docs say plainly: this is an app's own install, not CN's +and worktree-shared hooks in a test). The docs say plainly: this is an app's own install, not a developer's workspace and not an agent worktree's link farm. `--no-install` skips both install and builds. `LINKED_GIT_TOKEN` is removed from the environment of `npm install` and every build (lifecycle scripts must not see it). @@ -417,20 +413,20 @@ lockfile changed (or always with `--install`, if the agent finds `auto` unreliab "code": 0, "branch": "change-1", "root": "/srv/projects", - "app": {"name": "acme-peacegame-app", "repo": "https://github.com/create-now-repos/acme-peacegame.git", - "dir": "/srv/projects/acme-peacegame/change-1", "branch": "change-1", "created": true, + "app": {"name": "acme-planning-app", "repo": "https://github.com/example-org/acme-planning.git", + "dir": "/srv/projects/acme-planning/change-1", "branch": "change-1", "created": true, "head": "3f2c…", "status": "created"}, "packages": [ - {"name": "peacegame-ont", "repo": "https://github.com/create-now-repos/acme-ont-peacegame.git", - "dir": "/srv/projects/acme-peacegame/change-1/packages-local/peacegame-ont", + {"name": "planning-ont", "repo": "https://github.com/example-org/acme-ont-planning.git", + "dir": "/srv/projects/acme-planning/change-1/packages-local/planning-ont", "branch": "main", "detached": true, "fellBack": true, "head": "a91e…", - "requiredBy": ["acme-peacegame-app", "peacegame-assets"], "status": "created"}, - {"name": "peacegame-assets", "repo": "https://github.com/create-now-repos/acme-assets-peacegame.git", - "dir": "…/packages-local/peacegame-assets", "branch": "change-1", "detached": false, - "fellBack": false, "head": "77b0…", "requiredBy": ["acme-peacegame-app"], "status": "updated"} + "requiredBy": ["acme-planning-app", "planning-assets"], "status": "created"}, + {"name": "planning-assets", "repo": "https://github.com/example-org/acme-assets-planning.git", + "dir": "…/packages-local/planning-assets", "branch": "change-1", "detached": false, + "fellBack": false, "head": "77b0…", "requiredBy": ["acme-planning-app"], "status": "updated"} ], "install": {"ran": true, "ok": true}, - "builds": [{"name": "peacegame-ont", "result": "ok"}], + "builds": [{"name": "planning-ont", "result": "ok"}], "messages": [] } ``` @@ -448,7 +444,7 @@ variable is unset. One helper `gitRemoteEnv(env)` returns, only when `LINKED_GIT `GIT_CONFIG_KEY_n`/`GIT_CONFIG_VALUE_n`, an empty `credential.helper` (so a keychain helper never *stores* the token git just used) — no `-c` on argv, so no token or helper in `ps`. Every URL the CLI receives is stripped of userinfo before use; one with userinfo is accepted only to strip it, -with a warning (CN passes a clean URL plus the env). Error text from git is scrubbed of the token +with a warning (the host app passes a clean URL plus the env). Error text from git is scrubbed of the token value before it is printed. A test greps every `config` and `worktrees/*/config*` under the root for the token and for `@github.com`. @@ -493,16 +489,16 @@ agent worktrees (`commands/worktree.ts:395-399`, against the local base) is unch - `npx linked build` in the cli; `node lib/esm/launch.js checkout --help`, `branch fork --help`, `branch merge --help`, `worktree remove --help` show the flags recorded in K-checkout. - By hand, once, against a private repo of `linked-cm-testing` with an installation token in - `LINKED_GIT_TOKEN` (the master gets the token from CN's testing App key; skip and say so if not + `LINKED_GIT_TOKEN` (the master gets the token from the app's testing GitHub App key; skip and say so if not available): `linked checkout test-co --repo --root $(mktemp -d) --json`, then `grep -r x-access-token ` finds nothing. -- CN main checkout after landing and `npm run build` in the cli: `npx linked branch status` and +- The app's main checkout after landing and `npm run build` in the cli: `npx linked branch status` and `npx linked worktree list` unchanged; the owner's path works. ### Done when -K-unpublished and K-checkout hold, with the flag names and JSON shape recorded here and in CN -057/180; the e2e test makes a checkout of an app with two unpublished packages (the asset package +K-unpublished and K-checkout hold, with the flag names and JSON shape recorded here and in the master +plan; the e2e test makes a checkout of an app with two unpublished packages (the asset package listing the ontology package; one package only on the default branch: fallback reported), re-runs it idempotently, forks the fallen-back package's branch, merges package then app into the default branch, removes the checkout with the landed check; no `config` under the root holds a token; @@ -546,12 +542,11 @@ CLI (`packages-local/_linked-cli`): goes next to it. - No CLI code fetches or pushes today except `create-app`'s first push (`src/cli-methods.ts:2860`). -CN (`/Users/rene/web/create_now`), read-only for CO: -- `src/backend/provisioners/CheckoutProvisioner.ts:98-139` (`cloneBranch`: `git clone --branch - --single-branch`, token strip `:123-131`, `npm install` `:135-137`), `src/utils/projectsRoot.ts:19` - (`CN_PROJECTS_ROOT`), `:53` (`branchClonePath`: CN passes it as `--dir` in BC). -- `src/backend/provisioners/GitHubProvisioner.ts:128-149` (`buildRepoProtectionPayload`: - `enforce_admins: true`, pull-request reviews required — Pitfalls). +The host app (the app's checkout), read-only for CO: +- Its checkout provisioner (clones with `git clone --branch --single-branch`, strips the token, + runs `npm install`) and its projects root and branch clone path (passed as `--dir` later). +- Its GitHub provisioner's repo protection (`enforce_admins: true`, pull-request reviews required + — Pitfalls). Tests: `tests/unit/integration/{branch,worktree,repos,releasePlan}.test.ts` (real throwaway repos under `os.tmpdir()`: `initRepo`/`makeApp` in `worktree.test.ts:33,56`), @@ -560,8 +555,8 @@ under `os.tmpdir()`: `initRepo`/`makeApp` in `worktree.test.ts:33,56`), ### Pitfalls -- **Protected default branches refuse the push.** CN's app repos are protected with - `enforce_admins: true` and required pull-request reviews (`GitHubProvisioner.ts:128-149`), so +- **Protected default branches refuse the push.** The host app's app repos are protected with + `enforce_admins: true` and required pull-request reviews (its GitHub provisioner), so `git push origin HEAD:main` from `branch merge` is refused (GH006) even for the App. K-checkout's "fetch, merge, push" into the default branch cannot work on them as written; `--mode update` (push the branch, land by PR) is the proposal. Stop and report to the master before choosing. @@ -583,7 +578,7 @@ under `os.tmpdir()`: `initRepo`/`makeApp` in `worktree.test.ts:33,56`), - Do not reuse `worktree add`'s agent naming or integration-branch requirement; `checkout` needs neither. - Build with `npx linked build`; after landing, the main checkout runs `npm run build` in the cli - before anything else (057 Rules). + before anything else (the master plan's Rules). ### Architecture and docs @@ -594,10 +589,9 @@ under `os.tmpdir()`: `initRepo`/`makeApp` in `worktree.test.ts:33,56`), layout, branch rule, JSON, credentials) and §Limitations (`:272`). - `docs/localize.md`: §Commands (`:189`) `--listed`, §Docker and CI (`:439`) the env token, §What it never does (`:500`) "never writes a token", §Exit codes (`:511`). -- CN `docs/architecture/03-packages-and-governance.md` §Local development (`:727`, the - `unpublishedPackages` paragraph `:780-797`, "*Not built yet (plan 057)*" goes) and - `docs/how-to/develop-a-linked-package-locally.md`. -- semantu-agents (`/Users/rene/packages/semantu-agents`, currently on branch +- The host app's architecture docs on local development (the `unpublishedPackages` paragraph + loses its "not built yet" note) and its how-to on developing a linked package locally. +- semantu-agents (its local checkout, currently on branch `master-agent-skill`: branch from its default branch, not from that one): `skills/public/workflow/SKILL.md`, `implementation/SKILL.md`, `wrapup/SKILL.md`, `release/SKILL.md`, `master/SKILL.md` (all name `worktree add/remove`, `localize` or `branch @@ -623,9 +617,9 @@ under `os.tmpdir()`: `initRepo`/`makeApp` in `worktree.test.ts:33,56`), over HTTP (no network, no server): the unit tests assert the env and the hook directly. - **Quick gate (1–2 min):** `npx jest --config jest.config.cjs tests/unit/checkout tests/unit/integration/branch.test.ts tests/unit/integration/worktree.test.ts tests/unit/integration/releasePlan.test.ts tests/unit/localize/commands.test.ts tests/unit/localize/resolve.test.ts tests/unit/linkedKind.test.ts`. -- **Full gate:** cli `npm run test:unit`, `npm run test:template`, `npx linked build`; CN (only - the docs change there) `npm run typecheck:gate`. No CN regular set unless the agent touches CN - code (it should not). +- **Full gate:** cli `npm run test:unit`, `npm run test:template`, `npx linked build`; the host app + (only the docs change there) `npm run typecheck:gate`. No regular set of the app unless the agent + touches its code (it should not). ### Size and phases @@ -636,7 +630,7 @@ Large, 4 phases, one commit each: 2. `linked checkout` (base clones, worktrees, install, idempotency, JSON); the e2e checkout cases. 3. `branch fork`, `branch merge` (order, `--no-ff`, conflict stop, the mode question settled with the master), `worktree remove --branch`; e2e cases. -4. Docs, K-checkout updated in 002 and CN 057/180, changeset, semantu-agents PR, review fixes. +4. Docs, K-checkout updated in 002 and the master plan, changeset, semantu-agents PR, review fixes. ## Progress diff --git a/docs/plans/003-master-worktrees.md b/docs/plans/003-master-worktrees.md index 2c552bd1..7ff545ce 100644 --- a/docs/plans/003-master-worktrees.md +++ b/docs/plans/003-master-worktrees.md @@ -3,9 +3,9 @@ summary: > Masters run in their own worktree: `linked branch start --worktree` makes the integration branch in a link-farm worktree (never switching the owner's checkouts), `linked worktree add --from ` gives steps flattened farms with a `parent` marker that `relink` honours, - CN's own `packages/*` become overlays, `worktree list/remove` know masters, and `linked branch + the app's own `packages/*` become overlays, `worktree list/remove` know masters, and `linked branch land ` merges the owner's branch into ``, fast-forwards the owner's checkouts, builds and - pushes. For Create Now's master-run workflow (proposal of 2026-10-29). Lands on `dev`. + pushes. For the host app's master-run workflow (proposal of 2026-10-29). Lands on `dev`. status: Done (report 040) --- @@ -18,7 +18,7 @@ The ideation is the proposal "Master runs in their own worktree" (2026-10-29). S - The owner stays on his stable branch (`dev`) in the main checkout and every `packages-local/` checkout; nothing but `branch land` moves them. - Each master gets an integration branch `` in its own worktree (`../wt/`) with nested - framework worktrees and a link farm into the one install, plus its own preview CN. + framework worktrees and a link farm into the one install, plus its own preview of the app. - Steps: option A flattened. A full app worktree on `--`, nested package worktrees from the master's, a farm that links straight into the install with the master's overlays under its own, and the master recorded as `parent` so `relink` rebuilds the same farm. @@ -32,7 +32,7 @@ Decisions taken here (automatic mode, maintainability first): has no `lib/`, so linking it would make tsc and Node fail where they work today. A `packages/*` member is an overlay when its entry point exists (`main`, or the `.` export's import/default) or it declares none (`editor-chrome`, `my-app`). Built later: `linked worktree relink`. -2. **Preview env from the linked `.env`.** The CLI is not CN-specific: the start command overrides +2. **Preview env from the linked `.env`.** The CLI is not specific to one app: the start command overrides `SITE_ROOT` (to `http://localhost:`) whenever the linked `.env` defines it, for every worktree; a master's preview also overrides `CN_PROJECTS_ROOT` (to `/apps`) when the `.env` defines it. diff --git a/docs/reports/004-webpack-retired.md b/docs/reports/004-webpack-retired.md index 5566022d..c6844c56 100644 --- a/docs/reports/004-webpack-retired.md +++ b/docs/reports/004-webpack-retired.md @@ -14,7 +14,7 @@ anything could be deleted. All four were answered by measurement, and the answer ## What the scan found **Does any app still build with webpack?** `linked build-app` dispatched on `hasViteConfig()`, so -the question is "which app roots have no `vite.config.{ts,js,mjs}`". Across the create-now +the question is "which app roots have no `vite.config.{ts,js,mjs}`". Across the host app's workspace — the only workspace where this CLI is consumed locally — exactly one did: `packages/my-app`, a drifted copy of `linked-fw/app-template`. It was given the template's `vite.config.ts` as part of this change, so the webpack path had no consumer left when it was @@ -23,7 +23,7 @@ already, so nothing was creating new webpack apps. `defaults/app-react-native` i `defaults/app-static` is a Capacitor overlay; neither emits webpack configuration. **Does `generateWebpackConfig` have consumers?** It was re-exported from `src/index.ts`, so it was -public API. No importer was found anywhere in the create-now workspace, including the 25 local +public API. No importer was found anywhere in that workspace, including the 25 local framework checkouts under `packages-local/`. External consumers cannot be ruled out from here — hence `major` rather than a patch. diff --git a/docs/reports/005-build-all-discovery.md b/docs/reports/005-build-all-discovery.md index 2222afbd..c29a061d 100644 --- a/docs/reports/005-build-all-discovery.md +++ b/docs/reports/005-build-all-discovery.md @@ -13,7 +13,7 @@ summary: > `4a1d419`, PR [#154](https://github.com/linked-fw/cli/pull/154), released in **1.27.0**. `linked build-all` is the command this package offers as the answer to *does the workspace -compile*. Against the Create Now workspace — six tracked members plus 25 localized checkouts — +compile*. Against a host app's workspace — six tracked members plus 25 localized checkouts — it printed ``` @@ -81,8 +81,8 @@ skip carries a reason: ``` Found 27 linked packages to build: … Skipping 4 packages found but not built: - - @create-now/editor-chrome: has no `build` script - - lincd.org: not in @semantu/create-now's dependency tree + - @my-app/editor-chrome: has no `build` script + - lincd.org: not in @my-app/app's dependency tree - localpkg: has no `build` script - my-app: is a linked app — build it with `linked build-app` ``` diff --git a/docs/reports/006-package-template.md b/docs/reports/006-package-template.md index 21ed6036..d465cdda 100644 --- a/docs/reports/006-package-template.md +++ b/docs/reports/006-package-template.md @@ -110,8 +110,8 @@ imports resolving under node10. Once it is present, `types` has to be written as This was already "fixed" the wrong way once, downstream, on the strength of a measurement that was cheap, plausible, and inverted the answer. -**What was measured: file existence.** A backlog item in the consuming project (create-now -backlog 072) observed that 22 of 24 installed `@_linked/*` packages declare `"types": +**What was measured: file existence.** A backlog item in the consuming project's +backlog observed that 22 of 24 installed `@_linked/*` packages declare `"types": "index.d.ts"` while no such file is present in the package directory, concluded that every node10 consumer silently types those packages as `any`, and proposed a one-line fix across **20** separate `linked-fw/*` repositories. diff --git a/docs/reports/008-the-tsconfig-and-build-script-standards.md b/docs/reports/008-the-tsconfig-and-build-script-standards.md index dc300a52..918c3c4a 100644 --- a/docs/reports/008-the-tsconfig-and-build-script-standards.md +++ b/docs/reports/008-the-tsconfig-and-build-script-standards.md @@ -213,7 +213,7 @@ counts *in the compiled-output commits*. A three-day window over all deletions g because other commits also deleted files. Both numbers are correct answers to different questions. `sentry` still has a `tsconfig-es5.json` — -Create Now's `docs/backlog/087-dead-tsconfig-es5-in-s3-and-sentry.md`, now one +tracked in the host app's backlog, now one repo rather than two. --- @@ -266,11 +266,11 @@ how specifiers are *resolved*, not how they are emitted. Spot-checked against re ### R3 — `environmentMatchGlobs` does not exist in vitest 4.1.11 -Not deprecated — **absent**. It appears nowhere in the installed package. The obvious fix for CN's +Not deprecated — **absent**. It appears nowhere in the installed package. The obvious fix for the host app's jsdom/`NODE_ENV` trap would have been silently ignored: an unknown key in a vitest config is not an error, so the config would have looked correct and done nothing. The real mechanism is `test.projects`. -Create Now's `docs/backlog/084-the-jsdom-node-env-trap-in-backend-tests.md`. +Tracked in the host app's backlog. ### R4 — "the sweep would produce a release to watch" — false, and the publish half is unverified @@ -351,7 +351,7 @@ squash. Still outstanding: - **`sentry/tsconfig-es5.json`** still exists — the last one - (Create Now's `docs/backlog/087-dead-tsconfig-es5-in-s3-and-sentry.md`). + (tracked in the host app's backlog). - **`sentry`, `server-utils`, `semantu-cli`** are the three repos not yet on the tsconfig standard (§1.2 layer 3). - **`server-utils`** has one uncommitted edit (`src/types/ShapeDetails.ts`) and is the only repo diff --git a/docs/reports/009-create-package-location.md b/docs/reports/009-create-package-location.md index abd49291..53669e1d 100644 --- a/docs/reports/009-create-package-location.md +++ b/docs/reports/009-create-package-location.md @@ -146,11 +146,11 @@ gained `adopt`, so one package writes that file, the hand-moved checkouts get a ### Location and remote belong in the open-source CLI -Create Now's plan 054 had put "placement" in the first-party `@semantu/cli`. Choosing between +A host app's plan had put "placement" in the first-party `@semantu/cli`. Choosing between `packages/` and `packages-local/` and wiring an optional remote is structure every user needs and assumes no organisation, token or network — so it lives here. *Creating* the remote repository in an organisation and protecting it stays first-party; that tool calls -`create-package --remote ` once the repo exists. Plan 054 carries a correction note. +`create-package --remote ` once the repo exists. That plan carries a correction note. ### The pruned checkout (found during validation) @@ -213,5 +213,5 @@ and `linked build` in one exited 0. - `docs/reports/007-localize-command.md` — the `linked localize` adapter this builds on. - `@_linked/localize` README — `adopt`, the manifest, the relink reinstall. -- Create Now: `docs/how-to/develop-a-linked-package-locally.md` (creating a package, `--adopt`, - the postinstall contract) and `docs/plans/054-package-creation-and-governance.md` (correction). +- The host app's how-to for developing a linked package locally (creating a package, `--adopt`, + the postinstall contract) and its package-creation plan (correction). diff --git a/docs/reports/014-load-stores-loader.md b/docs/reports/014-load-stores-loader.md index cb6a1b13..6b09a578 100644 --- a/docs/reports/014-load-stores-loader.md +++ b/docs/reports/014-load-stores-loader.md @@ -8,7 +8,7 @@ summary: > `RemoteDataset` datasets file gives `instanceof RemoteDataset` and `instanceof RemoteDatasetUnreachableError` true, and the FusekiStore file keeps `instanceof FusekiStore` true; a core that ignores it boots as before. CLI half of backlog 014's - fix (CN plan 068 phase 4, step D1b). Minor release. + fix (part of a host app's plan). Minor release. --- # 014 — `linked start` installs the `loadStores` loader @@ -46,33 +46,33 @@ RemoteDatasetUnreachableError`, each against the storage file's own import. | core `loadStores` | datasets file | output | |---|---|---| | 2.33.0 as published (ignores the loader) | RemoteDataset | `[probe] instanceof RemoteDataset false, instanceof FusekiStore false`; `[probe] instanceof RemoteDatasetUnreachableError false (RemoteDatasetUnreachableError)` | -| with the loader (D1a's change applied to `lib/esm/utils/loadStores.js`) | RemoteDataset | `[probe] instanceof RemoteDataset true, instanceof FusekiStore false`; `[probe] instanceof RemoteDatasetUnreachableError true (RemoteDatasetUnreachableError)` | +| with the loader (core's half applied to `lib/esm/utils/loadStores.js`) | RemoteDataset | `[probe] instanceof RemoteDataset true, instanceof FusekiStore false`; `[probe] instanceof RemoteDatasetUnreachableError true (RemoteDatasetUnreachableError)` | | with the loader | FusekiStore (committed default) | `[probe] instanceof RemoteDataset false, instanceof FusekiStore true`; `[storage] appData: FusekiStore`; `GET /` 200 | | 2.34.0 from npm (core's half released) | RemoteDataset | `[probe] instanceof RemoteDataset true, instanceof FusekiStore false`; `[probe] instanceof RemoteDatasetUnreachableError true (RemoteDatasetUnreachableError)` | | 2.34.0 from npm | FusekiStore | `[probe] instanceof RemoteDataset false, instanceof FusekiStore true`; `[storage] appData: FusekiStore`; `GET /` 200 | The first row is today's behaviour and shows the CLI half is harmless with an older core. -## CN boot proof +## Host app boot proof -A CN worktree of `main` (`4900ce4e3`), `npm ci` (no `packages-local/`), `npm install` of this -build's tarball, then `CN_TEST_PORT=4079 npx playwright test tests/e2e/signin.spec.ts`: +A worktree of the host app's `main` (`4900ce4e3`), `npm ci` (no `packages-local/`), `npm install` of +this build's tarball, then its sign-in e2e (`tests/e2e/signin.spec.ts`) on port 4079: ``` -[globalSetup] CN is healthy on :4079 after 29.4 s +[globalSetup] app is healthy on :4079 after 29.4 s 5 passed (51.7s) ``` -CN's own storage file imports its stores by name and never calls `loadStores`, so the loader is -installed but unused there. The log has two `[CN-err] Fatal socket error Error: read/write +The app's own storage file imports its stores by name and never calls `loadStores`, so the loader +is installed but unused there. The log has two `[app-err] Fatal socket error Error: read/write ECONNRESET` lines during the iframe sign-in redirect (a browser-side socket reset); the tests pass. ## Not done here - Other native `import()`s of bundled packages (backlog 015's guard and bundling steps). -- A CLI e2e asserting `instanceof` with a `RemoteDataset` datasets file (CN plan 068 step D4). -- App-template's `name` + `url` fallback goes back to `instanceof` once core's half is released - (step D5). +- A CLI e2e asserting `instanceof` with a `RemoteDataset` datasets file (a later step of the host + app's plan). +- App-template's `name` + `url` fallback goes back to `instanceof` once core's half is released. ## PRs diff --git a/docs/reports/015-dual-copy-guard.md b/docs/reports/015-dual-copy-guard.md index 4f72d6de..bbdfd4d7 100644 --- a/docs/reports/015-dual-copy-guard.md +++ b/docs/reports/015-dual-copy-guard.md @@ -6,7 +6,7 @@ summary: > the package, file, specifier and importer. Files under `node_modules` and in localized checkouts or workspaces (by `package.json` name) both count; the CLI never does. Measured: a fresh template app flags 8 files with a `RemoteDataset` datasets file and 13 with FusekiStore, as on the spike; - CN (worktree, installed packages only) flags none. Minor release. + the host app (worktree, installed packages only) flags none. Minor release. --- # 015 — The two-copies guard in `linked start` @@ -49,7 +49,7 @@ summary: > App-template `main`, created with this build (`node lib/esm/launch.js create-app probe … --skip-install`), `npm install`, `npm install` of this build's `npm pack` tarball and of -`@_linked/core@2.35.0` (the template's lockfile still has 2.33.0, which ignores D1b's loader). +`@_linked/core@2.35.0` (the template's lockfile still has 2.33.0, which ignores the store loader of report 014). `linked start` on its own port with Node v22.23.3; `grep -c "TWO COPIES"` on the boot log. | Datasets file | Status line | `TWO COPIES` | Boot | @@ -81,44 +81,44 @@ The FusekiStore boot gets further (the server's providers load) and adds five: @_linked/react/lib/esm/utils/ClassNames.js (imported as "@_linked/react/utils/ClassNames" from …/@_linked/primitives/lib/esm/components/Button.js) ``` -No `@_linked/server` file is flagged: D1b's loader gives `RemoteDataset` the runner's copy. All +No `@_linked/server` file is flagged: the store loader (report 014) gives `RemoteDataset` the runner's copy. All 13 come from the external `@_linked/schema` and `@_linked/primitives` importing the bundled `@_linked/react` and `@_linked/server-utils`, which the standalone bundling change (backlog 015 option C) removes. -### CN boot proof +### Host app boot proof -A CN worktree of `main` (`e4af26cbc`), `npm ci`, `npm install` of this build's tarball, then -`CN_TEST_PORT=4079 npx playwright test tests/e2e/signin.spec.ts`: +A worktree of the host app's `main` (`e4af26cbc`), `npm ci`, `npm install` of this build's tarball, +then its sign-in e2e (`tests/e2e/signin.spec.ts`) on port 4079: ``` -[globalSetup] CN is healthy on :4079 after 23.2 s +[globalSetup] app is healthy on :4079 after 23.2 s 5 passed (45.0s) ``` `grep -E "dual-copy guard|TWO COPIES"` on the log: ``` -[CN] [linked] dual-copy guard: on +[app] [linked] dual-copy guard: on ``` -`grep -c "TWO COPIES"`: 0. A CN worktree has no `packages-local/`, so this measures CN with every -`@_linked/*` installed from npm: the dev `ssr.noExternal` is CN's workspace packages, their +`grep -c "TWO COPIES"`: 0. The worktree has no `packages-local/`, so this measures the app with every +`@_linked/*` installed from npm: the dev `ssr.noExternal` is the app's workspace packages, their installed dependents and `@_linked/server`. The owner's localized layout (every framework package -a `packages-local/` checkout, all bundled) was not measured: the owner's CN was listening on -:4040, and the lib overlay is never run under a running CN. +a `packages-local/` checkout, all bundled) was not measured: the owner's own instance was listening +on :4040, and the lib overlay is never run under a running instance. -The log has `[CN-err] Fatal socket error Error: read ECONNRESET` lines during the sign-in -redirects (4 under `[CN-err]` with this build, and one unprefixed). The same proof with `@_linked/cli@1.48.2` from npm +The log has `[app-err] Fatal socket error Error: read ECONNRESET` lines during the sign-in +redirects (4 under `[app-err]` with this build, and one unprefixed). The same proof with `@_linked/cli@1.48.2` from npm in the same worktree logs 4 as well (`5 passed (34.9s)`, no guard line), so they predate 1.49.0 and are not the CLI's. ## Not done here - Bundling every `@_linked/*` but core and the CLI in a standalone app (backlog 015 option C, - CN plan 068 step D3), which is expected to take the template's counts to 0. -- The CLI e2e that fails on a `TWO COPIES` line or a guard that is not `on` (option B, step D4). -- CN's count in the localized layout, at D3's CN measurement. + a later step of the host app's plan), which is expected to take the template's counts to 0. +- The CLI e2e that fails on a `TWO COPIES` line or a guard that is not `on` (option B). +- The host app's count in the localized layout, measured with option C. ## PRs diff --git a/docs/reports/016-standalone-ssr-bundles-every-linked-package.md b/docs/reports/016-standalone-ssr-bundles-every-linked-package.md index 2ec5bf0b..485c7d7f 100644 --- a/docs/reports/016-standalone-ssr-bundles-every-linked-package.md +++ b/docs/reports/016-standalone-ssr-bundles-every-linked-package.md @@ -6,8 +6,8 @@ summary: > guard: a fresh template app goes from 8 / 13 `TWO COPIES` lines (RemoteDataset / FusekiStore datasets file) to 0 / 0, renders and passes its own e2e; webid.email standalone goes from 17 lines and a failing `email.spec.ts` (case 17 (a), `LinkedEmail` provider lost) to 0 lines and - 5 passed, given core 2.34.0+; CN stays at 0 (worktree and localized layout) and its sign-in proof passes. Boot time - unchanged. Minor release. + 5 passed, given core 2.34.0+; the host app stays at 0 (worktree and localized layout) and its + sign-in proof passes. Boot time unchanged. Minor release. --- # 016 — Standalone apps bundle every `@_linked/*` but core and the CLI @@ -117,11 +117,11 @@ With core 2.35.0 they are gone. So webid.email needs its core floor raised to `^ Renovate bump or a direct one in Semantu/webid-email); until then `FusekiStore` is a Node copy, as it was before this change, which webid.email only imports as a type. -### CN boot proof +### Host app boot proof -A CN worktree of `main` (`c316c33da`), `npm ci`, the CLI under test installed, then -`CN_TEST_PORT=4079 npx playwright test tests/e2e/signin.spec.ts`. CN is workspace mode -(`packages/*`), so its list is unchanged; the count is the proof. +A worktree of the host app's `main` (`c316c33da`), `npm ci`, the CLI under test installed, then its +sign-in e2e (`tests/e2e/signin.spec.ts`) on port 4079. The app is workspace mode (`packages/*`), +so its list is unchanged; the count is the proof. | CLI | Result | `TWO COPIES` | |---|---|---| @@ -129,14 +129,14 @@ A CN worktree of `main` (`c316c33da`), `npm ci`, the CLI under test installed, t | this build | `5 passed (33.1s)` | 0 | ``` -[globalSetup] CN is healthy on :4079 after 18.3 s +[globalSetup] app is healthy on :4079 after 18.3 s 5 passed (33.1s) -[CN] [linked] dual-copy guard: on +[app] [linked] dual-copy guard: on ``` -**Localized layout** (the owner's CN: every framework package a `packages-local/` checkout, so a -bundled source workspace), measured once nothing listened on :4040. From CN's main checkout, -`CN_TEST_PORT=4079 npx playwright test tests/e2e/signin.spec.ts`, first with the checkout's own +**Localized layout** (the owner's checkout: every framework package a `packages-local/` checkout, +so a bundled source workspace), measured once nothing listened on :4040. From the app's main +checkout, the same sign-in e2e on port 4079, first with the checkout's own build (1.50.0), then with this build's `lib/` rsynced over `packages-local/_linked-cli/lib/`, then `npx linked build` in the checkout to put main's build back (`git status`: `## main...origin/main`, clean): @@ -147,17 +147,17 @@ clean): | this build | `5 passed (33.6s)` | 0 | ``` -[globalSetup] CN is healthy on :4079 after 17.2 s +[globalSetup] app is healthy on :4079 after 17.2 s 5 passed (33.6s) -[CN] [linked] dual-copy guard: on +[app] [linked] dual-copy guard: on ``` -This is also the first measurement of D2's guard in the localized layout: 0 lines. +This is also the first measurement of the dual-copy guard (report 015) in the localized layout: 0 lines. ## Not done here -- The CLI e2e that fails on a `TWO COPIES` line or a guard that is not `on` (option B, CN plan - 068 step D4), which closes backlog 014 and 015. +- The CLI e2e that fails on a `TWO COPIES` line or a guard that is not `on` (option B), which + closes backlog 014 and 015. - webid.email's core floor (`^2.34.0`), above; the webid-email backlog that tracks case 17 (a) is updated from this report (Semantu/webid-email). diff --git a/docs/reports/017-dual-copy-e2e.md b/docs/reports/017-dual-copy-e2e.md index cf93e604..b000c341 100644 --- a/docs/reports/017-dual-copy-e2e.md +++ b/docs/reports/017-dual-copy-e2e.md @@ -20,7 +20,7 @@ summary: > Under `linked start` a framework module could be evaluated twice, by Vite's SSR module runner and by Node, so classes failed `instanceof` across the two and module state existed twice. Backlog 015 counted 19 cases of this bug class since June 2026, each fixed on its own path; backlog 014 was the -newest (`instanceof RemoteDataset*` false in a template app, app-template#26). CN plan 068 phase 4 +newest (`instanceof RemoteDataset*` false in a template app, app-template#26). The host app's plan removed the known copies in three releases: the store loader (report 014, cli 1.49.0, core 2.34.0), the guard that prints a line for every file Node loads from a bundled package (report 015, cli 1.50.0), and standalone apps bundling every `@_linked/*` but core and the CLI (report 016, @@ -129,7 +129,7 @@ webid.email `LinkedEmail` provider, is gone with C and a core 2.34.0+ floor (rep What the guard and this e2e do not see: the browser, a built app, and the optimizer's copies. -Case 20, 2026-10-18, browser (CN plan 068 S5): an installed linked package's `src/` `.tsx` loaded +Case 20, 2026-10-18, browser (found under a host app's plan): an installed linked package's `src/` `.tsx` loaded plain and with `?v`, two React contexts in shape-ui. Fixed in [report 018](018-one-browser-copy-of-installed-linked-src.md); the browser check is [report 021](021-browser-side-dual-copy-check.md). diff --git a/docs/reports/018-one-browser-copy-of-installed-linked-src.md b/docs/reports/018-one-browser-copy-of-installed-linked-src.md index a3746ffe..e34df09b 100644 --- a/docs/reports/018-one-browser-copy-of-installed-linked-src.md +++ b/docs/reports/018-one-browser-copy-of-installed-linked-src.md @@ -3,7 +3,7 @@ date: 2026-10-18 summary: > In dev the browser loaded shape-ui's `src/hostContext.tsx` twice, plain and as `?v=`, when `@_linked/shape-ui` was installed from npm (it ships `src/`), so its React context existed twice - and CN's relation-fields e2e failed once CN stopped registering shapes globally (CN plan 068 S5). + and a host app's relation-fields e2e failed once the app stopped registering shapes globally. Vite adds `?v` only to `.[cm]?[jt]s` files it resolves in node_modules, and a relative import inherits its importer's `?v`, so a `.tsx` got `?v` from a `.ts` importer and none from a `.tsx` one. The CLI's `./Sibling.js` rewrite now covers importers under any registered linked `src/`, @@ -14,9 +14,9 @@ summary: > ## Why -CN plan 068 step S5 (CN branch `feat/browser-host-catalog`) has CN hand shape-ui a shape catalog -per (project, branch) instead of registering project shapes globally. CN's -`tests/e2e/relation-fields.spec.ts` then failed in a CN worktree (packages from npm): `InstanceView` +A host app's plan (branch `feat/browser-host-catalog`) has the app hand shape-ui a shape catalog +per (project, branch) instead of registering project shapes globally. The app's +`tests/e2e/relation-fields.spec.ts` then failed in a worktree (packages from npm): `InstanceView` read a host context with no catalog. The browser had loaded `hostContext.tsx` twice. This is case 20 of the dual-copy bug class (report 017), the first in the browser since cli#272. @@ -88,11 +88,11 @@ Template app as above, after (packed build of this branch): 56 shape-ui `src/` r /node_modules/@_linked/shape-ui/src/hostContext.tsx ``` -CN, worktree, `npm ci`, the packed build installed, `CN_TEST_PORT=4065`: +The host app, worktree, `npm ci`, the packed build installed, its e2e on port 4065: -- CN `main` (`56317a500`), `signin.spec.ts` + `relation-fields.spec.ts`: `6 passed (38.9s)`. +- The app's `main` (`56317a500`), `signin.spec.ts` + `relation-fields.spec.ts`: `6 passed (38.9s)`. relation-fields passes on main either way, since main still registers shapes globally. -- CN S5 (`58949c433`), `relation-fields.spec.ts`: with cli 1.51.0 from npm `1 failed` +- The app's catalog branch (`58949c433`), `relation-fields.spec.ts`: with cli 1.51.0 from npm `1 failed` (`expect(page).toHaveURL(expected) failed`); with this build, run twice, `2 passed (28.5s)` and `2 passed (28.0s)` (setup + the test). diff --git a/docs/reports/020-build-app-needs-no-data-server.md b/docs/reports/020-build-app-needs-no-data-server.md index 79468492..0f52e8e6 100644 --- a/docs/reports/020-build-app-needs-no-data-server.md +++ b/docs/reports/020-build-app-needs-no-data-server.md @@ -5,7 +5,7 @@ summary: > `linked.backend.files.{ts,js}` alone when it has one, falling back to the whole storage file (backlog 018, option 1). The app template moved its file stores into that file (app-template#34), so a template app builds with its `RemoteDataset` answering nowhere: before, the build exited 1 - with "Could not reach the data server". CN and webid.email have no files file and build as + with "Could not reach the data server". The host app and webid.email have no files file and build as before. A new e2e (`build-app.spec.ts`, in the `Dual-copy e2e` job) holds it. Minor release. Replaces backlog 018. --- @@ -18,7 +18,7 @@ summary: > `appAssets` store's `accessURL`. It found the store by importing the app's whole `linked.backend.storage.ts`, which runs `loadStores` and the template's awaited `appData.init()`. With `appData` a `RemoteDataset` and no data server, the build exited 1 before Vite started -(app-template#27, CN plan 068 step D5). A FusekiStore app tried to create its dataset in whatever +(app-template#27). A FusekiStore app tried to create its dataset in whatever Fuseki `FUSEKI_BASE_URL` named, during a build. ## The choice @@ -99,8 +99,8 @@ and with `E2E_CLI=@_linked/cli@1.51.2`: Apps without a files file take the fallback, so they load what they loaded before: -- CN (worktree of `main` `345e23773`, `npm ci`, this build installed, `npx linked build-all`, CN's - `.env`, `FUSEKI_BASE_URL=http://127.0.0.1:9 LINKED_SYNC_SHAPES_ON_BOOT=false`): +- The host app (worktree of `main` `345e23773`, `npm ci`, this build installed, `npx linked build-all`, + its `.env`, `FUSEKI_BASE_URL=http://127.0.0.1:9 LINKED_SYNC_SHAPES_ON_BOOT=false`): `NODE_ENV=production npm run build:app -- --allow-dirty` exit 0, `✅ Publishing destination: http://localhost:4040/uploads`, `✅ Release manifest ready: 142 artifacts`. - webid.email (fresh clone of Semantu/webid-email `75f079b`, `npm ci`, this build installed, @@ -111,7 +111,7 @@ Apps without a files file take the fallback, so they load what they loaded befor ## Follow-ups -- CN and webid.email can move their file stores into a `linked.backend.files.js`/`.ts` to build +- The host app and webid.email can move their file stores into a `linked.backend.files.js`/`.ts` to build without Fuseki; not needed today (both build with a dead Fuseki url). Not recorded as backlog. - app-template `blank`: the sync merge conflicts on the storage file's imports; resolved by hand (app-template readme, "The blank variant"). diff --git a/docs/reports/021-browser-side-dual-copy-check.md b/docs/reports/021-browser-side-dual-copy-check.md index bcc89804..92434fb9 100644 --- a/docs/reports/021-browser-side-dual-copy-check.md +++ b/docs/reports/021-browser-side-dual-copy-check.md @@ -16,7 +16,7 @@ summary: > Report 017's `tests/e2e/dual-copy.spec.ts` read only the boot's output, which covers Node loading a file the SSR runner bundles. The browser has its own ways to get two copies: Vite's optimizer (cli#272) and the `?v` split of report 018 (case 20, two React contexts in shape-ui). Nothing in -the CLI's tests loaded a page in a browser, so case 20 was found by CN's e2e, not here. +the CLI's tests loaded a page in a browser, so case 20 was found by the host app's e2e, not here. ## What changed diff --git a/docs/reports/022-dev-start-fixes.md b/docs/reports/022-dev-start-fixes.md index d37926dd..f10cba4c 100644 --- a/docs/reports/022-dev-start-fixes.md +++ b/docs/reports/022-dev-start-fixes.md @@ -43,7 +43,7 @@ only for standalone apps (no workspaces). - `linked:client-dep-includes` already scans every excluded framework package for its third-party client deps, so Radix, vaul and CJS deps still get `optimizeDeps.include` entries. -**Measured** in a CN-created app (two workspaces, vite 6.4.4, `node_modules/.vite` deleted): with +**Measured** in an app created by a host app (two workspaces, vite 6.4.4, `node_modules/.vite` deleted): with cli 1.47.0, `.vite/deps` held `class Person3` and the server logged `ServerCallError: Invalid query`; with this build, no `@_linked_*` chunks, `0` "Invalid query" lines, the People list rendered, `/` and `/page1` loaded with no console errors. diff --git a/docs/reports/023-build-package-files.md b/docs/reports/023-build-package-files.md index d7392193..3bbdee41 100644 --- a/docs/reports/023-build-package-files.md +++ b/docs/reports/023-build-package-files.md @@ -4,8 +4,8 @@ summary: > `buildPackageFiles(packageName, kind, options)` in `@_linked/cli/utils/packageFiles` returns the files `linked create-package --kind ontology|assets` produces as package-relative path → content, with no writes, prompts or install (cli 1.48.0, minor). `create-package` now writes exactly what - it returns; its output was verified byte-identical before and after. Create Now's - `appProjectPackages.ts` calls it instead of re-implementing the assembly to commit a project's + it returns; its output was verified byte-identical before and after. A host app's + project-package provisioner calls it instead of re-implementing the assembly to commit a project's packages through the GitHub API. --- @@ -13,8 +13,8 @@ summary: > ## Why -Create Now commits a project's ontology and assets packages through the GitHub API, not to a local -disk, and had re-implemented the CLI's package assembly (`src/backend/provisioners/appProjectPackages.ts`) +A host app commits a project's ontology and assets packages through the GitHub API, not to a local +disk, and had re-implemented the CLI's package assembly (in its project-package provisioner) with two deliberate differences: a literal `baseUri` and an added dependency. Two copies of the template logic drift. The CLI now exposes the assembly as a pure function, with options covering both differences. @@ -73,7 +73,7 @@ It is reached through the existing `./*` subpath export, like `utils/createPacka ## Limits and follow-ups - Only the `ontology` and `assets` kinds; `both` is two calls. -- Create Now's switch to `buildPackageFiles` is done (`appProjectPackages.ts` imports it). No open +- The host app's switch to `buildPackageFiles` is done (its provisioner imports it). No open follow-ups. ## PRs diff --git a/docs/reports/024-turtle-in-the-build.md b/docs/reports/024-turtle-in-the-build.md index abc2e4d1..6f1ab49b 100644 --- a/docs/reports/024-turtle-in-the-build.md +++ b/docs/reports/024-turtle-in-the-build.md @@ -7,16 +7,16 @@ summary: > copy fails the build). Measured in every mode an app runs in (release backend, dev SSR standalone and workspace, client build, tarball): each module reads the Turtle beside its own file through `import.meta.url`. New ontology packages are scaffolded in Turtle (`src/data/.ttl`, - `loadData` through core's `loadOntologyFiles`), which also changes Create Now's generated project + `loadData` through core's `loadOntologyFiles`), which also changes a host app's generated project packages. The CLI e2e runs its Fuseki on the inferring image with a `tdb2` dataset and asserts - the dataset infers. Part of CN plan 070 (sub-plan 001, step L1). + the dataset infers. Part of a host app's plan (sub-plan 001, step L1). --- # 024 — Turtle in the build ## Why -Under CN plan 070 a package's ontology data becomes Turtle, `src/data/.ttl`, read at runtime +Under a host app's plan a package's ontology data becomes Turtle, `src/data/.ttl`, read at runtime by `@_linked/core/ontology/loadOntologyFiles(import.meta.url, ['../data/.ttl'])` relative to the compiled module. That only works if the file sits at the same relative path in every place the module runs from. @@ -144,9 +144,9 @@ only, nothing for an app without Turtle, fails on a copy error), `ontologyDataRe the same call with an exported `dataFiles` constant; the scaffold keeps the literal list so the ontology module exports nothing but terms, `ns` and `loadData`. -Create Now builds its project packages through `buildPackageFiles`, so they change with it; its -`appProjectPackages.test.ts` now expects the `.ttl` file and the array form, and arch-03's package -tree names `data/.ttl`. +The host app builds its project packages through `buildPackageFiles`, so they change with it; its +project-package test now expects the `.ttl` file and the array form, and its architecture docs' +package tree names `data/.ttl`. **Verify** (tmp dir, worktree CLI as `$LINKED`; core packed from `store-inference` 944b6d0): @@ -181,7 +181,7 @@ Tests: 130 passed, 130 total 4.92 s $ time npm run test:unit Test Suites: 80 passed, 80 total Tests: 870 passed, 870 total 21.8 s -CN (~/web/wt/070-L1): $ time npx vitest run src/backend/provisioners/appProjectPackages.test.ts +host app: $ time npx vitest run Test Files 1 passed (1) Tests 25 passed | 1 skipped (26) 5.37 s ``` diff --git a/docs/reports/025-post-build-shape-check.md b/docs/reports/025-post-build-shape-check.md index 1a159c8b..152e3529 100644 --- a/docs/reports/025-post-build-shape-check.md +++ b/docs/reports/025-post-build-shape-check.md @@ -7,14 +7,14 @@ summary: > core's `registerInstalledOntologies`, and runs `checkShapeHierarchy({dependencies})`. Every finding is printed; an `error` fails the build; `--skip-shape-check ""` skips it. The build's dependency check no longer drops the last missing entry when `react` is not missing. All thirteen - framework packages of CN plan 070 build clean with it. Part of CN plan 070 (sub-plan 001, step L2). + framework packages of the host app's plan build clean with it. Part of that plan (sub-plan 001). --- # 025 — The post-build shape check ## Why -Under CN plan 070 the store infers `rdf:type` through `rdfs:subClassOf` and SHACL targeting +Under the host app's plan the store infers `rdf:type` through `rdfs:subClassOf` and SHACL targeting follows it, so shape `extends` and the class hierarchy must agree (plan decisions 13-16). Core's `checkShapeHierarchy` (`@_linked/core/shapes/checkShapeHierarchy`) reports where they do not. An app only logs its findings; a published package must be clean, so `linked build` fails on its @@ -52,10 +52,10 @@ shares the child pattern, the asset hook (now exported) and `findShapeModules`. ## Deviations from the sub-plan - Dependencies are followed when their name is `@_linked/*` **or** their `package.json` has - `linkedPackage: true`: an app or CN package that depends on another linked package needs that + `linkedPackage: true`: an app or app package that depends on another linked package needs that package's data as much as a framework one's. - The first implementation imported the register modules itself; the master's contract addition - (§Installed packages' ontologies, CN 7f5267e55) moved that into core, and the check calls + (§Installed packages' ontologies) moved that into core, and the check calls `registerInstalledOntologies` (core c3a5ef4) instead. ## Tests @@ -81,8 +81,8 @@ importing `n3` and not `react` gets `n3` in the warning (failed before the fix: ## Verify -Each package built in its `~/web/wt/070/packages-local/` integration copy with this branch's -CLI (`node ~/web/wt/070-L2/packages-local/_linked-cli/lib/esm/launch.js build`), core on c3a5ef4: +Each package built in its `/packages-local/` copy with this branch's +CLI (`node /packages-local/_linked-cli/lib/esm/launch.js build`), core on c3a5ef4: ``` core c3a5ef4: exit 0, 10s, ✔ Checking shape hierarchy, ✔ Build successful, git status: 0 changed diff --git a/docs/reports/026-shapes-ttl-in-the-build.md b/docs/reports/026-shapes-ttl-in-the-build.md index 98ab7665..9b672ecc 100644 --- a/docs/reports/026-shapes-ttl-in-the-build.md +++ b/docs/reports/026-shapes-ttl-in-the-build.md @@ -8,14 +8,14 @@ summary: > A package without shapes gets no file (a stale one is removed); a core without `shapes/shapesToTurtle` warns and writes none. `npm pack --dry-run` lists the file only for a package with shapes; two builds give the same bytes; core's file equals its golden (`fbe7639d…`). - Part of CN plan 071 (step L1). + Part of the host app's plan (its step L1). --- # 026 — `shapes.ttl` in the build ## Plan-mode detail -CN plan 071 §L1 is the sub-plan; §Contracts "Shape graphs" (as landed in core report 052) is the +The host app's plan §L1 is the sub-plan; its §Contracts "Shape graphs" (as landed in core report 052) is the contract: L1 writes `lib/esm/data/shapes.ttl` with `packageShapesTurtle(pkg)` and no options, so a built file and the server's in-process generation are the same bytes. Open question 6 (owner, 2026-10-23): a package without shapes gets no file, and nothing falls back. @@ -33,9 +33,9 @@ built file and the server's in-process generation are the same bytes. Open quest - **Pitfalls.** `removeOldFiles` deletes `lib` files older than 120 s, so a stale file usually goes, but a package that loses its shapes within two minutes of a build would keep one: the step removes it itself. A core older than the generator (npm's before R2) must not fail every build: it warns, - as the hierarchy check does for its module. CN backlog 130 (the SSR shim empties `@_linked/cli/*` - under Vitest) does not apply: nothing in CN imports this module; CN code that needs the Turtle - calls core. + as the hierarchy check does for its module. The host app's backlog item on the SSR shim (it empties + `@_linked/cli/*` under Vitest) does not apply: nothing in the app imports this module; its code + that needs the Turtle calls core. - **Tests.** Fixture packages in tmp dirs with a real child against the repository's core: file written in core's form, bytes stable across runs, no index, `npm pack --dry-run` with and without shapes, no shapes (stale file removed), shape modules registering nothing, no core dependency, an @@ -73,7 +73,7 @@ fallback). ## Gate -Worktree `named-graphs--l1` (`~/web/wt/l1/packages-local/_linked-cli`), core from the main +Worktree `named-graphs--l1` (`/packages-local/_linked-cli`), core from the main checkout's `named-graphs` at `200037d` (built; `shapes/shapesToTurtle` not yet on npm). No Fuseki of my own was needed: the e2e's testcontainer takes a random port. @@ -101,10 +101,10 @@ Fixture packages (`tests/unit/shapesTurtle.test.ts`, 10 tests, all passing): ✓ is byte-identical to core's in-process generation (its golden file) ``` -Real packages, built with this cli (`node ~/web/wt/l1/packages-local/_linked-cli/lib/esm/launch.js +Real packages, built with this cli (`node /packages-local/_linked-cli/lib/esm/launch.js build`): -- **`packages/documents`** (CN worktree copy): `✔ Writing shapes.ttl - lib/esm/data/shapes.ttl`, +- **`packages/documents`** (its copy in a host app worktree): `✔ Writing shapes.ttl - lib/esm/data/shapes.ttl`, `✔ Build successful with warnings` (the existing `@jest/globals`, `ajv` dependency warning), 22.2 s. 1365 lines, `sha256 1b520bceca8aab2fdccc5a905281218372b78f557b0258eb19fe9e7f3b60812b`; a second build gave the same hash, and a separate `node` importing `package.js`, diff --git a/docs/reports/027-ontology-accessor-generator.md b/docs/reports/027-ontology-accessor-generator.md index a761c0e7..3c4bed3e 100644 --- a/docs/reports/027-ontology-accessor-generator.md +++ b/docs/reports/027-ontology-accessor-generator.md @@ -8,7 +8,7 @@ summary: > `_ontologyResource`, `Prefix.add`) and the register module. No aggregated object. `linked build` fails on a stale module. On schema.org: 2,802 terms, a 402,091-byte module, and an esbuild bundle of `schema.Person` alone of 1,868 bytes (125,759 with every term). The SSR shim no longer empties - `@_linked/cli/*` under Vitest (CN backlog 130). + `@_linked/cli/*` under Vitest (a backlog item of the host app). --- # 027 — Ontology accessor generator @@ -34,7 +34,7 @@ one fixed identifier rule, no alias map. Choices made here: | owl, xsd, dcat, org | one each, default data | | dcmi | `dc` (`dcelems.ttl`), `dcterms`, `dcmitype` | | sioc | `sioc` (`sioc.ttl`, `sioc-types.ttl`; the `sioc_t:` subjects are not in its namespace) | - | a CN project ontology package | `` (its scaffold already names the file `.ttl`) | + | a host app's project ontology package | `` (its scaffold already names the file `.ttl`) | - **Several namespaces in one package: one entry each**, each with its own three modules and only the subjects of its own data files under its own namespace. @@ -60,18 +60,18 @@ one fixed identifier rule, no alias map. Choices made here: is no text or it only repeats the name. - **Tree-shaking**: every initializer is `/*#__PURE__*/ ns('Term')`. The data module keeps its `Prefix.add` side effect. -- **One generator.** `@_linked/cli/utils/ontologyModules` is pure (no Node, no parser), so CN's - browser-side `useCodeGenerator` can import it: it takes `{prefix, namespace, dataFiles, +- **One generator.** `@_linked/cli/utils/ontologyModules` is pure (no Node, no parser), so a host app's + browser-side code generator can import it: it takes `{prefix, namespace, dataFiles, terms}` with `terms: {localName, label?, comment?}[]`. `@_linked/cli/utils/ontologyTerms` selects the terms: `ontologyTermsFromQuads` is pure, and `ontologyTermsFromTurtle` parses with `n3` (now a cli dependency, loaded by a variable specifier) or with a `Parser` the caller passes. - CN should feed the Turtle it writes through the same selection (with its own statically + The app should feed the Turtle it writes through the same selection (with its own statically imported n3 in the browser) rather than map its draft by hand: `linked build` checks against that selection, so a term the draft lists differently (an individual, another label) would read as stale. -- **CN backlog 130 (the SSR shim under Vitest).** Reproduced in a CN worktree: +- **The host app's backlog item (the SSR shim under Vitest).** Reproduced in a worktree of the app: `import {buildPackageFiles} from '@_linked/cli/utils/packageFiles'` in a Vitest test was - `undefined`. CN's Vitest inlines `@_linked/*`, so the shim's own `export * from + `undefined`. The app's Vitest inlines `@_linked/*`, so the shim's own `export * from '@_linked/cli/x'` came back to the resolver, which handed it the shim again: a module re-exporting itself. The resolver now lets an import made by the shim resolve as usual (`ssrNodeShimId`). Under `linked start` that import never reaches the resolver (`ssr.external` @@ -165,7 +165,7 @@ Two independent read-only reviews found nothing high-severity. Fixed: - `npx linked build`, then the built cli on itself: "✔ Checking ontology modules … ✔ Build successful". - `npm run test:e2e` (the build steps changed): "6 passed (1.2m)". -- CN Vitest probe, a temporary test in a CN worktree, since removed: +- A Vitest probe, a temporary test in a host app worktree, since removed: - `import {buildPackageFiles} from '@_linked/cli/utils/packageFiles'` gave "1 failed" with the old `vite-config` and passed with this one; - the generator imported and ran under jsdom: "2 passed". @@ -175,12 +175,12 @@ Two independent read-only reviews found nothing high-severity. Fixed: - Rewrite the vocabulary packages to `linkedOntologies` and the generated modules, and their consumers to `import * as` and the generated names (the next step; consumers of `schema.ns`, `loadData`, `dataFiles` move to `.data`). -- Switch CN's `ontologyCodeGenerator` to `@_linked/cli/utils/ontologyModules`, and the cli's +- Switch the host app's ontology code generator to `@_linked/cli/utils/ontologyModules`, and the cli's `create-ontology` / `create-package --kind ontology` scaffold to the same three modules plus a - `linkedOntologies` entry. Both together: CN's test compares its output to the scaffold. + `linkedOntologies` entry. Both together: the app's test compares its output to the scaffold. - Report or remove the modules of a prefix dropped from `linkedOntologies` (in `linked generate-ontology --check`). -- CN backlog 130 can be closed once CN installs this cli; its test workaround +- The host app's backlog item can be closed once the app installs this cli; its test workaround (`lib/esm/utils/packageFiles.js` by path) can then go. ## PR @@ -204,10 +204,10 @@ the two drift apart. `linked generate-ontology` generates the accessor modules f There is no aggregated object. Names follow one rule: an invalid character becomes `_`, a leading digit gets a leading `_`, a reserved word gets a trailing `_`. Collisions are refused. - **`linked build`** now starts with **Checking ontology modules**. -- **For create-now:** `@_linked/cli/utils/ontologyModules` (pure) and +- **For a host app:** `@_linked/cli/utils/ontologyModules` (pure) and `@_linked/cli/utils/ontologyTerms` (`ontologyTermsFromQuads`, `ontologyTermsFromTurtle`). - **The dev SSR shim** no longer re-exports itself when Vitest inlines `@_linked/cli/*`. Before, - that made a cli helper `undefined` in an app's Vitest run (create-now backlog 130). + that made a cli helper `undefined` in an app's Vitest run. - **`n3`** is now a cli dependency. ### Verification @@ -225,13 +225,13 @@ the two drift apart. `linked generate-ontology` generates the accessor modules f - The generator also writes the data and register modules, so the namespace lives only in the configuration. -- The `create-ontology` scaffold is unchanged. It switches together with create-now's generator. +- The `create-ontology` scaffold is unchanged. It switches together with the host app's generator. ### Follow-ups All recorded in this report's §Follow-ups: - rewrite the vocabulary packages and their consumers; -- switch create-now's generator and the scaffold; +- switch the host app's generator and the scaffold; - report the modules of a dropped prefix; -- close create-now backlog 130. +- close the host app's backlog item. diff --git a/docs/reports/028-ontology-iri-and-generated-scaffold.md b/docs/reports/028-ontology-iri-and-generated-scaffold.md index cfd7f7ee..a937c82a 100644 --- a/docs/reports/028-ontology-iri-and-generated-scaffold.md +++ b/docs/reports/028-ontology-iri-and-generated-scaffold.md @@ -94,10 +94,10 @@ blank node, `urn:` namespaces and the refusals. Left as decided: generated by 1.57.0 sees `linked build` report them stale only when its data declares the ontology without the namespace's `#` (owl, dcat, both regenerated here) or it has a terms module without terms (none published). -- **Create Now.** CN scaffolds project ontology packages through `buildPackageFiles`, so on this - cli they get `linkedOntologies` and the generated modules, while CN's ontology builder still - writes the old module. CN's lockfile pins its cli, and CN switches its builder to - `generateOntologyModules` in the same change that raises its cli range (CN's report for this +- **The host app.** It scaffolds project ontology packages through `buildPackageFiles`, so on this + cli they get `linkedOntologies` and the generated modules, while its ontology builder still + writes the old module. Its lockfile pins its cli, and it switches its builder to + `generateOntologyModules` in the same change that raises its cli range (its own report for this work). ## Follow-ups diff --git a/docs/reports/031-worktree-node-modules-link-farm.md b/docs/reports/031-worktree-node-modules-link-farm.md index 67192036..3ac5fac5 100644 --- a/docs/reports/031-worktree-node-modules-link-farm.md +++ b/docs/reports/031-worktree-node-modules-link-farm.md @@ -14,11 +14,12 @@ summary: > `linked worktree add` symlinked `/node_modules` to the main checkout's. Vite loaded the worktree's `packages-local/` checkouts through its workspace table (`doctor resolve`: `overlay`), -but `tsc` and Node followed the symlink to the main checkout's copies. Measured in a CN worktree +but `tsc` and Node followed the symlink to the main checkout's copies. Measured in a host app worktree with a primitives worktree that adds `@_linked/primitives/components/RelativeTime`: `npm run typecheck:gate` → 17 new `TS2307 Cannot find module '@_linked/primitives/components/RelativeTime'`. Building the primitives worktree with `linked build` failed with `TS2742 The inferred type of 'Menu' -cannot be named without a reference to '../../../../../../create_now/node_modules/@radix-ui/react-context/dist'`. +cannot be named without a reference to '../../../../../../
/node_modules/@radix-ui/react-context/dist'` +(`
` being the main checkout). ## Design @@ -67,14 +68,14 @@ fixes every resolver at once without an install, so: ## Gate -On the CN worktree `wt/ontology-mgr` (primitives and cli worktrees), after `linked worktree relink`: +On a host app worktree `wt/ontology-mgr` (primitives and cli worktrees), after `linked worktree relink`: - `npm run typecheck:gate` → `No new type errors. 0 pre-existing errors still in the baseline.` - `doctor resolve` → `@_linked/primitives ontology-mgr/packages-local/_linked-primitives ontology-mgr/packages-local/_linked-primitives yes` (no flag), `@_linked/cli external ontology-mgr/packages-local/_linked-cli no`, exit 0. - `npx linked build` in the primitives worktree → `✔ Build successful`; `Menubar.d.ts` imports `import("@radix-ui/react-context")`, as the main checkout's build does. -- `npx vitest run src/features/document-studio/components/DocumentHistory.test.tsx` → `Tests 5 passed (5)`. +- `npx vitest run` on one of the app's component tests → `Tests 5 passed (5)`. - Backend restarted on :4310: `/models/ontologies` → `200`, no `Cannot find module` in the log. - The main checkout: `git status --short` empty, `node_modules` listing unchanged. - `npm run test:unit` → all suites pass. diff --git a/docs/reports/032-linked-kind-helper.md b/docs/reports/032-linked-kind-helper.md index da021798..c9e193af 100644 --- a/docs/reports/032-linked-kind-helper.md +++ b/docs/reports/032-linked-kind-helper.md @@ -4,12 +4,12 @@ summary: > One helper, `linkedKind(json)` (`@_linked/cli/installed-packages`, twin in `@_linked/server/utils/linkedDependencies`), decides what a `package.json` is from `linked.kind` (`app`, `ontology`, `assets`, `library`); every reader in the CLI, the server and - CN uses it and none reads `linkedPackage` / `linkedApp`, except CN's reader of an app clone's - npm-installed packages until the release. Scaffolds and both app identity stampers write - `linked.kind`. Step LK of CN master plan 057; landed with RK (report 033). Minor. + the host app uses it and none reads `linkedPackage` / `linkedApp`, except the app's reader of an + app clone's npm-installed packages until the release. Scaffolds and both app identity stampers + write `linked.kind`. A step of the host app's plan; landed with report 033. Minor. --- -# 032 — `linked.kind` through one helper (LK) +# 032 — `linked.kind` through one helper ## PR @@ -18,8 +18,8 @@ summary: > What a package is comes from `"linked": {"kind": …}` alone. `linkedKind(json)` returns `'app' | 'ontology' | 'assets' | 'library' | undefined`; a linked package is any kind but `app` (`isLinkedPackageJson`, now defined on top of it). `linkedPackage: true` and `linkedApp: true` are -no longer read. Everything the CLI and CN scaffold writes the kind. Landed back to back with RK -(report 033), which gave every `package.json` of the CN tree its kind. +no longer read. Everything the CLI and the host app scaffold writes the kind. Landed back to back +with report 033, which gave every `package.json` of the app's tree its kind. ### Changes @@ -35,44 +35,44 @@ no longer read. Everything the CLI and CN scaffold writes the kind. Landed back `applyAppIdentity` drops a template's `linkedApp` and merges `linked.kind: "app"`. - **server** (report 020): the twin helper, boot loading by kind, `discoverLinkedDependencies` takes an optional `isLinked` test. -- **CN**: `stampAppIdentity` drops `linkedApp`, merges `linked.kind: "app"`, refuses a template - whose kind is set and not `app`; `appPackagesOf` (`src/backend/gateway/graphAccess.ts`) accepts - `linked.kind` or `linkedPackage: true` (master decision, below); CN tests; arch-02, 03, 06 and - the Lego how-to name `linked.kind`. +- **the host app**: its app identity stamper drops `linkedApp`, merges `linked.kind: "app"`, refuses + a template whose kind is set and not `app`; its reader of an app clone's packages accepts + `linked.kind` or `linkedPackage: true` (master decision, below); its tests; its architecture docs + and a how-to name `linked.kind`. - Tests: new `tests/unit/linkedKind.test.ts`; `packageFiles` keeps an existing `linked` key; `createApp.identity` turns `linkedApp: true` into the kind; every fixture and test that wrote the old flags writes `linked.kind`. `tests/template/package.full.test.ts` now replaces the scaffold's installed CLI `lib`/`hooks` with this repo's, as the react-native one already did. - README §Package kinds (was §Package flags) and the create-package/build sections. -- Contract K-kind (sub-plan 002, CN 057, CN 180) records the helper's path, the twin and the - optional `isLinked` argument. +- Contract K-kind (sub-plan 002 and the host app's plans) records the helper's path, the twin and + the optional `isLinked` argument. ### Verification -Run in worktree `/Users/rene/web/wt/lk` with RK applied, rebased on `dev`. +Run in a worktree with report 033's change applied, rebased on `dev`. - Verify grep (`\.linkedPackage\b|linkedPackage ?(===|:) ?true|"linkedPackage"|linkedApp`) in - cli `src defaults`, server `src` (outside tests) and CN `src` (outside tests): only comments - that say the old field is not read, the two stampers' `delete pkg.linkedApp`, and CN's - `appPackagesOf` fallback with its comment. -- cli `npm run test:unit` (rebased on CK's core): `Test Suites: 92 passed, 92 total` / + cli `src defaults`, server `src` (outside tests) and the host app's `src` (outside tests): only + comments that say the old field is not read, the two stampers' `delete pkg.linkedApp`, and the + app's clone-package reader's fallback with its comment. +- cli `npm run test:unit` (rebased on the latest core change): `Test Suites: 92 passed, 92 total` / `Tests: 1081 passed, 1081 total`, 56 s. - cli `npm run test:template`: `Test Suites: 2 passed, 2 total` / `Tests: 22 passed, 22 total`, 1:22. - cli `npx linked build`: `✔ Build successful`, 8 s. -- server: see report 020 (one test known to fail on `dev` since CK's core change). -- CN: see report 033 (`typecheck:gate` and `CN_TEST_PORT=4342 npm run test:regular`). +- server: see report 020 (one test known to fail on `dev` since a core change). +- The host app: see report 033 (its typecheck gate and its regular test set). - `planBuildAll` / `getLincdPackages` / `discoverLinkedDependencies` over the worktree list the same 27 / 27 / 26 packages as the main checkout before landing (old flags, old CLI). ### Deviations -- **CN's npm fallback** (master decision in 057): `discoverLinkedDependencies(appDir, pkg, - isLinked?)` gained an optional third parameter; only `appPackagesOf` passes one, accepting +- **The host app's npm fallback** (master decision): `discoverLinkedDependencies(appDir, pkg, + isLinked?)` gained an optional third parameter; only the app's clone-package reader passes one, accepting `linkedPackage: true` too. The server itself reads only the kind. - **Twin by comment**, not by test: the copies are byte-identical between `// linkedKind: twin of …` and `// end of the linkedKind twin.` markers. A cross-repo source-text test could only run in - the CN tree (CI checks out one repo). + the app's tree (CI checks out one repo). - The stampers name `linkedApp` once each, to delete it from a template that still carries it. - `shapeHierarchy.ts`'s `name.startsWith('@_linked/') ||` fallback removed: neither the unit suite nor `test:template` (which builds against npm-installed `@_linked/*`) needed it. @@ -82,8 +82,8 @@ Run in worktree `/Users/rene/web/wt/lk` with RK applied, rebased on `dev`. ### Follow-ups -- Remove the `linkedPackage` fallback in graphAccess after the release republishes every - package — CN plan 180 §WU. +- Remove the `linkedPackage` fallback in the host app after the release republishes every + package — recorded in the app's plan. - The worktree link farm points the app's own workspace members at the main checkout — cli backlog 011. @@ -95,4 +95,4 @@ Run in worktree `/Users/rene/web/wt/lk` with RK applied, rebased on `dev`. the template is already in that form, so `create-package`'s output is unchanged apart from the kind. - `create-app` keeps working with today's published `linked-fw/app-template` - (`linkedApp: true`): the stamp turns it into the kind. The template's own branch is RK's. + (`linkedApp: true`): the stamp turns it into the kind. The template's own change is report 033's. diff --git a/docs/reports/033-linked-kind-in-every-package.md b/docs/reports/033-linked-kind-in-every-package.md index 2871df1f..09332023 100644 --- a/docs/reports/033-linked-kind-in-every-package.md +++ b/docs/reports/033-linked-kind-in-every-package.md @@ -1,46 +1,46 @@ --- date: 2026-10-27 summary: > - Every `package.json` of the CN tree says what it is in `linked.kind` (CN root, `packages/*`, - the 23 `_linked-*` checkouts and `semantu-webid-email`), the old `linkedPackage` / `linkedApp` - flags gone; a local `dev` branch of `linked-fw/app-template` does the same (not pushed). One - changeset per framework repo; pg-cn backlog 014. Step RK of CN master plan 057, landed right - after LK (report 032). Patch (cli and server: minor, with LK). + Every `package.json` of the host app's tree says what it is in `linked.kind` (the app's root, + `packages/*`, the 23 `_linked-*` checkouts and `semantu-webid-email`), the old `linkedPackage` / + `linkedApp` flags gone; a local `dev` branch of `linked-fw/app-template` does the same (not + pushed). One changeset per framework repo; a backlog item in another app. A step of the host + app's plan, landed right after report 032. Patch (cli and server: minor, with report 032). --- -# 033 — `linked.kind` in every `package.json` (RK) +# 033 — `linked.kind` in every `package.json` ## PR ### Summary -With LK the CLI and server read only `linked.kind`; RK gives every `package.json` they read its -kind, so the owner's CN loads exactly what it loaded before. Each file was rewritten by a script +With report 032 the CLI and server read only `linked.kind`; this change gives every `package.json` +they read its kind, so the owner's app loads exactly what it loaded before. Each file was rewritten by a script that keeps key order: `linked` takes the old flag's place, or `kind` goes first in an existing `linked` object (server, server-utils `serverOnly`). ### Changes -- `app`: CN root, `packages/my-app`, `packages-local/semantu-webid-email`, app-template. -- `library`: CN `packages/{access,documents,maps,execution-gateway}`; `_linked-{auth,cli,core, +- `app`: the host app's root, `packages/my-app`, `packages-local/semantu-webid-email`, app-template. +- `library`: the app's `packages/{access,documents,maps,execution-gateway}`; `_linked-{auth,cli,core, css,fuseki,icons,primitives,react,s3,sentry,server,server-utils,shape-ui,translation}`. - `ontology`: `_linked-{dcat,dcmi,npm,org,owl,rdfs,schema,sioc,xsd}` (`npm` carried both the - kind and `linkedPackage: true` from CK; the flag is gone). + kind and `linkedPackage: true` from an earlier step; the flag is gone). - `packages/editor-chrome`: left unmarked; it has no build script and nothing reads it as a linked package. - The 14 checkouts not on `dev` (css, dcmi, icons, org, owl, rdfs, react, s3, schema, sentry, shape-ui, sioc, translation, xsd) joined it (`npx linked branch start dev … --target main`). -- `linked-fw/app-template`: cloned to `/Users/rene/web/app-template`, branch `dev` from `main` +- `linked-fw/app-template`: cloned locally, branch `dev` from `main` (3eb6652), commit c6b87dd: `package.json` `"linked": {"kind": "app"}`, the readme and the `pr.yml` comment. Not pushed; the release opens its PR. - A changeset (`.changeset/linked-kind.md`) in each of the 23 framework repos: patch, except cli - and server (minor, LK's). -- pg-cn: backlog 014 (`docs/backlog/014-linked-kind-in-package-json.md`), committed on pg-cn's - local `main` (4a08b66e) through a temporary worktree; no package changes. + and server (minor, report 032's). +- Another app: a backlog item for its kinds, committed on its local `main` through a temporary + worktree; no package changes. ### Verification -- `git grep -nE '"linkedPackage"|"linkedApp"' -- '*package.json'` in CN and every +- `git grep -nE '"linkedPackage"|"linkedApp"' -- '*package.json'` in the host app and every `packages-local/` checkout, and in the template's `dev`: no output. - No lockfile changed (`package-lock.json` records neither flag). - `planBuildAll` / `getLincdPackages` / `discoverLinkedDependencies` over the worktree (new CLI @@ -48,43 +48,42 @@ that keeps key order: `linked` takes the old flag's place, or `kind` goes first identical lists (27 built, 3 skipped with the same reasons, 27 workspace linked packages, 26 boot dependencies). - Worktree `npx linked build-all`: `Successfully built:` 27 packages, 55 s. -- CN `npm run typecheck:gate`: `No new type errors. 0 pre-existing errors still in the baseline.` -- CN `CN_TEST_PORT=4342 npm run test:regular` on the landed tree (after Fuseki was restarted): +- The host app's typecheck gate: `No new type errors. 0 pre-existing errors still in the baseline.` +- The host app's regular test set on the landed tree (after Fuseki was restarted): `typecheck:gate PASS 16s`, `unit (vitest) PASS 60s` (`Tests 2968 passed | 5 skipped (2973)`), `packages PASS 6s`, `playwright (integration + sign-in e2e) FAIL 247s` — `1 failed`, `1 flaky`, - `14 skipped`, `331 passed (4.1m)`; total 5:28. The one failure, - `app-gateway-user-token.spec.ts:168` (`expect(lines).toHaveLength(5)` / `Received length: 1`), counts - gateway audit lines on CN's stdout: the other four were printed unprefixed in the same instant, - and its retry hit the first attempt's leftover dataset. Alone it passes: - `CN_TEST_PORT=4342 npx playwright test tests/integration/app-gateway-user-token.spec.ts` → - `7 passed (25.8s)`. Before the rebase onto CK's core the whole set passed (`336 passed`, + `14 skipped`, `331 passed (4.1m)`; total 5:28. The one failure, a gateway user-token spec + (`expect(lines).toHaveLength(5)` / `Received length: 1`), counts gateway audit lines on the + app's stdout: the other four were printed unprefixed in the same instant, and its retry hit the + first attempt's leftover dataset. Alone it passes: `7 passed (25.8s)`. Before the rebase onto + the latest core change the whole set passed (`336 passed`, `total PASS 329s`); a run in between failed on Fuseki running out of heap (`java.lang.OutOfMemoryError`) under concurrent test runs, not on this change. -- CN quick gate (`vitest` appTemplateIdentity, appProjectPackages, graphAccess, - ProjectCreationOrchestrator): `Test Files 4 passed (4)` / `Tests 123 passed | 2 skipped (125)`. +- The host app's quick gate (four Vitest files on app identity, project packages, graph access + and project creation): `Test Files 4 passed (4)` / `Tests 123 passed | 2 skipped (125)`. ### Deviations -- `@_linked/npm` was added to RK's list: CK landed it on `dev` with `linkedPackage: true` beside - its kind. -- The worktree's link farm pointed CN's own `packages/*` at the main checkout, so the worktree's - boot walk first lost the four `library` members; the links were pointed at the worktree by hand +- `@_linked/npm` was added to this step's list: an earlier step landed it on `dev` with + `linkedPackage: true` beside its kind. +- The worktree's link farm pointed the app's own `packages/*` at the main checkout, so the + worktree's boot walk first lost the four `library` members; the links were pointed at the worktree by hand for the run (cli backlog 011). -- The template's `APP_TEMPLATE_DIR` case of `appProjectPackages.test.ts` fails against the +- The template's `APP_TEMPLATE_DIR` case of the app's project-package test fails against the current template (its `workspaces` now lists `packages-local/*` too); that is not this change and the case is skipped in the regular run. ### Follow-ups -- pg-cn's and the `@linked.cm/*` packages' kinds — pg-cn backlog 014. +- Another app's and the `@linked.cm/*` packages' kinds — that app's backlog. - The release republishes every `@_linked/*` package with its kind and opens the template's PR - from its local `dev` (CN plan 057 §Wrap-up and deployment); then the graphAccess fallback goes - (CN plan 180 §WU). + from its local `dev` (the host app's plan §Wrap-up and deployment); then the app's + `linkedPackage` fallback goes. - Worktree link farm and the app's own workspace members — cli backlog 011. ## Details - The rewrite script parsed and re-serialised each file with two-space indent and a trailing newline; the diffs are the flag line and the new `linked` lines only. -- Main-checkout check after landing: see the master's report (rebuild, `curl :4040`, the CN +- Main-checkout check after landing: see the master's report (rebuild, `curl :4040`, the app's backend log's ontology and shape graph sync counts). diff --git a/docs/reports/034-linked-checkout.md b/docs/reports/034-linked-checkout.md index ea8deac9..c542b504 100644 --- a/docs/reports/034-linked-checkout.md +++ b/docs/reports/034-linked-checkout.md @@ -6,10 +6,10 @@ summary: > `linked branch merge --into [--mode push|update]`, `linked worktree remove --branch`, `linked localize --listed`, the `unpublishedPackages(json)` reader and transitive walk, list edges in `dependencyOrder`, and credentials only through `LINKED_GIT_TOKEN` (askpass, helpers - and hooks off, never on disk, never in an install). Step CO of CN master plan 057. Minor. + and hooks off, never on disk, never in an install). A step of the host app's plan. Minor. --- -# 034 — `linked checkout`, `branch fork`, `branch merge` (CO) +# 034 — `linked checkout`, `branch fork`, `branch merge` ## PR @@ -52,9 +52,9 @@ checkout up once landed. A private repo's token comes only from the environment. - Docs: `README.md`, `docs/integration-branches-and-worktrees.md` (§`linked branch fork`, §`linked branch merge`, §`linked worktree remove --branch`, §`linked checkout`, §Limitations), `docs/localize.md` (§Commands, §Unpublished packages, §Docker and CI, §What it - never does, §Exit codes). Sub-plan 002: K-checkout and K-unpublished final, CO ticked. CN (same - landing): arch-03 §Local development, `docs/how-to/develop-a-linked-package-locally.md`, - K-checkout and K-unpublished in plans 057 and 180. + never does, §Exit codes). Sub-plan 002: K-checkout and K-unpublished final, this step ticked. + The host app (same landing): its architecture docs, its how-to on developing a linked package + locally, and K-checkout and K-unpublished in its plans. - Changeset `.changeset/linked-checkout.md` (minor). semantu-agents PR https://github.com/Semantu/agents/pull/29 (workflow, wrapup). @@ -65,8 +65,8 @@ checkout up once landed. A private repo's token comes only from the environment. - `npm run test:unit`: before `Tests: 1081 passed` (with a built `lib/`); after `Test Suites: 97 passed, 97 total` / `Tests: 1126 passed, 1126 total`, 44 s wall. - `npm run test:template`: `Test Suites: 2 passed, 2 total` / `Tests: 22 passed, 22 total`, 79 s. -- CN `npm run typecheck:gate`: `No new type errors. 0 pre-existing errors still in the baseline.` - (15 s). CN's regular set not run: CN changed only docs. +- The host app's typecheck gate: `No new type errors. 0 pre-existing errors still in the baseline.` + (15 s). Its regular set not run: the app changed only docs. - `npm run build`; `node lib/esm/launch.js checkout --help`, `branch fork --help`, `branch merge --help`, `worktree remove --help` show the flags recorded in K-checkout. - No token on disk: every e2e case ends with `assertNoToken(root)`, which reads every `config` / @@ -124,12 +124,12 @@ checkout up once landed. A private repo's token comes only from the environment. refuses, even with `--force`, while `packages-local/` holds anything that is not a package worktree of the checkout; `origin/HEAD` set on every run; a new app branch a failed run left unpushed (no recorded upstream) is pushed by the re-run. -- K-checkout and K-unpublished were updated in 002, 057 and 180 in this landing. +- K-checkout and K-unpublished were updated in sub-plan 002 and the host app's plans in this landing. ### Follow-ups -- `linked checkout` takes no lock; a squash merge reads as not landed; CO's by-hand check with - a real installation token was not run — all three homed in CN sub-plan 180 §BC (Known files +- `linked checkout` takes no lock; a squash merge reads as not landed; the by-hand check with + a real installation token was not run — all three homed in the host app's plan (Known files and pitfalls), and the first two in K-checkout. ## Details diff --git a/docs/reports/035-minimatch-import-and-unbuilt-dependencies.md b/docs/reports/035-minimatch-import-and-unbuilt-dependencies.md index 296c2c3d..dab8c3c4 100644 --- a/docs/reports/035-minimatch-import-and-unbuilt-dependencies.md +++ b/docs/reports/035-minimatch-import-and-unbuilt-dependencies.md @@ -90,8 +90,9 @@ Tests: 1127 passed, 1127 total `linked build` of the cli: `✔ Build successful` (every check step green). `tsc --noEmit`: clean. -CN `npm run test:regular` in a CN worktree of `dev` (`bb8f5d8bd`) whose `@_linked/cli` resolves to -the main checkout's cli built at `0e228d8` (`CN_TEST_PORT=4166`, under the shared lock), 389 s: +The host app's `npm run test:regular` in a worktree of its `dev` (`bb8f5d8bd`) whose `@_linked/cli` +resolves to the main checkout's cli built at `0e228d8` (on its own test port, under the shared +lock), 389 s: ``` 14 skipped diff --git a/docs/reports/036-base-clone-lock.md b/docs/reports/036-base-clone-lock.md index a6c80629..32c9732b 100644 --- a/docs/reports/036-base-clone-lock.md +++ b/docs/reports/036-base-clone-lock.md @@ -4,8 +4,8 @@ summary: > One lock per base clone: `linked checkout`, `branch fork`, `branch push`, `branch merge` and `worktree remove --branch` take a shared base clone's `linked.lock` around their git work on that repo, one repo at a time; a waiter is refused after 120 s naming the holder, a dead holder's lock - is taken over; a new base clone is cloned beside its place and renamed in. Patch. Step SU of CN - master plan 057 (with server report 022). + is taken over; a new base clone is cloned beside its place and renamed in. Patch. A step of the + host app's master plan (with server report 022). --- # 036 — One lock per base clone @@ -16,7 +16,7 @@ summary: > A package's bare base clone (`/.repos//.git`) is the git dir of that package's worktree in every app checkout that lists it, but callers only serialised runs per app (K-checkout, -CN backlog 193 §7). Two apps listing one package could fetch, add worktrees or move refs in it at +and a backlog item of the host app). Two apps listing one package could fetch, add worktrees or move refs in it at once and fail on git's ref or `index.lock`. Each base clone now has its own lock. ### Changes @@ -41,7 +41,7 @@ once and fail on git's ref or `index.lock`. Each base clone now has its own lock - Options `lock?: RepoLockOptions` on `CheckoutOptions`, `CheckoutRemoveOptions`, `ForkOptions`, `PushOptions`, `MergeOptions` (tests use short waits). - Docs: `docs/integration-branches-and-worktrees.md` §One run per base clone at a time; K-checkout's - "callers serialise per app" in sub-plan 002 and in CN plans 057, 180 and 200. + "callers serialise per app" in sub-plan 002 and in the host app's plans. - Tests `tests/unit/checkout/repo-lock.test.ts` (7): held while running and removed after (also on a throw); re-entry; waiting for a holder that releases; refusal after the wait naming the holder; a dead holder taken over, another host's never; `checkout`, `fork`, `push`, `merge` and @@ -57,8 +57,8 @@ once and fail on git's ref or `index.lock`. Each base clone now has its own lock Tests: 1135 passed, 1135 total ``` - `npm run build`: compiled, copied, chmod (3 s). -- CN regular set on the step's CN worktree (rebased on `dev` 417e89222, `CN_TEST_PORT=4359`, under - the shared slot lock), one run for the step (server and cli): +- The host app's regular set on the step's worktree of the app (rebased on `dev` 417e89222, on its + own test port, under the shared slot lock), one run for the step (server and cli): ``` test:regular typecheck:gate PASS 13s @@ -67,8 +67,8 @@ once and fail on git's ref or `index.lock`. Each base clone now has its own lock playwright (integration + sign-in e2e) PASS 242s (355 passed, 16 skipped, 4.0m) total PASS 320s ``` -- The end-to-end check (server report 022) ran `linked checkout` through CN's project creation - against real GitHub: base clones made by rename, the app on `change-1`, both packages detached at +- The end-to-end check (server report 022) ran `linked checkout` through the host app's project + creation against real GitHub: base clones made by rename, the app on `change-1`, both packages detached at `origin/main`, then the save's `branch fork` of the ontology package. ### Deviations @@ -77,17 +77,17 @@ once and fail on git's ref or `index.lock`. Each base clone now has its own lock in the same shared base clones as the four commands named in the step. - The lock is held per repo rather than for the whole run (one lock at a time, so no deadlock); a caller still serialises the runs of one app checkout, whose worktrees and files are not locked. - K-checkout updated in sub-plan 002 and CN 057/180/200. + K-checkout updated in sub-plan 002 and the host app's plans. ### Follow-ups -None new. CN backlog 193 §7's base-clone item is removed. +None new. The base-clone item is removed from the host app's backlog. ## Details - The lock lives in the base clone, so it needs the base clone first; cloning beside and renaming makes the clone atomic, so no run ever locks or worktrees a half-made one. -- Waiting blocks the thread (`Atomics.wait`), which is right for these sync git runs; a CN calling +- Waiting blocks the thread (`Atomics.wait`), which is right for these sync git runs; a host app calling the cli runs it as a child process, so its event loop is not held. - A pid reused by an unrelated process makes a stale lock look alive until the wait ends; the refusal names the file to delete. diff --git a/docs/reports/037-checkout-add.md b/docs/reports/037-checkout-add.md index 7a3e8909..338f3e08 100644 --- a/docs/reports/037-checkout-add.md +++ b/docs/reports/037-checkout-add.md @@ -3,8 +3,8 @@ date: 2026-10-28 summary: > `linked checkout --add ` (repeatable): one more package worktree in the app checkout's `packages-local/` that no list names, by the same branch rule and base clone lock, - marked `added`, never a reason to install and never built. Minor. For Create Now plan 070 step - NO (editing a workspace ontology the app does not use), CN report 210. + marked `added`, never a reason to install and never built. Minor. For a step of the host app's + plan (editing a workspace ontology the app does not use). --- # 037 — `linked checkout --add` @@ -13,8 +13,8 @@ summary: > ### Summary -Create Now edits a workspace ontology package that the app does not list in -`linked.unpublishedPackages` (CN plan 070, design choice D-NO2): its worktree goes into the +The host app edits a workspace ontology package that the app does not list in +`linked.unpublishedPackages` (a design choice in its plan): its worktree goes into the branch checkout's `packages-local/`, unlisted, so `linked branch fork`, `push` and `merge`, which already take every checkout there, cover it. `linked checkout --add ` places it. @@ -39,7 +39,7 @@ already take every checkout there, cover it. `linked checkout --add ` (repeatable). - `README.md`, `docs/integration-branches-and-worktrees.md` (flag table, **Added packages**), - K-checkout in `docs/plans/002-package-repos-cli-steps.md` (and CN 057, 180, 200). + K-checkout in `docs/plans/002-package-repos-cli-steps.md` (and in the host app's plans). - Tests: two cases in `tests/unit/checkout/checkout.e2e.test.ts`. - Changeset `checkout-add` (minor). @@ -62,11 +62,11 @@ None. ### Follow-ups -None in this repo. CN's use of it: CN report 210. +None in this repo. The host app's use of it is recorded in its own report. ## Details -CN's independent review of the step found the name taken as a directory unchecked (low, fixed in -the second commit) and that the added checkout joins a later install (documented, by design). +The host app's independent review of the step found the name taken as a directory unchecked (low, +fixed in the second commit) and that the added checkout joins a later install (documented, by design). The skills in `semantu-agents` do not describe `linked checkout`, so they need no change. diff --git a/docs/reports/038-nested-app-workspace-root.md b/docs/reports/038-nested-app-workspace-root.md index 983f26c9..ed220d7d 100644 --- a/docs/reports/038-nested-app-workspace-root.md +++ b/docs/reports/038-nested-app-workspace-root.md @@ -3,8 +3,8 @@ date: 2026-10-25 summary: > A directory is a workspace root only when one of its `workspaces` globs matches an existing package. An app listing `packages-local/*` with no checkout of its own, nested in a parent - workspace (webid.email in CN), now resolves the parent's localized `@_linked/*` checkouts as - source instead of loading two copies of `@_linked/core`. Patch. + workspace (webid.email inside a host app), now resolves the parent's localized `@_linked/*` + checkouts as source instead of loading two copies of `@_linked/core`. Patch. --- # 038 — A nested app with an empty `packages-local/*` is not a workspace root @@ -12,11 +12,12 @@ summary: > ## Why An app made from the app template declares `"workspaces": ["packages-local/*"]` so it can -localize packages standalone. Run inside CN's workspace (`create_now/packages-local/semantu-webid-email`) -with no `packages-local/` of its own, its dependencies are hoisted to CN's `node_modules`, whose -`@_linked/*` entries are symlinks into CN's `packages-local/_linked-*`. `isWorkspaceRoot` treated +localize packages standalone. Run inside a host app's workspace +(`
/packages-local/semantu-webid-email`) with no `packages-local/` of its own, its dependencies +are hoisted to the host app's `node_modules`, whose `@_linked/*` entries are symlinks into its +`packages-local/_linked-*`. `isWorkspaceRoot` treated any `package.json` with `workspaces` as a root, so `readInstalledPkg` stopped at the app and never -reached CN's `node_modules`. The Vite plugin registered no linked package as source while Node +reached the host app's `node_modules`. The Vite plugin registered no linked package as source while Node walked up to the checkouts, and the app booted with "2 copies of @_linked/core's shape registry". `linked doctor resolve` from the app printed an empty table; `linked start` watched 1 package. @@ -40,12 +41,12 @@ walked up to the checkouts, and the app booted with "2 copies of @_linked/core's - New tests against the old `src/`: `Tests: 18 failed, 3 passed, 21 total`; with the fix all 21 pass. - `npm run test:unit` (after `npx linked build`): `Test Suites: 91 passed, 91 total`, `Tests: 1066 passed, 1066 total`. `npx tsc -p tsconfig-esm.json --noEmit`: exit 0. -- `doctor resolve` from `create_now/packages-local/semantu-webid-email`: the installed CLI prints +- `doctor resolve` from `
/packages-local/semantu-webid-email`: the installed CLI prints only the header `name vite node bundled flag`; this branch's built CLI lists 12 `@_linked/*` packages, each with `vite` and `node` on the same `_linked-*` checkout and no flag. - `discoverWorkspacePackages` (the HMR watch list) from the same directory: 1 package before, 13 after (the app plus its 12 localized dependencies). -- `doctor resolve` from the CN root: output identical before and after. +- `doctor resolve` from the host app's root: output identical before and after. ## Follow-ups @@ -70,9 +71,9 @@ longer reads; they now use `linked: {kind: 'library'}`. After the rebase, `npm r A directory counts as a workspace root only when one of its `workspaces` globs matches a package that exists. An app that lists `packages-local/*` with no checkout of its own, nested in a parent -workspace (webid.email inside CN), stopped `readInstalledPkg`'s walk at itself: no `@_linked/*` -package was registered as source while Node loaded CN's checkouts, so the app booted two copies of -`@_linked/core`. `isWorkspaceRoot` now requires an existing, non-negated member +workspace (webid.email inside a host app), stopped `readInstalledPkg`'s walk at itself: no +`@_linked/*` package was registered as source while Node loaded the host app's checkouts, so the +app booted two copies of `@_linked/core`. `isWorkspaceRoot` now requires an existing, non-negated member (`hasWorkspaceMembers`), and `discoverLocalPackages` picks its root by the same rule. `findWorkspaceRoot` already climbed to the parent; `doctor resolve`, the Vite resolver table and `start`'s HMR watch list are fixed through `readInstalledPkg`. @@ -82,10 +83,10 @@ package was registered as source while Node loaded CN's checkouts, so the app bo - `tests/unit/nestedWorkspaceRoot.test.ts` against the old `src/`: `Tests: 18 failed, 3 passed, 21 total`; with the fix: 21 passed. - `npm run test:unit`: `Test Suites: 91 passed, 91 total`, `Tests: 1066 passed, 1066 total`. `npx tsc -p tsconfig-esm.json --noEmit`: exit 0. -- `linked doctor resolve` from `create_now/packages-local/semantu-webid-email`: before, only the +- `linked doctor resolve` from `
/packages-local/semantu-webid-email`: before, only the header row; after, 12 rows such as `@_linked/core _linked-core _linked-core yes` with no flag. - HMR watch list from the same app: 1 package before, 13 after. -- `linked doctor resolve` from the CN root: identical before and after. +- `linked doctor resolve` from the host app's root: identical before and after. **Deviations:** `discoverLocalPackages` also changed, so the server's `getLincdPackages` and `build-all` agree with the resolver about the root. **Follow-ups:** `doctor resolve` takes its diff --git a/docs/reports/039-checkout-pins-and-worktree-forks.md b/docs/reports/039-checkout-pins-and-worktree-forks.md index f96ab468..178b44ba 100644 --- a/docs/reports/039-checkout-pins-and-worktree-forks.md +++ b/docs/reports/039-checkout-pins-and-worktree-forks.md @@ -4,8 +4,7 @@ summary: > `linked checkout --pin =` / `--pins-only`, `linked branch fork --worktree [--from ]` and `linked branch push --worktree `: a server checks a package out on a branch it chooses (not the same-name rule) and keeps a package branch in a worktree of its own, - outside every app checkout. Minor. For Create Now plan 225 step OB (ontology working branches), - CN report 261. + outside every app checkout. Minor. For the host app's plan (ontology working branches). --- # 039 — Checkout pins and worktree forks @@ -14,7 +13,7 @@ summary: > ### Summary -Create Now decouples ontology package branches from app branches (CN plan 225, decision G): a +The host app decouples ontology package branches from app branches (a decision in its plan): a person's working branch of an ontology (`{userSlug}/{topic}`) lives in a worktree of its own, and app branches use it by a pin. The same-name rule was the cli's (`packageBranch`, used by `linked checkout`), so the cli gains: @@ -57,7 +56,7 @@ checkout`), so the cli gains: - The whole unit suite after a build (`linked build`): `Tests: 1165 passed` before the review fixes; the two suites that read `lib/` (`shapeHierarchy`, `ontologyDataReachable`) fail without a build, as on `dev`. -- CN's suites run this cli through `node_modules/.bin/linked` (CN report 261). +- The host app's suites run this cli through `node_modules/.bin/linked` (its own report). ### Deviations @@ -65,12 +64,12 @@ checkout`), so the cli gains: (`--dir`), as `branch fork` does, rather than taking a base clone path. - A pin whose branch origin lacks falls back to the default branch (with a message) instead of refusing: a merged and deleted working branch is in `main`. -- From CN's review: `--worktree` prunes deleted worktrees, fast-forwards a stale local branch, and - takes the branch from a clean, pushed app checkout's package worktree that holds it. +- From the host app's review: `--worktree` prunes deleted worktrees, fast-forwards a stale local + branch, and takes the branch from a clean, pushed app checkout's package worktree that holds it. ### Follow-ups -None in this repo. Deleting merged working branches: CN backlog 268. +None in this repo. Deleting merged working branches: the host app's backlog. ## Details @@ -78,14 +77,14 @@ The pins mode moves a worktree only when `git for-each-ref --contains HEAD refs/ names a branch, so no commit becomes unreachable. A held pin is detached at `origin/`, never `git worktree add --force`. The skills in `semantu-agents` do not describe these flags. -## Addendum — after CN's independent review (patch) +## Addendum — after the host app's independent review (patch) - **A pin to another branch than the run's is always detached** at `origin/`: that branch (an ontology working branch) is written only in its own worktree, so no app checkout holds it. A pin to the run's own branch (a code-sync fork) stays attached. This removes the case where a pinned checkout took the branch while its worktree was absent. -- **`branch fork --worktree` detaches no other checkout any more** (that raced CN's lock of that - app); a branch another worktree holds is refused, as before the first review round. +- **`branch fork --worktree` detaches no other checkout any more** (that raced the host app's lock + of that app); a branch another worktree holds is refused, as before the first review round. - **`--from` starting with `-` is refused** (exit 2), and `rev-parse` gets `--end-of-options`. - Changeset `pinned-checkouts-read-only` (patch). Verification: `tests/unit/checkout` 59 passed; the whole unit suite `Tests: 1166 passed, 1166 total` after a build. diff --git a/docs/reports/040-master-worktrees.md b/docs/reports/040-master-worktrees.md index f5404deb..c6a31683 100644 --- a/docs/reports/040-master-worktrees.md +++ b/docs/reports/040-master-worktrees.md @@ -78,9 +78,8 @@ Local webid.email accepts sign-ins from preview ports: it signs in any client on 4000-4999 (`semantu-webid-email/src/oidc/devClients.ts:78` `DEFAULT_DEV_CLIENT_PORTS = {min: 4000, max: 4999}`, applied in `src/oidc/clientResolver.ts:172-176`; overridable with `DEV_CLIENT_PORTS`, unset in its `.env`) and fetches the client's own Client ID Document from -`http://localhost:/.well-known/linked-client.jsonld`. CN derives `client_id` and -`redirect_uri` from `SITE_ROOT` (`src/backend/auth/webIdSignin.ts`, `cnSigninClient(siteRoot)`), -so a preview with `WEBID_MODE=local` and `SITE_ROOT=http://localhost:45k0` (what the printed +`http://localhost:/.well-known/linked-client.jsonld`. The host app derives `client_id` and +`redirect_uri` from `SITE_ROOT`, so a preview with `WEBID_MODE=local` and `SITE_ROOT=http://localhost:45k0` (what the printed command sets) works. `WEBID_MODE=production` still only works on 4040 (`DEV_CLIENT_SITE_ROOT`). Read from the config, not run. @@ -105,7 +104,7 @@ Read from the config, not run. port-allocation lock (two concurrent `start --worktree` can pick the same slot): this report (cli backlog when scheduled). - The two-copies case for steps is warned, not prevented; `doctor resolve` could flag it. -- Skills and CN `CLAUDE.md`: proposed changes below, for the owner to apply (not edited here). +- Skills and the host app's `CLAUDE.md`: proposed changes below, for the owner to apply (not edited here). #### Proposed skill and CLAUDE.md changes @@ -130,11 +129,11 @@ Read from the config, not run. worktree; closing line variant "Landed on ``; preview at :45k0". - **release**: unchanged mechanics; add that `land` (master → owner's branch) is not a release, and that a master started from `dev` releases through `dev`. -- **CN CLAUDE.md §Git**: replace "Checkouts stay on the current integration branch…" with "The - owner's checkouts stay on his stable branch (`dev`); a master run lives in `../wt/` (`npx +- **The host app's CLAUDE.md §Git**: replace "Checkouts stay on the current integration + branch…" with "The owner's checkouts stay on his stable branch (`dev`); a master run lives in `../wt/` (`npx linked branch start --worktree --with …`), its steps in `../wt/--` (`npx linked worktree add --from `), and it lands into the owner's checkouts only on his approval (`npx linked branch land `, which merges, fast-forwards, builds and pushes)". In "Running a second backend": add `SITE_ROOT=http://localhost:` (now printed by every `worktree add`), - and that CN's built `packages/*` resolve to the worktree's copy after a build plus `linked + and that the app's built `packages/*` resolve to the worktree's copy after a build plus `linked worktree relink` (unbuilt ones still show as `overlay`, Vite only). diff --git a/docs/reports/041-master-worktrees-part-one.md b/docs/reports/041-master-worktrees-part-one.md index 97ec5887..ca72f735 100644 --- a/docs/reports/041-master-worktrees-part-one.md +++ b/docs/reports/041-master-worktrees-part-one.md @@ -6,7 +6,7 @@ summary: > port registry (`/master-ports.json`), released by `worktree remove `; `withRepoLockAsync`, `linkedHome`, `withMachineLockAsync`; `worktree relink --all`; `branch list`; `branch add-package ` (with `addPackageWorktree` extracted from - `createWorktreeSet`). Minor. Step CL of CN plan 282, sub-plan 004. + `createWorktreeSet`). Minor. Part of the host app's plan; sub-plan 004 §CL. --- # 041 — Master worktrees, part one @@ -18,8 +18,8 @@ summary: > Two masters started at the same time, in one app or in two, no longer take the same preview port. After an `npm install` in the main checkout, one command relinks every worktree of the app. One command lists the app's integration branches and masters. A framework package can join a running -master by command. This is step CL of CN plan 282 (sub-plan [004](../plans/004-hub-imports-cli.md) -§CL, contract KC) and the first part of backlog [013](../backlog/013-master-worktrees-remaining.md). +master by command. This is a step of the host app's plan (sub-plan +[004](../plans/004-hub-imports-cli.md) §CL, contract KC) and the first part of backlog [013](../backlog/013-master-worktrees-remaining.md). 013 is trimmed to what is still left. ### Changes @@ -81,9 +81,9 @@ master by command. This is step CL of CN plan 282 (sub-plan [004](../plans/004-h ### Verification -Run in `/Users/rene/web/wt/hub-imports--cl/packages-local/_linked-cli`. +Run in `../wt/hub-imports--cl/packages-local/_linked-cli`. -The build: `/Users/rene/web/create_now/node_modules/.bin/linked build`. `npx linked build` finds no +The build: `
/node_modules/.bin/linked build` (`
` being the app's main checkout). `npx linked build` finds no `linked` bin in a fresh cli worktree; see Deviations. ``` @@ -91,7 +91,7 @@ The build: `/Users/rene/web/create_now/node_modules/.bin/linked build`. `npx lin ✔ Checking sideEffects ✔ Checking dependencies ✔ Build successful -/Users/rene/web/create_now/node_modules/.bin/linked build 10.35s user 1.24s system 92% cpu 12.582 total +
/node_modules/.bin/linked build 10.35s user 1.24s system 92% cpu 12.582 total ``` `npx tsc --noEmit -p tsconfig.json` printed no errors. @@ -194,13 +194,13 @@ $ cat $LINKED_HOME/master-ports.json ``` **The running master `hub-imports` read with the built bin.** These are read-only commands, run in -`/Users/rene/web/create_now` with the real `LINKED_HOME`: +the app's main checkout with the real `LINKED_HOME`: ``` $ linked branch list BRANCH KIND TARGET REPOS WORKTREE PORT DATASET STEPS -hub-imports master dev app, _linked-cli, _linked-core, _linked-react, _linked-server /Users/rene/web/wt/hub-imports 4520 - 3 -side-225 master dev app /Users/rene/web/wt/side-225 4510 - 3 +hub-imports master dev app, _linked-cli, _linked-core, _linked-react, _linked-server ../wt/hub-imports 4520 - 3 +side-225 master dev app ../wt/side-225 4510 - 3 dev integration main app, _linked-auth, _linked-cli, _linked-core, … (+20) (checkouts) - - - $ linked branch list --json → hub-imports: port 4520, target dev, 5 repos each with its worktree, steps ["cl","hi","sy"]; otherPorts [] $ linked worktree list → Master hub-imports (target dev, preview http://localhost:4520), steps cl, hi, sy; Master side-225 (4510) … (exit 0) @@ -208,7 +208,7 @@ $ linked branch status → Integration branch: dev (target main), rows as $ ls -d ~/.linked → No such file or directory (nothing was written) ``` -Not run: `npm run test:e2e` (Docker), and CN's tests (no CN change). +Not run: `npm run test:e2e` (Docker), and the host app's tests (no change in the app). ### Deviations from the plan @@ -218,14 +218,15 @@ Not run: `npm run test:e2e` (Docker), and CN's tests (no CN change). - **`relink --all` leaves a worktree with an install of its own as it is**, with code 0 and one line saying so. A plain `relink` refuses such a worktree (exit 1). Under `--all` that would make every run fail once one master has its own install. KC in sub-plan 004 is updated to say so. -- **`branch list` names at most five repos in a text row** (`… (+n)`). CN's `dev` lists 24 repos. +- **`branch list` names at most five repos in a text row** (`… (+n)`). The host app's `dev` lists 24 + repos. The JSON keeps all of them. KC is updated. - **`add-package`**: the refusal when a step has a worktree of the package (named in the Pitfalls) and what happens when a relink fails afterwards (the worktrees stay, exit 1) are added to KC. - **The `--port` refusal and the free-port choice now run after the per-repo checks**, inside the lock, so a run with several problems lists the repo problems first. -- **The build** used `/Users/rene/web/create_now/node_modules/.bin/linked build`. In a fresh cli +- **The build** used `
/node_modules/.bin/linked build`. In a fresh cli worktree, `npx linked build` reports `sh: linked: command not found`: the farm's `.bin/linked` points at that same unbuilt CLI. This is recorded in backlog 013. @@ -254,7 +255,7 @@ Not run: `npm run test:e2e` (Docker), and CN's tests (no CN change). - Existing masters stay readable. A master started before this change is recorded only in its app's git config, which `freeMasterPort` and `--port` still read. So `hub-imports` (4520) and - `side-225` (4510) keep their ports, and a new master in CN gets 4530. Another app does not see + `side-225` (4510) keep their ports, and a new master in that app gets 4530. Another app does not see these two masters until they are restarted, because the registry does not have them. - `branch list` and `worktree list` never create `~/.linked`. Only `branch start --worktree` and `worktree remove ` write there, inside the lock. @@ -273,7 +274,7 @@ Not run: `npm run test:e2e` (Docker), and CN's tests (no CN change). | D8 | `relink --all` | A worktree with an install of its own | Left as it is, code 0, one line | Count it as failed (plain `relink` refuses it) | Once `own-install` exists, `--all` would otherwise always exit 1 | | D9 | `relink --all` | Which worktrees | `worktree list --all` from the main checkout: masters, then their steps, then every other worktree (non-agent ones too) | Agent worktrees only | KC: "`worktree list --all` minus the main checkout" | | D10 | `branch list` | Row order and the TARGET column | Masters first, then integration branches, each by name; TARGET is the app's target, else the first repo's | Order by git config | Masters first matches KC's example; the app's target is what `land` uses | -| D11 | `branch list` | CN's `dev` has 24 repos, too wide for a row | Text names at most five (`… (+n)`); JSON has all of them | Full list | Readable at a terminal width; nothing is lost in JSON | +| D11 | `branch list` | The host app's `dev` has 24 repos, too wide for a row | Text names at most five (`… (+n)`); JSON has all of them | Full list | Readable at a terminal width; nothing is lost in JSON | | D12 | `branch list` | An app with no records | Prints `No integration branches or masters.`, exit 0 | An empty header | KC: exit 0 for an empty list; a clearer message | | D13 | `add-package` | A relink fails after the worktrees were made | The worktrees and records stay; exit 1 with `rerun linked worktree relink --all` | Undo everything | The worktrees are correct, and a relink is repeatable on its own | | D14 | `add-package` | Which install the new package's nested `node_modules` links into | The master's farm marker `installRoot`, else the main checkout | Always the main checkout | Same as the master's own farm | diff --git a/docs/reports/042-component-index.md b/docs/reports/042-component-index.md index 47355cbb..dc612f77 100644 --- a/docs/reports/042-component-index.md +++ b/docs/reports/042-component-index.md @@ -5,7 +5,7 @@ summary: > `Writing components.ttl`, after `Writing shapes.ttl`) from the linked components exported by `src/components/index.ts`, generated by the package's `@_linked/react` (`utils/componentIndex`, react report 004) with new `@_linked/core` terms (core report 085). - Minor in cli, react and core. Step CI of CN plan 282 (K8), sub-plan 004. + Minor in cli, react and core. Part of the host app's plan (K8), sub-plan 004. --- # 042 — Component index @@ -14,10 +14,10 @@ summary: > ### Summary -Step CI of CN plan 282 (K8, decisions D5, D13, G5). A package that exports linked components from -`src/components/index.ts` now gets `lib/esm/data/components.ttl` from `linked build`: per +A step of the host app's plan (K8 and three of its decisions). A package that exports linked +components from `src/components/index.ts` now gets `lib/esm/data/components.ttl` from `linked build`: per component its export name, start shape, query shape and query wire format, as deterministic Turtle -that Create Now (step CX) stores and hash-replaces without running component code. Three repos: +that the host app stores and hash-replaces without running component code. Three repos: core (vocabulary, core report 085), react (the generator, react report 004), cli (the build step, this report). @@ -42,7 +42,7 @@ this report). ### Verification -All in the step worktrees (`/Users/rene/web/wt/hub-imports--ci/packages-local/*`). +All in the step worktrees (`../wt/hub-imports--ci/packages-local/*`). - Core: `jest src/tests/core-ontology.test.ts` → `Tests: 17 passed, 17 total` (12.7 s); `jest serialization query-builder ask-wire count-wire` → `Tests: 25 skipped, 359 passed, 384 @@ -65,7 +65,7 @@ All in the step worktrees (`/Users/rene/web/wt/hub-imports--ci/packages-local/*` (`@linkedPackage('…').linkedShape`, from `3c9a745`); reported to the master. - Sandbox, end to end with the step's built CLI (`node …/_linked-cli/lib/esm/launch.js build`), a package `@sandbox/widgets` in the scratchpad whose `node_modules` links the step's core and react - and CN's `react`: `package.ts`, one shape (`Person`), `components/index.ts` exporting + and the app's `react`: `package.ts`, one shape (`Person`), `components/index.ts` exporting `PersonCard` (`linkedComponent`, imports a `.module.css` and an `.svg`), the same as `Card`, `CurrentUserList` (`linkedSetComponent({people: Person.select(…).for(getQueryContext('user'))})`) and a plain function `Plain`. `✔ Writing components.ttl - lib/esm/data/components.ttl`: @@ -86,11 +86,11 @@ All in the step worktrees (`/Users/rene/web/wt/hub-imports--ci/packages-local/*` `✔ Writing components.ttl` with no file, `lib/esm/data` holds only `shapes.ttl`, `components.ttl gone`. `.for('')` and `.for(null)` round trips are covered by react's `component-index` test. -- CN typecheck: per master decision M23 not part of this step's gate (the step worktree loads two - copies of core); the master's test agent runs it after landing. A supplementary run in the app +- The host app's typecheck: per a master decision not part of this step's gate (the step worktree + loads two copies of core); the master's test agent runs it after landing. A supplementary run in the app worktree with core and react mapped to the step's copies by a temporary `paths` override (reverted): `No new type errors. 0 pre-existing errors still in the baseline.` (42 s). -- Not run: CN tests (no CN change); the cli's `npm run test:e2e` (Docker). +- Not run: the host app's tests (no change in the app); the cli's `npm run test:e2e` (Docker). ### Deviations @@ -114,7 +114,7 @@ All in the step worktrees (`/Users/rene/web/wt/hub-imports--ci/packages-local/*` [015](../backlog/015-stale-lib-files-within-two-minutes.md). - At release, after core 2.46 publishes, react's devDependency `@_linked/core` goes to `^2.46.0` (its tests need the new terms): react plan 001 §Release. -- CN reads the file (step CX): CN plan 282, step CX. +- The host app reads the file: a later step of its plan. ## Details @@ -145,4 +145,4 @@ including integer-like keys that `JSON.stringify` would reorder). | C9 | core.ttl | Ranges `→ sh:NodeShape` need SHACL | `@prefix sh:` added; domains/ranges stated for every new property | No ranges | The ontology says what CX stores | | C10 | react test | `n3` (to parse Turtle) is not a react dependency; `linked build` warned | Assert on the fixed one-line form instead | Add `n3` as a devDependency | No dependency change (no install in a shared worktree) | | C11 | landing | Plan said land core after phase 1 | Land core, react, cli at the end, in that order | Land per phase | The step worktree links its own core/react; one rebase, one landing | -| C12 | gate | CN typecheck in a two-core worktree | Per master M23 left to the master's test agent; supplementary run with a temporary `paths` override, reverted | Skip it | Evidence without touching the master's install | +| C12 | gate | The host app's typecheck in a two-core worktree | Per a master decision left to the master's test agent; supplementary run with a temporary `paths` override, reverted | Skip it | Evidence without touching the master's install | diff --git a/docs/reports/043-branch-key.md b/docs/reports/043-branch-key.md index a0c469cc..1825ec4b 100644 --- a/docs/reports/043-branch-key.md +++ b/docs/reports/043-branch-key.md @@ -5,8 +5,8 @@ summary: > never `main`), kept only from the app's own list, read by `linked checkout` as pins under `--pin` (`pinFrom`), followed by `localize --listed`, and landed by `linked branch merge`, which merges keyed package branches first (update mode refuses one the target lacks) and strips every - key from the app's `package.json` (`strippedKeys`, `via`). Minor. Step BK of CN plan 282 (K7), - sub-plan 004. + key from the app's `package.json` (`strippedKeys`, `via`). Minor. Part of the host app's plan + (K7), sub-plan 004. --- # 043 — The branch key @@ -19,7 +19,7 @@ An app branch names the package branch it uses in its own `package.json`: `"acme-ont": {"repo": "…", "branch": "rene/topic"}`. `linked checkout` places a keyed package as a pin places it, `linked localize --listed` clones it on that branch, and `linked branch merge` lands the keyed branch before the packages on the app branch and removes every key, so `main` -lists none. Contract K7 (Added by BK), master decisions M8, M29, M33. +lists none. Contract K7 (added by this step), and three master decisions (below). ### Changes @@ -53,7 +53,7 @@ lists none. Contract K7 (Added by BK), master decisions M8, M29, M33. - Docs: README (unpublished packages, branch checkouts, the merge lines), `docs/localize.md` (commands table, the on-disk example with `branch`, a paragraph on the key, exit code 6), `docs/integration-branches-and-worktrees.md` (merge: branch keys, push/update, JSON with `via` - and `strippedKeys`; checkout: branch rule, Pins, Create Now passes `--pins-only` only, JSON with + and `strippedKeys`; checkout: branch rule, Pins, a host app passes `--pins-only` only, JSON with `pinFrom`). - `.changeset/branch-key.md` (minor). Backlog 016. - Tests: `tests/unit/integration/branchName.test.ts` (new, 37 names against git), @@ -66,7 +66,7 @@ lists none. Contract K7 (Added by BK), master decisions M8, M29, M33. ### Verification Build (`npx linked build` in the cli worktree; first one with -`/Users/rene/web/create_now/node_modules/.bin/linked build`): +`
/node_modules/.bin/linked build`, `
` being the app's main checkout): ``` ✔ Checking dependencies @@ -94,7 +94,7 @@ Time: 115.954 s, estimated 118 s npm run test:unit 171.77s user 186.46s system 307% cpu 1:56.53 total ``` -After the M42 condition (below), `pins.e2e` and `checkout.e2e` (50 s): +After the master's condition (below), `pins.e2e` and `checkout.e2e` (50 s): ``` Test Suites: 2 passed, 2 total @@ -109,7 +109,7 @@ Tests: 1261 passed, 1261 total ``` End to end with the built bin (`node lib/esm/launch.js`) in -`/private/tmp/claude-501/-Users-rene-web-create-now/f0df7a7f-565a-4b79-a371-d7fb1ca89a28/scratchpad/cli-sandbox`, +`/cli-sandbox`, `file://` remotes `acme-app`, `acme-ont` (branch `rene/topic`), `acme-assets` (branch `change-1`); the app's `change-1` keys `acme-ont` to `rene/topic`. Script `bk-sandbox.sh` in the scratchpad; whole run 12.5 s. Packages from `--json` (paths trimmed): @@ -149,7 +149,7 @@ branch keys on origin/main: 0 (`acme-assets` is not in the merge: `--pins-only` left it detached at `origin/main`.) -Not run: `npm run test:e2e` (Docker); CN's tests (CN half). +Not run: `npm run test:e2e` (Docker); the host app's tests (the app's half). ### Deviations @@ -159,7 +159,7 @@ Not run: `npm run test:e2e` (Docker); CN's tests (CN half). `--pin`) left it where it was, against the documented "a clean worktree whose head origin has moves to its target when the pins change". The pinned path now moves when origin has the head, as the default-branch path already did. Applies to `--pin` changes too. Test added. Accepted by - the master as M42 with a condition: the move happens only when the worktree has no uncommitted + the master with a condition: the move happens only when the worktree has no uncommitted changes and no commits origin lacks; otherwise it is `kept` with a reason that starts with the worktree's path and a run message `: not moved: …` (both refusals tested). - The keys become pins **before** the walk (the plan says after): packages are placed during the @@ -174,8 +174,8 @@ Not run: `npm run test:e2e` (Docker); CN's tests (CN half). - Push mode with an app already in `` does not strip keys `` might list (message only); the strip reflows one-line objects; no command sets a key: cli backlog [016](../backlog/016-branch-key-follow-ups.md). -- CN half (passes `--pins-only` without `--pin`, lands keyed branches by PR before update mode, - M41): done in the same step, CN report 291. +- The host app's half (passes `--pins-only` without `--pin`, lands keyed branches by PR before + update mode, a master decision): done in the same step, in the app's own report. ## Details @@ -183,13 +183,13 @@ Not run: `npm run test:e2e` (Docker); CN's tests (CN half). The parser stays pure (`isBranchName` instead of a git call); `checkout` still runs `git check-ref-format --branch` on each key as it does on each `--pin`. Keys are read only from the -app's list (M8: the on-disk shape is unchanged, `{"": {"repo", "branch"?}}`); the walk +app's list (a master decision: the on-disk shape is unchanged, `{"": {"repo", "branch"?}}`); the walk copies a transitive entry without its key, so nothing downstream can see one. In `checkout` the pin set is one map built once (`pinKeys`), and a `keyed` set says which pins came from keys, so -`targetOf` and every pins-mode rule are unchanged (M29). In `branch merge` the keys come from +`targetOf` and every pins-mode rule are unchanged (a master decision). In `branch merge` the keys come from `origin/` after the fetch, and every refusal (no checkout for a keyed package, no `origin/`, update mode with `` not in ``) joins the existing "Nothing was merged" -pre-check, so a refusal never leaves a half merge (M33). +pre-check, so a refusal never leaves a half merge (a master decision). ### Autonomous decisions @@ -199,19 +199,19 @@ pre-check, so a refusal never leaves a half merge (M33). | B2 | checkout | Keys must be pins before packages are placed, which happens inside the walk | Read the keys from the app list before the walk (after the app worktree is up to date) | After the walk, as the plan worded it | The only order that places keyed packages; same file | | B3 | checkout | A key git's `check-ref-format` refuses (the parser already checked) | Refused with exit 6 (a list error), not 2 | Exit 2 like a bad `--pin` | A key is committed data, not the command line; matches the parser | | B4 | checkout | Override message when `--pin` equals the key | No message; `pinFrom: "flag"` | Always a message | Nothing is overridden | -| B5 ⚠ risky | checkout | A detached pinned worktree was kept on a non-fast-forward pin change (also for `--pin` alone, before this step) | Move it when origin has its head, as the default-branch path does; only a clean worktree with nothing unpushed (master M42), else `kept`, naming the worktree | Leave it; record a backlog item | Documented behaviour; without it `--pin` over a key, and a key change, never take effect on an existing checkout. Changes today's `--pin` behaviour in that case | +| B5 ⚠ risky | checkout | A detached pinned worktree was kept on a non-fast-forward pin change (also for `--pin` alone, before this step) | Move it when origin has its head, as the default-branch path does; only a clean worktree with nothing unpushed (the master's condition), else `kept`, naming the worktree | Leave it; record a backlog item | Documented behaviour; without it `--pin` over a key, and a key change, never take effect on an existing checkout. Changes today's `--pin` behaviour in that case | | B6 | merge | A keyed other-name package whose checkout is on `` too | The key decides: merged from `origin/` only, left out of the same-name set | Merge both | The app list says which branch the app uses | -| B7 | merge | Strip commit message: plan says `Use main of ` | `Use of ` | Literal `main` | Same text for `--into main` (CN's case); correct for any target | +| B7 | merge | Strip commit message: plan says `Use main of ` | `Use of ` | Literal `main` | Same text for `--into main` (the host app's case); correct for any target | | B8 | merge | Hooks on the strip commit and the amend | `--no-verify` | Run the app's hooks | A mechanical edit by the cli; the merge itself runs no pre-commit hook either; the pushes already use `--no-verify` | | B9 | merge | Push mode, app already in `` (no merge commit to amend) | Message only | Commit on ``, or refuse | No path to it in normal use; backlog 016 | | B10 | merge | Update mode: how to report keyed packages already in `` | In `repos` as `up-to-date`, `via: "key"`, `landed: true`, `sha` = `origin/` | Leave them out | The caller sees every package the merge considered | -| B11 | merge | Update mode, app up to date but keyed | The strip commit is pushed; app `result: "merged"` | `up-to-date` | Something was pushed; CN opens the app PR on it | +| B11 | merge | Update mode, app up to date but keyed | The strip commit is pushed; app `result: "merged"` | `up-to-date` | Something was pushed; the host app opens the app PR on it | | B12 | merge | App push refused after the strip | `strippedKeys` reset to `[]` | Keep the names | Nothing reached `` | -| B13 | merge | Strip commit fails | `result: "conflict"` with the message, exit 6 | A new result value | Keeps `MergeRepoResult` unchanged for CN | +| B13 | merge | Strip commit fails | `result: "conflict"` with the message, exit 6 | A new result value | Keeps `MergeRepoResult` unchanged for the host app | | B14 | merge | `origin/:package.json` unreadable / invalid list | No file: no keys; invalid JSON or list: refused with the parser's message, exit 6, nothing merged | Ignore the keys | A list the cli cannot read must not be landed | | B15 | strip | Formatting | Parse, delete, `JSON.stringify` with the detected indent, trailing newline and CRLF kept | Text-level edit | The plan's prescription; backlog 016 for one-line objects | -## Addendum: review fixes (master M44) +## Addendum: review fixes (master decision) ### PR diff --git a/docs/reports/044-hub-imports.md b/docs/reports/044-hub-imports.md index d88afb98..eb8a9c46 100644 --- a/docs/reports/044-hub-imports.md +++ b/docs/reports/044-hub-imports.md @@ -120,7 +120,7 @@ Three pieces: ## Details -### Contract: masters CLI surface (KC in the hosting application's plan 282) +### Contract: masters CLI surface (KC in the hosting application's plan) - **Port lock.** `linked branch start --worktree …` chooses and records its preview port holding one machine-wide lock, `/locks/master-ports/linked.lock` (`LINKED_HOME` diff --git a/docs/reports/046-build-app-compile-only.md b/docs/reports/046-build-app-compile-only.md index eae249cd..c8b56e59 100644 --- a/docs/reports/046-build-app-compile-only.md +++ b/docs/reports/046-build-app-compile-only.md @@ -3,17 +3,17 @@ date: 2026-10-30 summary: > `linked build-app --compile-only` (also `compileViteApp`): compile and check an app's client and backend without a release: no file store, no store accessURL, no revision, no manifest. Asked for - by Create Now's hub-update check (CN backlog 322, plan 311 decision E8). + by the host app's hub-update check (a decision in its plan). --- # 046 — `build-app --compile-only` ## Why -Create Now's hub-update check builds an app's clone at a new dependency version to learn whether it -still builds. `build-app` is a release build: a web build resolves the `appAssets` store first (the +The host app's hub-update check builds an app's clone at a new dependency version to learn whether +it still builds. `build-app` is a release build: a web build resolves the `appAssets` store first (the client bundle's base URL is under the release prefix) and writes a release manifest that needs the -store's `accessURL`. The check runs sandboxed with none of CN's environment, so it stopped at +store's `accessURL`. The check runs sandboxed with none of the host app's environment, so it stopped at `A web release manifest requires the accessURL of the store it will be published to`. ## What changed @@ -53,4 +53,5 @@ Time: 87.496 s ## Consumer -CN runs it with its own cli (`linkedBin()`), not the clone's npm-installed copy: CN report 322. +The host app runs it with its own cli, not the clone's npm-installed copy (recorded in its own +report). diff --git a/docs/reports/048-no-host-app-mentions.md b/docs/reports/048-no-host-app-mentions.md new file mode 100644 index 00000000..7ee5bdfc --- /dev/null +++ b/docs/reports/048-no-host-app-mentions.md @@ -0,0 +1,55 @@ +--- +date: 2026-11-02 +summary: > + Comments in src/, the README and the current docs (backlog, integration-branches-and-worktrees) + no longer name a particular private host app or point at its docs; they describe the host + generically. Comments and docs only, no behaviour change, no changeset. Five user-facing message + strings in the worktree and master commands still name the host's scripts and are left as code. +packages: [cli] +--- + +# 048 — No mentions of a particular host app + +The cli is open source; comments and docs named one private app built on it, cited its backlog +and architecture docs, and used its domain in an example IRI. They now say "a host app", "a +hosting app", "an app that commits through the GitHub API", and the example IRI uses +`example.org`. + +## PR + +**What changed** + +- `src/`: comments in 19 files rewritten generically, meaning kept (`lifecycle.ts`, `vite-config.ts`, + `cli-methods.ts`, `commands/start.ts`, `commands/setup-publish.ts`, `installed-packages.ts`, + `workspace-globs.ts`, `interfaces.ts`, `integration/credentials.ts`, `integration/masters.ts`, + `utils/{componentsTurtle,ontologyModules,ontologyNamespace,packageFiles,packageKind,packageManager}.ts`). + References to another repo's backlog item and architecture section were dropped; the rule they + pointed to is already stated inline. +- `README.md`, `docs/integration-branches-and-worktrees.md` and backlog items 006, 009, 011, 012, + 013, 014, 016, 017: the host named generically; absolute paths of its checkout replaced by + `
`; a citation of its report dropped. +- No changeset: comments and docs only. + +**Verification** + +- `npx linked build` → `✔ Build successful`. +- `npm run test:unit` → `Test Suites: 103 passed, 103 total`, `Tests: 1267 passed, 1267 total`. +- `npm run test:e2e` → `7 passed (1.3m)`. +- A case-insensitive grep for the host's name, abbreviation and domain over `src`, `package.json`, + `README.md` and `docs` (without `docs/reports` and `docs/plans`) finds only the strings below. + +**Deviations from the plan** + +- Left as code, not comments: `src/commands/worktree.ts:632-638` (checks for and prints the host's + backup script and the dump of its main dataset, both by names that carry the host's + abbreviation) and `src/commands/master.ts:242` and `:494` (the same hint, and a restart message + that names the host). Changing them changes output, so they need a decision. +- Not touched: `docs/reports/` and `docs/plans/` (historical records of finished work), + `CHANGELOG.md` (published history), and `tests/` (fixtures and comments there also name the host; + outside this pass's scope). + +**Follow-ups** + +- The five message strings above: make the dataset-clone hint generic or configurable by the app + (e.g. read script names from the app), and say "the app server" in the land message. +- `tests/` comments and fixtures: same cleanup, in a separate pass. diff --git a/docs/reports/049-dataset-clone-script.md b/docs/reports/049-dataset-clone-script.md new file mode 100644 index 00000000..63d70935 --- /dev/null +++ b/docs/reports/049-dataset-clone-script.md @@ -0,0 +1,107 @@ +--- +date: 2026-11-02 +summary: > + `worktree add --dataset` and `branch start --worktree --dataset` print the app's own clone + command (`npm run clone-dataset -- `, or the script `datasetCloneScript` names in + linked.config.js) and warn when the app has none; the port hint names the app's port and the + land message says "Restart the app". Minor. +packages: [cli] +--- + +# 049 — Dataset clone hint from the app's npm script + +## PR + +### Summary + +The `--dataset` hint of `linked worktree add` and `linked branch start --worktree` checked for +two shell scripts of one particular host app and printed their commands. It now asks the app: +an npm script `clone-dataset` in the app's root `package.json` (or the one `datasetCloneScript` +names in `linked.config.js`) that takes the target dataset as its one argument. Without it, a +warning says the dataset starts empty and how to add the script. Two output strings no longer +assume a host: the free-port hint names the app's own port, and `branch land` says "Restart the +app on …". Follow-up of report 048. + +### Changes + +- `src/commands/worktree.ts`: one shared helper set, used by both commands: + `datasetCloneHint(root, dataset, configured?)` (pure: the lines to print), + `readDatasetCloneScript(root)` (the linked config's `datasetCloneScript`, undefined on no + config / no key / a config that fails to load), `datasetCloneMessages(root, dataset)` (the two + combined), `DEFAULT_DATASET_CLONE_SCRIPT = 'clone-dataset'`, and `appPort(root)` (the root + `.env`'s `PORT`, else `DEFAULT_APP_PORT`). `worktreeAdd` uses them for the clone hint and the + `(pick a free port: the main checkout uses )` line. +- `src/commands/master.ts`: `branch start --worktree --dataset` prints `datasetCloneMessages`; + `branch land` says "Restart the app on ". +- `src/commands/start.ts`: `DEFAULT_APP_PORT` (4040), used by `resolveAppUrl`. +- `src/interfaces.ts`: optional `LinkedConfig.datasetCloneScript`. +- `src/cli.ts`: `--dataset` help of both commands mentions the clone command. +- Docs: `docs/integration-branches-and-worktrees.md` (new "Cloning a dataset" section, the flag + table, the master section, the "Data is shared" limitation), `README.md` (one example line). +- Tests: `tests/unit/datasetCloneHint.test.ts` (new), `tests/unit/integration/worktree.test.ts` + (the `--dataset` test rewritten; a new one for the warning and the port line). +- Changeset `.changeset/dataset-clone-script.md`: minor. + +### Verification + +- `npx linked build` → `✔ Build successful`. +- `npm run test:unit` → `Test Suites: 104 passed, 104 total`, `Tests: 1279 passed, 1279 total`. +- `npm run test:e2e` → `7 passed (2.0m)`. +- Against a real host app (its linked.config.js imported by the built `lib/`): + `datasetCloneMessages(, 'wt-x')` → + `'Clone the data into wt-x first (from ): npm run clone-dataset -- wt-x'`; against a + checkout without the script → + `'Warning: the app has no clone-dataset script, so wt-x starts empty unless it is cloned by hand.'` + plus the how-to line. +- A case-insensitive grep for the host's name, abbreviation and dataset names over the changed + files finds nothing. + +### Deviations + +- None from the settled design. The helper lives in `worktree.ts` (not its own module) because + `master.ts` already imports its start-command helpers from there and a separate module would + have needed `shellQuote` from `worktree.ts`, an import cycle. + +### Follow-ups + +- `src/vite-config.ts` still has its own `DEFAULT_DEV_PORT = 4040` and two literal `4040`s; it + could use `DEFAULT_APP_PORT`. Not recorded elsewhere; small cleanup. + +## Details + +### Behaviour + +| app state | printed | +|---|---| +| `package.json` has `scripts["clone-dataset"]`, no config key | `Clone the data into first (from ): npm run clone-dataset -- ` | +| `datasetCloneScript: 'x'` and `scripts.x` exists | the same with `npm run x -- ` | +| `datasetCloneScript: 'x'`, no `scripts.x` (even if `clone-dataset` exists) | `Warning: datasetCloneScript in the linked config names "x", but /package.json has no such script, so starts empty unless it is cloned by hand.` + how to add `x` | +| neither | `Warning: the app has no clone-dataset script, so starts empty unless it is cloned by hand.` + how to add `clone-dataset` or set `datasetCloneScript` | + +The dataset is shell-quoted in the command (`shellQuote`), shown raw in prose. `` is the +app's main checkout (where the script has to be run, since it needs the main install). + +### Decisions + +- **Config source:** the app's linked config, `linked.config.js` (or legacy `lincd.config.js`), + found with `resolveLinkedConfigPath` and loaded with `importFile`, the same way `linked start` + reads it. A config that throws on import (for example, one that imports something unavailable) + is treated as "no key", so the hint falls back to the default script instead of failing + `worktree add`. +- **An override naming a missing script warns** rather than falling back to `clone-dataset`: the + app said which script to use, so printing another one would be wrong. +- **Port:** `appPort(root)` reads the main checkout's `.env` `PORT` with the existing + `envValue` parser; `DEFAULT_APP_PORT` is the same 4040 `resolveAppUrl` falls back to. +- The cli prescribes only the interface (one positional argument, the target dataset). The docs + recommend the script refuse to overwrite the app's own datasets. + +### Tests + +- `tests/unit/datasetCloneHint.test.ts` (11 tests): script found; dataset shell-quoting; config + override found; override naming a missing script (warns, does not mention `clone-dataset`); + no script; no `package.json`; `readDatasetCloneScript` reading a temp `linked.config.js`, no + config / no key, a throwing config falling back; `datasetCloneMessages` with the configured + script; `appPort` from `.env` and the default. +- `tests/unit/integration/worktree.test.ts`: `--dataset` with a committed `clone-dataset` script + prints its command; `--dataset` without one prints the warning, and without `--port` the line + names the `.env` port (4100). diff --git a/docs/reports/050-ontology-names-and-vann-prefix.md b/docs/reports/050-ontology-names-and-vann-prefix.md new file mode 100644 index 00000000..ca96f21a --- /dev/null +++ b/docs/reports/050-ontology-names-and-vann-prefix.md @@ -0,0 +1,117 @@ +--- +date: 2026-11-10 +summary: > + `linkedOntologies` is keyed by the ontology's name within the package; the generator reads the + suggested prefix from the ontology's vann data and writes it in the data module; `linked build` + and `generate-ontology` refuse an ontology without that data, saying what to add. Minor. +packages: [cli] +--- + +# 050 — Ontology names and the vann prefix + +## PR + +### Summary + +An ontology is found by its package and its name within the package, never by a prefix. The +`package.json` `"linkedOntologies"` key is now that name: it names the three generated modules and +is the name `linkedOntology` registers. The suggested prefix is data: the ontology's +`owl:Ontology` node carries `vann:preferredNamespacePrefix` and `vann:preferredNamespaceUri`, and +the generator writes `Prefix.add('', '')` from it. A package whose data lacks +those triples, or whose vann namespace is not the configured one, now fails its build with a +message naming the package, the ontology, its files and the triples to add. + +### Changes + +- `src/utils/ontologyModules.ts`: `OntologyModuleSpec` is `{name, suggestedPrefix, namespace, + dataFiles, terms, ontology?}`; `ONTOLOGY_NAME` (lowercase `^[a-z0-9]+(?:[-_][a-z0-9]+)*$`) + replaces `ONTOLOGY_PREFIX`; `SUGGESTED_PREFIX` (a Turtle prefix); the data module adds the + suggested prefix, the register module passes the name; `OntologyNameCollisionError.ontologyName`. +- `src/utils/ontologyTerms.ts`: `ontologyTermsFromQuads` also returns the vann values of the + ontology node it finds (`preferredPrefixes`, `preferredNamespaces`; the namespace as a literal + or an IRI); `ontologySuggestedPrefix(result, namespace)` returns the one prefix or throws + `OntologyVannError` with the reason. Pure, so a browser caller applies the same rule. +- `src/utils/generateOntology.ts`: `OntologyConfig.name`; the entries keyed and sorted by name; + `generatePackageOntologies` turns an `OntologyVannError` into the build's message. The case check + is gone: the lowercase pattern refuses two names that differ only in case. +- Scaffold: `defaults/package-ontology/src/data/example-ontology.ttl` declares both vann triples + (the name as the prefix); `ontologyScaffoldModules(name, namespace)`, `withOntologyEntry`, + `checkScaffoldOntology` (now lowercase) take the name; `create-ontology `. +- `src/cli.ts`: `create-ontology` and `generate-ontology` help and messages speak of names. +- README: "Ontology accessor modules" and the ontology package description. +- Tests: `tests/unit/ontologyGenerator.test.ts` (a "suggested prefix" block: prefix ≠ name in the + fixture, an IRI vann namespace, vann on another node, no owl:Ontology, no prefix, no namespace, + two prefixes, two namespaces, a wrong namespace, an invalid prefix; two build-step tests for the + full message); the fixture's data carries vann (`ex` suggests `exa`); the scaffold tests expect + the vann triples and the lowercase message. +- Changeset `.changeset/ontology-names-and-vann-prefix.md`: minor, stating that a package without + vann data now fails its build and what to add. + +### Verification + +- `npx linked build` → `✔ Build successful`. +- `npm test`: unit `Test Suites: 104 passed, 104 total`, `Tests: 1290 passed, 1290 total`; e2e + `7 passed (1.3m)`. +- `node /lib/esm/launch.js generate-ontology --check`, read-only, in the vocabulary packages: + - `_linked-schema`: `schema: 3023 terms from src/data/schema.ttl, src/data/schema-added.ttl` / + `Every ontology module is current.` (exit 0) + - `_linked-dcmi`: `dc: 15 terms …`, `dcmitype: 12 terms …`, `dcterms: 98 terms …` / + `Every ontology module is current.` (exit 0) + - `_linked-org` (exit 1): + + ``` + @_linked/org: the ontology "org" (src/data/org.ttl) has no suggested prefix: has no vann:preferredNamespacePrefix. Its owl:Ontology node must carry its suggested prefix and its namespace, for example: + + @prefix owl: . + @prefix vann: . + + + vann:preferredNamespacePrefix "org" ; + vann:preferredNamespaceUri "http://www.w3.org/ns/org#" . + + Add it to one of its data files (a new file goes in "linkedOntologies".org.data). For a published vocabulary shipped unedited, put it in src/data/org-added.ttl, never in the published file. + ``` + - `git status --short` in all three: empty. + +### Deviations + +- `Prefix.add` keeps the namespace as a string (`Prefix.add('', '')`), not + `ns('')`: core's `Prefix.add` takes two strings, and the vann namespace equals the configured one + by the check, so the output of every package that already has vann data is byte-identical + (schema, dcmi, dcat pass `--check` unchanged). +- The case check of names was removed rather than kept: names are lowercase now, so it could not + fire. + +### Follow-ups + +- Vocabulary packages without vann data fail their build with this version: owl, rdfs (rdf, + rdfs), sioc, xsd, org, auth, npm, and the packages whose ontology modules are still + hand-written. They get their vann triples in the plan that changes those packages, which runs + after this one lands. +- A consumer of `@_linked/cli/utils/ontologyModules` that calls `generateOntologyModules` must + pass `name` and `suggestedPrefix` (reading the prefix with `ontologySuggestedPrefix`), and an + app that writes ontology data must write the vann triples. The known consumer is a host app, + tracked in its own plan. + +## Details + +### Decisions + +- **The prefix is required in the spec.** The pure generator writes what it is given; reading it + from the data is the caller's job (`ontologySuggestedPrefix`), so the browser and the build share + one rule. +- **Which node.** Only the vann values of the ontology node `ontologyIriOf` picks (the namespace, + else the namespace without its trailing `#`/`/`, else the only declaration it starts with) count; + vann data on another subject is ignored. +- **Values.** The prefix must be a literal; the namespace may be a literal or an IRI (both occur + in published vocabularies). More than one distinct value of either is refused rather than + picked. The prefix must be a Turtle prefix (`^[A-Za-z](?:[A-Za-z0-9_.-]*[A-Za-z0-9_-])?$`), so + existing prefixes such as `lincd-server` and `linked_core` stay valid. +- **Where to add it.** The vann triples may sit in any file of the ontology's `data`; the message + shows them on the ontology's node (declaring the node when the data has none) and points a + mirror to `src/data/-added.ttl`. + +### State of the other vocabulary packages + +`--check` with this version: dcat passes; owl, rdfs, sioc, xsd, auth, npm fail with the same +message for their ontology (each lacks `vann:preferredNamespacePrefix`). diff --git a/docs/reports/051-ontology-module-and-hand-written-modules.md b/docs/reports/051-ontology-module-and-hand-written-modules.md new file mode 100644 index 00000000..3f65105d --- /dev/null +++ b/docs/reports/051-ontology-module-and-hand-written-modules.md @@ -0,0 +1,101 @@ +--- +date: 2026-11-10 +summary: > + A `linkedOntologies` entry may name its module (`"module"`, default the name) and keep its + modules written by hand (`"generated": false`): nothing generated or compared, vann data still + required. A pure `readOntologyConfigs` gives any tool `{name, namespace, module, generated, + data}` per ontology. Minor. +packages: [cli] +--- + +# 051 — Ontology module names and hand-written modules + +## PR + +### Summary + +`"linkedOntologies"` is the one declaration of a package's ontologies, including those whose +modules hold more than the generator writes (grouping objects, extra exports, terms kept out of +module scope). Two optional keys per entry: + +- `"module"`: the modules' file name in `src/ontologies/` without extension, so the public import + path `/ontologies/` follows from the declaration. Default: the name. Same + pattern as a name. A generated entry may set it too; its files are then `.ts`, + `.data.ts`, `.register.ts`, and the registration still uses the name. +- `"generated": false` (default `true`): `linked generate-ontology` writes nothing for the entry + and the build's staleness check skips it, but its data must carry the vann triples (same message + as a generated ontology), and two entries with one module are refused. + +```json +"linkedOntologies": { + "core": {"namespace": "https://example.org/core/", "module": "linked-core", "generated": false} +} +``` + +### Changes + +- `src/utils/ontologyConfig.ts` (new, pure: no `fs`, no `n3`): `OntologyConfig` `{name, + namespace, data, module, generated}`, `ONTOLOGIES_KEY`, `ONTOLOGY_NAMESPACE`, + `readOntologyConfigs(pkgJson)` (validates `module` and `generated`, refuses one module for two + entries). Moved from `generateOntology.ts`; `cli.ts`, `packageFiles.ts` and the tests import it + from here. +- `src/utils/ontologyModules.ts`: `OntologyModuleSpec.module?`; file names and the modules' + imports use it, `linkedOntology(…, '', …)` the name. +- `src/utils/generateOntology.ts`: passes `module`; an entry with `generated: false` yields no + files but its vann data is read and checked; the staleness error names the `"generated": false` + option. +- `src/cli.ts`: `generate-ontology` help names the module and the option; a hand-written entry + prints `(modules written by hand: vann data checked, nothing generated)`; the `--check` error + names the option. +- README "Ontology accessor modules": the two keys, an example, `readOntologyConfigs`. +- Tests (`tests/unit/ontologyGenerator.test.ts`): config defaults and values; refusals of a bad + `module`, `../x`, a non-boolean `generated`, two entries with one module; a hand-written entry + (edited module, missing module and an extra export pass; no files; nothing written; without vann + data the build fails with the generated ontology's message); the staleness message names the + option; a `module` other than the name (files renamed, imports follow, registration by name). +- Changeset `.changeset/ontology-module-and-hand-written.md` (minor). + +### Verification + +- `linked build` → `✔ Build successful`. +- `npm test`: unit `Test Suites: 104 passed, 104 total`, `Tests: 1297 passed, 1297 total`; e2e + `7 passed (1.3m)`. +- `generate-ontology --check` in `_linked-schema` (master tree), unchanged: + `schema: 3023 terms from src/data/schema.ttl, src/data/schema-added.ttl` / + `Every ontology module is current.` (exit 0); `git status --short` empty. +- A copy of the test fixture with `"ex": {…, "generated": false, "module": "linked-ex"}` and + `ex.register.ts` deleted, `generate-ontology --check`: + - with vann data (exit 0): `ex: 8 terms from src/data/ex.ttl, src/data/ex-extra.ttl (modules + written by hand: vann data checked, nothing generated) …` / `Every ontology module is current.` + - vann triples removed (exit 1): `ontology-generator-fixture: the ontology "ex" (src/data/ex.ttl, + src/data/ex-extra.ttl) has no suggested prefix: has no + vann:preferredNamespacePrefix. Its owl:Ontology node must carry its suggested prefix and its + namespace, for example: …` + +### Deviations + +- The plan's `"modules": "manual"` became `"module"` plus `"generated": false`, as the master + changed the scope during the step (an ontology's module path must follow from its declaration). +- "Duplicate name": JSON keys are unique and names lowercase, so two equal names cannot occur; the + check that can fire is two entries with one module, which is refused. +- The config reader moved to a module of its own so it carries no `fs`/`n3` import; consumers of + `readOntologyConfigs`, `OntologyConfig`, `ONTOLOGIES_KEY` or `ONTOLOGY_NAMESPACE` from + `utils/generateOntology` import them from `utils/ontologyConfig` (stated in the changeset). + +### Follow-ups + +- The packages whose ontology modules are written by hand declare them with `"generated": false` + and their `module`, and get their vann data: the plan that changes those packages (its step on + the linked vocabularies). +- A host app reading ontology declarations uses `readOntologyConfigs`: tracked in the host app's + own plan. + +## Details + +- `module` defaults to the name in `readOntologyConfigs`, so every reader gets the module without + re-deriving it; `OntologyModuleSpec.module` stays optional so the scaffold and existing callers of + the pure generator are unchanged. +- A hand-written entry's data files must exist and are parsed in full (terms are counted), so a + wrong `data` list fails the build the same way as for a generated one. +- The stale old files of an entry whose `module` changes are not deleted by `generate-ontology`; + the build does not compare them, and the author removes them with the rename. diff --git a/docs/reports/052-ontology-index-and-app-prefixes.md b/docs/reports/052-ontology-index-and-app-prefixes.md new file mode 100644 index 00000000..3a54ae2f --- /dev/null +++ b/docs/reports/052-ontology-index-and-app-prefixes.md @@ -0,0 +1,158 @@ +--- +date: 2026-11-10 +summary: > + `linked generate-ontology` writes one terms module per ontology (terms as `{id}` literals) and + one `src/ontologies/index.ts` per package that registers every ontology with core's + `registerOntologies(…, import.meta.url)`; the entry imports it, the old `.data.ts` / + `.register.ts` go, and the build checks all of it. An app's prefix map lives in + `linked.app.json` (schema v1 shipped), grown add-only by `linked prefixes`, and is loaded at + server start and into the browser bundle. Major. +packages: [cli] +--- + +# 052 — The ontology index and the app's prefix map + +## PR + +### Summary + +**Ontology modules.** Per package, `linked generate-ontology` now writes: + +- `src/ontologies/.ts` per generated ontology: only its terms, each + `export const Term = {id: 'Term'};` with its doc line. It imports nothing. +- `src/ontologies/index.ts`: imports every ontology module (hand-written ones too) and registers + them with one call: + + ```ts + import {registerOntologies} from '../package.js'; + import * as dc from './dc.js'; + … + registerOntologies( + [ + { + name: 'dc', + namespace: 'http://purl.org/dc/elements/1.1/', + terms: dc, + data: ['../data/dcelems.ttl', '../data/dc-added.ttl'], + suggestedPrefix: 'dc', + }, + … + ], + import.meta.url, + ); + ``` + +- the entry (`src/index.ts[x]`) imports `./ontologies/index.js`; side-effect imports of a removed + `.register.js` anywhere in `src/` become an import of the index; the `.data.ts` / + `.register.ts` files it generated before are removed (only files carrying its header). + +`linked build`'s ontology check refuses a stale or missing module, an entry without the index +import, and a leftover generated file. `create-package --kind ontology` and `create-ontology` +produce this layout; the template's `src/package.ts` exports `registerOntologies`. The shape check +expects registration through `ontologies/index.js` (as core's `registerInstalledOntologies` now +imports). + +**`linked.app.json`.** Schema v1 ships as `schema/app/1.json` (`$id` +`https://linked.cm/schema/app/1.json`). The reader refuses an unknown or missing `schemaVersion`, +an unknown key, a prefix outside `^[A-Za-z][A-Za-z0-9_]*$` and a non-IRI namespace. `linked +prefixes` adds, for every installed ontology (the app's and every linked dependency's, recursively) +whose namespace the map lacks, its suggested prefix or `

_2`, `_3`, …; it never changes or +removes an entry and creates the file when missing. `generate-ontology` runs it for the app the +package belongs to (same git repository). The map is loaded with `Prefix.load` at `linked start` +(through the SSR runner), by a compiled server (the app's copy of core) and in the browser (Vite +plugin `linked:app-prefixes`: the client entry imports `virtual:linked-app-prefixes` first, on its +first line). `create-app` writes the file and fills it after the install; the React Native +template's API service has one. + +### Changes + +- `src/utils/ontologyModules.ts`: terms as literals; `generateOntologyIndexModule`; + `generateOntologyModules(specs, handWritten?)` gives a package's files; data and register + generators removed; `GENERATED_HEADER`, `ONTOLOGY_INDEX`; `_data`/`_load`/`_ns`/`_prefix` no + longer reserved. +- `src/utils/generateOntology.ts`: `generatePackageOntologies` → `{ontologies, files, edits, + remove}`; entry and import edits; stale file removal; check covers them. +- `src/utils/appConfig.ts` (new), `src/plugins/app-prefixes.ts` (new), `schema/app/1.json` (new, + in `files`). +- `src/cli.ts`: `linked prefixes`; `generate-ontology` text, output (`Wrote` / `Removed`) and the + app's map. `src/cli-methods.ts`: `create-ontology`, `create-app`, `startServer` loading. + `src/commands/start.ts`: loading. `src/vite-config.ts`: the plugin. `src/utils/shapeHierarchy.ts`: + index detection. `src/utils/packageFiles.ts`: scaffold docs. +- Templates: `defaults/package/src/package.ts`, `defaults/package-ontology/src/index.ts`, + `defaults/app-react-native/services/api/linked.app.json`. +- README: "Ontology modules", "`linked.app.json`", template lines. +- Tests: `appConfig.test.ts` (new, 12); `ontologyGenerator.test.ts` (golden index, literals, + import names, stale files refused and removed, entry import, hand-written in the index, module + rename); scaffold, package-file, create-inside-package, template-full, shape-check and + shapes-Turtle fixtures moved to the layout; the generator fixture regenerated. +- Changeset `.changeset/ontology-index-and-app-prefixes.md` (major). + +### Verification + +- `node lib/esm/launch.js build` → `✔ Build successful`. +- `npx jest tests/unit` → `Test Suites: 105 passed, 105 total`, `Tests: 1311 passed, 1311 total`. +- `npm run test:e2e` → `7 passed (1.2m)`. +- Against the master's core with F5 (3a64295, built): a package scaffolded by + `buildPackageFiles('planning-ont', 'ontology')`, two terms added to its Turtle, `linked + generate-ontology`, then `tsc -p tsconfig-esm.json --noEmit` → exit 0; emitted and imported in + Node, `suggestedPrefixes()` → + `[{"packageName":"planning-ont","name":"planning","namespace":"https://linked.cm/ont/planning/","prefix":"planning"}]`, + and after `Prefix.load({planning: …})`, `Prefix.toPrefixed('…/planning/Task')` → `planning:Task`. +- On a copy of `_linked-dcmi` (master tree): `generate-ontology --check` → + `Out of date: src/index.tsx, src/ontologies/dc.data.ts, … src/ontologies/index.ts, src/shapes/index.ts.`; + `generate-ontology` → `Wrote src/index.tsx, src/ontologies/dc.ts, src/ontologies/dcmitype.ts, + src/ontologies/dcterms.ts, src/ontologies/index.ts, src/shapes/index.ts` / `Removed + src/ontologies/dc.data.ts, src/ontologies/dc.register.ts, …`; then `--check` → `Every ontology + module is current.` +- The builder against an app with the master's packages installed (run by `generate-ontology` in a + scratch package inside the step's app worktree; the file was then deleted) added 20 prefixes: + `auth, core, dcat, dc, dcmitype, dcterms, fuseki, npm, org, owl, rdf, rdfs, s3, schema, sentry, + server, server_utils, sioc, translation, xsd`. + +### Deviations + +- Core's API landed during the step; the index first passed `data: {files, load}`, then matched + F5's `registerOntologies(ontologies, import.meta.url)` with `data: ['../data/x.ttl']`. +- Loading the map does not refuse a core without `Prefix.load`: it warns and loads nothing (that + core's packages still register their own prefixes). The cli's e2e apps install the published + core, and refusing broke their boot. Removing the tolerance is backlog 018. +- The web app template lives in its own repository; `create-app` writes `linked.app.json` when the + clone has none instead of changing that repository here. + +### Follow-ups + +- Regenerate every ontology package with this layout, move consumers of `ns` / `loadData` / + `_ontologyResource` to core's `createNameSpace`, and build each app's map with `linked prefixes`: + the plan's next step on the packages (it owns the regeneration). +- A host app that writes ontology packages through `generateOntologyModules` gets the index from + it now, and must make the package entry import `./ontologies/index.js` and `src/package.ts` + export `registerOntologies`: the host app's own plan for its package writer. +- Schema URL, the app template repo's file, the core range and the warning, hyphenated suggested + prefixes (`server-utils` → `server_utils` in a map): backlog 018. + +## Details + +### Decisions taken autonomously + +| # | Where | Problem | Choice | Alternative | Rationale | +|---|---|---|---|---|---| +| 1 | contract | Core's map-loading call was not named when the step started | `Prefix.load(map)` (confirmed by core) | — | Contract assumption | +| 2 | contract | Where `registerOntologies` is imported from | The package object, `../package.js` (confirmed) | A free function taking the package name | Registrations are keyed by package | +| 3 | contract | Shape of `data` | Core's landed form: file list relative to `import.meta.url` | `{files, load}` | Match the landed API | +| 4 | layout | `_ontologyResource` lived in the data module | Dropped | A registration field | No reader anywhere; the IRI stays in the data | +| 5 | map | A suggested prefix legal in Turtle but not as a map name | Other characters become `_` (`server_utils`), then the `_2` rule | Refuse | The builder never fails on a valid package | +| 6 | schema | Unknown keys in `linked.app.json` | Refused, naming the key | Ignored | A misspelt key would be silently lost | +| 7 | map | What "inside an app" means for `generate-ontology` | The package is the app or lies under it in the same git repository | Any app found walking up | A framework checkout nested in an app folder must not write its map | +| 8 | template | The web template is another repository | `create-app` writes the file when missing; the RN template ships one | Change that repository now | Out of this step's repositories | +| 9 | shape check | Which modules mean "registers its ontologies" | `ontologies/index` only | Also `*.register.js` | Must match what core imports | +| 10 | identifiers | `_data`, `_load`, `_ns`, `_prefix` were reserved | No longer reserved | Keep | Core adds no keys to the terms now | +| 11 | loading | A core without `Prefix.load` | Warn, load nothing | Refuse to start | Apps on the published core keep booting; their packages still add prefixes | + +### Notes + +- Only files that start with the generator's header are removed; a hand-written module that still + carries the header of the module it started as is kept when declared `"generated": false`. +- The entry import is added as the entry's first line; the client-bundle import is prepended on + the entry's first line so no line moves (`map: null`). +- A compiled server imports `@_linked/core/utils/Prefix` from the app's own install + (`/lib/esm/utils/Prefix.js` via the `node_modules` walk), not the cli's copy. diff --git a/docs/reports/053-app-settings-in-linked-app-json.md b/docs/reports/053-app-settings-in-linked-app-json.md new file mode 100644 index 00000000..23c691a9 --- /dev/null +++ b/docs/reports/053-app-settings-in-linked-app-json.md @@ -0,0 +1,143 @@ +--- +date: 2026-11-10 +summary: > + `linked.app.json` holds every setting of an app (`cssMode`, `syncShapesOnBoot`, + `datasetCloneScript`, `publish`, `server`); `linked.config.js` is no longer read and an app that + still has one is refused with the JSON to move it into. `LINKED_RPC_EXPOSURE` wins over + `server.rpcExposure`. `defineConfig` and the old webpack types are gone. `generate-ontology` + also replaces an import of a register module deleted by hand. Major. +packages: [cli] +--- + +# 053 — An app's settings in `linked.app.json` + +## PR + +### Summary + +**Settings.** Schema version 1 of `linked.app.json` (still `schemaVersion: 1`: nothing of it is +released) gains every declarative field the old `linked.config.js` had: + +| Key | Values | Read by | +|---|---|---| +| `cssMode` | `tailwind` \| `postcss` | `LinkedServer` (server-side rendering in development) | +| `syncShapesOnBoot` | boolean | `LinkedServer` | +| `datasetCloneScript` | string | `linked worktree add --dataset`, `linked branch start --worktree --dataset` | +| `publish.staticAssets`, `publish.releasePrefix` | string list, string | `linked build-app` | +| `server.rpcExposure` | `warn` \| `enforce` | `LinkedServer` | +| `server.rawQueries` | `off` \| `session` | `LinkedServer` | +| `server.apiOnly` | boolean | `linked start`, `LinkedServer` | +| `server.cachePaths`, `server.cacheTimeout` | string list, milliseconds | `LinkedServer` | + +Each is checked (an unknown key is refused, inside `server` and `publish` too) and written back in +the schema's order, so `linked prefixes` keeps them. The cli builds `LinkedServer`'s configuration +from the file (`linkedServerConfig(appRoot, env)`) in `linked start`, in a compiled server +(`startServer`, so `serve-app`) and in `linked run --spawn`, and adds the load hooks itself. + +**`linked.config.js` is refused.** An app with `linked.config.js` or `lincd.config.js` fails at +server start and at `build-app` with: + +``` +/linked.config.js is no longer read: an app's settings live in linked.app.json. Move them there and delete linked.config.js: + + { + "$schema": "https://linked.cm/schema/app/1.json", + "schemaVersion": 1, + "prefixes": {}, + "cssMode": "tailwind", + … + } + +Keep only the keys you set. Values are JSON: a value computed from the environment becomes the variable (LINKED_RPC_EXPOSURE wins over "server.rpcExposure"). `webpack` and `server.multiCore` are gone; `server.loadAppComponent` and `server.loadRoutes` are not settings (the server loads src/App and src/routes). Run `linked prefixes` to fill "prefixes". +``` + +`worktree add --dataset` only prints a hint, so it falls back to the default script instead of +failing. + +**`LINKED_RPC_EXPOSURE`** (when set) wins over `server.rpcExposure`, so an app that pins `enforce` +in the file can still be switched to `warn` for a diagnosis without editing it; any other value +is refused at start (a typo must not fall back to the server's default, `warn`). + +**Removed.** `defineConfig` (nothing reads a settings module any more), the old webpack build's +`ModuleConfig` / `AdjustedModuleConfig`, `LinkedServerConfig.multiCore` (read nowhere), +`resolveLinkedConfigPath` / `LINKED_CONFIG_FILES`. + +**Generator fix.** `linked generate-ontology` replaces a side-effect import of a +`src/ontologies/.register.js` whose module no longer exists (deleted by hand) with the +import of `./ontologies/index.js`, as it does for register modules it removes itself. An import of +a register module that exists is left. + +**App template.** The template repository's branch `linked-app-json` (commit 217243e) moves its +`cssMode` into `linked.app.json`, deletes `linked.config.js` and updates its readme; it merges +with this major's release (backlog 018). + +### Changes + +- `src/utils/appConfig.ts`: settings in `AppConfig`, checks, `serializeAppConfig` writes them, + `LEGACY_CONFIG_FILES`, `assertNoLegacyConfig`, `readAppSettings`, `linkedServerConfig`. +- `schema/app/1.json`: the new keys. +- `src/interfaces.ts`: `AppServerSettings`, `CssMode`, `RpcExposureMode`, `RawQueriesMode`; + `LinkedConfig` / `LinkedServerConfig` as the server configuration; webpack types removed. + `src/defineConfig.ts` removed; `src/index.ts` exports. +- `src/commands/start.ts`, `src/cli-methods.ts` (`startServer`, `runMethod`), + `src/commands/build-app.ts`, `src/commands/worktree.ts`, `src/cli.ts`: read `linked.app.json`. +- `src/utils/generateOntology.ts`: the register-import fix. +- README (`linked.app.json` table, release and API-only sections), `docs/integration-branches-and-worktrees.md`. +- Tests: `appConfig.test.ts` (settings read, refused, written back; legacy file refused; server + configuration and the environment; `linked prefixes` keeps settings), `datasetCloneHint.test.ts`, + `startApiOnly.test.ts`, `ontologyGenerator.test.ts` (the register import). +- Changeset `.changeset/app-settings-in-linked-app-json.md` (major); backlog 018 item 2. + +### Verification + +- `node lib/esm/launch.js build` → `✔ Build successful` (6.0 s). +- `npx jest tests/unit` → `Test Suites: 105 passed, 105 total`, `Tests: 1312 passed, 1312 total` + (1 min 36 s). +- `npm run test:e2e`, with the clone in `create-app` pointed for the run at the template branch + (`git clone --depth 1 --branch linked-app-json file://…/app-template`, reverted and rebuilt + after) → `7 passed (1.5m)`. +- An app folder with only `package.json` and `linked.config.js`, `linked start` → `Error: …/linked.config.js is no + longer read: an app's settings live in linked.app.json. Move them there and delete linked.config.js:` and the JSON above. +- A host app on this cli, its settings moved into `linked.app.json` (`cssMode`, `syncShapesOnBoot: + false`, `server.rpcExposure: "enforce"`, `server.rawQueries: "off"`), started on its own port: + signed in; its server-rendered page carries `tailwindcss v4.3.3`; `/api/select-raw` answers + `403` anonymous and signed in; started with `LINKED_RPC_EXPOSURE=warn` it logs + `!! RPC EXPOSURE IS 'warn', NOT 'enforce'.` (none without the variable); its integration and unit + suites pass (424 passed, 4525 passed). + +### Deviations + +- The e2e clones the template's `main`, which still has `linked.config.js` until the release: it + was run against the template branch with an uncommitted change (above). Against `main` it fails + until the branch merges (backlog 018 item 2). +- The template is a separate repository: its change is a pushed branch, no PR (it merges with the + release). + +### Follow-ups + +- Merge the template branch with the release; host apps that write a `linked.config.js` into the + apps they create switch first: backlog 018 item 2. +- Schema URL, core range, hyphenated prefixes: backlog 018 (unchanged). + +## Details + +### Decisions taken autonomously + +| # | Where | Problem | Choice | Alternative | Rationale | +|---|---|---|---|---|---| +| 1 | scope | Which fields of the old config move | Every declarative one in use: `cssMode`, `syncShapesOnBoot`, `datasetCloneScript`, `publish`, `server.rpcExposure`, `rawQueries`, `apiOnly`, `cachePaths`, `cacheTimeout` | Only the four named | They are all still read; leaving any out loses it silently | +| 2 | scope | `server.loadAppComponent`, `loadRoutes` (functions), `server.multiCore` (read nowhere), `webpack` | Not settings: the cli always sets the hooks; `multiCore` and the webpack types removed; the refusal names them | Keep a code escape hatch | No app overrides the hooks; one way | +| 3 | env | `LINKED_RPC_EXPOSURE` vs the file | The variable wins when set; an invalid value is refused | The server's order (config wins) | Keeps the break-glass switch working for an app that pins `enforce` in its file; a typo must not open methods | +| 4 | env | `LINKED_RAW_QUERIES` vs the file | The file wins (the server's order) | The variable wins too | Only the RPC switch has a diagnosing use; a variable must not reopen raw queries an app turned off | +| 5 | API | `defineConfig` | Removed | Keep for typing | Nothing imports a settings module any more | +| 6 | legacy | `lincd.config.js` | Refused like `linked.config.js` | Ignore it | Its settings would be lost silently | +| 7 | worktree hint | A leftover config or invalid file when printing the clone hint | Falls back to the default script | Fail `worktree add` | The hint is advice; the server start refuses the app anyway | +| 8 | template | The template is its own repository | Branch `linked-app-json`, merged with the release | Merge now | The published cli does not read the settings yet | +| 9 | generator | Which imports of a missing module to replace | Only `src/ontologies/.register` with no source file | Any import of a missing file | The case found; anything wider could hide a real broken import | + +### Phases + +1. Settings in `linked.app.json`, refusal, environment, readers, types, README, tests — build and + 1312 unit tests pass. +2. Generator register-import fix — its unit test passes. +3. Template branch, e2e against it — 7 passed. diff --git a/docs/reports/054-land-build-order.md b/docs/reports/054-land-build-order.md new file mode 100644 index 00000000..c45a890f --- /dev/null +++ b/docs/reports/054-land-build-order.md @@ -0,0 +1,66 @@ +--- +date: 2026-11-11 +summary: > + `linked branch land` built `@_linked/auth` before `@_linked/cli`: the shared dependency order + hit the core/cli cycle (cli depends on core, core devDepends on cli) and fell back to name order. + `dependencyOrder` now orders the build tool as build-all does (its dependencies, the tool, the + rest), and release PRs, checkout and land all use it. Patch. +packages: [cli] +--- + +# 050 — One dependency order, with the build tool first + +## Summary + +`linked branch land ` fast-forwards the owner's checkouts, then runs `npx linked build` in each +landed package. It works through them in `dependencyOrder`, the order release PRs and `checkout` +use as well. Almost every framework package lists `@_linked/cli` as a devDependency, and the CLI +depends on `@_linked/core`, which devDepends on the CLI. That cycle left no repo ready, so the +order fell back to `rel` order for everything left. `_linked-auth` sorted before `_linked-cli`, +ran the old CLI, and its ontology check failed. + +`dependencyOrder` now orders the build tool the way `build-all` does (`orderBuildToolFirst`). Edges +to the build tool count as satisfied. Its own dependencies come first, in dependency order, then +the build tool, then the rest in dependency order, with ties broken by `rel` and the app last. +Release PRs, `checkout` and `land` all share this one order. In `land`, when the build tool fails +to build, the packages after it are not built, since they would build with a broken tool, and so +they are not pushed. + +## PR + +**What changed** + +- `src/commands/release.ts`: `dependencyOrder` handles the build tool (`BUILD_TOOL_PACKAGE` from + `lifecycle.ts`). It drops edges to the tool, puts the transitive closure of the tool's own + dependencies first, then the tool, then the rest. Any other cycle still falls back to `rel` + order. +- `src/commands/master.ts`: `branchLand` builds the landed packages in that order. When the build + tool's build fails, every package after it is marked `built: false` with a message naming the + tool. +- `tests/unit/integration/releasePlan.test.ts`: `dependencyOrder` with the real shape. core and cli + form a cycle, and auth and server devDepend on cli and depend on core. The expected order is core, + cli, auth, server, app. A second test: a package that does not list the CLI still comes after it. +- `tests/unit/integration/master.test.ts`: land with the same cycle builds core, cli, auth, server. + When the CLI's build fails, server is not built. +- Changeset `land-build-order.md` (patch). + +**Verification** + +- The four new tests against `main`'s `release.ts` and `master.ts`: + `Tests: 4 failed, 36 skipped, 40 total`. Before this fix, the land test received + `_linked-core, _linked-auth, _linked-cli, _linked-server`. +- With the fix, `npx linked build`: `✔ Build successful`. +- `jest tests/unit/integration/master.test.ts tests/unit/integration/releasePlan.test.ts tests/unit/checkout`: + `Test Suites: 8 passed, 8 total`, `Tests: 121 passed, 121 total`. +- The full unit suite: `Test Suites: 1 failed, 102 passed, 103 total`, + `Tests: 13 failed, 1258 passed, 1271 total`. All 13 failures are in + `tests/unit/shapeHierarchy.test.ts`. They fail the same way on unmodified `main` in this worktree + (`Tests: 13 failed, 5 passed, 18 total`), because the fixture loads the host checkout's localized + `@_linked/core`. The worktree used a link farm into an app checkout's install, not an install of + its own. Not related to this change. +- The e2e suite (Playwright, scaffolds and installs an app) was not run. It does not cover these + orders. + +**Follow-ups** + +- None. diff --git a/jest.config.cjs b/jest.config.cjs index f854dcc5..f9f68dfa 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -14,7 +14,7 @@ const path = require('path'); // `@_linked/core` cannot be found with require.resolve(): it is ESM-only, so its // export map has no `require` condition and not even `./package.json` is // exported. And it is not necessarily in ./node_modules — when this repo is -// checked out inside the create_now yarn workspace, the dependency is hoisted to +// checked out inside a host app's yarn workspace, the dependency is hoisted to // the workspace root. So walk the node_modules chain the way node does, and // derive the on-disk layout from the package's own export map rather than // assuming `lib/esm`. diff --git a/package-lock.json b/package-lock.json index 6ea15022..9cac47aa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.61.0", "license": "MIT", "dependencies": { - "@_linked/core": "^2.39.0", + "@_linked/core": "^3.0.0", "@tailwindcss/vite": "^4.1.4", "@types/react": "^19.3.0", "@types/react-dom": "^19.3.0", @@ -62,9 +62,9 @@ } }, "node_modules/@_linked/core": { - "version": "2.48.0", - "resolved": "https://registry.npmjs.org/@_linked/core/-/core-2.48.0.tgz", - "integrity": "sha512-w+WC2xSmI4dAISUIaDNho00eUlTftWQctd69kCQsHrhZ1X1WobkGk59nc2/zO9DRsQpDFeDiFGJusPdEp3PY8w==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@_linked/core/-/core-3.0.0.tgz", + "integrity": "sha512-r/IRn6xLvVdfaV95WeO9a5OU5dYp8Z3jKJh1mXqt1aYGrY6VUN3P9yxH2Ke3TLE4nWoaw7xK3KEr1VbUBs2dIw==", "license": "MIT", "dependencies": { "n3": "^2.13.12", diff --git a/package.json b/package.json index d4c17dcb..5ff103f7 100644 --- a/package.json +++ b/package.json @@ -69,12 +69,13 @@ "lib", "defaults", "hooks", + "schema", "README.md", "CHANGELOG.md", "LICENSE" ], "dependencies": { - "@_linked/core": "^2.39.0", + "@_linked/core": "^3.0.0", "@tailwindcss/vite": "^4.1.4", "@types/react": "^19.3.0", "@types/react-dom": "^19.3.0", diff --git a/schema/app/1.json b/schema/app/1.json new file mode 100644 index 00000000..15b5a2f0 --- /dev/null +++ b/schema/app/1.json @@ -0,0 +1,105 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://linked.cm/schema/app/1.json", + "title": "linked.app.json", + "description": "A linked app's declarative settings, at the app root. Packages never have one.", + "type": "object", + "required": ["schemaVersion"], + "additionalProperties": false, + "properties": { + "$schema": { + "type": "string", + "const": "https://linked.cm/schema/app/1.json" + }, + "schemaVersion": { + "description": "The version of this schema the file follows. A tool refuses a version it does not know.", + "const": 1 + }, + "prefixes": { + "description": "The app's prefix map: prefix → namespace IRI. Its server, its browser bundle and its store queries all use it. Tools only add entries (`linked prefixes`); a rename or removal is the app owner's.", + "type": "object", + "propertyNames": { + "pattern": "^[A-Za-z][A-Za-z0-9_]*$" + }, + "additionalProperties": { + "type": "string", + "pattern": "^[A-Za-z][A-Za-z0-9+.-]*:\\S+$" + } + }, + "cssMode": { + "description": "CSS processing the server applies for server-side rendering in development: Tailwind CSS v4, or PostCSS (the default).", + "enum": [ + "tailwind", + "postcss" + ] + }, + "syncShapesOnBoot": { + "description": "Materialize the app's registered shapes into its data store as SHACL on boot. false for a server whose default dataset routes data per context, or an app that manages its own shape and dataset lifecycle.", + "type": "boolean", + "default": true + }, + "datasetCloneScript": { + "description": "The npm script that copies the app's data into a dataset named by its one argument (npm run