rigjs 4.0.18 → 4.1.0
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.
- package/.claude/skills/rig-cicd/SKILL.md +288 -0
- package/.claude/skills/rig-package/SKILL.md +162 -0
- package/RIG_CICD_SKILL.md +288 -0
- package/RIG_CREW_SKILL.md +50 -50
- package/RIG_PACKAGE_SKILL.md +162 -0
- package/built/index.js +346 -259
- package/lib/classes/cicd/CICD.ts +17 -0
- package/lib/classes/cicd/Deploy/ESA.ts +117 -0
- package/lib/crew/ask.ts +3 -3
- package/lib/crew/board.ts +14 -14
- package/lib/crew/config.ts +2 -2
- package/lib/crew/dispatchCommand.ts +58 -0
- package/lib/crew/doctor.ts +1 -1
- package/lib/crew/engine.test.ts +73 -0
- package/lib/crew/engine.ts +103 -0
- package/lib/crew/index.ts +48 -27
- package/lib/crew/init.ts +3 -3
- package/lib/crew/{inbox.ts → pendingQuestions.ts} +6 -7
- package/lib/crew/project.ts +1 -1
- package/lib/crew/role.ts +3 -3
- package/lib/crew/runtime.test.ts +160 -0
- package/lib/crew/runtime.ts +192 -0
- package/lib/crew/status.ts +4 -4
- package/lib/crew/stub.ts +2 -2
- package/lib/crew/task.ts +3 -3
- package/lib/crew/vault.ts +14 -14
- package/lib/init/index.ts +16 -9
- package/lib/publish/index.ts +78 -1
- package/lib/wiki/lint.ts +23 -1
- package/package.json +11 -3
- package/scripts/sync-skill.mjs +2 -0
- package/skills.md +5 -1
- package/lib/utils/redact.test.ts +0 -43
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rig-cicd
|
|
3
|
+
description: >-
|
|
4
|
+
Agent skill for `rig build` / `rig deploy` / `rig publish` — rig's static-site CI/CD targeting Aliyun OSS + CDN. One OSS bucket serves many sites: each site is uploaded into its own subdirectory; CDN URI-rewrite rules (set by `rig publish`) map incoming `https://<domain>/...` to the right `oss://<bucket>/<deployDir>/...` path. Supports SPA hash, SPA history (BrowserRouter), MPA (one HTML per route), and any pre-built directory of HTML files. Trigger when the user wants to build/deploy/publish a web app via rig, debug a CDN rewrite, add a new endpoint or domain, switch web_type, or asks "rig 怎么部署" / "回源路径怎么改" / "一个 OSS 桶发多个站怎么配". Do NOT use for backend deploys, container registries, non-Aliyun providers (Huawei stub exists but isn't wired through), or package management (see rig-package).
|
|
5
|
+
user-invocable: true
|
|
6
|
+
disable-model-invocation: false
|
|
7
|
+
metadata:
|
|
8
|
+
openclaw:
|
|
9
|
+
requires:
|
|
10
|
+
bins: [rig, git, yarn, node]
|
|
11
|
+
os: [darwin, linux]
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# rig-cicd — agent operator's playbook
|
|
15
|
+
|
|
16
|
+
## What this skill covers
|
|
17
|
+
|
|
18
|
+
rig ships three CI/CD commands that share the `cicd` block of `package.rig.json5`:
|
|
19
|
+
|
|
20
|
+
- `rig build [-s <schema>] [-p <params>] <dirPath>` — runs the per-endpoint build script with rig-injected variables (`publicPath`, `OUTPUT_DIR`, defines), then rewrites string tokens (`__RIG_PUBLIC_PATH__`, `__RIG_ENTRY_PATH__`, …) inside the built output. Output lands at `<source.root_path>/<deployDir>/`.
|
|
21
|
+
- `rig deploy [-s <schema>] [-p <params>] <dirPath>` — uploads `<source.root_path>/<deployDir>/` to the configured OSS bucket. Sets `Cache-Control: no-cache` on `index.html`, `max-age=31536000` on `.js` / `.css` / `.ico`.
|
|
22
|
+
- `rig publish [-s <schema>] [-p <params>] <dirPath>` — sets / updates Aliyun CDN **URI-rewrite** rules on each domain (this is what makes one bucket serve many sites), then refreshes the CDN cache.
|
|
23
|
+
|
|
24
|
+
Typical pipeline: `rig build "<dir>" && rig deploy "<dir>" && rig publish "<dir>"`. Build and deploy can run independently; **publish is the only step that touches CDN config** — re-run it whenever you change `web_type`, `endpoints`, `target`, or rename a `deployDir`.
|
|
25
|
+
|
|
26
|
+
The `<dirPath>` arg is a `/`-joined path matched against `tree_schema`. Use `%` as a wildcard and `%<group>` to reference a `groups[].name` (see `tree_schema` field below).
|
|
27
|
+
|
|
28
|
+
## Topology — one OSS bucket, many sites
|
|
29
|
+
|
|
30
|
+
A single OSS bucket holds every site:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
oss://<bucket>/
|
|
34
|
+
app-a/
|
|
35
|
+
index.html
|
|
36
|
+
assets/...
|
|
37
|
+
app-b/
|
|
38
|
+
index.html
|
|
39
|
+
assets/...
|
|
40
|
+
marketing/
|
|
41
|
+
en/
|
|
42
|
+
index.html
|
|
43
|
+
zh/
|
|
44
|
+
index.html
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
For each public domain you serve, CDN holds a stack of **URI rewrite** rules that map the user-visible path to a real OSS object. Example for `app-a.example.com` running SPA history mode:
|
|
48
|
+
|
|
49
|
+
| Match (incoming URI) | Rewrite to (origin path) | Purpose |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| `^/([^?]*\.[a-zA-Z0-9]+)($|\?)` | `/app-a/$1` | Any path ending in a file extension → that file under `app-a/` |
|
|
52
|
+
| `^/([\w-/]*\w+)(?![^?]*\.\w+)` | `/app-a/index.html` | Any extensionless path → SPA entry under `app-a/` |
|
|
53
|
+
| `^(/)($|\?|#|/\?|/$)` | `/app-a/index.html` | The web-entry path itself → SPA entry under `app-a/` |
|
|
54
|
+
|
|
55
|
+
`rig publish` generates these rules deterministically from `cicd.web_type` + each endpoint's `deployDir`, calls Aliyun CDN's `SetCdnDomainConfig` with `enhance_break` (stop processing further rules once matched), waits for the rule status to flip to `success`, then calls `RefreshObjectCaches` on the touched URLs. Failure modes: 10-min config-apply timeout, 10-min refresh timeout. The `setRewriteUri` / `refreshCache` retry loops poll every 3 s up to 100 ticks.
|
|
56
|
+
|
|
57
|
+
## `cicd` block — field reference
|
|
58
|
+
|
|
59
|
+
Lives inside `package.rig.json5` alongside `dependencies`. Comments are JSON5-legal.
|
|
60
|
+
|
|
61
|
+
```json5
|
|
62
|
+
{
|
|
63
|
+
// ... dependencies block (see rig-package skill) ...
|
|
64
|
+
|
|
65
|
+
cicd: {
|
|
66
|
+
// tree_schema — REQUIRED. Slash-joined path schema describing the SHAPE of <dirPath> args.
|
|
67
|
+
// Each segment is a "DirLevel". Examples:
|
|
68
|
+
// 'env/app' → two static segments: env, app.
|
|
69
|
+
// 'env/{vendor}' → second level is dynamic (param name 'vendor').
|
|
70
|
+
// 'env/%region/app' → second level uses a named group (see `groups`).
|
|
71
|
+
// Aliases: `path_schema` (kept for back-compat).
|
|
72
|
+
tree_schema: 'env/app',
|
|
73
|
+
|
|
74
|
+
// web_type — OPTIONAL, default 'hash'. Drives the CDN rewrite rules `rig publish` generates.
|
|
75
|
+
// 'hash' — SPA with hash routing (e.g. Vue Router hash mode, /#/foo).
|
|
76
|
+
// Files are NOT prefixed with deployDir (the build embeds publicPath itself);
|
|
77
|
+
// the only rule the publish step needs is "home → /<deployDir>/index.html".
|
|
78
|
+
// Lets ONE domain serve MULTIPLE hash-mode SPAs at different entry paths
|
|
79
|
+
// (/, /app1, /app2) because the runtime never asks the server for routes.
|
|
80
|
+
// 'history' — SPA with history routing (BrowserRouter / Vue Router history mode).
|
|
81
|
+
// ALL extensionless paths → /<deployDir>/index.html (server falls through to SPA).
|
|
82
|
+
// File-extension paths → /<deployDir>/<path>.
|
|
83
|
+
// 'mpa' — Multi-Page App: one HTML per route. ALSO the right choice for "a pre-built
|
|
84
|
+
// directory of HTML files" (e.g. a docs site, a hand-written static site,
|
|
85
|
+
// a Next.js `next export` output).
|
|
86
|
+
// Extensionless path /foo → /<deployDir>/foo.html.
|
|
87
|
+
// File-extension path → /<deployDir>/<path>.
|
|
88
|
+
web_type: 'history',
|
|
89
|
+
|
|
90
|
+
// source — REQUIRED. Where rig reads the built artefacts from on the local filesystem.
|
|
91
|
+
source: {
|
|
92
|
+
// root_path — REQUIRED. Directory (relative to project root) that contains per-endpoint
|
|
93
|
+
// subdirs after `rig build`. `rig deploy` walks <root_path>/<deployDir>/ and uploads
|
|
94
|
+
// every file with the relative path used as the OSS object key.
|
|
95
|
+
root_path: 'dist',
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
// target — REQUIRED. One DeployTarget object OR an array (only the first is used today).
|
|
99
|
+
target: {
|
|
100
|
+
// id — REQUIRED. Free-form label, used in logs.
|
|
101
|
+
id: 'prod',
|
|
102
|
+
|
|
103
|
+
// type — REQUIRED. Cloud provider. Currently only 'alicloud' is wired through publish + deploy.
|
|
104
|
+
// (A HuaweiDeploy.ts stub exists but is not connected to the publish path.)
|
|
105
|
+
type: 'alicloud',
|
|
106
|
+
|
|
107
|
+
// bucket / region / access_key / access_secret — REQUIRED. Aliyun OSS credentials.
|
|
108
|
+
// The same credentials are reused for CDN API calls during `rig publish`.
|
|
109
|
+
// NEVER inline real keys here — read from env (.env at project root) or the keychain and
|
|
110
|
+
// inject via `-p key=value` or `${VAR}` substitution in the file.
|
|
111
|
+
bucket: 'my-site-bucket',
|
|
112
|
+
region: 'oss-cn-hangzhou',
|
|
113
|
+
access_key: '${ALIYUN_ACCESS_KEY}',
|
|
114
|
+
access_secret: '${ALIYUN_ACCESS_SECRET}',
|
|
115
|
+
|
|
116
|
+
// root_path / bucket_root_path — REQUIRED. OSS key prefix all uploads share. Use '/'
|
|
117
|
+
// unless your bucket is shared with non-rig content.
|
|
118
|
+
root_path: '/',
|
|
119
|
+
bucket_root_path: '/',
|
|
120
|
+
|
|
121
|
+
// web_entry_path — OPTIONAL, default '/'. Fallback entry path when an endpoint omits its own.
|
|
122
|
+
// Used only in hash mode (history/mpa always treat '/' as entry).
|
|
123
|
+
web_entry_path: '/',
|
|
124
|
+
|
|
125
|
+
// uri_rewrite — OPTIONAL. Manual override for the CDN rewrite step. When set (with
|
|
126
|
+
// `original` or `original_regexp`), `rig publish` skips the auto-generated entry rule
|
|
127
|
+
// for that endpoint and uses this one instead.
|
|
128
|
+
// - original / original_regexp — the incoming URI to match. Pass a regex via
|
|
129
|
+
// original_regexp; plain prefixes via original. Example: '/admin'.
|
|
130
|
+
// - final — reserved, not consumed by publish today.
|
|
131
|
+
// Use this only when you need a non-standard entry path (e.g. `/portal` instead of `/`)
|
|
132
|
+
// on top of one of the three web_type modes.
|
|
133
|
+
uri_rewrite: undefined,
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
// endpoints — REQUIRED. Map keyed by the dir path that, when joined with `tree_schema`,
|
|
137
|
+
// identifies one site to build/deploy/publish. Each value tells rig how to build it and
|
|
138
|
+
// where to put it.
|
|
139
|
+
endpoints: {
|
|
140
|
+
// The key 'prod/app-a' fits a tree_schema of 'env/app' (two static segments).
|
|
141
|
+
'prod/app-a': {
|
|
142
|
+
// build — REQUIRED unless vue_env is set. Shell command rig runs to produce the bundle.
|
|
143
|
+
// rig substitutes the following tokens in the string BEFORE exec:
|
|
144
|
+
// $public_path / __PUBLIC_PATH__ / __RIG_PUBLIC_PATH__ → the deploy dir as URL path
|
|
145
|
+
// __RIG_OUTPUT_DIR__ → <source.root_path>/<deployDir>
|
|
146
|
+
// Use `__RIG_OUTPUT_DIR__` for `--outDir` / `--dest` flags so build output lands in
|
|
147
|
+
// the right place. Output dir is also exported as the env var `OUTPUT_DIR` for the
|
|
148
|
+
// child process (`PUBLIC_PATH` is exported too).
|
|
149
|
+
build: 'yarn vite build --base=__RIG_PUBLIC_PATH__ --outDir __RIG_OUTPUT_DIR__',
|
|
150
|
+
|
|
151
|
+
// vue_env — OPTIONAL. If set (e.g. 'prod'), rig generates a .env.rig file with
|
|
152
|
+
// PUBLIC_PATH + OUTPUT_DIR + every key in `extra_env`, then defaults `build` to
|
|
153
|
+
// `npx vue-cli-service build --mode rig --dest <OUTPUT_DIR>`. Use this with
|
|
154
|
+
// vue-cli projects to skip writing a custom build string.
|
|
155
|
+
vue_env: undefined,
|
|
156
|
+
|
|
157
|
+
// extra_env — OPTIONAL. Extra env vars that should land in the per-build .env file when
|
|
158
|
+
// vue_env is set. Also reachable from the build script via process.env.
|
|
159
|
+
extra_env: undefined,
|
|
160
|
+
|
|
161
|
+
// target — OPTIONAL. Free-form label that points back to a DeployTarget. Reserved for
|
|
162
|
+
// future multi-target routing; today rig deploys/publishes to `cicd.target[0]`.
|
|
163
|
+
target: 'prod',
|
|
164
|
+
|
|
165
|
+
// domain / domains — REQUIRED. Public domain(s) the CDN rules will be set on.
|
|
166
|
+
// `domains` is the canonical field (array, multi-domain). `domain` is the legacy
|
|
167
|
+
// single-value field kept for back-compat. Use `domains`.
|
|
168
|
+
domains: ['app-a.example.com'],
|
|
169
|
+
|
|
170
|
+
// defines — OPTIONAL. String-replace map applied to every built .js / .ts / .html file
|
|
171
|
+
// AFTER the build runs. Both keys and values are treated as plain strings. rig
|
|
172
|
+
// pre-populates these for you:
|
|
173
|
+
// __PUBLIC_PATH__ → the deploy dir as URL path
|
|
174
|
+
// __DEPLOY_DIR__ → the deploy dir as URL path
|
|
175
|
+
// __RIG_PUBLIC_PATH__ → same
|
|
176
|
+
// __RIG_DEPLOY_DIR__ → same
|
|
177
|
+
// __RIG_ENTRY_PATH__ → the endpoint's web_entry_path
|
|
178
|
+
// The values you supply are themselves replaced for: $public_path, __PUBLIC_PATH__,
|
|
179
|
+
// __RIG_PUBLIC_PATH__, __DOMAIN__, __RIG_DOMAIN__ before they are substituted into
|
|
180
|
+
// files. Useful for bundling absolute API URLs that depend on the deploy domain.
|
|
181
|
+
defines: {
|
|
182
|
+
__API_BASE__: 'https://api.__RIG_DOMAIN__',
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
// web_entry_path — OPTIONAL. Where the SPA mounts in hash mode. Default '/'. Lets you
|
|
186
|
+
// put two hash-mode SPAs on one domain at /, /portal, etc. Ignored when
|
|
187
|
+
// web_type='history' or 'mpa' (those always use '/').
|
|
188
|
+
web_entry_path: '/',
|
|
189
|
+
|
|
190
|
+
// uri_rewrite — OPTIONAL per-endpoint override (same shape as target.uri_rewrite above).
|
|
191
|
+
// When set, suppresses the auto-generated entry rule for this endpoint only.
|
|
192
|
+
uri_rewrite: undefined,
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
'prod/app-b': {
|
|
196
|
+
build: 'yarn build --base=__RIG_PUBLIC_PATH__ --outDir __RIG_OUTPUT_DIR__',
|
|
197
|
+
domains: ['app-b.example.com'],
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
|
|
201
|
+
// groups — OPTIONAL. Named bundles of values for one dynamic level of tree_schema.
|
|
202
|
+
// Lets `rig build env/%region/app` expand across many regions. Each group:
|
|
203
|
+
// - name Used in <dirPath> as `%<name>`. MUST start with `%`.
|
|
204
|
+
// - level The DirLevel name (segment of tree_schema, without `{}`).
|
|
205
|
+
// - includes Allowed values for that level. Endpoints whose actual dir value is not in
|
|
206
|
+
// `includes` are skipped during build/deploy/publish.
|
|
207
|
+
groups: [
|
|
208
|
+
{ name: '%apac', level: 'region', includes: ['cn', 'jp', 'sg'] },
|
|
209
|
+
],
|
|
210
|
+
},
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### `<dirPath>` matching rules (read before debugging "no endpoints matched")
|
|
215
|
+
|
|
216
|
+
`tree_schema` declares the shape; `<dirPath>` selects which endpoints to act on:
|
|
217
|
+
|
|
218
|
+
- `prod/app-a` — exact match. Only the `prod/app-a` endpoint runs.
|
|
219
|
+
- `prod/%` — wildcard at level 2. All endpoints whose first segment is `prod` AND whose level 2 is **dynamic** (declared as `{...}` in `tree_schema`) match.
|
|
220
|
+
- `%/app-a` — wildcard at level 1. Only endpoints whose second segment equals `app-a`.
|
|
221
|
+
- `prod/%apac/app` — group wildcard. Iterates `groups['%apac'].includes` and picks endpoints whose level-2 value is in `['cn','jp','sg']`. (Requires `tree_schema` to have THREE segments.)
|
|
222
|
+
- Extra trailing segments past `tree_schema.length` are appended to each matching endpoint's `deployDir`. E.g. with `tree_schema: 'env/app'` and `<dirPath>: 'prod/app-a/v2'`, the endpoint `prod/app-a` gets deployed to `<bucket>/prod/app-a/v2/`. This lets you push the same code under a versioned subpath without editing `endpoints`.
|
|
223
|
+
|
|
224
|
+
`-p key=value` and `-s key=value` further substitute `${key}` (in the JSON5 file) and `{key}` (inside `<dirPath>`) at run time. Use them for branch/PR/env scoping in CI.
|
|
225
|
+
|
|
226
|
+
## Intent → command map
|
|
227
|
+
|
|
228
|
+
| User intent | Action |
|
|
229
|
+
|---|---|
|
|
230
|
+
| "build everything for prod" | `rig build "prod"` (matches every endpoint whose first segment is `prod` if level 2 is dynamic, or just one if it's static). Verify the dist tree exists at `<source.root_path>/<deployDir>/` before deploying. |
|
|
231
|
+
| "build + deploy + publish one site" | `rig build "<dirPath>"` → `rig deploy "<dirPath>"` → `rig publish "<dirPath>"`. Publish is the slow one (CDN-config apply 30 s – minutes; cache refresh another minute). |
|
|
232
|
+
| "I changed web_type / endpoints / deployDir" | Re-run `rig publish "<dirPath>"` on every affected endpoint. Build + deploy alone do NOT update CDN rules. |
|
|
233
|
+
| "the site is showing the WRONG site" | Two suspects: (1) CDN rewrite rule is wrong — check Aliyun console → CDN domain → 配置 → 高级配置 → URI 改写; expect a rule per row matching the table in the topology section. (2) The OSS object isn't where you think — `aliyun oss ls oss://<bucket>/<deployDir>/`. Confirm `index.html` exists. |
|
|
234
|
+
| "404 on a deep route in history mode" | CDN rewrite rules missing the `^/([\w-/]*\w+)(?![^?]*\.\w+)` → `/<deployDir>/index.html` rule. Re-run `rig publish` to regenerate. |
|
|
235
|
+
| "404 on a deep route in MPA mode" | Means the matching `.html` file does not exist in OSS. The MPA rewrite is `/foo` → `/<deployDir>/foo.html` — your build must emit `foo.html`. If it emits `foo/index.html`, switch web_type or change the rewrite via `target.uri_rewrite`. |
|
|
236
|
+
| "rebuild publicPath was wrong, hash mode" | rig injects `__RIG_PUBLIC_PATH__` / `__PUBLIC_PATH__` and the `PUBLIC_PATH` env var. Use one of them in the bundler config (`vite --base`, Vue CLI `publicPath`, webpack `output.publicPath`). hash mode does NOT prefix OSS path with deployDir at the CDN layer — the bundle has to know its own deploy dir at build time. |
|
|
237
|
+
| "want a new domain on an existing site" | Add to the endpoint's `domains` array. Re-run `rig publish` (no rebuild needed). |
|
|
238
|
+
| "want one OSS bucket for two completely different sites" | That's the default model. Two endpoints with different `deployDir`s and different `domains`. `rig publish` writes per-domain rewrite stacks; the bucket is shared. |
|
|
239
|
+
| "deploy a pre-built static dir (docs site, hand-written HTML)" | Set `web_type: 'mpa'`. Point `endpoints.<dir>.build` at whatever produces the dir (or a no-op like `cp -r src/site dist/<deployDir>` if there's nothing to build). The MPA rewrite handles both `/about` → `/about.html` and `/img.png` → `/img.png`. |
|
|
240
|
+
| "credentials in package.rig.json5 — is that OK?" | NO. Use `${VAR}` interpolation or `-p key=value` and store the real values in env / keychain. Anything committed is shared with everyone who clones. |
|
|
241
|
+
|
|
242
|
+
## How it works under the hood
|
|
243
|
+
|
|
244
|
+
`rig build` (lib/build/index.ts):
|
|
245
|
+
1. Load `cicd` block; create `CICD` (parses `tree_schema` into `DirLevel[]`, builds an `Endpoint[]`).
|
|
246
|
+
2. Create `CICDCmd` from the `<dirPath>` arg — filters endpoints by `matchCmd()`, appends extra trailing path segments to each surviving endpoint's `deployDir` / `publicPath`.
|
|
247
|
+
3. For each surviving endpoint:
|
|
248
|
+
- Replace `$public_path`, `__PUBLIC_PATH__`, `__RIG_PUBLIC_PATH__`, `__DOMAIN__`, `__RIG_DOMAIN__` in `defines`.
|
|
249
|
+
- If `vue_env`, write `.env.rig` (via `lib/env`), default the `build` string if missing.
|
|
250
|
+
- Replace `$public_path`, `__RIG_OUTPUT_DIR__` in `build`. shelljs.exec.
|
|
251
|
+
- Walk the output dir; replace every `defines` key in every `.js` / `.ts` / `.html` file.
|
|
252
|
+
|
|
253
|
+
`rig deploy` (lib/deploy/index.ts):
|
|
254
|
+
1. Same `CICD` / `CICDCmd` setup.
|
|
255
|
+
2. For each endpoint: walk `<root_path>/<deployDir>/` recursively, upload every file via `ali-oss`'s `putStream` with the relative path as OSS key. `index.html` → `Cache-Control: no-cache`; `.js`/`.css`/`.ico` → `max-age=31536000`. Everything else uses bucket default.
|
|
256
|
+
|
|
257
|
+
`rig publish` (lib/publish/index.ts):
|
|
258
|
+
1. Same `CICD` / `CICDCmd` setup.
|
|
259
|
+
2. Group rewrite rules by **domain** (a domain can host multiple endpoints — uncommon but supported).
|
|
260
|
+
3. For each domain, build the rewrite stack from `web_type`:
|
|
261
|
+
- `hash`: only the file-extension passthrough `/<file>` → `/<file>` (no deployDir prefix — bundle is built with publicPath baked in) plus the entry rule (`/` or `web_entry_path` → `/<deployDir>/index.html`).
|
|
262
|
+
- `history`: file-extension paths → `/<deployDir>/<path>`; everything else → `/<deployDir>/index.html`.
|
|
263
|
+
- `mpa`: file-extension paths → `/<deployDir>/<path>`; extensionless paths → `/<deployDir>/<path>.html`; entry rule for `/`.
|
|
264
|
+
- If endpoint or target supplies `uri_rewrite`, only the file-extension rule + the custom entry are emitted (no auto extensionless rule). Useful for irregular sites mounted at non-root paths.
|
|
265
|
+
4. Call `cdn.setRewriteUri(domain, originals, deployDirs, ['enhance_break'])`. Poll `describeCdnDomainConfigs` every 3 s; succeed when all configs reach `Status: success`; fail on any `Status: failed` or after 100 ticks.
|
|
266
|
+
5. Call `cdn.refreshCache(urls.join('\n'))` on every touched entry URL. Poll `describeRefreshTaskById` the same way.
|
|
267
|
+
|
|
268
|
+
### Order matters when re-running publish
|
|
269
|
+
|
|
270
|
+
`SetCdnDomainConfig` appends rules — it does NOT replace the existing stack. If you change `deployDir` for an endpoint and re-publish, **both the old and new rules are now active**, and Aliyun evaluates the **first match wins** (the `enhance_break` action stops the chain). The old rule may shadow the new one. Cleanup steps:
|
|
271
|
+
|
|
272
|
+
1. Aliyun console → CDN → domain → 配置 → 高级配置 → URI 改写 → delete obsolete rules manually, OR
|
|
273
|
+
2. Use Aliyun's `BatchDeleteCdnDomainConfig` API if you script it (rig has no built-in cleanup today — surface this as a known gap when migrating endpoints).
|
|
274
|
+
|
|
275
|
+
## What rig CI/CD does NOT do
|
|
276
|
+
|
|
277
|
+
- **No non-Aliyun providers.** `HuaweiDeploy.ts` exists but is not wired into publish; CloudFront / Fastly / Cloudflare are out of scope.
|
|
278
|
+
- **No backend deploy.** Container images, lambdas, server bundles — find another tool.
|
|
279
|
+
- **No environment promotion ladder.** rig has no notion of "promote from staging → prod". Use distinct `tree_schema` segments (`env`) and run publish per env.
|
|
280
|
+
- **No rule cleanup.** Renaming a `deployDir` leaves orphan CDN rules pointing at the old path. Delete by hand.
|
|
281
|
+
- **No publish-time secret scanning.** Don't commit credentials into `package.rig.json5`; the deploy pipeline will happily ship them.
|
|
282
|
+
|
|
283
|
+
## Reporting & cleanup checklist (after non-trivial changes)
|
|
284
|
+
|
|
285
|
+
- After `rig build`: confirm `<source.root_path>/<deployDir>/index.html` exists for every targeted endpoint.
|
|
286
|
+
- After `rig deploy`: spot-check OSS with `aliyun oss ls oss://<bucket>/<deployDir>/`.
|
|
287
|
+
- After `rig publish`: open `https://<domain><web_entry_path>` and a deep route; both should respond 200 with the expected content. Cache may take another 30 s to settle even after the refresh task reports `Complete`.
|
|
288
|
+
- When migrating `web_type`, list every endpoint that was on the old type and re-publish each one — the rewrite stack is per-domain, not per-endpoint.
|
package/RIG_CREW_SKILL.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: rig-crew
|
|
3
3
|
description: >-
|
|
4
|
-
Agent-facing
|
|
5
|
-
`rig crew
|
|
6
|
-
refresh a human-readable dashboard, inspect
|
|
4
|
+
Agent-facing Orchestrator-first multi-agent workflow over an Obsidian vault using
|
|
5
|
+
`rig orchestrate` (alias: `rig crew`). Use when the current coding agent should initialize a crew vault,
|
|
6
|
+
refresh a human-readable dashboard, inspect pending-questions/status, register project
|
|
7
7
|
owners, or coordinate PRD-driven project work through Vault files.
|
|
8
8
|
For frontend testing, default to PRD-scoped Playwright E2E only: do not add
|
|
9
9
|
or run frontend unit/integration tests unless the user or project explicitly
|
|
@@ -19,46 +19,46 @@ metadata:
|
|
|
19
19
|
|
|
20
20
|
# rig-crew
|
|
21
21
|
|
|
22
|
-
Use this skill when the current coding agent is inside or coordinating an Obsidian Vault that uses `rig crew
|
|
22
|
+
Use this skill when the current coding agent is inside or coordinating an Obsidian Vault that uses `rig orchestrate` (alias: `rig crew`): a file-backed, Orchestrator-first agent workflow using Obsidian Markdown as the source of truth.
|
|
23
23
|
|
|
24
|
-
`rig
|
|
24
|
+
`rig orchestrate` is primarily for coding agents, not a human-operated daily CLI. The human talks to the active Claude/Codex session; that coding agent should use `rig orchestrate` commands and Vault files to communicate with the Orchestrator, coordinate other roles, and stay aware of all agent/todo status.
|
|
25
25
|
|
|
26
26
|
## Agent Quickstart
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
|
-
rig
|
|
30
|
-
rig
|
|
31
|
-
rig
|
|
32
|
-
rig
|
|
33
|
-
rig
|
|
34
|
-
rig
|
|
35
|
-
rig
|
|
29
|
+
rig orchestrate init --vault "/path/to/ObsidianVault" --as personal
|
|
30
|
+
rig orchestrate "推进当前目标"
|
|
31
|
+
rig orchestrate role add security-reviewer --from ./security-reviewer.md --agent security-reviewer --executor codex
|
|
32
|
+
rig orchestrate research "比较 Playwright agents 的最佳实践"
|
|
33
|
+
rig orchestrate pending-questions
|
|
34
|
+
rig orchestrate board
|
|
35
|
+
rig orchestrate status
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
Project Owner management:
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
rig
|
|
42
|
-
rig
|
|
43
|
-
rig
|
|
44
|
-
rig
|
|
45
|
-
rig
|
|
46
|
-
rig
|
|
41
|
+
rig orchestrate project add rig --path /path/to/projects/rig --executor claude --test-command "yarn build"
|
|
42
|
+
rig orchestrate project add dsh-service --path /path/to/projects/dsh-service --executor codex --test-command "yarn test"
|
|
43
|
+
rig orchestrate project add demo-web --path /path/to/ObsidianVault/tmp/demo-web --executor codex
|
|
44
|
+
rig orchestrate project sync
|
|
45
|
+
rig orchestrate project list
|
|
46
|
+
rig orchestrate project status rig
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
Use `rig
|
|
49
|
+
Use `rig orchestrate project sync` after directories are added to or removed from the Vault `projects/` folder. It refreshes the active Project Owner registry and project-scoped agent task folders under `<crew-root>/Projects/`.
|
|
50
50
|
|
|
51
51
|
## State Model
|
|
52
52
|
|
|
53
|
-
`rig
|
|
53
|
+
`rig orchestrate` is file-backed. Do not assume a long-running multi-agent runtime exists.
|
|
54
54
|
|
|
55
|
-
- Default crew root: `rig-
|
|
56
|
-
- Vault source of truth: `rig-
|
|
55
|
+
- Default crew root: `rig-crew/`
|
|
56
|
+
- Vault source of truth: `rig-crew/**` by default, or the configured `crew.root`.
|
|
57
57
|
- Vault-local scratch projects: `tmp/<project>/**`
|
|
58
|
-
- Human dashboard: `<crew-root>/
|
|
59
|
-
- User decisions: `<crew-root>/
|
|
58
|
+
- Human dashboard: `<crew-root>/Dashboard.md`
|
|
59
|
+
- User decisions: `<crew-root>/Pending-Questions.md`
|
|
60
60
|
- Shared context: `<crew-root>/Shared/**`
|
|
61
|
-
- Role registry for
|
|
61
|
+
- Role registry for the Orchestrator: `<crew-root>/Shared/Roles.md`
|
|
62
62
|
- Project owner memory: `<crew-root>/Projects/<project>/**`
|
|
63
63
|
- Project-scoped agent tasks: `<crew-root>/Projects/<project>/Agents/<role>/Tasks.md`
|
|
64
64
|
- Large active task batches: `<crew-root>/Projects/<project>/Tasklists/active/*.md` and `<crew-root>/Projects/<project>/Agents/<role>/Tasklists/active/*.md`
|
|
@@ -71,9 +71,9 @@ Use `rig crew project sync` after directories are added to or removed from the V
|
|
|
71
71
|
|
|
72
72
|
All multi-agent collaboration materials should live inside the Vault. Temporary demo or test projects should be created under `Vault/tmp/<project>` and registered with their own Project Owner.
|
|
73
73
|
|
|
74
|
-
`rig
|
|
74
|
+
`rig orchestrate` coordinates multiple roles on one device through one Vault. Do not assume a separate multi-agent runtime inside each project repository; project directories are execution workspaces, while tasks, reports, inbox, dashboard, and research indexes return to the Vault.
|
|
75
75
|
|
|
76
|
-
`rig
|
|
76
|
+
`rig orchestrate init` is additive and non-destructive. It may create missing folders/files and update managed blocks, but it must not overwrite existing agent work files such as project `Tasks.md`, `Role.md`, `Index.md`, reports, specs, decisions, or user-authored notes.
|
|
77
77
|
|
|
78
78
|
Built-in role directories are reusable role cards, not project task queues. Concrete PM/Coder/Tester/etc work should be assigned under a specific project:
|
|
79
79
|
|
|
@@ -92,16 +92,16 @@ Keep each `Tasks.md` small. Use it as a current queue or index, not an unlimited
|
|
|
92
92
|
|
|
93
93
|
Move completed or stale batches to `Tasklists/archive/YYYY-MM.md`. The active dashboard scans `Tasks.md` and `Tasklists/active/**/*.md`; it does not scan archive files by default.
|
|
94
94
|
|
|
95
|
-
##
|
|
95
|
+
## Orchestrator
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
The Orchestrator is the default orchestration protocol, not a mandatory Claude/Codex subagent.
|
|
98
98
|
|
|
99
|
-
As the coding agent, use `rig
|
|
99
|
+
As the coding agent, use `rig orchestrate "<request>"` when the user asks for planning, multi-agent coordination, PRD, research, testing strategy, owner routing, role routing, reports, or broad project changes. Do not ask the human to run the command when you can run it yourself.
|
|
100
100
|
|
|
101
101
|
After handoff, read:
|
|
102
102
|
|
|
103
|
-
- `<crew-root>/
|
|
104
|
-
- `<crew-root>/
|
|
103
|
+
- `<crew-root>/Dashboard.md`
|
|
104
|
+
- `<crew-root>/Pending-Questions.md`
|
|
105
105
|
- `<crew-root>/Shared/Roles.md`
|
|
106
106
|
- relevant `<crew-root>/Projects/<project>/Tasks.md`
|
|
107
107
|
- relevant `<crew-root>/Projects/<project>/Agents/<role>/Tasks.md`
|
|
@@ -112,15 +112,15 @@ If the CLI is unavailable, use the file protocol:
|
|
|
112
112
|
1. Append the request to `<crew-root>/Current-Goal.md`.
|
|
113
113
|
2. When a project is known, create or update small/current work in `<crew-root>/Projects/<project>/Tasks.md` or `<crew-root>/Projects/<project>/Agents/<role>/Tasks.md`; split larger batches into `Tasklists/active/<feature-or-iteration>.md`.
|
|
114
114
|
3. Route worker tasks with inline fields such as `[role:: tester]`, `[owner:: maintainer:rig]`, `[project:: rig]`, `[executor:: codex]`, `[status:: pending]`.
|
|
115
|
-
4. Put user-facing questions or approvals in `<crew-root>/
|
|
115
|
+
4. Put user-facing questions or approvals in `<crew-root>/Pending-Questions.md`.
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
The Orchestrator communicates with workers through Markdown tasks, delegation packets, and result notes. Do not rely on private subagent chat state as the coordination source of truth. Subagents are optional executors for specific roles when the selected executor supports them; Vault files remain canonical.
|
|
118
118
|
|
|
119
119
|
Maintain status awareness before and after work: scan dashboard, inbox, project owner tasks, project-scoped agent tasks, active tasklists, blockers, and todo status. The coding session should be able to answer what each role/project is doing without asking the human to inspect the Vault manually.
|
|
120
120
|
|
|
121
121
|
## Mixed Executors
|
|
122
122
|
|
|
123
|
-
`rig
|
|
123
|
+
`rig orchestrate` can mix Claude Code, Codex, and future executors because state lives in files, not in one long-running agent process.
|
|
124
124
|
|
|
125
125
|
Executor selection order:
|
|
126
126
|
|
|
@@ -133,11 +133,11 @@ Executor selection order:
|
|
|
133
133
|
Use project-level executors when teams prefer different coding agents per repo:
|
|
134
134
|
|
|
135
135
|
```bash
|
|
136
|
-
rig
|
|
137
|
-
rig
|
|
136
|
+
rig orchestrate project add rig --path /path/to/projects/rig --executor claude
|
|
137
|
+
rig orchestrate project add dsh-service --path /path/to/projects/dsh-service --executor codex
|
|
138
138
|
```
|
|
139
139
|
|
|
140
|
-
The executor only affects code-running / project-local work. Vault Markdown updates should still be written by the `rig
|
|
140
|
+
The executor only affects code-running / project-local work. Vault Markdown updates should still be written by the `rig orchestrate` host so Claude and Codex share the same source of truth.
|
|
141
141
|
|
|
142
142
|
## Custom Roles
|
|
143
143
|
|
|
@@ -158,10 +158,10 @@ Directory layout:
|
|
|
158
158
|
Commands:
|
|
159
159
|
|
|
160
160
|
```bash
|
|
161
|
-
rig
|
|
162
|
-
rig
|
|
163
|
-
rig
|
|
164
|
-
rig
|
|
161
|
+
rig orchestrate role add security-reviewer --from ./security-reviewer.md --agent security-reviewer --executor codex
|
|
162
|
+
rig orchestrate role add security-reviewer --from ./security-reviewer.md --agent security-reviewer --executor codex --crew personal
|
|
163
|
+
rig orchestrate role list
|
|
164
|
+
rig orchestrate role show security-reviewer
|
|
165
165
|
```
|
|
166
166
|
|
|
167
167
|
When a role is materialized in a Vault, use:
|
|
@@ -174,7 +174,7 @@ When a role is materialized in a Vault, use:
|
|
|
174
174
|
|
|
175
175
|
Built-in roles use `<crew-root>/<Role>/Role.md`. These role files are short editable descriptions. Do not use them as normal task queues.
|
|
176
176
|
|
|
177
|
-
`<crew-root>/Shared/Roles.md` is generated so
|
|
177
|
+
`<crew-root>/Shared/Roles.md` is generated so the Orchestrator can load available roles. If the user asks the Orchestrator to use a specific role, match that role by `name` first, then route the task into `<crew-root>/Projects/<project>/Agents/<role>/Tasks.md` with `[role:: <name>]`. If the role defines `agent`, use that agent/subagent for role execution when the executor supports it.
|
|
178
178
|
|
|
179
179
|
## Researcher
|
|
180
180
|
|
|
@@ -201,13 +201,13 @@ Recommended `~/.rig/RIG.md` section:
|
|
|
201
201
|
| project:<name> | <crew-root>/Projects/<name>/Research | Project-specific research notes |
|
|
202
202
|
```
|
|
203
203
|
|
|
204
|
-
If the destination is unclear, create or ask
|
|
204
|
+
If the destination is unclear, create or ask the Orchestrator to create a Pending-Questions entry instead of guessing. When a report is written outside `<crew-root>/Researcher/Reports`, keep an index entry in `<crew-root>/Researcher/Index.md`.
|
|
205
205
|
|
|
206
206
|
## Rules Files
|
|
207
207
|
|
|
208
208
|
Read rules in this order:
|
|
209
209
|
|
|
210
|
-
1. Vault agent rules: `CLAUDE.md` and `AGENTS.md` at the Vault root. `rig
|
|
210
|
+
1. Vault agent rules: `CLAUDE.md` and `AGENTS.md` at the Vault root. `rig orchestrate init` maintains a managed `rig-crew` block in both files.
|
|
211
211
|
2. Project rules: `projects/<project>/RIG.md` (also accept `rig.md` for compatibility).
|
|
212
212
|
3. Project testing guide: `docs/testing.md`, `test/README.md`, or `tests/README.md`.
|
|
213
213
|
4. User rules: `~/.rig/RIG.md`.
|
|
@@ -225,7 +225,7 @@ For frontend/UI behavior:
|
|
|
225
225
|
- Use PRD-scoped Playwright E2E as the default and preferred test type.
|
|
226
226
|
- Do not add frontend unit tests by default.
|
|
227
227
|
- Do not add frontend integration tests by default.
|
|
228
|
-
- Do not run old frontend unit/integration suites as part of normal `rig
|
|
228
|
+
- Do not run old frontend unit/integration suites as part of normal `rig orchestrate` verification.
|
|
229
229
|
- Do not run the full historical E2E suite unless risk requires it.
|
|
230
230
|
|
|
231
231
|
Default frontend verification is:
|
|
@@ -235,7 +235,7 @@ PM PRD / Acceptance Criteria
|
|
|
235
235
|
-> Tester creates current Test Scope
|
|
236
236
|
-> Playwright planner/generator creates or updates focused E2E
|
|
237
237
|
-> Tester runs only current PRD E2E + minimal smoke
|
|
238
|
-
->
|
|
238
|
+
-> The Orchestrator reports what was run and what was intentionally skipped
|
|
239
239
|
```
|
|
240
240
|
|
|
241
241
|
Run full regression only when:
|
|
@@ -243,7 +243,7 @@ Run full regression only when:
|
|
|
243
243
|
- Project Owner asks for it.
|
|
244
244
|
- The change touches auth, routing, shared layout, build config, data migration, checkout/payment, or release flow.
|
|
245
245
|
- Focused PRD E2E cannot cover the risk.
|
|
246
|
-
-
|
|
246
|
+
- The Orchestrator marks the task `risk: high`.
|
|
247
247
|
|
|
248
248
|
Tester reports must include:
|
|
249
249
|
|
|
@@ -291,7 +291,7 @@ yarn playwright test --project=chromium-production --grep @prod-readonly --trace
|
|
|
291
291
|
- Do not run a separate multi-agent state machine inside a project repo; coordinate through one local Vault.
|
|
292
292
|
- Do not store custom role prompts in project repos; use `~/.rig/crew/roles/<role>/`.
|
|
293
293
|
- Do not overwrite unrelated Vault `CLAUDE.md` / `AGENTS.md` content; update only the managed `rig-crew` block.
|
|
294
|
-
- Do not overwrite existing agent work files on repeated `rig
|
|
294
|
+
- Do not overwrite existing agent work files on repeated `rig orchestrate init`; only create missing files or update explicit managed blocks.
|
|
295
295
|
- Researcher reports default to Vault paths configured in `~/.rig/RIG.md`.
|
|
296
296
|
- For frontend testing, prefer one high-value PRD E2E over many low-signal unit/integration tests.
|
|
297
|
-
- If a required account alias is missing, run or recommend `rig
|
|
297
|
+
- If a required account alias is missing, run or recommend `rig orchestrate doctor`; do not guess credentials.
|