@jnyross/code-factory 1.1.3 → 1.1.5

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 CHANGED
@@ -71,12 +71,15 @@ npm run harness:ui:capture-browser-evidence
71
71
  npm run harness:ui:verify-browser-evidence
72
72
  npm run harness:risk-tier
73
73
  npm run harness:weekly-metrics
74
+ npm run spec:normalize
75
+ npm run spec:validate
76
+ npm run spec:check
74
77
  ```
75
78
 
76
79
  ## Branch Protection
77
80
  Merge blocking is enforced via GitHub branch protection requiring `risk-policy-finalize`.
78
81
 
79
- - `code-factory --github` now applies this automatically.
82
+ - `code-factory` applies this automatically when it creates the GitHub repo (default behavior).
80
83
  - For repos created from GitHub template UI, run:
81
84
 
82
85
  ```bash
@@ -117,19 +120,19 @@ npm install -g @jnyross/code-factory
117
120
  ```
118
121
 
119
122
  ## Create a New Project
120
- Local only:
123
+ Default (local scaffold + create/push GitHub repo):
121
124
  ```bash
122
125
  code-factory my-next-app ~/Projects
123
126
  ```
124
127
 
125
- Create + push GitHub repo in one command:
128
+ Local only (opt out of GitHub creation):
126
129
  ```bash
127
- code-factory my-next-app ~/Projects --github --private
130
+ code-factory my-next-app ~/Projects --no-github
128
131
  ```
129
132
 
130
133
  Examples:
131
134
  ```bash
132
- code-factory my-next-app --github --owner my-org --repo my-org/my-next-app --public
135
+ code-factory my-next-app --owner my-org --repo my-org/my-next-app --public
133
136
  ```
134
137
 
135
138
  Compatibility alias:
@@ -142,6 +145,15 @@ Compatibility alias:
142
145
  - `opencode` (default model `minimax-coding-plan/MiniMax-M2.5`)
143
146
  - `custom`
144
147
 
148
+ Before task execution, `ralph.sh` now runs a spec gate:
149
+ 1. normalize `ARCHITECTURE.yaml` + `prd.json` into canonical format
150
+ 2. validate both files strictly
151
+ 3. if still invalid, auto-repair with your selected local engine and retry (bounded)
152
+
153
+ Defaults:
154
+ - `SPEC_REPAIR_ENABLED=true`
155
+ - `SPEC_REPAIR_MAX_RETRIES=3`
156
+
145
157
  Examples:
146
158
  ```bash
147
159
  ./ralph.sh --once
@@ -15,22 +15,24 @@ function usage(exitCode = 0) {
15
15
  code-factory new <project-name> [destination-directory] [options]
16
16
 
17
17
  Options:
18
- --github Create and push a new GitHub repo via gh CLI
19
- --public Use public visibility for --github
20
- --private Use private visibility for --github (default)
21
- --owner <owner> GitHub owner/org for --github (defaults to gh auth user)
18
+ --github Create and push a GitHub repo via gh CLI (default)
19
+ --no-github Skip GitHub creation and keep project local only
20
+ --public Use public visibility for GitHub repo creation
21
+ --private Use private visibility for GitHub repo creation (default)
22
+ --owner <owner> GitHub owner/org (defaults to gh auth user)
22
23
  --repo <name|owner/name>
23
24
  GitHub repo name override (default: slugified project name)
24
25
  --no-branch-protection
25
- Skip automatic main branch protection setup for --github
26
+ Skip automatic main branch protection setup for GitHub creation
26
27
  --template-url <url> Override template repository URL for this run
27
28
  -h, --help Show help
28
29
 
29
30
  Examples:
30
31
  code-factory my-app
32
+ code-factory my-app ~/Software_Projects --no-github
31
33
  code-factory "Youth Reg Response Platform" ~/Software_Projects
32
34
  code-factory my-app ~/Software_Projects --github --private
33
- code-factory my-app --github --owner my-org --repo my-org/my-app
35
+ code-factory my-app --owner my-org --repo my-org/my-app --public
34
36
  `);
35
37
  process.exit(exitCode);
36
38
  }
@@ -59,7 +61,7 @@ function slugify(name) {
59
61
 
60
62
  function parseArgs(rawArgs) {
61
63
  const options = {
62
- github: false,
64
+ github: true,
63
65
  visibility: "private",
64
66
  owner: null,
65
67
  repo: null,
@@ -82,6 +84,11 @@ function parseArgs(rawArgs) {
82
84
  continue;
83
85
  }
84
86
 
87
+ if (arg === "--no-github") {
88
+ options.github = false;
89
+ continue;
90
+ }
91
+
85
92
  if (arg === "--public") {
86
93
  options.visibility = "public";
87
94
  continue;
@@ -157,6 +164,16 @@ function deriveGitHubRepo(projectName, options) {
157
164
  return { owner, repo };
158
165
  }
159
166
 
167
+ function ensureGitHubCliReady() {
168
+ try {
169
+ runCapture("gh", ["auth", "status"]);
170
+ } catch {
171
+ throw new Error(
172
+ "GitHub creation is enabled by default. Run `gh auth login` first or pass --no-github for local-only setup."
173
+ );
174
+ }
175
+ }
176
+
160
177
  function configureBranchProtection({ owner, repo }) {
161
178
  const requiredChecks = ["risk-policy-finalize"];
162
179
  const payload = {
@@ -209,6 +226,8 @@ function createProject(projectName, destinationDir, options) {
209
226
  run("git", ["-C", targetPath, "branch", "-M", "main"]);
210
227
 
211
228
  if (options.github) {
229
+ ensureGitHubCliReady();
230
+
212
231
  const { owner, repo } = deriveGitHubRepo(projectName, options);
213
232
  const fullRepo = `${owner}/${repo}`;
214
233
  const visibilityFlag = options.visibility === "public" ? "--public" : "--private";
@@ -227,6 +246,8 @@ function createProject(projectName, destinationDir, options) {
227
246
  );
228
247
  }
229
248
  }
249
+ } else {
250
+ console.log("GitHub repo creation skipped (--no-github).");
230
251
  }
231
252
 
232
253
  console.log("Your new Code Factory project is ready!");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jnyross/code-factory",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "Bootstrap new repos from the Code Factory template.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -31,7 +31,10 @@
31
31
  "harness:ui:capture-browser-evidence": "node scripts/control-plane/capture-browser-evidence.mjs",
32
32
  "harness:ui:verify-browser-evidence": "node scripts/control-plane/verify-browser-evidence.mjs",
33
33
  "harness:ui:pre-pr": "npm run harness:ui:capture-browser-evidence && npm run harness:ui:verify-browser-evidence",
34
- "harness:weekly-metrics": "node scripts/control-plane/weekly-metrics.mjs"
34
+ "harness:weekly-metrics": "node scripts/control-plane/weekly-metrics.mjs",
35
+ "spec:normalize": "node scripts/control-plane/normalize-specs.mjs --write",
36
+ "spec:validate": "node scripts/control-plane/validate-specs.mjs",
37
+ "spec:check": "npm run spec:normalize && npm run spec:validate"
35
38
  },
36
39
  "files": [
37
40
  "bin",