@davidbyoung/software-factory 0.1.0 → 0.1.2

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.
@@ -8,7 +8,7 @@ import { existsSync, realpathSync } from "node:fs";
8
8
  import { homedir } from "node:os";
9
9
  import { dirname, isAbsolute, join, relative } from "node:path";
10
10
  import { fileURLToPath } from "node:url";
11
- import { defaultDeps, loadSettings } from "./config.mjs";
11
+ import { defaultDeps, loadSettings, settingsPath } from "./config.mjs";
12
12
  /** Heredoc bodies and quoted strings blanked, so a commit message, grep
13
13
  * pattern, or file body that mentions "git push -f" or "main" is not read as
14
14
  * part of a command. A quoted single word is unquoted instead: the shell
@@ -182,6 +182,10 @@ export async function checkCommit(input, err) {
182
182
  err(lastLines(`${r.stdout ?? ""}${r.stderr ?? ""}`).join("\n"));
183
183
  return `the factory in ${top} blocked it, as above.`;
184
184
  }
185
+ // A repository with no settings is not one the factory governs, such as
186
+ // another repository a session works in: it has no gate to run.
187
+ if (!existsSync(settingsPath(top)))
188
+ return null;
185
189
  let commands;
186
190
  try {
187
191
  commands = (await loadSettings(defaultDeps(top))).beforeCommit;
package/dist/sync.d.mts CHANGED
@@ -14,9 +14,10 @@ type Has = (path: string) => boolean;
14
14
  export declare function withMinutes(text: string, minutes: number, file: string): string;
15
15
  /** Each copy, as [path in the package, path in the repository]. */
16
16
  export declare function copies(pkg: string, s: Settings, has: Has): [string, string][];
17
- /** The launcher's path from the repository's root: the package's own
18
- * folder where it is inside the repository, as a workspace or installed,
19
- * and where it would be installed otherwise. */
17
+ /** The launcher's path from the repository's root: the root's own, where
18
+ * the repository is the package itself; the package's own folder where it
19
+ * is inside the repository, as a workspace or installed; and where it would
20
+ * be installed otherwise. */
20
21
  export declare function launcherPath(pkg: string, root: string, name: string): string;
21
22
  type HookEntry = {
22
23
  type: "command";
package/dist/sync.mjs CHANGED
@@ -90,14 +90,17 @@ export function copies(pkg, s, has) {
90
90
  add("actions", ".github/actions");
91
91
  return out;
92
92
  }
93
- /** The launcher's path from the repository's root: the package's own
94
- * folder where it is inside the repository, as a workspace or installed,
95
- * and where it would be installed otherwise. */
93
+ /** The launcher's path from the repository's root: the root's own, where
94
+ * the repository is the package itself; the package's own folder where it
95
+ * is inside the repository, as a workspace or installed; and where it would
96
+ * be installed otherwise. */
96
97
  export function launcherPath(pkg, root, name) {
97
98
  const rel = relative(realpathSync(root), realpathSync(pkg))
98
99
  .split(sep)
99
100
  .join("/");
100
- const base = rel && !rel.startsWith("..") && !rel.startsWith("/")
101
+ if (rel === "")
102
+ return LAUNCHER;
103
+ const base = !rel.startsWith("..") && !rel.startsWith("/")
101
104
  ? rel
102
105
  : `node_modules/${name}`;
103
106
  return `${base}/${LAUNCHER}`;
@@ -109,6 +109,10 @@ tickets:
109
109
  when you tell a session.
110
110
  - **If `board` is wrong:** the board sync fails and names the board it could
111
111
  not read.
112
+ - **One board can hold more than one repository's tickets.** Give each
113
+ repository the same `board`: each one's sync, `status`, and poller read
114
+ only the cards for its own issues, and GitHub's Repository field tells
115
+ them apart on the board.
112
116
 
113
117
  A board shows the six states of [Workflow](workflow.md) as columns, and
114
118
  keeps three fields the factory writes. A repository that writes nothing
@@ -8,8 +8,18 @@ How to work on the factory itself. For using it, start with the
8
8
  This repository holds the package, its docs, and its tests, and publishes
9
9
  the package to npm as `@davidbyoung/software-factory`. It was developed
10
10
  inside the private repository it was drawn out of until 0.1.0, and moved
11
- here with a fresh history. Its tickets are kept, for now, on that
12
- repository's board.
11
+ here with a fresh history. Its tickets are issues here, shown on a board
12
+ it shares with that repository: each repository's sync reads only its own
13
+ cards.
14
+
15
+ **It uses the factory on itself.** `.claude/factory.yaml` here sets the
16
+ board, OpenSpec, and the CI review, and `node bin/factory.js sync` copies
17
+ this repository's own skills, agents, rules, and workflows into `.claude/`
18
+ and `.github/`, with hooks that run `bin/factory.js` at the root. So a
19
+ change to a skill shows in the same pull request twice: the source, and
20
+ the copy this repository's own sessions follow. `CLAUDE.md` says what is
21
+ this repository's own, and `npx --no-install factory` finds the package's
22
+ own command here without installing it.
13
23
 
14
24
  A change reaches a repository that uses the factory as a release: a new
15
25
  version on npm, then Dependabot's pull request there, which `factory-deps`
@@ -350,6 +360,7 @@ its own tests against faked replies.
350
360
  | `factory sync --check` | The copies match the source |
351
361
  | Pack and install | CI packs the folder, installs it into an empty scratch repository, and runs `sync`, `config check`, and one read-only command there. It works outside its host |
352
362
  | `/factory-trace` | A change to a rule did not make some kind of change heavier, lighter, or ambiguous |
363
+ | Fork safety | No workflow it runs or ships could run a fork's code with a secret or write access (`tests/fork-safety.test.ts`). This repository is public |
353
364
  | One throwaway ticket | After each stage, one small ticket goes through refine, build, and review for real. Nothing else tests the prose |
354
365
 
355
366
  The skills are instructions, and instructions cannot be unit tested. The
@@ -357,15 +368,18 @@ last row is the only real proof that a change to one still works.
357
368
 
358
369
  ## Releasing
359
370
 
360
- 1. Raise `version` in `package.json` in a pull request, and merge it.
371
+ 1. Raise `version` in `package.json` in a pull request, run `factory sync`
372
+ so `.claude/factory.lock` records it, and merge it.
361
373
  2. Tag the merge commit with the same version and push the tag:
362
374
 
363
375
  ```bash
364
376
  git tag v0.2.0 && git push origin v0.2.0
365
377
  ```
366
378
 
367
- 3. The release workflow checks that the tag matches `package.json`,
368
- runs the tests and `pack-check`, and publishes the version to npm.
379
+ 3. The release workflow runs the whole CI on the tagged commit, the same
380
+ jobs a pull request gets. Only once they pass does it check that the tag
381
+ matches `package.json` and that `main` has the commit, then publish the
382
+ version to npm.
369
383
 
370
384
  The first version, 0.1.0, was published by hand, since npm sets up a
371
385
  trusted publisher only for a package that exists:
package/docs/plugins.md CHANGED
@@ -32,7 +32,7 @@ three. A repository can have several plug-ins in one role, or none.
32
32
 
33
33
  Reads a finished change and reports problems.
34
34
 
35
- | | |
35
+ | Step | What happens |
36
36
  | ------------------- | -------------------------------------------------------------------------------------------- |
37
37
  | **Called** | By `factory-build`, after the change is built and before the pull request opens |
38
38
  | **Considered when** | The change touches a file matching one of its `files` patterns |
@@ -52,7 +52,7 @@ A repository with `site` in its settings has one already: the factory's
52
52
  own `factory-design` skill, which `factory sync` writes, is its `mockups`
53
53
  plug-in unless you list one of your own with this role.
54
54
 
55
- | | |
55
+ | Step | What happens |
56
56
  | --------------- | ----------------------------------------------------------------------------------- |
57
57
  | **Called** | By `factory-refine`, when one of the decisions it would bring you is about the look |
58
58
  | **Handed** | The ticket and the decision |
@@ -64,7 +64,7 @@ plug-in unless you list one of your own with this role.
64
64
 
65
65
  Builds a kind of ticket the general build would do badly.
66
66
 
67
- | | |
67
+ | Step | What happens |
68
68
  | ------------- | -------------------------------------------------------------------------- |
69
69
  | **Called** | By `factory-build`, in place of its own build step |
70
70
  | **Used when** | The ticket carries one of its `labels` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@davidbyoung/software-factory",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Refines, builds, and reviews tickets with Claude Code sessions, from a board to a merged pull request.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -33,10 +33,11 @@
33
33
  "typecheck": "tsc --noEmit",
34
34
  "format": "prettier --write .",
35
35
  "format:check": "prettier --check .",
36
- "check": "prettier --check . && tsc --noEmit && vitest run",
36
+ "check": "prettier --check . && tsc --noEmit && npm run -s spec:validate && node bin/factory.js sync --check && node bin/factory.js config check && vitest run",
37
37
  "prepack": "tsc -p tsconfig.build.json",
38
38
  "pack-check": "node tests/pack-check.mts",
39
- "site-check": "node --test tests/site-check.mts"
39
+ "site-check": "node --test tests/site-check.mts",
40
+ "spec:validate": "DO_NOT_TRACK=1 openspec validate --all --strict --no-interactive"
40
41
  },
41
42
  "dependencies": {
42
43
  "@inquirer/prompts": "^8.8.0",
@@ -46,6 +47,7 @@
46
47
  "yaml": "^2.9.1"
47
48
  },
48
49
  "devDependencies": {
50
+ "@fission-ai/openspec": "2.0.0",
49
51
  "@types/js-yaml": "^4.0.9",
50
52
  "@types/node": "^22.18.0",
51
53
  "@types/pngjs": "^6.0.5",