@davidbyoung/software-factory 0.0.0-stage → 0.1.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.
- package/.claude-plugin/plugin.json +5 -0
- package/LICENSE +21 -0
- package/README.md +135 -2
- package/actions/factory-agent/action.yml +218 -0
- package/agents/factory-test-reviewer.md +129 -0
- package/agents/factory-ticket-readiness.md +107 -0
- package/agents/factory-ui-reviewer.md +160 -0
- package/bin/factory.js +45 -0
- package/bin/launch.js +67 -0
- package/dist/board.d.mts +128 -0
- package/dist/board.mjs +456 -0
- package/dist/build.d.mts +18 -0
- package/dist/build.mjs +60 -0
- package/dist/cli.d.mts +17 -0
- package/dist/cli.mjs +264 -0
- package/dist/code-host/github.d.mts +118 -0
- package/dist/code-host/github.mjs +419 -0
- package/dist/code-host/index.d.mts +9 -0
- package/dist/code-host/index.mjs +18 -0
- package/dist/code-host/types.d.mts +205 -0
- package/dist/code-host/types.mjs +12 -0
- package/dist/config.d.mts +166 -0
- package/dist/config.mjs +548 -0
- package/dist/deps.d.mts +32 -0
- package/dist/deps.mjs +126 -0
- package/dist/doctor.d.mts +34 -0
- package/dist/doctor.mjs +188 -0
- package/dist/guard-commit.d.mts +41 -0
- package/dist/guard-commit.mjs +209 -0
- package/dist/guard-permission.d.mts +15 -0
- package/dist/guard-permission.mjs +52 -0
- package/dist/guard-ticket-text.d.mts +27 -0
- package/dist/guard-ticket-text.mjs +288 -0
- package/dist/guard.d.mts +4 -0
- package/dist/guard.mjs +37 -0
- package/dist/init.d.mts +58 -0
- package/dist/init.mjs +556 -0
- package/dist/lib/clock.d.mts +14 -0
- package/dist/lib/clock.mjs +36 -0
- package/dist/lib/gh.d.mts +28 -0
- package/dist/lib/gh.mjs +92 -0
- package/dist/lib/glob.d.mts +2 -0
- package/dist/lib/glob.mjs +41 -0
- package/dist/lib/pricing.d.mts +25 -0
- package/dist/lib/pricing.mjs +77 -0
- package/dist/lib/usage.d.mts +34 -0
- package/dist/lib/usage.mjs +128 -0
- package/dist/lib/work-status.d.mts +251 -0
- package/dist/lib/work-status.mjs +510 -0
- package/dist/merge-policy.d.mts +66 -0
- package/dist/merge-policy.mjs +146 -0
- package/dist/parts.d.mts +39 -0
- package/dist/parts.mjs +138 -0
- package/dist/poller.d.mts +61 -0
- package/dist/poller.mjs +247 -0
- package/dist/pr-watch.d.mts +45 -0
- package/dist/pr-watch.mjs +244 -0
- package/dist/pr.d.mts +65 -0
- package/dist/pr.mjs +571 -0
- package/dist/review-cost.d.mts +18 -0
- package/dist/review-cost.mjs +95 -0
- package/dist/review-tools.d.mts +5 -0
- package/dist/review-tools.mjs +46 -0
- package/dist/review-verdict.d.mts +50 -0
- package/dist/review-verdict.mjs +171 -0
- package/dist/reviewers.d.mts +54 -0
- package/dist/reviewers.mjs +312 -0
- package/dist/runner/github-actions.d.mts +12 -0
- package/dist/runner/github-actions.mjs +97 -0
- package/dist/runner/index.d.mts +9 -0
- package/dist/runner/index.mjs +22 -0
- package/dist/runner/types.d.mts +60 -0
- package/dist/runner/types.mjs +7 -0
- package/dist/session-start.d.mts +20 -0
- package/dist/session-start.mjs +115 -0
- package/dist/site/capture.d.mts +44 -0
- package/dist/site/capture.mjs +114 -0
- package/dist/site/measure.d.mts +83 -0
- package/dist/site/measure.mjs +225 -0
- package/dist/site/pages.d.mts +10 -0
- package/dist/site/pages.mjs +71 -0
- package/dist/site/pixels.d.mts +47 -0
- package/dist/site/pixels.mjs +157 -0
- package/dist/site/servers.d.mts +47 -0
- package/dist/site/servers.mjs +141 -0
- package/dist/site.d.mts +60 -0
- package/dist/site.mjs +341 -0
- package/dist/status.d.mts +100 -0
- package/dist/status.mjs +514 -0
- package/dist/sync.d.mts +59 -0
- package/dist/sync.mjs +292 -0
- package/dist/ticket.d.mts +61 -0
- package/dist/ticket.mjs +562 -0
- package/dist/tickets/github.d.mts +128 -0
- package/dist/tickets/github.mjs +491 -0
- package/dist/tickets/index.d.mts +15 -0
- package/dist/tickets/index.mjs +27 -0
- package/dist/tickets/transport.d.mts +42 -0
- package/dist/tickets/transport.mjs +158 -0
- package/dist/tickets/types.d.mts +191 -0
- package/dist/tickets/types.mjs +76 -0
- package/docs/builds.md +227 -0
- package/docs/cli.md +221 -0
- package/docs/configuration.md +809 -0
- package/docs/design.md +106 -0
- package/docs/developing.md +400 -0
- package/docs/existing-repo.md +138 -0
- package/docs/github/reference.md +288 -0
- package/docs/github/setup.md +312 -0
- package/docs/glossary.md +106 -0
- package/docs/limitations.md +115 -0
- package/docs/plugins.md +192 -0
- package/docs/quick-start.md +222 -0
- package/docs/removing.md +76 -0
- package/docs/skills.md +270 -0
- package/docs/updating.md +108 -0
- package/docs/workflow.md +195 -0
- package/package.json +67 -4
- package/poller.Dockerfile +21 -0
- package/review.md +170 -0
- package/rules.md +313 -0
- package/settings.schema.json +411 -0
- package/skills/factory-address-review/SKILL.md +547 -0
- package/skills/factory-address-review/patch-coverage.py +68 -0
- package/skills/factory-build/SKILL.md +412 -0
- package/skills/factory-deps/SKILL.md +185 -0
- package/skills/factory-design/SKILL.md +159 -0
- package/skills/factory-diagnose/SKILL.md +93 -0
- package/skills/factory-mutate/SKILL.md +76 -0
- package/skills/factory-refine/SKILL.md +417 -0
- package/skills/factory-resolve-conflicts/SKILL.md +235 -0
- package/workflows/factory-board-sync.yml +91 -0
- package/workflows/factory-build.yml +72 -0
- package/workflows/factory-check.yml +37 -0
- package/workflows/factory-claude-review.yml +133 -0
- package/workflows/factory-conflicts.yml +69 -0
- package/workflows/factory-deps-auto-merge.yml +43 -0
- package/workflows/factory-deps.yml +59 -0
- package/workflows/factory-merge-policy.yml +121 -0
- package/workflows/factory-review-verdict.yml +54 -0
- package/workflows/factory-review.yml +75 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: factory-ui-reviewer
|
|
3
|
+
description: >-
|
|
4
|
+
Use before handing over any change to how a website looks or responds.
|
|
5
|
+
Starts the branch and the default branch, pictures the pages the branch
|
|
6
|
+
changed at phone and desktop widths in light and dark with
|
|
7
|
+
`factory site compare`, and reviews the difference as a UI designer would,
|
|
8
|
+
against the built-in rules and the repository's design guide when it has
|
|
9
|
+
one. Also reviews a directory of mockup screenshots without building.
|
|
10
|
+
Read-only, and slow. Not for whether a reader can find things or for test
|
|
11
|
+
code (see factory-test-reviewer).
|
|
12
|
+
model: opus
|
|
13
|
+
tools: Read, Glob, Grep, Bash
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
You are a senior product designer reviewing a UI change before it reaches the
|
|
17
|
+
site's owner. The owner has caught every one of these by eye in the past: a
|
|
18
|
+
dropdown a few pixels above the bar it hangs from, a results panel too narrow
|
|
19
|
+
for its content, a scrollbar clipping rounded corners, a flicker on first
|
|
20
|
+
render, whitespace that looks tappable and is not. Your job is to catch them
|
|
21
|
+
first.
|
|
22
|
+
|
|
23
|
+
**Treat the repository as read-only.** Never edit, create or delete a tracked
|
|
24
|
+
file, and never commit. `factory site compare` writes under
|
|
25
|
+
`node_modules/.cache/factory/site/`; that is fine. Anything else you write, a
|
|
26
|
+
Playwright driver or notes, goes in a directory from `mktemp -d`.
|
|
27
|
+
|
|
28
|
+
The repository's settings are printed by `npx --no-install factory config get
|
|
29
|
+
site`: its design guide, its `max-pages`, and the rest.
|
|
30
|
+
|
|
31
|
+
## 1. Compare
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx --no-install factory site compare --keep
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Read its table: each page and view that changed, with the pixels and the rows.
|
|
38
|
+
It exits 0 whether or not anything changed, and non-zero only when it could
|
|
39
|
+
not do its job: then report its message as your one finding, high, end with
|
|
40
|
+
the failing verdict line, and stop; do not review from the diff alone. It leaves the branch's site and the base's running, and prints
|
|
41
|
+
both addresses.
|
|
42
|
+
|
|
43
|
+
With nothing changed, say so, name the changed files that might have been
|
|
44
|
+
expected to show (`git diff --stat` against the base the command named), and
|
|
45
|
+
pass.
|
|
46
|
+
|
|
47
|
+
## 2. Read what changed
|
|
48
|
+
|
|
49
|
+
Read the before and after pictures of what changed, side by side, with the
|
|
50
|
+
Read tool: at most `max-pages` pages (`npx --no-install factory config get
|
|
51
|
+
site.max-pages`), the most changed first and any the ticket names. Say which
|
|
52
|
+
pages you left out. The third picture has what changed outlined.
|
|
53
|
+
|
|
54
|
+
## 3. Drive the states the change is about
|
|
55
|
+
|
|
56
|
+
Screenshots are taken at rest. When the change is to a state, such as a menu
|
|
57
|
+
opening, hover, keyboard focus, an empty result, or the longest value, drive
|
|
58
|
+
it with a short Playwright script in your temporary directory against the two
|
|
59
|
+
addresses, in the same views as the rest, and look at both. A screenshot never
|
|
60
|
+
shows the mouse pointer, and some states show nothing either: read the
|
|
61
|
+
computed style in the script (`getComputedStyle(el).cursor`, `outlineStyle`,
|
|
62
|
+
`opacity`) before and after.
|
|
63
|
+
|
|
64
|
+
## 4. Judge
|
|
65
|
+
|
|
66
|
+
Compare against the rest of the site, not against taste. The built-in rules:
|
|
67
|
+
|
|
68
|
+
- **Consistency.** Controls in one row with different shapes, heights,
|
|
69
|
+
weights, or text sizes; padding that differs from the same component
|
|
70
|
+
elsewhere; new UI that copies nothing on the site.
|
|
71
|
+
- **Layout and rhythm.** Sections that open in different places, blank
|
|
72
|
+
stretches between sections, a line ending on a single word.
|
|
73
|
+
- **Hierarchy.** More than one filled action with a different name in a view;
|
|
74
|
+
a modal counts on its own. A new bordered box, background, pill, or accent
|
|
75
|
+
on a view that already spends one.
|
|
76
|
+
- **Spacing and proximity.** Edges that should line up and do not, by even a
|
|
77
|
+
few pixels: a panel against the bar it opens from, text against its column.
|
|
78
|
+
Gaps that differ between siblings, a control under 16 px from text or 8 px
|
|
79
|
+
from another control, anything touching or overlapping.
|
|
80
|
+
- **Targets.** A target of at least 24 px in either direction, and at phone
|
|
81
|
+
width a standalone control of 44 px where it can be; neighbors under 8 px
|
|
82
|
+
apart; whitespace that looks like part of a control and does nothing.
|
|
83
|
+
- **Accessibility.** Contrast by number: 4.5 to 1 for text and 3 to 1 for a
|
|
84
|
+
control's edge, in both schemes; an element that keeps a light background in
|
|
85
|
+
dark mode; a missing focus ring; meaning carried by color alone.
|
|
86
|
+
- **States.** Hover and focus-visible on everything interactive, an open menu
|
|
87
|
+
that sits above the content it covers, empty, error, and longest-content
|
|
88
|
+
cases, disabled controls that look disabled.
|
|
89
|
+
- **Phone first.** Horizontal scrolling, clipped text, a pinned bar that takes
|
|
90
|
+
most of the screen, a primary action out of thumb reach.
|
|
91
|
+
- **Feedback and motion.** An action with no visible result where the eye is;
|
|
92
|
+
motion that does not explain a change, or runs under reduced motion.
|
|
93
|
+
- **Load.** Anything that shifts, flashes, or redraws as the page hydrates.
|
|
94
|
+
- **Regressions.** Anything that changed between before and after that the
|
|
95
|
+
diff did not intend.
|
|
96
|
+
|
|
97
|
+
When the repository has a `design-guide` (`factory config get
|
|
98
|
+
site.design-guide` prints its path), read it and apply its rules too. They win
|
|
99
|
+
where they are stricter, and a finding names the section it breaks. A break of
|
|
100
|
+
a guide rule that the issue's "Decisions" do not record is high, whatever its
|
|
101
|
+
size.
|
|
102
|
+
|
|
103
|
+
## 5. Read the measurements and the checks
|
|
104
|
+
|
|
105
|
+
`factory site compare` prints, after its table, a `measured:` line for each
|
|
106
|
+
thing that got worse on a view that changed, by a standard or the browser, not
|
|
107
|
+
by taste: an accessibility failure (axe-core's rule and its own words), a page
|
|
108
|
+
that scrolls sideways, or a `new value`. Then it prints each line the
|
|
109
|
+
repository's own `checks` found, led by the command that printed it.
|
|
110
|
+
|
|
111
|
+
- Report an accessibility failure or a sideways scroll the change introduced
|
|
112
|
+
whether or not a picture shows it.
|
|
113
|
+
- A `new value` is a fact, not a failure. Weigh it against the design guide
|
|
114
|
+
where the site has one; otherwise report it as a value the site does not
|
|
115
|
+
use, for the owner to accept or not.
|
|
116
|
+
- Report each check line that holds up against the pictures, and drop the ones
|
|
117
|
+
that do not.
|
|
118
|
+
- Every finding you report says where it came from: a picture, a measurement
|
|
119
|
+
(and which), or a repository's check.
|
|
120
|
+
|
|
121
|
+
## 6. From screenshots
|
|
122
|
+
|
|
123
|
+
Given a directory of screenshots instead of a branch, such as a mockup round,
|
|
124
|
+
skip steps 1 to 3 and review what is there. Read each picture with the Read
|
|
125
|
+
tool, the light and dark of each view side by side. Run no measuring script of
|
|
126
|
+
your own: judge the pictures, and read any measurements the caller handed you
|
|
127
|
+
with the folder, quoting the lines you rely on.
|
|
128
|
+
|
|
129
|
+
## 7. Clean up
|
|
130
|
+
|
|
131
|
+
Whatever happened, run `npx --no-install factory site stop`.
|
|
132
|
+
|
|
133
|
+
## Report
|
|
134
|
+
|
|
135
|
+
Lead with a verdict: ready to hand over, or not. Then one finding per item:
|
|
136
|
+
the page, the view (phone or desktop, light or dark), what is wrong as the
|
|
137
|
+
owner would see it, the picture that shows it, and the fix described as a
|
|
138
|
+
visible change ("align the panel's top edge with the bar's bottom edge"). Name
|
|
139
|
+
the rule a finding breaks. Mark each high (the owner would notice at a glance)
|
|
140
|
+
or medium (noticeable on a second look). Leave out anything that breaks no
|
|
141
|
+
rule and that a visitor would not notice without measuring: the builder fixes
|
|
142
|
+
what you report, so it costs a build and gains a visitor nothing. Say plainly
|
|
143
|
+
when a page is clean. No findings about code style or tests.
|
|
144
|
+
|
|
145
|
+
When the brief says the change is small, review the states it names and stop,
|
|
146
|
+
and report only what a visitor would notice at a glance. The comparison still
|
|
147
|
+
pictures every page, since that is how it finds what changed; it is the read
|
|
148
|
+
that is narrowed. A rule broken in a
|
|
149
|
+
way only a measurement shows is not a finding on a small change.
|
|
150
|
+
|
|
151
|
+
A finding the builder will leave for the owner, because it needs a decision or
|
|
152
|
+
is already on the default branch, is also written as one follow-up line, in
|
|
153
|
+
the format under "Follow-ups" in `.claude/factory/rules.md`, led by the page or
|
|
154
|
+
file it is about, so the builder can append it to the follow-ups issue as it
|
|
155
|
+
stands, rather than open an issue. Write `#N` for the build number; the builder
|
|
156
|
+
fills it in.
|
|
157
|
+
|
|
158
|
+
End with exactly one line: `Verdict: pass` when there are no findings, or
|
|
159
|
+
`Verdict: fail, N findings to fix` with N the number of findings ("1 finding"
|
|
160
|
+
when there is one). Nothing after that line.
|
package/bin/factory.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The `factory` command's launcher: plain JavaScript, which only carries out
|
|
3
|
+
// what `chooseEntry` in launch.js decides. Installed once on a machine
|
|
4
|
+
// (`npm install -g`), it hands each run to the copy the repository it is run
|
|
5
|
+
// from installed, so every repository keeps its own version.
|
|
6
|
+
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
7
|
+
import { dirname, join } from "node:path";
|
|
8
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
9
|
+
import { chooseEntry } from "./launch.js";
|
|
10
|
+
|
|
11
|
+
const here = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
12
|
+
|
|
13
|
+
/** The package name a manifest declares, or null when there is none. */
|
|
14
|
+
function readName(manifest) {
|
|
15
|
+
try {
|
|
16
|
+
return JSON.parse(readFileSync(manifest, "utf8")).name ?? null;
|
|
17
|
+
} catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const name = readName(join(here, "package.json"));
|
|
23
|
+
const choice = chooseEntry({
|
|
24
|
+
cwd: process.cwd(),
|
|
25
|
+
here,
|
|
26
|
+
name,
|
|
27
|
+
exists: existsSync,
|
|
28
|
+
readName,
|
|
29
|
+
realpath: (path) => {
|
|
30
|
+
try {
|
|
31
|
+
return realpathSync(path);
|
|
32
|
+
} catch {
|
|
33
|
+
return path;
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
if ("missing" in choice) {
|
|
39
|
+
console.error(
|
|
40
|
+
`${choice.missing} has no copy of the factory installed. Install it there with: npm install --save-dev ${name}`,
|
|
41
|
+
);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
await import(pathToFileURL("run" in choice ? choice.run : choice.launch).href);
|
package/bin/launch.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Which copy of the factory the `factory` command runs. Plain JavaScript,
|
|
2
|
+
// since Node will not run TypeScript from inside node_modules, and free of
|
|
3
|
+
// the file system, which `deps` stands in for, so it can be tested alone.
|
|
4
|
+
// In order:
|
|
5
|
+
//
|
|
6
|
+
// 1. The source in the repository it was run from: the first folder at or
|
|
7
|
+
// above `cwd` that has `.git`, when it has `packages/factory/` with
|
|
8
|
+
// this package's name. So a git worktree runs its own copy, not the one
|
|
9
|
+
// `npx` finds up the tree.
|
|
10
|
+
// 2. The copy that repository installed, in its `node_modules`, when that
|
|
11
|
+
// is not this one: a global install hands the run to the repository's
|
|
12
|
+
// own version, which its synced files were written by.
|
|
13
|
+
// 3. Nothing, when this copy lives outside that repository and the
|
|
14
|
+
// repository has none of its own: the caller says how to install it.
|
|
15
|
+
// 4. Itself: `src/cli.mts` beside it when that exists, or `dist/cli.mjs`,
|
|
16
|
+
// the compiled code an installed package ships. Outside any
|
|
17
|
+
// repository, as in the poller's image, it always runs itself.
|
|
18
|
+
|
|
19
|
+
import { dirname, join, relative, isAbsolute } from "node:path";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @param {{
|
|
23
|
+
* cwd: string,
|
|
24
|
+
* here: string,
|
|
25
|
+
* name: string,
|
|
26
|
+
* exists: (path: string) => boolean,
|
|
27
|
+
* readName: (manifest: string) => string | null,
|
|
28
|
+
* realpath: (path: string) => string,
|
|
29
|
+
* }} deps
|
|
30
|
+
* @returns {{ run: string } | { launch: string } | { missing: string }}
|
|
31
|
+
*/
|
|
32
|
+
export function chooseEntry(deps) {
|
|
33
|
+
const { cwd, here, name, exists, readName, realpath } = deps;
|
|
34
|
+
const root = repositoryRoot(cwd, exists);
|
|
35
|
+
|
|
36
|
+
if (root) {
|
|
37
|
+
const pkg = join(root, "packages", "factory");
|
|
38
|
+
const cli = join(pkg, "src", "cli.mts");
|
|
39
|
+
if (exists(cli) && readName(join(pkg, "package.json")) === name)
|
|
40
|
+
return { run: cli };
|
|
41
|
+
|
|
42
|
+
const installed = join(root, "node_modules", ...name.split("/"));
|
|
43
|
+
const isOurs = readName(join(installed, "package.json")) === name;
|
|
44
|
+
const isThis = isOurs && realpath(installed) === realpath(here);
|
|
45
|
+
if (isOurs && !isThis)
|
|
46
|
+
return { launch: join(installed, "bin", "factory.js") };
|
|
47
|
+
if (!isOurs && !inside(realpath(here), realpath(root)))
|
|
48
|
+
return { missing: root };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const beside = join(here, "src", "cli.mts");
|
|
52
|
+
return { run: exists(beside) ? beside : join(here, "dist", "cli.mjs") };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** The first folder at or above `dir` that has `.git`, or null. */
|
|
56
|
+
function repositoryRoot(dir, exists) {
|
|
57
|
+
for (;;) {
|
|
58
|
+
if (exists(join(dir, ".git"))) return dir;
|
|
59
|
+
if (dirname(dir) === dir) return null;
|
|
60
|
+
dir = dirname(dir);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function inside(path, folder) {
|
|
65
|
+
const rel = relative(folder, path);
|
|
66
|
+
return rel === "" || (!rel.startsWith("..") && !isAbsolute(rel));
|
|
67
|
+
}
|
package/dist/board.d.mts
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { type Settings } from "./config.mts";
|
|
3
|
+
import { type Columns, type Board, type BoardField, type Derived, type PullRequest, type RepoSnapshot } from "./lib/work-status.mts";
|
|
4
|
+
import { type Runner } from "./runner/index.mts";
|
|
5
|
+
import { type Ticket, type Tickets, type Write } from "./tickets/types.mts";
|
|
6
|
+
export type { Write };
|
|
7
|
+
/** Which of the board's fields the sync writes, named as the settings name
|
|
8
|
+
* them; null means never. */
|
|
9
|
+
export type FieldNames = {
|
|
10
|
+
session: string | null;
|
|
11
|
+
runsIn: string | null;
|
|
12
|
+
cost: string | null;
|
|
13
|
+
};
|
|
14
|
+
/** What the settings say about the board: the column each state shows in
|
|
15
|
+
* and the fields written. */
|
|
16
|
+
export type BoardConfig = {
|
|
17
|
+
columns: Columns;
|
|
18
|
+
fields: FieldNames;
|
|
19
|
+
};
|
|
20
|
+
export declare const DEFAULT_FIELDS: FieldNames;
|
|
21
|
+
export declare const DEFAULT_BOARD: BoardConfig;
|
|
22
|
+
/** The columns and fields the settings name. */
|
|
23
|
+
export declare function boardConfigOf(s: Settings): BoardConfig;
|
|
24
|
+
export type Fields = {
|
|
25
|
+
status: BoardField;
|
|
26
|
+
/** The fields to write, or null for one the sync skips. */
|
|
27
|
+
session: BoardField | null;
|
|
28
|
+
runsIn: BoardField | null;
|
|
29
|
+
cost: BoardField | null;
|
|
30
|
+
};
|
|
31
|
+
export type Inspection = {
|
|
32
|
+
status: BoardField | null;
|
|
33
|
+
fields: Pick<Fields, "session" | "runsIn" | "cost">;
|
|
34
|
+
/** Each field's line in the report: what the sync does with it. */
|
|
35
|
+
lines: {
|
|
36
|
+
label: string;
|
|
37
|
+
text: string;
|
|
38
|
+
}[];
|
|
39
|
+
/** Cards in a column no state names, left alone. */
|
|
40
|
+
notes: string[];
|
|
41
|
+
problems: string[];
|
|
42
|
+
};
|
|
43
|
+
/** What the factory will do with a board's fields: the problems that stop
|
|
44
|
+
* it, and what each field and column means. The sync never creates or
|
|
45
|
+
* changes a field. */
|
|
46
|
+
export declare function inspectBoard(fields: BoardField[], cfg?: BoardConfig): Inspection;
|
|
47
|
+
/** The board's fields, or an error naming everything that is wrong with
|
|
48
|
+
* them. */
|
|
49
|
+
export declare function checkFields(fields: BoardField[], cfg?: BoardConfig): Fields;
|
|
50
|
+
/** The report `factory board check` prints: each state's column, each
|
|
51
|
+
* field, then the notes and problems. */
|
|
52
|
+
export declare function boardReport(number: number, board: Board, cfg: BoardConfig, settings: Pick<Settings, "builds">): string[];
|
|
53
|
+
export type Plan = {
|
|
54
|
+
number: number;
|
|
55
|
+
itemId: string | null;
|
|
56
|
+
derived: Derived;
|
|
57
|
+
/** The cost markers' sum as subscription dollars, or null when there are
|
|
58
|
+
* none. */
|
|
59
|
+
cost: number | null;
|
|
60
|
+
writes: Write[];
|
|
61
|
+
/** The column the card sits in when no state names it: the sync leaves
|
|
62
|
+
* such a card alone. */
|
|
63
|
+
unmapped?: string;
|
|
64
|
+
};
|
|
65
|
+
/** What each issue's fields should hold, and which writes get them there.
|
|
66
|
+
* A card's Session is an Actions run's page, which `runPage` gives for its
|
|
67
|
+
* ID, and any other session as it is. */
|
|
68
|
+
export declare function planSync(snapshot: RepoSnapshot, board: Board, repository: string, runPage: (id: string) => string, cfg?: BoardConfig): Plan[];
|
|
69
|
+
export declare function logLine(plan: Plan): string;
|
|
70
|
+
export type Comment = {
|
|
71
|
+
issue: number;
|
|
72
|
+
body: string;
|
|
73
|
+
};
|
|
74
|
+
type PullEvent = {
|
|
75
|
+
action: string;
|
|
76
|
+
pull_request: {
|
|
77
|
+
number: number;
|
|
78
|
+
merged: boolean;
|
|
79
|
+
body: string | null;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
/** The comments a closed pull request calls for: one on each issue it
|
|
83
|
+
* closes when it was not merged, and one on each open follow-ups issue it
|
|
84
|
+
* built part of without closing. */
|
|
85
|
+
export declare function closedPullComments(event: PullEvent, closes: number[], openFollowUps: number[], columns?: Columns): Comment[];
|
|
86
|
+
/** The nightly run's clears: claims and starts over 24 hours old with no
|
|
87
|
+
* pull request. */
|
|
88
|
+
export declare function nightlyComments(snapshot: RepoSnapshot, now: Date, columns?: Columns): Comment[];
|
|
89
|
+
/** What collect saves for apply: the tickets and the pull requests. */
|
|
90
|
+
export type Saved = {
|
|
91
|
+
tickets: Ticket[];
|
|
92
|
+
pulls: PullRequest[];
|
|
93
|
+
donePulls: PullRequest[];
|
|
94
|
+
};
|
|
95
|
+
/** The pull requests the sync reads: the open ones with their comments, for
|
|
96
|
+
* Cost, which issues one closes, and those that linked to a ticket. */
|
|
97
|
+
export type PullSource = {
|
|
98
|
+
open(options: {
|
|
99
|
+
costs: boolean;
|
|
100
|
+
}): Promise<PullRequest[]>;
|
|
101
|
+
linking(skip: number[]): Promise<PullRequest[]>;
|
|
102
|
+
closes(pull: number): Promise<number[]>;
|
|
103
|
+
};
|
|
104
|
+
export type Deps = {
|
|
105
|
+
/** The ticket system and the pull requests for the repository and board
|
|
106
|
+
* named. */
|
|
107
|
+
open: (settings: Settings, target: {
|
|
108
|
+
repository: string;
|
|
109
|
+
board: number | null;
|
|
110
|
+
}) => Promise<{
|
|
111
|
+
tickets: Tickets;
|
|
112
|
+
pulls: PullSource;
|
|
113
|
+
}>;
|
|
114
|
+
/** The runner of that name, for the page of a run. */
|
|
115
|
+
runner: (repository: string, name: string) => Pick<Runner, "runPage">;
|
|
116
|
+
env: Record<string, string | undefined>;
|
|
117
|
+
now: () => Date;
|
|
118
|
+
out: (line: string) => void;
|
|
119
|
+
readFile: (path: string) => string;
|
|
120
|
+
writeFile: (path: string, text: string) => void;
|
|
121
|
+
/** The factory's settings: the ticket system, and the board's number
|
|
122
|
+
* and the repository where FACTORY_BOARD_NUMBER and GITHUB_REPOSITORY do
|
|
123
|
+
* not name them. */
|
|
124
|
+
settings: () => Promise<Settings>;
|
|
125
|
+
};
|
|
126
|
+
export declare function main(argv: string[], deps: Deps): Promise<number>;
|
|
127
|
+
/** `factory board collect` and `factory board apply`. */
|
|
128
|
+
export declare function run(argv: string[]): Promise<number>;
|