@catalyst-cloud/cli 0.9.3 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +35 -31
  3. package/dist/args.js +13 -1
  4. package/dist/ask.js +2 -2
  5. package/dist/capabilities.js +70 -0
  6. package/dist/cli.js +37 -29
  7. package/dist/config.js +1 -1
  8. package/dist/connections.js +5 -5
  9. package/dist/environment.js +4 -4
  10. package/dist/events.js +1 -1
  11. package/dist/execution.js +5 -4
  12. package/dist/identity.js +3 -3
  13. package/dist/oauth.js +3 -3
  14. package/dist/query.js +27 -1
  15. package/dist/ready.js +3 -3
  16. package/dist/release.js +1 -1
  17. package/dist/replica.js +9 -7
  18. package/dist/runtime-store.js +2 -2
  19. package/dist/runtime.js +1 -1
  20. package/dist/secret.js +1 -1
  21. package/dist/skills.js +1 -1
  22. package/dist/team.js +329 -0
  23. package/package.json +1 -1
  24. package/skills/catalyst-github/SKILL.md +1 -1
  25. package/skills/catalyst-linear/SKILL.md +1 -1
  26. package/skills/catalyst-onboard/SKILL.md +51 -35
  27. package/skills/catalyst-onboard/references/choosing-a-coding-account.md +52 -0
  28. package/skills/catalyst-onboard/references/declaring-a-repository.md +4 -2
  29. package/skills/catalyst-onboard/references/local-sync.md +3 -3
  30. package/skills/catalyst-onboard/references/replacing-a-credential.md +2 -2
  31. package/skills/catalyst-onboard/references/skill-sources.md +1 -1
  32. package/skills/catalyst-onboard/references/the-one-path.md +54 -86
  33. package/skills/catalyst-onboard/references/what-a-phase-needs.md +6 -6
  34. package/skills/catalyst-onboard/references/what-the-browser-owns.md +8 -10
  35. package/skills/catalyst-onboard/references/who-fixes-what.md +38 -18
  36. package/skills/catalyst-onboard/scripts/lib/cli.mjs +15 -1
  37. package/skills/catalyst-onboard/scripts/local-sync.mjs +6 -6
  38. package/skills/catalyst-onboard/scripts/where-am-i.mjs +294 -61
  39. package/skills/catalyst-setup/SKILL.md +1 -1
  40. package/skills/connect-me/SKILL.md +1 -1
  41. package/skills/how-catalyst-works/SKILL.md +2 -2
  42. package/skills/how-catalyst-works/references/what-runs-next.md +11 -0
  43. package/skills/run-this-project/SKILL.md +1 -1
  44. package/skills/unstick/SKILL.md +1 -1
  45. package/skills/what-needs-me/SKILL.md +1 -1
  46. package/skills/whats-happening/SKILL.md +1 -1
  47. package/skills/whats-happening/references/reading-the-board.md +1 -1
  48. package/skills/whats-happening/references/why-is-it-stuck.md +1 -0
@@ -6,7 +6,7 @@ A person can finish every other step and still see nothing run. A phase needs tw
6
6
 
7
7
  **For:** a phase runs on one of the tenant's own enrolled coding accounts. With none active, no phase can start.
8
8
 
9
- **Instrument:** `codingAccounts` in `catalyst-skills contract`. It carries a `state`, a printable `line`, who enrolls an account (`enrolledByLine`) and the `page`. The script prints all of them. It never shows a credential or an email. When the state is `enrolled`, the script also reads `catalyst-skills accounts` to check each account's credential.
9
+ **Instrument:** `codingAccounts` in `catalyst contract`. It carries a `state`, a printable `line`, who enrolls an account (`enrolledByLine`) and the `page`. The script prints all of them. It never shows a credential or an email. When the state is `enrolled`, the script also reads `catalyst accounts` to check each account's credential.
10
10
 
11
11
  **What each state means:**
12
12
 
@@ -17,15 +17,15 @@ A person can finish every other step and still see nothing run. A phase needs tw
17
17
  | `inactive` | accounts exist, but every one is out of rotation | reactivate one on the page. Never tell them to enrol another |
18
18
  | `unread` | the cloud could not read the accounts | say it could not be read. It is not "no accounts". Do not tell them to enrol one; read it again later |
19
19
 
20
- **Owner:** the one the contract names. The person does it in the browser. Never ask for the credential, and never handle it. A key cannot enrol one.
20
+ **Owner:** the one the contract names. The person does it in the browser. Never ask for the credential, and never handle it. A key cannot enrol one. Which kinds of account exist, what each asks for, and what to do with an ended or cancelled one are in `references/choosing-a-coding-account.md`; it is step 2 of the path, the first thing asked.
21
21
 
22
- **Older cloud:** if the contract has no `codingAccounts`, the script says the cloud is older and reads `catalyst-skills accounts` instead. That list counts the accounts enrolled and the ones able to take work. An expired, revoked or quarantined account does not count. The owner is then a tenant owner or admin, at `<their cloud>/settings/coding-accounts`.
22
+ **Older cloud:** if the contract has no `codingAccounts`, the script says the cloud is older and reads `catalyst accounts` instead. That list counts the accounts enrolled and the ones able to take work. An expired, revoked or quarantined account does not count. The owner is then a tenant owner or admin, at `<their cloud>/settings/coding-accounts`.
23
23
 
24
24
  ## Host
25
25
 
26
26
  **For:** the contract carries this as the `hosts_current` readiness check on each project. It reads the same on every project, because it is about the whole account.
27
27
 
28
- **Instrument:** the `hosts_current` check in `catalyst-skills contract --path teams`, and its owner in `catalyst-skills contract --path readinessChecks`.
28
+ **Instrument:** the `hosts_current` check in `catalyst contract --path teams`, and its owner in `catalyst contract --path readinessChecks`.
29
29
 
30
30
  **What each reading means:**
31
31
 
@@ -35,11 +35,11 @@ A person can finish every other step and still see nothing run. A phase needs tw
35
35
  | `unknown`, `no_host_connected` | no Catalyst host is connected | name the owner and stop |
36
36
  | `unknown`, `hosts_unreported` | a host is connected but has not said which mapping it loaded | name the owner; it clears when the host reconnects |
37
37
  | `fail`, `hosts_behind` | a connected host runs an older mapping | name the owner |
38
- | the part reads `unreadable` | no project has been checked yet | press Re-check on the projects page, then read it again |
38
+ | the part reads `unreadable` | no project has been checked yet | run `catalyst team check <KEY>` when the script names it (it does when the CLI has the verb and the person is an owner or admin); otherwise press Re-check on the projects page; then read it again |
39
39
 
40
40
  **Owner:** the contract names the owner of `hosts_current`, and where they act in its `fixedWhere`. When `fixedWhere` has a page, the script prints it, and the command too when there is one. When it is null, which it is today, the script prints the owner sentence alone. Then there is no page, so do not invent one. Say who owns it and that they connect it.
41
41
 
42
- ⛔ `catalyst-skills ready` treats this check as a note, so it can print READY while no host is connected. READY there is not proof a phase can run. The `host` part is.
42
+ ⛔ `catalyst ready` treats this check as a note, so it can print READY while no host is connected. READY there is not proof a phase can run. The `host` part is.
43
43
 
44
44
  ## Saying it is ready
45
45
 
@@ -8,12 +8,13 @@ These will never be a command, on any release. Each is an authorization a person
8
8
 
9
9
  | step | where | what you say |
10
10
  | -- | -- | -- |
11
- | approving the login | the URL and short code that `catalyst-skills login` printed | "I have started the login. It printed this code and this URL — approve it in your browser, or on your phone, and tell me when it is done." |
12
- | connecting Linear | `<their cloud>/settings/connections` | "Open this page and connect Linear. It will send you to Linear to authorize it and bring you back." |
11
+ | approving the login | the URL and short code that `catalyst login` printed | "I have started the login. It printed this code and this URL — approve it in your browser, or on your phone, and tell me when it is done." |
12
+ | enrolling a coding account, or replacing its credential | the AI accounts page the script printed for the `coding accounts` part | "Choose the provider, give the account a label you will recognise, and paste the credential the page asks for. Nothing on this side sees it. Tell me when it is saved and I will read it back." |
13
+ | connecting the Linear integration | `<their cloud>/settings/connections` (the Integrations page; Settings labels it Connections today) | "Open this page and connect Linear. It will send you to Linear to authorize it and bring you back." |
13
14
  | installing the GitHub App | `<their cloud>/settings/connections` | "Open the same page and install the GitHub App, granting it the repository you want worked and `<your GitHub org>/thoughts`." |
14
15
  | creating or confirming `<your GitHub org>/thoughts`, and letting the GitHub App reach it | GitHub, then the GitHub App's installation page for that org | "Catalyst's cloud phases write their notes to `<your GitHub org>/thoughts`, in the org that owns the code repository. Check it exists. If not, create a private repository named `thoughts`, initialized with a README. Then, on the GitHub App's installation page for that org, choose All repositories, or add `thoughts` to the selected repositories." |
15
- | connecting personal Linear | the URL printed by `catalyst-skills connections personal linear start` | "Approve your own Linear account in this browser. I will check the grant status afterward." |
16
- | connecting personal GitHub, after the tenant GitHub App is installed and its repository is registered | the URL printed by `catalyst-skills connections personal github start` | "Approve your own GitHub account in this browser. I will check the grant status afterward." |
16
+ | connecting personal Linear | the URL printed by `catalyst connections personal linear start` | "Approve your own Linear account in this browser. I will check the grant status afterward." |
17
+ | connecting personal GitHub, after the tenant GitHub App is installed and its repository is registered | the URL printed by `catalyst connections personal github start` | "Approve your own GitHub account in this browser. I will check the grant status afterward." |
17
18
 
18
19
  Say **by construction**, not "not supported yet". A person who thinks it is a missing feature will wait for it.
19
20
 
@@ -23,17 +24,14 @@ These are settings pages today because the routes behind them take a browser ses
23
24
 
24
25
  | step | where | what you say |
25
26
  | -- | -- | -- |
26
- | seeing every project they could set up | `<their cloud>/settings/linear-teams` | "I can read the projects that are already mapped, but the full list is only on this page today. Open it and tell me the ones you see." |
27
- | checking a project's readiness, or re-checking it | the same page | "I can read the verdict your tenant last stored, from the contract. Asking for a fresh check is on that page." |
28
- | mapping stages, or adopting the workflow | the same page, per project | "Pick one project, then **Map my stages** — or **Adopt the Catalyst workflow** if you want Catalyst's stages created for you." |
29
27
  | registering a repository | `<their cloud>/settings/repositories` | "Add the repository here, and attach it to the project you just mapped, in the same form." |
30
- | approving the environment **for one repository**, and entering its values | that repository's Environment page under `<their cloud>/settings/repositories`: the Setup declaration tab's Approve this revision button approves, and the Environment variables and Secrets tabs take the values | "The names come from `.catalyst/catalyst.toml` in the repository, which I can write with you. Approving it and entering the values happen here, once, by you. Nothing I run ever sees a value." (Account-wide names are **not** on this list: `catalyst-skills environment` does those.) |
28
+ | approving the environment **for one repository**, and entering its values | that repository's Environment page under `<their cloud>/settings/repositories`: the Setup declaration tab's Approve this revision button approves, and the Environment variables and Secrets tabs take the values | "The names come from `.catalyst/catalyst.toml` in the repository, which I can write with you. Approving it and entering the values happen here, once, by you. Nothing I run ever sees a value." (Account-wide names are **not** on this list: `catalyst environment` does those.) |
31
29
 
32
30
  ⛔ **Do not compose a request for any of these.** A skill script never makes a request of its own; only the CLI does, and the CLI has no verb for them. If you find yourself constructing a URL, stop.
33
31
 
34
32
  ## The URL to hand over
35
33
 
36
- Never type a host from memory. `catalyst-skills status` prints the API it is connected to on its `API:` line, and `node scripts/where-am-i.mjs` prints ready-made links built from it. Use those. A person pointed at the wrong tenant's settings page has a worse afternoon than one pointed at no page at all.
34
+ Never type a host from memory. `catalyst status` prints the API it is connected to on its `API:` line, and `node scripts/where-am-i.mjs` prints ready-made links built from it. Use those. A person pointed at the wrong tenant's settings page has a worse afternoon than one pointed at no page at all.
37
35
 
38
36
  ## Handing over, and coming back
39
37
 
@@ -49,5 +47,5 @@ When they come back:
49
47
 
50
48
  - Re-run `node scripts/where-am-i.mjs` and read them the part that should have changed.
51
49
  - If it changed, say what it now says and move on.
52
- - If it did not, refresh the contract once (`catalyst-skills contract --refresh`) and read it again — the contract is cached, and a page can be ahead of it by a few seconds.
50
+ - If it did not, refresh the contract once (`catalyst contract --refresh`) and read it again — the contract is cached, and a page can be ahead of it by a few seconds.
53
51
  - If it still did not, report both: what the page told them, and what the instrument says. Ask what they saw. **Never mark a step done because the person said a page worked** — the instrument is the record, and this is exactly where a confident false "all set" costs them an hour later.
@@ -1,44 +1,64 @@
1
1
  # Who fixes what
2
2
 
3
- Setup is seven parts. Each has one instrument, and each instrument answers about its own part and nothing else. Read this before you tell a person that something is not ready, and before you tell them to do anything about it.
3
+ Setup is eight parts. Each has one instrument, and each instrument answers about its own part and nothing else. Read this before you tell a person that something is not ready, and before you tell them to do anything about it. The product's words for what they own are Workspace, Project, Repository, Integration, Connected account and Member; the parts below are the instruments' names for the same things.
4
4
 
5
- ## The seven parts, and the instrument that owns each
5
+ ## The eight parts, and the instrument that owns each
6
6
 
7
7
  | part | instrument | what a pass proves | what it does **not** prove | who fixes a failure, and where |
8
8
  | -- | -- | -- | -- | -- |
9
- | **machine** | `catalyst-skills status`, and the non-team checks of `catalyst-skills ready` | Node is new enough, this machine holds a credential, the CLI is where the config says, the contract is cached, the skills are on disk | anything at all about the tenant | the person at this keyboard, here |
10
- | **person** | `catalyst-skills me`, and `catalyst-skills connections personal <linear|github> status` | the credential resolves to this person, shows their role and Linear identity match, and reports each personal grant's state | that their seat is active, or that they may change tenant settings | the member approves missing or expired personal grants in a browser; an owner or admin handles seat or identity conflicts in Settings → Members |
11
- | **account** | `catalyst-skills contract --path account` | a resolved Linear workspace means the tenant's Linear grant landed | that the GitHub App is installed — the contract does not carry it | a tenant owner or admin, `<their cloud>/settings/connections` |
12
- | **project** | `catalyst-skills contract --path teams`, and the `team:` checks of `ready` | for each project **that has been mapped**: its readiness verdict and each failing check by name | that this is every project they have — see below | a tenant owner or admin, `<their cloud>/settings/linear-teams` |
13
- | **repository** | `catalyst-skills contract --path merge.repositories` | the repository is registered to the account | that it is active, that a project can dispatch into it, or that its environment is declared | a tenant owner or admin, `<their cloud>/settings/repositories` |
14
- | **coding accounts** | `codingAccounts` in `catalyst-skills contract` (`catalyst-skills accounts` on an older cloud) | an account is enrolled and active | that it has headroom left for the next phase | the enroller and page the contract names; see `references/what-a-phase-needs.md` |
15
- | **host** | the `hosts_current` check in `catalyst-skills contract --path teams` | no host is missing or behind, or the tenant runs none | anything before a project has been checked | the owner the contract names for `hosts_current`; see `references/what-a-phase-needs.md` |
9
+ | **machine** | `catalyst status`, and the non-team checks of `catalyst ready` | Node is new enough, this machine holds a credential, the CLI is where the config says, the contract is cached, the skills are on disk | anything at all about the tenant | the person at this keyboard, here |
10
+ | **person** | `catalyst me`, and `catalyst connections personal <linear|github> status` | the credential resolves to this person, shows their role and Linear identity match, and reports each personal grant's state | that their seat is active, or that they may change tenant settings | the member approves missing or expired personal grants in a browser; an owner or admin handles seat or identity conflicts in Settings → Members |
11
+ | **account** | `catalyst contract --path account` | a resolved Linear workspace means the tenant's Linear grant landed | that the GitHub App is installed — the contract does not carry it | a tenant owner or admin, `<their cloud>/settings/connections` |
12
+ | **project** | `catalyst team list`, then `team check <KEY>` and the `team:` checks of `ready` for the selected team | the live team list and the selected team's latest readiness verdict | that an unchecked team is ready | a tenant owner or admin, through `catalyst team` or `<their cloud>/settings/linear-teams` |
13
+ | **repository** | `catalyst contract --path merge.repositories` | the repository is registered to the account | that it is active, that a project can dispatch into it, or that its environment is declared | a tenant owner or admin, `<their cloud>/settings/repositories` |
14
+ | **coding accounts** | `codingAccounts` in `catalyst contract` (`catalyst accounts` on an older cloud) | an account is enrolled and active | that it has headroom left for the next phase | the enroller and page the contract names; see `references/what-a-phase-needs.md` |
15
+ | **repository declarations** | the `environment_declared` check in `catalyst contract --path teams`, and its per-repository notes | the project's default repository has a committed `.catalyst/catalyst.toml` in effect: ingested, valid, and its latest revision approved | that the values the names refer to exist; that any other repository is declared, unless its note says so | the person, with you, in the repository for the file; a tenant owner or admin for the approval, at the repository's Environment page under `<their cloud>/settings/repositories` |
16
+ | **host** | the `hosts_current` check in `catalyst contract --path teams` | no host is missing or behind, or the tenant runs none | anything before a project has been checked | the owner the contract names for `hosts_current`; see `references/what-a-phase-needs.md` |
16
17
 
17
- `node scripts/where-am-i.mjs` runs all seven and labels each finding with its part. Use it rather than composing this by hand.
18
+ `node scripts/where-am-i.mjs` runs all eight, in the order a person can act on them, and labels each finding with its part. Use it rather than composing this by hand.
18
19
 
19
20
  ## The two silences that are not absences
20
21
 
21
- ⛔ **An empty project list means nothing is mapped yet — it does not mean they have no projects.** The tenant contract carries a project only once someone has saved a stage mapping for it. A brand-new tenant has projects in Linear and an empty list here, and reading that as "you have no projects" sends the person looking for a problem that does not exist. Say: *nothing is mapped yet*, and go to step 4. The list of every project they could map is browser-only today.
22
+ ⛔ **An empty contract project list means nothing is mapped yet — it does not mean they have no projects.** The tenant contract carries a project only once someone has saved a stage mapping for it. Read the available team list with `catalyst team list`, choose one, then go to step 4. `team check --all` performs readiness checks and may create asks for every team.
22
23
 
23
- ⛔ **A registered repository is not a dispatchable one.** The contract's repository list carries no status and no project attachment, so a paused repository and an active one look identical there, and a repository registered without a project attached looks exactly like a correctly attached one. Registration is all it proves. If a card does not start, `catalyst-skills explain <ticket>` names the real reason; do not conclude anything about the repository from its presence in a list.
24
+ ⛔ **A registered repository is not a dispatchable one.** The contract's repository list carries no status and no project attachment, so a paused repository and an active one look identical there, and a repository registered without a project attached looks exactly like a correctly attached one. Registration is all it proves. If a card does not start, `catalyst explain <ticket>` names the real reason; do not conclude anything about the repository from its presence in a list.
24
25
 
25
26
  ⭐ And the general form of both: **an instrument that answers about a part it does not own will answer confidently and wrongly.** When you are unsure which part something belongs to, look it up in the table above rather than guessing from the wording of an error.
26
27
 
27
28
  ## Triaging NOT READY
28
29
 
29
- `catalyst-skills ready` prints one verdict over every check, machine and project together. That single verdict is correct for "can work run?" and useless for "what should I do now?", because it folds two parts into one word. Split it before you act:
30
+ `catalyst ready` prints one verdict over every check, machine and project together. That single verdict is correct for "can work run?" and useless for "what should I do now?", because it folds two parts into one word. Split it before you act:
30
31
 
31
- 1. Run `catalyst-skills ready --json`. Every check has an `id`.
32
+ 1. Run `catalyst ready --json`. Every check has an `id`.
32
33
  2. A check whose id begins with `team:` is a **project** finding. Everything else is a **machine** finding.
33
34
  3. Report the two groups separately, in that order, each with its own owner.
34
35
 
35
- - **A machine check failed.** This is the person's, here, now. Each failing check carries its own `fix` line; read it and do it. A missing or partial skill set is `catalyst-skills install`; a stale contract is `catalyst-skills contract --refresh`; a missing CLI path is one more `catalyst-skills login`.
36
- - **A project check failed.** ⛔ **Nothing you run on this machine can move it.** Name the check, name the project, and name the owner — the `who` field carries the tenant's own owners and admins. Point at `<their cloud>/settings/linear-teams`. Then stop. Re-running `ready` in a loop is the failure this section exists to prevent: it will keep saying NOT READY for a reason that lives somewhere else entirely.
37
- - **A check is a note.** Notes never move the verdict. A stale or absent replica or event cache is optional; an unknown freshness probe means the cloud comparison could not be proved. The API-backed skills still work. Say whether the local cache is absent, stale or unknown, and ask before starting the optional writer.
36
+ - **A machine check failed.** This is the person's, here, now. Each failing check carries its own `fix` line; read it and do it. A missing or partial skill set is `catalyst install`; a stale contract is `catalyst contract --refresh`; a missing CLI path is one more `catalyst login`.
37
+ - **A project check failed.** Name the check, the project, and the owner; the `who` field carries the workspace's own owners and admins. An admin or owner can run the check, preview a stage mapping, or adopt the workflow through `catalyst team`; some failures still need provider consent or a browser action, and `<their cloud>/settings/linear-teams` is where those live. Use the check's reason to choose the next action. Re-running `ready` alone does not fix it.
38
+ - **A check is a note.** Notes never move the verdict. A stale or absent replica or event cache is optional; an unknown freshness probe means the cloud comparison could not be proved. A check that has never been run is waiting, not failing; a check the engine could not run is unknown, which is not a pass and not a failure. Say which it is. The API-backed skills still work; ask before starting the optional writer.
38
39
 
39
40
  ## When to stop rather than continue
40
41
 
41
42
  - **They have no account yet.** There is no self-serve sign-up. Coalesce Labs provisions each account, and a person joins one by invitation from its admin. Say so and stop; the next step is theirs.
42
43
  - **The account is suspended.** Setup cannot proceed and no retry changes that. Say so and name the conversation they need to have.
43
44
  - **Their seat is not active, or they are not an owner or admin where one is required.** Say who is, and what to ask for. Do not offer a workaround.
44
- - **A page said it worked and the instrument still disagrees.** Refresh the contract once (`catalyst-skills contract --refresh`) and read it again. If it still disagrees, report both facts — what the page said and what the instrument says — and let the person decide. Do not pick one for them.
45
+ - **A page said it worked and the instrument still disagrees.** Refresh the contract once (`catalyst contract --refresh`) and read it again. If it still disagrees, report both facts — what the page said and what the instrument says — and let the person decide. Do not pick one for them.
46
+
47
+ ## What still happens in a browser, and why
48
+
49
+ Every step a key can do, the guide does. These are the ones it hands over, each with the reason; when a reason stops being true, the step moves to the CLI and this table changes in the same release.
50
+
51
+ | step | today | why it is still the person's |
52
+ | -- | -- | -- |
53
+ | install Node, or a coding agent | the person, on their machine | outside the CLI |
54
+ | approve the login | the code and URL `login` prints, in a browser | a grant only the person can give |
55
+ | connect the Linear integration | Settings → Connections | an OAuth grant, by construction |
56
+ | install the GitHub App | Settings → Connections | an OAuth grant, by construction |
57
+ | enrol a coding account, or replace its credential | Settings → AI accounts | the credential is theirs to paste; a CLI verb for the paste is being built |
58
+ | register a repository to a project | Settings → Repositories | the route exists; the CLI verb is being built |
59
+ | approve one repository's settings file | the repository's Environment page | the route for a key is being built |
60
+ | enter a secret's value | the repository's Environment page, or `secret set` | a value never passes through the agent |
61
+ | the person's own Linear and GitHub connected accounts | the link `connections personal … start` prints | a grant only the person can give |
62
+ | move the first ticket | Linear, or `write state` when they ask | their call which ticket runs first |
63
+
64
+ A project's readiness check, its stage mapping and adopting the workflow are CLI steps (`team check`, `team map`, `team adopt`) when `catalyst capabilities` says the installed CLI can run them for the person's role; the script names the command, and the page only for a person whose role cannot.
@@ -34,9 +34,23 @@ export function tryLoadConfig() {
34
34
  }
35
35
  }
36
36
 
37
+ /** The recorded CLI path, credential or no credential: a machine that was connected once and is now
38
+ * logged out still has its CLI, and `status` on it is the honest first reading. Null when the config
39
+ * is absent or unreadable. */
40
+ function recordedCliPath() {
41
+ try {
42
+ const raw = JSON.parse(readFileSync(configPath(), "utf8"));
43
+ return typeof raw.cliPath === "string" && existsSync(raw.cliPath) ? raw.cliPath : null;
44
+ } catch {
45
+ return null;
46
+ }
47
+ }
48
+
37
49
  /** Where the CLI is on this machine: the path login recorded when it still exists, else npx. */
38
50
  export function cliTarget(cfg = tryLoadConfig()) {
39
- const recorded = cfg !== null && typeof cfg.cliPath === "string" && existsSync(cfg.cliPath);
51
+ const recordedPath = cfg !== null && typeof cfg.cliPath === "string" && existsSync(cfg.cliPath) ? cfg.cliPath : recordedCliPath();
52
+ if (recordedPath !== null) cfg = { ...(cfg ?? {}), cliPath: recordedPath };
53
+ const recorded = recordedPath !== null;
40
54
  return recorded
41
55
  ? { command: process.execPath, prefix: [cfg.cliPath], via: `node ${cfg.cliPath}`, recorded: true }
42
56
  : { command: "npx", prefix: [PACKAGE], via: `npx ${PACKAGE}`, recorded: false };
@@ -8,7 +8,7 @@ import { cliTarget } from "./lib/cli.mjs";
8
8
  const STATUS_COMMAND = ["replica", "status", "--probe", "--json"];
9
9
  const EVENTS_COMMAND = ["events", "status", "--probe", "--json"];
10
10
  const START_COMMAND = ["replica", "start", "--detach"];
11
- const RECOVERY_COMMAND = "catalyst-skills replica start --detach";
11
+ const RECOVERY_COMMAND = "catalyst replica start --detach";
12
12
 
13
13
  function defaultRun(args) {
14
14
  const target = cliTarget();
@@ -105,7 +105,7 @@ function readStatus(run) {
105
105
  current: false,
106
106
  reason: `replica status is unknown: ${replicaResult.error || replicaResult.stderr.trim() || "invalid JSON"}`,
107
107
  },
108
- recovery: replicaResult.code === 2 ? "catalyst-skills login" : "catalyst-skills replica status --probe --json",
108
+ recovery: replicaResult.code === 2 ? "catalyst login" : "catalyst replica status --probe --json",
109
109
  };
110
110
  }
111
111
  const eventsResult = run(EVENTS_COMMAND);
@@ -120,7 +120,7 @@ function readStatus(run) {
120
120
  current: false,
121
121
  reason: `event freshness is unknown: ${eventsResult.error || eventsResult.stderr.trim() || "invalid JSON"}`,
122
122
  },
123
- recovery: "catalyst-skills events status --probe --json",
123
+ recovery: "catalyst events status --probe --json",
124
124
  };
125
125
  }
126
126
  return { status, events, assessment: assessLocalSync(status, events) };
@@ -140,12 +140,12 @@ export async function runLocalSync({
140
140
  if (reading.assessment.current || !start)
141
141
  return { ...reading, started: false, recovery: reading.recovery ?? RECOVERY_COMMAND };
142
142
  if (!reading.status)
143
- return { ...reading, started: false, recovery: reading.recovery ?? "catalyst-skills replica status --probe --json" };
143
+ return { ...reading, started: false, recovery: reading.recovery ?? "catalyst replica status --probe --json" };
144
144
  if (
145
145
  reading.status?.verdict === "not-configured" ||
146
146
  reading.status?.dbPath == null
147
147
  ) {
148
- return { ...reading, started: false, recovery: "catalyst-skills login" };
148
+ return { ...reading, started: false, recovery: "catalyst login" };
149
149
  }
150
150
  let started = false;
151
151
  if (reading.status.writerAlive !== true && ["absent", "stale"].includes(reading.assessment.verdict)) {
@@ -177,7 +177,7 @@ export async function runLocalSync({
177
177
  recovery: reading.assessment.verdict === "unknown"
178
178
  ? "node scripts/local-sync.mjs --json"
179
179
  : reading.status?.writerAlive
180
- ? "catalyst-skills replica stop && catalyst-skills replica start --detach"
180
+ ? "catalyst replica stop && catalyst replica start --detach"
181
181
  : RECOVERY_COMMAND,
182
182
  };
183
183
  }