Every entry point serves /dsh/latest.json and the release tarballs, synced from GitHub; the version check asks the mirror first through the endpoint pool and installs the mirrored tarball, with GitHub as the fallback. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
4.3 KiB
Repository agent guide
This file governs the entire dsh-geek2api repository.
Repository identity
- Canonical repository:
https://github.com/CoderKuo/dsh-geek2api(derived fromhttps://github.com/BaronCyrus/dsh-packycode-api, MIT) - Package name:
dsh-geek2api, distributed as a GitHub Release tarball (dsh-geek2api-<version>.tgz); not published to npm - DSH plugin row:
geek2api - Model group display name:
Geek2API - Gateway: Geek2API, a sub2api deployment. Entry points:
hk,hk2,hk3,hk4,www.geek2api.com. Default endpoints are geek2api.com hosts only. - LLM provider route key:
geek2api
Project boundaries
- This is a permanent DSH profile plugin, not a temporary dynamic Cordis Plugin.
- Host code belongs in
src/index.jsand its sibling modules; browser UI belongs insrc/client.jsxand is built through the client wrapper intsdown.config.mjs. - The route is self-contained: the plugin builds its own pi-ai provider, catalog, key ring, and balance reader. It must never require the user to edit
cordis.patch.ymlorllm-pi-aiprovider YAML. - Never introduce a silent fallback to another provider, another credential source, or an ambient
GEEK2API_API_KEY. Only keys the user added through this plugin may authenticate a request. - The catalog declares protocols and effort levels from vendor documentation. Changing a model's
api,baseUrl, orthinkingLevelMaprequires a note inCHANGELOG.mdand a live check.
Security requirements
- Never print, log, commit, return to the browser, or include in diagnostics any API key.
scripts/live-check.mjsmay read the stored key but must only ever print its masked tail. - Credentials and balance requests stay host-side. Browser RPC returns only the projections in
src/rpc.js. - Balance requests stay bounded by a timeout and configured with
redirect: 'error'. - Preserve unrelated DSH plugins, profiles, sessions, settings, and credentials.
- Do not start, stop, or restart DSH without explicit user permission.
Source and generated files
- Edit
src/; never hand-edit generatedlib/index.jsorlib/client.js. lib/is tracked and must be regenerated withpnpm run buildafter source changes..artifacts/andnode_modules/are ignored and must never be committed.- Add or update tests under
tests/for behavior changes.
Required validation
pnpm install
pnpm run check
pnpm run check must run every test, rebuild both bundles, and produce the versioned tarball in .artifacts/.
Live gateway behavior is verified with node scripts/live-check.mjs after a build. It consumes a small amount of quota; run it when a change touches the catalog, the provider composition, or the failure classification. Do not claim runtime success from a passing build alone.
Release authorization
Git tags and GitHub Releases are externally visible: installed copies offer the newest release as an update. Create them only when the user explicitly asks to release and confirms the target version. A request to modify, test, or commit alone is not release authorization.
Never reuse, move, or delete a published tag or release asset. If a released version needs a correction, release a new patch version.
Release checklist
-
Confirm a clean base and an unused version:
git status --short --branch git ls-remote --exit-code --tags origin refs/tags/v<version> # must fail -
Update
package.jsonversion and add a## <version>section toCHANGELOG.md(the release workflow uses that section as the release notes). -
Validate:
pnpm install --frozen-lockfile && pnpm run check, and commit the rebuiltlib/. -
Push
main, then tag and push the tag:git tag -a v<version> -m "dsh-geek2api v<version>" git push origin v<version>.github/workflows/release.ymlrefuses a tag that does not matchpackage.json, runspnpm run check, refuses a stalelib/, and creates the release withdsh-geek2api-<version>.tgzattached. Every Geek2API entry point mirrors the release at/dsh/within about 10 minutes (origin timerdsh-mirror-sync); the plugin's update check reads the mirror'slatest.jsonfirst and GitHubreleases/latestas the fallback. -
Confirm the workflow succeeded and the asset is attached before announcing the release.