@clearlydev/nx-archweave 0.5.2 → 0.6.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.
Files changed (36) hide show
  1. package/dist/generators/_chunks/{chunk-ILICA6LC.js → chunk-23NN76E3.js} +1 -1
  2. package/dist/generators/_chunks/{chunk-VTXXW2B5.js → chunk-3HSNM6AS.js} +5 -55
  3. package/dist/generators/_chunks/{chunk-624F6DEP.js → chunk-7EDJKUY4.js} +4 -106
  4. package/dist/generators/_chunks/chunk-AMOOSD5Q.js +79 -0
  5. package/dist/generators/_chunks/{chunk-M7OQWSNF.js → chunk-C2WELXMV.js} +11 -3
  6. package/dist/generators/_chunks/{chunk-E565RG2B.js → chunk-CSJZ4PP3.js} +15 -0
  7. package/dist/generators/_chunks/{chunk-WVMTOWLM.js → chunk-FBCIELXS.js} +4 -93
  8. package/dist/generators/_chunks/chunk-FZGN5NEP.js +31 -0
  9. package/dist/generators/_chunks/{chunk-ND62HBKD.js → chunk-JNYQTW7S.js} +15 -8
  10. package/dist/generators/_chunks/chunk-LJRFVE6B.js +55 -0
  11. package/dist/generators/_chunks/{chunk-Q7IYHKT3.js → chunk-M7UBCSYL.js} +5 -3
  12. package/dist/generators/_chunks/chunk-SHKQSTV2.js +110 -0
  13. package/dist/generators/_chunks/{chunk-RDTB34IA.js → chunk-VCLVE4EQ.js} +10 -94
  14. package/dist/generators/_chunks/chunk-XSALM2IR.js +396 -0
  15. package/dist/generators/_chunks/{chunk-LBYZDAWS.js → chunk-XXXON43Z.js} +194 -3
  16. package/dist/generators/_chunks/chunk-YEMQFSL6.js +95 -0
  17. package/dist/generators/_chunks/{chunk-3ZHRZK5M.js → chunk-ZRHIFPUC.js} +4 -32
  18. package/dist/generators/add-agent-rules/generator.js +4 -3
  19. package/dist/generators/add-backend/generator.js +3 -2
  20. package/dist/generators/add-fsd-lite/generator.js +7 -5
  21. package/dist/generators/add-github-templates/generator.js +3 -2
  22. package/dist/generators/add-integration/generator.js +2 -2
  23. package/dist/generators/add-review/generator.js +3 -3
  24. package/dist/generators/doctor/generator.js +32 -19
  25. package/dist/generators/entity/generator.js +4 -3
  26. package/dist/generators/feature/generator.js +4 -3
  27. package/dist/generators/init/generator.js +32 -367
  28. package/dist/generators/install-integration/generator.js +2 -2
  29. package/dist/generators/page/generator.js +4 -3
  30. package/dist/generators/shared/generator.js +4 -3
  31. package/dist/generators/widget/generator.js +4 -3
  32. package/dist/migrations/update-0.5.3/add-toolkit-config-lint-input.js +62 -0
  33. package/migrations.json +9 -0
  34. package/package.json +7 -2
  35. package/src/generators/add-review/schema.json +4 -0
  36. package/src/generators/init/schema.json +4 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  TOOLKIT_CONFIG_PATH,
3
3
  workspacePackageManager
4
- } from "./chunk-M7OQWSNF.js";
4
+ } from "./chunk-C2WELXMV.js";
5
5
  import {
6
6
  runNxCommand
7
7
  } from "./chunk-5Z7VZPES.js";
@@ -1,6 +1,9 @@
1
+ import {
2
+ renderAddAgentRulesReport
3
+ } from "./chunk-LJRFVE6B.js";
1
4
  import {
2
5
  renderLineDiff
3
- } from "./chunk-E565RG2B.js";
6
+ } from "./chunk-CSJZ4PP3.js";
4
7
  import {
5
8
  resolveFsdPolicy
6
9
  } from "./chunk-5MI3O4VZ.js";
@@ -16,7 +19,7 @@ import {
16
19
  resolveAiHostsOption,
17
20
  resolveLocaleOption,
18
21
  rulesFilesFor
19
- } from "./chunk-M7OQWSNF.js";
22
+ } from "./chunk-C2WELXMV.js";
20
23
 
21
24
  // ../templates/dist/agents/agent-sections.js
22
25
  var UNIVERSAL_AGENT_SECTION_IDS = [
@@ -476,58 +479,6 @@ function applyAgentRulesBlock(existing, body, options = {}) {
476
479
  return { kind: "replace", text };
477
480
  }
478
481
 
479
- // src/generators/add-agent-rules/render.ts
480
- var ACTION_LINE = {
481
- created: (result) => `${result.filePath}: created`,
482
- appended: (result) => `${result.filePath}: nx-archweave block added after the existing content (nothing else changed)`,
483
- updated: (result) => `${result.filePath}: nx-archweave block updated (nothing outside it changed)`,
484
- unchanged: (result) => `${result.filePath}: unchanged`,
485
- unrecognized: (result) => `${result.filePath}: not written \u2014 ${result.reason ?? "the nx-archweave markers could not be placed"}`,
486
- "user-modified": (result) => `${result.filePath}: not written \u2014 the nx-archweave block was edited by hand, so it is kept`
487
- };
488
- function renderAddAgentRulesReport(report) {
489
- const lines = [];
490
- lines.push(report.dryRun ? "add-agent-rules dry-run \u2014 no files were written." : "add-agent-rules:");
491
- lines.push(` hosts: ${report.hosts.join(", ")}`);
492
- lines.push(` locale: ${report.locale}`);
493
- lines.push(` teamRules: ${report.teamRules}`);
494
- lines.push("");
495
- for (const file of report.files) {
496
- lines.push(` ${ACTION_LINE[file.action](file)}`);
497
- if (file.action === "user-modified") {
498
- lines.push(" What this run would write instead (your block \u2192 generated):");
499
- for (const line of (file.diff ?? "").split("\n")) lines.push(` ${line}`);
500
- lines.push(" Rerun with --overwriteBlock to replace the block with the generated one.");
501
- }
502
- }
503
- const RECORD_LINE = {
504
- created: "toolkit.config.json: aiHosts recorded (file created)",
505
- updated: "toolkit.config.json: aiHosts recorded",
506
- unchanged: "toolkit.config.json: aiHosts already recorded",
507
- unrecognized: "toolkit.config.json: not a JSON object \u2014 aiHosts not recorded (fix the file, then rerun)",
508
- "not-applied": "toolkit.config.json: aiHosts not recorded \u2014 a file above was not written",
509
- "not-requested": null
510
- };
511
- const recordLine = RECORD_LINE[report.hostsRecord];
512
- if (recordLine !== null) lines.push(` ${recordLine}`);
513
- if (report.files.some((file) => file.action === "unrecognized")) {
514
- lines.push("");
515
- lines.push('Manual fix needed: keep exactly one "<!-- nx-archweave:agent-rules start \u2026 -->" \u2026 "<!-- nx-archweave:agent-rules end -->"');
516
- lines.push("pair in the file (or remove both markers), then rerun add-agent-rules.");
517
- }
518
- if (report.dryRun) {
519
- lines.push("");
520
- lines.push("Generated content preview:");
521
- for (const file of report.files) {
522
- if (file.content === null) continue;
523
- lines.push("");
524
- lines.push(`--- ${file.filePath} ---`);
525
- lines.push(file.content);
526
- }
527
- }
528
- return lines.join("\n");
529
- }
530
-
531
482
  // src/generators/add-agent-rules/generator.ts
532
483
  function resolveTeamRules(option, config) {
533
484
  if (option !== void 0) return option;
@@ -610,7 +561,6 @@ async function addAgentRulesGenerator(tree, options) {
610
561
  var generator_default = addAgentRulesGenerator;
611
562
 
612
563
  export {
613
- renderAddAgentRulesReport,
614
564
  runAddAgentRules,
615
565
  addAgentRulesGenerator,
616
566
  generator_default
@@ -1,3 +1,6 @@
1
+ import {
2
+ renderAddBackendReport
3
+ } from "./chunk-SHKQSTV2.js";
1
4
  import {
2
5
  addSharedTypesNpmWorkspace,
3
6
  addSharedTypesWorkspaceGlob,
@@ -24,7 +27,7 @@ import {
24
27
  readToolkitConfigFile,
25
28
  setJsonValue,
26
29
  treePackageManager
27
- } from "./chunk-M7OQWSNF.js";
30
+ } from "./chunk-C2WELXMV.js";
28
31
  import {
29
32
  INSTALL_ASSUMES_PNPM,
30
33
  detectYarnFlavor,
@@ -34,110 +37,6 @@ import {
34
37
 
35
38
  // src/generators/add-backend/generator.ts
36
39
  import { getProjects } from "@nx/devkit";
37
-
38
- // src/generators/add-backend/render.ts
39
- function renderAddBackendBody(report) {
40
- const lines = [];
41
- if (report.refused === "no-frontend") {
42
- lines.push(`Refused: no frontend application and no "${report.apiName}" app found in this workspace.`);
43
- lines.push(" add-backend wires a backend app \u2014 beside a frontend, or on its own in a backend-only");
44
- lines.push(` workspace (create one with: npx create-nx-workspace --preset=${report.backend} --appName=${report.apiName}).`);
45
- lines.push(" If the backend app has another name, pass --apiName=<its directory name>.");
46
- return lines.join("\n");
47
- }
48
- if (report.refused === "frontend-not-found") {
49
- lines.push(`Refused: --frontendProject "${report.frontendProject}" does not match any project.`);
50
- lines.push(" Nothing was written. Check the name with `nx show projects`.");
51
- return lines.join("\n");
52
- }
53
- if (report.refused === "ambiguous-frontend") {
54
- lines.push("Refused: multiple frontend applications found \u2014 add-backend will not guess:");
55
- for (const name of report.frontendCandidates ?? []) lines.push(` - ${name}`);
56
- lines.push(" Nothing was written. Re-run with --frontendProject=<name> to pick one.");
57
- return lines.join("\n");
58
- }
59
- if (report.refused === "invalid-project-json") {
60
- lines.push("Refused: a project.json this run must update could not be parsed:");
61
- for (const path of report.invalidProjects ?? []) lines.push(` - ${path}`);
62
- lines.push(" Nothing was written \u2014 fix the JSON, then re-run add-backend.");
63
- return lines.join("\n");
64
- }
65
- if (report.refused === "missing-api-project") {
66
- lines.push(`Refused: no "${report.apiName}" application project found.`);
67
- lines.push(" Create it with the official commands first (copy-paste, names already filled in),");
68
- lines.push(" then re-run add-backend to wire it up:");
69
- lines.push("");
70
- for (const command of report.commands ?? []) lines.push(` ${command}`);
71
- if (report.packageManagerNote !== void 0) lines.push(` note: ${report.packageManagerNote}`);
72
- if (report.expressRange !== void 0) {
73
- lines.push("");
74
- lines.push(` The express line declares express@${report.expressRange}, the range this workspace's @nx/react supports \u2014`);
75
- lines.push(" the official generator then keeps it instead of adding express 5, which npm rejects as a peer conflict.");
76
- }
77
- return lines.join("\n");
78
- }
79
- if (report.packageManagerNote !== void 0) lines.push(` note: ${report.packageManagerNote}`);
80
- lines.push(` frontend project: ${report.frontendProject ?? "none (backend-only workspace)"}`);
81
- const libPath = report.sharedTypesRoot ?? "libs/shared-types";
82
- lines.push(
83
- report.sharedTypes === "created" ? ` ${libPath}: created (import it as ${report.sharedTypesPackage})` : report.sharedTypes === "disabled" ? " shared-types lib: none (sharedTypes: false in toolkit.config.json)" : ` ${libPath}: already exists \u2014 skipped`
84
- );
85
- if (report.config !== void 0 && report.config !== "unchanged") {
86
- lines.push(` toolkit.config.json: backend "${report.backend}" recorded (${report.config}) \u2014 doctor's backend checks now run`);
87
- }
88
- if (report.workspaceGlob !== void 0) {
89
- const pmName = report.packageManager ?? "pnpm";
90
- const registry = packageManagerCommands(pmName).workspaceRegistration;
91
- lines.push(
92
- {
93
- added: ` ${registry}: '${libPath}' registered \u2014 run \`${pmName} install\` once to link it`,
94
- present: ` ${registry}: already covers ${libPath}`,
95
- unrecognized: (
96
- // an integrated layout lists no workspace packages: the paths alias below links it
97
- report.tsconfigPaths === "added" || report.tsconfigPaths === "present" ? ` ${registry}: no workspace package list (integrated layout) \u2014 the tsconfig paths alias links ${libPath}` : ` ${registry}: shape not recognized \u2014 add '${libPath}' to its workspace list yourself`
98
- )
99
- }[report.workspaceGlob]
100
- );
101
- }
102
- for (const tag of report.tags) {
103
- lines.push(` tag ${tag.project}: ${tag.action === "added" ? "added" : "already present"}`);
104
- }
105
- lines.push(
106
- {
107
- added: ` tsconfig.base.json paths: ${report.sharedTypesPackage} added (a classic or integrated setup \u2014 libs resolve through paths)`,
108
- present: " tsconfig.base.json paths: already wired",
109
- "workspace-link": " tsconfig paths: not needed \u2014 the workspace package link is the wiring",
110
- unrecognized: " tsconfig.base.json: could not be parsed \u2014 left untouched",
111
- none: " tsconfig paths: nothing to wire (no shared-types lib)"
112
- }[report.tsconfigPaths]
113
- );
114
- switch (report.eslint) {
115
- case "applied":
116
- lines.push(" ESLint boundaries: cross-side deny rules written (existing imports stay allowed)");
117
- break;
118
- case "already-applied":
119
- lines.push(" ESLint boundaries: already enforced \u2014 no change");
120
- break;
121
- case "degraded-unrecognized":
122
- lines.push(" ESLint boundaries: your config was NOT recognized \u2014 left untouched.");
123
- lines.push(" Merge this yourself (then boundaries are actually enforced):");
124
- break;
125
- case "snippet-only":
126
- lines.push(" ESLint boundaries: report-only (pass --applyEslint to write them).");
127
- lines.push(" Paste-ready snippet:");
128
- break;
129
- }
130
- if (report.snippet) {
131
- lines.push("");
132
- lines.push(report.snippet);
133
- }
134
- return lines.join("\n");
135
- }
136
- function renderAddBackendReport(report, dryRun) {
137
- return [`add-backend (${report.backend})${dryRun ? " \u2014 dry run" : ""}`, "", renderAddBackendBody(report)].join("\n");
138
- }
139
-
140
- // src/generators/add-backend/generator.ts
141
40
  function runAddBackend(tree, options) {
142
41
  const backend = options.backend;
143
42
  const apiName = options.apiName ?? "api";
@@ -384,7 +283,6 @@ async function addBackendGenerator(tree, options) {
384
283
  var generator_default = addBackendGenerator;
385
284
 
386
285
  export {
387
- renderAddBackendBody,
388
286
  runAddBackend,
389
287
  addBackendGenerator,
390
288
  generator_default
@@ -0,0 +1,79 @@
1
+ import {
2
+ INSTALL_ASSUMES_PNPM
3
+ } from "./chunk-5Z7VZPES.js";
4
+
5
+ // src/generators/add-fsd-lite/render.ts
6
+ function renderAddFsdLiteReport(report) {
7
+ const lines = [];
8
+ if (report.aborted) {
9
+ lines.push("add-fsd-lite aborted \u2014 nothing was written.");
10
+ const refusal = report.appRefusal;
11
+ if (refusal !== null) {
12
+ lines.push("");
13
+ lines.push(" FSD layers live inside the frontend app's source root (e.g. apps/web/src), and no app could be picked:");
14
+ if (refusal.reason === "project-not-found") {
15
+ lines.push(` --project=${refusal.project} names no project in this workspace.`);
16
+ } else if (refusal.reason === "ambiguous-frontend") {
17
+ lines.push(" more than one frontend app was found \u2014 rerun with --project=<one of them>:");
18
+ for (const name of refusal.candidates) lines.push(` - ${name}`);
19
+ } else if (refusal.reason === "invalid-project-json") {
20
+ lines.push(` a project.json could not be parsed (${refusal.detail}) \u2014 fix it, then rerun.`);
21
+ } else if (refusal.otherProjects.length > 0) {
22
+ lines.push(" no project was recognised as a frontend app. If one of these is it, rerun with --project=<name>:");
23
+ for (const name of refusal.otherProjects) lines.push(` - ${name}`);
24
+ } else {
25
+ lines.push(" the workspace has no projects \u2014 create one (e.g. nx g @nx/react:app or nx g @nx/next:app), then rerun.");
26
+ }
27
+ }
28
+ return lines.join("\n");
29
+ }
30
+ if (report.dryRun) {
31
+ lines.push("add-fsd-lite dry-run \u2014 no files were written.");
32
+ lines.push("");
33
+ }
34
+ lines.push(`FSD layers (in ${report.project}, ${report.sourceRoot}):`);
35
+ if (report.layerGuide !== null && report.frontend === "generic") {
36
+ lines.push("Frontend: framework not recognised \u2014 the common FSD rules apply, with no framework-specific layer names.");
37
+ }
38
+ if (report.layerGuide !== null) lines.push(report.layerGuide);
39
+ lines.push("");
40
+ const where = report.eslintPath ?? `${report.project}'s eslint.config.mjs`;
41
+ switch (report.eslint) {
42
+ case "applied":
43
+ lines.push(`ESLint: archweave/fsd-boundaries (${report.enforcement}) written to ${where}`);
44
+ break;
45
+ case "already-applied":
46
+ lines.push(`ESLint: archweave/fsd-boundaries already wired in ${where} \u2014 no change`);
47
+ break;
48
+ case "degraded-unrecognized":
49
+ lines.push(`ESLint: ${report.eslintPath === null ? `no ESLint config found for ${report.project}` : `${where} was NOT recognized \u2014 left untouched`}.`);
50
+ lines.push(" Add the rule yourself (then the layer rules are actually enforced):");
51
+ break;
52
+ case "snippet-only":
53
+ lines.push(`ESLint: report-only (pass --applyEslint to write the rule into ${where}).`);
54
+ break;
55
+ case "not-applied":
56
+ break;
57
+ }
58
+ if (report.snippet !== null) lines.push(report.snippet);
59
+ if (report.steiger !== null) {
60
+ const st = report.steiger;
61
+ lines.push("");
62
+ lines.push("steiger (official FSD linter, opt-in):");
63
+ lines.push(
64
+ ` ${st.configPath}: ${st.config === "created" ? "created" : st.config === "unchanged" ? "unchanged" : "kept \u2014 an existing config with other content is never replaced"}`
65
+ );
66
+ lines.push(
67
+ st.target === "added" ? ` target ${"fsd-check"}: added to ${st.targetPath}` : st.target === "present" ? ` target ${"fsd-check"}: already present in ${st.targetPath}` : " target fsd-check: NOT added \u2014 no parseable project.json / package.json for the app"
68
+ );
69
+ lines.push(
70
+ st.dependencies === "added" ? ` devDependencies: steiger + @feature-sliced/steiger-plugin added to package.json \u2014 run \`${st.installCommand}\`${st.installAssumed ? ` (${INSTALL_ASSUMES_PNPM})` : ""}` : st.dependencies === "present" ? " devDependencies: already present" : " devDependencies: NOT added \u2014 the root package.json could not be parsed"
71
+ );
72
+ lines.push(` run it with: ${st.runCommand} (steiger needs Node >= 22.18)`);
73
+ }
74
+ return lines.join("\n");
75
+ }
76
+
77
+ export {
78
+ renderAddFsdLiteReport
79
+ };
@@ -129,6 +129,13 @@ function applyJsonEdits(raw, edits) {
129
129
  return edits.reduce((text, [path, value]) => setJsonValue(text, path, value), raw);
130
130
  }
131
131
 
132
+ // src/generators/shared/message-only-error.ts
133
+ function messageOnlyError(message) {
134
+ const error = new Error(message);
135
+ error.stack = "";
136
+ return error;
137
+ }
138
+
132
139
  // src/generators/shared/toolkit-config-file.ts
133
140
  var TOOLKIT_CONFIG_PATH = "toolkit.config.json";
134
141
  function readToolkitConfigFile(tree) {
@@ -163,10 +170,10 @@ var RECORDED_PACKAGE_MANAGERS = ["pnpm", "npm", "yarn", "bun"];
163
170
  function resolveFrontendOption(option, config, generator) {
164
171
  const frontend = option ?? recordedChoice(config, "frontend", RECORDED_FRONTENDS);
165
172
  if (frontend === void 0) {
166
- throw new Error(`${generator}: pass --frontend=react-vite|next|expo|generic (toolkit.config.json records none \u2014 init writes it).`);
173
+ throw messageOnlyError(`${generator}: pass --frontend=react-vite|next|expo|generic (toolkit.config.json records none \u2014 init writes it).`);
167
174
  }
168
175
  if (frontend === "none") {
169
- throw new Error(
176
+ throw messageOnlyError(
170
177
  `${generator}: this is a backend-only workspace (toolkit.config.json frontend: none) \u2014 FSD structures a frontend app. Pass --frontend=react-vite|next|expo|generic if you added one.`
171
178
  );
172
179
  }
@@ -175,7 +182,7 @@ function resolveFrontendOption(option, config, generator) {
175
182
  function resolveInitFrontend(option, config) {
176
183
  const frontend = option ?? recordedChoice(config, "frontend", RECORDED_FRONTENDS);
177
184
  if (frontend === void 0) {
178
- throw new Error("init: pass --frontend=react-vite|next|expo|generic|none (toolkit.config.json records none \u2014 init writes it).");
185
+ throw messageOnlyError("init: pass --frontend=react-vite|next|expo|generic|none (toolkit.config.json records none \u2014 init writes it).");
179
186
  }
180
187
  return frontend;
181
188
  }
@@ -217,6 +224,7 @@ export {
217
224
  setJsonValue,
218
225
  appendJsonArrayItem,
219
226
  applyJsonEdits,
227
+ messageOnlyError,
220
228
  TOOLKIT_CONFIG_PATH,
221
229
  readToolkitConfigFile,
222
230
  readToolkitConfig,
@@ -88,6 +88,7 @@ function renderAddReviewReport(report) {
88
88
  }
89
89
  if (report.dependabot === "created") {
90
90
  lines.push(` ${DEPENDABOT_PATH}: created \u2014 Dependabot proposes newer pins for the workflow's actions`);
91
+ lines.push(" Delete this file and pass --dependabot=false from then on if you don't want those pull requests.");
91
92
  } else if (report.dependabot === "present") {
92
93
  lines.push(` ${DEPENDABOT_PATH}: already updates github-actions`);
93
94
  } else if (report.dependabot === "proposed") {
@@ -95,6 +96,20 @@ function renderAddReviewReport(report) {
95
96
  lines.push(" to a commit SHA; add this entry under `updates:` so those pins get update pull requests:");
96
97
  lines.push("");
97
98
  lines.push(report.dependabotProposal ?? "");
99
+ } else if (report.dependabot === "off") {
100
+ lines.push(
101
+ report.dependabotOff === "recorded" ? ` ${DEPENDABOT_PATH}: not created \u2014 review.dependabot is false in toolkit.config.json (--dependabot=true turns it on)` : ` ${DEPENDABOT_PATH}: not created \u2014 Dependabot updates are off (--dependabot=false)`
102
+ );
103
+ } else if (report.dependabot === "withheld") {
104
+ lines.push(` ${DEPENDABOT_PATH}: not created \u2014 the workflow wasn't written this run. To get update pull requests`);
105
+ lines.push(" for its pinned actions, add this file:");
106
+ lines.push("");
107
+ lines.push(report.dependabotProposal ?? "");
108
+ }
109
+ if (report.dependabotNotApplied !== void 0) {
110
+ lines.push(
111
+ report.workflowAction === "alternate" ? ` --dependabot=${report.dependabotNotApplied} was not recorded because the workflow was written under another name; toolkit.config.json keeps its review settings.` : ` --dependabot=${report.dependabotNotApplied} was not applied because the workflow ${report.workflowAction === "skipped" ? "was skipped" : "was only proposed"}; toolkit.config.json keeps its review settings.`
112
+ );
98
113
  }
99
114
  if (report.workflowAction === "alternate") {
100
115
  lines.push("");
@@ -1,3 +1,6 @@
1
+ import {
2
+ detectFramework
3
+ } from "./chunk-YEMQFSL6.js";
1
4
  import {
2
5
  resolveProjectType
3
6
  } from "./chunk-TXAQ2GJC.js";
@@ -6,97 +9,7 @@ import {
6
9
  } from "./chunk-6ZTIUBB2.js";
7
10
  import {
8
11
  readToolkitConfig
9
- } from "./chunk-M7OQWSNF.js";
10
-
11
- // ../template-engine/dist/frameworks/profiles.js
12
- var ALL_LAYERS = ["app", "pages", "features", "entities", "shared"];
13
- var NEXT = {
14
- id: "next",
15
- recognised: true,
16
- // Next.js's own app/ (App Router) directory is the composition root; FSD's Next.js guide
17
- // names the FSD app and pages layers _app and _pages, since Next.js reads src/app and
18
- // src/pages as its routers.
19
- layers: ["pages", "features", "entities", "shared"],
20
- layerDirs: { app: "_app", pages: "_pages" },
21
- buildOutputDirs: [".next", "out"],
22
- platformSuffixes: [],
23
- routerDirs: ["pages"]
24
- };
25
- var REACT_VITE = {
26
- id: "react-vite",
27
- recognised: true,
28
- layers: ALL_LAYERS,
29
- layerDirs: {},
30
- buildOutputDirs: ["dist"],
31
- platformSuffixes: [],
32
- routerDirs: []
33
- };
34
- var EXPO_ROUTER = {
35
- id: "expo",
36
- recognised: true,
37
- layers: ALL_LAYERS,
38
- layerDirs: { app: "_app" },
39
- buildOutputDirs: [".expo", "dist"],
40
- platformSuffixes: ["ios", "android", "native", "web"],
41
- routerDirs: []
42
- };
43
- var EXPO = { ...EXPO_ROUTER, layerDirs: {} };
44
- var GENERIC = {
45
- id: "generic",
46
- recognised: false,
47
- layers: ALL_LAYERS,
48
- layerDirs: {},
49
- buildOutputDirs: ["dist", "build"],
50
- platformSuffixes: [],
51
- routerDirs: []
52
- };
53
- var PROFILES = { next: NEXT, "react-vite": REACT_VITE, expo: EXPO_ROUTER, generic: GENERIC };
54
- function profileById(id) {
55
- return PROFILES[id];
56
- }
57
- function allFrameworkProfiles() {
58
- return Object.values(PROFILES);
59
- }
60
- var NEXT_CONFIGS = ["next.config.js", "next.config.mjs", "next.config.ts", "next.config.cjs"];
61
- var VITE_CONFIGS = ["vite.config.ts", "vite.config.mts", "vite.config.js", "vite.config.mjs"];
62
- var EXPO_CONFIGS = ["app.config.ts", "app.config.js", "app.config.mjs"];
63
- function hasExpoKey(input, file) {
64
- const text = input.read(file);
65
- if (typeof text !== "string")
66
- return false;
67
- try {
68
- return typeof JSON.parse(text)["expo"] === "object";
69
- } catch {
70
- return false;
71
- }
72
- }
73
- function dependsOn(input, manifest, name) {
74
- const text = input.read(manifest);
75
- if (typeof text !== "string")
76
- return false;
77
- try {
78
- const parsed = JSON.parse(text);
79
- return ["dependencies", "devDependencies", "peerDependencies"].some((field) => parsed[field]?.[name] !== void 0);
80
- } catch {
81
- return false;
82
- }
83
- }
84
- function detectFramework(input) {
85
- const prefix = input.projectRoot === "" || input.projectRoot === "." ? "" : `${input.projectRoot}/`;
86
- const executors = input.executors ?? [];
87
- if (NEXT_CONFIGS.some((file) => input.exists(`${prefix}${file}`)) || executors.some((executor) => executor.startsWith("@nx/next:"))) {
88
- return NEXT;
89
- }
90
- const dependsAnywhere = (name) => dependsOn(input, `${prefix}package.json`, name) || dependsOn(input, "package.json", name);
91
- const usesExpo = executors.some((executor) => executor.startsWith("@nx/expo:")) || hasExpoKey(input, `${prefix}app.json`) || EXPO_CONFIGS.some((file) => input.exists(`${prefix}${file}`)) || dependsOn(input, `${prefix}package.json`, "expo");
92
- if (usesExpo)
93
- return dependsAnywhere("expo-router") ? EXPO_ROUTER : EXPO;
94
- const usesReact = dependsAnywhere("react");
95
- const usesVite = VITE_CONFIGS.some((file) => input.exists(`${prefix}${file}`)) || executors.some((executor) => executor.startsWith("@nx/vite:"));
96
- if (usesVite && usesReact)
97
- return REACT_VITE;
98
- return GENERIC;
99
- }
12
+ } from "./chunk-C2WELXMV.js";
100
13
 
101
14
  // src/generators/shared/frontend-app.ts
102
15
  import { getProjects } from "@nx/devkit";
@@ -263,8 +176,6 @@ function inferredRootApp(tree, projects) {
263
176
  }
264
177
 
265
178
  export {
266
- profileById,
267
- allFrameworkProfiles,
268
179
  resolveSlicePublicApiName,
269
180
  isUsableSliceApiName,
270
181
  isEssenceSegmentName,
@@ -0,0 +1,31 @@
1
+ // src/generators/add-github-templates/render.ts
2
+ var ACTION_LINES = {
3
+ created: "created",
4
+ unchanged: "unchanged (already matches the generated version)",
5
+ skipped: "left as-is (a different file already exists there \u2014 never overwritten)"
6
+ };
7
+ function renderAddGithubTemplatesReport(report) {
8
+ const lines = [];
9
+ if (report.files.length === 0) {
10
+ lines.push("add-github-templates: nothing selected (issue/pr/codeowners all false) \u2014 no files to install.");
11
+ return lines.join("\n");
12
+ }
13
+ if (report.dryRun) {
14
+ lines.push("add-github-templates dry-run \u2014 no files were written.");
15
+ lines.push("");
16
+ for (const file of report.files) {
17
+ lines.push(`${file.filePath}:`);
18
+ lines.push(file.content);
19
+ lines.push("");
20
+ }
21
+ lines.push("Effective decision:");
22
+ }
23
+ for (const file of report.files) {
24
+ lines.push(` ${file.filePath}: ${ACTION_LINES[file.action]}`);
25
+ }
26
+ return lines.join("\n");
27
+ }
28
+
29
+ export {
30
+ renderAddGithubTemplatesReport
31
+ };
@@ -6,7 +6,7 @@ import {
6
6
  DEPENDABOT_PATH,
7
7
  renderAddReviewReport,
8
8
  renderLineDiff
9
- } from "./chunk-E565RG2B.js";
9
+ } from "./chunk-CSJZ4PP3.js";
10
10
  import {
11
11
  generatorFilesDir,
12
12
  renderTemplateFiles
@@ -17,7 +17,7 @@ import {
17
17
  import {
18
18
  applyJsonEdits,
19
19
  treePackageManager
20
- } from "./chunk-M7OQWSNF.js";
20
+ } from "./chunk-C2WELXMV.js";
21
21
 
22
22
  // src/generators/add-review/generator.ts
23
23
  var CONFIG_PATH = "toolkit.config.json";
@@ -64,7 +64,8 @@ function recordedReview(config) {
64
64
  return {
65
65
  provider: pick(record["provider"], PROVIDERS),
66
66
  mode: pick(record["mode"], MODES),
67
- maxRounds: rounds === 1 || rounds === 2 || rounds === 3 || rounds === 4 || rounds === 5 ? rounds : void 0
67
+ maxRounds: rounds === 1 || rounds === 2 || rounds === 3 || rounds === 4 || rounds === 5 ? rounds : void 0,
68
+ ...record["dependabot"] === false ? { dependabot: false } : {}
68
69
  };
69
70
  }
70
71
  function runAddReview(tree, options) {
@@ -139,21 +140,23 @@ function runAddReview(tree, options) {
139
140
  }
140
141
  }
141
142
  let configAction;
143
+ const dependabotOn = options.dependabot ?? recordedReview(config.parsed).dependabot !== false;
144
+ const reviewConfig = dependabotOn ? plan.configSnippet : { ...plan.configSnippet, dependabot: false };
142
145
  let newConfigContent = null;
143
146
  if (!mainFileMatchesOptions) {
144
147
  configAction = "not-updated";
145
148
  } else {
146
149
  const existingReview = config.parsed?.["review"];
147
- if (deepEqual(existingReview, plan.configSnippet)) {
150
+ if (deepEqual(existingReview, reviewConfig)) {
148
151
  configAction = "unchanged";
149
152
  } else {
150
153
  configAction = config.raw === null ? "created" : "updated";
151
- newConfigContent = applyJsonEdits(config.raw, [[["review"], plan.configSnippet]]);
154
+ newConfigContent = applyJsonEdits(config.raw, [[["review"], reviewConfig]]);
152
155
  }
153
156
  }
154
157
  const [dependabotFile] = renderTemplateFiles(generatorFilesDir("add-review", import.meta.url), ".github", {});
155
158
  const existingDependabot = tree.read(DEPENDABOT_PATH, "utf-8");
156
- const dependabot = existingDependabot === null ? "created" : /github-actions/.test(existingDependabot) ? "present" : "proposed";
159
+ const dependabot = existingDependabot !== null ? /github-actions/.test(existingDependabot) ? "present" : dependabotOn ? "proposed" : "off" : !dependabotOn ? "off" : writeWorkflowTo !== null || options.dependabot === true && workflowAction === "unchanged" ? "created" : "withheld";
157
160
  const dryRun = options.dryRun ?? false;
158
161
  if (!dryRun) {
159
162
  if (writeWorkflowTo !== null) tree.write(writeWorkflowTo, plan.workflowYaml);
@@ -168,10 +171,14 @@ function runAddReview(tree, options) {
168
171
  requiredSecretName: plan.requiredSecretName,
169
172
  diff,
170
173
  workflowYaml: dryRun ? plan.workflowYaml : null,
171
- configSnippetJson: dryRun ? JSON.stringify(plan.configSnippet, null, 2) : null,
174
+ configSnippetJson: dryRun ? JSON.stringify(reviewConfig, null, 2) : null,
172
175
  configError: null,
173
176
  dependabot,
174
- dependabotProposal: dependabot === "proposed" ? dependabotFile.content : null,
177
+ dependabotProposal: dependabot === "proposed" || dependabot === "withheld" ? dependabotFile.content : null,
178
+ ...dependabot === "off" ? { dependabotOff: options.dependabot === false ? "option" : "recorded" } : {},
179
+ // An explicit --dependabot goes with the review config, which a run that leaves the main
180
+ // workflow alone doesn't touch: say the option wasn't applied.
181
+ ...options.dependabot !== void 0 && !mainFileMatchesOptions ? { dependabotNotApplied: options.dependabot } : {},
175
182
  ...packageManagerNote !== void 0 ? { packageManagerNote } : {},
176
183
  reviewProvider: provider
177
184
  };
@@ -0,0 +1,55 @@
1
+ // src/generators/add-agent-rules/render.ts
2
+ var ACTION_LINE = {
3
+ created: (result) => `${result.filePath}: created`,
4
+ appended: (result) => `${result.filePath}: nx-archweave block added after the existing content (nothing else changed)`,
5
+ updated: (result) => `${result.filePath}: nx-archweave block updated (nothing outside it changed)`,
6
+ unchanged: (result) => `${result.filePath}: unchanged`,
7
+ unrecognized: (result) => `${result.filePath}: not written \u2014 ${result.reason ?? "the nx-archweave markers could not be placed"}`,
8
+ "user-modified": (result) => `${result.filePath}: not written \u2014 the nx-archweave block was edited by hand, so it is kept`
9
+ };
10
+ function renderAddAgentRulesReport(report) {
11
+ const lines = [];
12
+ lines.push(report.dryRun ? "add-agent-rules dry-run \u2014 no files were written." : "add-agent-rules:");
13
+ lines.push(` hosts: ${report.hosts.join(", ")}`);
14
+ lines.push(` locale: ${report.locale}`);
15
+ lines.push(` teamRules: ${report.teamRules}`);
16
+ lines.push("");
17
+ for (const file of report.files) {
18
+ lines.push(` ${ACTION_LINE[file.action](file)}`);
19
+ if (file.action === "user-modified") {
20
+ lines.push(" What this run would write instead (your block \u2192 generated):");
21
+ for (const line of (file.diff ?? "").split("\n")) lines.push(` ${line}`);
22
+ lines.push(" Rerun with --overwriteBlock to replace the block with the generated one.");
23
+ }
24
+ }
25
+ const RECORD_LINE = {
26
+ created: "toolkit.config.json: aiHosts recorded (file created)",
27
+ updated: "toolkit.config.json: aiHosts recorded",
28
+ unchanged: "toolkit.config.json: aiHosts already recorded",
29
+ unrecognized: "toolkit.config.json: not a JSON object \u2014 aiHosts not recorded (fix the file, then rerun)",
30
+ "not-applied": "toolkit.config.json: aiHosts not recorded \u2014 a file above was not written",
31
+ "not-requested": null
32
+ };
33
+ const recordLine = RECORD_LINE[report.hostsRecord];
34
+ if (recordLine !== null) lines.push(` ${recordLine}`);
35
+ if (report.files.some((file) => file.action === "unrecognized")) {
36
+ lines.push("");
37
+ lines.push('Manual fix needed: keep exactly one "<!-- nx-archweave:agent-rules start \u2026 -->" \u2026 "<!-- nx-archweave:agent-rules end -->"');
38
+ lines.push("pair in the file (or remove both markers), then rerun add-agent-rules.");
39
+ }
40
+ if (report.dryRun) {
41
+ lines.push("");
42
+ lines.push("Generated content preview:");
43
+ for (const file of report.files) {
44
+ if (file.content === null) continue;
45
+ lines.push("");
46
+ lines.push(`--- ${file.filePath} ---`);
47
+ lines.push(file.content);
48
+ }
49
+ }
50
+ return lines.join("\n");
51
+ }
52
+
53
+ export {
54
+ renderAddAgentRulesReport
55
+ };