From 6170f4e5e57ecba3867cc020b708c58edb27e70e Mon Sep 17 00:00:00 2001 From: leemour Date: Wed, 25 Nov 2026 22:08:02 +0100 Subject: [PATCH] fix(registry): catch what the drift check missed, and refresh the manifests The drift check between Desktop's catalog and each CLI's manifest now catches four more kinds of drift: - A key the manifest leaves out or sets to null, while the catalog runs something there (zm and pbx state no meetings, gcal 0.35.0 no accountRemove, the messengers no sync). Desktop's own fields stay out: mcpServer.port, accountRemove.keeps, skill.doctorSkills, and sign-in methods a CLI does not state. - A command line in Desktop's catalog that names a command the CLI's latest release no longer has. It reads both main and Desktop's latest release, the catalog people run (Desktop 0.8.0 still runs `account list` for tg, max, wa). - accountRemove.removes: the catalog must name at least the manifest's words. The manifest's schema has only signIn, so max's serverSession is right. - An allow line in drift-allow.json without a real reason, or without an "until" date or an "issue" link. "Not checked" is refused, and a line past its date fails. Every allow line now says why the difference is right for now, from the CLI source at its npm version, and when it is looked at again. `--catalog ` checks a Desktop branch before it merges. registry/official-manifests.json is refreshed: hubspot 0.8.0, linear 0.5.0, max 0.119.0, memo 0.153.0, notion 0.9.0, pbx 0.10.0 (issue #746). Co-Authored-By: Claude Opus 5.5 --- .github/workflows/registry-drift.yml | 4 +- docs/REVIEWING.md | 9 +- registry/drift-allow.json | 402 ++++++++++++++++----------- registry/official-manifests.json | 56 ++-- scripts/official-tools.test.ts | 51 +++- scripts/official-tools.ts | 141 +++++++++- 6 files changed, 466 insertions(+), 197 deletions(-) diff --git a/.github/workflows/registry-drift.yml b/.github/workflows/registry-drift.yml index 982554f7..fe02e091 100644 --- a/.github/workflows/registry-drift.yml +++ b/.github/workflows/registry-drift.yml @@ -37,6 +37,8 @@ jobs: package-manager-cache: false - name: Compare the list with npm and Desktop's catalog shell: bash + env: + GITHUB_TOKEN: ${{ github.token }} run: node --experimental-strip-types scripts/official-tools.ts --check 2>&1 | tee drift.txt # A pull request opened with github.token starts no checks, so the job keeps one issue up to date instead. - name: Keep one issue open while the list lags a release @@ -62,7 +64,7 @@ jobs: echo '```' echo echo "To fix: run \`pnpm registry:official && pnpm exec biome format --write registry/\`, commit registry/official-manifests.json in a pull request, and" - echo "add a known difference to registry/drift-allow.json only with its reason." + echo "add a known difference to registry/drift-allow.json only with its reason and an \"until\" date or an \"issue\" link." } > issue.md title="Registry drift: Desktop's tool list lags a release" number=$(gh issue list --state open --search "\"$title\" in:title" --json number -q '.[0].number // ""') diff --git a/docs/REVIEWING.md b/docs/REVIEWING.md index 5bfe8b7f..c674e641 100644 --- a/docs/REVIEWING.md +++ b/docs/REVIEWING.md @@ -179,9 +179,12 @@ release. The design is in wirecat-desktop site's summaries in `summaries`, and the texts above. - **The drift check,** `pnpm registry:drift` and the Registry drift workflow (daily and on pull requests that touch the registry), fails when `official-manifests.json` is behind npm, or when Desktop's compiled catalog says something - else than a manifest. Each known difference is a line in `registry/drift-allow.json` with why; a line that no - longer differs fails too. A CLI release that changes its manifest turns the check red until someone runs - `pnpm registry:official` and commits the result. + else than a manifest. A key the manifest leaves out or sets to `null` counts too, when the catalog runs something + there. The check also fails when a command line in Desktop's catalog, on main or in its latest release, names a + command the CLI's latest release no longer has. Each known difference is a line in `registry/drift-allow.json` + with why, and with an `until` date or an `issue` link. "Not checked" is not a reason, and a line past its date + fails. A line that no longer differs fails too. A CLI release that changes its manifest turns the check red until + someone runs `pnpm registry:official` and commits the result. To add a new official CLI: list it in `tools.json` like any of our tools, give it an entry in `registry/official.json` (at least `mcpPort` when it has an MCP server, and the Russian and Spanish texts), run diff --git a/registry/drift-allow.json b/registry/drift-allow.json index cf064a8f..6abb08ab 100644 --- a/registry/drift-allow.json +++ b/registry/drift-allow.json @@ -1,312 +1,404 @@ [ - { - "tool": "max", - "key": "tagline", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." - }, - { - "tool": "max", - "key": "signIn.gives", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." - }, - { - "tool": "max", - "key": "signIn.asks", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." - }, { "tool": "tg", - "key": "accountRemove.removes", - "why": "Desktop names what a sign-out keeps in its own words (folders, appKeys, googleAccess). cli-base writes a generic list. Open which list is right." + "key": "sync.run", + "why": "cli-base writes sync only when a CLI has one sync command (cli-base src/wcat/manifest.ts:327). The messenger has several, `messages sync` among them, so its manifest states none. Desktop's catalog keeps the messenger's sync.", + "until": "2027-01-15" }, { "tool": "tg", - "key": "accountRemove.keeps", - "why": "Desktop names what a sign-out keeps in its own words (folders, appKeys, googleAccess). cli-base writes a generic list. Open which list is right." + "key": "sync.last", + "why": "cli-base writes sync only when a CLI has one sync command (cli-base src/wcat/manifest.ts:327). The messenger has several, `messages sync` among them, so its manifest states none. Desktop's catalog keeps the messenger's sync.", + "until": "2027-01-15" }, { "tool": "tg", - "key": "tagline", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "key": "sync.lastShape", + "why": "cli-base writes sync only when a CLI has one sync command (cli-base src/wcat/manifest.ts:327). The messenger has several, `messages sync` among them, so its manifest states none. Desktop's catalog keeps the messenger's sync.", + "until": "2027-01-15" }, { - "tool": "tg", - "key": "signIn.gives", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "tool": "max", + "key": "sync.run", + "why": "cli-base writes sync only when a CLI has one sync command (cli-base src/wcat/manifest.ts:327). The messenger has several, `messages sync` among them, so its manifest states none. Desktop's catalog keeps the messenger's sync.", + "until": "2027-01-15" }, { - "tool": "tg", - "key": "signIn.asks", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "tool": "max", + "key": "sync.last", + "why": "cli-base writes sync only when a CLI has one sync command (cli-base src/wcat/manifest.ts:327). The messenger has several, `messages sync` among them, so its manifest states none. Desktop's catalog keeps the messenger's sync.", + "until": "2027-01-15" }, { - "tool": "wa", - "key": "accountRemove.removes", - "why": "Desktop names what a sign-out keeps in its own words (folders, appKeys, googleAccess). cli-base writes a generic list. Open which list is right." + "tool": "max", + "key": "sync.lastShape", + "why": "cli-base writes sync only when a CLI has one sync command (cli-base src/wcat/manifest.ts:327). The messenger has several, `messages sync` among them, so its manifest states none. Desktop's catalog keeps the messenger's sync.", + "until": "2027-01-15" }, { "tool": "wa", - "key": "tagline", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "key": "sync.last", + "why": "cli-base writes sync only when a CLI has one sync command (cli-base src/wcat/manifest.ts:327). The messenger has several, `messages sync` among them, so its manifest states none. Desktop's catalog keeps the messenger's sync. WhatsApp's last sync is read from `server status`.", + "until": "2027-01-15" }, { "tool": "wa", - "key": "signIn.gives", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "key": "sync.lastShape", + "why": "cli-base writes sync only when a CLI has one sync command (cli-base src/wcat/manifest.ts:327). The messenger has several, `messages sync` among them, so its manifest states none. Desktop's catalog keeps the messenger's sync. WhatsApp's last sync is read from `server status`.", + "until": "2027-01-15" }, { "tool": "wa", - "key": "signIn.asks", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "key": "accountRemove.removes", + "why": "WhatsApp signs in by linking this computer as a device. Desktop names that deviceKeys and linkedDevice, and the manifest's schema has only the word signIn (cli-base src/wcat/manifest.ts:157).", + "until": "2027-01-31" }, { "tool": "drive", "key": "doctor", - "why": "wirecat-desktop journal FIND-283: Desktop runs something else than the manifest says. Not checked which one the CLI answers; needs a run of the CLI." - }, - { - "tool": "drive", - "key": "profiles.shape", - "why": "wirecat-desktop journal FIND-283: Desktop runs something else than the manifest says. Not checked which one the CLI answers; needs a run of the CLI." + "why": "Desktop main takes this key from the installed CLI's own answer (wirecat-desktop #476). The compiled value serves Desktop 0.8.0 and a CLI that gives no answer, and the command it runs still exists in the CLI's latest release (wirecat-desktop catalog-commands.test.ts checks it). drive answers both `status` and `doctor`.", + "until": "2027-01-31" }, { "tool": "drive", "key": "mcpServer.config", - "why": "wirecat-desktop journal FIND-283: Desktop runs something else than the manifest says. Not checked which one the CLI answers; needs a run of the CLI." + "why": "Desktop main takes this key from the installed CLI's own answer (wirecat-desktop #476). The compiled value serves Desktop 0.8.0 and a CLI that gives no answer, and the command it runs still exists in the CLI's latest release (wirecat-desktop catalog-commands.test.ts checks it). Desktop 0.8.0 shows no MCP config button for drive.", + "until": "2027-01-31" }, { "tool": "drive", "key": "sync.last", - "why": "wirecat-desktop journal FIND-283: the catalog passes the filter as one argument, the manifest as two. Not checked whether runs list reads them alike." + "why": "Desktop main takes this key from the installed CLI's own answer (wirecat-desktop #476). The compiled value serves Desktop 0.8.0 and a CLI that gives no answer, and the command it runs still exists in the CLI's latest release (wirecat-desktop catalog-commands.test.ts checks it). Desktop 0.8.0 reads drive's last sync from `status`.", + "until": "2027-01-31" }, { "tool": "drive", - "key": "accountRemove.keeps", - "why": "Desktop names what a sign-out keeps in its own words (folders, appKeys, googleAccess). cli-base writes a generic list. Open which list is right." + "key": "sync.lastShape", + "why": "Goes with drive's sync.last: `status` answers in the driveStatus shape, runs list in the runs shape.", + "until": "2027-01-31" }, { "tool": "drive", - "key": "tagline", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "key": "profiles.shape", + "why": "The catalog is right: drive-cli 0.77.0 answers session list as item.items (drive-cli src/commands/session.ts:135). The manifest says items because cli-base allows no other shape (cli-base src/wcat/manifest.ts:101). Fix drive-cli to answer a list, or let cli-base state the shape.", + "until": "2027-01-15" }, { - "tool": "ydisk", - "key": "accountRemove.keeps", - "why": "Desktop names what a sign-out keeps in its own words (folders, appKeys, googleAccess). cli-base writes a generic list. Open which list is right." + "tool": "gcal", + "key": "doctor", + "why": "Desktop main takes this key from the installed CLI's own answer (wirecat-desktop #476). The compiled value serves Desktop 0.8.0 and a CLI that gives no answer, and the command it runs still exists in the CLI's latest release (wirecat-desktop catalog-commands.test.ts checks it). Desktop 0.8.0 checks it with `session status`, which the CLI still has.", + "until": "2027-01-31" }, { - "tool": "ydisk", - "key": "tagline", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "tool": "gcal", + "key": "mcpServer", + "why": "Desktop has no port for this MCP server yet, so it starts none (wirecat-desktop #476). Giving it a port is the owner's call.", + "until": "2027-01-31" }, { - "tool": "ydisk", - "key": "signIn.gives", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "tool": "email", + "key": "doctor", + "why": "Desktop main takes this key from the installed CLI's own answer (wirecat-desktop #476). The compiled value serves Desktop 0.8.0 and a CLI that gives no answer, and the command it runs still exists in the CLI's latest release (wirecat-desktop catalog-commands.test.ts checks it). Desktop 0.8.0 checks it with `session status`, which the CLI still has.", + "until": "2027-01-31" }, { - "tool": "ydisk", - "key": "signIn.asks", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "tool": "email", + "key": "mcpServer", + "why": "Desktop has no port for this MCP server yet, so it starts none (wirecat-desktop #476). Giving it a port is the owner's call.", + "until": "2027-01-31" }, { - "tool": "notion", + "tool": "zm", + "key": "doctor", + "why": "Desktop main takes this key from the installed CLI's own answer (wirecat-desktop #476). The compiled value serves Desktop 0.8.0 and a CLI that gives no answer, and the command it runs still exists in the CLI's latest release (wirecat-desktop catalog-commands.test.ts checks it). Desktop 0.8.0 checks it with `session status`, which the CLI still has.", + "until": "2027-01-31" + }, + { + "tool": "zm", + "key": "mcpServer", + "why": "Desktop has no port for this MCP server yet, so it starts none (wirecat-desktop #476). Giving it a port is the owner's call.", + "until": "2027-01-31" + }, + { + "tool": "gcal", + "key": "accountRemove", + "why": "gcal-cli 0.35.0 is built with cli-base 0.109.0, whose manifest has no accountRemove yet. The cli-core 1.0 update brings it.", + "issue": "https://github.com/WireCatLabs/gcal-cli/pull/199" + }, + { + "tool": "email", "key": "sync.last", - "why": "wirecat-desktop journal FIND-283: the catalog passes the filter as one argument, the manifest as two. Not checked whether runs list reads them alike." + "why": "The catalog passes the query as one argument, the manifest as two. Both forms ask the same thing: cli-core's runs list joins its query words before it reads them (cli-core src/cli/list-query.ts:134).", + "until": "2027-01-31" }, { "tool": "notion", - "key": "accountRemove.keeps", - "why": "Desktop names what a sign-out keeps in its own words (folders, appKeys, googleAccess). cli-base writes a generic list. Open which list is right." + "key": "sync.last", + "why": "The catalog passes the query as one argument, the manifest as two. Both forms ask the same thing: cli-core's runs list joins its query words before it reads them (cli-core src/cli/list-query.ts:134).", + "until": "2027-01-31" }, { - "tool": "notion", - "key": "tagline", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "tool": "memo", + "key": "sync.last", + "why": "The catalog passes the query as one argument, the manifest as two. Both forms ask the same thing: cli-core's runs list joins its query words before it reads them (cli-core src/cli/list-query.ts:134).", + "until": "2027-01-31" }, { - "tool": "gcal", - "key": "doctor", - "why": "wirecat-desktop journal FIND-283: Desktop runs something else than the manifest says. Not checked which one the CLI answers; needs a run of the CLI." + "tool": "memo", + "key": "skill.install", + "why": "Desktop main takes this key from the installed CLI's own answer (wirecat-desktop #476). The compiled value serves Desktop 0.8.0 and a CLI that gives no answer, and the command it runs still exists in the CLI's latest release (wirecat-desktop catalog-commands.test.ts checks it). The manifest adds --json, which memo has taken since 0.131.86 at least.", + "until": "2027-01-31" }, { - "tool": "gcal", - "key": "mcpServer", - "why": "wirecat-desktop journal FIND-283: Desktop runs something else than the manifest says. Not checked which one the CLI answers; needs a run of the CLI." + "tool": "memo", + "key": "skill.show", + "why": "Desktop main takes this key from the installed CLI's own answer (wirecat-desktop #476). The compiled value serves Desktop 0.8.0 and a CLI that gives no answer, and the command it runs still exists in the CLI's latest release (wirecat-desktop catalog-commands.test.ts checks it). The manifest adds --json, which memo has taken since 0.131.86 at least.", + "until": "2027-01-31" }, { - "tool": "gcal", + "tool": "zm", + "key": "profiles.args", + "why": "Desktop's compiled catalog lists zm's profiles with `doctor`, which every zm answers. `session list` came in zoom-cli 0.81.0, so the compiled entry would fail on an older zm. Desktop main takes profiles from an installed zm 0.81.0 or newer's own answer (wirecat-desktop src-tauri/src/described.rs:33), and Desktop 0.8.0 keeps `doctor`.", + "until": "2027-01-31" + }, + { + "tool": "zm", + "key": "profiles.shape", + "why": "Desktop's compiled catalog lists zm's profiles with `doctor`, which every zm answers. `session list` came in zoom-cli 0.81.0, so the compiled entry would fail on an older zm. Desktop main takes profiles from an installed zm 0.81.0 or newer's own answer (wirecat-desktop src-tauri/src/described.rs:33), and Desktop 0.8.0 keeps `doctor`.", + "until": "2027-01-31" + }, + { + "tool": "zm", + "key": "accountRemove.signOut", + "why": "Deliberate: the catalog's signOut is the fallback for zm before accountRemove.remove.minVersion (0.70.0), and `session end` came in that same release, so an older zm has no sign-out to run (wirecat-desktop AccountRow.test.tsx, \"an old Zoom cannot sign out\"). With no sign-out, the sign-out removes nothing.", + "until": "2027-01-31" + }, + { + "tool": "zm", + "key": "accountRemove.removes", + "why": "Deliberate: the catalog's signOut is the fallback for zm before accountRemove.remove.minVersion (0.70.0), and `session end` came in that same release, so an older zm has no sign-out to run (wirecat-desktop AccountRow.test.tsx, \"an old Zoom cannot sign out\"). With no sign-out, the sign-out removes nothing.", + "until": "2027-01-31" + }, + { + "tool": "zm", + "key": "meetings", + "why": "zoom-cli 0.82.0 names no meetingsProvider in its identity, so its manifest states no meetings, though it has `meetings show` and `meetings transcript`. Fix in zoom-cli.", + "until": "2027-01-15" + }, + { + "tool": "pbx", + "key": "meetings", + "why": "asterisk-cli 0.10.0 names no meetingsProvider in its identity, so its manifest states no meetings, though it has `meetings show` and `meetings transcript`. Fix in asterisk-cli.", + "until": "2027-01-15" + }, + { + "tool": "attio", + "key": "accountRemove.remove", + "why": "attio-cli has had `account remove` since 0.3.0. Desktop main takes it from attio's own answer (wirecat-desktop #476), and Desktop 0.8.0 offers only sign-out for Attio.", + "until": "2027-01-31" + }, + { + "tool": "bitrix", + "key": "signIn.asks", + "why": "bitrix24-cli 0.27.0 also asks for the task, telephony, disk and documentgenerator scopes, under Common use cases, Other (bitrix24-cli src/identity.ts:35). Desktop's own Bitrix24 sign-in screens name three scopes, with screenshots in three languages, so a webhook made from them may lack telephony. The owner decides the new screens.", + "until": "2027-01-15" + }, + { + "tool": "amo", + "key": "signIn.asks", + "why": "amo-cli 0.4.0 also signs in through your own integration (--client-id) and with --one-click. Desktop offers only the long-lived token. More sign-in screens are the owner's call.", + "until": "2027-01-15" + }, + { + "tool": "max", "key": "tagline", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { - "tool": "gcal", + "tool": "max", "key": "signIn.gives", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { - "tool": "gcal", + "tool": "max", "key": "signIn.asks", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { - "tool": "email", - "key": "doctor", - "why": "wirecat-desktop journal FIND-283: Desktop runs something else than the manifest says. Not checked which one the CLI answers; needs a run of the CLI." + "tool": "tg", + "key": "tagline", + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { - "tool": "email", - "key": "mcpServer", - "why": "wirecat-desktop journal FIND-283: Desktop runs something else than the manifest says. Not checked which one the CLI answers; needs a run of the CLI." + "tool": "tg", + "key": "signIn.gives", + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { - "tool": "email", - "key": "sync.last", - "why": "wirecat-desktop journal FIND-283: the catalog passes the filter as one argument, the manifest as two. Not checked whether runs list reads them alike." + "tool": "tg", + "key": "signIn.asks", + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { - "tool": "email", - "key": "accountRemove.keeps", - "why": "Desktop names what a sign-out keeps in its own words (folders, appKeys, googleAccess). cli-base writes a generic list. Open which list is right." + "tool": "wa", + "key": "tagline", + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { - "tool": "email", + "tool": "wa", "key": "signIn.gives", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { - "tool": "email", + "tool": "wa", "key": "signIn.asks", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { - "tool": "zm", - "key": "doctor", - "why": "Desktop checks zm with `{profile} session status`; the manifest says `{profile} doctor`, as for gcal and email. Both answer: the built zoom-cli 0.81.0 code ran both with a profile and no sign-in on 2026-11-24. Which one Desktop should run is open." + "tool": "drive", + "key": "tagline", + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { - "tool": "zm", - "key": "mcpServer", - "why": "wirecat-desktop journal FIND-283: Desktop runs something else than the manifest says. Not checked which one the CLI answers; needs a run of the CLI." + "tool": "ydisk", + "key": "tagline", + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { - "tool": "zm", - "key": "tagline", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "tool": "ydisk", + "key": "signIn.gives", + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { - "tool": "zm", - "key": "profiles.args", - "why": "Desktop's compiled catalog lists zm's profiles with `doctor`, which every zm answers. `session list` came in zoom-cli 0.81.0, so a catalog entry pointing there would fail on every zm installed before it; an installed zm's own answer replaces it once wirecat-desktop #476 lands." + "tool": "ydisk", + "key": "signIn.asks", + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { - "tool": "zm", - "key": "profiles.shape", - "why": "Desktop's compiled catalog lists zm's profiles with `doctor`, which every zm answers. `session list` came in zoom-cli 0.81.0, so a catalog entry pointing there would fail on every zm installed before it; an installed zm's own answer replaces it once wirecat-desktop #476 lands." + "tool": "notion", + "key": "tagline", + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { - "tool": "zm", - "key": "accountRemove.signOut", - "why": "Deliberate: the catalog's signOut is the fallback for zm before accountRemove.remove.minVersion (0.70.0), and `session end` came in that same release, so an older zm has no sign-out to run (wirecat-desktop AccountRow.test.tsx, \"an old Zoom cannot sign out\")." + "tool": "gcal", + "key": "tagline", + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { - "tool": "zm", - "key": "accountRemove.removes", - "why": "Desktop names what a sign-out keeps in its own words, and has none for zm yet. cli-base writes a generic list. Open which list is right." + "tool": "gcal", + "key": "signIn.gives", + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { - "tool": "zm", - "key": "accountRemove.keeps", - "why": "Desktop names what a sign-out keeps in its own words, and has none for zm yet. cli-base writes a generic list. Open which list is right." + "tool": "gcal", + "key": "signIn.asks", + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { - "tool": "memo", - "key": "skill.install", - "why": "wirecat-desktop journal FIND-283: Desktop runs something else than the manifest says. Not checked which one the CLI answers; needs a run of the CLI." + "tool": "email", + "key": "signIn.gives", + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { - "tool": "memo", - "key": "skill.show", - "why": "wirecat-desktop journal FIND-283: Desktop runs something else than the manifest says. Not checked which one the CLI answers; needs a run of the CLI." + "tool": "email", + "key": "signIn.asks", + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { - "tool": "memo", - "key": "sync.last", - "why": "wirecat-desktop journal FIND-283: the catalog passes the filter as one argument, the manifest as two. Not checked whether runs list reads them alike." + "tool": "zm", + "key": "tagline", + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { "tool": "memo", "key": "tagline", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { "tool": "bitrix", "key": "tagline", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { "tool": "bitrix", "key": "signIn.gives", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." - }, - { - "tool": "bitrix", - "key": "signIn.asks", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { "tool": "amo", "key": "tagline", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { "tool": "amo", "key": "signIn.gives", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." - }, - { - "tool": "amo", - "key": "signIn.asks", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { "tool": "attio", "key": "tagline", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { "tool": "attio", "key": "signIn.gives", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." - }, - { - "tool": "attio", - "key": "accountRemove.remove", - "why": "attio-cli 0.3.0 added `account remove`, but Desktop's compiled catalog still has none, so Desktop offers only sign-out for Attio until wirecat-desktop's catalog/tools.json adds it." + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { "tool": "hubspot", "key": "tagline", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { "tool": "pbx", "key": "tagline", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { "tool": "wordpress", "key": "tagline", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { "tool": "linear", "key": "tagline", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" }, { "tool": "linear", "key": "signIn.asks", - "why": "wirecat-desktop journal FIND-282: the catalog and the CLI word this differently. Desktop shows the catalog text until one side is changed." + "why": "Desktop shows its own words and never takes texts from the CLI (wirecat-desktop #476). Which wording wins is the owner's open call (wirecat-desktop journal FIND-282).", + "until": "2027-02-28" } ] diff --git a/registry/official-manifests.json b/registry/official-manifests.json index 2725a35c..64baaf70 100644 --- a/registry/official-manifests.json +++ b/registry/official-manifests.json @@ -69,7 +69,7 @@ } }, "attio": { - "version": "0.6.0", + "version": "0.7.0", "manifestSha256": "7596342a1761a2d5c6dd5ec26267edc0b7402e64ab3849cf1002af7ccea125cf", "bin": "wcat-attio", "bins": ["attio", "wcat-attio"], @@ -341,8 +341,8 @@ } }, "hubspot": { - "version": "0.7.0", - "manifestSha256": "14e60c4b08c0ce6e473dec603d59b1d613e6c1d5032d4180e87e047f26956060", + "version": "0.8.0", + "manifestSha256": "ced19f53297e5c7f2a2f30ec9158f8d72dd346d51dad5f32159c0da0009a1626", "bin": "wcat-hubspot", "bins": ["hubspot", "wcat-hubspot"], "desktop": { @@ -360,7 +360,8 @@ "setup": ["{profile}", "setup"], "signIn": { "gives": "Lets your agent read the account's CRM, and change it if you give the key the write scopes.", - "asks": "A service key or a legacy private app's access token from your HubSpot account, with read scopes, and write scopes if you want changes." + "asks": "A service key or a legacy private app's access token from your HubSpot account, with read scopes, and write scopes if you want changes.", + "setupFrom": "0.0.0" }, "skill": { "status": ["skill", "status", "--no-record", "--json"], @@ -410,8 +411,8 @@ } }, "linear": { - "version": "0.4.0", - "manifestSha256": "731b0c3eb2fbab35986ed3bb1945f7ea35c00bbd484d52aea28015c2a8dfce97", + "version": "0.5.0", + "manifestSha256": "6e0c75e1fe9a5cd38b2510f91477441e0363fa333a40f758d845a943c14c694f", "bin": "wcat-linear", "bins": ["linear", "wcat-linear"], "desktop": { @@ -473,7 +474,7 @@ } }, "mail": { - "version": "0.36.0", + "version": "0.37.0", "manifestSha256": "9011aaf419624a2b53f121e25f20afe65a89b87577a0b1c34619ce578019b449", "bin": "wcat-mail", "bins": ["mail", "wcat-mail"], @@ -542,8 +543,8 @@ } }, "max": { - "version": "0.118.0", - "manifestSha256": "95931a2497f457a89bb776ec0a733f3ce6dfe1f964e0d142ca10982b5e9f2fbb", + "version": "0.119.0", + "manifestSha256": "cbcf4e7bc7075f1ee99344f8dd617e3cf02f7968a1ff65c1c9c652815d98942e", "bin": "wcat-max", "bins": ["max", "wcat-max"], "desktop": { @@ -589,12 +590,24 @@ "app": "max-cli", "env": "MAX" }, - "settings": null + "settings": null, + "accountRemove": { + "signOut": ["{profile}", "session", "end", "--record", "--json"], + "remove": { + "minVersion": "0.0.0", + "keepData": ["{profile}", "account", "remove", "--keep-data", "--record", "--json"], + "deleteData": ["{profile}", "account", "remove", "--delete-data", "--record", "--json"], + "dryRun": "--dry-run", + "confirm": "--yes" + }, + "removes": ["signIn"], + "keeps": ["settings", "data", "listed"] + } } }, "memo": { - "version": "0.152.0", - "manifestSha256": "ad0614cb1598f6275603b3d0fffd9f36a149764d9bc98b2833c99e749b180838", + "version": "0.153.0", + "manifestSha256": "1df1588ac9c96fc388e042b89c5295307ca6370540cc43d1ba7f55b25bfc1760", "bin": "wcat-memo", "bins": ["memo", "wcat-memo"], "desktop": { @@ -644,8 +657,8 @@ } }, "notion": { - "version": "0.8.0", - "manifestSha256": "d824afa20fa419aab79ee4578796ded328cb28e01dd8598a3ff5699a1b5d342b", + "version": "0.9.0", + "manifestSha256": "4e59f7411f6ae6ca2d3632aa585846db7395ab89421b5eb8a63d390c30de12d9", "bin": "wcat-notion", "bins": ["notion", "wcat-notion"], "desktop": { @@ -713,8 +726,8 @@ } }, "pbx": { - "version": "0.9.0", - "manifestSha256": "67fecf0f8d4ede1500390df5c0c0b84ea24ce594a061828bb015c9acdfc5490f", + "version": "0.10.0", + "manifestSha256": "ce5445e382e320d44494729f0665cb3209f6c70447d30a33694cfa2297c26dd8", "bin": "wcat-pbx", "bins": ["pbx", "wcat-pbx"], "desktop": { @@ -732,7 +745,8 @@ "setup": ["{profile}", "setup"], "signIn": { "gives": "Lets your agent find your company's phone calls and read what was said in them.", - "asks": "The path of Master.csv, or the CDR database's address and a read-only user's password." + "asks": "The path of Master.csv, or the CDR database's address and a read-only user's password.", + "setupFrom": "0.0.0" }, "skill": { "status": ["skill", "status", "--no-record", "--json"], @@ -782,7 +796,7 @@ } }, "slk": { - "version": "0.2.0", + "version": "0.3.0", "manifestSha256": "04e0955ca837633856f6fedc12e6c41462602c94c18ea079b02a426f3a0f4cb0", "bin": "wcat-slk", "bins": ["slk", "wcat-slk"], @@ -846,7 +860,7 @@ } }, "tg": { - "version": "0.135.0", + "version": "0.136.0", "manifestSha256": "833a6bd2111100ebbbc3f512ac3598715916609ab10e0dfdea2a94c77f16d248", "bin": "wcat-tg", "bins": ["tg", "wcat-tg"], @@ -909,7 +923,7 @@ } }, "wa": { - "version": "0.46.0", + "version": "0.47.0", "manifestSha256": "7441f2a52c51e0012caf89e41f5ddf39cf435736fcdc367e7a04d64e9c50e80d", "bin": "wcat-wa", "bins": ["wa", "wcat-wa"], @@ -1114,7 +1128,7 @@ } }, "zm": { - "version": "0.81.0", + "version": "0.82.0", "manifestSha256": "917653b6e25d98605a350eeec7df7df701ebc6a6bf06fe92e5919596df11095a", "bin": "wcat-zm", "bins": ["wcat-zm", "zm"], diff --git a/scripts/official-tools.test.ts b/scripts/official-tools.test.ts index 97cfa64c..6789509a 100644 --- a/scripts/official-tools.test.ts +++ b/scripts/official-tools.test.ts @@ -4,10 +4,12 @@ import { describe, expect, it } from "vitest" import { buildRegistry } from "./desktop-registry" import { type Allowed, + allowProblems, differences, driftProblems, type Manifest, type Manifests, + missingCommands, type Overlays, officialEntries, overlayProblems, @@ -40,6 +42,7 @@ const manifest = (desktop: Record = {}): Manifest => ({ doctor: ["{profile}", "doctor", "--record", "--json"], search: null, storage: { app: "beeline-cli", env: "WCBEELINE" }, + mcpServer: { start: ["mcp", "server", "start"] }, ...desktop, }, }) @@ -122,13 +125,27 @@ describe("the drift check", () => { const drift = (m: Manifest, allowed: Allowed[] = [], cat = catalog) => driftProblems([beeline], {}, { beeline: m }, cat, allowed) - it("compares only what the manifest states, and Desktop's own keys not at all", () => { - expect(drift(manifest({ mcpServer: { start: ["mcp", "server", "start"] } }))).toEqual([]) - expect(differences(null, { args: [] }, "search")).toEqual([]) + it("compares the keys a manifest can state, and Desktop's own keys not at all", () => { + expect(drift(manifest())).toEqual([]) expect( differences({ remove: { minVersion: "0.0.0" } }, { remove: { minVersion: "0.9.0" } }, "accountRemove"), ).toEqual([]) expect(differences({ setupFrom: "0.0.0" }, { setupFrom: "0.1.0" }, "signIn")).toEqual([]) + expect(differences({ gives: "x" }, { gives: "x", methods: [{ id: "token" }] }, "signIn")).toEqual([]) + }) + + it("fails on a command the catalog runs where the manifest says the CLI has none", () => { + expect(differences(null, ["{profile}", "setup", "--json"], "setup")).toEqual(["setup"]) + expect(differences({ start: ["mcp"] }, { start: ["mcp"], config: ["mcp", "config"] }, "mcpServer")).toEqual([ + "mcpServer.config", + ]) + expect(differences(undefined, { provider: "zoom" }, "meetings")).toEqual(["meetings"]) + }) + + it("wants the catalog to name at least what the manifest says a sign-out removes", () => { + expect(differences(["signIn"], ["signIn", "serverSession"], "accountRemove.removes")).toEqual([]) + expect(differences(["signIn"], [], "accountRemove.removes")).toEqual(["accountRemove.removes"]) + expect(differences(["settings"], ["folders"], "accountRemove.keeps")).toEqual([]) }) it("fails on a word, a program the package does not install, or a text", () => { @@ -140,6 +157,34 @@ describe("the drift check", () => { ) }) + it("finds a command a Desktop catalog runs that the CLI's latest release no longer has", () => { + const m = { ...manifest(), commands: ["session list", "doctor", "doctor reports show"] } + const cat = (args: string[]) => ({ + tools: [{ id: "beeline", profiles: { args }, doctor: ["{profile}", "doctor"] }], + }) + expect(missingCommands([beeline], {}, { beeline: m }, cat(["session", "list", "--json"]), "v0.8.0")).toEqual([]) + expect(missingCommands([beeline], {}, { beeline: m }, cat(["account", "list", "--json"]), "v0.8.0")).toEqual([ + "beeline profiles.args: Desktop v0.8.0 runs `account list --json`, @wirecat/beeline-cli 0.5.0 has no such command", + ]) + expect(missingCommands([beeline], {}, { beeline: manifest() }, cat(["account", "list", "--json"]), "main")).toEqual( + [], + ) + }) + + it("takes an allow line only with a reason and an end date or an issue", () => { + const line = { tool: "beeline", key: "tagline", why: "Desktop words it its own way." } + expect(allowProblems([{ ...line, until: "2027-01-31" }], "2026-11-25")).toEqual([]) + expect( + allowProblems([{ ...line, issue: "https://github.com/WireCatLabs/beeline-cli/issues/7" }], "2026-11-25"), + ).toEqual([]) + expect(allowProblems([line], "2026-11-25").join()).toContain('"until" date or the "issue"') + expect(allowProblems([{ ...line, why: "Not checked yet", until: "2027-01-31" }], "2026-11-25").join()).toContain( + "not a reason", + ) + expect(allowProblems([{ ...line, until: "2026-11-24" }], "2026-11-25").join()).toContain("has passed") + expect(allowProblems([{ ...line, issue: "https://example.com/1" }], "2026-11-25").join()).toContain("WireCatLabs") + }) + it("lets a difference through only with a reason, and fails on a reason no longer needed", () => { const allowed = [{ tool: "beeline", key: "tagline", why: "FIND-282" }] expect(drift(manifest({ tagline: "Other words" }), allowed)).toEqual([]) diff --git a/scripts/official-tools.ts b/scripts/official-tools.ts index 9a30334f..4b2f452b 100644 --- a/scripts/official-tools.ts +++ b/scripts/official-tools.ts @@ -24,8 +24,9 @@ import type { Tool } from "./sync.ts" export const MANIFESTS_FILE = "registry/official-manifests.json" export const OVERLAY_FILE = "registry/official.json" export const DRIFT_ALLOW_FILE = "registry/drift-allow.json" -export const DESKTOP_CATALOG_URL = - "https://raw.githubusercontent.com/WireCatLabs/wirecat-desktop/main/catalog/tools.json" +const DESKTOP_RAW = "https://raw.githubusercontent.com/WireCatLabs/wirecat-desktop" +export const DESKTOP_CATALOG_URL = `${DESKTOP_RAW}/main/catalog/tools.json` +const DESKTOP_RELEASE_URL = "https://api.github.com/repos/WireCatLabs/wirecat-desktop/releases/latest" const NPM = "https://registry.npmjs.org/" const LANGS = ["en", "ru", "es"] as const const TEXTS = ["name", "tagline", "summary", "gives", "asks", "syncNote"] as const @@ -41,6 +42,8 @@ export type Manifest = { /** Every program the package installs: Desktop runs our tools by their short name, the manifest names `wcat-…`. */ bins: string[] desktop: Record + /** The manifest's command paths (`session list`), read for the check only and not kept in the committed file. */ + commands?: string[] } /** By tools.json name; `null` when the latest release ships no manifest. */ export type Manifests = Record @@ -57,7 +60,8 @@ export type Overlay = { } export type Overlays = Record -export type Allowed = { tool: string; key: string; why: string } +/** A known difference: why it is so, and when it is looked at again (`until`, a date) or where it is fixed (`issue`). */ +export type Allowed = { tool: string; key: string; why: string; until?: string; issue?: string } const record = (v: unknown): Record | undefined => v && typeof v === "object" && !Array.isArray(v) ? (v as Record) : undefined @@ -179,9 +183,12 @@ async function retried(run: () => Promise, tries = 3): Promise { } } -const getJson = (url: string) => +const getJson = (url: string, headers: Record = {}) => retried(async () => { - const res = await fetch(url, { headers: { accept: "application/json" }, signal: AbortSignal.timeout(30_000) }) + const res = await fetch(url, { + headers: { accept: "application/json", ...headers }, + signal: AbortSignal.timeout(30_000), + }) if (!res.ok) throw new Error(`${url}: HTTP ${res.status}`) return (await res.json()) as Record }) @@ -209,6 +216,10 @@ export async function fetchManifest(pkg: string): Promise { bin: String(m.bin), bins: Object.keys(record(latest.bin) ?? {}).sort(), desktop: m.desktop as Record, + commands: (Array.isArray(m.commands) ? m.commands : []).flatMap((c) => { + const path = record(c)?.path + return Array.isArray(path) ? [path.join(" ")] : [] + }), } } @@ -252,6 +263,7 @@ const FACTS = [ "signIn.setupFrom", "accountRemove", "meetings", + "sync.lastShape", ] as const /** What the person reads. */ const WORDS = ["tagline", "signIn.gives", "signIn.asks"] as const @@ -260,26 +272,111 @@ const WORDS = ["tagline", "signIn.gives", "signIn.asks"] as const * describes; Desktop keeps its own: the first version it offers the flow for. */ const IGNORED = ["accountRemove.remove.minVersion", "signIn.setupFrom"] +/** + * The manifest's schema has one word for what a sign-out removes (`signIn`) and three for what it keeps (cli-base + * src/wcat/manifest.ts), while Desktop names more (`serverSession`, `folders`). So the catalog must name every word + * the manifest names for `removes`, and `keeps` is not compared. + */ +const AT_LEAST = ["accountRemove.removes"] +const DESKTOP_OWN = ["mcpServer.port", "accountRemove.keeps", "skill.doctorSkills"] +/** + * Desktop's sign-in methods carry fields a manifest has no place for (`clientFile`, `address`, `portal`), so a CLI that + * states none says nothing; a list it does state is compared. + */ +const OWN_WHEN_UNSTATED = ["signIn.methods"] const at = (v: unknown, path: string): unknown => path.split(".").reduce((o, k) => (record(o) ? (o as Record)[k] : undefined), v) /** - * The paths under `path` where the catalog says something else than the manifest. Only what the manifest states is - * compared: a key it leaves out or sets to `null` says nothing, and a key only the catalog has (`mcpServer.port`) is - * Desktop's own. Word lists are compared as they are, since one argument is not two. + * The paths under `path` where the catalog says something else than the manifest. A key the manifest leaves out or + * sets to `null` says the CLI has no such thing, so a catalog that runs one there differs too; only Desktop's own keys + * (`mcpServer.port`) are not compared. Word lists are compared as they are, since one argument is not two. */ export function differences(said: unknown, has: unknown, path: string): string[] { - if (said === null || said === undefined || IGNORED.includes(path)) return [] + if (IGNORED.includes(path) || DESKTOP_OWN.includes(path)) return [] + if (said === null || said === undefined) + return has === null || has === undefined || OWN_WHEN_UNSTATED.includes(path) ? [] : [path] const s = record(said) if (s) { const h = record(has) if (!h) return [path] - return Object.entries(s).flatMap(([k, v]) => differences(v, h[k], `${path}.${k}`)) + return [...new Set([...Object.keys(s), ...Object.keys(h)])].flatMap((k) => differences(s[k], h[k], `${path}.${k}`)) } + if (AT_LEAST.includes(path) && Array.isArray(said) && Array.isArray(has)) + return said.every((w) => has.includes(w)) ? [] : [path] return JSON.stringify(said) === JSON.stringify(has) ? [] : [path] } +const isWords = (v: unknown): v is string[] => + Array.isArray(v) && + v.length > 0 && + v.every((w) => typeof w === "string") && + (v[0] === "{profile}" || v.some((w) => w.startsWith("--"))) + +/** Every command line a catalog entry runs, by the key it sits under. */ +export function commandLines(v: unknown, path = ""): [string, string[]][] { + if (isWords(v)) return [[path, v]] + const r = record(v) + return r ? Object.entries(r).flatMap(([k, x]) => commandLines(x, path ? `${path}.${k}` : k)) : [] +} + +/** The catalog runs `words`: one of the CLI's commands must be their first words, the rest its arguments. */ +export const runsACommand = (words: readonly string[], commands: readonly string[]) => { + const lead = words.filter((w) => !w.startsWith("{")) + const end = lead.findIndex((w) => w.startsWith("--")) + const path = end < 0 ? lead : lead.slice(0, end) + return commands.some((c) => { + const p = c.split(" ") + return p.every((w, i) => path[i] === w) + }) +} + +/** + * The command lines of a Desktop catalog (`where` says which: main, or the release people run) whose command the CLI's + * latest release no longer has. A released Desktop keeps running them until the next one ships. + */ +export function missingCommands( + tools: readonly Tool[], + overlays: Overlays, + manifests: Manifests, + catalog: { tools: Record[] }, + where: string, +): string[] { + return ours(tools).flatMap((tool) => { + const m = manifests[tool.name] + const entry = catalog.tools.find((t) => t.id === (overlays[tool.name]?.id ?? tool.name)) + if (!m?.commands?.length || !entry) return [] + return commandLines(entry) + .filter(([, words]) => !runsACommand(words, m.commands ?? [])) + .map( + ([key, words]) => + `${String(entry.id)} ${key}: Desktop ${where} runs \`${words.join(" ")}\`, ${tool.package} ${m.version} has no such command`, + ) + }) +} + +const DATE = /^\d{4}-\d{2}-\d{2}$/ +const VAGUE = /not checked|needs a run|open which/i + +/** A line in drift-allow.json says why the difference is right for now, and when or where it ends. */ +export function allowProblems(allowed: readonly Allowed[], today: string): string[] { + return allowed.flatMap((a) => { + const at = `${DRIFT_ALLOW_FILE}: ${a.tool} ${a.key}` + const problems: string[] = [] + if (!a.why?.trim() || VAGUE.test(a.why)) + problems.push(`${at}: say why the difference is right; "not checked" is a question, not a reason`) + if (a.until === undefined && a.issue === undefined) + problems.push(`${at}: give an "until" date or the "issue" that fixes it`) + if (a.until !== undefined && !DATE.test(a.until)) problems.push(`${at}: "until" is a date, YYYY-MM-DD`) + else if (a.until !== undefined && a.until < today) + problems.push(`${at}: its "until" (${a.until}) has passed; fix the difference or give a new date with the reason`) + if (a.issue !== undefined && !/^https:\/\/github\.com\/WireCatLabs\/[\w.-]+\/(issues|pull)\/\d+$/.test(a.issue)) + problems.push(`${at}: "issue" is a WireCatLabs issue or pull request link`) + return problems + }) +} + /** * Where Desktop's compiled catalog says something else than the CLI's own manifest, and a catalog program the package * does not install. Each difference must be fixed or written into drift-allow.json with why; a line there that no @@ -345,27 +442,43 @@ export function portProblems(overlays: Overlays, catalog: { tools: Record(file: string) => JSON.parse(readFileSync(join(root, file), "utf8")) as T - const { values } = parseArgs({ options: { check: { type: "boolean", default: false } } }) + const { values } = parseArgs({ options: { check: { type: "boolean", default: false }, catalog: { type: "string" } } }) const tools = read("tools.json") const overlays = read(OVERLAY_FILE) const live = await fetchManifests(tools) if (!values.check) { - writeFileSync(join(root, MANIFESTS_FILE), `${JSON.stringify(live, null, 2)}\n`) + const kept = Object.fromEntries( + Object.entries(live).map(([name, m]) => [name, m && (({ commands: _, ...rest }) => rest)(m)]), + ) + writeFileSync(join(root, MANIFESTS_FILE), `${JSON.stringify(kept, null, 2)}\n`) const shipped = Object.values(live).filter(Boolean).length console.log(`${MANIFESTS_FILE}: ${shipped} of ${Object.keys(live).length} tools ship a manifest`) } else { const committed = read(MANIFESTS_FILE) - const catalog = (await getJson(DESKTOP_CATALOG_URL)) as { tools: Record[] } + type Catalog = { tools: Record[] } + // `--catalog ` reads a Desktop branch's catalog instead of main's, to check a change before it merges. + const catalog = ( + values.catalog ? JSON.parse(readFileSync(values.catalog, "utf8")) : await getJson(DESKTOP_CATALOG_URL) + ) as Catalog + const token = process.env.GITHUB_TOKEN + const release = await getJson(DESKTOP_RELEASE_URL, token ? { authorization: `Bearer ${token}` } : {}) + const tag = String(release.tag_name) + const released = (await getJson(`${DESKTOP_RAW}/${tag}/catalog/tools.json`)) as Catalog + const allowed = read(DRIFT_ALLOW_FILE) const stale = staleProblems(committed, live) const drift = [ ...overlayProblems(tools, overlays), ...portProblems(overlays, catalog), - ...driftProblems(tools, overlays, live, catalog, read(DRIFT_ALLOW_FILE)), + ...allowProblems(allowed, new Date().toISOString().slice(0, 10)), + ...driftProblems(tools, overlays, live, catalog, allowed), + ...missingCommands(tools, overlays, live, catalog, "main"), + ...missingCommands(tools, overlays, live, released, tag), ] for (const name of Object.keys(live).filter((n) => !live[n])) console.log(`gap ${name}: ships no manifest yet`) for (const p of stale) console.log(`stale ${p}`) for (const p of drift) console.log(`drift ${p}`) if (stale.length) console.log("Run `pnpm registry:official` and commit registry/official-manifests.json.") + console.log(`Compared with Desktop's catalog on ${values.catalog ?? "main"} and in its latest release, ${tag}.`) if (stale.length || drift.length) process.exit(1) console.log("The signed list, Desktop's catalog and the published CLIs agree.") }