dorfl 0.8.1 → 0.10.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 (58) hide show
  1. package/dist/cli.d.ts.map +1 -1
  2. package/dist/cli.js +70 -26
  3. package/dist/cli.js.map +1 -1
  4. package/dist/config.d.ts +82 -7
  5. package/dist/config.d.ts.map +1 -1
  6. package/dist/config.js +14 -2
  7. package/dist/config.js.map +1 -1
  8. package/dist/do.d.ts +16 -1
  9. package/dist/do.d.ts.map +1 -1
  10. package/dist/do.js +14 -9
  11. package/dist/do.js.map +1 -1
  12. package/dist/env-config.d.ts.map +1 -1
  13. package/dist/env-config.js +25 -3
  14. package/dist/env-config.js.map +1 -1
  15. package/dist/gc.d.ts +17 -0
  16. package/dist/gc.d.ts.map +1 -1
  17. package/dist/gc.js +75 -2
  18. package/dist/gc.js.map +1 -1
  19. package/dist/git.d.ts +20 -0
  20. package/dist/git.d.ts.map +1 -1
  21. package/dist/git.js +155 -8
  22. package/dist/git.js.map +1 -1
  23. package/dist/intake-trigger-template.d.ts +91 -53
  24. package/dist/intake-trigger-template.d.ts.map +1 -1
  25. package/dist/intake-trigger-template.js +213 -114
  26. package/dist/intake-trigger-template.js.map +1 -1
  27. package/dist/intake.d.ts +53 -4
  28. package/dist/intake.d.ts.map +1 -1
  29. package/dist/intake.js +59 -15
  30. package/dist/intake.js.map +1 -1
  31. package/dist/placement.d.ts +42 -33
  32. package/dist/placement.d.ts.map +1 -1
  33. package/dist/placement.js +20 -17
  34. package/dist/placement.js.map +1 -1
  35. package/dist/repo-config.d.ts +1 -1
  36. package/dist/repo-config.d.ts.map +1 -1
  37. package/dist/repo-config.js +35 -0
  38. package/dist/repo-config.js.map +1 -1
  39. package/dist/tasking.d.ts +43 -0
  40. package/dist/tasking.d.ts.map +1 -1
  41. package/dist/tasking.js +39 -19
  42. package/dist/tasking.js.map +1 -1
  43. package/dist/workspace.d.ts.map +1 -1
  44. package/dist/workspace.js +64 -21
  45. package/dist/workspace.js.map +1 -1
  46. package/package.json +1 -1
  47. package/src/cli.ts +83 -29
  48. package/src/config.ts +96 -9
  49. package/src/do.ts +30 -10
  50. package/src/env-config.ts +25 -3
  51. package/src/gc.ts +95 -2
  52. package/src/git.ts +180 -8
  53. package/src/intake-trigger-template.ts +263 -143
  54. package/src/intake.ts +136 -18
  55. package/src/placement.ts +42 -36
  56. package/src/repo-config.ts +35 -0
  57. package/src/tasking.ts +66 -41
  58. package/src/workspace.ts +74 -20
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,OAAO,EAAS,MAAM,WAAW,CAAC;AAmH1C,OAAO,EAAiB,KAAK,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAwCvE,OAAO,EAAgB,KAAK,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AA2xB5E;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC/B,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,OAAO,GACb,MAAM,CAoCR;AA6RD,wBAAgB,YAAY,IAAI,OAAO,CA04GtC;AAaD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACpC,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,OAAO,GACZ,MAAM,CAyBR;AA+FD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,MAAM,CAAC,IAAI,GAAE,MAAM,EAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBzE"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,OAAO,EAAS,MAAM,WAAW,CAAC;AAmH1C,OAAO,EAAiB,KAAK,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAwCvE,OAAO,EAAgB,KAAK,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AA+xB5E;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC/B,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,OAAO,GACb,MAAM,CAoCR;AA6RD,wBAAgB,YAAY,IAAI,OAAO,CA47GtC;AAaD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACpC,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,OAAO,GACZ,MAAM,CAyBR;AA+FD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,MAAM,CAAC,IAAI,GAAE,MAAM,EAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBzE"}
package/dist/cli.js CHANGED
@@ -256,11 +256,13 @@ function buildRegistrySetAdvanceTick(options) {
256
256
  // The per-TRANSITION TASKING override: the `do spec:` tasking path threads
257
257
  // `taskingIntegration ?? integration`; the build path stays on `integration`.
258
258
  taskingIntegration: config.taskingIntegration,
259
- // The TASK-PLACEMENT configured default (`do spec:` tasking output:
259
+ // The TASK-PLACEMENT configured defaults (`do spec:` tasking output:
260
260
  // `backlog` staged vs `ready` pool). No operator flag on this
261
- // registry-driven advance context, so only the configured default rung is
262
- // threaded (the resolver still layers untrusted-origin force + built-in floor).
261
+ // registry-driven advance context, so only the configured default rungs
262
+ // are threaded (trusted + the untrusted twin the tasker selects from the
263
+ // spec's stamp; the resolver layers the built-in floor).
263
264
  tasksLandIn: config.tasksLandIn,
265
+ untrustedTasksLandIn: config.untrustedTasksLandIn,
264
266
  prepare: config.prepare,
265
267
  verify: config.verify,
266
268
  // Single-job build path: gate the REBASED tip (the default) unconditionally.
@@ -449,8 +451,8 @@ function explicitSpecsLandInFromFlag(raw, flagName = '--specs-land-in') {
449
451
  if (raw === undefined) {
450
452
  return undefined;
451
453
  }
452
- if (raw !== 'pre-proposed' && raw !== 'ready') {
453
- throw new Error(`${flagName} must be 'pre-proposed' or 'ready' (got '${raw}').`);
454
+ if (raw !== 'proposed' && raw !== 'ready') {
455
+ throw new Error(`${flagName} must be 'proposed' or 'ready' (got '${raw}').`);
454
456
  }
455
457
  return raw;
456
458
  }
@@ -1629,10 +1631,12 @@ export function buildProgram() {
1629
1631
  explicitMerge: flagMode === 'merge',
1630
1632
  // Per-TRANSITION TASKING override (the `do --remote spec:` tasking path).
1631
1633
  taskingIntegration: remoteConfig.taskingIntegration,
1632
- // TASK-PLACEMENT: the configured default + the EXPLICIT operator override
1633
- // (`--tasks-land-in`), the top of the placement precedence mirrors
1634
- // `explicitMerge` (set only when the flag was typed).
1634
+ // TASK-PLACEMENT: the configured defaults (trusted + the untrusted twin
1635
+ // the tasker selects from the spec's stamp) + the EXPLICIT operator
1636
+ // override (`--tasks-land-in`), the top of the placement precedence
1637
+ // mirrors `explicitMerge` (set only when the flag was typed).
1635
1638
  tasksLandIn: remoteConfig.tasksLandIn,
1639
+ untrustedTasksLandIn: remoteConfig.untrustedTasksLandIn,
1636
1640
  explicitTasksLandIn: explicitTasksLandInFromFlag(flags.tasksLandIn),
1637
1641
  prepare: remoteConfig.prepare,
1638
1642
  verify: remoteConfig.verify,
@@ -1795,12 +1799,13 @@ export function buildProgram() {
1795
1799
  // `taskingIntegration ?? integration`; the task-build path stays on
1796
1800
  // `integration`. Unset ⇒ tasking falls back to `integration` (today's behaviour).
1797
1801
  taskingIntegration: config.taskingIntegration,
1798
- // TASK-PLACEMENT (`do spec:` tasking output): the configured default rung +
1802
+ // TASK-PLACEMENT (`do spec:` tasking output): the configured default rungs
1803
+ // (trusted + the untrusted twin the tasker selects from the spec's stamp) +
1799
1804
  // the EXPLICIT operator override `--tasks-land-in` (top of the precedence).
1800
1805
  // `explicitTasksLandIn` is set ONLY when the flag was typed (mirrors
1801
- // `explicitMerge`), so an untrusted-origin staging force still wins under a
1802
- // config default.
1806
+ // `explicitMerge`).
1803
1807
  tasksLandIn: config.tasksLandIn,
1808
+ untrustedTasksLandIn: config.untrustedTasksLandIn,
1804
1809
  explicitTasksLandIn: explicitTasksLandInFromFlag(flags.tasksLandIn),
1805
1810
  // In-place divergence guard override (mirrors --ignore-not-ready).
1806
1811
  ignoreDivergedMain: flags.ignoreDivergedMain === true,
@@ -2062,9 +2067,10 @@ export function buildProgram() {
2062
2067
  explicitMerge: flagMode === 'merge',
2063
2068
  // Per-TRANSITION TASKING override (the isolated `do --remote spec:` path).
2064
2069
  taskingIntegration: remoteConfig.taskingIntegration,
2065
- // TASK-PLACEMENT: configured default + EXPLICIT `--tasks-land-in` override
2066
- // (set only when typed, mirroring `explicitMerge`).
2070
+ // TASK-PLACEMENT: configured defaults (trusted + untrusted twin) + EXPLICIT
2071
+ // `--tasks-land-in` override (set only when typed, mirroring `explicitMerge`).
2067
2072
  tasksLandIn: remoteConfig.tasksLandIn,
2073
+ untrustedTasksLandIn: remoteConfig.untrustedTasksLandIn,
2068
2074
  explicitTasksLandIn: explicitTasksLandInFromFlag(flags.tasksLandIn),
2069
2075
  prepare: remoteConfig.prepare,
2070
2076
  verify: remoteConfig.verify,
@@ -2201,9 +2207,10 @@ export function buildProgram() {
2201
2207
  // Per-TRANSITION TASKING override (the `do spec:` tasking path threads
2202
2208
  // `taskingIntegration ?? integration`; the build path stays on `integration`).
2203
2209
  taskingIntegration: config.taskingIntegration,
2204
- // TASK-PLACEMENT: configured default + EXPLICIT `--tasks-land-in` override
2205
- // (set only when typed, mirroring `explicitMerge`).
2210
+ // TASK-PLACEMENT: configured defaults (trusted + untrusted twin) + EXPLICIT
2211
+ // `--tasks-land-in` override (set only when typed, mirroring `explicitMerge`).
2206
2212
  tasksLandIn: config.tasksLandIn,
2213
+ untrustedTasksLandIn: config.untrustedTasksLandIn,
2207
2214
  explicitTasksLandIn: explicitTasksLandInFromFlag(flags.tasksLandIn),
2208
2215
  prepare: config.prepare,
2209
2216
  verify: config.verify,
@@ -2534,7 +2541,13 @@ export function buildProgram() {
2534
2541
  for (const retained of result.retained) {
2535
2542
  console.log(` [retained] ${retained.slug} \u2014 ${RETAIN_REASON_TEXT[retained.reason]}`);
2536
2543
  }
2537
- console.log(`Summary: ${result.reaped.length} reaped, ${result.retained.length} retained.`);
2544
+ for (const orphan of result.sweptOrphans) {
2545
+ console.log(` [swept] ${orphan.dir} \u2014 ${orphan.kind}`);
2546
+ }
2547
+ const orphanNote = result.sweptOrphans.length > 0
2548
+ ? `, ${result.sweptOrphans.length} orphan(s) swept`
2549
+ : '';
2550
+ console.log(`Summary: ${result.reaped.length} reaped, ${result.retained.length} retained${orphanNote}.`);
2538
2551
  });
2539
2552
  // `dorfl sync`: bring an already-onboarded repo up to the CURRENT protocol.
2540
2553
  // Always re-syncs `work/protocol/*` + bumps VERSION (the deterministic slice of
@@ -2995,7 +3008,8 @@ export function buildProgram() {
2995
3008
  .option('--merge-task', 'integrate a task outcome in merge mode (granular; overrides --merge/--propose for a task; mutually exclusive with --propose-task)')
2996
3009
  .option('--propose-task', 'integrate a task outcome in propose mode (granular; overrides --merge/--propose for a task; mutually exclusive with --merge-task)')
2997
3010
  .option('--origin-trust <trusted|untrusted>', "the author-trust verdict to STAMP onto the emitted spec/task (origin: issue + originTrust: <value>), so an untrusted origin survives the merge boundary and later forces the task's BUILD transition to propose. CI's intake.yml derives it from the SAME author_association case as the integration flags. UNSET (a local intake) ⇒ emitted unstamped (human/trusted) — the human running intake IS the checkpoint.")
2998
- .option('--specs-land-in <where>', 'where an intake-authored spec lands: `pre-proposed` (staged, not auto-taskable) or `ready` (the auto-tasking pool). The EXPLICIT operator override at the top of the placement precedence (explicit flag > untrusted-origin forces staging > specsLandIn default > built-in). Resolved flag > env (DORFL_SPECS_LAND_IN) > per-repo > global > built-in.')
3011
+ .option('--specs-land-in <where>', 'where an intake-authored spec lands: `proposed` (staged, not auto-taskable) or `ready` (the auto-tasking pool). The EXPLICIT operator override at the top of the placement precedence (explicit flag > untrusted-origin forces staging > specsLandIn default > built-in). Resolved flag > env (DORFL_SPECS_LAND_IN) > per-repo > global > built-in.')
3012
+ .option('--tasks-land-in <where>', 'where an intake-authored TASK (emitted DIRECTLY from an issue) lands: `backlog` (staged, not agent-eligible) or `ready` (the agent POOL). The task twin of --specs-land-in: the EXPLICIT operator override at the top of the placement precedence (explicit flag > configured default > built-in staging; the caller selects the trusted-vs-untrusted default from the origin-trust stamp). Resolved flag > env (DORFL_TASKS_LAND_IN) > per-repo > global > built-in.')
2999
3013
  .option('--agent-cmd <cmd>', 'command to run the decision agent')
3000
3014
  .option('--model <id>', 'model the decision agent runs on (routing intent; resolved flag > env > per-repo > global > default)')
3001
3015
  .option('--harness <adapter>', 'harness adapter that launches the decision agent: null (default) or pi')
@@ -3028,14 +3042,18 @@ export function buildProgram() {
3028
3042
  // Resolve the PER-OUTCOME integration modes (spec US #9): `intake` decides
3029
3043
  // the artifact TYPE at runtime, so a single --merge/--propose can't express
3030
3044
  // a type-conditional policy. The granular flags override the aggregate; an
3031
- // UNSET type falls back to the per-repo/global `integration` (the SAME chain
3032
- // `do`/`complete` use — flag > per-repo > global > default propose). `intake`
3033
- // is GATE-FREE, so autoTask/autoBuild are NOT consulted (the explicit
3034
- // invocation is its own authorization). `intake` owns only these KNOBS; WHICH
3035
- // knobs CI sets is CI's POLICY (`runner-in-ci`), NOT here.
3045
+ // UNSET type falls back to the per-repo/global `intakeIntegration ??
3046
+ // integration` (the INTAKE-DOCUMENT knob, twin of the tasking path's
3047
+ // `taskingIntegration ?? integration`; spec
3048
+ // `intake-integration-knob-and-specs-land-in-proposed-rename`). DECOUPLED
3049
+ // from the autonomy gates: `intake` is GATE-FREE, so autoTask/autoBuild are
3050
+ // NOT consulted for the document mode (the explicit invocation is its own
3051
+ // authorization; ADR untrusted-origin-carries-via-stamp-not-forced-staging).
3052
+ // `intake` owns only these KNOBS; WHICH knobs CI sets is CI's POLICY
3053
+ // (`runner-in-ci`), NOT here.
3036
3054
  let modes;
3037
3055
  try {
3038
- modes = resolveIntakeIntegrationModes(flags, config.integration);
3056
+ modes = resolveIntakeIntegrationModes(flags, config.intakeIntegration ?? config.integration);
3039
3057
  }
3040
3058
  catch (err) {
3041
3059
  console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
@@ -3071,6 +3089,18 @@ export function buildProgram() {
3071
3089
  console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
3072
3090
  process.exit(1);
3073
3091
  }
3092
+ // The OPERATOR's EXPLICIT task-placement override (`--tasks-land-in`), the
3093
+ // TOP of the placement precedence for a DIRECT-from-issue task emit — the
3094
+ // task twin of `explicitSpecsLandIn` above (reuses the same `do`-path
3095
+ // helper). Fails loudly on a bad value.
3096
+ let explicitTasksLandIn;
3097
+ try {
3098
+ explicitTasksLandIn = explicitTasksLandInFromFlag(flags.tasksLandIn);
3099
+ }
3100
+ catch (err) {
3101
+ console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
3102
+ process.exit(1);
3103
+ }
3074
3104
  const result = await performIntake({
3075
3105
  issueNumber,
3076
3106
  cwd,
@@ -3086,11 +3116,25 @@ export function buildProgram() {
3086
3116
  // The origin-trust stamp the CI shell passes IN (unset ⇒ unstamped).
3087
3117
  originTrust,
3088
3118
  noPR: config.noPR,
3089
- // SPEC-PLACEMENT: the configured-default `specsLandIn` rung + the EXPLICIT
3090
- // `--specs-land-in` override (top of the precedence). The shared placement
3091
- // resolver in `intake.ts` overlays the untrusted-origin staging force.
3119
+ // SPEC-PLACEMENT: the TRUSTED-side configured default (`specsLandIn`) +
3120
+ // the UNTRUSTED-side twin (`untrustedSpecsLandIn`, selected in
3121
+ // `dispatchSpec` when the stamp is untrusted) + the EXPLICIT
3122
+ // `--specs-land-in` override (top of the precedence). The placement
3123
+ // resolver no longer has an untrusted-forces-staging rung (ADR
3124
+ // `untrusted-origin-carries-via-stamp-not-forced-staging`); the caller
3125
+ // selects the trusted-vs-untrusted default from the stamp.
3092
3126
  specsLandIn: config.specsLandIn,
3127
+ untrustedSpecsLandIn: config.untrustedSpecsLandIn,
3093
3128
  explicitSpecsLandIn,
3129
+ // TASK-PLACEMENT (parity with the spec-placement block above; ADR
3130
+ // `untrusted-origin-carries-via-stamp-not-forced-staging`): the
3131
+ // TRUSTED-side default (`tasksLandIn`) + the UNTRUSTED-side twin
3132
+ // (`untrustedTasksLandIn`, selected in `dispatchTask` when the stamp is
3133
+ // untrusted) + the EXPLICIT `--tasks-land-in` override. Replaces the old
3134
+ // hardcoded `tasks-ready` path; the resolver picks backlog vs ready.
3135
+ tasksLandIn: config.tasksLandIn,
3136
+ untrustedTasksLandIn: config.untrustedTasksLandIn,
3137
+ explicitTasksLandIn,
3094
3138
  harness,
3095
3139
  agentCmd: config.agentCmd,
3096
3140
  model: config.model,