English | 中文
This repository is a patch branch of
dsh-workbuddy-connect
(upstream), published to npm as @54145a/dsh-workbuddy-connect and based on
upstream v0.7.8.
Upstream reads the sign-in only from the WorkBuddy / WorkBuddy AI desktop app. This patch adds a second source: the CodeBuddy CLI sign-in. What used to require the desktop app now also works with just the CLI installed and logged in.
For upstream documentation (install, version-compatibility table, known limitations, disclaimer) see https://github.com/corrinehu/dsh-workbuddy-connect. This file only covers what the patch changes, how to install it, and its boundaries.
# Web profile (core 0.2.1-rc.2 -> this package 0.7.8-cli.1)
dsh plugin --profile web add @54145a/dsh-workbuddy-connect
dsh web
# Or straight from the repository
dsh plugin --profile web add github:54145a/dsh-workbuddy-connect-codebuddy-cli-patchSign in once — the desktop app or the CodeBuddy CLI both work:
codebuddy login # or sign in to the WorkBuddy desktop appThe CodeBuddy CLI and the WorkBuddy desktop app write their credentials into the same directory, differing only by filename:
| Source | File (in the shared directory) |
|---|---|
| WorkBuddy desktop app (CN) | workbuddy-desktop.info |
| WorkBuddy AI desktop app (global) | workbuddy-desktop-ai.info |
| CodeBuddy CLI (added by this patch) | Tencent-Cloud.coding-copilot.info |
The directory itself (CodeBuddyExtension/Data/Public/auth/) and the
per-platform probe order are reused verbatim from upstream: macOS
Application Support, Windows Local→Roaming AppData, Linux XDG config→data
home, WSL's mounted Windows profile first. The patch only appends the CLI
filename after every desktop candidate, so it introduces no new path rules.
The desktop app remains the identity authority: the CLI file is consulted only when no desktop candidate yields a credential.
In order of importance, these are the boundaries the patch deliberately draws:
- Desktop first, CLI as fallback. When the desktop app is signed in, the desktop credential is always used and the CLI file is not even read. The CLI is reached only after the desktop app signs out (its file stays valid JSON but carries no token).
- A corrupt desktop file still fails loudly and is not papered over by the CLI. An unparsable file, or a failed decryption of an encrypted credential, throws exactly as upstream does. The desktop file is the identity authority; a broken one is a problem to fix, not a reason to quietly switch sign-ins.
- Cross-region is skipped, never an error. Because both products share one
directory, "the global plugin meets a CN CLI sign-in" is coexistence, not
misconfiguration: a region-mismatched CLI file is silently skipped. The
credential-region-mismatchthrow incurrent()is reserved for a desktop file pointed at the wrong product. Each variant honors only its own region's CLI sign-in. - An explicit path is never widened. A path given via the
authFilesetting or theWORKBUDDY_AUTH_FILEenv var (international:WORKBUDDY_AI_AUTH_FILE) is used verbatim and does not pick up the CLI file alongside it. Even when that path names the CLI's file, it is treated with desktop semantics. - The CLI file is never written back to. The CLI owns its file. Refreshed
credentials go to the plugin-owned copy under
$DSH_HOME, exactly as upstream treats the desktop file. - Status still reports
desktop. The patch does not add aclisource label — a CLI credential enters the desktop slot on read, so thesourcefield instatus/doctorstill printsdesktopfor a CLI sign-in. This is deliberate: a smaller diff is easier to rebase across upstream releases.
Against upstream v0.7.8:
| File | Change |
|---|---|
src/auth.ts |
Core: CLI_AUTH_FILENAME constant, CLI file appended to the candidate list, readDesktop() split into the upstream desktop probe (verbatim) plus a region-filtered CLI segment |
src/bin.ts |
Copy only: doctor hints mention the CLI |
src/client/index.tsx |
Copy only: overrides the four intro / signedOutHint keys at locale.register; locales.ts is left untouched |
package.json |
Renamed to @54145a/dsh-workbuddy-connect; author/repository point at this fork |
cordis.patch.yml |
The patch entry's name follows the package name, now scoped |
tests/*.spec.ts |
Two assertions invalidated by the candidate append rewritten; CLI fallback and copy-override cases added |
.github/workflows/release.yml |
Added: publishes to npm on a tag push |
.gitattributes |
Declares both READMEs as merge=ours when syncing upstream |
Unchanged: src/client/locales.ts (byte-identical to upstream),
upstream.ts, variants.ts, status-paths.ts,
desktop-credential-protection.ts, catalog.ts, web-status.ts. The routes
under /plugins/dsh-workbuddy-connect/... are hard-coded literals unrelated to
the package name, so scoping does not affect them.
The changes here are deliberately concentrated in files upstream rarely touches.
Measured on a simulated release, a sync needs one manual merge — package.json:
git remote add upstream https://github.com/corrinehu/dsh-workbuddy-connect.git
git fetch upstream --tags
git merge upstream/main # or a specific tag
# merge package.json by hand (version + @deepseek-ai peer range); the rest is automatic
pnpm check # regenerates lib/ and verifiesWhy only one:
src/auth.tsis the only core file changed, and recent upstream releases have not touched it at all (v0.7.7 -> v0.7.8 changed it zero times).locales.tsis byte-identical to upstream — the copy is overridden at the registration site inindex.tsx. Upstream rewrites those very keys often (v0.7.8 changedintroandsignedOutHint), so leaving the copy inlocales.tswould make every release a manual merge.- Both READMEs are declared
merge=oursin.gitattributes: they were rewritten as this fork's documentation, so upstream's edits are not merged.
Two caveats worth knowing:
merge=oursneeds a local git setting. The driver is a built-in git convention, but its definition lives in.git/configand does not travel with a clone, so on a new machine run this once:Without it git does not recognize the driver and the attribute degrades to an ordinary conflict — a safe failure, nothing is silently lost.git config merge.ours.driver truepackage.jsonmust never be added to.gitattributes. Measured: withmerge=ourson it, a merge resolved with zero conflicts while upstream's version and@deepseek-aipeer range were silently discarded (left at the old values) — and that range is exactly what decides whether the plugin loads on the next DSH core line. It stays a manual merge.
The version is upstream baseline + -cli.N, so the mapping stays obvious
when upstream ships a new release:
| Upstream | This package |
|---|---|
| 0.7.8 | 0.7.8-cli.1, 0.7.8-cli.2, … |
| 0.7.9 | 0.7.9-cli.1, … |
-cli.1 is a valid semver prerelease, which sorts below 0.7.8:
0.7.8-cli.1 < 0.7.8-cli.2 < 0.7.8 < 0.7.9-cli.1 < 0.7.9
Do not use 0.7.8+cli.1: semver treats that as build metadata, so it is
equal to 0.7.8 and cannot distinguish the two packages.
# 1. Bump the version and rebuild (edit by hand; `pnpm pkg set` reorders devDependencies)
sed -i 's/^ "version": ".*",$/ "version": "0.7.8-cli.2",/' package.json
pnpm check # typecheck + tests + build, regenerates lib/
git commit -am "chore: release 0.7.8-cli.2"
git push
# 2. Tag and push — this is what triggers the publish
git tag v0.7.8-cli.2
git push origin v0.7.8-cli.2On a v* tag the workflow installs dependencies, runs pnpm check, verifies the
tag against package.json, then runs
pnpm publish --access public --provenance --no-git-checks --tag latest using
the repository secret NPM_TOKEN.
--tag latestmust be spelled out. The version is a prerelease and the two tools disagree on what that implies: npm refuses to publish one without--tag(You must specify a tag using --tag), while pnpm publishes it silently. Leaving it to pnpm's default would make the dist-tag depend on undocumented behaviour.latestis deliberate so a plaindsh plugin add @54145a/dsh-workbuddy-connectresolves to this build.- A semver RANGE will not match a prerelease:
^0.7.8and>=0.7.8both fail against0.7.8-cli.1. Installs must therefore be untagged or exact, never a range. - pnpm 12 is required:
--provenanceneeds pnpm >= 12 (pnpm 10/11'spublishhas no such flag). Upstream'sdiagnostics.ymlpins pnpm 10 — that is a testing version and must not be copied for publishing. - Registry auth: pnpm refuses to expand
${NODE_AUTH_TOKEN}from a project-level.npmrc, because a repository-controlled file must not be able to read credentials. Auth therefore depends onactions/setup-nodewriting its.npmrcto$RUNNER_TEMP(outside the repo) and exportingNPM_CONFIG_USERCONFIG, which pnpm treats as user-level. NPM_CONFIG_REGISTRYis set explicitly: publishing is the one operation where silently landing on a configured mirror is not a performance question.--no-git-checksis required, not a shortcut:actions/checkoutleaves a detached HEAD on a tag, and pnpm's defaultpublish-branchcheck (master|main) needs an attached branch name, so the publish would fail withERR_PNPM_GIT_UNKNOWN_BRANCH. Working-tree cleanliness is already enforced by the precedingpnpm check, which leaves the tree clean.
One-time setup: add NPM_TOKEN under the GitHub repository's Settings →
Secrets and variables → Actions, holding an npm Automation token (that type
skips OTP, which is what CI needs). The token must be allowed to publish in the
@54145a scope.
dsh plugin --profile web exec dsh-workbuddy-connect doctor --json
dsh plugin --profile web exec dsh-workbuddy-connect status --jsonThe command after exec is the package's bin name
(dsh-workbuddy-connect), independent of whether the package name is scoped.
With only the CodeBuddy CLI signed in, doctor reports:
{
"desktopAuthFile": {
"path": "/home/<user>/.local/share/CodeBuddyExtension/Data/Public/auth/Tencent-Cloud.coding-copilot.info",
"present": true,
"format": "plaintext"
},
"signIn": "signed-in"
}path names the file actually hit (here, the CLI file), which is upstream's
existing diagnostic semantics.
- refresh_token rotation race (real; not handled by this patch). The CLI and
WorkBuddy share the same refresh endpoint, and refreshing rotates the
refresh_token: in one live run it went from 1088 to 700 characters. If the
plugin, the real CodeBuddy CLI, or
dsh-codebuddy-clihold the same account's refresh chain concurrently, whichever refreshes first invalidates the other's refresh_token. This is the same level as upstream's status quo (upstream likewise shares the chain with the desktop app), so the patch changes no code and only warns here: on a mysterious "sign-in expired", sign in again. - The CLI file format is verified against a real install only. A live
CodeBuddy CLI 2.63.x CN account writes plaintext JSON (
auth.domain = "www.codebuddy.cn"), which upstream's existing parser reads directly. If the CLI later switches to an encrypted envelope or another schema, that file is classifiedunrecognized/encryptedand silently skipped (the fallback segment never throws), surfacing as "the CLI sign-in doesn't work" rather than an error. - XDG edge cases. On the test machine the CLI writes under
~/.local/share(data home), and upstream's Linux candidates probe both, so it is found. But with a non-defaultXDG_CONFIG_HOME/XDG_DATA_HOME, if the CLI binary honors only one of~/.configor~/.local/share, the fallback can miss — pointWORKBUDDY_AUTH_FILEstraight at the CLI file (it is then handled with desktop semantics; see contract 4). - The global variant's
doctorpresentflag is optimistic. With only a CN CLI file present, the global variant still reportspresent: true(the file does exist) while the credential is region-skipped andsignInstayssigned-out. A display-only imprecision, accepted. - Peer dependencies are bound to a core line. This package targets DSH core 0.2.1-rc.2. On core 0.2.1-rc.1 use upstream 0.7.7; on 0.2.0-rc.2 use upstream 0.7.6. Installing across core lines makes DSH fail to start.
- Other CLI capabilities are out of scope. Only the sign-in is reused; the
CLI's
X-IDE-Type: cliclient identity, multi-account support, daily check-in, and the credits panel are untouched.
- Unit tests:
pnpm check(typecheck + 804 tests + build) is green; the new CLI fallback cases fail against the unpatched code, so they are not vacuous. - Live (this machine has no WorkBuddy desktop app, only a CodeBuddy CLI
sign-in): installed into a real DSH Web profile,
GET /plugins/dsh-workbuddy-connect/statusreturnedsigned-inwith the real account andcatalog.source: live; the auth directory held only the CLI file — no desktop file and no plugin-owned copy — so that sign-in could only have come from the CLI. - Refresh path: a CLI credential successfully exchanged for a new access token through WorkBuddy's refresh endpoint, and the original CLI file was left byte-identical (matching sha256 before and after).
- fu827707013/dsh-codebuddy-cli — the sibling plugin that connects the CodeBuddy CLI to DSH. This patch's CLI fallback design follows it directly: the credential filename
Tencent-Cloud.coding-copilot.info, the probe order across the sharedCodeBuddyExtension/Data/Public/authdirectory, and its parser, which is structurally identical to workbuddy's. Without that project there would have been no starting point for establishing that a CLI sign-in could be reused by workbuddy-connect at all.
Same as upstream, MIT.