@jnyross/code-factory 1.1.4 → 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
@@ -79,7 +79,7 @@ npm run spec:check
79
79
  ## Branch Protection
80
80
  Merge blocking is enforced via GitHub branch protection requiring `risk-policy-finalize`.
81
81
 
82
- - `code-factory --github` now applies this automatically.
82
+ - `code-factory` applies this automatically when it creates the GitHub repo (default behavior).
83
83
  - For repos created from GitHub template UI, run:
84
84
 
85
85
  ```bash
@@ -120,19 +120,19 @@ npm install -g @jnyross/code-factory
120
120
  ```
121
121
 
122
122
  ## Create a New Project
123
- Local only:
123
+ Default (local scaffold + create/push GitHub repo):
124
124
  ```bash
125
125
  code-factory my-next-app ~/Projects
126
126
  ```
127
127
 
128
- Create + push GitHub repo in one command:
128
+ Local only (opt out of GitHub creation):
129
129
  ```bash
130
- code-factory my-next-app ~/Projects --github --private
130
+ code-factory my-next-app ~/Projects --no-github
131
131
  ```
132
132
 
133
133
  Examples:
134
134
  ```bash
135
- 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
136
136
  ```
137
137
 
138
138
  Compatibility alias:
@@ -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.4",
3
+ "version": "1.1.5",
4
4
  "description": "Bootstrap new repos from the Code Factory template.",
5
5
  "type": "module",
6
6
  "license": "MIT",