Repository navigation
feat(workspace): the declaration, findWorkspaceRoot, chant workspace init and ls (#2534) - #2593
Merged
Merged
Conversation
lex00
force-pushed
the
feat/2534-declaration
branch
2 times, most recently
from
September 24, 2026 02:30
6639613 to
59f91dd
Compare
4 tasks done
lex00
force-pushed
the
feat/2534-declaration
branch
2 times, most recently
from
September 24, 2026 02:58
fdcdafc to
6378274
Compare
lex00
force-pushed
the
feat/2534-declaration
branch
2 times, most recently
from
September 24, 2026 03:35
1410660 to
06f2128
Compare
This was referenced Sep 24, 2026
…init and ls (#2534) chant.workspace.json (or .jsonc) with a JSON Schema shipped in @intentius/chant and validated on every read, parse and schema errors with file, line and column, example groups (ws-051), placement rules, and minReader. findWorkspaceRoot walks up to the git root. chant workspace init proposes a declaration and prints what leaves the root project before it writes; chant workspace ls lists members with reason codes and a versioned --json contract. The chant repo commits its own chant.workspace.json, replacing the design draft.
lex00
force-pushed
the
feat/2534-declaration
branch
from
September 24, 2026 04:40
06f2128 to
f31737f
Compare
This was referenced Sep 24, 2026
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.
Closes #2534. Level 1 (#2525); ws-051 (#2588) is on main.
What it adds:
chant.workspace.json/.jsonc, schema 1:name,schema,membersrequired;minReader,pins,$schema,$commentandx-*fields optional; any other field refused. Schema atpackages/core/src/workspace/declaration.schema.json, validated with ajv on every read. A small JSON/JSONC reader gives every parse and schema error a file, line and column, refuses duplicate keys, and never reads an empty file as a declaration. Both names present isdeclaration-ambiguous.{ name, dir, kind, roles?, upstream?, because? }(becauserequired forother) and example groups{ name, kind: "examples", glob }per ws-051. D2 name grammar, with_workspace/_membersreported as reserved. Placement: no../absolute paths, no two members in one directory, only"."contains members; a group match is never a member's directory, never contains one, never sits inside a nested workspace, and no two groups share one. A match may sit inside a member.findWorkspaceRootinproject-root.ts: walks up to the git root (the first directory with.git), existsSync only, so a level-0 command could call it later.findProjectConfigis unchanged.chant workspace init [dir] [--name] [--yes] [--verbose]: proposes members and groups from chant configs, nested declarations, npm packages and example trees. It prints the directories leaving the root project, with their .ts file counts, before asking, and writes only after ayor--yes. Without a TTY and without--yesit writes nothing.chant workspace ls [dir] [--at <rev>] [--json]: an unreadable member is listed withdir-missing,unknown-kindorkind-probe-failedand the command still exits 0.--jsonfollowsls.schema.json(contract 1, closed code lists), likerecords.cli/workspace-init,cli/workspace-ls,reference/workspace-declaration.The chant repo: the real
chant.workspace.jsonis committed. It is whatinitproposes, with one hand edit:reference-workspace/(#2543) is oneothermember until its own declaration stops being a draft, rather than the two members init finds inside it, anddocs/design/chant.workspace.draft.jsonis removed. Nothing outsidechant workspacereads the file:findWorkspaceRoothas no other caller,recordsdoesn't look at it, and the goldens run on copies outside the repo. So chant's CI is unchanged. It differs from the draft in three places.opsis left in the root because it holds Op files with no chant.config, so kindchantwould fail its probe.editors/vscodeis added asother. The lexiconbecausetexts are init's generic ones.One interpretation: D1's root member
"."is read asdir: ".", and its name follows the grammar (init names itroot).Hooks for other issues, kept small:
workspace/kinds.tshas aKindRegistrywith the built-inschant,workspaceandother.listWorkspace({ kinds })takes a registry. Plugin kinds, precedence andWSPchecks slot in there.resolveGroups()gives each group's matches,rootExclusions()the directories the root project loses, andownerOf()the member or group that owns a path.ownerOf()maps a path to its member for_members/<member>. The ws-037 "init proposes a unique stack per member" line is left to workspace: member ledgers under _members/ and unique ownership stacks #2538.declaration.schema.jsonas optional within schema 1. A declaration that uses one setsminReader, since an older chant refuses unknown fields.Level 0 is unaffected: every new module is under
workspace/and loads throughawait importin main.ts. The level-0 goldens and the no-workspace-module test pass unchanged.