@clemrig/factory 0.8.0 → 0.10.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 (78) hide show
  1. package/README.md +26 -10
  2. package/dist/app/board.js +44 -9
  3. package/dist/app/board.js.map +1 -1
  4. package/dist/app/define.d.ts +3 -3
  5. package/dist/app/define.js +15 -9
  6. package/dist/app/define.js.map +1 -1
  7. package/dist/app/run.d.ts +1 -1
  8. package/dist/app/run.js +4 -3
  9. package/dist/app/run.js.map +1 -1
  10. package/dist/app/workflows/implement.d.ts +1 -6
  11. package/dist/app/workflows/implement.js +41 -593
  12. package/dist/app/workflows/implement.js.map +1 -1
  13. package/dist/app/workflows/stages/agents.d.ts +34 -0
  14. package/dist/app/workflows/stages/agents.js +93 -0
  15. package/dist/app/workflows/stages/agents.js.map +1 -0
  16. package/dist/app/workflows/stages/choose.d.ts +13 -0
  17. package/dist/app/workflows/stages/choose.js +107 -0
  18. package/dist/app/workflows/stages/choose.js.map +1 -0
  19. package/dist/app/workflows/stages/deliver.d.ts +18 -0
  20. package/dist/app/workflows/stages/deliver.js +167 -0
  21. package/dist/app/workflows/stages/deliver.js.map +1 -0
  22. package/dist/app/workflows/stages/implement.d.ts +5 -0
  23. package/dist/app/workflows/stages/implement.js +42 -0
  24. package/dist/app/workflows/stages/implement.js.map +1 -0
  25. package/dist/app/workflows/stages/plan.d.ts +7 -0
  26. package/dist/app/workflows/stages/plan.js +34 -0
  27. package/dist/app/workflows/stages/plan.js.map +1 -0
  28. package/dist/app/workflows/stages/prepare.d.ts +14 -0
  29. package/dist/app/workflows/stages/prepare.js +195 -0
  30. package/dist/app/workflows/stages/prepare.js.map +1 -0
  31. package/dist/app/workflows/stages/resume.d.ts +7 -0
  32. package/dist/app/workflows/stages/resume.js +54 -0
  33. package/dist/app/workflows/stages/resume.js.map +1 -0
  34. package/dist/app/workflows/stages/review.d.ts +16 -0
  35. package/dist/app/workflows/stages/review.js +103 -0
  36. package/dist/app/workflows/stages/review.js.map +1 -0
  37. package/dist/app/workflows/stages/run.d.ts +60 -0
  38. package/dist/app/workflows/stages/run.js +16 -0
  39. package/dist/app/workflows/stages/run.js.map +1 -0
  40. package/dist/app/workflows/stages/verify.d.ts +11 -0
  41. package/dist/app/workflows/stages/verify.js +47 -0
  42. package/dist/app/workflows/stages/verify.js.map +1 -0
  43. package/dist/app/workflows/tidy.d.ts +7 -0
  44. package/dist/app/workflows/tidy.js +79 -0
  45. package/dist/app/workflows/tidy.js.map +1 -0
  46. package/dist/cli/help.d.ts +1 -1
  47. package/dist/cli/help.js +4 -3
  48. package/dist/cli/help.js.map +1 -1
  49. package/dist/domain/board.d.ts +18 -3
  50. package/dist/domain/board.js +24 -10
  51. package/dist/domain/board.js.map +1 -1
  52. package/dist/domain/definition.d.ts +6 -1
  53. package/dist/domain/definition.js +3 -0
  54. package/dist/domain/definition.js.map +1 -1
  55. package/dist/domain/plan.d.ts +1 -1
  56. package/dist/domain/plan.js +1 -1
  57. package/dist/domain/spec.d.ts +1 -0
  58. package/dist/domain/spec.js +3 -0
  59. package/dist/domain/spec.js.map +1 -1
  60. package/dist/domain/tidy.d.ts +58 -0
  61. package/dist/domain/tidy.js +57 -0
  62. package/dist/domain/tidy.js.map +1 -0
  63. package/dist/system/factory.js +4 -3
  64. package/dist/system/factory.js.map +1 -1
  65. package/dist/system/git.d.ts +16 -2
  66. package/dist/system/git.js +52 -3
  67. package/dist/system/git.js.map +1 -1
  68. package/dist/system/github.d.ts +14 -0
  69. package/dist/system/github.js +38 -0
  70. package/dist/system/github.js.map +1 -1
  71. package/dist/system/lock.js +1 -1
  72. package/dist/system/lock.js.map +1 -1
  73. package/package.json +2 -2
  74. package/prompts/{implement/review.md → review.md} +18 -7
  75. package/prompts/scout.md +53 -0
  76. /package/prompts/{implement/describe.md → describe.md} +0 -0
  77. /package/prompts/{implement/implement.md → implement.md} +0 -0
  78. /package/prompts/{implement/plan.md → plan.md} +0 -0
@@ -0,0 +1,79 @@
1
+ import { defineWorkflow, END, node, retry } from "@clemrig/flow";
2
+ import { TIDY } from "../../domain/tidy.js";
3
+ import { commitSpec, judgeChoice, release, scout, survey, tidyResult, } from "./stages/choose.js";
4
+ import { attach, deliver, describer, judgeDescription, } from "./stages/deliver.js";
5
+ import { implementer, judgeImplementation } from "./stages/implement.js";
6
+ import { commitPlan, judgePlan, planner } from "./stages/plan.js";
7
+ import { prepareTidy } from "./stages/prepare.js";
8
+ import { resumeProblem } from "./stages/resume.js";
9
+ import { diff, judgeReview, reviewer } from "./stages/review.js";
10
+ import { verify } from "./stages/verify.js";
11
+ /**
12
+ * Chooses the cleanup of the code that comes first, recent code first, and
13
+ * writes it as an issue with its spec; then plans, implements, checks and
14
+ * reviews it like any issue, and describes it in the pull request it opens.
15
+ */
16
+ export function tidy(definition) {
17
+ const { profiles } = definition;
18
+ return defineWorkflow({
19
+ name: TIDY,
20
+ maxCostUsd: definition.maxCostUsd,
21
+ initial: "prepare",
22
+ nodes: {
23
+ prepare: node(prepareTidy(definition.verify), {
24
+ ready: "survey",
25
+ // A cleanup still waits for the operator: one at a time.
26
+ waiting: END,
27
+ }),
28
+ survey: node(survey, { ok: "scout" }),
29
+ // The scout explores the code read-only, as the planning agent does.
30
+ scout: node(scout(profiles.plan), { ok: "scouted" }),
31
+ scouted: node(judgeChoice, {
32
+ chosen: "commit-spec",
33
+ nothing: "release",
34
+ invalid: retry("scout", 2),
35
+ }),
36
+ release: node(release, { ok: END }),
37
+ "commit-spec": node(commitSpec, { ok: "plan" }),
38
+ plan: node(planner(profiles.plan), { ok: "planned" }),
39
+ planned: node(judgePlan, {
40
+ ok: "commit-plan",
41
+ invalid: retry("plan", 2),
42
+ }),
43
+ "commit-plan": node(commitPlan, { ok: "implement" }),
44
+ implement: node(implementer(profiles.implement), { ok: "implemented" }),
45
+ implemented: node(judgeImplementation, {
46
+ ok: "verify",
47
+ invalid: retry("implement", 2),
48
+ }),
49
+ verify: node(verify(definition.verify), {
50
+ passed: "diff",
51
+ failed: retry("implement", 3),
52
+ }),
53
+ diff: node(diff, { ok: "review" }),
54
+ review: node(reviewer(profiles.review), {
55
+ ok: "reviewed",
56
+ modified: retry("review", 1),
57
+ }),
58
+ reviewed: node(judgeReview, {
59
+ approved: "describe",
60
+ changes: retry("implement", 2),
61
+ invalid: retry("review", 2),
62
+ }),
63
+ describe: node(describer(profiles.describe ?? profiles.review), {
64
+ ok: "described",
65
+ modified: retry("describe", 1),
66
+ }),
67
+ described: node(judgeDescription, {
68
+ ok: "deliver",
69
+ invalid: retry("describe", 2),
70
+ }),
71
+ deliver: node(deliver, { done: END, attach: "attach" }),
72
+ attach: node(attach, { ok: END }),
73
+ },
74
+ resumeProblem,
75
+ // Also called for a failed run, which opened no pull request.
76
+ presentResult: tidyResult,
77
+ });
78
+ }
79
+ //# sourceMappingURL=tidy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tidy.js","sourceRoot":"","sources":["../../../src/app/workflows/tidy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EACL,UAAU,EACV,WAAW,EACX,OAAO,EACP,KAAK,EACL,MAAM,EACN,UAAU,GACX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,MAAM,EACN,OAAO,EACP,SAAS,EACT,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,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,CAAC,CAAC;aAC9B,CAAC;YACF,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;YACvD,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC;SAClC;QACD,aAAa;QACb,8DAA8D;QAC9D,aAAa,EAAE,UAAU;KAC1B,CAAC,CAAC;AACL,CAAC"}
@@ -1 +1 @@
1
- export declare const help = "factory \u2014 this repository's issues, from spec to pull request, with .factory/\n\n factory init create .factory/ here and install it\n factory doctor [--json] check Node, workflows, prompts and runtimes\n factory run WORKFLOW [--INPUT VALUE\u2026] [--max-cost-usd USD] [--json]\n factory resume RUN_ID [--max-cost-usd USD] [--accept-review] [--json]\n factory status [RUN_ID] [--json] list this repository's runs, or show one\n factory ui [--port N] serve the live read-only Kanban, runs under /runs/\n\nCommands other than init and help use the nearest .factory/ in the current directory\nor a parent, with the factory version installed there. factory doctor lists each\nworkflow's input options. factory run issue-save saves an issue or its spec;\nfactory run implement --issue SLUG takes a pushed spec to a pull request.\n.factory/.env is loaded; shell variables take precedence.\n--max-cost-usd fails the run once its agents' announced cost exceeds it, instead\nof the workflow's maxCostUsd. --json writes events, then the result, as JSON lines.\nCtrl-C stops a run, which ends failed; press it again to quit at once.\nfactory resume starts a failed run again at the stage where it stopped, with its\ndata and its agents' conversations; a run stopped at a maximum of corrections gets\none more. --accept-review delivers an implement run its review stopped by asking\nfor changes, with what it still asks for shown open in the pull request.\nExit codes: 0 completed, 1 error or failed run, 130 second Ctrl-C.\n";
1
+ export declare const help = "factory \u2014 this repository's issues, from spec to pull request, with .factory/\n\n factory init create .factory/ here and install it\n factory doctor [--json] check Node, workflows, prompts and runtimes\n factory run WORKFLOW [--INPUT VALUE\u2026] [--max-cost-usd USD] [--json]\n factory resume RUN_ID [--max-cost-usd USD] [--accept-review] [--json]\n factory status [RUN_ID] [--json] list this repository's runs, or show one\n factory ui [--port N] serve the live read-only Kanban, runs under /runs/\n\nCommands other than init and help use the nearest .factory/ in the current directory\nor a parent, with the factory version installed there. factory doctor lists each\nworkflow's input options. factory run issue-save saves an issue or its spec;\nfactory run implement --issue SLUG takes a pushed spec to a pull request;\nfactory run tidy chooses a cleanup of recent code and takes it to a pull request.\n.factory/.env is loaded; shell variables take precedence.\n--max-cost-usd fails the run once its agents' announced cost exceeds it, instead\nof the workflow's maxCostUsd. --json writes events, then the result, as JSON lines.\nCtrl-C stops a run, which ends failed; press it again to quit at once.\nfactory resume starts a failed run again at the stage where it stopped, with its\ndata and its agents' conversations; a run stopped at a maximum of corrections gets\none more. --accept-review delivers an implement or tidy run its review stopped by\nasking for changes, with what it still asks for shown open in the pull request.\nExit codes: 0 completed, 1 error or failed run, 130 second Ctrl-C.\n";
package/dist/cli/help.js CHANGED
@@ -10,15 +10,16 @@ export const help = `factory — this repository's issues, from spec to pull req
10
10
  Commands other than init and help use the nearest .factory/ in the current directory
11
11
  or a parent, with the factory version installed there. factory doctor lists each
12
12
  workflow's input options. factory run issue-save saves an issue or its spec;
13
- factory run implement --issue SLUG takes a pushed spec to a pull request.
13
+ factory run implement --issue SLUG takes a pushed spec to a pull request;
14
+ factory run tidy chooses a cleanup of recent code and takes it to a pull request.
14
15
  .factory/.env is loaded; shell variables take precedence.
15
16
  --max-cost-usd fails the run once its agents' announced cost exceeds it, instead
16
17
  of the workflow's maxCostUsd. --json writes events, then the result, as JSON lines.
17
18
  Ctrl-C stops a run, which ends failed; press it again to quit at once.
18
19
  factory resume starts a failed run again at the stage where it stopped, with its
19
20
  data and its agents' conversations; a run stopped at a maximum of corrections gets
20
- one more. --accept-review delivers an implement run its review stopped by asking
21
- for changes, with what it still asks for shown open in the pull request.
21
+ one more. --accept-review delivers an implement or tidy run its review stopped by
22
+ asking for changes, with what it still asks for shown open in the pull request.
22
23
  Exit codes: 0 completed, 1 error or failed run, 130 second Ctrl-C.
23
24
  `;
24
25
  //# sourceMappingURL=help.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/cli/help.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;CAsBnB,CAAC"}
1
+ {"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/cli/help.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuBnB,CAAC"}
@@ -8,6 +8,11 @@ export interface IssueFacts {
8
8
  /** From `issue.md`; the slug when it has no readable title. */
9
9
  title: string;
10
10
  hasSpec: boolean;
11
+ /** The issues its spec depends on, and whether each is delivered: its `plan.md` on the main branch, whatever the working tree holds. */
12
+ dependencies: {
13
+ slug: string;
14
+ delivered: boolean;
15
+ }[];
11
16
  /** Its `plan.md` is on the main branch. */
12
17
  delivered: boolean;
13
18
  /** When one of its files last changed, as an ISO date. */
@@ -17,6 +22,8 @@ export interface IssueFacts {
17
22
  export interface StepProgress {
18
23
  name: string;
19
24
  state: "done" | "current" | "failed" | "pending";
25
+ /** Corrections that sent the run back into the step. */
26
+ retries: number;
20
27
  }
21
28
  /** The last run of a workflow shown for an issue. */
22
29
  export interface RunProgress {
@@ -36,6 +43,8 @@ export interface RunProgress {
36
43
  export interface IssueCard {
37
44
  slug: string;
38
45
  title: string;
46
+ /** The issues it depends on that are not delivered yet. */
47
+ waitsFor: string[];
39
48
  /** The newest pull request its deliveries recorded. */
40
49
  pullRequest?: string;
41
50
  /** The last run of each shown workflow, newest first. */
@@ -53,13 +62,19 @@ export interface IssueBoard {
53
62
  export interface ShownWorkflow {
54
63
  name: string;
55
64
  steps: WorkflowStep[];
65
+ /** The stage each retry edge goes back to, keyed `<stage>.<outcome>` like a run's retries. */
66
+ corrections: Record<string, string>;
56
67
  }
57
68
  /** No status is stored: the column follows from the issue's files, the main branch and its last delivery. */
58
69
  export declare function columnOf(issue: IssueFacts, lastDelivery: Pick<RunState, "status"> | undefined): ColumnName;
59
- /** How far a run went through its workflow's steps; a correction brings its step back. */
60
- export declare function stepsOf(steps: WorkflowStep[], run: Pick<RunState, "stage" | "status">): StepProgress[];
70
+ /**
71
+ * How far a run went through its workflow's steps; a correction brings its
72
+ * step back, and counts among the step's retries.
73
+ */
74
+ export declare function stepsOf({ steps, corrections }: Pick<ShownWorkflow, "steps" | "corrections">, run: Pick<RunState, "stage" | "status" | "retries">): StepProgress[];
61
75
  /**
62
76
  * The Kanban: each issue in its column, the most recently active first, with
63
- * the last run of each shown workflow. `runs` come in creation order.
77
+ * the last run of each shown workflow and the issues it still waits for.
78
+ * `runs` come in creation order.
64
79
  */
65
80
  export declare function boardOf(issues: IssueFacts[], runs: RunState[], shown: ShownWorkflow[], problems: string[]): IssueBoard;
@@ -21,10 +21,14 @@ export function columnOf(issue, lastDelivery) {
21
21
  return "To Approve";
22
22
  return issue.hasSpec ? "Specifying" : "Backlog";
23
23
  }
24
- /** How far a run went through its workflow's steps; a correction brings its step back. */
25
- export function stepsOf(steps, run) {
24
+ /**
25
+ * How far a run went through its workflow's steps; a correction brings its
26
+ * step back, and counts among the step's retries.
27
+ */
28
+ export function stepsOf({ steps, corrections }, run) {
26
29
  const at = steps.findIndex(({ stages }) => stages.includes(run.stage));
27
- return steps.map(({ name }, index) => ({
30
+ const taken = Object.entries(run.retries ?? {});
31
+ return steps.map(({ name, stages }, index) => ({
28
32
  name,
29
33
  state: run.status === "completed" || index < at
30
34
  ? "done"
@@ -33,16 +37,19 @@ export function stepsOf(steps, run) {
33
37
  : run.status === "running"
34
38
  ? "current"
35
39
  : "failed",
40
+ retries: taken
41
+ .filter(([edge]) => stages.includes(corrections[edge] ?? ""))
42
+ .reduce((sum, [, count]) => sum + count, 0),
36
43
  }));
37
44
  }
38
- function progressOf(run, steps) {
45
+ function progressOf(run, workflow) {
39
46
  const { durationMs, costUsd, partial } = summarizeRun(run);
40
47
  return {
41
48
  id: run.id,
42
49
  workflow: run.workflow,
43
50
  status: run.status,
44
51
  stage: run.stage,
45
- steps: stepsOf(steps, run),
52
+ steps: stepsOf(workflow, run),
46
53
  durationMs,
47
54
  costUsd,
48
55
  partial,
@@ -50,7 +57,8 @@ function progressOf(run, steps) {
50
57
  }
51
58
  /**
52
59
  * The Kanban: each issue in its column, the most recently active first, with
53
- * the last run of each shown workflow. `runs` come in creation order.
60
+ * the last run of each shown workflow and the issues it still waits for.
61
+ * `runs` come in creation order.
54
62
  */
55
63
  export function boardOf(issues, runs, shown, problems) {
56
64
  const placed = issues.map((issue) => {
@@ -61,12 +69,12 @@ export function boardOf(issues, runs, shown, problems) {
61
69
  const delivery = last(DELIVERY);
62
70
  const pullRequest = own.map(pullRequestOf).findLast(Boolean);
63
71
  const cardRuns = shown
64
- .flatMap(({ name, steps }) => {
65
- const run = last(name);
66
- return run ? [{ run, steps }] : [];
72
+ .flatMap((workflow) => {
73
+ const run = last(workflow.name);
74
+ return run ? [{ run, workflow }] : [];
67
75
  })
68
76
  .sort((a, b) => b.run.createdAt.localeCompare(a.run.createdAt))
69
- .map(({ run, steps }) => progressOf(run, steps));
77
+ .map(({ run, workflow }) => progressOf(run, workflow));
70
78
  const activity = [issue.changedAt, ...own.map((run) => run.updatedAt)]
71
79
  .sort()
72
80
  .at(-1);
@@ -76,6 +84,12 @@ export function boardOf(issues, runs, shown, problems) {
76
84
  card: {
77
85
  slug: issue.slug,
78
86
  title: issue.title,
87
+ // A delivered issue waits for nothing, whatever became of its dependencies.
88
+ waitsFor: issue.delivered
89
+ ? []
90
+ : issue.dependencies
91
+ .filter(({ delivered }) => !delivered)
92
+ .map(({ slug }) => slug),
79
93
  ...(pullRequest ? { pullRequest } : {}),
80
94
  runs: cardRuns,
81
95
  },
@@ -1 +1 @@
1
- {"version":3,"file":"board.js","sourceRoot":"","sources":["../../src/domain/board.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,YAAY,EAAqB,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE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MAAM,EAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;YACjC,QAAQ,EAAE,QAAQ,IAAI,KAAK,CAAC,SAAS;YACrC,IAAI,EAAE;gBACJ,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,4EAA4E;gBAC5E,QAAQ,EAAE,KAAK,CAAC,SAAS;oBACvB,CAAC,CAAC,EAAE;oBACJ,CAAC,CAAC,KAAK,CAAC,YAAY;yBACf,MAAM,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC;yBACrC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC;gBAC9B,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvC,IAAI,EAAE,QAAQ;aACf;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC9B,IAAI;YACJ,KAAK,EAAE,MAAM;iBACV,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,KAAK,IAAI,CAAC;iBACvC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;iBACpD,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC;SAC3B,CAAC,CAAC;QACH,QAAQ;KACT,CAAC;AACJ,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { type AgentProfile, type Workflow } from "@clemrig/flow";
2
2
  import type { VerifyCommand } from "./verification.js";
3
- /** What a repository decides: its checks, its budget per run, its agents and its own workflows. */
3
+ /** What a repository decides: its checks, its budgets per run, its agents and its own workflows. */
4
4
  export interface FactoryDefinition {
5
5
  verify: VerifyCommand[];
6
6
  maxCostUsd: number;
@@ -11,6 +11,11 @@ export interface FactoryDefinition {
11
11
  /** The agent that writes the pull request; the review's when absent. */
12
12
  describe?: AgentProfile;
13
13
  };
14
+ /** The `tidy` workflow's settings. */
15
+ tidy?: {
16
+ /** Its budget per run; the `implement` run's when absent. */
17
+ maxCostUsd?: number;
18
+ };
14
19
  /** The repository's own workflows, beside the factory's. */
15
20
  workflows?: Workflow[];
16
21
  }
@@ -19,6 +19,9 @@ const definition = z.strictObject({
19
19
  review: profile,
20
20
  describe: profile.optional(),
21
21
  }),
22
+ tidy: z
23
+ .strictObject({ maxCostUsd: z.number().positive().optional() })
24
+ .optional(),
22
25
  // Each workflow is checked where the factory loads them.
23
26
  workflows: z.array(z.unknown()).optional(),
24
27
  });
@@ -1 +1 @@
1
- {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../src/domain/definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,CAAC,EAAE,MAAM,eAAe,CAAC;AAkBpE,uFAAuF;AACvF,MAAM,OAAO,GAAG,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;AAElC,MAAM,UAAU,GAAG,CAAC,CAAC,YAAY,CAAC;IAChC,MAAM,EAAE,CAAC;SACN,KAAK,CACJ,CAAC,CAAC,YAAY,CAAC;QACb,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACvB,+DAA+D;QAC/D,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;QACjD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;QACtC,uFAAuF;QACvF,IAAI,EAAE,CAAC,CAAC,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AC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,OAAO,EAAE,CACvD,CAAC;AACR,CAAC"}
@@ -22,6 +22,6 @@ export declare function planProblem(plan: Plan, criteria: Criterion[]): string |
22
22
  export declare function renderPlan(plan: Plan, source: {
23
23
  title: string;
24
24
  specPath: string;
25
- baseCommit: string;
25
+ specCommit: string;
26
26
  }): string;
27
27
  export declare function planCommitMessage(slug: string): string;
@@ -55,7 +55,7 @@ export function renderPlan(plan, source) {
55
55
  const list = (items) => items.length > 0 ? items.map((item) => `- ${item}`).join("\n") : "None.";
56
56
  return `${[
57
57
  `# Plan: ${source.title}`,
58
- `Spec: \`${source.specPath}\` at ${source.baseCommit.slice(0, 7)}`,
58
+ `Spec: \`${source.specPath}\` at ${source.specCommit.slice(0, 7)}`,
59
59
  `## Summary\n\n${plan.summary}`,
60
60
  `## Existing\n\n${existing}`,
61
61
  `## Steps\n\n${steps.join("\n\n")}`,
@@ -16,5 +16,6 @@ export interface Spec {
16
16
  }
17
17
  /** Reads issue `slug`'s spec.md: a `# ` title, then exactly the six sections, in order. */
18
18
  export declare function parseSpec(text: string, slug: string): Parsed<Spec>;
19
+ export declare function specCommitMessage(slug: string): string;
19
20
  /** What is wrong with the criteria a response cites: all of the spec's, no other, and each once if required. */
20
21
  export declare function citationProblem(cited: string[], criteria: Criterion[], once?: boolean): string | undefined;
@@ -133,6 +133,9 @@ function parseDependencies(lines, slug) {
133
133
  }
134
134
  return { dependencies, problems };
135
135
  }
136
+ export function specCommitMessage(slug) {
137
+ return `docs: spec ${slug}`;
138
+ }
136
139
  /** What is wrong with the criteria a response cites: all of the spec's, no other, and each once if required. */
137
140
  export function citationProblem(cited, criteria, once = false) {
138
141
  const ids = criteria.map((criterion) => criterion.id);
@@ -1 +1 @@
1
- {"version":3,"file":"spec.js","sourceRoot":"","sources":["../../src/domain/spec.ts"],"names":[],"mappings":"AAAA,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AE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACtE,MAAM,QAAQ,GAAG,IAAI;QACnB,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC;QACxE,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,QAAQ,GAAG;QACf,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAChE,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAChE,GAAG,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KACpE,CAAC;IACF,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC;QACxB,CAAC,CAAC,wBAAwB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QAC/C,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC"}
@@ -0,0 +1,58 @@
1
+ import { z } from "@clemrig/flow";
2
+ import type { Parsed } from "./parsed.js";
3
+ import { type Spec } from "./spec.js";
4
+ /** The workflow that chooses a cleanup of the code and delivers it like an issue. */
5
+ export declare const TIDY = "tidy";
6
+ /**
7
+ * The slug, and so the branch, of the cleanup the run `runId` delivers: the
8
+ * branch belongs to its run, which takes it before choosing the cleanup.
9
+ */
10
+ export declare function tidySlug(runId: string): string;
11
+ /** Whether a branch carries a cleanup. */
12
+ export declare function isTidyBranch(branch: string): boolean;
13
+ /** Recent code starts at the last cleanup merged or, without one, this many days ago. */
14
+ export declare const recentDays = 14;
15
+ /** The scout reads at most this many recent commits, the newest. */
16
+ export declare const maxRecentCommits = 200;
17
+ /** A commit of the main branch: its short id, its subject and the files it changed. */
18
+ export interface RecentCommit {
19
+ commit: string;
20
+ subject: string;
21
+ files: string[];
22
+ }
23
+ /** What the scout receives to choose a cleanup. */
24
+ export interface Survey {
25
+ /** Where recent code starts. */
26
+ since: string;
27
+ /** The recent commits, newest first, merges aside. */
28
+ commits: RecentCommit[];
29
+ /** The files the recent commits changed, the most often changed first. */
30
+ files: {
31
+ path: string;
32
+ commits: number;
33
+ }[];
34
+ /** The pull requests still open, with the first 100 files of each: a cleanup leaves their files alone. */
35
+ openPullRequests: {
36
+ title: string;
37
+ files: string[];
38
+ }[];
39
+ /** The titles of the cleanups the operator closed without merging: not to propose again. */
40
+ rejected: string[];
41
+ }
42
+ /** The files of `commits`, the most often changed first, then by path. */
43
+ export declare function churn(commits: RecentCommit[]): Survey["files"];
44
+ /** The scout's response. */
45
+ export declare const choiceOutput: z.ZodObject<{
46
+ reason: z.ZodString;
47
+ cleanup: z.ZodNullable<z.ZodObject<{
48
+ issue: z.ZodString;
49
+ spec: z.ZodString;
50
+ }, z.core.$strict>>;
51
+ }, z.core.$strict>;
52
+ export type Choice = z.output<typeof choiceOutput>;
53
+ export type Cleanup = NonNullable<Choice["cleanup"]>;
54
+ /**
55
+ * The cleanup's spec, once its issue and spec have the formats of any issue's;
56
+ * a cleanup starts from the main branch alone, so it depends on no issue.
57
+ */
58
+ export declare function cleanupSpec(cleanup: Cleanup, slug: string): Parsed<Spec>;
@@ -0,0 +1,57 @@
1
+ import { z } from "@clemrig/flow";
2
+ import { parseIssue } from "./issue.js";
3
+ import { parseSpec } from "./spec.js";
4
+ /** The workflow that chooses a cleanup of the code and delivers it like an issue. */
5
+ export const TIDY = "tidy";
6
+ /** A cleanup is an issue whose slug, and so its branch, starts with this. */
7
+ const prefix = "tidy-";
8
+ /**
9
+ * The slug, and so the branch, of the cleanup the run `runId` delivers: the
10
+ * branch belongs to its run, which takes it before choosing the cleanup.
11
+ */
12
+ export function tidySlug(runId) {
13
+ return `${prefix}${runId}`;
14
+ }
15
+ /** Whether a branch carries a cleanup. */
16
+ export function isTidyBranch(branch) {
17
+ return branch.startsWith(prefix);
18
+ }
19
+ /** Recent code starts at the last cleanup merged or, without one, this many days ago. */
20
+ export const recentDays = 14;
21
+ /** The scout reads at most this many recent commits, the newest. */
22
+ export const maxRecentCommits = 200;
23
+ /** The files of `commits`, the most often changed first, then by path. */
24
+ export function churn(commits) {
25
+ const counts = new Map();
26
+ for (const { files } of commits)
27
+ for (const path of files)
28
+ counts.set(path, (counts.get(path) ?? 0) + 1);
29
+ return [...counts]
30
+ .map(([path, count]) => ({ path, commits: count }))
31
+ .sort((a, b) => b.commits - a.commits || a.path.localeCompare(b.path));
32
+ }
33
+ const text = z.string().trim().min(1);
34
+ /** The scout's response. */
35
+ export const choiceOutput = z.strictObject({
36
+ /** Why this cleanup comes first among those considered, or why none is worth a pull request. */
37
+ reason: text,
38
+ /** The cleanup, as its issue.md and spec.md; null when none is worth a pull request. */
39
+ cleanup: z.strictObject({ issue: text, spec: text }).nullable(),
40
+ });
41
+ /**
42
+ * The cleanup's spec, once its issue and spec have the formats of any issue's;
43
+ * a cleanup starts from the main branch alone, so it depends on no issue.
44
+ */
45
+ export function cleanupSpec(cleanup, slug) {
46
+ const issue = parseIssue(cleanup.issue);
47
+ const spec = parseSpec(cleanup.spec, slug);
48
+ const problems = [
49
+ ...(issue.ok ? [] : issue.problems.map((problem) => `issue: ${problem}`)),
50
+ ...(spec.ok ? [] : spec.problems.map((problem) => `spec: ${problem}`)),
51
+ ...(spec.ok && spec.value.dependencies.length > 0
52
+ ? ["spec: a cleanup depends on no issue: write None. under Dependencies"]
53
+ : []),
54
+ ];
55
+ return problems.length > 0 || !spec.ok ? { ok: false, problems } : spec;
56
+ }
57
+ //# sourceMappingURL=tidy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tidy.js","sourceRoot":"","sources":["../../src/domain/tidy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,SAAS,EAAa,MAAM,WAAW,CAAC;AAEjD,qFAAqF;AACrF,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC;AAE3B,6EAA6E;AAC7E,MAAM,MAAM,GAAG,OAAO,CAAC;AAEvB;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAa;IACpC,OAAO,GAAG,MAAM,GAAG,KAAK,EAAE,CAAC;AAC7B,CAAC;AAED,0CAA0C;AAC1C,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,OAAO,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC;AAED,yFAAyF;AACzF,MAAM,CAAC,MAAM,UAAU,GAAG,EAAE,CAAC;AAE7B,oEAAoE;AACpE,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAuBpC,0EAA0E;AAC1E,MAAM,UAAU,KAAK,CAAC,OAAuB;IAC3C,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IACzC,KAAK,MAAM,EAAE,KAAK,EAAE,IAAI,OAAO;QAC7B,KAAK,MAAM,IAAI,IAAI,KAAK;YAAE,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1E,OAAO,CAAC,GAAG,MAAM,CAAC;SACf,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,I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AAI,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC;YAC/C,CAAC,CAAC,CAAC,qEAAqE,CAAC;YACzE,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;IACF,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1E,CAAC"}
@@ -25,12 +25,13 @@ export function workflowOf(factory, name) {
25
25
  /** Both `src/system/` and `dist/system/` sit two levels below the package root. */
26
26
  const packageRoot = fileURLToPath(new URL("../../", import.meta.url));
27
27
  /**
28
- * Where a workflow's prompts are: `prompts/<workflow>/` of this package for the
29
- * factory's own, `.factory/workflows/<workflow>/prompts/` for the repository's.
28
+ * Where a workflow's prompts are: `prompts/` of this package for the factory's
29
+ * own, whose agents keep one prompt each whatever workflow runs them, and
30
+ * `.factory/workflows/<workflow>/prompts/` for the repository's.
30
31
  */
31
32
  function promptsDir(factory, workflow) {
32
33
  return factory.packaged.has(workflow.name)
33
- ? join(packageRoot, "prompts", workflow.name)
34
+ ? join(packageRoot, "prompts")
34
35
  : join(factory.factoryDir, "workflows", workflow.name, "prompts");
35
36
  }
36
37
  /** Reads `<name>.md` for each agent stage of the workflow, at every run. */
@@ -1 +1 @@
1
- {"version":3,"file":"factory.js","sourceRoot":"","sources":["../../src/system/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAcxD,+EAA+E;AAC/E,MAAM,UAAU,YAAY,CAAC,UAAkB;IAC7C,OAAO;QACL,GAAG,EAAE,OAAO,CAAC,UAAU,CAAC;QACxB,UAAU;QACV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,CAAC;AACjB,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { ChangedFile } from "../domain/review.js";
2
+ import type { RecentCommit } from "../domain/tidy.js";
2
3
  /** A branch's full reference: a tag of the same name never answers for it. */
3
4
  export declare function branchRef(branch: string): string;
4
5
  /** The full reference of `origin`'s copy of a branch. */
@@ -10,8 +11,8 @@ export declare function gitDir(dir: string): Promise<string>;
10
11
  /** The files under `path` in a branch or commit, relative to the repository. */
11
12
  export declare function filesIn(dir: string, ref: string, path: string): Promise<string[]>;
12
13
  export declare function currentBranch(dir: string): Promise<string>;
13
- /** Modified, staged or untracked files, in the whole tree or under a path, `except` one of its files. */
14
- export declare function hasChanges(dir: string, path?: string, except?: string): Promise<boolean>;
14
+ /** Modified, staged or untracked files, in the whole tree or under a path, `except` some of its files. */
15
+ export declare function hasChanges(dir: string, path?: string, except?: string[]): Promise<boolean>;
15
16
  export declare function fetchBranch(dir: string, branch: string): Promise<void>;
16
17
  /** Whether Git still has this object. */
17
18
  export declare function hasObject(dir: string, id: string): Promise<boolean>;
@@ -20,7 +21,20 @@ export declare function commitOf(dir: string, ref: string): Promise<string>;
20
21
  export declare function switchTo(dir: string, branch: string, from?: string): Promise<void>;
21
22
  /** Commits the given paths, or every change; returns the new commit. */
22
23
  export declare function commit(dir: string, message: string, paths?: string[]): Promise<string>;
24
+ /** Deletes a branch merged into HEAD; Git refuses one with commits of its own. */
25
+ export declare function deleteBranch(dir: string, branch: string): Promise<void>;
23
26
  export declare function forcePush(dir: string, branch: string): Promise<void>;
27
+ /** The latest commit of HEAD's own history that changed a file matching `glob`; none if none did. */
28
+ export declare function lastCommitTouching(dir: string, glob: string): Promise<string | undefined>;
29
+ /**
30
+ * The latest commits of HEAD, merges aside, newest first and at most `max`:
31
+ * those after the commit `after`, or those of the last `days`.
32
+ */
33
+ export declare function recentCommits(dir: string, since: {
34
+ after: string;
35
+ } | {
36
+ days: number;
37
+ }, max: number): Promise<RecentCommit[]>;
24
38
  /** The diff from one commit or tree to another. */
25
39
  export declare function diff(dir: string, before: string, after: string): Promise<{
26
40
  text: string;