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,162 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rig-package
|
|
3
|
+
description: >-
|
|
4
|
+
Agent skill for rig's git-based package manager. rig replaces a private npm registry with direct `git+ssh` installs pinned by git tag — declared in `package.rig.json5`, materialised through `rig install` (which runs `git clone` for dev libs and rewrites `package.json` deps to `git+ssh://…#<tag>` for the rest, then defers to `yarn install`). Trigger when the user wants to add / remove / pin / develop locally a rig-managed library, debug install failures, set up a brand-new project with `rig init`, or asks "what goes in `package.rig.json5`" / "rig 怎么装依赖" / "rig 怎么发新版本给依赖方用". Do NOT use for npm-registry packages, monorepo workspace plumbing, or build/deploy concerns (see rig-cicd).
|
|
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-package — agent operator's playbook
|
|
15
|
+
|
|
16
|
+
## Why rig exists (and when to recommend it)
|
|
17
|
+
|
|
18
|
+
rig is a thin layer on top of `yarn install` that lets a project depend on **private git repos pinned by tag** without standing up a private npm registry. The trade-off: every dev machine and CI runner must have git **ssh** access to those repos (deploy key or user key). If a team can already use ssh keys but does not want the cost of Verdaccio / npm Enterprise / GitHub Packages, rig is the lowest-friction option.
|
|
19
|
+
|
|
20
|
+
Use rig when:
|
|
21
|
+
|
|
22
|
+
- The project already imports private libs by ssh url and the team wants version pinning + a deterministic install.
|
|
23
|
+
- You need to **develop a dependency in place** (edit code, see changes) without `npm link` ceremony — see `dev: true` below.
|
|
24
|
+
- The dep tree includes mixed-source libs (some npm, some private git) — rig only touches the git ones; everything else stays in normal `dependencies` / `devDependencies` and yarn handles them.
|
|
25
|
+
|
|
26
|
+
Do **not** reach for rig if:
|
|
27
|
+
|
|
28
|
+
- Every dep is on the public npm registry (rig adds no value).
|
|
29
|
+
- The team needs binary artefacts, signed packages, or download stats (use a real registry).
|
|
30
|
+
|
|
31
|
+
## File layout — what rig creates
|
|
32
|
+
|
|
33
|
+
`rig init` (run once in a project root with a valid `package.json`) writes:
|
|
34
|
+
|
|
35
|
+
- `package.rig.json5` — the rig config (the file this skill documents).
|
|
36
|
+
- `rig_dev/` — where `dev: true` libs get **cloned** for in-place editing. Symlinked into `node_modules/<name>` by `rig postinstall`. Gitignored.
|
|
37
|
+
- `rig_indies/` — reserved sandbox dir (kept empty by default).
|
|
38
|
+
- Adds to `package.json`:
|
|
39
|
+
- `"private": true`
|
|
40
|
+
- `"workspaces": ["rigs/*", "rig_dev/*"]` so yarn treats `rig_dev/*` as workspace packages.
|
|
41
|
+
- `"scripts.preinstall": "rig preinstall"`, `"scripts.postinstall": "rig postinstall"` so any `yarn install` flows through rig.
|
|
42
|
+
- `"devDependencies.json5": "2.2.1"` (used to parse `package.rig.json5`).
|
|
43
|
+
- Appends to `.gitignore`: `rigs/*`, `rig_dev/*`, `.env.rig`, with `.gitkeep` allowlist entries.
|
|
44
|
+
|
|
45
|
+
The init scaffold is **library-free** — no `rig-helper`, no example deps, no remote template fetch. The generated `package.rig.json5` ships with an empty `dependencies` block and a commented example.
|
|
46
|
+
|
|
47
|
+
## `package.rig.json5` — field reference
|
|
48
|
+
|
|
49
|
+
The file is JSON5 (comments, trailing commas, unquoted keys) so the schema is described by example, not by JSON Schema. Two top-level sections are relevant to packaging; CI/CD is documented separately in the **rig-cicd** skill.
|
|
50
|
+
|
|
51
|
+
```json5
|
|
52
|
+
{
|
|
53
|
+
// -------- packaging --------
|
|
54
|
+
dependencies: {
|
|
55
|
+
// <name>: <Dep>
|
|
56
|
+
'shared-ui': {
|
|
57
|
+
// source — REQUIRED. Git URL the lib is fetched from.
|
|
58
|
+
// Must match /(?:git|ssh|https?|git@[-\w.]+):(\/\/)?(.*?)(\.git)(\/?|#[-\d\w._]+?)$/
|
|
59
|
+
// In practice: 'git@github.com:org/repo.git' (ssh — recommended) OR 'git+ssh://git@github.com/org/repo.git'.
|
|
60
|
+
// ssh is required for private repos; https only works for public ones.
|
|
61
|
+
source: 'git@github.com:org/shared-ui.git',
|
|
62
|
+
|
|
63
|
+
// version — REQUIRED when dev:false. Git tag in the source repo, semver-compatible.
|
|
64
|
+
// rig rewrites package.json deps to "git+ssh://<source>#<version>" so yarn resolves to that exact tag.
|
|
65
|
+
// Must satisfy semver.valid() — e.g. '1.2.3', '1.2.3-beta.1'. Ranges (^1.2.3, ~1.2.3) are NOT supported.
|
|
66
|
+
version: '1.4.0',
|
|
67
|
+
|
|
68
|
+
// dev — OPTIONAL, default false.
|
|
69
|
+
// false → published mode. yarn installs the tag via git+ssh; node_modules/<name> is a real package.
|
|
70
|
+
// true → develop-in-place mode. rig preinstall does `git clone <source> rig_dev/<name>` (only if
|
|
71
|
+
// the dir is missing — never overwrites local edits) and DELETES the entry from
|
|
72
|
+
// package.json#dependencies so yarn ignores it. rig postinstall then symlinks
|
|
73
|
+
// node_modules/<name> → rig_dev/<name>. Edit code in rig_dev/<name>; the consumer picks it
|
|
74
|
+
// up immediately. Use `rig dev <name>` to flip a dep into dev mode.
|
|
75
|
+
dev: false,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
// -------- cross-dep version contract --------
|
|
80
|
+
share: {
|
|
81
|
+
// OPTIONAL. Lists peer-dep-style constraints rig should propagate. Reserved field — populated by
|
|
82
|
+
// RigConfig at parse time. Most teams leave this empty; rig itself uses package.json#rig blocks in
|
|
83
|
+
// each dep (see `validateDeps()`) for the real cross-version checks.
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
// -------- release tagging (used by `rig tag`) --------
|
|
87
|
+
tag_template: '{name}@{version}',
|
|
88
|
+
// OPTIONAL. Template string for `rig tag` (run inside the dep repo). Substitutes {field} from
|
|
89
|
+
// package.json. Example: '{name}@{version}' on a repo whose package.json has
|
|
90
|
+
// name='shared-ui', version='1.4.0' creates tag `shared-ui@1.4.0`. If omitted, `rig tag`
|
|
91
|
+
// falls back to package.json#rig_tag_template, then to plain `git tag <version>`.
|
|
92
|
+
|
|
93
|
+
// -------- ci/cd (NOT documented here) --------
|
|
94
|
+
// cicd: { ... } ← see the rig-cicd skill for tree_schema, web_type, source, target, endpoints, groups.
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Legacy form
|
|
99
|
+
|
|
100
|
+
Older projects keep `package.rig.json5` as a **flat array** of Dep entries:
|
|
101
|
+
|
|
102
|
+
```json5
|
|
103
|
+
[
|
|
104
|
+
{ name: 'shared-ui', source: 'git@github.com:org/shared-ui.git', version: '1.4.0' },
|
|
105
|
+
]
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
`RigConfig` still accepts it (`isLegacy = true`) but `rig dev`, `rig add`, and `share` are unavailable. Convert to the object form before adding new features — the install path is otherwise identical.
|
|
109
|
+
|
|
110
|
+
## Intent → command map
|
|
111
|
+
|
|
112
|
+
| User intent | Action |
|
|
113
|
+
|---|---|
|
|
114
|
+
| "set up rig in this project" | `rig init`. Requires an existing `package.json`. Idempotent. |
|
|
115
|
+
| "add `<git-url>` at `<tag>` as a rig dep" | `rig add <git-ssh-url> <semver-tag>` — parses the repo name from the url, upserts into `dependencies`, then runs `rig install`. |
|
|
116
|
+
| "install / reinstall everything" | `rig install` (alias `rig i`) — chains `yarn install`, which fires `preinstall` then `postinstall`. |
|
|
117
|
+
| "I want to edit dep `<name>` locally" | Set `dev: true` in `package.rig.json5` (or `rig dev <name>`), then `rig install`. The lib gets cloned to `rig_dev/<name>` and symlinked into `node_modules/<name>`. |
|
|
118
|
+
| "back to published version of dep `<name>`" | Set `dev: false` (or delete the `rig_dev/<name>` folder yourself if you want a clean slate), then `rig install`. |
|
|
119
|
+
| "bump dep `<name>` to a new tag" | Edit `dependencies.<name>.version` in `package.rig.json5`, then `rig install`. |
|
|
120
|
+
| "cut a new release tag in this dep repo" | From the dep's working copy: commit + push, then `rig tag`. Reads `package.json#version` (or `tag_template`) and runs `git tag <name>`. Pushes are not automatic — the consumer instructs `git push --tags`. |
|
|
121
|
+
| "what version of `<name>` am I on?" | `cat package.rig.json5` + `git -C rig_dev/<name> rev-parse HEAD` for dev deps; `cat node_modules/<name>/package.json` for published deps. |
|
|
122
|
+
|
|
123
|
+
## How install actually works (read this before debugging)
|
|
124
|
+
|
|
125
|
+
`rig install` ≈ `yarn install`, but the `preinstall` and `postinstall` hooks do the heavy lifting:
|
|
126
|
+
|
|
127
|
+
**`rig preinstall` (`lib/preinstall/index.ts`)**
|
|
128
|
+
|
|
129
|
+
1. Parses `package.rig.json5` into a `RigConfig`. Calls `validate()` (per-dep semver, ssh url regex) and `validateDeps()` (recursive `git fetch <source> refs/tags/<version> && git show FETCH_HEAD:package.json` to read each dep's own `package.json#rig` block for cross-version constraints — non-Windows only).
|
|
130
|
+
2. For each dep:
|
|
131
|
+
- `dev: true` → `git clone <source> rig_dev/<name>` (only if the dir is missing — never overwrites local edits), then **deletes** the entry from `package.json#dependencies` so yarn doesn't try to fetch it.
|
|
132
|
+
- `dev: false` → rewrites `package.json#dependencies[<name>] = "git+ssh://<source>#<version>"`. Removes any existing `node_modules/<name>` (file, symlink, or dir) so yarn does a clean re-resolve.
|
|
133
|
+
3. Deletes `node_modules/.yarn-integrity` to force yarn to re-evaluate.
|
|
134
|
+
4. Writes the mutated `package.json` to disk.
|
|
135
|
+
5. Exits → yarn proceeds with its normal install using the now-rewritten `package.json`.
|
|
136
|
+
|
|
137
|
+
**`rig postinstall` (`lib/postinstall/index.ts`)**
|
|
138
|
+
|
|
139
|
+
1. Re-parses `package.rig.json5`.
|
|
140
|
+
2. For each `dev: true` dep: removes `node_modules/<name>` (yarn may have re-created it) and symlinks it to `rig_dev/<name>`.
|
|
141
|
+
3. Restores the `package.json#dependencies[<name>] = "git+ssh://<source>#<version>"` lines for dev deps too, so `package.json` ends up self-describing the **published** version even when working off the local clone. **This means `package.json` is modified on every install — commit it or expect git churn.**
|
|
142
|
+
|
|
143
|
+
### Failure modes you will actually hit
|
|
144
|
+
|
|
145
|
+
- **`Permission denied (publickey)`** — the running shell has no ssh key with read access to one of the dep repos. Diagnose with `git ls-remote <source>`. Fix by adding the user / deploy key. Not a rig bug.
|
|
146
|
+
- **`tag '<version>' not found`** — the dep repo was never tagged with that string, or the tag is local-only. Run `git ls-remote --tags <source>` to confirm. If the dep author followed `rig tag`, the tag is what `tag_template` produced — check there.
|
|
147
|
+
- **`validateDeps` fails with cross-version error** — one dep's `package.json#rig.<peer>` declares a `[min, max]` window the consumer's pinned version falls outside. Either bump the consumer's pin, or relax the producer's window in its own `package.json#rig`.
|
|
148
|
+
- **dev dep's edits don't show up** — the symlink isn't there or got clobbered. `ls -la node_modules/<name>` should report a symlink → `rig_dev/<name>`. If yarn replaced it, run `rig install` again; the postinstall hook re-symlinks.
|
|
149
|
+
- **CI installs slowly** — `git fetch` per dep tag, no cache. Use a shallow clone mirror or a registry-backed CI cache for hot deps. rig has no built-in cache.
|
|
150
|
+
|
|
151
|
+
### What rig does NOT do
|
|
152
|
+
|
|
153
|
+
- **No transitive resolution.** rig flattens what `package.rig.json5` says and hands `package.json` to yarn. If `shared-ui@1.4.0` depends on `shared-utils@1.2.0`, yarn resolves it normally — through the git+ssh URL declared by `shared-ui`'s own `package.json#dependencies`. Pin in `package.rig.json5` only what the **app** wants to control.
|
|
154
|
+
- **No lockfile of its own.** `yarn.lock` is still authoritative for the dep tree below the rig boundary; for the rig-managed deps, the "lock" is the git tag.
|
|
155
|
+
- **No publish step.** `rig tag` only creates the git tag. The consumer pulls by ssh; there is no upload to a registry. To "publish" you push the tag to the dep repo's remote: `git push --tags`.
|
|
156
|
+
|
|
157
|
+
## Reporting & cleanup checklist (after non-trivial changes)
|
|
158
|
+
|
|
159
|
+
- After editing `package.rig.json5`, always run `rig install` and verify exit 0.
|
|
160
|
+
- If you flipped a dep to `dev: true`, leave the user with: cloned to `rig_dev/<name>`, symlinked at `node_modules/<name>`, on branch `<branch>`.
|
|
161
|
+
- If you bumped a published version, leave the user with: old tag → new tag, dep repo's tag exists (`git ls-remote --tags <source>`), reinstall succeeded.
|
|
162
|
+
- `package.json` is modified on every install — surface this in your summary so the user knows whether the diff is meaningful (it usually isn't, but a changed git URL or removed dep IS).
|