Artifact 7fc268ba39bfd39e926b0e5bda428a41724a5f9dfd4d4964b30b81eb910851f8:
- File
docs/projects.md
— part of check-in
[5ef6c04ebd]
at
2026-11-13 09:35:59
on branch trunk
— Phase 4c: suit why says which supplier of an asset is in effect, and why
suit why NAME prints, for the folder you are in, every place that supplies an asset and what became of it: placed, dropped because the machine-limited outfit wins, joined, not applied on this machine, no project with that key here, a clash with a real file, or skipped. It uses the resolver's own record of each decision, so why and apply cannot disagree. Where an asset is placed at both personal and User scope it says which the harness reads first.
suit status now prints a line for a machine-limited personal outfit that did not apply, as it did for User ones.
The project tests set a user name. The forge's runner sets none, so on the last check-in the store never opened there and 130 project cases failed. The suites are now also run with no user name before a push.
1011 unit checks, 227 shell cases, 146 store cases, 612 placement cases and 376 project cases, under clang, under gcc 16, and with no user name set. 100% coverage in all 19 source files. (user: dmestas, size: 8221) [annotate] [blame] [check-ins using]
# Projects A project is a code repository on your disk: the nearest folder holding `.git`, `.fslckout` or `.zit-checkout`. Suit finds projects by scanning the folders you name, and matches each one to config by its remote address. ## The key A project's key is its remote address reduced to host and path: lower-case host, no scheme, no user or password, no port, no trailing `.git` or `/`. | Remote address | Key | |---|---| | `https://github.com/Owner/Name.git` | `github.com/Owner/Name` | | `[email protected]:Owner/Name.git` | `github.com/Owner/Name` | | `ssh://[email protected]/Owner/Name` | `github.com/Owner/Name` | | `https://User:[email protected]:8443/x/y.git/` | `example.com/x/y` | | `https://zeitforge.app/r/dmestas/suit` | `zeitforge.app/r/dmestas/suit` | The key is what a `[wear personal KEY]` or `[wear shared KEY]` section in `suit.conf` names, so config follows a project wherever it is cloned. A user name or password in a remote address never reaches suit's files or output. ## Commands | Command | What it does | |---|---| | `suit roots` | Print the folders suit looks in | | `suit roots add FOLDER` | Add one. FOLDER is an absolute path. | | `suit roots rm FOLDER` | Remove one | | `suit projects scan` | Walk the roots and rewrite the list of projects | | `suit projects` | Print the list: one line per project folder, `KEY FOLDER KIND` | | `suit project set FOLDER KEY` | Give a project a key by hand | | `suit project unset FOLDER` | Take a hand-set key away | A project with no key is listed with `-` in the key column. A key set by hand is applied by the next scan and kept across scans. ## The scan - It walks each root to a depth of four folders. - It does not follow symbolic links. - It does not look inside a project for more projects, except to find a git project's linked worktrees. - A folder it cannot read is skipped with a note. - It runs no other program. Everything is read from the project's own files. ## What each kind supports | Kind | Marker | Where the remote is read from | Worktrees | |---|---|---|---| | git | `.git` | `url` under `[remote "origin"]` in `.git/config`, or the first remote when there is no origin | Each linked worktree is listed with its project's key | | Fossil | `.fslckout` | The checkout database names the repository file, and that file's `last-sync-url` setting holds the remote | Not applicable | | zit | `.zit-checkout` | Not read. A zit project has no key until you set one with `suit project set`. | Not found | A linked git worktree has a `.git` file where a project has a `.git` folder. Suit follows it to the main repository's config, so a worktree made by an agent gets the same key, and later the same personal links, as the project it belongs to. ## Files All three sit in suit's home folder, are read strictly (a malformed line is an error that names the file and the line) and are rewritten by writing a new file beside the old one and renaming it. | File | Holds | Written by | |---|---|---| | `roots` | One absolute folder per line | `suit roots add`, `suit roots rm` | | `projects` | One line per project folder: key, folder, kind | `suit projects scan` | | `projects.set` | Keys set by hand: folder and key | `suit project set`, `suit project unset` | ## What lands in a project `suit apply` places the Project personal scope: for each `[wear personal KEY]` section, in every project in the list whose key is KEY. A linked worktree is a line of its own with the same key, so it gets the same links. `apply` uses the list as it is and does not scan; a `suit run` applies after a scan that changed the list, because the stamp watches `roots`, `projects` and `projects.set`. Each asset is a link to the store, as in the User scope, below the project's folder: | Asset | Where it lands | |---|---| | skill | `FOLDER/<skills.personal>/NAME` | | agent, command | `FOLDER/<agents.personal>/FILE`, `FOLDER/<commands.personal>/FILE` | | `instructions` | `FOLDER/<instructions.personal>` | | `file DEST = SRC` | `FOLDER/DEST` | - A harness's `.personal` folders are relative paths, with no `..` part. A harness with none for a kind is skipped for that kind, and `suit plan` and `suit status` say `skipped HARNESS KIND NAME in FOLDER (no folder)`. - DEST of a `file` worn at personal scope is relative with no `..` part. An absolute or `~` DEST is an error that names the outfit. - A `slot` in an outfit worn at personal scope is an error: a slot belongs to the User scope. - `[wear personal KEY machine=NAME]` applies only on that machine. Where both it and the unlimited section supply the same destination the limited one wins, and two `instructions` are joined, broadest first, into a file of suit's own that the destination links to, exactly as at the User scope. - A `[wear personal KEY]` that matches no project is no error. `suit status` says `personal KEY: no project with this key`. - `[wear shared ...]` sections are not placed yet and are not an error. Suit never touches what is not its own. A destination that holds a real file, a real folder or someone else's link is a clash: reported and left as it is, so a file committed in the project always wins. Suit never runs git and never stages, commits or changes anything else in a project. ## How the links are hidden Links in a project must not be committed by accident, and a global ignore rule would hide same-named files in every project. So each git project hides its own links, in its own local exclude file, `info/exclude` in the main repository (for a linked worktree, found through `commondir`). Suit keeps one block there: # suit begin /.claude/skills/tdd /CLAUDE.local.md # suit end One line for each link suit owns in the repository's project and worktrees, written as a path from the project's top, with a backslash before any of `\ * ? [`. A destination that is a clash is not listed. Everything outside the block is left byte-identical; a file with no final newline gets one before the block, and its block ends without one, so taking the block out gives back the very bytes that were there. The file is rewritten atomically. The ledger records the block as `block PATH`, or `block PATH created` when suit made the file. `suit off` removes the block and nothing else, and removes the file only if suit made it and nothing else is in it. A Fossil or zit project has no local exclude file. Its links are placed, and `suit status` says `links in FOLDER are visible to its version control (KIND has no local exclude file)`. ## Why an asset is where it is `suit why NAME` answers it for the current folder, and changes nothing. NAME is a skill's folder name, an agent's or command's file name with or without `.md`, `instructions`, a slot's name, or a `file`'s destination as the config spells it. It prints one line for each place that supplies the asset: SCOPE: outfit OUTFIT, HARNESS, DESTINATION: STATE SCOPE is `user`, `user machine=NAME`, `personal KEY` or `personal KEY machine=NAME`. STATE is one of: | State | Meaning | |---|---| | `placed` | This one is in effect | | `dropped (the machine-limited outfit wins)` | A machine-limited outfit of the same scope supplies the same destination | | `joined` | Instructions joined with another file; both lines say so | | `not applied (not this machine)` | The section is limited to another machine | | `not applied (no project with this key here)` | Only outside a project, or in one with no key: a personal section whose key no project has | | `clash (REASON)` | The destination holds something that is not suit's, such as `a real file` committed in the project | | `skipped (no folder)` | The harness names no folder for this kind | Personal places are shown only for the project the current folder is in (the longest project folder that holds it). A harness reads its own project folder before its user folder, so when a harness has both a personal and a User place for the asset, both are placed and a last line says `HARNESS reads the project's before the user's`. A name nothing supplies prints `nothing supplies NAME here` and exits 1; a wrong number of arguments exits 2. The states come from the same decision `apply` uses, not a second one.