Repository navigation
Cli 2: linked.app.json, the ontology index layout, core 3 - #349
Merged
Merged
Conversation
…by its name or domain
…ne-dataset script (or datasetCloneScript), warn when it has none; port hint names the app's port Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ead from the ontology's vann data, refused without it generate-ontology names the modules and the linkedOntology registration by the linkedOntologies key (lowercase), and writes Prefix.add from the vann:preferredNamespacePrefix of the ontology's owl:Ontology node. The build and the command refuse an ontology without that prefix, or whose vann:preferredNamespaceUri is not its namespace, naming the package, the ontology, its files and the triples to add. The ontology scaffold writes both triples.
…, the build check
…module" and "generated": false; the declarations read by a pure readOntologyConfigs
…package registering every ontology; the template and create-ontology write that layout
…linked prefixes, and generate-ontology in an app), the map loaded at server start and into the client bundle; the ontology index calls registerOntologies with the module URL
…is, with a warning
… the app's prefix map
…hand with the ontology index
…datasetCloneScript, publish, server); linked.config.js is refused; LINKED_RPC_EXPOSURE wins over server.rpcExposure; defineConfig and the webpack module types removed
…nd the architecture notes
…urtle IRI linkedOntologies namespaces and linked.app.json prefix namespaces share NAMESPACE_IRI, exported from utils/ontologyConfig.
land built the landed packages in release order, which follows only the dependencies a package.json lists, so a package that runs `npx linked` without listing @_linked/cli could build before it with the old tool. Use build-all's order (orderBuildToolFirst) instead, and skip the rest when the build tool fails to build.
The earlier commit misnamed the cause. auth does list @_linked/cli (as a devDependency), but cli depends on core and core devDepends on cli. With that cycle no repo was ready, so dependencyOrder fell back to rel order for everything left, which put auth before cli. dependencyOrder now orders the build tool as build-all does: edges to it count as satisfied, its own dependencies come first, then the tool, then the rest. Release PRs, checkout and land share this one order, and land no longer has an ordering of its own.
Contributor
Author
|
Merged with "Dual-copy e2e" red as a one-off, approved exception ("Build & Test" is green). The e2e scaffolds the app template's main, which still has linked.config.js and the 2.x framework set; with this cli (core ^3) that is a refused config and two copies of core. Expected to fail until the coordinated set and the template are published, per the release plan; re-run once they are. |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the coordinated major of the
@_linkedpackages: ontologies register withregisterOntologies(core 3), prefixes belong to the app, and the cli 2 ontology layout.Merges
dev(withmainmerged in) intomain, plus the move to@_linked/core^3.0.0 (published) and the package template's ranges (defaults/package/package.json: core ^3.0.0, cli ^2.0.0). Locally against core 3.0.0:test:unit105 suites passed, 1319 tests passed, 1 skipped. The app template's move tolinked.app.jsonlands in linked-fw/app-template next; the dual-copy e2e clones that template.Changesets
app-json-wording.md): Comments and the architecture notes namelinked.app.json, not the removedlinked.config.js.app-settings-in-linked-app-json.md):linked.app.jsonholds every setting of an app;linked.config.jsis no longer read.Breaking.
linked.config.js(orlincd.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 intolinked.app.jsonand delete the file.cssMode(tailwind|postcss),syncShapesOnBoot,datasetCloneScript,publish(staticAssets,releasePrefix) andserver(rpcExposure,rawQueries,apiOnly,cachePaths,cacheTimeout). Each is checked; an unknown key, also insideserverorpublish, is refused.linked prefixeskeeps them when it adds prefixes.LINKED_RPC_EXPOSURE, when set, wins overserver.rpcExposure; a value other thanwarnorenforceis refused at start.defineConfig(@_linked/cli/defineConfigand the package entry) is removed: nothing reads a settings module any more.ModuleConfig,AdjustedModuleConfig(the old webpack build's) andLinkedServerConfig.multiCoreare removed;LinkedConfigis the configuration the cli givesLinkedServer(cssMode,syncShapesOnBoot,server), and losesdatasetCloneScript. New:AppServerSettings,CssMode,RpcExposureMode,RawQueriesMode.server.loadAppComponentandserver.loadRoutesare set by the cli only.resolveLinkedConfigPathandLINKED_CONFIG_FILES(@_linked/cli/commands/start) are removed;readDatasetCloneScriptis synchronous.Fixed.
linked generate-ontologyreplaces a side-effect import of asrc/ontologies/<name>.register.jsthat 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.dataset-clone-script.md):linked worktree add --dataset <name>andlinked branch start <m> --worktree --dataset <name>now print how to fill the new dataset from the app's own clone script instead of fixed script paths:clone-datasetto its rootpackage.jsonthat copies its data into the dataset named by its one argument. The hint is thenClone the data into <name> first (from <root>): npm run clone-dataset -- <name>.datasetCloneScriptinlinked.config.js:defineConfig({datasetCloneScript: 'data:clone'})(new optionalLinkedConfigkey).datasetCloneScriptnames a scriptpackage.jsonlacks), 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 addwithout--portnames the app's own port (its.envPORT, else 4040) as the main checkout's, andbranch landsays "Restart the app on …". Seedocs/integration-branches-and-worktrees.md, "Cloning a dataset".debuginfo-stale-todo.md): Removes a stale commented-out TODO aboutlinked.config.jsonfromdebugInfo.host-app-generic.md): Comments and docs describe the host app generically.land-build-order.md): One dependency order for release PRs,checkoutandbranch land, with the build tool ordered aslinked build-allorders 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 landtherefore built such a package with the old build tool. When the build tool fails to build inbranch land, the packages after it are not built (and so not pushed).namespace-iri-characters.md):linkedOntologiesnamespaces and the namespaces oflinked.app.jsonprefixes refuse the characters that cannot appear in a SPARQL or Turtle IRI (<,>,",{,},|,^, backtick, backslash, whitespace and control characters).NAMESPACE_IRIis exported fromutils/ontologyConfig.ontology-index-and-app-prefixes.md): One ontology index per package, and an app's own prefix map inlinked.app.json.Ontology modules (breaking).
linked generate-ontologywrites, per package:src/ontologies/<module>.tsfor each generated ontology: only its terms, eachexport const Term = {id: '<namespace>Term'};(the valuecreateNameSpace(namespace)('Term')returns). It imports nothing; usecreateNameSpacefrom@_linked/core/utils/NameSpacewhere code needs a namespace function.src/ontologies/index.ts: imports every ontology module of the package (those with"generated": falsetoo) and registers them all with oneregisterOntologies([{name, namespace, terms, data, suggestedPrefix}], import.meta.url)call.registerOntologiescomes from the package'ssrc/package.ts(linkedPackage(...)), so it needs the@_linked/coremajor that provides it.src/index.ts[x]) imports./ontologies/index.js; side-effect imports of a removed<module>.register.jsbecome an import of the index.<module>.data.tsand<module>.register.tsare no longer generated: the command removes the ones it wrote before. Their exports (ns,dataFiles,loadData,_ontologyResource) are gone; importcreateNameSpacefrom core instead ofns.linked build's ontology check also fails when the entry does not import the index or such a file is left. Runlinked generate-ontologyand commit the result."generated": false) no longer registers itself: the index does.create-package --kind ontologyandcreate-ontologywrite this layout; the package template'ssrc/package.tsexportsregisterOntologiesinstead oflinkedOntology.ontologies/index.js(orsrc/ontologies/index.tsbefore it is built).@_linked/cli/utils/ontologyModules:generateOntologyModules(specs, handWritten?)returns every module of a package (terms modules andsrc/ontologies/index.ts); newgenerateOntologyIndexModule;generateOntologyDataModuleandgenerateOntologyRegisterModuleare removed;OntologyModuleSpec.ontologyis removed.generatePackageOntologiesreturns{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": {"<prefix>": "<namespace>"}}. The schema ships asschema/app/1.json; an unknownschemaVersionor key is refused; a prefix is^[A-Za-z][A-Za-z0-9_]*$.ontology-module-and-hand-written.md): AlinkedOntologiesentry 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 insrc/ontologies/: a generated ontology's files are<module>.ts,<module>.data.tsand<module>.register.ts, imported as<package>/ontologies/<module>. The registration still uses the name:linkedOntology(terms, ns, '<name>', …). Two entries with one module are refused."generated": false(defaulttrue) declares an ontology whose modules hold more than the generator writes.linked generate-ontologywrites nothing for it andlinked buildskips its staleness check, but its data must carry the same vann triples, and the build refuses it without them:@_linked/cli/utils/ontologyConfig:readOntologyConfigs(pkgJson)returns{name, namespace, module, generated, data}per ontology, sorted by name.OntologyConfig,ONTOLOGIES_KEY,ONTOLOGY_NAMESPACEandreadOntologyConfigsmove there from@_linked/cli/utils/generateOntology.OntologyModuleSpec.module(optional) names the generated files.ontology-names-and-vann-prefix.md): 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/<name>.ts,.data.ts,.register.ts) and is the third argument of the generatedlinkedOntology(terms, ns, '<name>', loadData, dataFiles). It is no longer a prefix.linked generate-ontologyreads the suggested prefix from thevann:preferredNamespacePrefixof the ontology'sowl:Ontologynode and writesPrefix.add('<that prefix>', '<namespace>')in<name>.data.ts.linked generate-ontology): every ontology'sowl:Ontologynode must carry exactly onevann:preferredNamespacePrefixand onevann:preferredNamespaceUriequal to its configurednamespace. 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, asrc/data/<name>-added.ttllisted in itsdata):linked generate-ontology.Verification
CI (
Build & Test) on this PR, built with the cli 2 release commit through the shared workflow'scli-version.