@clemrig/factory 0.7.0 → 0.9.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 (82) hide show
  1. package/README.md +29 -13
  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 +40 -587
  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 +2 -1
  56. package/dist/domain/plan.js +10 -5
  57. package/dist/domain/plan.js.map +1 -1
  58. package/dist/domain/pull-request.d.ts +4 -0
  59. package/dist/domain/pull-request.js +11 -1
  60. package/dist/domain/pull-request.js.map +1 -1
  61. package/dist/domain/spec.d.ts +1 -0
  62. package/dist/domain/spec.js +3 -0
  63. package/dist/domain/spec.js.map +1 -1
  64. package/dist/domain/tidy.d.ts +58 -0
  65. package/dist/domain/tidy.js +57 -0
  66. package/dist/domain/tidy.js.map +1 -0
  67. package/dist/system/factory.js +4 -3
  68. package/dist/system/factory.js.map +1 -1
  69. package/dist/system/git.d.ts +16 -2
  70. package/dist/system/git.js +52 -3
  71. package/dist/system/git.js.map +1 -1
  72. package/dist/system/github.d.ts +14 -0
  73. package/dist/system/github.js +38 -0
  74. package/dist/system/github.js.map +1 -1
  75. package/dist/system/lock.js +1 -1
  76. package/dist/system/lock.js.map +1 -1
  77. package/package.json +2 -2
  78. package/prompts/{implement/describe.md → describe.md} +3 -3
  79. package/prompts/{implement/plan.md → plan.md} +8 -5
  80. package/prompts/scout.md +53 -0
  81. /package/prompts/{implement/implement.md → implement.md} +0 -0
  82. /package/prompts/{implement/review.md → review.md} +0 -0
@@ -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,C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AO,EAAE,CAAC,CAAC;QACzE,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,SAAS,OAAO,EAAE,CAAC,CAAC;QACtE,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,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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AiB,IAAI,EAAE,CAAC,CAAC;QACzD,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;IACjC,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1D,OAAO,OAAO,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;
@@ -50,14 +50,16 @@ export async function filesIn(dir, ref, path) {
50
50
  export function currentBranch(dir) {
51
51
  return output(dir, ["branch", "--show-current"]);
52
52
  }
53
- /** Modified, staged or untracked files, in the whole tree or under a path, `except` one of its files. */
54
- export async function hasChanges(dir, path, except) {
53
+ /** Modified, staged or untracked files, in the whole tree or under a path, `except` some of its files. */
54
+ export async function hasChanges(dir, path, except = []) {
55
55
  return ((await output(dir, [
56
56
  "status",
57
57
  "--porcelain",
58
58
  // Every untracked file, whatever status.showUntrackedFiles says.
59
59
  "--untracked-files=all",
60
- ...(path ? ["--", path, ...(except ? [`:(exclude)${except}`] : [])] : []),
60
+ ...(path
61
+ ? ["--", path, ...except.map((file) => `:(exclude)${file}`)]
62
+ : []),
61
63
  ])) !== "");
62
64
  }
63
65
  export async function fetchBranch(dir, branch) {
@@ -81,10 +83,57 @@ export async function commit(dir, message, paths) {
81
83
  await git(dir, ["commit", "-m", message, ...(paths ? ["--", ...paths] : [])]);
82
84
  return commitOf(dir, "HEAD");
83
85
  }
86
+ /** Deletes a branch merged into HEAD; Git refuses one with commits of its own. */
87
+ export async function deleteBranch(dir, branch) {
88
+ await git(dir, ["branch", "-d", branch]);
89
+ }
84
90
  export async function forcePush(dir, branch) {
85
91
  const ref = branchRef(branch);
86
92
  await git(dir, ["push", "--force", "-u", "origin", `${ref}:${ref}`], 120_000);
87
93
  }
94
+ /** The latest commit of HEAD's own history that changed a file matching `glob`; none if none did. */
95
+ export async function lastCommitTouching(dir, glob) {
96
+ // First parents only: a merged branch counts at its merge, which brought
97
+ // the file to this branch.
98
+ const commit = await output(dir, [
99
+ "log",
100
+ "-1",
101
+ "--first-parent",
102
+ "--format=%H",
103
+ "--",
104
+ `:(glob)${glob}`,
105
+ ]);
106
+ return commit || undefined;
107
+ }
108
+ /**
109
+ * The latest commits of HEAD, merges aside, newest first and at most `max`:
110
+ * those after the commit `after`, or those of the last `days`.
111
+ */
112
+ export async function recentCommits(dir, since, max) {
113
+ const range = "after" in since
114
+ ? [`${since.after}..HEAD`]
115
+ : [`--since=${since.days}.days.ago`, "HEAD"];
116
+ const records = await fields(dir, [
117
+ "log",
118
+ "--no-merges",
119
+ `--max-count=${max}`,
120
+ "-z",
121
+ "--name-only",
122
+ "--format=%h%x1f%s",
123
+ ...range,
124
+ ]);
125
+ const commits = [];
126
+ // Each commit's id and subject, then its files; a newline starts the first file.
127
+ for (const record of records) {
128
+ const field = record.replace(/^\n/, "");
129
+ const [commit = "", subject] = field.split("\x1f");
130
+ if (subject !== undefined)
131
+ commits.push({ commit, subject, files: [] });
132
+ else
133
+ commits.at(-1)?.files.push(field);
134
+ }
135
+ return commits;
136
+ }
88
137
  /** The diff from one commit or tree to another. */
89
138
  export async function diff(dir, before, after) {
90
139
  const result = await git(dir, ["diff", before, after]);
@@ -1 +1 @@
1
- {"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/system/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,uEAAuE;AACvE,KAAK,UAAU,GAAG,CAAC,GAAW,EAAE,IAAc,EAAE,SAAS,GAAG,MAAM;IAChE,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,EAAE,GAAG,EAAE,S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AAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC;IACzC,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC;IACpE,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,QAAQ,CAAC;IACzC,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACvE,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC,CAAC;AAClE,CAAC;AAED,sEAAsE;AACtE,SAAS,KAAK,CAAC,IAAY;IACzB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;AAChC,CAAC"}
@@ -6,6 +6,20 @@ export declare function repository(dir: string): Promise<{
6
6
  url: string;
7
7
  public: boolean;
8
8
  }>;
9
+ /** An open pull request: its title, branch, page and the files it changes, the first 100: gh lists no more. */
10
+ export interface OpenPullRequest {
11
+ title: string;
12
+ branch: string;
13
+ url: string;
14
+ files: string[];
15
+ }
16
+ /** The latest open pull requests, newest first. */
17
+ export declare function openPullRequests(dir: string): Promise<OpenPullRequest[]>;
18
+ /** The latest pull requests closed without being merged, newest first: their title and branch. */
19
+ export declare function closedPullRequests(dir: string): Promise<{
20
+ title: string;
21
+ branch: string;
22
+ }[]>;
9
23
  /** Updates the branch's open pull request, or opens one; returns its URL. */
10
24
  export declare function openPullRequest(dir: string, pullRequest: {
11
25
  base: string;
@@ -23,6 +23,44 @@ export async function repository(dir) {
23
23
  const { url, visibility } = JSON.parse(await gh(dir, ["repo", "view", "--json", "url,visibility"]));
24
24
  return { url, public: visibility === "PUBLIC" };
25
25
  }
26
+ /** The pull requests gh lists: the latest, at most this many. */
27
+ const listed = "100";
28
+ /** The latest open pull requests, newest first. */
29
+ export async function openPullRequests(dir) {
30
+ const open = JSON.parse(await gh(dir, [
31
+ "pr",
32
+ "list",
33
+ "--state",
34
+ "open",
35
+ "--limit",
36
+ listed,
37
+ "--json",
38
+ "title,headRefName,url,files",
39
+ ]));
40
+ return open.map(({ title, headRefName, url, files }) => ({
41
+ title,
42
+ branch: headRefName,
43
+ url,
44
+ files: files.map(({ path }) => path),
45
+ }));
46
+ }
47
+ /** The latest pull requests closed without being merged, newest first: their title and branch. */
48
+ export async function closedPullRequests(dir) {
49
+ const closed = JSON.parse(await gh(dir, [
50
+ "pr",
51
+ "list",
52
+ "--state",
53
+ "closed",
54
+ "--limit",
55
+ listed,
56
+ "--json",
57
+ "title,headRefName,state",
58
+ ]));
59
+ // gh lists merged pull requests among the closed ones.
60
+ return closed
61
+ .filter(({ state }) => state === "CLOSED")
62
+ .map(({ title, headRefName }) => ({ title, branch: headRefName }));
63
+ }
26
64
  /** Updates the branch's open pull request, or opens one; returns its URL. */
27
65
  export async function openPullRequest(dir, pullRequest) {
28
66
  const { base, head, title, body } = pullRequest;
@@ -1 +1 @@
1
- {"version":3,"file":"github.js","sourceRoot":"","sources":["../../src/system/github.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,gGAAgG;AAChG,KAAK,UAAU,EAAE,CACf,GAAW,EACX,IAAc,EACd,KAAc,EACd,SAAS,GAAG,MAAM;IAElB,MAAM,MAAM,GAAG,MAAM,UAAU,CAC7B,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,EACf,GAAG,EACH,SAAS,EACT,SAAS,EACT,KAAK,CACN,CAAC;IACF,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC;QACvB,MAAM,IAAI,KAAK,CACb,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CA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AAC,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;AACvE,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAc,EACd,WAAmB,EACnB,IAAY,EACZ,MAAgB;IAEhB,MAAM,EAAE,CACN,MAAM,EACN;QACE,IAAI;QACJ,MAAM;QACN,WAAW;QACX,aAAa;QACb,GAAG;QACH,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;KAClD,EACD,IAAI;IACJ,4CAA4C;IAC5C,OAAO,CACR,CAAC;AACJ,CAAC"}
@@ -17,7 +17,7 @@ export async function exclusively(path, work, waitMs = 10_000) {
17
17
  if (error.code !== "EEXIST")
18
18
  throw error;
19
19
  if (Date.now() >= until)
20
- throw new Error(`${path} has been held for ${Math.round(waitMs / 1000)} s: if no implement run is starting, remove it`);
20
+ throw new Error(`${path} has been held for ${Math.round(waitMs / 1000)} s: if no implement or tidy run is starting, remove it`);
21
21
  await new Promise((resolve) => setTimeout(resolve, 50));
22
22
  }
23
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"lock.js","sourceRoot":"","sources":["../../src/system/lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,IAAY,EACZ,IAAsB,EACtB,MAAM,GAAG,MAAM;IAEf,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC;IAClC,SAAS,CAAC;QACR,IAAI,CAAC;YACH,MAAM,SAAS,CAAC,IA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,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC;IAClC,SAAS,CAAC;QACR,IAAI,CAAC;YACH,MAAM,SAAS,CAAC,IAAI,EAAE,GAAG,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;YAC1D,MAAM;QACR,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;gBAAE,MAAM,KAAK,CAAC;YACpE,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,KAAK;gBACrB,MAAM,IAAI,KAAK,CACb,GAAG,IAAI,sBAAsB,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,wDAAwD,CAC/G,CAAC;YACJ,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;IACD,IAAI,CAAC;QACH,OAAO,MAAM,IAAI,EAAE,CAAC;IACtB,CAAC;YAAS,CAAC;QACT,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAClC,CAAC;AACH,CAAC;AAED,4GAA4G;AAC5G,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,GAAW,EACX,IAAsB;IAEtB,OAAO,WAAW,CAAC,IAAI,CAAC,MAAM,MAAM,CAAC,GAAG,CAAC,EAAE,wBAAwB,CAAC,EAAE,IAAI,CAAC,CAAC;AAC9E,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clemrig/factory",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "Take a repository's issues from spec to pull request with agents, watch them on a local Kanban, and run the repository's own workflows",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -39,7 +39,7 @@
39
39
  "prepack": "npm run build"
40
40
  },
41
41
  "dependencies": {
42
- "@clemrig/factory-ui": "0.1.0",
42
+ "@clemrig/factory-ui": "0.2.0",
43
43
  "@clemrig/flow": "0.7.0",
44
44
  "@clemrig/flow-ui": "0.5.0"
45
45
  }
@@ -16,9 +16,9 @@ The request gives the spec, the plan, the change, the checks that passed, the re
16
16
 
17
17
  Read the code: describe what the change does, not what anyone said it does. The pull request already shows, from
18
18
  the run, the spec's objective, each acceptance criterion with the review's evidence, the checks, the review's
19
- findings, the deviations and the plan's risks: do not repeat them. When the review still asks for changes, the
20
- operator delivers the change anyway and the pull request lists them as open: weigh them in `danger`, without
21
- listing them again.
19
+ findings, the deviations, and the plan's interpretations of the spec and risks: do not repeat them. When the
20
+ review still asks for changes, the operator delivers the change anyway and the pull request lists them as open:
21
+ weigh them in `danger`, without listing them again.
22
22
 
23
23
  Write for that reader: name things by what they do, an identifier only beside its meaning, and say what each item
24
24
  means for the merge. Be brief: a sentence or two per item, the details a reviewer finds in the code left there.
@@ -7,8 +7,8 @@ change will touch, and follow them. Ignore `.factory/`: the other issues there a
7
7
  truth, and `.factory/runs/` holds agents' outputs.
8
8
 
9
9
  The request gives the issue's slug and its spec. The spec is approved and does not change: plan what it asks,
10
- nothing more. When something is unclear, choose the interpretation most consistent with the code and record it
11
- in `risks`.
10
+ nothing more. When the spec reads more than one way, or its letter would give a behavior its objective would not
11
+ want, choose the reading most consistent with the code and record it in `interpretations`.
12
12
 
13
13
  ## Explore first
14
14
 
@@ -43,6 +43,9 @@ Answer with:
43
43
  or many items, permissions. Only those the step meets; empty when there are none.
44
44
  - `commit`: the conventional commit subject of the whole change, for example
45
45
  `feat(api): export watchlists as CSV`, at most 72 characters.
46
- - `risks`: what could go wrong and what you assumed; empty if nothing. The pull request shows them to a reader
47
- who knows neither the spec nor the code: a sentence or two each, naming things by what they do, an identifier
48
- only beside its meaning, and what each means for the change.
46
+ - `interpretations`: each reading of the spec you chose, as above: what users observe with it and what the other
47
+ reading would change; empty when the spec leaves no doubt. The pull request asks the operator to confirm each one
48
+ or to fix the spec.
49
+ - `risks`: what else could go wrong and what else you assumed; empty if nothing. The pull request shows them and
50
+ `interpretations` to a reader who knows neither the spec nor the code: a sentence or two each, naming things by
51
+ what they do, an identifier only beside its meaning, and what each means for the change.
@@ -0,0 +1,53 @@
1
+ You choose the one cleanup of this repository's code that comes first, and write it as an issue with its spec. You
2
+ change nothing. Write the issue and the spec in the language of the repository's agent instructions, English
3
+ without them; keep code, paths and identifiers as they are.
4
+
5
+ First read the repository's agent instructions: `AGENTS.md` at the root and in each directory you explore. Their
6
+ conventions are the standard the code is held to. Ignore `.factory/`: it holds issues' history and agents' outputs.
7
+
8
+ A cleanup makes the code simpler to read and to change without changing anything observable: what users, callers
9
+ and other programs see stays the same, outputs, errors, public interfaces and stored data included. It removes the
10
+ waste that fast changes leave behind, such as:
11
+
12
+ - several implementations of the same need, or helpers that repeat one another;
13
+ - dead code: unused exports, branches no input reaches, flags and parameters always given the same value;
14
+ - defensive code against situations that cannot happen, wrappers that add nothing, indirections with one user;
15
+ - functions or files too long to follow, names that no longer say what the code does;
16
+ - departures from the conventions the instructions and the rest of the code follow;
17
+ - comments that repeat the code or describe what it no longer does, documentation that contradicts the code;
18
+ - weak tests: tests of mocks rather than behavior, duplicated cases, missing tests where the code to tidy has none.
19
+
20
+ Never a feature, a fix, a new dependency or tool, a change to a public interface, a mass reformatting or a change
21
+ to generated files. A defect you find is no cleanup: name it in the issue, leave it for the operator.
22
+
23
+ ## Choose
24
+
25
+ The request's `survey` describes the code since the last cleanup was merged (`since`): `commits`, newest first,
26
+ with their files, and `files`, the files they changed, the most often changed first. Waste piles up where code
27
+ changes fast, and code that changes often costs at each change: start there, read those files and what they call.
28
+ Look at the rest of the repository only when recent code has nothing worth a cleanup.
29
+
30
+ Leave alone the files of `openPullRequests`: another change is on its way there. Do not propose again a cleanup
31
+ like those in `rejected`: the operator closed them without merging.
32
+
33
+ Compare the candidates you find, three when you can, and choose the one that removes the most waste from the code
34
+ that changes most, within one cleanup a reviewer reads in about ten minutes: one theme, one area, with tests that
35
+ prove nothing observable changed, or adding those tests as the cleanup. Prefer no cleanup to a cosmetic one: when
36
+ nothing is worth a pull request, answer `cleanup: null`.
37
+
38
+ ## The answer
39
+
40
+ - `reason`: why this cleanup comes first, or why none is worth a pull request.
41
+ - `cleanup.issue`: the issue, as `issue.md`: a `# ` title, then what the waste is and where (files and symbols),
42
+ the evidence that it comes first, the other candidates and why they wait, and any defect you found.
43
+ - `cleanup.spec`: its spec, as `spec.md`: the same title, then exactly these sections, in this order, none empty
44
+ (`None.` when there is nothing to say):
45
+ - `## Objective`: why the cleanup is worth it, for whoever changes this code next.
46
+ - `## Scope`: what it changes, in the code and its tests.
47
+ - `## Out of scope`: what it leaves, the other candidates and any defect included.
48
+ - `## Acceptance criteria`: only `- AC1: …` items numbered without gaps, each a fact a reviewer checks in the
49
+ code or the tests, one of them that nothing observable changes; an indented line continues an item.
50
+ - `## Constraints`: what the change must keep: behavior, public interfaces, the repository's conventions.
51
+ - `## Dependencies`: `None.`; a cleanup starts from the main branch alone.
52
+
53
+ The spec says what must be true and why, not how to write it: the plan and the implementation come after you.
File without changes