rubrkit 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/README.md +357 -79
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,126 +1,404 @@
1
1
  # Rubrkit CLI
2
2
 
3
- Local v1 package for pulling Rubrkit artifact-bundle files into agent projects and testing artifacts from local projects or CI.
4
-
5
- The package folder is `tools/rubrkit-cli`, but the intended published package name and executable are `rubrkit` so users can run:
3
+ Pull Rubrkit artifact bundles into agent projects and validate/test artifacts locally or remotely.
6
4
 
7
5
  ```bash
8
- npx rubrkit pull [all|<artifact-bundle-or-artifact-selector>]
9
- npx rubrkit validate <path|glob>
10
- npx rubrkit test <path|glob|artifact-bundle-or-artifact-selector>
11
- npx rubrkit audit <artifact-bundle-or-selector>
12
- npx rubrkit eval <artifact-bundle-or-selector>
13
- npx rubrkit report <job-or-run-id>
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]
14
12
  ```
15
13
 
16
- ## Auth
14
+ ## Commands
15
+
16
+ ### pull
17
+
18
+ Downloads artifact bundles from Rubrkit and writes them to your local project.
17
19
 
18
- Use a Rubrkit API key for pull commands and remote checks. Prefer a pull key scoped to `artifacts:pull`. For `rubrkit test <path> --remote`, use a testing key scoped to the existing composed API flow: `artifact_bundles:write`, `files:write`, `audits:run`, `jobs:read`, and `credits:read`.
20
+ **Syntax:**
21
+ ```bash
22
+ rubrkit pull [all|<bundle>] [options]
23
+ ```
19
24
 
25
+ **Examples:**
20
26
  ```bash
21
- RUBRKIT_API_KEY=... rubrkit pull all --yes
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
22
32
  ```
23
33
 
24
- `--api-key` is also supported for secret-manager wrappers. API keys are never written to `.rubrkit/manifest.json`, local reports, fixtures, or snapshots.
34
+ **Requires:** `RUBRKIT_API_KEY` environment variable or `--api-key` flag. Use a key scoped to `artifacts:pull`.
25
35
 
26
- ## Pull Examples
36
+ ### validate
27
37
 
38
+ Checks artifact syntax and structure locally (no API calls, no credits).
39
+
40
+ **Syntax:**
28
41
  ```bash
29
- rubrkit pull
30
- rubrkit pull all --yes
31
- rubrkit pull team-agent-kit --destination .
32
- rubrkit pull --artifact-bundle team-agent-kit --artifact AGENTS.md --yes
33
- rubrkit pull all --yes --dry-run
34
- ```
35
-
36
- Useful flags:
37
-
38
- ```text
39
- --destination <path>
40
- --agent <auto|codex|claude|generic>
41
- --artifact-bundle <id-or-name>
42
- --artifact <id-or-path>
43
- --rubric <rubric-id-or-path>
44
- --format <text|json|junit>
45
- --output <path>
46
- --fail-under <score>
47
- --fail-on <critical|high|medium|low>
48
- --ci
49
- --local
50
- --remote
51
- --no-ai
52
- --watch
53
- --changed
54
- --all
55
- --yes
56
- --dry-run
57
- --force
58
- --prune
59
- --update-only
60
- --config <path>
61
- --api-url <url>
62
- --api-key <key>
63
- ```
64
-
65
- ## Testing Examples
66
-
67
- Local validation runs without network access or credits where possible:
42
+ rubrkit validate <path|glob> [options]
43
+ ```
68
44
 
45
+ **Examples:**
69
46
  ```bash
70
47
  rubrkit validate docs/example.rubr_flow
71
- rubrkit test "prompts/**/*.md" --local --format json
48
+ rubrkit validate "prompts/**/*.md" --format json
72
49
  ```
73
50
 
74
- Remote checks use the public `/api/v1` API, create async jobs, and poll `/jobs/{jobId}`. Local-file remote tests create or select an artifact bundle, upload the local text files, then start an audit job:
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.
75
69
 
70
+ **Syntax:**
71
+ ```bash
72
+ rubrkit audit <artifact-bundle-or-selector> [options]
73
+ ```
74
+
75
+ **Examples:**
76
76
  ```bash
77
- RUBRKIT_API_KEY=... rubrkit test team-agent-kit --remote --format json
78
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
79
93
  RUBRKIT_API_KEY=... rubrkit eval team-agent-kit --format junit --output rubrkit-junit.xml
80
- RUBRKIT_API_KEY=... rubrkit report <job-id>
81
94
  ```
82
95
 
83
- Use `--dry-run --remote` to inspect the remote request shape without calling the API.
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.
84
214
 
85
- Exit codes:
215
+ ---
86
216
 
87
- - `0`: checks passed.
88
- - `1`: checks completed and failed validation or quality gates.
89
- - `2`: invalid CLI usage or invalid config.
90
- - `3`: authentication or authorization failure.
91
- - `4`: credit, usage-limit, or circuit-breaker block.
92
- - `5`: network, provider, or server failure.
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
+ ---
93
327
 
94
328
  ## SDK
95
329
 
96
- The current local package exports the SDK from `rubrkit` while final package naming awaits owner approval.
330
+ Import the Rubrkit SDK for programmatic use:
97
331
 
98
332
  ```js
99
333
  import { Rubrkit } from 'rubrkit';
100
334
 
101
335
  const client = new Rubrkit({ apiKey: process.env.RUBRKIT_API_KEY });
336
+
337
+ // Test an artifact bundle
102
338
  const started = await client.artifacts.test({ artifactBundleId: 'team-agent-kit' });
103
339
  const job = await client.jobs.wait(started.jobId);
104
- ```
105
340
 
106
- ## Placement
107
-
108
- - Codex primary artifacts are placed as `AGENTS.md`; supporting files go under `.rubrkit/artifacts/<bundle>/`.
109
- - Claude primary artifacts are placed as `CLAUDE.md`, or `.claude/CLAUDE.md` when that file already exists; supporting files go under `.rubrkit/artifacts/<bundle>/`.
110
- - Generic placement preserves artifact paths under `.rubrkit/artifacts/<bundle>/`.
341
+ // Get job results
342
+ const results = await client.jobs.get(job.jobId);
343
+ console.log(results.score, results.findings);
344
+ ```
111
345
 
112
- The CLI protects existing local files unless they were previously managed by Rubrkit and match the local manifest. Use `--force` to overwrite after reviewing the plan.
346
+ ---
113
347
 
114
- ## Postinstall
348
+ ## Configuration File
115
349
 
116
- Rubrkit does not run network sync from its own package lifecycle. Consuming projects can opt in:
350
+ Create `.rubrkit/config.json` (or pass `--config path/to/config.json`):
117
351
 
118
352
  ```json
119
353
  {
120
- "scripts": {
121
- "postinstall": "rubrkit pull all --yes"
122
- }
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"
123
391
  }
124
392
  ```
125
393
 
126
- Postinstall commands should use `RUBRKIT_API_KEY` and an unambiguous selector.
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rubrkit",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "description": "Rubrkit CLI for pulling artifact bundles into local agent projects.",
6
6
  "bin": {