Skip to content

Commit 7970413

Browse files
committed
fix(scripts): order docs before deployment config and gate the pre-push regenerate on a clean tree
1 parent 0f4ad3a commit 7970413

4 files changed

Lines changed: 18 additions & 13 deletions

File tree

‎.github/CONTRIBUTING.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,10 +516,10 @@ In addition, you will need to update the registries:
516516
Ensure that your tool functions correctly by making test requests and verifying the responses.
517517

518518
8. **Generate Documentation:**
519-
Run the documentation generator (from `apps/sim`) to create docs for your new tool:
519+
Regenerate every derived artifact, including your tool's docs page, from the repo root:
520520

521521
```bash
522-
cd apps/sim && bun run generate-docs
522+
bun run generate
523523
```
524524

525525
### Naming Conventions

‎.husky/pre-push‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,17 @@ if printf '%s\n' "$changed" | grep -qE '^scripts/'; then
4444
fi
4545
TURBO_SCM_BASE="$base" bunx turbo run type-check --affected --output-logs=errors-only
4646

47-
# A stale generated artifact would only fail CI's check:audits, so regenerate them all here. The
48-
# diff is compared before and after, so uncommitted work in the tree never trips this.
49-
before=$(git diff | git hash-object --stdin)
50-
bun run generate >/dev/null
51-
if [ "$(git diff | git hash-object --stdin)" != "$before" ]; then
52-
echo "pre-push: generated artifacts were stale and have been regenerated:"
53-
git diff --name-only
54-
echo "pre-push: commit them and push again."
55-
exit 1
47+
# A stale generated artifact would only fail CI's check:audits. Generators read the working tree,
48+
# so the result describes the pushed commit only when the tree is that commit; with uncommitted or
49+
# untracked files the check is left to CI rather than judging (or blocking) unrelated work.
50+
if git diff --quiet HEAD && [ -z "$(git ls-files --others --exclude-standard)" ]; then
51+
bun run generate >/dev/null
52+
if ! git diff --quiet; then
53+
echo "pre-push: generated artifacts were stale and have been regenerated:"
54+
git diff --name-only
55+
echo "pre-push: commit them and push again."
56+
exit 1
57+
fi
58+
else
59+
echo "pre-push: uncommitted changes; leaving generated-artifact freshness to CI"
5660
fi

‎package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,13 @@
108108
"generate:sdk-fixture-catalog": "bun run apps/sim/scripts/generate-sdk-fixture-catalog.ts",
109109
"check:sdk-fixture-catalog": "bun run apps/sim/scripts/generate-sdk-fixture-catalog.ts --check",
110110
"check:sdk-names-frozen": "bun run scripts/check-sdk-names-frozen.ts",
111+
"generate:docs": "bun run scripts/generate-docs.ts",
112+
"check:docs": "bun run scripts/generate-docs.ts --check",
111113
"generate:deployment-config": "bun run scripts/generate-deployment-config.ts",
112114
"check:deployment-config": "bun run scripts/generate-deployment-config.ts --check",
113115
"images:generate": "bun run scripts/generate-image-manifest.ts",
114116
"images:check": "bun run scripts/generate-image-manifest.ts --check",
115117
"check:integration-catalog": "bun run scripts/check-integration-catalog.ts",
116-
"generate:docs": "bun run scripts/generate-docs.ts",
117-
"check:docs": "bun run scripts/generate-docs.ts --check",
118118
"mship-tools:generate": "bun run scripts/sync-tool-catalog.ts",
119119
"mship-tools:check": "bun run scripts/sync-tool-catalog.ts --check",
120120
"trace-spans-contract:generate": "bun run scripts/sync-trace-spans-contract.ts",

‎scripts/generate-all.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*
99
* Generators run one at a time, in package.json order, because some read what an earlier one
1010
* wrote: `generate:cli-docs` reads the operation table `generate:cli-api` emits,
11+
* `generate:deployment-config` imports the integration metadata `generate:docs` writes,
1112
* `generate:docs-manifest` lists the pages `generate:cli-docs` and `generate:docs` write, and
1213
* `generate:sdk-fixture-catalog` projects through `generate:tool-metadata` and `generate:sdk-names`
1314
* output. Keep a new pair below the generators it reads.

0 commit comments

Comments
 (0)