@clearlydev/nx-archweave 0.5.1 → 0.5.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.
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # @clearlydev/nx-archweave
2
2
 
3
- Nx generators that get a workspace ready to work on with one preset:
3
+ Nx plugin and CLI that set up Feature-Sliced Design (FSD) import linting, frontend/backend module boundaries and AI agent rule files. AI PR review is optional (beta).
4
+
5
+ Its generators get a workspace ready to work on with one preset:
4
6
 
5
7
  - an FSD Lite lint rule for the frontend app's layers (`warn` or `error` by preset), plus slice generators
6
8
  - frontend/backend boundaries as lint errors between the projects it tags, when there is a backend
@@ -9,7 +11,7 @@ and, each one optional:
9
11
 
10
12
  - AI agent rules
11
13
  - GitHub templates
12
- - AI PR review with the provider you choose (Claude supported; Gemini, GPT and Cursor in beta)
14
+ - AI PR review (beta) with the provider you choose; Claude is the most tested provider
13
15
 
14
16
  Starting a brand-new workspace instead? Use [`create-nx-archweave`](https://www.npmjs.com/package/create-nx-archweave). It creates the workspace, installs this plugin, and runs `init`, all in one command.
15
17
 
@@ -211,9 +213,9 @@ Options: `--packages`\*, `--apply`
211
213
 
212
214
  Explicit flags always win over preset defaults. `solo` is an alias of `quick-start`: it still works and gets quick-start's defaults. Turning review off never removes a review workflow a workspace already has; update it with `add-review`.
213
215
 
214
- ## AI PR review (optional)
216
+ ## AI PR review (optional, beta)
215
217
 
216
- `add-review` adds a GitHub Actions workflow that reviews each pull request with the provider you pick: `claude` (default) is supported; `gemini`, `gpt` and `cursor` are beta.
218
+ `add-review` adds a GitHub Actions workflow that reviews each pull request with the provider you pick. The feature is in beta; `claude` (default) is the most tested provider.
217
219
 
218
220
  - Off: no review files at all.
219
221
  - On: until you register the provider's secret, the `review` check ends green with a notice. After that, it fails on a blocking finding (P0/P1) or when the review leaves no verdict it can read, so it can be a required check.
@@ -4,6 +4,7 @@ import {
4
4
 
5
5
  // src/generators/add-review/render.ts
6
6
  var DEPENDABOT_PATH = ".github/dependabot.yml";
7
+ var MOST_TESTED_PROVIDER = "claude";
7
8
  var PROVIDER_STATUS_URL = "https://github.com/clearlydev/nx-archweave/blob/main/docs/pr-review.md#provider-status";
8
9
  function renderLineDiff(existing, generated) {
9
10
  const a = normalizeFileText(existing).split("\n");
@@ -102,12 +103,12 @@ function renderAddReviewReport(report) {
102
103
  }
103
104
  lines.push("");
104
105
  lines.push(`Note: the review workflow stays green-skipped until you register the ${report.requiredSecretName} secret.`);
105
- if (report.betaProvider !== void 0) {
106
- lines.push(`Note: the ${report.betaProvider} provider is in beta \u2014 its workflow hasn't finished a review end to end on`);
107
- lines.push(`GitHub Actions yet. Status, costs and known issues: ${PROVIDER_STATUS_URL}`);
108
- lines.push("Warning: the AI review doesn't replace a person's code review. Require a person's approval on every pull");
109
- lines.push("request.");
110
- }
106
+ lines.push(
107
+ report.reviewProvider === MOST_TESTED_PROVIDER ? `Note: AI PR review is in beta \u2014 ${MOST_TESTED_PROVIDER} is its most tested provider.` : `Note: AI PR review is in beta, and the ${report.reviewProvider} provider hasn't been verified end to end yet.`
108
+ );
109
+ lines.push(`Status, costs and known issues: ${PROVIDER_STATUS_URL}`);
110
+ lines.push("Warning: the AI review doesn't replace a person's code review. Require a person's approval on every pull");
111
+ lines.push("request.");
111
112
  lines.push("Note: this workflow runs with elevated permissions only after it is merged to the default branch \u2014");
112
113
  lines.push("merging is the first real validation.");
113
114
  return lines.join("\n");
@@ -134,6 +134,17 @@ function lintInputsTargetDefaultsSnippet(target) {
134
134
  "they are dropped, and lint is served from the cache after a source change."
135
135
  ];
136
136
  }
137
+ function lintInputsListSnippet(target) {
138
+ return [
139
+ `targetDefaults.${target} in nx.json is a list of entries, each for the projects its filter picks. Add`,
140
+ `"${TOOLKIT_CONFIG_INPUT}" to every entry that covers an FSD project:`,
141
+ ` an entry with inputs: add it to its "inputs"`,
142
+ ` an entry without inputs: "inputs": ["...", "${TOOLKIT_CONFIG_INPUT}"]`,
143
+ 'Keep "...": it stands for the inputs @nx/eslint/plugin infers (the sources, the ESLint config). Without it',
144
+ "they are dropped, and lint is served from the cache after a source change. A lint target written in a",
145
+ 'project file keeps only what targetDefaults lists ("..." has nothing to keep there): give it its own inputs.'
146
+ ];
147
+ }
137
148
  function lintInputsProjectSnippet(input) {
138
149
  if (input.ownInputs)
139
150
  return [`Add "${TOOLKIT_CONFIG_INPUT}" to the inputs of the ${input.target} target in ${input.file}.`];
@@ -152,5 +163,6 @@ export {
152
163
  composeFsdLayerGuide,
153
164
  TOOLKIT_CONFIG_INPUT,
154
165
  lintInputsTargetDefaultsSnippet,
166
+ lintInputsListSnippet,
155
167
  lintInputsProjectSnippet
156
168
  };
@@ -6,7 +6,7 @@ import {
6
6
  DEPENDABOT_PATH,
7
7
  renderAddReviewReport,
8
8
  renderLineDiff
9
- } from "./chunk-AON4KGZT.js";
9
+ } from "./chunk-E565RG2B.js";
10
10
  import {
11
11
  generatorFilesDir,
12
12
  renderTemplateFiles
@@ -54,7 +54,6 @@ function deepEqual(a, b) {
54
54
  return aKeys.every((key) => deepEqual(a[key], b[key]));
55
55
  }
56
56
  var PROVIDERS = ["claude", "gemini", "gpt", "cursor"];
57
- var BETA_PROVIDERS = ["gemini", "gpt", "cursor"];
58
57
  var MODES = ["fast", "standard", "thorough"];
59
58
  function recordedReview(config) {
60
59
  const review = config?.["review"];
@@ -96,7 +95,8 @@ function runAddReview(tree, options) {
96
95
  configSnippetJson: null,
97
96
  configError: config.error,
98
97
  dependabot: "not-applied",
99
- dependabotProposal: null
98
+ dependabotProposal: null,
99
+ reviewProvider: provider
100
100
  };
101
101
  }
102
102
  const existing = tree.read(plan.workflowFilePath, "utf-8");
@@ -173,7 +173,7 @@ function runAddReview(tree, options) {
173
173
  dependabot,
174
174
  dependabotProposal: dependabot === "proposed" ? dependabotFile.content : null,
175
175
  ...packageManagerNote !== void 0 ? { packageManagerNote } : {},
176
- ...BETA_PROVIDERS.includes(provider) ? { betaProvider: provider } : {}
176
+ reviewProvider: provider
177
177
  };
178
178
  }
179
179
  async function addReviewGenerator(tree, options) {
@@ -2,7 +2,7 @@ import {
2
2
  applyFsdEslintConfig,
3
3
  buildFsdEslintPasteSnippet,
4
4
  composeFsdLayerGuide
5
- } from "./chunk-N6B6VBHG.js";
5
+ } from "./chunk-LBYZDAWS.js";
6
6
  import {
7
7
  profileById,
8
8
  resolveFrontendApp
@@ -81,6 +81,20 @@ function buildSteigerConfig({ renamedLayerDirs, locale }) {
81
81
  return lines.join("\n");
82
82
  }
83
83
 
84
+ // ../template-engine/dist/fsd/lint-target-defaults.js
85
+ var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
86
+ var inputsOf = (value) => isObject(value) && Array.isArray(value["inputs"]) ? value["inputs"] : void 0;
87
+ function readTargetDefaults(targetDefaults, key) {
88
+ const value = isObject(targetDefaults) ? targetDefaults[key] : void 0;
89
+ if (value === void 0)
90
+ return { shape: "absent" };
91
+ if (Array.isArray(value))
92
+ return { shape: "list", entries: value.map((entry) => ({ inputs: inputsOf(entry) })) };
93
+ if (isObject(value))
94
+ return { shape: "object", inputs: inputsOf(value) };
95
+ return { shape: "other" };
96
+ }
97
+
84
98
  // src/generators/add-fsd-lite/render.ts
85
99
  function renderAddFsdLiteReport(report) {
86
100
  const lines = [];
@@ -286,6 +300,7 @@ var generator_default = addFsdLiteGenerator;
286
300
 
287
301
  export {
288
302
  DEFAULT_CONFLICT_POLICY,
303
+ readTargetDefaults,
289
304
  renderAddFsdLiteReport,
290
305
  runAddFsdLite,
291
306
  addFsdLiteGenerator,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  renderLineDiff
3
- } from "./chunk-AON4KGZT.js";
3
+ } from "./chunk-E565RG2B.js";
4
4
  import {
5
5
  resolveFsdPolicy
6
6
  } from "./chunk-5MI3O4VZ.js";
@@ -2,8 +2,8 @@ import {
2
2
  addAgentRulesGenerator,
3
3
  generator_default,
4
4
  runAddAgentRules
5
- } from "../_chunks/chunk-ZNTGYYLU.js";
6
- import "../_chunks/chunk-AON4KGZT.js";
5
+ } from "../_chunks/chunk-VTXXW2B5.js";
6
+ import "../_chunks/chunk-E565RG2B.js";
7
7
  import "../_chunks/chunk-5MI3O4VZ.js";
8
8
  import "../_chunks/chunk-6ZTIUBB2.js";
9
9
  import "../_chunks/chunk-JPS6XKYK.js";
@@ -2,8 +2,8 @@ import {
2
2
  addFsdLiteGenerator,
3
3
  generator_default,
4
4
  runAddFsdLite
5
- } from "../_chunks/chunk-TJ6SCQLI.js";
6
- import "../_chunks/chunk-N6B6VBHG.js";
5
+ } from "../_chunks/chunk-RDTB34IA.js";
6
+ import "../_chunks/chunk-LBYZDAWS.js";
7
7
  import "../_chunks/chunk-WVMTOWLM.js";
8
8
  import "../_chunks/chunk-TXAQ2GJC.js";
9
9
  import "../_chunks/chunk-6ZTIUBB2.js";
@@ -3,9 +3,9 @@ import {
3
3
  generator_default,
4
4
  recordedReview,
5
5
  runAddReview
6
- } from "../_chunks/chunk-ERCX7F6K.js";
6
+ } from "../_chunks/chunk-ND62HBKD.js";
7
7
  import "../_chunks/chunk-2WXAGWAJ.js";
8
- import "../_chunks/chunk-AON4KGZT.js";
8
+ import "../_chunks/chunk-E565RG2B.js";
9
9
  import "../_chunks/chunk-YNMLB4DL.js";
10
10
  import "../_chunks/chunk-JPS6XKYK.js";
11
11
  import "../_chunks/chunk-TUN34LAQ.js";
@@ -27,7 +27,7 @@ import {
27
27
  classifyFsdEslintConfig,
28
28
  lintInputsProjectSnippet,
29
29
  lintInputsTargetDefaultsSnippet
30
- } from "../_chunks/chunk-N6B6VBHG.js";
30
+ } from "../_chunks/chunk-LBYZDAWS.js";
31
31
  import {
32
32
  resolveFrontendApp,
33
33
  sourceRootOf
@@ -1240,14 +1240,15 @@ function buildFrameworkChecks(env) {
1240
1240
  const dependencies = env.rootPackageJson?.["dependencies"] ?? {};
1241
1241
  const devDependencies = env.rootPackageJson?.["devDependencies"] ?? {};
1242
1242
  const allDeps = { ...dependencies, ...devDependencies };
1243
- const hasReactVite = Boolean(allDeps.vite && allDeps.react);
1244
1243
  const hasNext = Boolean(allDeps.next);
1244
+ const reactViteDeps = Boolean(allDeps.vite && allDeps.react);
1245
+ const hasReactVite = reactViteDeps && !hasNext;
1245
1246
  return [
1246
1247
  createDoctorCheck({
1247
1248
  id: "framework-react-vite",
1248
1249
  label: "React + Vite (root package.json only)",
1249
1250
  status: hasReactVite ? "pass" : "not-applicable",
1250
- message: hasReactVite ? "react + vite dependencies detected in the root package.json" : "Not detected in the root package.json (sub-packages are not scanned)",
1251
+ message: hasReactVite ? "react + vite dependencies detected in the root package.json" : reactViteDeps ? "next is in the root package.json too, so vite may come from its test runner \u2014 see each app's Frontend framework check" : "Not detected in the root package.json (sub-packages are not scanned)",
1251
1252
  evidence: hasReactVite ? ["package.json"] : []
1252
1253
  }),
1253
1254
  createDoctorCheck({
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  recordedReview,
3
3
  runAddReview
4
- } from "../_chunks/chunk-ERCX7F6K.js";
4
+ } from "../_chunks/chunk-ND62HBKD.js";
5
5
  import "../_chunks/chunk-ASY3CK5L.js";
6
6
  import {
7
7
  DEFAULT_MAX_ROUNDS,
@@ -11,10 +11,10 @@ import {
11
11
  import {
12
12
  renderAddAgentRulesReport,
13
13
  runAddAgentRules
14
- } from "../_chunks/chunk-ZNTGYYLU.js";
14
+ } from "../_chunks/chunk-VTXXW2B5.js";
15
15
  import {
16
16
  renderAddReviewReport
17
- } from "../_chunks/chunk-AON4KGZT.js";
17
+ } from "../_chunks/chunk-E565RG2B.js";
18
18
  import "../_chunks/chunk-5MI3O4VZ.js";
19
19
  import {
20
20
  renderAddBackendBody,
@@ -23,14 +23,16 @@ import {
23
23
  import "../_chunks/chunk-WNO3ZGBB.js";
24
24
  import {
25
25
  DEFAULT_CONFLICT_POLICY,
26
+ readTargetDefaults,
26
27
  renderAddFsdLiteReport,
27
28
  runAddFsdLite
28
- } from "../_chunks/chunk-TJ6SCQLI.js";
29
+ } from "../_chunks/chunk-RDTB34IA.js";
29
30
  import {
30
31
  TOOLKIT_CONFIG_INPUT,
32
+ lintInputsListSnippet,
31
33
  lintInputsProjectSnippet,
32
34
  lintInputsTargetDefaultsSnippet
33
- } from "../_chunks/chunk-N6B6VBHG.js";
35
+ } from "../_chunks/chunk-LBYZDAWS.js";
34
36
  import {
35
37
  allFrameworkProfiles,
36
38
  resolveFrontendApp
@@ -259,6 +261,10 @@ function applyLintInputs(tree, input) {
259
261
  return Array.isArray(named) && named.includes(TOOLKIT_CONFIG_INPUT);
260
262
  });
261
263
  if (defaultsInputs !== void 0 && carries(defaultsInputs)) return { action: "present", target };
264
+ const lintDefaults = readTargetDefaults(targetDefaults, target);
265
+ if (lintDefaults.shape === "list" && lintDefaults.entries.length > 0 && lintDefaults.entries.every((entry) => entry.inputs !== void 0 && carries(entry.inputs))) {
266
+ return { action: "present", target };
267
+ }
262
268
  const projects = getProjects(tree);
263
269
  const ownTarget = (name) => {
264
270
  const project = projects.get(name);
@@ -269,13 +275,13 @@ function applyLintInputs(tree, input) {
269
275
  return void 0;
270
276
  };
271
277
  const ownTargets = [...projects.keys()].filter((name) => ownTarget(name) !== void 0).sort();
272
- const reason = !input.firstRun ? "not-first-run" : plugin === void 0 ? "no-plugin" : ownTargets.length > 0 ? "own-targets" : defaultsInputs !== void 0 ? "existing-inputs" : void 0;
278
+ const reason = !input.firstRun ? "not-first-run" : plugin === void 0 ? "no-plugin" : ownTargets.length > 0 ? "own-targets" : lintDefaults.shape === "list" ? "list-defaults" : lintDefaults.shape === "other" ? "unreadable-defaults" : defaultsInputs !== void 0 ? "existing-inputs" : void 0;
273
279
  if (reason === void 0) {
274
280
  if (!input.dryRun) tree.write("nx.json", applyJsonEdits(raw, [[["targetDefaults", target, "inputs"], ["...", TOOLKIT_CONFIG_INPUT]]]));
275
281
  return { action: "added", target };
276
282
  }
277
283
  const fsdProjects = input.fsdProjects.filter((name) => prefix(projects.get(name)?.root ?? "") !== "");
278
- const snippet = reason === "existing-inputs" && defaultsKey !== void 0 ? [`Add "${TOOLKIT_CONFIG_INPUT}" to targetDefaults["${defaultsKey}"].inputs in nx.json.`] : plugin !== void 0 && ownTargets.length === 0 ? lintInputsTargetDefaultsSnippet(target) : fsdProjects.flatMap((name) => {
284
+ const snippet = reason === "existing-inputs" && defaultsKey !== void 0 ? [`Add "${TOOLKIT_CONFIG_INPUT}" to targetDefaults["${defaultsKey}"].inputs in nx.json.`] : plugin !== void 0 && ownTargets.length === 0 ? lintDefaults.shape === "list" ? lintInputsListSnippet(target) : lintDefaults.shape === "other" ? [`Replace targetDefaults["${target}"] in nx.json with an object, then:`, ...lintInputsTargetDefaultsSnippet(target)] : lintInputsTargetDefaultsSnippet(target) : fsdProjects.flatMap((name) => {
279
285
  const root = projects.get(name)?.root ?? "";
280
286
  const own = ownTarget(name);
281
287
  return lintInputsProjectSnippet({
@@ -441,6 +447,8 @@ function renderLintInputs(outcome, dryRun) {
441
447
  "not-first-run": "init writes nx.json only when it sets a workspace up for the first time",
442
448
  "no-plugin": "@nx/eslint/plugin is not registered, so targetDefaults would replace the lint targets' inputs",
443
449
  "own-targets": `${(outcome.ownTargets ?? []).join(", ")} write their own ${outcome.target} target, which keeps only what targetDefaults lists`,
450
+ "list-defaults": `targetDefaults.${outcome.target} is a list of entries, and the input belongs in each one that covers an FSD project`,
451
+ "unreadable-defaults": `targetDefaults.${outcome.target} is neither an object nor a list of entries`,
444
452
  "existing-inputs": `targetDefaults already gives ${outcome.target} inputs of its own`
445
453
  }[outcome.reason ?? "not-first-run"];
446
454
  return [
package/generators.json CHANGED
@@ -19,7 +19,7 @@
19
19
  "add-review": {
20
20
  "factory": "./dist/generators/add-review/generator",
21
21
  "schema": "./src/generators/add-review/schema.json",
22
- "description": "Install the Claude PR review workflow"
22
+ "description": "Add an AI PR review workflow (beta)"
23
23
  },
24
24
  "add-backend": {
25
25
  "factory": "./dist/generators/add-backend/generator",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@clearlydev/nx-archweave",
3
- "version": "0.5.1",
4
- "description": "Nx generators for an FSD Lite lint rule, frontend/backend boundaries, AI agent rules, GitHub templates and optional AI PR review",
3
+ "version": "0.5.2",
4
+ "description": "Nx plugin and CLI that set up Feature-Sliced Design (FSD) import linting, frontend/backend module boundaries and AI agent rule files. AI PR review is optional (beta).",
5
5
  "license": "MIT",
6
6
  "author": "clearlydev (https://github.com/clearlydev)",
7
7
  "engines": {
@@ -19,17 +19,25 @@
19
19
  "keywords": [
20
20
  "nx",
21
21
  "nx-plugin",
22
- "generators",
23
22
  "monorepo",
24
- "scaffolding",
25
23
  "feature-sliced-design",
26
24
  "fsd",
27
- "ai",
25
+ "eslint",
26
+ "eslint-rule",
27
+ "module-boundaries",
28
+ "frontend-architecture",
29
+ "steiger",
30
+ "generators",
31
+ "ai-agents",
32
+ "agents-md",
33
+ "claude-md",
28
34
  "code-review",
29
- "claude",
30
- "gemini",
31
- "gpt",
32
- "cursor"
35
+ "github-actions",
36
+ "react",
37
+ "nextjs",
38
+ "nestjs",
39
+ "express",
40
+ "typescript"
33
41
  ],
34
42
  "sideEffects": false,
35
43
  "publishConfig": {