@davidbyoung/software-factory 0.0.0-stage → 0.1.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.
- 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 +205 -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,166 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { type Columns, type StateKey } from "./lib/work-status.mts";
|
|
3
|
+
export declare class SettingsError extends Error {
|
|
4
|
+
}
|
|
5
|
+
export declare const ROLES: readonly ["mockups", "builder", "reviewer"];
|
|
6
|
+
export type Role = (typeof ROLES)[number];
|
|
7
|
+
export declare const TRIGGERS: readonly ["own-server", "github-action", "manual"];
|
|
8
|
+
export declare const SPECS: readonly ["none", "openspec"];
|
|
9
|
+
declare const FIELD_DEFAULTS: {
|
|
10
|
+
readonly session: "Session";
|
|
11
|
+
readonly "runs-in": "Runs in";
|
|
12
|
+
readonly cost: "Cost";
|
|
13
|
+
};
|
|
14
|
+
export type FieldKey = keyof typeof FIELD_DEFAULTS;
|
|
15
|
+
export type Plugin = {
|
|
16
|
+
kind: "skill" | "agent";
|
|
17
|
+
name: string;
|
|
18
|
+
role: Role;
|
|
19
|
+
files: string[];
|
|
20
|
+
labels: string[];
|
|
21
|
+
};
|
|
22
|
+
export type Settings = {
|
|
23
|
+
version: 1;
|
|
24
|
+
repository: string;
|
|
25
|
+
tickets: {
|
|
26
|
+
type: "github";
|
|
27
|
+
board: number | null;
|
|
28
|
+
/** The board's column for each state, null for none. */
|
|
29
|
+
columns: Record<StateKey, string | null>;
|
|
30
|
+
/** The board's field for each of three the sync writes, null for none. */
|
|
31
|
+
fields: Record<FieldKey, string | null>;
|
|
32
|
+
};
|
|
33
|
+
/** Where pull requests are. */
|
|
34
|
+
codeHost: {
|
|
35
|
+
type: "github";
|
|
36
|
+
};
|
|
37
|
+
builds: {
|
|
38
|
+
/** What notices a card moved to Ready and starts its build. */
|
|
39
|
+
trigger: (typeof TRIGGERS)[number];
|
|
40
|
+
/** Where an unattended build runs. */
|
|
41
|
+
runner: "github-actions";
|
|
42
|
+
};
|
|
43
|
+
specs: (typeof SPECS)[number];
|
|
44
|
+
beforeCommit: string[];
|
|
45
|
+
/** Commands an unattended build runs from the root before it starts. */
|
|
46
|
+
buildSetup: string[];
|
|
47
|
+
plugins: Plugin[];
|
|
48
|
+
autoMerge: {
|
|
49
|
+
allow: string[];
|
|
50
|
+
deny: string[];
|
|
51
|
+
commands: string[];
|
|
52
|
+
};
|
|
53
|
+
/** The CI review, on when `ci-review` is written, with the commands it
|
|
54
|
+
* may run as prefixes beside the factory's own; null when it is off. */
|
|
55
|
+
ciReview: {
|
|
56
|
+
commands: string[];
|
|
57
|
+
} | null;
|
|
58
|
+
/** How the factory looks at the repository's website; null when the
|
|
59
|
+
* repository is not one. */
|
|
60
|
+
site: Site | null;
|
|
61
|
+
/** How long each kind of unattended session may run, in minutes. */
|
|
62
|
+
sessionMinutes: Record<SessionKind, number>;
|
|
63
|
+
};
|
|
64
|
+
/** Each kind of unattended session, with how long it may run by default. */
|
|
65
|
+
export declare const SESSION_MINUTES: {
|
|
66
|
+
readonly build: 230;
|
|
67
|
+
readonly conflicts: 110;
|
|
68
|
+
readonly review: 50;
|
|
69
|
+
readonly dependencies: 50;
|
|
70
|
+
};
|
|
71
|
+
export type SessionKind = keyof typeof SESSION_MINUTES;
|
|
72
|
+
export type Site = {
|
|
73
|
+
start: string;
|
|
74
|
+
url: string;
|
|
75
|
+
designGuide: string | null;
|
|
76
|
+
/** The paths to look at, or null to find them. */
|
|
77
|
+
pages: string[] | null;
|
|
78
|
+
widths: number[];
|
|
79
|
+
hide: string[];
|
|
80
|
+
checks: string[];
|
|
81
|
+
maxPages: number;
|
|
82
|
+
startMinutes: number;
|
|
83
|
+
/** The WCAG level axe-core measures against, or none. */
|
|
84
|
+
accessibility: Accessibility;
|
|
85
|
+
/** Whether a style value the base site does not use is reported. */
|
|
86
|
+
newValues: boolean;
|
|
87
|
+
};
|
|
88
|
+
export declare const ACCESSIBILITY: readonly ["wcag22aa", "wcag21aa", "wcag2aa", "none"];
|
|
89
|
+
export type Accessibility = (typeof ACCESSIBILITY)[number];
|
|
90
|
+
/** The agent that needs `site`. */
|
|
91
|
+
export declare const SITE_AGENT = "factory-ui-reviewer";
|
|
92
|
+
export declare const NO_PLAYWRIGHT = "site needs Playwright: npm install -D playwright";
|
|
93
|
+
/** The keys each block allows, by the block's path: `""` is the top of the
|
|
94
|
+
* file and `plugins[]` is one plug-in. `settings.schema.json` lists the same
|
|
95
|
+
* keys, and a test fails when the two differ. A key the code accepts goes
|
|
96
|
+
* here, in the schema, and in docs/configuration.md. */
|
|
97
|
+
export declare const SETTINGS_KEYS: Record<string, readonly string[]>;
|
|
98
|
+
/** `factory config get site`: every key in the table's order. */
|
|
99
|
+
export declare function siteLines(site: Site): string[];
|
|
100
|
+
/** The root of the repository a command runs in: the nearest folder at or
|
|
101
|
+
* above `from` that holds `.git`, or `from` itself when none does. */
|
|
102
|
+
export declare function repoRoot(from?: string): string;
|
|
103
|
+
export declare const SETTINGS_FILE = ".claude/factory.yaml";
|
|
104
|
+
/** The settings with every default filled in. Throws a SettingsError naming
|
|
105
|
+
* the key on anything unsound. `exists` says whether a path from the root
|
|
106
|
+
* exists, for the plug-ins' files. */
|
|
107
|
+
export declare function parseSettings(raw: unknown, exists: (path: string) => boolean): Settings;
|
|
108
|
+
/** One line for each pattern that matches none of `files`: a stale pattern
|
|
109
|
+
* is how a policy rots. */
|
|
110
|
+
export declare function patternWarnings(s: Settings, files: string[]): string[];
|
|
111
|
+
type YamlLoad = (text: string) => unknown;
|
|
112
|
+
export type Deps = {
|
|
113
|
+
readFile: () => string;
|
|
114
|
+
exists: (path: string) => boolean;
|
|
115
|
+
/** Whether an npm package resolves from the repository's root. */
|
|
116
|
+
hasPackage: (name: string) => boolean;
|
|
117
|
+
listFiles: () => string[];
|
|
118
|
+
loadYaml: () => Promise<YamlLoad>;
|
|
119
|
+
out: (line: string) => void;
|
|
120
|
+
err: (line: string) => void;
|
|
121
|
+
};
|
|
122
|
+
export declare const NO_DEPENDENCIES = "The factory's settings cannot be read until dependencies are installed: run npm ci.";
|
|
123
|
+
/** The settings file: FACTORY_SETTINGS where it is set, for trying settings
|
|
124
|
+
* against a board without changing the repository's, and otherwise the
|
|
125
|
+
* repository's own. */
|
|
126
|
+
export declare const settingsPath: (root: string, env?: Record<string, string | undefined>) => string;
|
|
127
|
+
export declare const defaultDeps: (root?: string) => Deps;
|
|
128
|
+
/** The column each state shows in on the board, null for none. */
|
|
129
|
+
export declare function columnsOf(s: Settings): Columns;
|
|
130
|
+
/** The board's names for the fields the sync writes, null for none. */
|
|
131
|
+
export declare function fieldNamesOf(s: Settings): {
|
|
132
|
+
session: string | null;
|
|
133
|
+
runsIn: string | null;
|
|
134
|
+
cost: string | null;
|
|
135
|
+
};
|
|
136
|
+
/** The settings of the checkout the command runs in. */
|
|
137
|
+
export declare const loadSettings: (d?: Deps) => Promise<Settings>;
|
|
138
|
+
/** The settings' plug-ins, and the factory's design skill as the mockups
|
|
139
|
+
* plug-in of a site that lists none, once it is synced. */
|
|
140
|
+
export declare function pluginsOf(s: Settings, exists: (path: string) => boolean): Plugin[];
|
|
141
|
+
export declare function main(argv: string[], d: Deps): Promise<number>;
|
|
142
|
+
/** `factory config get KEY`, `factory config check`, and
|
|
143
|
+
* `factory plugins [ROLE]`. */
|
|
144
|
+
export declare function run(argv: string[]): Promise<number>;
|
|
145
|
+
/** What a reading needs from the settings. */
|
|
146
|
+
export type Target = {
|
|
147
|
+
repository: string;
|
|
148
|
+
board: number | null;
|
|
149
|
+
/** Whether something starts builds from the board. */
|
|
150
|
+
watched: boolean;
|
|
151
|
+
/** The column each state shows in on the board. */
|
|
152
|
+
columns: Columns;
|
|
153
|
+
};
|
|
154
|
+
/** The settings' answer, with GITHUB_REPOSITORY and FACTORY_BOARD_NUMBER
|
|
155
|
+
* winning where they are set. */
|
|
156
|
+
export declare function targetOf(s: Settings, env: Record<string, string | undefined>): Target;
|
|
157
|
+
/** The repository, code host, and runner for a command a workflow runs
|
|
158
|
+
* too. There GITHUB_REPOSITORY names the repository and the settings are
|
|
159
|
+
* not read, so an unreadable settings file cannot fail the workflow's step,
|
|
160
|
+
* and the code host and the runner are the defaults. */
|
|
161
|
+
export declare function reachOf(env: Record<string, string | undefined>, settings?: () => Promise<Settings>): Promise<{
|
|
162
|
+
repository: string;
|
|
163
|
+
codeHost: string;
|
|
164
|
+
runner: string;
|
|
165
|
+
}>;
|
|
166
|
+
export {};
|