create-jigo 1.15.18 → 2.0.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/cli.mjs CHANGED
@@ -176,13 +176,13 @@ function existingSource(root) {
176
176
  return { url, repo: githubRepo(url) };
177
177
  }
178
178
 
179
- function setupBody(check, local) {
179
+ function setupBody({ check, layers }, local) {
180
180
  return `## Summary
181
181
 
182
182
  \`\`\`text
183
183
  Repository
184
- core: pr and capture skills, ${check}
185
- typescript: when package.json exists
184
+ layers: ${layers.join(", ")}
185
+ pr and capture skills, ${check}
186
186
  Squash merge
187
187
  \`\`\`
188
188
 
@@ -264,7 +264,7 @@ async function adopt(root, kind, scratch) {
264
264
  setup.scripts.length > 0
265
265
  ? "Applicable local project checks passed."
266
266
  : "The setup diff preserves the repository’s files and checks.";
267
- const pr = host.createPull(base, branch, SETUP_TITLE, setupBody(check, evidence));
267
+ const pr = host.createPull(base, branch, SETUP_TITLE, setupBody(setup, evidence));
268
268
  print(`Setup PR: ${pr}\n${root}`);
269
269
  if (!flags["no-wait"]) await host.waitForCheck(head, check);
270
270
  configureProtection(host, base, check);
package/github.mjs CHANGED
@@ -42,6 +42,7 @@ export function github(cwd, repo) {
42
42
  allow_merge_commit: false,
43
43
  allow_rebase_merge: false,
44
44
  allow_squash_merge: true,
45
+ allow_update_branch: true,
45
46
  squash_merge_commit_title: "PR_TITLE",
46
47
  squash_merge_commit_message: "BLANK",
47
48
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-jigo",
3
- "version": "1.15.18",
3
+ "version": "2.0.0",
4
4
  "description": "Create or adopt a GitHub repository that uses jigo.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/setup.mjs CHANGED
@@ -262,5 +262,10 @@ export function configure(root, name, { kind = "plain", initial = false } = {})
262
262
  const check = configureCheck(root, Boolean(typescript));
263
263
  dependabot(root, Boolean(typescript));
264
264
  automerge(root, check.workflow);
265
- return { check: check.name, updateLock: typescript?.updateLock ?? false, scripts: typescript?.scripts ?? [] };
265
+ return {
266
+ check: check.name,
267
+ updateLock: typescript?.updateLock ?? false,
268
+ scripts: typescript?.scripts ?? [],
269
+ layers: ["core", ...(typescript?.layers ?? [])],
270
+ };
266
271
  }
package/typescript.mjs CHANGED
@@ -7,17 +7,34 @@ import { read, write, YAML } from "./files.mjs";
7
7
  import { releasePeers, releaseTag } from "./release.mjs";
8
8
 
9
9
  export const PACKAGE = "@mapringg/jigo";
10
- const CONFIGS = "node_modules/@mapringg/jigo/typescript";
10
+ const JIGO = "node_modules/@mapringg/jigo";
11
+ const CONFIGS = `${JIGO}/typescript`;
11
12
  const RULES = "jigo rules";
12
13
  const SCRIPTS = {
13
14
  lint: "oxlint",
14
15
  format: `oxfmt -c ${CONFIGS}/oxfmt.json`,
15
16
  "format:check": `oxfmt -c ${CONFIGS}/oxfmt.json --check`,
16
17
  knip: `knip -c ${CONFIGS}/knip.json && knip -c ${CONFIGS}/knip.json --production`,
18
+ dupes: `jscpd -c ${CONFIGS}/jscpd.json .`,
17
19
  };
18
- const OXLINTRC = `{ "extends": ["./${CONFIGS}/oxlint.json"] }\n`;
20
+ const RENAMED = {
21
+ "agent-docs": "no-unstructured-docs",
22
+ "design-system": "no-loosened-rules",
23
+ "feature-imports": "no-cross-feature-imports",
24
+ hono: "no-loose-handlers",
25
+ "next-data": "no-router-refresh",
26
+ "next-routes": "no-async-pages",
27
+ "no-put-routes": "no-unknown-methods",
28
+ params: "no-custom-params",
29
+ reducer: "no-multiple-reducers",
30
+ "repo-shape": "no-stray-files",
31
+ "server-actions": "no-inline-actions",
32
+ tests: "no-impure-tests",
33
+ };
34
+ const LAYERS = { web: ["react", "next"], api: ["hono"] };
19
35
  const MIGRATIONS = [
20
- [/node_modules\/@mapringg\/standard\/(oxlint|oxfmt|knip)\.json/g, `${CONFIGS}/$1.json`],
36
+ ...Object.entries(RENAMED).map(([from, to]) => [new RegExp(`"(?:standard|jigo)/${from}"`, "g"), `"jigo/${to}"`]),
37
+ [/node_modules\/@mapringg\/(?:standard|jigo)\/(oxlint|oxfmt|knip)\.json/g, `${CONFIGS}/$1.json`],
21
38
  [/\bstandard-rules\b/g, RULES],
22
39
  [/"standard\//g, '"jigo/'],
23
40
  [/@mapringg\/standard\b/g, PACKAGE],
@@ -44,20 +61,42 @@ const HOOKS = {
44
61
  ],
45
62
  };
46
63
 
47
- function migrate(root, dir = "") {
64
+ function walk(root, visit, dir = "") {
48
65
  for (const entry of readdirSync(join(root, dir), { withFileTypes: true })) {
49
66
  if (entry.name === "node_modules" || entry.name === ".git") continue;
50
67
  const rel = dir ? `${dir}/${entry.name}` : entry.name;
51
- if (entry.isDirectory()) migrate(root, rel);
52
- else if (MIGRATED.test(entry.name)) {
53
- const path = join(root, rel);
54
- const text = read(path);
68
+ if (entry.isDirectory()) walk(root, visit, rel);
69
+ else visit(entry.name, join(root, rel));
70
+ }
71
+ }
72
+
73
+ function migrate(root) {
74
+ walk(root, (name, path) => {
75
+ if (MIGRATED.test(name))
55
76
  write(
56
77
  path,
57
- MIGRATIONS.reduce((next, [from, to]) => next.replace(from, to), text),
78
+ MIGRATIONS.reduce((next, [from, to]) => next.replace(from, to), read(path)),
58
79
  );
59
- }
60
- }
80
+ });
81
+ }
82
+
83
+ function layers(root) {
84
+ const deps = new Set();
85
+ walk(root, (name, path) => {
86
+ if (name !== "package.json") return;
87
+ const manifest = JSON.parse(read(path));
88
+ for (const field of ["dependencies", "devDependencies", "peerDependencies"])
89
+ for (const dep of Object.keys(manifest[field] ?? {})) deps.add(dep);
90
+ });
91
+ return ["typescript", ...Object.keys(LAYERS).filter((layer) => LAYERS[layer].some((dep) => deps.has(dep)))];
92
+ }
93
+
94
+ function extend(root, wanted) {
95
+ const path = join(root, ".oxlintrc.json");
96
+ const config = JSON.parse(read(path) ?? "{}");
97
+ const current = config.extends ?? [];
98
+ const missing = wanted.map((layer) => `./${JIGO}/${layer}/oxlint.json`).filter((entry) => !current.includes(entry));
99
+ if (missing.length > 0) write(path, `${JSON.stringify({ ...config, extends: [...current, ...missing] }, null, 2)}\n`);
61
100
  }
62
101
 
63
102
  function install(root, manifest, text) {
@@ -122,9 +161,10 @@ export function configureTypescript(root) {
122
161
  const text = read(path);
123
162
  const manifest = JSON.parse(text);
124
163
  const updateLock = install(root, manifest, text);
125
- if (!existsSync(join(root, ".oxlintrc.json"))) write(join(root, ".oxlintrc.json"), OXLINTRC);
164
+ const included = layers(root);
165
+ extend(root, included);
126
166
  trust(root);
127
167
  addHooks(join(root, ".claude", "settings.json"), "claude");
128
168
  addHooks(join(root, ".codex", "hooks.json"), "codex");
129
- return { updateLock, scripts: Object.keys(manifest.scripts ?? {}) };
169
+ return { updateLock, scripts: Object.keys(manifest.scripts ?? {}), layers: included };
130
170
  }