@weldr/runr 0.7.3 → 0.7.4

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/dist/cli.js CHANGED
@@ -47,6 +47,13 @@ import { computeBrain } from './ux/brain.js';
47
47
  import { formatFrontDoor, formatJson as formatBrainJson } from './ux/render.js';
48
48
  import { recordFrontDoor } from './ux/telemetry.js';
49
49
  import fs from 'node:fs';
50
+ import path from 'node:path';
51
+ import { fileURLToPath } from 'node:url';
52
+ // Read version from package.json at module load time
53
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
54
+ const packageJsonPath = path.resolve(__dirname, '../package.json');
55
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
56
+ const CLI_VERSION = packageJson.version;
50
57
  const program = new Command();
51
58
  // Check if invoked as deprecated 'agent' command
52
59
  const invokedAs = process.argv[1]?.split('/').pop() || 'runr';
@@ -69,7 +76,7 @@ Advanced:
69
76
  program
70
77
  .name('runr')
71
78
  .description('Autopilot for agent tasks')
72
- .version('0.7.1');
79
+ .version(CLI_VERSION);
73
80
  // ============================================================================
74
81
  // CORE COMMANDS (the 5 commands everyone needs)
75
82
  // ============================================================================
@@ -386,14 +386,18 @@ async function generateDemoProject(demoDir) {
386
386
  */
387
387
  export function add(a: number, b: number): number { return a + b; }
388
388
  export function subtract(a: number, b: number): number { return a - b; }
389
+ export function divide(a: number, b: number): number { return a / b; }
389
390
  // TODO: implement multiply
390
391
  `);
391
392
  fs.writeFileSync(path.join(demoDir, 'tests', 'math.test.ts'), `import { describe, it, expect } from 'vitest';
392
- import { add, subtract } from '../src/math.js';
393
+ import { add, subtract, divide } from '../src/math.js';
393
394
 
394
395
  describe('math', () => {
395
396
  it('adds two numbers', () => { expect(add(2, 3)).toBe(5); });
396
397
  it('subtracts two numbers', () => { expect(subtract(5, 3)).toBe(2); });
398
+ // INTENTIONAL BUG: expects 999 but divide(10, 2) returns 5
399
+ // Task 01 will fix this by changing 999 to 5
400
+ it('divides two numbers', () => { expect(divide(10, 2)).toBe(999); });
397
401
  });
398
402
  `);
399
403
  const runrConfig = {
@@ -423,20 +427,27 @@ Add a multiply function to src/math.ts and add a test for it.
423
427
  - npm run typecheck passes
424
428
  - npm test passes
425
429
  `);
426
- fs.writeFileSync(path.join(demoDir, '.runr', 'tasks', '01-intentional-fail.md'), `# Add divide function with edge case
430
+ fs.writeFileSync(path.join(demoDir, '.runr', 'tasks', '01-fix-failing-test.md'), `# Fix the failing divide test
427
431
 
428
432
  ## Goal
429
- Add a divide function with tests including edge cases.
433
+ The divide test is currently failing. Fix it.
434
+
435
+ ## Context
436
+ Run \`npm test\` to see the failure. The test expects the wrong value.
430
437
 
431
438
  ## Requirements
432
- - Add \`divide(a: number, b: number): number\` to src/math.ts
433
- - Add tests including divide(10, 2) === 5 and divide(10, 0) === Infinity
439
+ - Fix the failing test in tests/math.test.ts
440
+ - The divide(10, 2) test should expect 5, not 999
434
441
 
435
442
  ## Success Criteria
436
443
  - npm run typecheck passes
437
444
  - npm test passes
445
+
446
+ ## Note
447
+ This task demonstrates the autofix flow. When verification fails,
448
+ run \`runr\` to see safe commands, then \`runr continue\` to auto-fix.
438
449
  `);
439
- fs.writeFileSync(path.join(demoDir, '.runr', 'tasks', '02-scope-violation.md'), `# Update README with project description
450
+ fs.writeFileSync(path.join(demoDir, '.runr', 'tasks', '02-scope-violation.md'), `# Update README (will be blocked)
440
451
 
441
452
  ## Goal
442
453
  Update README.md to describe this math library.
@@ -448,63 +459,93 @@ Update README.md to describe this math library.
448
459
  ## Success Criteria
449
460
  - README.md contains function documentation
450
461
 
451
- ## Note
452
- This task will trigger a scope violation because README.md is in the denylist.
462
+ ## Expected Behavior
463
+ This task WILL be blocked by the scope guard.
464
+ README.md is in the denylist (see .runr/runr.config.json).
465
+
466
+ This demonstrates Runr's safety guardrails working correctly.
467
+ Run \`runr report latest\` to see the guard violation details.
453
468
  `);
454
469
  fs.writeFileSync(path.join(demoDir, 'README.md'), `# Runr Demo
455
470
 
456
471
  Try Runr in 2 minutes.
457
472
 
458
- ## Step 1: Install
473
+ ## Setup
459
474
 
460
475
  \`\`\`bash
461
476
  npm install
462
477
  \`\`\`
463
478
 
464
- ## Step 2: Run the tasks
479
+ ---
465
480
 
466
- ### Task 00: Success (quick win)
481
+ ## Task 1: Success (the happy path)
467
482
 
468
483
  \`\`\`bash
469
484
  runr run --task .runr/tasks/00-success.md
470
485
  \`\`\`
471
486
 
472
- **Expected:** Completes cleanly. The agent adds a multiply function and test.
487
+ **What happens:** Agent adds a multiply function, tests pass, checkpoint created.
488
+
489
+ \`\`\`bash
490
+ runr report latest # See the run details
491
+ \`\`\`
492
+
493
+ ---
494
+
495
+ ## Task 2: Autofix (the "wow" moment)
496
+
497
+ This task has a **failing test** (intentional). Watch Runr detect it and offer safe commands.
473
498
 
474
499
  \`\`\`bash
475
- runr report latest # see what happened
500
+ runr run --task .runr/tasks/01-fix-failing-test.md
476
501
  \`\`\`
477
502
 
478
- ### Task 01: Failure + Recovery
503
+ **What happens:** Verification fails (npm test fails). Run stops.
479
504
 
480
505
  \`\`\`bash
481
- runr run --task .runr/tasks/01-intentional-fail.md
506
+ runr # Shows STOPPED + 3 next actions
482
507
  \`\`\`
483
508
 
484
- **Expected:** May stop (verification failed or review loop). This is intentional.
509
+ You'll see safe commands like \`npm test\`. Now auto-fix:
485
510
 
486
511
  \`\`\`bash
487
- runr # shows STOPPED + 3 next actions
488
- runr continue # attempt auto-fix
489
- runr report latest
512
+ runr continue # Runs safe commands, then resumes
490
513
  \`\`\`
491
514
 
492
- ### Task 02: Scope Guard
515
+ \`\`\`bash
516
+ runr report latest # See what was fixed
517
+ \`\`\`
518
+
519
+ ---
520
+
521
+ ## Task 3: Guard (safety demo)
522
+
523
+ This task tries to modify README.md, which is in the denylist.
493
524
 
494
525
  \`\`\`bash
495
526
  runr run --task .runr/tasks/02-scope-violation.md
496
527
  \`\`\`
497
528
 
498
- **Expected:** STOPPED (scope guard). README.md is in the denylist.
529
+ **What happens:** STOPPED immediately. Scope guard blocks the change.
530
+
531
+ \`\`\`bash
532
+ runr # Shows BLOCKED headline + manual recipe
533
+ runr report latest # See the guard violation details
534
+ \`\`\`
535
+
536
+ This is the safety layer working correctly. No \`--force\` can bypass scope.
537
+
538
+ ---
539
+
540
+ ## The Point
499
541
 
500
- This demonstrates the safety guardrails.
542
+ Runr stops with receipts and 3 actions you can trust:
501
543
 
502
- ## The point
544
+ 1. **continue** — run safe commands, then resume
545
+ 2. **report** — inspect the run: diffs, logs, timeline
546
+ 3. **intervene** — record manual fixes for provenance
503
547
 
504
- Runr stops with receipts and 3 next actions you can trust:
505
- - **continue** — auto-fix what's safe, then resume
506
- - **report** — open the run receipt: diffs + logs + timeline
507
- - **intervene** — record manual fixes
548
+ Every stop has a headline. Every headline maps to a fix.
508
549
  `);
509
550
  fs.writeFileSync(path.join(demoDir, '.gitignore'), 'node_modules/\ndist/\n.runr/runs/\n');
510
551
  }
@@ -59,7 +59,7 @@ export function getVersionInfo() {
59
59
  */
60
60
  function formatVersion(info) {
61
61
  const lines = [];
62
- lines.push(`Agent Runner v${info.agent_version}`);
62
+ lines.push(`Runr v${info.agent_version}`);
63
63
  lines.push(` Artifact Schema: v${info.artifact_schema_version}`);
64
64
  lines.push(` Node: ${info.node}`);
65
65
  lines.push(` Platform: ${info.platform}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weldr/runr",
3
- "version": "0.7.3",
3
+ "version": "0.7.4",
4
4
  "description": "Phase-gated orchestration for agent tasks",
5
5
  "type": "module",
6
6
  "bin": {