Repository navigation
agents subman skill SKILL
name: subman-project description: Use when working on the SubMan repository, including Gist workspace behavior, Cloudflare Workers deployment, trusted automation API integration, node sync scripts, or aggregate publishing.
English | 简体中文
Use this skill when modifying or operating SubMan. SubMan is a SvelteKit app that stores its workspace in a fixed GitHub Gist and can expose trusted automation API endpoints from the same Cloudflare Worker.
Paths outside references/ below are relative to the repository root.
- Inspect the current worktree and read
AGENTS.mdfor repository rules. - Read
docs/agents/subman-agent-guide.mdfor the agent-facing overview. English is the default; each guide has a*.zh-CN.mdChinese counterpart. - Pick only the reference needed for the task:
- Architecture and file map:
references/architecture.md - Cloudflare deployment and verification:
references/deployment.md - Gist workspace and
subman.json:references/workspace-data.md - Trusted backend/API integration:
references/server-api.md
- Architecture and file map:
- Use Bun 1.3.14 and
bun install --frozen-lockfile; follow current package scripts. - Cloud
subman.jsonis the sole business authority in one bound Gist. Require a fresh cloud load before edits; IndexedDB holds only technical cache, delivery journals, and recovery evidence. Do not restore local business mode or switching. - Keep the workspace identity stable: description
SubMan-Data, filesubman.json. - Do not give external automation the GitHub token. Store
GITHUB_TOKENin Cloudflare Secrets and give scripts onlySUBMAN_API_TOKEN. - Browser GitHub tokens use session-only
sessionStorageby default. PersistentlocalStorageneeds explicit Remember token opt-in and stays outside IndexedDB. - For machine-managed nodes, prefer
PUT /api/nodes/by-key/:externalKey. - Treat that endpoint as resource-identity idempotent, not request-replay
idempotent. The API does not support
Idempotency-Key. - A public Node API write
2xxresponse proves a verified remote commit. Use responseETagvalues with optionalIf-Matchfor optimistic concurrency. - Treat
/api/workspaces/:workspaceId/mutationsas an internal browser protocol, never as an integration surface. - Node names must remain distinguishable for aggregate filtering. UI and API writes automatically add a timestamp suffix on name collision.
- Treat duplicate node raw URIs as content duplicates. UI and API writes reject raw collisions instead of creating another node with a different name.
- Conflict recovery reloads the original cloud document only after confirming complete-queue discard. Do not restore local push/merge, bind-only, manual sync, or business JSON backup/import.
- Await
WorkspaceActionHandle.completion;submittedonly accepts the task. Use the shared presenter for operation outcomes and keep durable queued, peer-owned, or retry-scheduled work pending. Onlyremote-committedreports success or finalizes a draft. - Preserve revisions, tombstones, mutation IDs, fencing tokens, and the complete Workspace queue during repair. Diagnostics must never read raw quarantine data.
- Run
bun run checkafter TypeScript or Svelte changes. Runbun run buildbefore deployment-related completion claims. - Make atomic commits after independent changes.
- Default to local/mock checks. Do not push, deploy, access/mutate real Gists, create releases, or use production secrets without explicit authorization.
API integration details, including the effective 119-byte external-key limit, 63 caller-tag limit, full-field PUT defaults, and uncertain-write recovery, are in the Server API guide. API discovery uses Worker credentials independently of browser binding; check the returned Gist identity before writing. Node updates do not republish output files, and GET/health success does not prove a remote commit.
Read references/server-api.md and docs/api/openapi.yaml. For sing-box-vps,
use the integration guide
(简体中文). Use stable external
keys and curl --fail-with-body -sS or equivalent status-plus-body handling.
Treat SubMan as a low-frequency Gist-backed write target, not a high-concurrency
database. Branch on stable error codes and dispositions, preserve retry timing,
and handle 409 duplicate_node_raw as "this node URI already exists elsewhere".
When changing the public API, update docs/api/openapi.yaml,
docs/api/server-api.md, the English README and Chinese counterpart, and
references/server-api.md together. Keep translated guides synchronized.
Run bun test src/lib/server/api plus runtime gates for route changes.
Read references/workspace-data.md and inspect src/lib/workspace.ts,
src/lib/workspace-browser-session-v2.ts,
src/lib/workspace-persistence.ts, src/lib/workspace-mutation-sync.ts,
src/lib/workspace-operation-result.ts, and
src/lib/server/workspace-coordinator-core.ts. Preserve the protected
subman.json file, revisioned mutation queue, and same-gist publishing model.
Read src/lib/workspace-cloud-session.ts for startup cloud revalidation and
src/lib/workspace-settings-controller.ts for persisted cloud reload/recovery.
Keep the single binding and cloud authority; no local overwrite/merge or manual
business mode. Retained internal merge/reconcile code must preserve tombstones.
Add protocol behavior tests first, then run unit, type, lint, Cloudflare, and
relevant browser gates.
Read docs/legacy-workspace-migration.md and references/workspace-data.md.
Use /auth Manual Workspace migration only while unbound, with the original
Gist ID, for a read-only check. Bound startup/reconnection reads the original
Gist and cannot select another one. Initial absent discovery can create an empty
bootstrap; ambiguity requires an explicit ID. Confirm the original Gist and
preview before migration. Retain historical cache and repair evidence for
operator recovery; do not upload it, clear queues, regenerate outputs, or change
old links. Offline audit uses scripts/audit-workspace.ts without network or
credentials; its conversion artifact has no current browser import path.
Inspect the matching route under src/routes. Keep the current product shape:
/auth for workspace/token/sync, /gists for workspace files, /nodes for
node and subscription management, /aggregate for output rules and
publishing, and /exports for sing-box profiles and publication. Follow
DESIGN.md, require fresh cloud data before editing, retain drafts until
remote-committed, and verify changed browser flows. Pending/peer/retry results
are technical delivery states and never local business success.
Read references/deployment.md and docs/workspace-v2-operations.md. Use
Wrangler through bun. Verify the Durable Object migration and secrets after
deployment.
SubMan Wiki
| English | 简体中文 |
|---|---|
| User guide | 使用指南 |
| Development | 开发指南 |
| Server API | 接口文档 |
| Operations | 运维与恢复 |
| Migration | 旧版迁移 |
| sing-box export | sing-box 导出 |
| CI/CD | CI/CD |
| Roadmap | 路线图 |
| Changelog | 变更记录 |