rigjs 4.0.10 → 4.0.12

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.
@@ -30,15 +30,24 @@ function findRigRoot(): string | undefined {
30
30
  interface InstallOpts { force?: boolean; project?: boolean; }
31
31
 
32
32
  /**
33
- * Install bundled skills (rig-wiki, rig-crew) as symlinks.
33
+ * Install bundled skills (rig-wiki, rig-crew).
34
34
  *
35
- * Default (global): link into `~/.claude/skills/<name>/SKILL.md`. Affects
36
- * every project that uses Claude Code on this machine.
35
+ * Default (global): symlink into `~/.claude/skills/<name>/SKILL.md`. Affects
36
+ * every project that uses Claude Code on this machine. Symlink because
37
+ * `~/.claude/skills/` is not committed; the link should auto-track
38
+ * whichever rigjs version is installed.
37
39
  *
38
- * `--project` (project-level override for overmind-style monorepos):
39
- * link into BOTH `<cwd>/.claude/skills/<name>/SKILL.md` (Claude Code) AND
40
- * `<cwd>/.agents/skills/<name>/SKILL.md` (Codex). When the user is inside
41
- * the project, the project-local skill files override the global ones.
40
+ * `--project`: **copy actual file contents** into BOTH
41
+ * `<cwd>/.claude/skills/<name>/SKILL.md` (Claude Code) AND
42
+ * `<cwd>/.agents/skills/<name>/SKILL.md` (Codex). Copy because:
43
+ * 1. these paths get committed to the project's repo and need to work
44
+ * after a fresh clone on any machine, regardless of where rigjs lives
45
+ * on that machine's disk;
46
+ * 2. a symlink targeting `/usr/local/lib/node_modules/rigjs/...` would
47
+ * be machine-specific and meaningless on CI / colleague's laptop /
48
+ * a different install prefix.
49
+ * To refresh project-local copies after a rigjs upgrade, re-run
50
+ * `rig wiki install-skill --project --force`.
42
51
  */
43
52
  export default function wikiInstallSkill(opts: InstallOpts): void {
44
53
  const root = findRigRoot();
@@ -102,22 +111,50 @@ function linkSkill(name: string, src: string, parentDir: string, opts: InstallOp
102
111
  const target = path.join(targetDir, 'SKILL.md');
103
112
  fs.mkdirSync(targetDir, { recursive: true });
104
113
 
114
+ const useCopy = !!opts.project;
115
+
105
116
  if (fs.existsSync(target) || isBrokenSymlink(target)) {
106
- const existing = safeReadlink(target);
107
- if (existing === src) {
108
- print.info(`already linked: ${shortPath(target)}`);
109
- return;
110
- }
111
- if (!opts.force) {
112
- const what = existing ? `symlink -> ${existing}` : 'a regular file';
113
- print.error(`${shortPath(target)} exists as ${what}. Pass --force to replace.`);
114
- process.exit(1);
117
+ const existingLink = safeReadlink(target);
118
+
119
+ if (useCopy) {
120
+ // Copy mode: same-content existing copy is a no-op; otherwise overwrite
121
+ // when --force, error when not.
122
+ if (!existingLink) {
123
+ try {
124
+ if (fs.readFileSync(target, 'utf8') === fs.readFileSync(src, 'utf8')) {
125
+ print.info(`already up to date: ${shortPath(target)}`);
126
+ return;
127
+ }
128
+ } catch { /* fall through to the force-check below */ }
129
+ }
130
+ if (!opts.force) {
131
+ const what = existingLink ? `symlink -> ${existingLink}` : 'a different file';
132
+ print.error(`${shortPath(target)} exists as ${what}. Pass --force to replace.`);
133
+ process.exit(1);
134
+ }
135
+ fs.rmSync(target, { force: true });
136
+ } else {
137
+ // Symlink mode (global): same-target existing symlink is a no-op.
138
+ if (existingLink === src) {
139
+ print.info(`already linked: ${shortPath(target)}`);
140
+ return;
141
+ }
142
+ if (!opts.force) {
143
+ const what = existingLink ? `symlink -> ${existingLink}` : 'a regular file';
144
+ print.error(`${shortPath(target)} exists as ${what}. Pass --force to replace.`);
145
+ process.exit(1);
146
+ }
147
+ fs.rmSync(target, { force: true });
115
148
  }
116
- fs.rmSync(target, { force: true });
117
149
  }
118
150
 
119
- fs.symlinkSync(src, target);
120
- print.succeed(`linked ${shortPath(target)} -> ${shortPath(src)}`);
151
+ if (useCopy) {
152
+ fs.copyFileSync(src, target);
153
+ print.succeed(`wrote ${shortPath(target)}`);
154
+ } else {
155
+ fs.symlinkSync(src, target);
156
+ print.succeed(`linked ${shortPath(target)} -> ${shortPath(src)}`);
157
+ }
121
158
  }
122
159
 
123
160
  function safeReadlink(p: string): string | null {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rigjs",
3
- "version": "4.0.10",
4
- "versionCode": 26052415,
3
+ "version": "4.0.12",
4
+ "versionCode": 26052418,
5
5
  "description": "A multi-repos dev tool based on yarn and git.Rigjs is intended to be the simplest way to develop,share and deliver codes between different developers or different projects.",
6
6
  "keywords": [
7
7
  "modular",
package/skills.md CHANGED
@@ -1,81 +1,105 @@
1
1
  # rig Skills
2
2
 
3
- This page is the skill index for the `rigjs` package.
4
-
5
- Keep the root `README.md` short: it should link here and to the canonical skill files, while this page explains how the bundled skills relate to the CLI.
3
+ This page is the skill index for the `rigjs` package. The root `README.md` keeps a one-line pointer here; everything skill-related — what ships, how to install, how to maintain — lives in this file.
6
4
 
7
5
  ## Bundled Skills
8
6
 
9
7
  | Skill | Canonical file | Plugin copy | CLI area | Purpose |
10
8
  |---|---|---|---|---|
11
- | `rig-wiki` | [`RIG_WIKI_SKILL.md`](./RIG_WIKI_SKILL.md) | [`.claude/skills/rig-wiki/SKILL.md`](./.claude/skills/rig-wiki/SKILL.md) | `rig wiki *` | Karpathy-style LLM wiki operations: scan, fetch, ingest, query, lint, and rebuild. |
12
- | `rig-crew` | [`RIG_CREW_SKILL.md`](./RIG_CREW_SKILL.md) | None; use the Vault/overmind skill copy | `rig crew *` | File-backed, Leader-first multi-agent coordination over an Obsidian vault. |
9
+ | `rig-wiki` | [`RIG_WIKI_SKILL.md`](./RIG_WIKI_SKILL.md) | [`.claude/skills/rig-wiki/SKILL.md`](./.claude/skills/rig-wiki/SKILL.md) | `rig wiki *` | Karpathy-style LLM wiki operations: scan, fetch, ingest, query, lint, rebuild. |
10
+ | `rig-crew` | [`RIG_CREW_SKILL.md`](./RIG_CREW_SKILL.md) | (none vault-level guidance) | `rig crew *` | File-backed, Leader-first multi-agent coordination over an Obsidian vault. |
13
11
 
14
- `rig-crew` is intentionally not copied into `projects/rig/.claude/skills/`. In the overmind workflow, `rig` is just one project inside the Vault. The active crew instructions come from the Vault root `CLAUDE.md` / `AGENTS.md` managed block plus the overmind/user-level skill installation, so a project-local Claude skill copy would be misleading.
12
+ `rig-crew` is intentionally not copied into the rigjs package's own `.claude/skills/`. Its instructions belong at the Vault level (the project that uses crew), not at the tool level (rigjs itself).
15
13
 
16
14
  ## Install
17
15
 
18
- ### Global install (default affects every project on the machine)
16
+ ### Global install — default (per-machine, auto-updates with rigjs)
19
17
 
20
18
  ```bash
21
19
  yarn global add rigjs
22
20
  ```
23
21
 
24
- The `postinstall` script links bundled skills into `~/.claude/skills/` (Claude Code's user-level skill directory). If you prefer to skip the postinstall:
22
+ The `postinstall` hook **symlinks** the bundled skills into Claude Code's user-level skill directory:
23
+
24
+ - `~/.claude/skills/rig-wiki/SKILL.md` → `<rigjs-install>/RIG_WIKI_SKILL.md`
25
+ - `~/.claude/skills/rig-crew/SKILL.md` → `<rigjs-install>/RIG_CREW_SKILL.md`
26
+
27
+ Symlink is the right call here because `~/.claude/skills/` is not committed to any repo — the link merely follows whichever rigjs version you have installed locally. `yarn global add rigjs` next month and the skill description updates the next Claude Code restart.
28
+
29
+ If `--ignore-scripts` was used, do it manually:
25
30
 
26
31
  ```bash
27
- yarn global add rigjs --ignore-scripts
28
- rig wiki install-skill
32
+ rig wiki install-skill # idempotent; safe to re-run
33
+ rig wiki install-skill --force # overwrite an existing entry pointing elsewhere
29
34
  ```
30
35
 
31
- ### Project-level install (per-project override, Claude Code + Codex)
36
+ ### Project-level install for committed, reproducible setups
32
37
 
33
- For "monorepo of work projects" setupse.g. overmind you can install the skills **into the project itself** so they live alongside the code and override the global ones whenever the user is inside that project:
38
+ For a project (any rigjs consumeryour repo doesn't need to live inside `rig` or be a monorepo) that wants its own pinned skill files committed to git so any clone of the project gets the same agent behaviour:
34
39
 
35
40
  ```bash
36
41
  cd <project>
37
42
  rig wiki install-skill --project
38
43
  ```
39
44
 
40
- This creates symlinks at:
45
+ This **writes real file copies** at:
41
46
 
42
- - `<project>/.claude/skills/rig-wiki/SKILL.md` → `<rigjs-install>/RIG_WIKI_SKILL.md`
43
- - `<project>/.claude/skills/rig-crew/SKILL.md` → `<rigjs-install>/RIG_CREW_SKILL.md`
44
- - `<project>/.agents/skills/rig-wiki/SKILL.md`(same target, for Codex)
45
- - `<project>/.agents/skills/rig-crew/SKILL.md` → (same target, for Codex)
47
+ - `<project>/.claude/skills/rig-wiki/SKILL.md` (Claude Code)
48
+ - `<project>/.claude/skills/rig-crew/SKILL.md`
49
+ - `<project>/.agents/skills/rig-wiki/SKILL.md` (Codex)
50
+ - `<project>/.agents/skills/rig-crew/SKILL.md`
46
51
 
47
- Both Claude Code (`.claude/skills/`) and Codex (`.agents/skills/`) read from project-local skill dirs when invoked inside the project, so a single `--project` install covers both agents.
52
+ Both Claude Code (`.claude/skills/`) and Codex (`.agents/skills/`) read from these project-local dirs when invoked inside the project, and **project-local skills override the global ones**. A single `--project` install covers both agents.
48
53
 
49
- Project-local skills take precedence over `~/.claude/skills/` while the user is in that project. To remove:
54
+ **Files, not symlinks.** A symlink pointing at `<rigjs-install>/RIG_WIKI_SKILL.md` would be machine-specific — it might be `/usr/local/lib/node_modules/rigjs/...` on macOS, `/opt/homebrew/lib/node_modules/rigjs/...` on Apple Silicon, somewhere under `~/.yarn/...` on a yarn-prefix setup, or simply missing on CI. Committing such a symlink to git would break the repo for anyone else. Real-file copies remove that variable: the skill the agent sees comes from the repo, not from a system path.
55
+
56
+ To refresh project-local copies after a rigjs upgrade:
57
+
58
+ ```bash
59
+ rig wiki install-skill --project --force
60
+ ```
61
+
62
+ To remove:
50
63
 
51
64
  ```bash
52
- cd <project>
53
65
  rig wiki uninstall-skill --project
54
66
  ```
55
67
 
56
68
  ### Why project-level over global
57
69
 
58
- - Pins the skill version to the rigjs install in `node_modules` (or wherever the global rig lives), so the skill the agent sees matches the CLI it's about to call.
59
- - Lets the project decide which agent gets which skill committing `.claude/skills/rig-wiki/` to the repo makes the agent behaviour reproducible across machines.
60
- - Works in CI / sandboxes where there's no home-dir `~/.claude/skills/` to install into.
70
+ - Pins the skill description to the rigjs version that exists at install time. The agent reads from your repo, not from whatever rigjs is current.
71
+ - Survives across machines, CI, and collaborator laptops — the skill is committed, not synthesized.
72
+ - Lets a single repo override the user-global skill for that project (useful when one repo's `rig wiki` workflow differs from the user's default).
73
+
74
+ ### Special case — rig in a sibling submodule
75
+
76
+ If your project hosts rigjs as a git submodule (rig's own development workflow with the `overmind` vault is the canonical example), you can choose to **symlink** the project skill files at the dev source instead of copying. This is a deliberate opt-out, not the default:
77
+
78
+ ```bash
79
+ # from <project>/, with rigjs cloned as a submodule under projects/rig
80
+ ln -sf ../../../projects/rig/RIG_WIKI_SKILL.md .claude/skills/rig-wiki/SKILL.md
81
+ ln -sf ../../../projects/rig/RIG_CREW_SKILL.md .claude/skills/rig-crew/SKILL.md
82
+ ```
83
+
84
+ This makes edits in the submodule's `RIG_*_SKILL.md` immediately visible to the agent without a publish-and-reinstall cycle. **Don't use this pattern in projects where rigjs is not in-tree** — the symlink target won't exist and the skill won't load.
61
85
 
62
- ## Maintenance
86
+ ## Maintenance (rig contributors)
63
87
 
64
- Canonical files live at the package root:
88
+ Canonical skill files live at the package root:
65
89
 
66
90
  - [`RIG_WIKI_SKILL.md`](./RIG_WIKI_SKILL.md)
67
91
  - [`RIG_CREW_SKILL.md`](./RIG_CREW_SKILL.md)
68
92
 
69
- Plugin copies that belong to the `rig` package live under `.claude/skills/` and are synchronized by:
93
+ A package-internal mirror lives under `.claude/skills/` so the rig package itself (when checked out by another agent) can read its own skills:
70
94
 
71
95
  ```bash
72
96
  node scripts/sync-skill.mjs
73
97
  ```
74
98
 
75
- `prepublishOnly` runs the sync script before packaging. Today this plugin-copy set only includes `rig-wiki`; `rig-crew` remains Vault-level guidance.
99
+ `prepublishOnly` runs the sync script before packaging. Today this plugin-copy set only includes `rig-wiki`; `rig-crew` remains Vault-level guidance and has no in-package `.claude/skills/` copy.
76
100
 
77
101
  ## Documentation Policy
78
102
 
79
- - Put one-line skill visibility and high-level links in `README.md`.
80
- - Put all skill references, maintenance notes, and plugin-copy details in this file.
81
- - Keep each canonical `RIG_*_SKILL.md` self-contained so users can read exactly what they are enabling.
103
+ - One-line skill visibility + high-level links in `README.md`.
104
+ - All skill references, install variants, and maintenance notes in this file.
105
+ - Each canonical `RIG_*_SKILL.md` stays self-contained a user opening it should be able to read exactly what they're enabling, without needing this index.