@davidbyoung/software-factory 0.1.4 → 0.1.6
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/README.md +9 -8
- package/dist/cli.mjs +13 -1
- package/dist/code-host/github-setup.mjs +1 -1
- package/dist/config.d.mts +74 -20
- package/dist/config.mjs +326 -76
- package/dist/deps.d.mts +6 -4
- package/dist/deps.mjs +29 -7
- package/dist/doctor.d.mts +3 -0
- package/dist/doctor.mjs +7 -4
- package/dist/explain.d.mts +13 -2
- package/dist/explain.mjs +58 -43
- package/dist/init.mjs +9 -7
- package/dist/lib/default-branch.d.mts +1 -1
- package/dist/lib/default-branch.mjs +2 -2
- package/dist/lib/refined-check.mjs +1 -1
- package/dist/lib/work-status.d.mts +2 -2
- package/dist/lib/work-status.mjs +4 -4
- package/dist/parts.d.mts +1 -1
- package/dist/parts.mjs +2 -2
- package/dist/preset-commands.d.mts +65 -0
- package/dist/preset-commands.mjs +1148 -0
- package/dist/preset.d.mts +169 -0
- package/dist/preset.mjs +550 -0
- package/dist/remove.mjs +34 -1
- package/dist/review-cost.mjs +1 -1
- package/dist/review-tools.mjs +3 -3
- package/dist/session-start.d.mts +3 -0
- package/dist/session-start.mjs +12 -1
- package/dist/sync.d.mts +42 -7
- package/dist/sync.mjs +166 -32
- package/docs/builds.md +12 -11
- package/docs/cli.md +27 -8
- package/docs/configuration.md +723 -714
- package/docs/design.md +1 -1
- package/docs/developing.md +20 -8
- package/docs/existing-repo.md +1 -1
- package/docs/github/by-hand.md +9 -9
- package/docs/github/reference.md +4 -19
- package/docs/github/setup.md +3 -3
- package/docs/glossary.md +18 -9
- package/docs/limitations.md +4 -1
- package/docs/plugins.md +36 -24
- package/docs/presets.md +410 -0
- package/docs/quick-start.md +21 -18
- package/docs/removing.md +1 -1
- package/docs/skills.md +28 -23
- package/docs/updating.md +22 -14
- package/docs/workflow.md +13 -14
- package/package.json +1 -1
- package/rules.md +1 -1
- package/settings.schema.json +60 -11
- package/skills/factory-build/SKILL.md +1 -1
- package/skills/factory-deps/SKILL.md +23 -12
- package/skills/factory-design/SKILL.md +2 -2
- package/skills/factory-refine/SKILL.md +2 -2
- package/skills/factory-resolve-conflicts/SKILL.md +6 -0
- package/workflows/factory-claude-review.yml +8 -3
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
export declare const PRESET_FILE = "factory-preset.yaml";
|
|
2
|
+
export declare const CHOICES_FILE = ".claude/factory.choices.yaml";
|
|
3
|
+
export declare const LOCK_FILE = ".claude/factory.lock";
|
|
4
|
+
/** The layer name of the repository's own settings. */
|
|
5
|
+
export declare const OWN = ".claude/factory.yaml";
|
|
6
|
+
export declare const SYNC = "npx --no-install factory sync";
|
|
7
|
+
type Obj = Record<string, unknown>;
|
|
8
|
+
/** One value as text that is the same for equal values, whatever the order
|
|
9
|
+
* of a block's keys. */
|
|
10
|
+
export declare function stable(v: unknown): string;
|
|
11
|
+
/** A preset's package and the folder in it: `@acme/p/node` is the folder
|
|
12
|
+
* `node` of the package `@acme/p`. */
|
|
13
|
+
export declare function splitName(name: string): {
|
|
14
|
+
pkg: string;
|
|
15
|
+
folder: string;
|
|
16
|
+
};
|
|
17
|
+
/** A package's folder and version, found as Node finds it from `root`, or
|
|
18
|
+
* null when it is not installed. */
|
|
19
|
+
export declare function findPackage(root: string, pkg: string): {
|
|
20
|
+
dir: string;
|
|
21
|
+
version: string;
|
|
22
|
+
} | null;
|
|
23
|
+
export type Found = {
|
|
24
|
+
name: string;
|
|
25
|
+
pkg: string;
|
|
26
|
+
folder: string;
|
|
27
|
+
/** The preset's own folder, which holds its file. */
|
|
28
|
+
dir: string;
|
|
29
|
+
version: string;
|
|
30
|
+
};
|
|
31
|
+
export declare class PresetError extends Error {
|
|
32
|
+
}
|
|
33
|
+
/** The preset NAME as installed from `root`. Throws a PresetError saying
|
|
34
|
+
* what to do when it is not installed, or is no preset. */
|
|
35
|
+
export declare function findPreset(root: string, name: string): Found;
|
|
36
|
+
/** The agents and skills a preset in `dir` ships, each as the path it is
|
|
37
|
+
* written to in a repository and the file it comes from. */
|
|
38
|
+
export declare function shipped(dir: string): [string, string][];
|
|
39
|
+
/** How many agents and skills a preset ships, as `preset check` says it. */
|
|
40
|
+
export declare function shipsText(dir: string): string;
|
|
41
|
+
/** The keys no preset can set: each decides who a session takes
|
|
42
|
+
* instructions from or what merges without a person. */
|
|
43
|
+
export declare const OWN_ONLY: string[];
|
|
44
|
+
/** The list roles' paths, such as `plugins.build.reviewers`. */
|
|
45
|
+
export declare const PLUGIN_LISTS: string[];
|
|
46
|
+
/** The first key a block has that the settings do not know, as `factory
|
|
47
|
+
* config check` words it: `KEY: unknown key`. */
|
|
48
|
+
export declare function unknownKey(raw: unknown): string | null;
|
|
49
|
+
/** What is wrong with a preset's own settings, each as `KEY: MESSAGE`,
|
|
50
|
+
* before it is combined with any other layer. */
|
|
51
|
+
export declare function presetFaults(raw: unknown): {
|
|
52
|
+
key: string;
|
|
53
|
+
message: string;
|
|
54
|
+
/** Which of the refusals it is, for `preset check`'s advice. */
|
|
55
|
+
kind: "own-only" | "presets" | "off" | "unknown";
|
|
56
|
+
}[];
|
|
57
|
+
/** One layer's settings: a preset's, or `.claude/factory.yaml`'s. */
|
|
58
|
+
export type Layer = {
|
|
59
|
+
name: string;
|
|
60
|
+
raw: Obj;
|
|
61
|
+
};
|
|
62
|
+
/** Where a value in effect came from. `over` names the presets whose
|
|
63
|
+
* values it replaced, where that is part of its mark. */
|
|
64
|
+
export type Source = {
|
|
65
|
+
from: string;
|
|
66
|
+
state?: "chosen" | "not-chosen";
|
|
67
|
+
over?: string[];
|
|
68
|
+
};
|
|
69
|
+
export type Replaced = {
|
|
70
|
+
from: string;
|
|
71
|
+
value: unknown;
|
|
72
|
+
};
|
|
73
|
+
export type Disagreement = {
|
|
74
|
+
key: string;
|
|
75
|
+
/** Each preset's value, in layer order. */
|
|
76
|
+
values: Replaced[];
|
|
77
|
+
applies: string;
|
|
78
|
+
chosen: boolean;
|
|
79
|
+
};
|
|
80
|
+
export type Resolution = {
|
|
81
|
+
/** The combined settings, as one file would write them. */
|
|
82
|
+
raw: Obj;
|
|
83
|
+
/** By key: a setting's dotted path, a list item's `PATH[ITEM]`, a
|
|
84
|
+
* plugin's `PATH.NAME`, or a file's path. */
|
|
85
|
+
sources: Map<string, Source>;
|
|
86
|
+
overridden: Map<string, Replaced[]>;
|
|
87
|
+
disagreements: Disagreement[];
|
|
88
|
+
/** The keys each preset sets, for telling a stale choice. */
|
|
89
|
+
setBy: Map<string, Set<string>>;
|
|
90
|
+
/** Each agent or skill file a preset ships that is written, by its path
|
|
91
|
+
* in the repository: the file it comes from and its preset. */
|
|
92
|
+
files: Map<string, {
|
|
93
|
+
from: string;
|
|
94
|
+
source: string;
|
|
95
|
+
}>;
|
|
96
|
+
/** `kept PATH, ... over NAME` for each preset file not written. */
|
|
97
|
+
kept: string[];
|
|
98
|
+
};
|
|
99
|
+
export declare const itemKey: (path: string, item: unknown) => string;
|
|
100
|
+
export type Combine = {
|
|
101
|
+
layers: Layer[];
|
|
102
|
+
choices: Record<string, string>;
|
|
103
|
+
/** Whether a path is one of the factory's own files. */
|
|
104
|
+
factoryFile?: (path: string) => boolean;
|
|
105
|
+
/** Whether a path is a file the repository wrote itself. */
|
|
106
|
+
ownFile?: (path: string) => boolean;
|
|
107
|
+
/** Each preset's shipped files, by its name. */
|
|
108
|
+
ships?: Map<string, [string, string][]>;
|
|
109
|
+
read?: (file: string) => string;
|
|
110
|
+
};
|
|
111
|
+
/** The layers combined, the later over the earlier, with
|
|
112
|
+
* `.claude/factory.yaml` last. */
|
|
113
|
+
export declare function combine(c: Combine): Resolution;
|
|
114
|
+
/** The mark `factory config explain` gives a value from `source`, or null
|
|
115
|
+
* for none: a value only `.claude/factory.yaml` sets has none. */
|
|
116
|
+
export declare function markText(source: Source | undefined): string | null;
|
|
117
|
+
export declare const CHOICES_HEADER: string[];
|
|
118
|
+
/** The choices file's text, or null when it holds no choice. */
|
|
119
|
+
export declare function choicesText(choices: Record<string, string>): string | null;
|
|
120
|
+
/** Each choice a sync drops, with why: its preset is no longer listed, or
|
|
121
|
+
* no longer sets its key. */
|
|
122
|
+
export declare function staleChoices(choices: Record<string, string>, presets: string[], setBy: Map<string, Set<string>>): {
|
|
123
|
+
key: string;
|
|
124
|
+
reason: string;
|
|
125
|
+
}[];
|
|
126
|
+
/** `sha256:` and the hex SHA-256 of the settings file, a NUL byte, then the
|
|
127
|
+
* choices file, or nothing for a missing file. */
|
|
128
|
+
export declare function settingsHash(own: string | null, choices: string | null): string;
|
|
129
|
+
export declare const staleMessages: {
|
|
130
|
+
missing: string;
|
|
131
|
+
earlier: string;
|
|
132
|
+
changed: (file: string) => string;
|
|
133
|
+
notInstalled: (name: string) => string;
|
|
134
|
+
/** An older install is behind a pull: npm ci brings it up. A newer one
|
|
135
|
+
* is an update: the sync records it. */
|
|
136
|
+
version: (name: string, installed: string, locked: string) => string;
|
|
137
|
+
unreadable: string;
|
|
138
|
+
};
|
|
139
|
+
export type Lock = {
|
|
140
|
+
version: string;
|
|
141
|
+
presets: {
|
|
142
|
+
name: string;
|
|
143
|
+
version: string;
|
|
144
|
+
}[];
|
|
145
|
+
hash: string | null;
|
|
146
|
+
settings: Obj | null;
|
|
147
|
+
overridden: Record<string, Replaced[]>;
|
|
148
|
+
files: string[];
|
|
149
|
+
};
|
|
150
|
+
/** The lock's text read as YAML. A lock from an earlier release has no
|
|
151
|
+
* `settings`, and reads with it null. */
|
|
152
|
+
export declare function readLock(text: string, load: (t: string) => unknown): Lock;
|
|
153
|
+
export type StaleDeps = {
|
|
154
|
+
lock: string | null;
|
|
155
|
+
own: string | null;
|
|
156
|
+
choices: string | null;
|
|
157
|
+
/** The files of the two that differ from the last commit, for naming the
|
|
158
|
+
* one that changed. */
|
|
159
|
+
changed: () => string[];
|
|
160
|
+
/** A package's installed version, null when it is not installed, or
|
|
161
|
+
* undefined when there is no node_modules to look in. */
|
|
162
|
+
installed: (pkg: string) => string | null | undefined;
|
|
163
|
+
load: (t: string) => unknown;
|
|
164
|
+
};
|
|
165
|
+
/** Why the lock is stale, the first of: missing, from an earlier release,
|
|
166
|
+
* a settings file changed, a preset not installed, a preset at another
|
|
167
|
+
* version. Null when it is current. */
|
|
168
|
+
export declare function staleReason(d: StaleDeps): string | null;
|
|
169
|
+
export {};
|