@open-tomato/rafa 0.17.0 → 0.19.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.
Files changed (33) hide show
  1. package/NOTICE +9 -1
  2. package/README.md +40 -26
  3. package/dist/PROMPT.md +2 -1
  4. package/dist/bundled/agents/build-error-resolver.md +144 -0
  5. package/dist/bundled/agents/code-reviewer.md +335 -0
  6. package/dist/bundled/agents/doc-updater.md +108 -0
  7. package/dist/bundled/agents/loop-implementer.md +57 -0
  8. package/dist/bundled/agents/qa-bug-reporter.md +164 -0
  9. package/dist/bundled/agents/tdd-guide.md +121 -0
  10. package/dist/bundled/bin/ts-symbols +272 -0
  11. package/dist/{SKILL.md → bundled/skills/dev-planner/SKILL.md} +7 -5
  12. package/dist/bundled/skills/documentation/SKILL.md +93 -0
  13. package/dist/bundled/skills/git-workflow/SKILL.md +242 -0
  14. package/dist/bundled/skills/ts-symbols/SKILL.md +82 -0
  15. package/dist/cli.js +6952 -4721
  16. package/dist/{describe-wbn759vf.js → describe-cenk70n5.js} +4 -3
  17. package/dist/effort/store/index.js +6 -4
  18. package/dist/{index-64wec0k7.js → index-09p41s0n.js} +11 -224
  19. package/dist/{index-qzhpqmfy.js → index-c5cecsga.js} +2 -2
  20. package/dist/{index-4qd537z6.js → index-ca0fccvr.js} +3527 -1402
  21. package/dist/{index-n3rw8rhr.js → index-cedghpva.js} +78 -2
  22. package/dist/index-d6d0942q.js +218 -0
  23. package/dist/{index-7t0qz29r.js → index-gb51x34c.js} +1020 -58
  24. package/dist/{index-r7cnr44m.js → index-mh5hyw8g.js} +1681 -3101
  25. package/dist/index-pqrpcfaz.js +1020 -0
  26. package/dist/{index-p901zs2p.js → index-vg7ycs94.js} +1 -1
  27. package/dist/index-wp8c28fd.js +18 -0
  28. package/dist/index.js +13 -11
  29. package/dist/learning/index.js +25 -0
  30. package/dist/plan/index.js +8 -7
  31. package/dist/plan-prompt.md +2 -0
  32. package/package.json +4 -3
  33. package/dist/index-ps5sac9p.js +0 -531
@@ -3,9 +3,10 @@ import {
3
3
  DESCRIBE_BINARY,
4
4
  DESCRIBE_SCHEMA_VERSION,
5
5
  describeRegistry
6
- } from "./index-qzhpqmfy.js";
7
- import"./index-p901zs2p.js";
8
- import"./index-n3rw8rhr.js";
6
+ } from "./index-c5cecsga.js";
7
+ import"./index-vg7ycs94.js";
8
+ import"./index-cedghpva.js";
9
+ import"./index-wp8c28fd.js";
9
10
  export {
10
11
  describeRegistry,
11
12
  DESCRIBE_SCHEMA_VERSION,
@@ -4,12 +4,14 @@ import {
4
4
  openNdjsonStore,
5
5
  openSqliteStore,
6
6
  selectEffortStore
7
- } from "../../index-7t0qz29r.js";
8
- import"../../index-ps5sac9p.js";
9
- import"../../index-p901zs2p.js";
7
+ } from "../../index-gb51x34c.js";
8
+ import"../../index-pqrpcfaz.js";
9
+ import"../../index-d6d0942q.js";
10
+ import"../../index-vg7ycs94.js";
10
11
  import {
11
12
  STORE_BACKENDS
12
- } from "../../index-n3rw8rhr.js";
13
+ } from "../../index-cedghpva.js";
14
+ import"../../index-wp8c28fd.js";
13
15
  export {
14
16
  selectEffortStore,
15
17
  openSqliteStore,
@@ -2,11 +2,11 @@
2
2
  import {
3
3
  activeOutput,
4
4
  readRafaBlocks
5
- } from "./index-ps5sac9p.js";
5
+ } from "./index-pqrpcfaz.js";
6
6
  import {
7
7
  messageOf,
8
8
  parseTaskDeclaration
9
- } from "./index-n3rw8rhr.js";
9
+ } from "./index-cedghpva.js";
10
10
  // src/preflight/prerequisites-md.ts
11
11
  import { basename, dirname, join } from "path";
12
12
  var SECTION_AUTO_RE = /\[auto\]/i;
@@ -376,219 +376,6 @@ async function runPreflight(items, options) {
376
376
  knownMissing: Object.freeze(knownMissing)
377
377
  });
378
378
  }
379
- // src/report/parse.ts
380
- var REPORT_STATUSES = ["done", "blocked"];
381
- var FINDING_KINDS = ["gotcha", "pattern", "location", "skill-suggestion"];
382
- var FINDING_SIGNALS = ["loud", "silent"];
383
- var CHANGE_LEVELS = ["patch", "minor", "major", "none"];
384
- var REPORT_KIND = "report";
385
- var REQUIRED = true;
386
- var OPTIONAL = false;
387
- var REPORT_KEYS = [
388
- "status",
389
- "feedback",
390
- "findings",
391
- "skills_used",
392
- "blockers",
393
- "out_of_scope_bugs",
394
- "changes"
395
- ];
396
- var FINDING_KEYS = ["trigger", "kind", "what", "cause", "resolution", "artifact", "signal"];
397
- var BLOCKER_KEYS = ["what", "artifact"];
398
- var BUG_KEYS = ["what", "artifact", "security"];
399
- var CHANGE_KEYS = ["level", "area", "summary"];
400
- function isMapping(value) {
401
- return typeof value === "object" && value !== null && !Array.isArray(value);
402
- }
403
- function isOneOf(choices, value) {
404
- return choices.includes(value);
405
- }
406
- function describeValue(value) {
407
- if (typeof value === "string")
408
- return JSON.stringify(value);
409
- if (value === null)
410
- return "nothing";
411
- if (Array.isArray(value))
412
- return "a list";
413
- if (typeof value === "object")
414
- return "a mapping";
415
- return `the ${typeof value} ${String(value)}`;
416
- }
417
- function messageOf2(error) {
418
- return error instanceof Error ? error.message : String(error);
419
- }
420
- function reportIssue(reason, field, text) {
421
- return { reason, field, text };
422
- }
423
- function absent(reason, block, text) {
424
- return { present: false, reason, block, text };
425
- }
426
- function scopeOf(mapping, keys, prefix, issues) {
427
- const fields = new Map;
428
- const extras = [];
429
- for (const [key, value] of Object.entries(mapping)) {
430
- if (keys.includes(key))
431
- fields.set(key, value);
432
- else
433
- extras.push({ key, value });
434
- }
435
- return { fields, extras, prefix, issues };
436
- }
437
- function valueOf(scope, key, required) {
438
- const value = scope.fields.get(key) ?? null;
439
- if (value === null && required) {
440
- const field = `${scope.prefix}${key}`;
441
- scope.issues.push(reportIssue("missing-field", field, `${field} is missing`));
442
- }
443
- return value;
444
- }
445
- function unusable(scope, key, why) {
446
- const field = `${scope.prefix}${key}`;
447
- scope.issues.push(reportIssue("unusable-field", field, `${field} ${why}`));
448
- return null;
449
- }
450
- function stringProblem(value) {
451
- if (typeof value !== "string")
452
- return `is ${describeValue(value)}, not a string; quote it`;
453
- if (value.trim().length === 0)
454
- return "is blank";
455
- return null;
456
- }
457
- function stringField(scope, key, required) {
458
- const value = valueOf(scope, key, required);
459
- if (value === null)
460
- return null;
461
- const problem = stringProblem(value);
462
- return problem === null ? value : unusable(scope, key, problem);
463
- }
464
- function choiceField(scope, key, choices, required) {
465
- const value = valueOf(scope, key, required);
466
- if (value === null || isOneOf(choices, value))
467
- return value;
468
- return unusable(scope, key, `is ${describeValue(value)}, not one of ${choices.join(", ")}`);
469
- }
470
- function booleanField(scope, key, required) {
471
- const value = valueOf(scope, key, required);
472
- if (value === null || typeof value === "boolean")
473
- return value;
474
- return unusable(scope, key, `is ${describeValue(value)}, not true or false; write it unquoted`);
475
- }
476
- function listField(scope, key, readEntry) {
477
- const value = valueOf(scope, key, OPTIONAL);
478
- if (value === null)
479
- return [];
480
- if (!Array.isArray(value)) {
481
- unusable(scope, key, `is ${describeValue(value)}, not a list`);
482
- return [];
483
- }
484
- const entries = [];
485
- const items = value;
486
- for (const [index, item] of items.entries()) {
487
- const entry = readEntry(item, `${scope.prefix}${key}[${index}]`, scope.issues);
488
- if (entry !== null)
489
- entries.push(entry);
490
- }
491
- return entries;
492
- }
493
- function entryScope(item, field, keys, issues) {
494
- if (isMapping(item))
495
- return scopeOf(item, keys, `${field}.`, issues);
496
- const text = `${field} is ${describeValue(item)}, not a mapping of ${keys.join(", ")}; dropped`;
497
- issues.push(reportIssue("unusable-field", field, text));
498
- return null;
499
- }
500
- function readSkill(item, field, issues) {
501
- const problem = stringProblem(item);
502
- if (problem === null)
503
- return item;
504
- issues.push(reportIssue("unusable-field", field, `${field} ${problem}; dropped`));
505
- return null;
506
- }
507
- function readFinding(item, field, issues) {
508
- const scope = entryScope(item, field, FINDING_KEYS, issues);
509
- if (scope === null)
510
- return null;
511
- return {
512
- trigger: stringField(scope, "trigger", REQUIRED),
513
- kind: choiceField(scope, "kind", FINDING_KINDS, REQUIRED),
514
- what: stringField(scope, "what", REQUIRED),
515
- cause: stringField(scope, "cause", OPTIONAL),
516
- resolution: stringField(scope, "resolution", OPTIONAL),
517
- artifact: stringField(scope, "artifact", OPTIONAL),
518
- signal: choiceField(scope, "signal", FINDING_SIGNALS, REQUIRED),
519
- extras: scope.extras
520
- };
521
- }
522
- function readBlocker(item, field, issues) {
523
- const scope = entryScope(item, field, BLOCKER_KEYS, issues);
524
- if (scope === null)
525
- return null;
526
- return {
527
- what: stringField(scope, "what", REQUIRED),
528
- artifact: stringField(scope, "artifact", OPTIONAL),
529
- extras: scope.extras
530
- };
531
- }
532
- function readBug(item, field, issues) {
533
- const scope = entryScope(item, field, BUG_KEYS, issues);
534
- if (scope === null)
535
- return null;
536
- return {
537
- what: stringField(scope, "what", REQUIRED),
538
- artifact: stringField(scope, "artifact", OPTIONAL),
539
- security: booleanField(scope, "security", REQUIRED),
540
- extras: scope.extras
541
- };
542
- }
543
- function readChange(item, field, issues) {
544
- const scope = entryScope(item, field, CHANGE_KEYS, issues);
545
- if (scope === null)
546
- return null;
547
- return {
548
- level: choiceField(scope, "level", CHANGE_LEVELS, REQUIRED),
549
- area: stringField(scope, "area", OPTIONAL),
550
- summary: stringField(scope, "summary", REQUIRED),
551
- extras: scope.extras
552
- };
553
- }
554
- function readReport(document, issues) {
555
- const scope = scopeOf(document, REPORT_KEYS, "", issues);
556
- return {
557
- status: choiceField(scope, "status", REPORT_STATUSES, REQUIRED),
558
- feedback: stringField(scope, "feedback", OPTIONAL),
559
- findings: listField(scope, "findings", readFinding),
560
- skillsUsed: listField(scope, "skills_used", readSkill),
561
- blockers: listField(scope, "blockers", readBlocker),
562
- outOfScopeBugs: listField(scope, "out_of_scope_bugs", readBug),
563
- changes: listField(scope, "changes", readChange),
564
- extras: scope.extras
565
- };
566
- }
567
- function parseReport(output) {
568
- const reports = readRafaBlocks(output).filter((block2) => block2.kind === REPORT_KIND);
569
- const block = reports.at(-1);
570
- if (block === undefined) {
571
- return absent("no-block", null, "the session output holds no rafa:report block");
572
- }
573
- const line = block.span.first;
574
- if (!block.closed) {
575
- return absent("unclosed-block", block, `rafa:report block at line ${line} is never closed, so its body may have been cut short ` + "and is not read");
576
- }
577
- let document;
578
- try {
579
- document = Bun.YAML.parse(block.body);
580
- } catch (error) {
581
- const text = `rafa:report block at line ${line} is not valid YAML (${messageOf2(error)})`;
582
- return absent("malformed-block", block, text);
583
- }
584
- if (!isMapping(document)) {
585
- const text = `rafa:report block at line ${line} holds ${describeValue(document)}, ` + "not a mapping of report fields";
586
- return absent("malformed-block", block, text);
587
- }
588
- const issues = [];
589
- const report = readReport(document, issues);
590
- return { present: true, report, block, issues };
591
- }
592
379
  // src/utils/plan-stamp.ts
593
380
  var STUB_PATTERN = "[A-Za-z0-9._-]+";
594
381
  var STAMP_PATTERN = new RegExp(`<!--\\s*ralph:plan=(${STUB_PATTERN})\\s*-->`);
@@ -784,10 +571,10 @@ function isHeaderField(key) {
784
571
  function isReleaseLevel(value) {
785
572
  return PLAN_RELEASE_LEVELS.includes(value);
786
573
  }
787
- function isMapping2(value) {
574
+ function isMapping(value) {
788
575
  return typeof value === "object" && value !== null && !Array.isArray(value);
789
576
  }
790
- function describeValue2(value) {
577
+ function describeValue(value) {
791
578
  if (typeof value === "string")
792
579
  return JSON.stringify(value);
793
580
  if (value === null)
@@ -798,7 +585,7 @@ function describeValue2(value) {
798
585
  return "a mapping";
799
586
  return String(value);
800
587
  }
801
- function messageOf3(error) {
588
+ function messageOf2(error) {
802
589
  return error instanceof Error ? error.message : String(error);
803
590
  }
804
591
  function planIssue(reason, line, text) {
@@ -930,10 +717,10 @@ function unusableText(field, value) {
930
717
  return `${subject} is empty; a value opening with # after a space is a YAML comment unless quoted`;
931
718
  }
932
719
  if (field === "release") {
933
- return `${subject} is ${describeValue2(value)}, not one of ${PLAN_RELEASE_LEVELS.join(", ")}`;
720
+ return `${subject} is ${describeValue(value)}, not one of ${PLAN_RELEASE_LEVELS.join(", ")}`;
934
721
  }
935
722
  if (typeof value !== "string") {
936
- return field === "issue" ? `${subject} is ${describeValue2(value)}, not a string or a whole number; quote it` : `${subject} is ${describeValue2(value)}, not a string; quote it`;
723
+ return field === "issue" ? `${subject} is ${describeValue(value)}, not a string or a whole number; quote it` : `${subject} is ${describeValue(value)}, not a string; quote it`;
937
724
  }
938
725
  if (value.trim().length === 0)
939
726
  return `${subject} is blank`;
@@ -977,13 +764,13 @@ function readHeader(block) {
977
764
  try {
978
765
  document = Bun.YAML.parse(block.body);
979
766
  } catch (error) {
980
- const text = `rafa:plan block is not valid YAML (${messageOf3(error)})`;
767
+ const text = `rafa:plan block is not valid YAML (${messageOf2(error)})`;
981
768
  return { header: emptyHeader(), issues: [planIssue("malformed-header", line, text)] };
982
769
  }
983
770
  if (document === null)
984
771
  return { header: emptyHeader(), issues: [] };
985
- if (!isMapping2(document)) {
986
- const text = `rafa:plan block holds ${describeValue2(document)}, not a mapping of fields`;
772
+ if (!isMapping(document)) {
773
+ const text = `rafa:plan block holds ${describeValue(document)}, not a mapping of fields`;
987
774
  return { header: emptyHeader(), issues: [planIssue("malformed-header", line, text)] };
988
775
  }
989
776
  return readFields(document, line);
@@ -1113,4 +900,4 @@ function renderInjection(request) {
1113
900
  }
1114
901
  return { requested: mode, mode, text: RENDERERS[mode](model, location.task), fallback: null };
1115
902
  }
1116
- export { isStampableStub, planStubFromPrompt, stampPrompt, planStubFromPath, REPORT_STATUSES, FINDING_KINDS, FINDING_SIGNALS, CHANGE_LEVELS, parseReport, escapeBlockerText, splitBlockerComment, findNextTask, updateTrackerLine, writeTrackerBlocker, trackerPathFor, PLAN_BLOCK_KINDS, PLAN_HEADER_FIELDS, parsePlan, parsePrerequisites, planPrerequisites, malformedPrerequisiteLines, mergePlanPrerequisites, prerequisitesPathForPlan, loadPlanPrerequisites, PROBE_TIMEOUT_MS, runShellProbe, runPreflight, renderInjection };
903
+ export { isStampableStub, planStubFromPrompt, stampPrompt, planStubFromPath, escapeBlockerText, splitBlockerComment, findNextTask, updateTrackerLine, writeTrackerBlocker, trackerPathFor, PLAN_BLOCK_KINDS, PLAN_HEADER_FIELDS, parsePlan, parsePrerequisites, planPrerequisites, malformedPrerequisiteLines, mergePlanPrerequisites, prerequisitesPathForPlan, loadPlanPrerequisites, PROBE_TIMEOUT_MS, runShellProbe, runPreflight, renderInjection };
@@ -4,10 +4,10 @@ import {
4
4
  commandSpelling,
5
5
  isRoutingWord,
6
6
  isTopLevel
7
- } from "./index-p901zs2p.js";
7
+ } from "./index-vg7ycs94.js";
8
8
  import {
9
9
  describeValue
10
- } from "./index-n3rw8rhr.js";
10
+ } from "./index-cedghpva.js";
11
11
 
12
12
  // src/cli/registry.ts
13
13
  var REFUSAL = "command registry";