rubrkit 0.1.1 → 0.4.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/README.md CHANGED
@@ -1,404 +1,417 @@
1
- # Rubrkit CLI
2
-
3
- Pull Rubrkit artifact bundles into agent projects and validate/test artifacts locally or remotely.
4
-
5
- ```bash
6
- npx rubrkit pull [all|<artifact-bundle-or-artifact-selector>] [options]
7
- npx rubrkit validate <path|glob> [options]
8
- npx rubrkit test <path|glob|artifact-bundle-or-artifact-selector> [options]
9
- npx rubrkit audit <artifact-bundle-or-selector> [options]
10
- npx rubrkit eval <artifact-bundle-or-selector> [options]
11
- npx rubrkit report <job-or-run-id> [options]
12
- ```
13
-
14
- ## Commands
15
-
16
- ### pull
17
-
18
- Downloads artifact bundles from Rubrkit and writes them to your local project.
19
-
20
- **Syntax:**
21
- ```bash
22
- rubrkit pull [all|<bundle>] [options]
23
- ```
24
-
25
- **Examples:**
26
- ```bash
27
- rubrkit pull # Interactive mode
28
- rubrkit pull all --yes # Pull all bundles without confirmation
29
- rubrkit pull team-agent-kit # Pull one bundle
30
- rubrkit pull --artifact-bundle team-agent-kit --artifact AGENTS.md # Pull specific artifact
31
- rubrkit pull all --yes --dry-run # Preview what would be written
32
- ```
33
-
34
- **Requires:** `RUBRKIT_API_KEY` environment variable or `--api-key` flag. Use a key scoped to `artifacts:pull`.
35
-
36
- ### validate
37
-
38
- Checks artifact syntax and structure locally (no API calls, no credits).
39
-
40
- **Syntax:**
41
- ```bash
42
- rubrkit validate <path|glob> [options]
43
- ```
44
-
45
- **Examples:**
46
- ```bash
47
- rubrkit validate docs/example.rubr_flow
48
- rubrkit validate "prompts/**/*.md" --format json
49
- ```
50
-
51
- ### test
52
-
53
- Validates artifacts locally or submits them to Rubrkit for remote testing and quality scoring.
54
-
55
- **Syntax:**
56
- ```bash
57
- rubrkit test <path|glob|artifact-bundle-or-artifact-selector> [options]
58
- ```
59
-
60
- **Examples:**
61
- ```bash
62
- rubrkit test "prompts/**/*.md" --local --format json # Local only, no API
63
- RUBRKIT_API_KEY=... rubrkit test team-agent-kit --remote # Remote test with scoring
64
- ```
65
-
66
- ### audit
67
-
68
- Submits artifacts to Rubrkit and runs audit checks with quality gates.
69
-
70
- **Syntax:**
71
- ```bash
72
- rubrkit audit <artifact-bundle-or-selector> [options]
73
- ```
74
-
75
- **Examples:**
76
- ```bash
77
- RUBRKIT_API_KEY=... rubrkit audit team-agent-kit --fail-under 85 --ci
78
- ```
79
-
80
- **Requires:** `RUBRKIT_API_KEY` environment variable or `--api-key` flag. Use a key scoped to: `artifact_bundles:write`, `files:write`, `audits:run`, `jobs:read`, `credits:read`.
81
-
82
- ### eval
83
-
84
- Evaluates artifacts against rubrics with detailed scoring and reporting.
85
-
86
- **Syntax:**
87
- ```bash
88
- rubrkit eval <artifact-bundle-or-selector> [options]
89
- ```
90
-
91
- **Examples:**
92
- ```bash
93
- RUBRKIT_API_KEY=... rubrkit eval team-agent-kit --format junit --output rubrkit-junit.xml
94
- ```
95
-
96
- **Requires:** API key with testing scope (same as `audit`).
97
-
98
- ### report
99
-
100
- Fetches results from a completed async job.
101
-
102
- **Syntax:**
103
- ```bash
104
- rubrkit report <job-id> [options]
105
- ```
106
-
107
- **Examples:**
108
- ```bash
109
- RUBRKIT_API_KEY=... rubrkit report job-abc-123 --format json
110
- ```
111
-
112
- **Requires:** API key with `jobs:read` scope.
113
-
114
- ---
115
-
116
- ## Flags
117
-
118
- ### Output & Formatting
119
-
120
- **`--format <text|json|junit>`**
121
- Output format for test/audit/eval results. Defaults to `text`.
122
- - `text`: Human-readable summary
123
- - `json`: Structured JSON for parsing
124
- - `junit`: JUnit XML for CI systems
125
-
126
- **`--output <path>`**
127
- Write results to a file instead of stdout.
128
-
129
- ### Artifact Selection
130
-
131
- **`--artifact-bundle <id-or-name>`**
132
- Select a specific artifact bundle to pull or test.
133
-
134
- **`--artifact <id-or-path>`**
135
- Select a specific artifact file within a bundle.
136
-
137
- **`--rubric <rubric-id-or-path>`**
138
- Select a specific evaluation rubric for audits.
139
-
140
- **`--all`**
141
- Pull all available bundles (requires `--yes` for safety). Equivalent to `rubrkit pull all`.
142
-
143
- ### Quality Gates
144
-
145
- **`--fail-under <score>`**
146
- Exit with code 1 if the quality score falls below this threshold (0-100). Only applies to test/audit/eval.
147
-
148
- **`--fail-on <critical|high|medium|low>`**
149
- Exit with code 1 if any findings at this severity level or higher are detected.
150
-
151
- ### Execution Mode
152
-
153
- **`--local`**
154
- Run checks locally without making API calls or consuming credits. Cannot be combined with `--remote`.
155
-
156
- **`--remote`**
157
- Submit artifacts to Rubrkit for remote testing. Requires API key. Cannot be combined with `--local`. Default for `test`/`audit`/`eval` without `--local`.
158
-
159
- **`--ci`**
160
- Run in CI mode: non-interactive, structured output, appropriate exit codes.
161
-
162
- **`--no-ai`**
163
- Skip AI-powered analysis (reduces cost, available for some commands).
164
-
165
- ### Pull-Specific Flags
166
-
167
- **`--agent <auto|codex|claude|generic>`**
168
- Target agent type for placement decisions. `auto` detects from project structure.
169
-
170
- **`--destination <path>`**
171
- Target directory for pulling artifacts. Defaults to current directory.
172
-
173
- **`--force`**
174
- Overwrite protected local changes. By default, `pull` stops if existing files differ from tracked versions.
175
-
176
- **`--prune`**
177
- Remove manifest-tracked files that are no longer selected.
178
-
179
- **`--update-only`**
180
- Only update files already tracked in `.rubrkit/manifest.json`. Skip new files.
181
-
182
- **`--yes` or `-y`**
183
- Skip interactive confirmation for unambiguous pulls.
184
-
185
- ### Testing & Debugging
186
-
187
- **`--dry-run`**
188
- Preview planned actions without changing files or making API calls. Useful with `--remote` to inspect request payloads.
189
-
190
- **`--watch`**
191
- Re-run checks when local files change (development mode).
192
-
193
- **`--changed`**
194
- Only test files changed since last run.
195
-
196
- ### Configuration
197
-
198
- **`--config <path>`**
199
- Load options from a JSON config file. API keys are not allowed in config files; use environment variables instead.
200
-
201
- **`--api-url <url>`**
202
- Override the Rubrkit API endpoint. Defaults to `RUBRKIT_API_URL` env var or `https://rubrkit.com/api/v1`.
203
-
204
- **`--api-key <key>`**
205
- Provide the API key explicitly (use `RUBRKIT_API_KEY` env var for security).
206
-
207
- ### Help
208
-
209
- **`--help` or `-h`**
210
- Show command help.
211
-
212
- **`--version` or `-v`**
213
- Show CLI version.
214
-
215
- ---
216
-
217
- ## Authentication
218
-
219
- Rubrkit requires API keys for `pull`, `test`, `audit`, `eval`, and `report` commands.
220
-
221
- **Set the key via environment variable (recommended):**
222
- ```bash
223
- export RUBRKIT_API_KEY=your_api_key_here
224
- rubrkit pull all --yes
225
- ```
226
-
227
- **Or pass it directly (avoid in scripts/CI):**
228
- ```bash
229
- rubrkit pull all --yes --api-key your_api_key_here
230
- ```
231
-
232
- **API key scopes:**
233
- - **Pull:** `artifacts:pull`
234
- - **Test/Audit/Eval/Report:** `artifact_bundles:write`, `files:write`, `audits:run`, `jobs:read`, `credits:read`
235
-
236
- Keys are never saved to `.rubrkit/manifest.json`, logs, or client bundles.
237
-
238
- ---
239
-
240
- ## Artifact Placement
241
-
242
- Artifacts are placed based on your agent type (`--agent auto|codex|claude|generic`):
243
-
244
- | Agent | Primary Artifact | Supporting Files | Auto-Detect |
245
- |-------|------------------|------------------|------------|
246
- | **codex** | `AGENTS.md` | `.rubrkit/artifacts/<bundle>/` | Looks for `AGENTS.md` |
247
- | **claude** | `CLAUDE.md` (or `.claude/CLAUDE.md` if exists) | `.rubrkit/artifacts/<bundle>/` | Looks for `CLAUDE.md` or `.claude/` |
248
- | **generic** | Preserves original paths | `.rubrkit/artifacts/<bundle>/` | Default fallback |
249
- | **auto** | Detects from project structure | `.rubrkit/artifacts/<bundle>/` | Recommended for new projects |
250
-
251
- Pull creates a `.rubrkit/manifest.json` to track managed files. Existing files are protected unless they match the manifest or you use `--force`.
252
-
253
- ---
254
-
255
- ## Exit Codes
256
-
257
- - **0:** Success. Checks passed or command completed without errors.
258
- - **1:** Validation/quality checks failed (threshold not met, findings detected, etc.).
259
- - **2:** Invalid CLI usage or configuration error.
260
- - **3:** Authentication or authorization failure (missing or invalid API key).
261
- - **4:** Rate limited, usage blocked, or circuit breaker active.
262
- - **5:** Network, API, or server failure.
263
-
264
- ---
265
-
266
- ## Examples
267
-
268
- ### Pull artifacts
269
- ```bash
270
- # Interactive: prompts for bundle and artifact selection
271
- rubrkit pull
272
-
273
- # Pull all bundles non-interactively
274
- RUBRKIT_API_KEY=my_key rubrkit pull all --yes
275
-
276
- # Pull one bundle to a custom location
277
- RUBRKIT_API_KEY=my_key rubrkit pull team-agent-kit --destination ./my-agents
278
-
279
- # Preview without writing
280
- RUBRKIT_API_KEY=my_key rubrkit pull all --yes --dry-run
281
-
282
- # Update only already-tracked files, skip new ones
283
- RUBRKIT_API_KEY=my_key rubrkit pull --update-only --yes
284
- ```
285
-
286
- ### Validate artifacts locally
287
- ```bash
288
- # Check syntax
289
- rubrkit validate docs/example.rubr_flow
290
-
291
- # Batch validate with glob
292
- rubrkit validate "prompts/**/*.md" --format json
293
- ```
294
-
295
- ### Test artifacts
296
- ```bash
297
- # Local validation (no API, no cost)
298
- rubrkit test "prompts/**/*.md" --local --format json
299
-
300
- # Remote test with scoring (requires API key)
301
- RUBRKIT_API_KEY=my_key rubrkit test team-agent-kit --remote
302
-
303
- # Remote with quality gates
304
- RUBRKIT_API_KEY=my_key rubrkit test team-agent-kit --remote --fail-under 80
305
- ```
306
-
307
- ### Audit with CI output
308
- ```bash
309
- # Generate JUnit XML for GitHub Actions / GitLab CI
310
- RUBRKIT_API_KEY=my_key rubrkit audit team-agent-kit \
311
- --format junit \
312
- --output test-results.xml \
313
- --ci \
314
- --fail-under 85
315
- ```
316
-
317
- ### Postinstall hook
318
- ```json
319
- {
320
- "scripts": {
321
- "postinstall": "rubrkit pull all --yes"
322
- }
323
- }
324
- ```
325
-
326
- ---
327
-
328
- ## SDK
329
-
330
- Import the Rubrkit SDK for programmatic use:
331
-
332
- ```js
333
- import { Rubrkit } from 'rubrkit';
334
-
335
- const client = new Rubrkit({ apiKey: process.env.RUBRKIT_API_KEY });
336
-
337
- // Test an artifact bundle
338
- const started = await client.artifacts.test({ artifactBundleId: 'team-agent-kit' });
339
- const job = await client.jobs.wait(started.jobId);
340
-
341
- // Get job results
342
- const results = await client.jobs.get(job.jobId);
343
- console.log(results.score, results.findings);
344
- ```
345
-
346
- ---
347
-
348
- ## Configuration File
349
-
350
- Create `.rubrkit/config.json` (or pass `--config path/to/config.json`):
351
-
352
- ```json
353
- {
354
- "destination": ".",
355
- "agent": "claude",
356
- "format": "json",
357
- "failUnder": 85,
358
- "failOn": "high"
359
- }
360
- ```
361
-
362
- **Note:** API keys are not allowed in config files. Always use `RUBRKIT_API_KEY` environment variable for security.
363
-
364
- ---
365
-
366
- ## Common Patterns
367
-
368
- ### CI/CD Integration
369
- ```bash
370
- # GitHub Actions
371
- - name: Pull Rubrkit artifacts
372
- env:
373
- RUBRKIT_API_KEY: ${{ secrets.RUBRKIT_API_KEY }}
374
- run: npx rubrkit pull all --yes
375
-
376
- - name: Audit artifacts
377
- env:
378
- RUBRKIT_API_KEY: ${{ secrets.RUBRKIT_API_KEY }}
379
- run: npx rubrkit audit team-agent-kit --ci --format junit --output results.xml --fail-under 80
380
- ```
381
-
382
- ### Development Workflow
383
- ```bash
384
- # Watch for changes and re-validate
385
- rubrkit test "prompts/**/*.md" --local --watch
386
-
387
- # Or in package.json
388
- "scripts": {
389
- "validate": "rubrkit validate docs/CLAUDE.md",
390
- "test": "rubrkit test docs/CLAUDE.md --local"
391
- }
392
- ```
393
-
394
- ---
395
-
396
- ## Troubleshooting
397
-
398
- **Missing API key:** Set `RUBRKIT_API_KEY` or pass `--api-key` for commands requiring authentication.
399
-
400
- **Local file conflicts:** Use `--dry-run` to preview, then `--force` to overwrite, or manually resolve and retry.
401
-
402
- **Slow remote tests:** Use `--local` for quick validation, `--remote --no-ai` to skip expensive analysis.
403
-
404
- **Rate limited:** Wait and retry. Consider using `--ci` to reduce request overhead in high-volume scenarios.
1
+ # Rubrkit CLI
2
+
3
+ Pull Rubrkit artifact bundles into agent projects and validate/test artifacts locally or remotely.
4
+
5
+ ```bash
6
+ npx rubrkit pull [all|<artifact-bundle-or-artifact-selector>] [options]
7
+ npx rubrkit validate <path|glob> [options]
8
+ npx rubrkit test <path|glob|artifact-bundle-or-artifact-selector> [options]
9
+ npx rubrkit audit <artifact-bundle-or-selector> [options]
10
+ npx rubrkit eval <artifact-bundle-or-selector> [options]
11
+ npx rubrkit report <job-or-run-id> [options]
12
+ ```
13
+
14
+ ## Commands
15
+
16
+ ### pull
17
+
18
+ Downloads artifact bundles from Rubrkit and writes them to your local project.
19
+
20
+ **Syntax:**
21
+ ```bash
22
+ rubrkit pull [all|<bundle>] [options]
23
+ ```
24
+
25
+ **Examples:**
26
+ ```bash
27
+ rubrkit pull # Interactive mode
28
+ rubrkit pull all --yes # Pull all bundles without confirmation
29
+ rubrkit pull team-agent-kit # Pull one bundle
30
+ rubrkit pull --artifact-bundle team-agent-kit --artifact AGENTS.md # Pull specific artifact
31
+ rubrkit pull --label prod --yes # Pull every bundle carrying a label
32
+ rubrkit pull all --yes --dry-run # Preview what would be written
33
+ ```
34
+
35
+ **Requires:** `RUBRKIT_API_KEY` environment variable or `--api-key` flag. Use a key scoped to `artifacts:pull`.
36
+
37
+ ### validate
38
+
39
+ Checks artifact syntax and structure locally (no API calls, no credits).
40
+
41
+ **Syntax:**
42
+ ```bash
43
+ rubrkit validate <path|glob> [options]
44
+ ```
45
+
46
+ **Examples:**
47
+ ```bash
48
+ rubrkit validate docs/example.rubr_flow
49
+ rubrkit validate "prompts/**/*.md" --format json
50
+ ```
51
+
52
+ ### test
53
+
54
+ Validates artifacts locally or submits them to Rubrkit for remote testing and quality scoring.
55
+
56
+ **Syntax:**
57
+ ```bash
58
+ rubrkit test <path|glob|artifact-bundle-or-artifact-selector> [options]
59
+ ```
60
+
61
+ **Examples:**
62
+ ```bash
63
+ rubrkit test "prompts/**/*.md" --local --format json # Local only, no API
64
+ RUBRKIT_API_KEY=... rubrkit test team-agent-kit --remote # Remote test with scoring
65
+ ```
66
+
67
+ ### audit
68
+
69
+ Submits artifacts to Rubrkit and runs audit checks with quality gates.
70
+
71
+ **Syntax:**
72
+ ```bash
73
+ rubrkit audit <artifact-bundle-or-selector> [options]
74
+ ```
75
+
76
+ **Examples:**
77
+ ```bash
78
+ RUBRKIT_API_KEY=... rubrkit audit team-agent-kit --fail-under 85 --ci
79
+ RUBRKIT_API_KEY=... rubrkit audit team-agent-kit --no-cache # Force a fresh run
80
+ ```
81
+
82
+ **Deterministic results (caching):** Audit results are cached per account by a content hash of the inputs (artifact contents, rubric, artifact type, and the scoring engine/model version). Re-running an audit on unchanged inputs returns the identical stored result instantly, charges no credits, and creates no job — so repeated CI runs are reproducible. The result is reported as cached (the text output prints `Cached: yes`; JSON/JUnit payloads carry a `cached` field). Changing any input — or a server-side engine/model version bump — produces a fresh result automatically. Use `--no-cache` to bypass the cache and force a fresh run.
83
+
84
+ **Requires:** `RUBRKIT_API_KEY` environment variable or `--api-key` flag. Use a key scoped to: `artifact_bundles:write`, `files:write`, `audits:run`, `jobs:read`, `credits:read`.
85
+
86
+ ### eval
87
+
88
+ Evaluates artifacts against rubrics with detailed scoring and reporting.
89
+
90
+ **Syntax:**
91
+ ```bash
92
+ rubrkit eval <artifact-bundle-or-selector> [options]
93
+ ```
94
+
95
+ **Examples:**
96
+ ```bash
97
+ RUBRKIT_API_KEY=... rubrkit eval team-agent-kit --format junit --output rubrkit-junit.xml
98
+ ```
99
+
100
+ **Requires:** API key with testing scope (same as `audit`).
101
+
102
+ ### report
103
+
104
+ Fetches results from a completed async job.
105
+
106
+ **Syntax:**
107
+ ```bash
108
+ rubrkit report <job-id> [options]
109
+ ```
110
+
111
+ **Examples:**
112
+ ```bash
113
+ RUBRKIT_API_KEY=... rubrkit report job-abc-123 --format json
114
+ ```
115
+
116
+ **Requires:** API key with `jobs:read` scope.
117
+
118
+ ---
119
+
120
+ ## Flags
121
+
122
+ ### Output & Formatting
123
+
124
+ **`--format <text|json|junit>`**
125
+ Output format for test/audit/eval results. Defaults to `text`.
126
+ - `text`: Human-readable summary
127
+ - `json`: Structured JSON for parsing
128
+ - `junit`: JUnit XML for CI systems
129
+
130
+ **`--output <path>`**
131
+ Write results to a file instead of stdout.
132
+
133
+ ### Artifact Selection
134
+
135
+ **`--artifact-bundle <id-or-name>`**
136
+ Select a specific artifact bundle to pull or test.
137
+
138
+ **`--artifact <id-or-path>`**
139
+ Select a specific artifact file within a bundle.
140
+
141
+ **`--label <name>`**
142
+ Pull every artifact in all bundles carrying this label. Repeatable and comma-separated, with **OR** semantics — a bundle matches if it has ANY of the given labels (`--label prod --label api` or `--label prod,api`). Cannot be combined with a positional selector, `--artifact-bundle`, or `--artifact`. Create and attach labels in the Rubrkit dashboard.
143
+
144
+ **`--rubric <rubric-id-or-path>`**
145
+ Select a specific evaluation rubric for audits.
146
+
147
+ **`--all`**
148
+ Pull all available bundles (requires `--yes` for safety). Equivalent to `rubrkit pull all`.
149
+
150
+ ### Quality Gates
151
+
152
+ **`--fail-under <score>`**
153
+ Exit with code 1 if the quality score falls below this threshold (0-100). Only applies to test/audit/eval.
154
+
155
+ **`--fail-on <critical|high|medium|low>`**
156
+ Exit with code 1 if any findings at this severity level or higher are detected.
157
+
158
+ ### Execution Mode
159
+
160
+ **`--local`**
161
+ Run checks locally without making API calls or consuming credits. Cannot be combined with `--remote`.
162
+
163
+ **`--remote`**
164
+ Submit artifacts to Rubrkit for remote testing. Requires API key. Cannot be combined with `--local`. Default for `test`/`audit`/`eval` without `--local`.
165
+
166
+ **`--ci`**
167
+ Run in CI mode: non-interactive, structured output, appropriate exit codes.
168
+
169
+ **`--no-ai`**
170
+ Skip AI-powered analysis (reduces cost, available for some commands).
171
+
172
+ **`--no-cache`**
173
+ Bypass the per-account audit result cache and force a fresh run, even when an identical prior result exists. Applies to `audit` (and `test`, which composes an audit). The fresh result becomes the new cached result for those inputs. Without this flag, identical inputs return the stored result instantly at no credit cost.
174
+
175
+ ### Pull-Specific Flags
176
+
177
+ **`--agent <auto|codex|claude|generic>`**
178
+ Target agent type for placement decisions. `auto` detects from project structure.
179
+
180
+ **`--destination <path>`**
181
+ Target directory for pulling artifacts. Defaults to current directory.
182
+
183
+ **`--force`**
184
+ Overwrite protected local changes. By default, `pull` stops if existing files differ from tracked versions.
185
+
186
+ **`--prune`**
187
+ Remove manifest-tracked files that are no longer selected.
188
+
189
+ **`--update-only`**
190
+ Only update files already tracked in `.rubrkit/manifest.json`. Skip new files.
191
+
192
+ **`--yes` or `-y`**
193
+ Skip interactive confirmation for unambiguous pulls.
194
+
195
+ ### Testing & Debugging
196
+
197
+ **`--dry-run`**
198
+ Preview planned actions without changing files or making API calls. Useful with `--remote` to inspect request payloads.
199
+
200
+ **`--watch`**
201
+ Re-run checks when local files change (development mode).
202
+
203
+ **`--changed`**
204
+ Only test files changed since last run.
205
+
206
+ ### Configuration
207
+
208
+ **`--config <path>`**
209
+ Load options from a JSON config file. API keys are not allowed in config files; use environment variables instead.
210
+
211
+ **`--api-url <url>`**
212
+ Override the Rubrkit API endpoint. Defaults to `RUBRKIT_API_URL` env var or `https://rubrkit.com/api/v1`.
213
+
214
+ **`--api-key <key>`**
215
+ Provide the API key explicitly (use `RUBRKIT_API_KEY` env var for security).
216
+
217
+ ### Help
218
+
219
+ **`--help` or `-h`**
220
+ Show command help.
221
+
222
+ **`--version` or `-v`**
223
+ Show CLI version.
224
+
225
+ ---
226
+
227
+ ## Authentication
228
+
229
+ Rubrkit requires API keys for `pull`, `test`, `audit`, `eval`, and `report` commands.
230
+
231
+ **Set the key via environment variable (recommended):**
232
+ ```bash
233
+ export RUBRKIT_API_KEY=your_api_key_here
234
+ rubrkit pull all --yes
235
+ ```
236
+
237
+ **Or pass it directly (avoid in scripts/CI):**
238
+ ```bash
239
+ rubrkit pull all --yes --api-key your_api_key_here
240
+ ```
241
+
242
+ **API key scopes:**
243
+ - **Pull:** `artifacts:pull`
244
+ - **Test/Audit/Eval/Report:** `artifact_bundles:write`, `files:write`, `audits:run`, `jobs:read`, `credits:read`
245
+
246
+ Keys are never saved to `.rubrkit/manifest.json`, logs, or client bundles.
247
+
248
+ ---
249
+
250
+ ## Artifact Placement
251
+
252
+ Artifacts are placed based on your agent type (`--agent auto|codex|claude|generic`):
253
+
254
+ | Agent | Primary Artifact | Supporting Files | Auto-Detect |
255
+ |-------|------------------|------------------|------------|
256
+ | **codex** | `AGENTS.md` | `.rubrkit/artifacts/<bundle>/` | Looks for `AGENTS.md` |
257
+ | **claude** | `CLAUDE.md` (or `.claude/CLAUDE.md` if exists) | `.rubrkit/artifacts/<bundle>/` | Looks for `CLAUDE.md` or `.claude/` |
258
+ | **generic** | Preserves original paths | `.rubrkit/artifacts/<bundle>/` | Default fallback |
259
+ | **auto** | Detects from project structure | `.rubrkit/artifacts/<bundle>/` | Recommended for new projects |
260
+
261
+ Pull creates a `.rubrkit/manifest.json` to track managed files. Existing files are protected unless they match the manifest or you use `--force`.
262
+
263
+ ---
264
+
265
+ ## Exit Codes
266
+
267
+ - **0:** Success. Checks passed or command completed without errors.
268
+ - **1:** Validation/quality checks failed (threshold not met, findings detected, etc.).
269
+ - **2:** Invalid CLI usage or configuration error.
270
+ - **3:** Authentication or authorization failure (missing or invalid API key).
271
+ - **4:** Rate limited, usage blocked, or circuit breaker active.
272
+ - **5:** Network, API, or server failure.
273
+
274
+ ---
275
+
276
+ ## Examples
277
+
278
+ ### Pull artifacts
279
+ ```bash
280
+ # Interactive: prompts for bundle and artifact selection
281
+ rubrkit pull
282
+
283
+ # Pull all bundles non-interactively
284
+ RUBRKIT_API_KEY=my_key rubrkit pull all --yes
285
+
286
+ # Pull one bundle to a custom location
287
+ RUBRKIT_API_KEY=my_key rubrkit pull team-agent-kit --destination ./my-agents
288
+
289
+ # Preview without writing
290
+ RUBRKIT_API_KEY=my_key rubrkit pull all --yes --dry-run
291
+
292
+ # Update only already-tracked files, skip new ones
293
+ RUBRKIT_API_KEY=my_key rubrkit pull --update-only --yes
294
+
295
+ # Pull every bundle carrying a label (OR across multiple labels)
296
+ RUBRKIT_API_KEY=my_key rubrkit pull --label prod --label api --yes
297
+ ```
298
+
299
+ ### Validate artifacts locally
300
+ ```bash
301
+ # Check syntax
302
+ rubrkit validate docs/example.rubr_flow
303
+
304
+ # Batch validate with glob
305
+ rubrkit validate "prompts/**/*.md" --format json
306
+ ```
307
+
308
+ ### Test artifacts
309
+ ```bash
310
+ # Local validation (no API, no cost)
311
+ rubrkit test "prompts/**/*.md" --local --format json
312
+
313
+ # Remote test with scoring (requires API key)
314
+ RUBRKIT_API_KEY=my_key rubrkit test team-agent-kit --remote
315
+
316
+ # Remote with quality gates
317
+ RUBRKIT_API_KEY=my_key rubrkit test team-agent-kit --remote --fail-under 80
318
+ ```
319
+
320
+ ### Audit with CI output
321
+ ```bash
322
+ # Generate JUnit XML for GitHub Actions / GitLab CI
323
+ RUBRKIT_API_KEY=my_key rubrkit audit team-agent-kit \
324
+ --format junit \
325
+ --output test-results.xml \
326
+ --ci \
327
+ --fail-under 85
328
+ ```
329
+
330
+ ### Postinstall hook
331
+ ```json
332
+ {
333
+ "scripts": {
334
+ "postinstall": "rubrkit pull all --yes"
335
+ }
336
+ }
337
+ ```
338
+
339
+ ---
340
+
341
+ ## SDK
342
+
343
+ Import the Rubrkit SDK for programmatic use:
344
+
345
+ ```js
346
+ import { Rubrkit } from 'rubrkit';
347
+
348
+ const client = new Rubrkit({ apiKey: process.env.RUBRKIT_API_KEY });
349
+
350
+ // Test an artifact bundle
351
+ const started = await client.artifacts.test({ artifactBundleId: 'team-agent-kit' });
352
+ const job = await client.jobs.wait(started.jobId);
353
+
354
+ // Get job results
355
+ const results = await client.jobs.get(job.jobId);
356
+ console.log(results.score, results.findings);
357
+ ```
358
+
359
+ ---
360
+
361
+ ## Configuration File
362
+
363
+ Create `.rubrkit/config.json` (or pass `--config path/to/config.json`):
364
+
365
+ ```json
366
+ {
367
+ "destination": ".",
368
+ "agent": "claude",
369
+ "format": "json",
370
+ "failUnder": 85,
371
+ "failOn": "high"
372
+ }
373
+ ```
374
+
375
+ **Note:** API keys are not allowed in config files. Always use `RUBRKIT_API_KEY` environment variable for security.
376
+
377
+ ---
378
+
379
+ ## Common Patterns
380
+
381
+ ### CI/CD Integration
382
+ ```bash
383
+ # GitHub Actions
384
+ - name: Pull Rubrkit artifacts
385
+ env:
386
+ RUBRKIT_API_KEY: ${{ secrets.RUBRKIT_API_KEY }}
387
+ run: npx rubrkit pull all --yes
388
+
389
+ - name: Audit artifacts
390
+ env:
391
+ RUBRKIT_API_KEY: ${{ secrets.RUBRKIT_API_KEY }}
392
+ run: npx rubrkit audit team-agent-kit --ci --format junit --output results.xml --fail-under 80
393
+ ```
394
+
395
+ ### Development Workflow
396
+ ```bash
397
+ # Watch for changes and re-validate
398
+ rubrkit test "prompts/**/*.md" --local --watch
399
+
400
+ # Or in package.json
401
+ "scripts": {
402
+ "validate": "rubrkit validate docs/CLAUDE.md",
403
+ "test": "rubrkit test docs/CLAUDE.md --local"
404
+ }
405
+ ```
406
+
407
+ ---
408
+
409
+ ## Troubleshooting
410
+
411
+ **Missing API key:** Set `RUBRKIT_API_KEY` or pass `--api-key` for commands requiring authentication.
412
+
413
+ **Local file conflicts:** Use `--dry-run` to preview, then `--force` to overwrite, or manually resolve and retry.
414
+
415
+ **Slow remote tests:** Use `--local` for quick validation, `--remote --no-ai` to skip expensive analysis.
416
+
417
+ **Rate limited:** Wait and retry. Consider using `--ci` to reduce request overhead in high-volume scenarios.