Skip to content

Commit bb443fd

Browse files
chrisdoccoderabbitai[bot]CodeRabbitgitar-botdependabot[bot]
authored
refactor: reduce root package scripts by 31% (#939)
* refactor: reduce root package scripts * docs: publish runtime architecture review (#940) * docs: attach architecture review to issue 937 * style: format issue 937 architecture report * docs: attach runtime architecture review to issue 941 * chore: scope architecture report PR to issue 941 * fix: apply CodeRabbit auto-fixes Fixed 2 file(s) based on 2 unresolved review comments. Co-authored-by: CodeRabbit <noreply@coderabbit.ai> * fix: format runtime-architecture-review HTML report Co-authored-by: Christoph Kieslich <9047291+chrisdoc@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: CodeRabbit <noreply@coderabbit.ai> Co-authored-by: Gitar <noreply@gitar.ai> Co-authored-by: Christoph Kieslich <9047291+chrisdoc@users.noreply.github.com> * refactor: centralize Hevy endpoint policy (#944) * refactor: centralize Hevy endpoint policy * refactor(client): simplify retry failure transition * feat(operations): route routine listing through shared operation (#946) * feat(operations): route routine listing through shared operation * refactor(cli): split command dispatchers * fix(cli): avoid async dispatch wrappers * refactor(node): separate embedding from runtime bootstrap (#947) * refactor(node): separate embedding from runtime bootstrap * fix(node): clean up embedding test diagnostics * fix(node): include runtime chunk in Sentry source maps * refactor(node): centralize process lifecycle (#948) * refactor(node): centralize process lifecycle * fix(node): satisfy lifecycle static analysis * feat(worker): add safe tool observation (#949) * feat(worker): add safe tool observation * refactor(worker): simplify safe observation projection * feat(node): bound HTTP session admission (#951) * feat(node): bound HTTP session admission * refactor(node): split HTTP request admission paths * fix(node): satisfy HTTP admission lint * fix(node): remove HTTP handler lint regressions * test(core): add initial runtime contract matrix (#952) * test(core): add initial runtime contract matrix * fix(test): satisfy contract matrix lint * fix(test): remove redundant async wrappers * style(test): format contract fixture * feat(operations): add routine retrieval operation (#953) * feat(operations): add routine retrieval operation * fix(test): remove redundant routine async wrapper * feat(operations): add workout retrieval operation (#954) * feat(operations): add workout retrieval operation * fix(test): remove redundant workout async wrappers * style(test): format workout fixture * fix(deps): bump hono from 4.12.31 to 4.13.1 (#955) Bumps [hono](https://github.com/honojs/hono) from 4.12.31 to 4.13.1. - [Release notes](https://github.com/honojs/hono/releases) - [Commits](honojs/hono@v4.12.31...v4.13.1) --- updated-dependencies: - dependency-name: hono dependency-version: 4.13.1 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * test(worker): configure CIMD compatibility in Vitest (#950) * test(worker): configure CIMD compatibility in Vitest * fix(test): harden Cloudflare Vitest runtime setup --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: CodeRabbit <noreply@coderabbit.ai> Co-authored-by: Gitar <noreply@gitar.ai> Co-authored-by: Christoph Kieslich <9047291+chrisdoc@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 9c8c701 commit bb443fd

10 files changed

Lines changed: 219 additions & 141 deletions

.changeset/lean-root-scripts.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
---
3+
4+
Reduce the root package script surface while preserving internal lanes as Nx targets.

CONTRIBUTING.md

Lines changed: 42 additions & 36 deletions
Large diffs are not rendered by default.

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ COPY packages/hevy-client/ ./packages/hevy-client/
1717
COPY packages/operations/ ./packages/operations/
1818
COPY packages/core/ ./packages/core/
1919
COPY packages/node/ ./packages/node/
20-
RUN npm run build:standalone
20+
RUN npm run build:standalone --workspace hevy-mcp
2121

2222
FROM node:24-alpine AS runtime
2323

docs/nx-dependency-cruiser-spike.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,16 @@ lane model. The generated contributor tables in
4141
[`docs/test-lanes.md`](./test-lanes.md) show the current lane and aggregate
4242
membership, while `project.json` is the source for target dependencies. Do not
4343
copy a target or member count into prose: derive the current graph with
44-
`npx nx show project repository --json` (or `npx nx graph`). Root aliases remain
45-
supported compatibility entrypoints; workflow steps invoke the corresponding
46-
Nx targets, so command text is not duplicated in the policy model.
44+
`npx nx show project repository --json` (or `npx nx graph`). Contributor-facing
45+
root aliases remain supported compatibility entrypoints; internal-only lanes
46+
use their corresponding Nx targets directly, so command text is not duplicated
47+
in the policy model.
4748

48-
Run the dependency rules independently, through the combined boundary lane,
49-
and exercise the representative pack target:
49+
Run the dependency rules through the combined boundary lane and exercise the
50+
representative pack target:
5051

5152
```sh
52-
npm run check:dependency-cruiser
5353
npm run check:boundaries
54-
npx nx run repository:check:dependency-cruiser
5554
npx nx run repository:check:boundaries
5655
npx nx run repository:pack:artifacts --skip-nx-cache
5756
```

docs/test-lanes.md

Lines changed: 34 additions & 35 deletions
Large diffs are not rendered by default.

docs/testing-strategy.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,13 @@ these names rather than duplicating selectors:
297297
"test:live": "node --env-file-if-exists=.env scripts/run-live-vitest.mjs HEVY_API_KEY tests/integration/hevy-mcp.integration.test.ts",
298298
"test:nightly": "node --env-file-if-exists=.env tests/nightly/test_hevy_mcp.mjs",
299299
"test:performance": "npm run build && vitest run tests/performance/performance.test.ts",
300-
"test:coverage": "unit and mocked MCP coverage via their named lanes",
301-
"test:pr": "npm run test:unit && npm run test:mcp && npm run test:contract && npm run test:stdio && npm run test:pack"
300+
"test:pr": "nx run repository:test:pr"
302301
}
303302
```
304303

304+
Coverage uses the unit and mocked MCP commands with their existing
305+
`--coverage.reportsDirectory` arguments instead of a separate wrapper alias.
306+
305307
`test:live` and `test:nightly` must fail fast with a clear message when they are
306308
explicitly invoked without required credentials. They should not silently turn
307309
an intentional live job into a skipped success.

package.json

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@
3737
"scripts": {
3838
"prepare": "node scripts/install-git-hooks.mjs",
3939
"inspect": "npm run build && npx @modelcontextprotocol/inspector@latest node --env-file .env packages/node/dist/cli.mjs",
40-
"inspect:npm": "npx @modelcontextprotocol/inspector@latest npx hevy-mcp@latest",
4140
"measure:tokens": "tsx scripts/measure-token-cost.ts",
42-
"update-dependencies": "npx --yes npm-check-updates --deep -u && npm install",
4341
"test": "npm run build && node --env-file-if-exists=.env node_modules/vitest/vitest.mjs --run",
4442
"test:unit": "vitest run --exclude 'tests/integration/**' --exclude 'tests/performance/**'",
4543
"test:release-unit": "vitest run --exclude 'tests/integration/**'",
@@ -57,12 +55,10 @@
5755
"test:live": "node --env-file-if-exists=.env scripts/run-live-vitest.mjs HEVY_API_KEY tests/integration/hevy-mcp.integration.test.ts",
5856
"test:nightly": "node --env-file-if-exists=.env tests/nightly/test_hevy_mcp.mjs",
5957
"test:performance": "npm run build && vitest run tests/performance/performance.test.ts",
60-
"test:coverage": "npm run test:unit -- --coverage --coverage.reportsDirectory=coverage/unit && npm run test:mcp -- --coverage --coverage.reportsDirectory=coverage/mocked",
6158
"test:pr": "nx run repository:test:pr",
6259
"openapi": "node ./scripts/openapi-spec.js",
6360
"check:openapi": "node ./scripts/check-openapi-spec.js",
6461
"build": "npm run build --workspace hevy-mcp",
65-
"build:standalone": "npm run build:standalone --workspace hevy-mcp",
6662
"build:client": "npm run build:client --workspace @hevy-mcp/hevy-client && prettier --ignore-unknown --write packages/hevy-client/src/generated",
6763
"prepack": "npm run check:server-manifest && npm run build",
6864
"start": "node --env-file .env packages/node/dist/cli.mjs",
@@ -72,26 +68,12 @@
7268
"check:types": "tsc --noEmit && npm run check:types --workspaces --if-present",
7369
"check:control-plane": "node scripts/check-control-plane.mjs",
7470
"check:generated": "node ./scripts/check-generated-client.mjs",
75-
"check:boundaries": "node scripts/check-package-boundaries.mjs && npm run check:dependency-cruiser",
76-
"check:exports": "node scripts/check-package-exports.mjs",
77-
"check:publint": "publint run --strict --pack npm packages/node && publint run --strict --pack npm packages/cli",
78-
"check:package-changesets": "node scripts/check-package-changesets.mjs",
71+
"check:boundaries": "node scripts/check-package-boundaries.mjs && depcruise --config .dependency-cruiser.cjs packages",
7972
"build:packages": "npm run build --workspaces --if-present",
80-
"check:dependency-cruiser": "depcruise --config .dependency-cruiser.cjs packages",
81-
"check:changeset": "env -u GIT_DIR -u GIT_WORK_TREE changeset status --since=origin/main && env -u GIT_DIR -u GIT_WORK_TREE npm run check:package-changesets -- --since origin/main",
82-
"nx:affected": "nx affected --target=control-plane --base=origin/main --head=HEAD",
83-
"nx:control-plane": "nx run repository:control-plane",
73+
"check:changeset": "env -u GIT_DIR -u GIT_WORK_TREE changeset status --since=origin/main && env -u GIT_DIR -u GIT_WORK_TREE node scripts/check-package-changesets.mjs --since origin/main",
8474
"check:server-manifest": "node scripts/server-manifest.mjs check",
85-
"sync:server-manifest": "node scripts/server-manifest.mjs sync",
86-
"version:changesets": "changeset version && npm run sync:server-manifest",
87-
"version": "npm run sync:server-manifest && git add server.json packages/node/server.json",
88-
"version:patch": "npm version patch",
89-
"version:minor": "npm version minor",
90-
"version:major": "npm version major",
91-
"release": "changeset publish",
92-
"commit": "commit",
75+
"version": "node scripts/server-manifest.mjs sync && git add server.json packages/node/server.json",
9376
"worker:dev": "wrangler dev --x-new-config",
94-
"worker:deploy": "cross-env WRANGLER_MODE=production wrangler deploy --x-new-config --env production",
9577
"worker:dry-run": "wrangler deploy --x-new-config --dry-run --outdir .wrangler/dry-run && node scripts/check-worker-bundle.mjs"
9678
},
9779
"devDependencies": {

project.json

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,27 @@
1515
"inputs": ["boundaryInputs", "controlPlaneInputs"]
1616
},
1717
"check:exports": {
18+
"executor": "nx:run-commands",
19+
"options": {
20+
"command": "node scripts/check-package-exports.mjs"
21+
},
1822
"inputs": ["packageManifestInputs", "controlPlaneInputs"]
1923
},
2024
"check:publint": {
25+
"executor": "nx:run-commands",
26+
"options": {
27+
"command": "publint run --strict --pack npm packages/node && publint run --strict --pack npm packages/cli"
28+
},
2129
"cache": false,
2230
"dependsOn": ["build", "@chrisdoc/hevy-cli:build"],
2331
"parallelism": false,
2432
"inputs": ["validationInputs"]
2533
},
2634
"check:package-changesets": {
35+
"executor": "nx:run-commands",
36+
"options": {
37+
"command": "node scripts/check-package-changesets.mjs"
38+
},
2739
"cache": false,
2840
"inputs": ["packageManifestInputs", "{workspaceRoot}/.changeset/**/*.md"]
2941
},
@@ -170,6 +182,10 @@
170182
"inputs": ["validationInputs"]
171183
},
172184
"sync:server-manifest": {
185+
"executor": "nx:run-commands",
186+
"options": {
187+
"command": "node scripts/server-manifest.mjs sync"
188+
},
173189
"cache": false,
174190
"outputs": [
175191
"{workspaceRoot}/server.json",
@@ -178,14 +194,6 @@
178194
],
179195
"inputs": ["manifestInputs"]
180196
},
181-
"test:coverage": {
182-
"cache": false,
183-
"outputs": [
184-
"{workspaceRoot}/coverage/unit",
185-
"{workspaceRoot}/coverage/mocked"
186-
],
187-
"inputs": ["validationInputs"]
188-
},
189197
"test:performance": {
190198
"cache": false,
191199
"outputs": ["{workspaceRoot}/test-results/performance/summary.json"],
@@ -210,21 +218,33 @@
210218
"inputs": ["validationInputs"]
211219
},
212220
"version:changesets": {
221+
"executor": "nx:run-commands",
222+
"options": {
223+
"command": "changeset version && node scripts/server-manifest.mjs sync"
224+
},
213225
"cache": false,
214226
"inputs": ["packageManifestInputs", "{workspaceRoot}/.changeset/**/*.md"]
215227
},
216228
"version": {
217229
"cache": false,
218230
"inputs": ["packageManifestInputs", "controlPlaneInputs"]
219231
},
220-
"version:major": { "cache": false },
221-
"version:minor": { "cache": false },
222-
"version:patch": { "cache": false },
223232
"release": {
233+
"executor": "nx:run-commands",
234+
"options": {
235+
"command": "changeset publish"
236+
},
224237
"cache": false,
225238
"inputs": ["packageManifestInputs", "controlPlaneInputs"]
226239
},
227-
"worker:deploy": { "cache": false },
240+
"worker:deploy": {
241+
"executor": "nx:run-commands",
242+
"options": {
243+
"command": "cross-env WRANGLER_MODE=production wrangler deploy --x-new-config --env production"
244+
},
245+
"cache": false,
246+
"inputs": ["validationInputs"]
247+
},
228248
"control-plane": {
229249
"executor": "nx:noop",
230250
"dependsOn": [

repository/validation-lanes.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@
230230
},
231231
{
232232
"id": "package-exports",
233-
"alias": "check:exports",
234233
"selector": {
235234
"kind": "control-plane",
236235
"check": "exports"
@@ -245,7 +244,6 @@
245244
},
246245
{
247246
"id": "package-publint",
248-
"alias": "check:publint",
249247
"selector": {
250248
"kind": "control-plane",
251249
"check": "publint"
@@ -260,7 +258,6 @@
260258
},
261259
{
262260
"id": "package-changesets",
263-
"alias": "check:package-changesets",
264261
"selector": {
265262
"kind": "control-plane",
266263
"check": "changesets"

0 commit comments

Comments
 (0)