@invariant.guru/cli 0.5.5 → 0.5.6
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/README.md +71 -8
- package/dist/main.js +533 -527
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Invariant CLI
|
|
2
2
|
|
|
3
|
-
A package manager for AI coding-agent context. Install, compose, and sync reusable agents, skills, commands, rules, contexts, and instructions
|
|
3
|
+
A package manager for AI coding-agent context. Install, compose, and sync reusable agents, skills, commands, rules, contexts, and instructions. Every item is stored **once** in `.agents/` — the [Agent Skills](https://agentskills.io) standard most harnesses read natively — and each CLI target gets a view of it rather than its own copy.
|
|
4
4
|
|
|
5
5
|
## Requirements
|
|
6
6
|
|
|
@@ -42,7 +42,7 @@ invariant init claude cursor # multiple targets
|
|
|
42
42
|
invariant init --name my-project
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
Supported targets: `claude`, `codex`, `cursor`, `
|
|
45
|
+
Supported targets: `claude`, `codex`, `cursor`, `aider`, `copilot`.
|
|
46
46
|
|
|
47
47
|
### 2. `invariant install` — pull a package
|
|
48
48
|
|
|
@@ -119,13 +119,20 @@ invariant add skill:nest-clean-architecture/implement-command \
|
|
|
119
119
|
|
|
120
120
|
Check what landed with `invariant inspect nest-clean-architecture`, or use `invariant add-interactive` for a checkbox tree of every installed item.
|
|
121
121
|
|
|
122
|
-
### 4. `invariant sync` — write the files
|
|
122
|
+
### 4. `invariant sync` — reconcile and write the files
|
|
123
123
|
|
|
124
|
-
`sync`
|
|
124
|
+
`sync` brings the whole tree back in line with `invariant.json`: it rebuilds
|
|
125
|
+
canonical items that went missing, materializes every active item for every
|
|
126
|
+
configured target, prunes what is no longer active, and regenerates the context
|
|
127
|
+
files (`CLAUDE.md`, `AGENTS.md`, …).
|
|
128
|
+
|
|
129
|
+
Add a target to `invariant.json`, run `sync`, and that target is set up — no need
|
|
130
|
+
to re-run `add`.
|
|
125
131
|
|
|
126
132
|
```bash
|
|
127
133
|
invariant sync
|
|
128
134
|
invariant sync --target claude
|
|
135
|
+
invariant sync --check # CI gate: exits 1 when the tree is stale
|
|
129
136
|
```
|
|
130
137
|
|
|
131
138
|
`add`, `install`, and `add-interactive` all accept `-s, --sync` to do this in one shot:
|
|
@@ -179,6 +186,8 @@ invariant init --hybrid
|
|
|
179
186
|
|--------|-------------|
|
|
180
187
|
| `-n, --name <name>` | Project name (defaults to directory name) |
|
|
181
188
|
| `--hybrid` | Initialize as hybrid mode — project *and* package in one directory |
|
|
189
|
+
| `--copy` | Copy items into each target folder instead of linking them to `.agents/` |
|
|
190
|
+
| `--canonical-dir <dir>` | Canonical store location (default `.agents`) |
|
|
182
191
|
|
|
183
192
|
### `invariant install [packages...]`
|
|
184
193
|
|
|
@@ -306,7 +315,9 @@ invariant sync --target cursor
|
|
|
306
315
|
|
|
307
316
|
| Option | Description |
|
|
308
317
|
|--------|-------------|
|
|
309
|
-
| `-t, --target <target>` | Sync only to a specific target (`claude`, `codex`, `cursor`, `
|
|
318
|
+
| `-t, --target <target>` | Sync only to a specific target (`claude`, `codex`, `cursor`, `aider`, `copilot`). Skips pruning — the other targets are out of scope |
|
|
319
|
+
| `--check` | Report drift without writing anything; exits `1` when out of sync |
|
|
320
|
+
| `--force` | Replace target files that were hand-edited away from the canonical item |
|
|
310
321
|
|
|
311
322
|
### `invariant inspect [package]`
|
|
312
323
|
|
|
@@ -523,10 +534,62 @@ After `init` + `install` + `sync`:
|
|
|
523
534
|
│ ├── instructions/ # rendered instructions
|
|
524
535
|
│ ├── sessions/ # `invariant plan` output
|
|
525
536
|
│ └── codegraph/ # `invariant scan` output
|
|
537
|
+
├── .agents/ # canonical store — the only physical copy
|
|
538
|
+
│ ├── skills/<name>/SKILL.md
|
|
539
|
+
│ ├── agents/<name>.md
|
|
540
|
+
│ ├── commands/<name>.md
|
|
541
|
+
│ └── rules/<name>.md
|
|
526
542
|
├── CLAUDE.md # generated by `invariant sync`
|
|
527
|
-
└── .claude/
|
|
528
|
-
├── agents/<name>.md
|
|
529
|
-
├── skills/<name
|
|
543
|
+
└── .claude/ # symlinks into .agents/
|
|
544
|
+
├── agents/<name>.md -> ../../.agents/agents/<name>.md
|
|
545
|
+
├── skills/<name> -> ../../.agents/skills/<name>
|
|
530
546
|
├── commands/<name>.md
|
|
531
547
|
└── rules/<name>.md
|
|
532
548
|
```
|
|
549
|
+
|
|
550
|
+
### One copy, many views
|
|
551
|
+
|
|
552
|
+
`.agents/` holds the single physical copy of every activated item. What each
|
|
553
|
+
target gets depends on how it reads skills:
|
|
554
|
+
|
|
555
|
+
| Target | Skills | Agents / commands / rules |
|
|
556
|
+
|---|---|---|
|
|
557
|
+
| `claude` | symlink into `.agents/` | symlink into `.agents/` |
|
|
558
|
+
| `codex` | reads `.agents/skills/` — nothing written | embedded in `AGENTS.md` |
|
|
559
|
+
| `cursor` | reads `.agents/skills/` — nothing written | `.cursor/rules/<name>.mdc` |
|
|
560
|
+
| `copilot` | reads `.agents/skills/` — nothing written | `.github/instructions/<name>.instructions.md` |
|
|
561
|
+
| `aider` | embedded in `CONVENTIONS.md` | embedded in `CONVENTIONS.md` |
|
|
562
|
+
|
|
563
|
+
Two consequences worth knowing:
|
|
564
|
+
|
|
565
|
+
- Targets that speak the standard get **no invariant-written skill files**, so
|
|
566
|
+
they never read the same skill twice.
|
|
567
|
+
- Hand-written items you put in `.claude/skills/` yourself are never touched —
|
|
568
|
+
invariant only manages what is listed in `invariant.json → active`, plus links
|
|
569
|
+
that resolve into `.agents/`. A target file you edit by hand is kept, with a
|
|
570
|
+
warning, until you pass `--force`.
|
|
571
|
+
|
|
572
|
+
On hosts without symlink support the CLI falls back to a Windows junction, then
|
|
573
|
+
to a physical copy, and says which one it used. `invariant init --copy` (or
|
|
574
|
+
`"materialization": { "mode": "copy" }`) opts out of linking entirely.
|
|
575
|
+
|
|
576
|
+
### Version control
|
|
577
|
+
|
|
578
|
+
`.agents/` and the target folders are **generated** — they are rebuilt by
|
|
579
|
+
`invariant add` and `invariant sync`, the way `node_modules` is rebuilt by a
|
|
580
|
+
package manager. `init` and `sync` keep them out of git via a delimited block:
|
|
581
|
+
|
|
582
|
+
```gitignore
|
|
583
|
+
# --- invariant (generated, do not edit) ---
|
|
584
|
+
.agents/
|
|
585
|
+
.claude/agents/
|
|
586
|
+
.claude/skills/
|
|
587
|
+
.claude/commands/
|
|
588
|
+
.claude/rules/
|
|
589
|
+
CLAUDE.md
|
|
590
|
+
# --- end invariant ---
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
Only paths invariant owns outright are listed, so a folder you share with it
|
|
594
|
+
(`.cursor/rules/`, which also holds your own rules) is left alone. Commit
|
|
595
|
+
`invariant.json`, run `invariant sync` after a clone.
|