Skip to content

AI-native design editor. Open-source Figma alternative.

build(tools): group tools by role and gate them like the rest of the repo (#791)

Danila Poyarkov1aa10a4fed5e
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index aff8ee1dc..bc3963cae 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -41,7 +41,7 @@ jobs:
name: Resolve immutable source and native matrix
env:
RELEASE_TAG: ${{ inputs.tag || github.ref_name }}
- run: bun tools/release-packages/src/native/resolve.ts
+ run: bun tools/release/release-packages/src/native/resolve.ts
frontend:
needs: plan
@@ -74,12 +74,12 @@ jobs:
bun run build
- name: Prepare and validate npm tarballs
run: |
- bun .pipeline/tools/release-packages/src/cli.ts prepare
- bun .pipeline/tools/release-packages/src/cli.ts pack
+ bun .pipeline/tools/release/release-packages/src/cli.ts prepare
+ bun .pipeline/tools/release/release-packages/src/cli.ts pack
- name: Extract exact release notes
env:
RELEASE_VERSION: ${{ needs.plan.outputs.version }}
- run: bun .pipeline/tools/release-packages/src/extract-release-notes.ts "$RELEASE_VERSION" release-notes.md
+ run: bun .pipeline/tools/release/release-packages/src/extract-release-notes.ts "$RELEASE_VERSION" release-notes.md
- name: Archive platform-independent native inputs
id: frontend
run: |
@@ -148,7 +148,7 @@ jobs:
with:
name: release-frontend
- name: Verify shared inputs and disable only the redundant build hook
- run: bun .pipeline/tools/release-packages/src/native/frontend.ts
+ run: bun .pipeline/tools/release/release-packages/src/native/frontend.ts
- name: Extract shared frontend, icons and menu
run: tar -xf frontend.tar
- name: Verify Node and Tauri startup
@@ -175,7 +175,7 @@ jobs:
- name: Collect only reported bundles and signatures
env:
TAURI_ARTIFACT_PATHS: ${{ steps.tauri.outputs.artifactPaths }}
- run: bun .pipeline/tools/release-packages/src/native/collect.ts
+ run: bun .pipeline/tools/release/release-packages/src/native/collect.ts
- uses: actions/upload-artifact@v7
with:
name: native-${{ matrix.target }}
@@ -230,9 +230,9 @@ jobs:
- name: Install signature verifier
run: sudo apt-get update && sudo apt-get install -y minisign
- name: Verify all targets, digests and updater signatures
- run: bun .pipeline/tools/release-packages/src/native/assemble.ts
+ run: bun .pipeline/tools/release/release-packages/src/native/assemble.ts
- name: Refuse published releases or moved tags
- run: bun .pipeline/tools/release-packages/src/native/publish.ts check
+ run: bun .pipeline/tools/release/release-packages/src/native/publish.ts check
- name: Attest the complete binary set and source/workflow manifest
id: provenance
uses: actions/attest@v4
@@ -249,6 +249,6 @@ jobs:
--signer-digest "$WORKFLOW_COMMIT" --deny-self-hosted-runners
done
- name: Publish verified npm artifacts with provenance
- run: bun .pipeline/tools/release-packages/src/cli.ts publish
+ run: bun .pipeline/tools/release/release-packages/src/cli.ts publish
- name: Replace and verify the entire draft asset set
- run: bun .pipeline/tools/release-packages/src/native/publish.ts upload
+ run: bun .pipeline/tools/release/release-packages/src/native/publish.ts upload
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index aced2176e..c955f010a 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -35,7 +35,7 @@ jobs:
id: classify
env:
CI_BASE_SHA: ${{ github.event.pull_request.base.sha }}
- run: bun tools/ci/src/classify.ts
+ run: bun tools/ci/policy/src/classify.ts
commit-messages:
name: Commit messages
@@ -247,7 +247,7 @@ jobs:
run: bun --filter @open-pencil/core build
- name: Run ${{ matrix.group }} unit tests
- run: bun tools/unit-tests/src/run.ts "${{ matrix.group }}"
+ run: bun tools/dev/unit-tests/src/run.ts "${{ matrix.group }}"
result:
name: CI result
@@ -263,4 +263,4 @@ jobs:
- name: Require successful checks for the selected scope
env:
CI_NEEDS: ${{ toJSON(needs) }}
- run: bun tools/ci/src/gate.ts
+ run: bun tools/ci/policy/src/gate.ts
diff --git a/.github/workflows/native-contracts-image.yml b/.github/workflows/native-contracts-image.yml
index fc7d75289..77f15aa9c 100644
--- a/.github/workflows/native-contracts-image.yml
+++ b/.github/workflows/native-contracts-image.yml
@@ -5,7 +5,7 @@ on:
push:
branches: [master]
paths:
- - 'tools/ci-images/native-contracts/Dockerfile'
+ - 'tools/ci/images/native-contracts/Dockerfile'
- '.github/workflows/native-contracts-image.yml'
permissions:
@@ -35,7 +35,7 @@ jobs:
- uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
with:
- context: tools/ci-images/native-contracts
+ context: tools/ci/images/native-contracts
push: true
tags: |
ghcr.io/open-pencil/native-contracts-ci:ubuntu-24.04
diff --git a/.github/workflows/pr-review-guidance.yml b/.github/workflows/pr-review-guidance.yml
index a6cdb4f51..846e6be52 100644
--- a/.github/workflows/pr-review-guidance.yml
+++ b/.github/workflows/pr-review-guidance.yml
@@ -34,8 +34,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
- if [ ! -f tools/pr-review-guidance/src/index.ts ]; then
+ if [ ! -f tools/ci/pr-review-guidance/src/index.ts ]; then
echo "Trusted PR review guidance helper is not present on the default branch yet."
exit 0
fi
- node --experimental-strip-types tools/pr-review-guidance/src/index.ts
+ node --experimental-strip-types tools/ci/pr-review-guidance/src/index.ts
diff --git a/.gitignore b/.gitignore
index 07baf89fc..5d70c2768 100644
--- a/.gitignore
+++ b/.gitignore
@@ -49,7 +49,7 @@ storybook-static/
/desktop/*.key
!/desktop/*.key.pub
-# Generated from assets/brand by tools/brand (never hand-edit these outputs)
+# Generated from assets/brand by tools/generate/brand (never hand-edit these outputs)
/.cache/brand/
/.cache/brand.lock/
/public/brand/
diff --git a/assets/brand/README.md b/assets/brand/README.md
index 155666ca1..6bcc2d7e0 100644
--- a/assets/brand/README.md
+++ b/assets/brand/README.md
@@ -6,7 +6,7 @@
- Both use real transparent counters and no white outline. Preserve the `data-part` attributes used for derived dark and monochrome artwork.
- Dark artwork has its own brighter teal palette, lighter blue borders, soft-white handle centers, and a subtler grid. Monochrome artwork omits the grid.
-Edit these SVGs, not generated files. Platform backgrounds, padding, and dark colors live in `tools/brand/src/config.ts`. The approved main colors are defined by the SVG artwork. The official app-icon variant puts the light-palette mark on an ivory (`#F5F5EF`) rounded tile that fills the image, with transparency only at the rounded corners. Native desktop assets retain their platform-specific outer margin. Desktop icons, any-purpose PWA icons, and larger in-app branding share this composition. The tile stays ivory in both themes; use `BrandMark` with `variant="app-icon"` for larger placements. The editor header uses a 24px tile. Favicons use the same tile with the optical micro master inside, in both browser themes. Generated `brand/app-icon.svg` and `brand/app-icon-1024.png` are suitable for profile images. Apple Touch keeps an opaque square for platform rounding; maskable artwork stays opaque and inside the central 80%-diameter safe circle.
+Edit these SVGs, not generated files. Platform backgrounds, padding, and dark colors live in `tools/generate/brand/src/config.ts`. The approved main colors are defined by the SVG artwork. The official app-icon variant puts the light-palette mark on an ivory (`#F5F5EF`) rounded tile that fills the image, with transparency only at the rounded corners. Native desktop assets retain their platform-specific outer margin. Desktop icons, any-purpose PWA icons, and larger in-app branding share this composition. The tile stays ivory in both themes; use `BrandMark` with `variant="app-icon"` for larger placements. The editor header uses a 24px tile. Favicons use the same tile with the optical micro master inside, in both browser themes. Generated `brand/app-icon.svg` and `brand/app-icon-1024.png` are suitable for profile images. Apple Touch keeps an opaque square for platform rounding; maskable artwork stays opaque and inside the central 80%-diameter safe circle.
## Generation
@@ -17,14 +17,14 @@ bun run generate:icons --target docs # Documentation
bun run generate:icons --target desktop # Native PNG/ICO/ICNS
bun run generate:icons --force # Ignore the content cache
bun run check:icons # Fresh generation, contracts, reproducibility, types
-bun test tools/brand/tests
+bun test tools/generate/brand/tests
```
Generation is local using pinned RealFaviconGenerator/Sharp and Tauri versions; no hosted generator or credentials are needed. Generated assets and the cache are ignored by Git. Only the two artwork masters, settings, code, tests, and the normal Playwright visual baseline are tracked.
Vite ensures web assets before app dev/build. VitePress ensures docs assets before docs dev/build. Storybook prepares the assets for its stories. Tauri's dev/build hooks prepare native icons before compilation. Direct Cargo commands bypass those hooks: run `bun run generate:icons --target desktop` before `cargo check` or `cargo build` on a fresh checkout. CI's native-contract job does this explicitly. No icon generation runs in the shipped application.
-Outputs are owned by `tools/brand/src/config.ts`: `public/brand/`, `packages/docs/public/brand/`, the root ICO/Apple Touch files in each public directory, and `desktop/icons/`. The app's manifest remains in `vite/pwa.ts`; docs intentionally do not receive an installable-app manifest. Web assets never symlink into desktop output.
+Outputs are owned by `tools/generate/brand/src/config.ts`: `public/brand/`, `packages/docs/public/brand/`, the root ICO/Apple Touch files in each public directory, and `desktop/icons/`. The app's manifest remains in `vite/pwa.ts`; docs intentionally do not receive an installable-app manifest. Web assets never symlink into desktop output.
Preparation fingerprints the artwork, generator code/settings, lockfile and runtime/tool versions, verifies output hashes, and skips unchanged targets. Missing or corrupted outputs regenerate. A cross-process lock serializes concurrent builds; each file is published atomically and the cache is written last. Destination symlinks are rejected. Native ICNS frame ordering is normalized without re-encoding images.
diff --git a/bun.lock b/bun.lock
index 0961a5782..03262c0f9 100644
--- a/bun.lock
+++ b/bun.lock
@@ -403,18 +403,92 @@
"canvaskit-wasm",
],
},
- "tools/authoring-reference": {
+ "tools": {
+ "name": "@open-pencil/tools",
+ "devDependencies": {
+ "@types/bun": "^1.3.14",
+ "@types/mdast": "^4.0.4",
+ "@types/node": "^25.9.5",
+ },
+ },
+ "tools/checks/architecture": {
+ "name": "@open-pencil/architecture-tools",
+ "dependencies": {
+ "@open-pencil/package-artifacts-tools": "workspace:*",
+ },
+ },
+ "tools/checks/docs": {
+ "name": "@open-pencil/docs-tools",
+ "dependencies": {
+ "@open-pencil/package-artifacts-tools": "workspace:*",
+ },
+ },
+ "tools/checks/i18n": {
+ "name": "@open-pencil/i18n-tools",
+ },
+ "tools/checks/lint": {
+ "name": "@open-pencil/lint-tools",
+ "devDependencies": {
+ "@open-pencil/package-artifacts-tools": "workspace:*",
+ },
+ },
+ "tools/checks/package-quality": {
+ "name": "@open-pencil/package-quality-tools",
+ "dependencies": {
+ "@open-pencil/package-artifacts-tools": "workspace:*",
+ "citty": "^0.1.6",
+ "es-toolkit": "^1.51.0",
+ },
+ },
+ "tools/checks/secret-scan": {
+ "name": "@open-pencil/secret-scan-tools",
+ },
+ "tools/checks/test-homes": {
+ "name": "@open-pencil/test-homes-tools",
+ "dependencies": {
+ "@open-pencil/package-artifacts-tools": "workspace:*",
+ "@open-pencil/unit-tests-tools": "workspace:*",
+ },
+ },
+ "tools/checks/type-shapes": {
+ "name": "@open-pencil/type-shapes-tools",
+ },
+ "tools/ci/images": {
+ "name": "@open-pencil/ci-images-tools",
+ },
+ "tools/ci/policy": {
+ "name": "@open-pencil/ci-policy-tools",
+ "dependencies": {
+ "@open-pencil/package-artifacts-tools": "workspace:*",
+ },
+ },
+ "tools/ci/pr-review-guidance": {
+ "name": "@open-pencil/pr-review-guidance-tools",
+ },
+ "tools/dev/dev-server": {
+ "name": "@open-pencil/dev-server-tools",
+ },
+ "tools/dev/navigation-benchmark": {
+ "name": "@open-pencil/navigation-benchmark-tools",
+ },
+ "tools/dev/unit-tests": {
+ "name": "@open-pencil/unit-tests-tools",
+ "dependencies": {
+ "@open-pencil/package-artifacts-tools": "workspace:*",
+ },
+ },
+ "tools/generate/authoring-reference": {
"name": "@open-pencil/authoring-reference-tools",
"dependencies": {
"@open-pencil/core": "workspace:*",
- "@open-pencil/package-artifacts": "workspace:*",
+ "@open-pencil/package-artifacts-tools": "workspace:*",
"dedent": "^1.7.2",
},
},
- "tools/brand": {
+ "tools/generate/brand": {
"name": "@open-pencil/brand-tools",
"dependencies": {
- "@open-pencil/package-artifacts": "workspace:*",
+ "@open-pencil/package-artifacts-tools": "workspace:*",
"@realfavicongenerator/generate-favicon": "0.9.0",
"@realfavicongenerator/image-adapter-node": "0.9.0",
"@tauri-apps/cli": "2.11.4",
@@ -429,17 +503,21 @@
"typescript": "~5.8.3",
},
},
- "tools/docs": {
- "name": "@open-pencil/docs-tools",
- },
- "tools/lint": {
- "name": "@open-pencil/lint-tools",
+ "tools/generate/tauri-menu": {
+ "name": "@open-pencil/tauri-menu-tools",
"devDependencies": {
- "@open-pencil/package-artifacts": "workspace:*",
+ "@open-pencil/package-artifacts-tools": "workspace:*",
+ "@open-pencil/vue": "workspace:*",
},
},
- "tools/package-artifacts": {
- "name": "@open-pencil/package-artifacts",
+ "tools/generate/visual-oracles": {
+ "name": "@open-pencil/visual-oracles-tools",
+ "dependencies": {
+ "citty": "^0.1.6",
+ },
+ },
+ "tools/release/package-artifacts": {
+ "name": "@open-pencil/package-artifacts-tools",
"dependencies": {
"@publint/pack": "^0.1.5",
"pkg-types": "^2.3.1",
@@ -450,18 +528,10 @@
"nanotar": "^0.3.0",
},
},
- "tools/package-quality": {
- "name": "@open-pencil/package-quality-tools",
+ "tools/release/release-packages": {
+ "name": "@open-pencil/release-packages-tools",
"dependencies": {
- "@open-pencil/package-artifacts": "workspace:*",
- "citty": "^0.1.6",
- "es-toolkit": "^1.51.0",
- },
- },
- "tools/release-packages": {
- "name": "@open-pencil/release-packages",
- "dependencies": {
- "@open-pencil/package-artifacts": "workspace:*",
+ "@open-pencil/package-artifacts-tools": "workspace:*",
"@open-pencil/package-quality-tools": "workspace:*",
"citty": "^0.1.6",
"es-toolkit": "^1.51.0",
@@ -472,25 +542,6 @@
"nanotar": "^0.3.0",
},
},
- "tools/tauri-menu": {
- "name": "@open-pencil/tauri-menu-tools",
- "devDependencies": {
- "@open-pencil/package-artifacts": "workspace:*",
- "@open-pencil/vue": "workspace:*",
- },
- },
- "tools/unit-tests": {
- "name": "@open-pencil/tool-unit-tests",
- "dependencies": {
- "@open-pencil/package-artifacts": "workspace:*",
- },
- },
- "tools/visual-oracles": {
- "name": "@open-pencil/visual-oracle-tools",
- "dependencies": {
- "citty": "^0.1.6",
- },
- },
},
"overrides": {
"@codemirror/view": "6.43.9",
@@ -1340,17 +1391,25 @@
"@nodelib/fs.walk": ["@nodelib/[email protected]", "", { "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" } }, "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg=="],
- "@open-pencil/authoring-reference-tools": ["@open-pencil/authoring-reference-tools@workspace:tools/authoring-reference"],
+ "@open-pencil/architecture-tools": ["@open-pencil/architecture-tools@workspace:tools/checks/architecture"],
+
+ "@open-pencil/authoring-reference-tools": ["@open-pencil/authoring-reference-tools@workspace:tools/generate/authoring-reference"],
+
+ "@open-pencil/brand-tools": ["@open-pencil/brand-tools@workspace:tools/generate/brand"],
- "@open-pencil/brand-tools": ["@open-pencil/brand-tools@workspace:tools/brand"],
+ "@open-pencil/ci-images-tools": ["@open-pencil/ci-images-tools@workspace:tools/ci/images"],
+
+ "@open-pencil/ci-policy-tools": ["@open-pencil/ci-policy-tools@workspace:tools/ci/policy"],
"@open-pencil/cli": ["@open-pencil/cli@workspace:packages/cli"],
"@open-pencil/core": ["@open-pencil/core@workspace:packages/core"],
+ "@open-pencil/dev-server-tools": ["@open-pencil/dev-server-tools@workspace:tools/dev/dev-server"],
+
"@open-pencil/docs": ["@open-pencil/docs@workspace:packages/docs"],
- "@open-pencil/docs-tools": ["@open-pencil/docs-tools@workspace:tools/docs"],
+ "@open-pencil/docs-tools": ["@open-pencil/docs-tools@workspace:tools/checks/docs"],
"@open-pencil/dom-css": ["@open-pencil/dom-css@workspace:packages/dom-css"],
@@ -1358,27 +1417,41 @@
"@open-pencil/harness": ["@open-pencil/harness@workspace:packages/harness"],
+ "@open-pencil/i18n-tools": ["@open-pencil/i18n-tools@workspace:tools/checks/i18n"],
+
"@open-pencil/kiwi": ["@open-pencil/kiwi@workspace:packages/kiwi"],
- "@open-pencil/lint-tools": ["@open-pencil/lint-tools@workspace:tools/lint"],
+ "@open-pencil/lint-tools": ["@open-pencil/lint-tools@workspace:tools/checks/lint"],
"@open-pencil/mcp": ["@open-pencil/mcp@workspace:packages/mcp"],
- "@open-pencil/package-artifacts": ["@open-pencil/package-artifacts@workspace:tools/package-artifacts"],
+ "@open-pencil/navigation-benchmark-tools": ["@open-pencil/navigation-benchmark-tools@workspace:tools/dev/navigation-benchmark"],
- "@open-pencil/package-quality-tools": ["@open-pencil/package-quality-tools@workspace:tools/package-quality"],
+ "@open-pencil/package-artifacts-tools": ["@open-pencil/package-artifacts-tools@workspace:tools/release/package-artifacts"],
+
+ "@open-pencil/package-quality-tools": ["@open-pencil/package-quality-tools@workspace:tools/checks/package-quality"],
"@open-pencil/pen": ["@open-pencil/pen@workspace:packages/pen"],
- "@open-pencil/release-packages": ["@open-pencil/release-packages@workspace:tools/release-packages"],
+ "@open-pencil/pr-review-guidance-tools": ["@open-pencil/pr-review-guidance-tools@workspace:tools/ci/pr-review-guidance"],
+
+ "@open-pencil/release-packages-tools": ["@open-pencil/release-packages-tools@workspace:tools/release/release-packages"],
"@open-pencil/scene-graph": ["@open-pencil/scene-graph@workspace:packages/scene-graph"],
- "@open-pencil/tauri-menu-tools": ["@open-pencil/tauri-menu-tools@workspace:tools/tauri-menu"],
+ "@open-pencil/secret-scan-tools": ["@open-pencil/secret-scan-tools@workspace:tools/checks/secret-scan"],
+
+ "@open-pencil/tauri-menu-tools": ["@open-pencil/tauri-menu-tools@workspace:tools/generate/tauri-menu"],
+
+ "@open-pencil/test-homes-tools": ["@open-pencil/test-homes-tools@workspace:tools/checks/test-homes"],
+
+ "@open-pencil/tools": ["@open-pencil/tools@workspace:tools"],
+
+ "@open-pencil/type-shapes-tools": ["@open-pencil/type-shapes-tools@workspace:tools/checks/type-shapes"],
- "@open-pencil/tool-unit-tests": ["@open-pencil/tool-unit-tests@workspace:tools/unit-tests"],
+ "@open-pencil/unit-tests-tools": ["@open-pencil/unit-tests-tools@workspace:tools/dev/unit-tests"],
- "@open-pencil/visual-oracle-tools": ["@open-pencil/visual-oracle-tools@workspace:tools/visual-oracles"],
+ "@open-pencil/visual-oracles-tools": ["@open-pencil/visual-oracles-tools@workspace:tools/generate/visual-oracles"],
"@open-pencil/vue": ["@open-pencil/vue@workspace:packages/vue"],
diff --git a/commitlint.config.ts b/commitlint.config.ts
index 2b7751b6e..79c931c50 100644
--- a/commitlint.config.ts
+++ b/commitlint.config.ts
@@ -1,7 +1,7 @@
import isIgnored from '@commitlint/is-ignored'
import type { UserConfig } from '@commitlint/types'
-import { hasAICoauthor, noAICoauthors } from './tools/ci/src/commit-attribution'
+import { hasAICoauthor, noAICoauthors } from './tools/ci/policy/src/commit-attribution'
export default {
extends: ['@commitlint/config-conventional'],
diff --git a/lint/plugin.js b/lint/plugin.js
index e993d13f1..daa599d27 100644
--- a/lint/plugin.js
+++ b/lint/plugin.js
@@ -1 +1 @@
-export { default } from '../tools/lint/src/plugin.ts'
+export { default } from '../tools/checks/lint/src/plugin.ts'
diff --git a/oxlint.json b/oxlint.json
index baf74576d..58eda9302 100644
--- a/oxlint.json
+++ b/oxlint.json
@@ -426,15 +426,15 @@
},
"overrides": [
{
- "files": ["tools/lint/src/rules/quality/widen-then-assert.ts"],
+ "files": ["tools/checks/lint/src/rules/quality/widen-then-assert.ts"],
"rules": {
"complexity": "off"
}
},
{
"files": [
- "tools/lint/src/**/*.ts",
- "tools/lint/tests/**/*.ts"
+ "tools/checks/lint/src/**/*.ts",
+ "tools/checks/lint/tests/**/*.ts"
],
"rules": {
"open-pencil/no-generated-test-id-literals": "off",
diff --git a/package.json b/package.json
index 9f849181c..780ea1874 100644
--- a/package.json
+++ b/package.json
@@ -15,16 +15,27 @@
"packages/mcp",
"packages/harness",
"packages/docs",
- "tools/brand",
- "tools/docs",
- "tools/lint",
- "tools/package-artifacts",
- "tools/authoring-reference",
- "tools/package-quality",
- "tools/release-packages",
- "tools/unit-tests",
- "tools/tauri-menu",
- "tools/visual-oracles"
+ "tools",
+ "tools/checks/architecture",
+ "tools/checks/docs",
+ "tools/checks/i18n",
+ "tools/checks/lint",
+ "tools/checks/package-quality",
+ "tools/checks/secret-scan",
+ "tools/checks/test-homes",
+ "tools/checks/type-shapes",
+ "tools/ci/images",
+ "tools/ci/policy",
+ "tools/ci/pr-review-guidance",
+ "tools/dev/dev-server",
+ "tools/dev/navigation-benchmark",
+ "tools/dev/unit-tests",
+ "tools/generate/authoring-reference",
+ "tools/generate/brand",
+ "tools/generate/tauri-menu",
+ "tools/generate/visual-oracles",
+ "tools/release/package-artifacts",
+ "tools/release/release-packages"
],
"type": "module",
"scripts": {
@@ -36,28 +47,27 @@
"build-storybook": "storybook build",
"tauri": "tauri",
"build:native-test": "bun run generate:icons --target desktop && bun run build:packages && bun tauri build --debug --no-bundle --features native-test --config desktop/tauri.native-test.conf.json",
- "benchmark:navigation": "bun tools/navigation-benchmark/src/cli.ts run",
- "benchmark:navigation:test": "bun test tools/navigation-benchmark/tests",
+ "benchmark:navigation": "bun tools/dev/navigation-benchmark/src/cli.ts run",
"test:native": "bun run build:native-test && wdio run wdio.conf.ts",
"lint": "bun run lint:structure && oxlint -c oxlint.json --type-aware --type-check src/ packages/scene-graph/src/ packages/core/src/ packages/vue/src/ packages/cli/src/ packages/mcp/src/ packages/harness/src/ packages/dom-css/src/ packages/pen/src/ packages/kiwi/src/ packages/fig/src/",
"lint:structure": "oxlint -c oxlint.json commitlint.config.ts vite.config.ts vite/ .storybook/ src/ packages/scene-graph/src/ packages/scene-graph/scripts/ packages/core/src/ packages/vue/src/ packages/cli/src/ packages/mcp/src/ packages/harness/src/ packages/harness/tests/ packages/dom-css/src/ packages/dom-css/tests/ packages/dom-css/scripts/ packages/pen/src/ packages/pen/scripts/ packages/kiwi/src/ packages/kiwi/tests/ packages/kiwi/scripts/ packages/fig/src/ packages/fig/tests/ packages/fig/scripts/ tests/ scripts/ tools/",
"format": "oxfmt --write .oxfmtrc.json commitlint.config.ts vite.config.ts vite/ .storybook/ src/ packages/scene-graph/src/ packages/scene-graph/scripts/ packages/core/src/ packages/cli/src/ packages/mcp/src/ packages/harness/src/ packages/harness/tests/ packages/vue/src/ packages/dom-css/src/ packages/dom-css/tests/ packages/dom-css/scripts/ packages/pen/src/ packages/pen/scripts/ packages/kiwi/src/ packages/kiwi/tests/ packages/kiwi/scripts/ packages/fig/src/ packages/fig/tests/ packages/fig/scripts/ tests scripts/ tools/",
"format:check": "bun run format && status=$(git status --porcelain -uall) && test -z \"$status\" || (echo \"$status\" && exit 1)",
- "check": "bun run check:icons && bun run build:packages && bun run lint && tsgo --noEmit && bun run check:vue && bun run check:native-test && bun run check:i18n && bun run check:docs && bun run check:changelog && bun run check:packages && bun run check:deps && bun run check:audit && bun run check:secrets && bun run check:monorepo && bun run check:arch && bun run check:test-homes && bun run test:type-shapes && bun run test:tools && bun run test:dupes",
+ "check": "bun run check:icons && bun run build:packages && bun run lint && tsgo --noEmit && bun run check:vue && bun run check:native-test && bun run check:i18n && bun run check:docs && bun run check:changelog && bun run check:packages && bun run check:deps && bun run check:audit && bun run check:secrets && bun run check:monorepo && bun run check:arch && bun run check:test-homes && bun run test:type-shapes && bun run check:tools && bun run test:tools && bun run test:dupes",
"check:commits": "commitlint",
- "check:changelog": "bun tools/release-packages/src/check-changelog.ts",
+ "check:changelog": "bun tools/release/release-packages/src/check-changelog.ts",
"check:deps": "knip --include unlisted,unresolved,binaries",
"check:docs": "bun --filter @open-pencil/docs check && bun run check:authoring-reference",
- "check:authoring-reference": "bun tools/authoring-reference/src/check.ts",
- "generate:authoring-reference": "bun tools/authoring-reference/src/generate.ts",
+ "check:authoring-reference": "bun tools/generate/authoring-reference/src/check.ts",
+ "generate:authoring-reference": "bun tools/generate/authoring-reference/src/generate.ts",
"check:audit": "bun audit --audit-level=critical",
- "check:secrets": "bun tools/secret-scan/src/index.ts",
+ "check:secrets": "bun tools/checks/secret-scan/src/index.ts",
"check:monorepo": "sherif --ignore-rule root-package-dependencies",
"check:native-test": "tsc --noEmit -p tests/e2e/native/tsconfig.json",
- "check:i18n": "bun tools/i18n/src/check-locales.ts",
- "check:packages": "bun tools/package-quality/src/cli.ts check",
+ "check:i18n": "bun tools/checks/i18n/src/check-locales.ts",
+ "check:packages": "bun tools/checks/package-quality/src/cli.ts check",
"check:arch": "steiger .",
- "check:test-homes": "bun tools/unit-tests/src/check-homes.ts",
+ "check:test-homes": "bun tools/checks/test-homes/src/index.ts",
"check:vue": "vue-tsc --noEmit -p tsconfig.json && vue-tsc --noEmit -p packages/vue/tsconfig.json",
"test": "OPENPENCIL_TEST_SERVER=app playwright test --project=openpencil --grep-invert @real-llm",
"test:storybook": "OPENPENCIL_TEST_SERVER=storybook playwright test --project=storybook-chromium",
@@ -66,24 +76,25 @@
"test:figma": "OPENPENCIL_TEST_SERVER=app playwright test --project=figma",
"figma:debug": "open -a Figma --args --remote-debugging-port=9222",
"typecheck": "tsgo --noEmit && bun run check:vue",
- "test:unit": "bun tools/unit-tests/src/run.ts all --include-heavy",
- "test:unit:quick": "bun tools/unit-tests/src/run.ts all -- --parallel",
- "test:unit:isolated": "bun tools/unit-tests/src/run.ts all -- --isolate",
- "test:unit:heavy": "bun tools/unit-tests/src/run.ts all --heavy-only -- --timeout 180000",
- "test:coverage": "bun tools/unit-tests/src/run.ts all --include-heavy -- --coverage",
- "test:type-shapes": "bun tools/type-shapes/src/index.ts",
- "test:tools": "bun tools/test.ts && bun --filter @open-pencil/harness test",
+ "test:unit": "bun tools/dev/unit-tests/src/run.ts all --include-heavy",
+ "test:unit:quick": "bun tools/dev/unit-tests/src/run.ts all -- --parallel",
+ "test:unit:isolated": "bun tools/dev/unit-tests/src/run.ts all -- --isolate",
+ "test:unit:heavy": "bun tools/dev/unit-tests/src/run.ts all --heavy-only -- --timeout 180000",
+ "test:coverage": "bun tools/dev/unit-tests/src/run.ts all --include-heavy -- --coverage",
+ "test:type-shapes": "bun tools/checks/type-shapes/src/index.ts",
+ "test:tools": "bun --filter '@open-pencil/*-tools' test && bun --filter @open-pencil/harness test",
"test:dupes": "jscpd packages/scene-graph/src packages/pen/src packages/core/src packages/cli/src packages/dom-css/src src --min-lines 5 --min-tokens 50 --format typescript --threshold 0",
- "test:packages": "bun tools/package-quality/src/cli.ts verify",
- "build:packages": "bun tools/package-artifacts/src/build.ts",
+ "test:packages": "bun tools/checks/package-quality/src/cli.ts verify",
+ "build:packages": "bun tools/release/package-artifacts/src/build.ts",
"open-pencil": "bun packages/cli/src/index.ts",
"docs:dev": "bun --filter @open-pencil/docs dev",
"docs:build": "bun --filter @open-pencil/docs build",
"docs:build:production": "bun --filter @open-pencil/docs build:production",
"docs:preview": "bun --filter @open-pencil/docs preview",
- "generate:icons": "bun tools/brand/src/cli.ts generate",
- "check:icons": "bun tools/brand/src/cli.ts check && bun --filter @open-pencil/brand-tools check",
- "generate:tauri-menu": "bun tools/tauri-menu/src/generate.ts"
+ "generate:icons": "bun tools/generate/brand/src/cli.ts generate",
+ "check:icons": "bun tools/generate/brand/src/cli.ts check",
+ "generate:tauri-menu": "bun tools/generate/tauri-menu/src/generate.ts",
+ "check:tools": "tsgo --noEmit -p tools/tsconfig.json"
},
"dependencies": {
"@ai-sdk/anthropic": "^4.0.39",
diff --git a/packages/docs/AGENTS.md b/packages/docs/AGENTS.md
index 83791d96c..fe7331eeb 100644
--- a/packages/docs/AGENTS.md
+++ b/packages/docs/AGENTS.md
@@ -1,6 +1,6 @@
# Docs site
-Published VitePress site. `bun run docs:dev`, `bun run docs:build` for fast checks, and `bun run docs:build:production` for deployment output. `bun run check:docs` runs the integrity checks in `tools/docs/` plus `check:authoring-reference`.
+Published VitePress site. `bun run docs:dev`, `bun run docs:build` for fast checks, and `bun run docs:build:production` for deployment output. `bun run check:docs` runs the integrity checks in `tools/checks/docs/` plus `check:authoring-reference`.
- Keep routes under `/getting-started`, `/overview/**`, `/user-guide/**`, `/programmable/**`, `/reference/**`, and `/development/**`; do not recreate `/guide/**`. Preserve moves in `packages/docs/public/_redirects`.
- Link untranslated locale navigation to canonical English pages rather than adding placeholders.
diff --git a/packages/docs/development/navigation-performance.md b/packages/docs/development/navigation-performance.md
index 0530d1270..9e270a495 100644
--- a/packages/docs/development/navigation-performance.md
+++ b/packages/docs/development/navigation-performance.md
@@ -99,7 +99,7 @@ Do not gate shared CI on absolute timing. Dedicated benchmark hardware may gate
Compare two completed runs:
```sh
-bun tools/navigation-benchmark/src/cli.ts compare \
+bun tools/dev/navigation-benchmark/src/cli.ts compare \
--baseline artifacts/navigation-benchmark/v0.14.0/metrics.json \
--candidate artifacts/navigation-benchmark/current/metrics.json \
--output artifacts/navigation-benchmark/comparison.json
diff --git a/packages/docs/development/roadmap.md b/packages/docs/development/roadmap.md
index e60955906..a33aa6a0e 100644
--- a/packages/docs/development/roadmap.md
+++ b/packages/docs/development/roadmap.md
@@ -37,7 +37,7 @@ See [canvas navigation](../user-guide/canvas-navigation), [components and librar
### Figma fidelity
- Preserve and round-trip more Figma metadata safely.
-- Add visual regression coverage for full multi-page `.fig` documents. `bun tools/visual-oracles/src/cli.ts export-fixtures` exports current smoke fixture pages to `/tmp` for manual comparison without committing large images; `tests/fixtures/figma-oracles/visual-comparison-report.json` records the current Figma-vs-OpenPencil oracle diff findings.
+- Add visual regression coverage for full multi-page `.fig` documents. `bun tools/generate/visual-oracles/src/cli.ts export-fixtures` exports current smoke fixture pages to `/tmp` for manual comparison without committing large images; `tests/fixtures/figma-oracles/visual-comparison-report.json` records the current Figma-vs-OpenPencil oracle diff findings.
- Close high-impact renderer gaps: remaining mask edge cases, blend isolation, pattern fills, and broader variable-font fixtures.
- Improve boolean operation editing/export now that imported Figma `BOOLEAN_OPERATION` nodes remain boolean operations.
diff --git a/packages/docs/development/testing.md b/packages/docs/development/testing.md
index 04bbb9279..20d0f1e66 100644
--- a/packages/docs/development/testing.md
+++ b/packages/docs/development/testing.md
@@ -20,9 +20,9 @@ Core tests using SceneGraph still belong to Core. Central integration is for con
**Migration status:** much existing coverage remains under `tests/engine/**`, alongside package-local suites. The table is the agreed destination, not a claim that migration is complete. Until a domain migrates, extend its existing suite rather than create a second home. The repository-wide migration is separate from feature work.
-`bun run check:test-homes` keeps the debt shrinking: every test under `tests/engine` must be listed in `tools/unit-tests/engine-baseline.txt`, so a new test fails the check until it lives in its owner's canonical home, and a moved file must be removed from the baseline. Scene Graph tests have migrated to `packages/scene-graph/tests`.
+`bun run check:test-homes` keeps the debt shrinking: every test under `tests/engine` must be listed in `tools/dev/unit-tests/engine-baseline.txt`, so a new test fails the check until it lives in its owner's canonical home, and a moved file must be removed from the baseline. Scene Graph tests have migrated to `packages/scene-graph/tests`.
-Discovery already covers the destinations: `tools/unit-tests/src/shards.ts` groups tests by owner and lists each owner's canonical home (`packages/<owner>/tests`, `tests/app`, `tests/integration`) together with the `tests/engine` directories it still owns, so `bun run test:unit` and the CI shards run a file from either place. Moving a domain is therefore a `git mv` plus import fixes; only a new owner or a new top-level home needs a shard entry. Do not move files into a directory the shard map does not list.
+Discovery already covers the destinations: `tools/dev/unit-tests/src/shards.ts` groups tests by owner and lists each owner's canonical home (`packages/<owner>/tests`, `tests/app`, `tests/integration`) together with the `tests/engine` directories it still owns, so `bun run test:unit` and the CI shards run a file from either place. Moving a domain is therefore a `git mv` plus import fixes; only a new owner or a new top-level home needs a shard entry. Do not move files into a directory the shard map does not list.
`test:unit:quick` runs files in Bun worker processes (`--parallel`), which is the fastest local loop. CI shards still run each group in one process; `test:unit:isolated` (`--isolate`, also run nightly) gives every file a fresh global object and is the check to run when a suite passes alone but fails in a shard. Shards share one Bun process, so module-level state (a `fake-indexeddb/auto` import, an IndexedDB connection left open by `createEditorStore()`, a patched global) leaks into later files in the same shard. A package-local run (`bun test tests` inside the package) is a fresh process and will not reproduce that leak. Close what a test opens and restore what it patches.
diff --git a/packages/docs/package.json b/packages/docs/package.json
index 2b53d3e6d..58dea31f9 100644
--- a/packages/docs/package.json
+++ b/packages/docs/package.json
@@ -11,7 +11,7 @@
"dev": "vitepress dev",
"build": "OPENPENCIL_DOCS_FAST_BUILD=1 NODE_OPTIONS=--max-old-space-size=8192 vitepress build --minify=false --buildConcurrency=8",
"build:production": "NODE_OPTIONS=--max-old-space-size=8192 vitepress build --minify=esbuild --buildConcurrency=8",
- "check": "bun ../../tools/docs/src/check.ts",
+ "check": "bun ../../tools/checks/docs/src/check.ts",
"preview": "vitepress preview"
},
"devDependencies": {
diff --git a/scripts/generate-tauri-menu.ts b/scripts/generate-tauri-menu.ts
deleted file mode 100644
index 1407f4c72..000000000
--- a/scripts/generate-tauri-menu.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/env bun
-import '../tools/tauri-menu/src/generate'
diff --git a/steiger.config.ts b/steiger.config.ts
index d278fa632..9266dc1bd 100644
--- a/steiger.config.ts
+++ b/steiger.config.ts
@@ -1,7 +1,7 @@
import fsd from '@feature-sliced/steiger-plugin'
import { defineConfig } from 'steiger'
-import { openPencilArchitecturePlugin } from './tools/architecture/src/steiger-rules/index.ts'
+import { openPencilArchitecturePlugin } from './tools/checks/architecture/src/steiger-rules/index.ts'
// OpenPencil is not laid out as canonical Feature-Sliced Design layers.
// Keep Steiger focused on project-specific architecture boundaries instead of
diff --git a/tests/AGENTS.md b/tests/AGENTS.md
index e20790629..18afd3e12 100644
--- a/tests/AGENTS.md
+++ b/tests/AGENTS.md
@@ -5,7 +5,7 @@
## Placement
- Package-local tests mirror source domains under `packages/<owner>/tests/`; central app tests mirror `src/app/**` under `tests/app/`; `tests/integration/` requires a genuinely cross-owner contract; E2E under `tests/e2e/` follows user workflows; native and Figma acceptance are explicit exceptions.
-- Existing `tests/engine/**` domains migrate together with runner discovery: `tools/unit-tests/src/shards.ts` lists each owner's canonical home and its current `tests/engine` directories, so a move is a `git mv` plus imports. `bun run check:test-homes` rejects any test added under `tests/engine` and any stale entry in `tools/unit-tests/engine-baseline.txt`; new tests go to the canonical home, and a moved file is removed from the baseline (`--write` regenerates it). Scene Graph has migrated to `packages/scene-graph/tests`.
+- Existing `tests/engine/**` domains migrate together with runner discovery: `tools/dev/unit-tests/src/shards.ts` lists each owner's canonical home and its current `tests/engine` directories, so a move is a `git mv` plus imports. `bun run check:test-homes` rejects any test added under `tests/engine` and any stale entry in `tools/dev/unit-tests/engine-baseline.txt`; new tests go to the canonical home, and a moved file is removed from the baseline (`--write` regenerates it). Scene Graph has migrated to `packages/scene-graph/tests`.
- Owner-local helpers and fixtures stay local; only genuinely shared support goes under central `tests/helpers/<domain>/` and `tests/fixtures/`. MCP transport tests: `tests/engine/mcp/{server,stdio,transport}` with `tests/helpers/mcp`.
- Never commit temporary, diagnostic, or profile specs; keep them in ignored `scratch/`.
diff --git a/tests/fixtures/figma-oracles/visual-comparison-report.json b/tests/fixtures/figma-oracles/visual-comparison-report.json
index 098f1eb62..3f38c3056 100644
--- a/tests/fixtures/figma-oracles/visual-comparison-report.json
+++ b/tests/fixtures/figma-oracles/visual-comparison-report.json
@@ -1,6 +1,6 @@
{
"source": {
- "tool": "tools/visual-oracles/src/cli.ts compare node",
+ "tool": "tools/generate/visual-oracles/src/cli.ts compare node",
"captured": "2026-05-22",
"outputRoot": "/tmp/open-pencil-oracles"
},
diff --git a/tools/AGENTS.md b/tools/AGENTS.md
index 33e5eba22..03451932d 100644
--- a/tools/AGENTS.md
+++ b/tools/AGENTS.md
@@ -1,25 +1,35 @@
# Repo tooling, CI, and releases
-Private tooling lives under `tools/<domain>/{src,tests}` with kebab-case domains and focused tests; `bun run test:tools` runs every tool package with a `test` script. `scripts/` may contain only tiny compatibility entrypoints.
+Private tooling lives under `tools/<role>/<domain>/{src,tests}`; Steiger enforces the layout and kebab-case domain names. Every tool is a workspace named `@open-pencil/<domain>-tools`, listed literally in the root `workspaces` (the manifest schema rejects globs on purpose), so it can declare dependencies and run through `bun --filter`. `bun run check:tools` type-checks every tool through `tools/tsconfig.json`; `bun run test:tools` runs every tool with a `test` script. A tool imports its own files through its package.json `imports` alias (`#ci/*`, `#release/*`), other tools through their package name, and the docs site config through the shared `#docs-config/*` path.
-- Resolve the workspace with `resolveWorkspaceRoot` from `@open-pencil/package-artifacts`, not parent-directory traversal. Use domain aliases for cross-directory tooling imports, including tests; keep sibling imports relative.
-- `tools/architecture` (Steiger rules) backs `check:arch`; `tools/docs` backs `check:docs`, including the guide-map check; `tools/unit-tests` backs the unit shards and `check:test-homes` with its `engine-baseline.txt`; `tools/i18n`, `tools/release-packages`, `tools/ci`, and `tools/brand` own their namesake commands.
+| Role | Contract | Domains |
+| ----------- | ---------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
+| `checks/` | Read the tree and exit non-zero; never write inside the repository except an own baseline behind an explicit `--write` | `architecture`, `lint`, `i18n`, `secret-scan`, `type-shapes`, `docs`, `test-homes`, `package-quality` |
+| `generate/` | Write generated files or artifacts, idempotently | `brand`, `tauri-menu`, `authoring-reference`, `visual-oracles` |
+| `release/` | Build, verify, and publish packages and native artifacts | `package-artifacts`, `release-packages` |
+| `ci/` | Consumed by workflows: path classification and gate policy, container images, the review-guidance bot | `policy`, `images`, `pr-review-guidance` |
+| `dev/` | Test running and benchmarks for humans | `unit-tests`, `navigation-benchmark`, `dev-server` |
+
+- Nothing under `generate/` or `release/` runs from `bun run check` except through a check entrypoint; `generate/authoring-reference` keeps its `check.ts` beside `generate.ts` until it splits.
+- Resolve the workspace with `resolveWorkspaceRoot` from `@open-pencil/package-artifacts-tools`, not parent-directory traversal. Keep sibling imports relative.
+- `checks/test-homes` owns `engine-baseline.txt` and `check:test-homes`; `dev/unit-tests` owns the shard map and runner (`tests/AGENTS.md`).
+- No `scripts/` entrypoints: root `package.json` scripts call tool files directly.
## CI
-- `.github/workflows/ci.yml` and `heavy-tests.yml` define validation gates. PR CI always classifies changed paths through `tools/ci/src/policy.ts`: root docs, package READMEs, every `AGENTS.md`, `packages/docs` Markdown and assets, and skill Markdown are docs-only; runtime prompt Markdown, executable examples, configuration, and unknown paths require code validation.
+- `.github/workflows/ci.yml` and `heavy-tests.yml` define validation gates. PR CI always classifies changed paths through `tools/ci/policy/src/policy.ts`: root docs, package READMEs, every `AGENTS.md`, `packages/docs` Markdown and assets, and skill Markdown are docs-only; runtime prompt Markdown, executable examples, configuration, and unknown paths require code validation.
- Docs-only changes run documentation integrity and the docs build; everything else runs the full suites. The aggregate `CI result` gate requires successful classification and every applicable job; failures, cancellations, and unexpected skips cannot pass. Do not restore workflow-level path filtering on required CI.
-- `commitlint.config.ts` enforces commit structure in the **Commit messages** job; the separate **PR title** workflow validates titles. Preserve the `Release vX.Y.Z` exception and product casing when changing rules; the known AI co-author check does not rewrite base history. Gate policy lives in `tools/ci/src/policy.ts`.
-- App and docs production workflows run on `v*` tags or `workflow_dispatch`, not ordinary `master` pushes.
+- `commitlint.config.ts` enforces commit structure in the **Commit messages** job; the separate **PR title** workflow validates titles. Preserve the `Release vX.Y.Z` exception and product casing when changing rules; the known AI co-author check does not rewrite base history. Gate policy lives in `tools/ci/policy/src/policy.ts`.
+- App and docs production workflows run on `v*` tags or `workflow_dispatch`, not ordinary `master` pushes. `build.yml` checks the tooling out under `.pipeline/` and runs `tools/release/release-packages` from there.
## Releases
- Update versions in the root and publishable package manifests plus `desktop/tauri.conf.json` and `desktop/Cargo.toml`; move `Unreleased` into `## x.y.z — YYYY-MM-DD`; commit `Release vX.Y.Z`; tag and push `vX.Y.Z`.
-- `.github/workflows/build.yml` is the source of truth: `v*` tags (or dispatches for an immutable stable tag) build shared frontend/package outputs once, build signed desktop artifacts in parallel, verify and attest one complete same-run artifact set, publish npm packages, and replace the draft release assets using the exact changelog section. Policy, provenance, and recovery: `tools/release-packages/README.md`.
-- Public workspace packages are discovered by the package-artifacts catalog. Bun source exports require the complete `src` directory in package contents; Node exports use `dist`. Release preparation must preserve resolution maps. Prepared publish directories receive the root `LICENSE` when a package has none of its own, and every package needs a `README.md` because npm renders it. Publishing uses prepared npm tarballs verified through the shared Node/Bun consumer checks; never publish package directories manually. `test:packages` first runs the packaging guards in `tools/package-quality/src/smoke/guards.ts`: fixture manifests packed with the real `npm pack` that must trip the tarball inspector and the Node/Bun consumer checks before those checks vouch for real packages.
+- `.github/workflows/build.yml` is the source of truth: `v*` tags (or dispatches for an immutable stable tag) build shared frontend/package outputs once, build signed desktop artifacts in parallel, verify and attest one complete same-run artifact set, publish npm packages, and replace the draft release assets using the exact changelog section. Policy, provenance, and recovery: `tools/release/release-packages/README.md`.
+- Public workspace packages are discovered by the package-artifacts catalog. Bun source exports require the complete `src` directory in package contents; Node exports use `dist`. Release preparation must preserve resolution maps. Prepared publish directories receive the root `LICENSE` when a package has none of its own, and every package needs a `README.md` because npm renders it. Publishing uses prepared npm tarballs verified through the shared Node/Bun consumer checks; never publish package directories manually. `test:packages` first runs the packaging guards in `tools/checks/package-quality/src/smoke/guards.ts`: fixture manifests packed with the real `npm pack` that must trip the tarball inspector and the Node/Bun consumer checks before those checks vouch for real packages.
- Ensure Tauri and Apple signing/notarization secrets are configured. Verify the draft title, body, and artifacts, then publish. Release titles are exactly the tag (`vX.Y.Z`) without a product-name prefix.
- Homebrew's `openpencil` cask is managed upstream: BrewTestBot proposes bumps and Homebrew merges them. Check the upstream cask PR after publication; do not push to the archived custom tap or add bump automation. Users install the app with `brew install --cask openpencil` and the CLI through npm or Bun.
## Brand assets
-Canonical artwork lives in `assets/brand/` (main mark and optical micro master; see its README). `tools/brand/` derives web, docs, and native icons with RealFaviconGenerator and Tauri; generated assets are ignored, not committed. Vite and VitePress configs prepare their own targets, and Tauri dev/build hooks prepare native icons.
+Canonical artwork lives in `assets/brand/` (main mark and optical micro master; see its README). `tools/generate/brand/` derives web, docs, and native icons with RealFaviconGenerator and Tauri; generated assets are ignored, not committed. Vite and VitePress configs prepare their own targets, and Tauri dev/build hooks prepare native icons.
diff --git a/tools/architecture/package.json b/tools/architecture/package.json
deleted file mode 100644
index fd097e58f..000000000
--- a/tools/architecture/package.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "name": "@open-pencil/architecture-tools",
- "private": true,
- "type": "module",
- "scripts": {
- "test": "bun test"
- }
-}
diff --git a/tools/brand/tsconfig.json b/tools/brand/tsconfig.json
deleted file mode 100644
index ab0ea6360..000000000
--- a/tools/brand/tsconfig.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "compilerOptions": {
- "target": "ES2022",
- "module": "ESNext",
- "moduleResolution": "bundler",
- "strict": true,
- "noUnusedLocals": true,
- "noUnusedParameters": true,
- "skipLibCheck": true,
- "noEmit": true,
- "allowImportingTsExtensions": true,
- "types": ["node", "bun"]
- },
- "include": ["src/**/*.ts", "tests/**/*.ts"]
-}
diff --git a/tools/checks/architecture/package.json b/tools/checks/architecture/package.json
new file mode 100644
index 000000000..fee2e6847
--- /dev/null
+++ b/tools/checks/architecture/package.json
@@ -0,0 +1,11 @@
+{
+ "name": "@open-pencil/architecture-tools",
+ "private": true,
+ "type": "module",
+ "scripts": {
+ "test": "bun test tests"
+ },
+ "dependencies": {
+ "@open-pencil/package-artifacts-tools": "workspace:*"
+ }
+}
diff --git a/tools/architecture/src/steiger-rules/cross-package-reexport-shims.ts b/tools/checks/architecture/src/steiger-rules/cross-package-reexport-shims.ts
similarity index 95%
rename from tools/architecture/src/steiger-rules/cross-package-reexport-shims.ts
rename to tools/checks/architecture/src/steiger-rules/cross-package-reexport-shims.ts
index 3adc88887..3acff8f64 100644
--- a/tools/architecture/src/steiger-rules/cross-package-reexport-shims.ts
+++ b/tools/checks/architecture/src/steiger-rules/cross-package-reexport-shims.ts
@@ -9,6 +9,7 @@ export function isCrossPackageReexportShim(sourceRel: string, content: string):
return source.statements.every(
(statement) =>
ts.isExportDeclaration(statement) &&
+ statement.moduleSpecifier !== undefined &&
ts.isStringLiteral(statement.moduleSpecifier) &&
statement.moduleSpecifier.text.startsWith('@open-pencil/')
)
diff --git a/tools/architecture/src/steiger-rules/dynamic-tailwind-classes.ts b/tools/checks/architecture/src/steiger-rules/dynamic-tailwind-classes.ts
similarity index 100%
rename from tools/architecture/src/steiger-rules/dynamic-tailwind-classes.ts
rename to tools/checks/architecture/src/steiger-rules/dynamic-tailwind-classes.ts
diff --git a/tools/architecture/src/steiger-rules/index.ts b/tools/checks/architecture/src/steiger-rules/index.ts
similarity index 97%
rename from tools/architecture/src/steiger-rules/index.ts
rename to tools/checks/architecture/src/steiger-rules/index.ts
index 3da01cb3a..a99e370bc 100644
--- a/tools/architecture/src/steiger-rules/index.ts
+++ b/tools/checks/architecture/src/steiger-rules/index.ts
@@ -1,3 +1,4 @@
+import { readFileSync } from 'node:fs'
import path from 'node:path'
import { parse as parseVueSfc } from 'vue/compiler-sfc'
@@ -8,6 +9,7 @@ import {
noVueTemplateUIHooksOrSVG
} from './dynamic-tailwind-classes.ts'
import {
+ collectFiles,
collectFolders,
createFileRule,
createImportRule,
@@ -18,6 +20,7 @@ import {
PACKAGE_ALIAS_OWNERS,
relativePath,
ROOT_MARKDOWN_ALLOWLIST,
+ type Diagnostic,
TEXT_EXTENSIONS,
type Rule
} from './support.ts'
@@ -64,19 +67,22 @@ const scriptsAreEntrypointShims = createTextRule(
}
)
+const TOOL_ROLES = new Set(['checks', 'generate', 'release', 'ci', 'dev'])
const TOOL_LAYOUT_MESSAGE =
- 'Tool files must live under tools/<domain>/src/**, tests/**/*.test.ts, or tests/helpers/**.'
+ 'Tool files must live under tools/<role>/<domain>/src/**, tests/**/*.test.ts, or tests/helpers/**.'
const strictToolsLayout = createFileRule('open-pencil/strict-tools-layout', (sourceRel) => {
if (!sourceRel.startsWith('tools/') || !TEXT_EXTENSIONS.has(path.extname(sourceRel))) return null
- if (sourceRel === 'tools/test.ts') return null
- const [, domain, segment] = sourceRel.split('/')
- if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(domain))
+ const [, role, domain, segment] = sourceRel.split('/')
+ if (!TOOL_ROLES.has(role))
+ return `Tool packages live under a role folder: ${[...TOOL_ROLES].join(', ')}.`
+ if (!domain || !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(domain))
return 'Tool package folders must use kebab-case domain names.'
if (segment === 'src') return null
if (
segment === 'tests' &&
- (sourceRel.endsWith('.test.ts') || sourceRel.startsWith(`tools/${domain}/tests/helpers/`))
+ (sourceRel.endsWith('.test.ts') ||
+ sourceRel.startsWith(`tools/${role}/${domain}/tests/helpers/`))
)
return null
return TOOL_LAYOUT_MESSAGE
diff --git a/tools/architecture/src/steiger-rules/support.ts b/tools/checks/architecture/src/steiger-rules/support.ts
similarity index 100%
rename from tools/architecture/src/steiger-rules/support.ts
rename to tools/checks/architecture/src/steiger-rules/support.ts
diff --git a/tools/architecture/tests/acronym-casing.test.ts b/tools/checks/architecture/tests/acronym-casing.test.ts
similarity index 83%
rename from tools/architecture/tests/acronym-casing.test.ts
rename to tools/checks/architecture/tests/acronym-casing.test.ts
index 07fdac5c9..881f53d0f 100644
--- a/tools/architecture/tests/acronym-casing.test.ts
+++ b/tools/checks/architecture/tests/acronym-casing.test.ts
@@ -1,10 +1,12 @@
import { afterEach, describe, expect, test } from 'bun:test'
import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
-import { join, resolve } from 'node:path'
+import { join } from 'node:path'
+
+import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts-tools'
const temporaryDirectories: string[] = []
-const repositoryRoot = resolve(import.meta.dir, '../../..')
+const repositoryRoot = await resolveWorkspaceRoot(import.meta.dir)
const oxlint = join(repositoryRoot, 'node_modules/.bin/oxlint')
const plugin = join(repositoryRoot, 'lint/plugin.js')
@@ -39,9 +41,9 @@ describe('acronym identifier casing', () => {
'export class CloudCorsError {}\nexport function sendRpc() {}\nexport type FontPickerUi = {}'
)
expect(result.exitCode).toBe(1)
- expect(result.stdout.toString()).toContain('CloudCorsError')
- expect(result.stdout.toString()).toContain('sendRpc')
- expect(result.stdout.toString()).toContain('FontPickerUi')
+ expect(String(result.stdout)).toContain('CloudCorsError')
+ expect(String(result.stdout)).toContain('sendRpc')
+ expect(String(result.stdout)).toContain('FontPickerUi')
})
test('accepts canonical first-party acronym identifiers', () => {
diff --git a/tools/architecture/tests/cross-package-reexports.test.ts b/tools/checks/architecture/tests/cross-package-reexports.test.ts
similarity index 100%
rename from tools/architecture/tests/cross-package-reexports.test.ts
rename to tools/checks/architecture/tests/cross-package-reexports.test.ts
diff --git a/tools/architecture/tests/dynamic-classes.test.ts b/tools/checks/architecture/tests/dynamic-classes.test.ts
similarity index 100%
rename from tools/architecture/tests/dynamic-classes.test.ts
rename to tools/checks/architecture/tests/dynamic-classes.test.ts
diff --git a/tools/architecture/tests/tool-layout.test.ts b/tools/checks/architecture/tests/tool-layout.test.ts
similarity index 62%
rename from tools/architecture/tests/tool-layout.test.ts
rename to tools/checks/architecture/tests/tool-layout.test.ts
index 210bc0379..f60f4c7e5 100644
--- a/tools/architecture/tests/tool-layout.test.ts
+++ b/tools/checks/architecture/tests/tool-layout.test.ts
@@ -9,12 +9,15 @@ test('keeps tool test helpers beside tests without allowing arbitrary tool locat
)
if (!rule) throw new Error('Missing tool layout rule')
for (const [file, valid] of [
- ['tools/lint/src/plugin.ts', true],
- ['tools/lint/tests/example.test.ts', true],
- ['tools/lint/tests/helpers/lint.ts', true],
- ['tools/lint/tests/lint.ts', false],
- ['tools/lint/helpers/lint.ts', false],
- ['tools/lint/plugin.ts', false]
+ ['tools/checks/lint/src/plugin.ts', true],
+ ['tools/checks/lint/tests/example.test.ts', true],
+ ['tools/checks/lint/tests/helpers/lint.ts', true],
+ ['tools/checks/lint/tests/lint.ts', false],
+ ['tools/checks/lint/helpers/lint.ts', false],
+ ['tools/checks/lint/plugin.ts', false],
+ ['tools/lint/src/plugin.ts', false],
+ ['tools/test.ts', false],
+ ['tools/tooling/lint/src/plugin.ts', false]
] as const) {
const root = process.cwd()
expect(
diff --git a/tools/unit-tests/package.json b/tools/checks/docs/package.json
similarity index 54%
rename from tools/unit-tests/package.json
rename to tools/checks/docs/package.json
index c2091939b..658055fec 100644
--- a/tools/unit-tests/package.json
+++ b/tools/checks/docs/package.json
@@ -1,11 +1,11 @@
{
- "name": "@open-pencil/tool-unit-tests",
+ "name": "@open-pencil/docs-tools",
"private": true,
"type": "module",
"scripts": {
"test": "bun test tests"
},
"dependencies": {
- "@open-pencil/package-artifacts": "workspace:*"
+ "@open-pencil/package-artifacts-tools": "workspace:*"
}
}
diff --git a/tools/docs/src/check.ts b/tools/checks/docs/src/check.ts
similarity index 95%
rename from tools/docs/src/check.ts
rename to tools/checks/docs/src/check.ts
index 1ea606c82..bfe60db0a 100644
--- a/tools/docs/src/check.ts
+++ b/tools/checks/docs/src/check.ts
@@ -1,6 +1,5 @@
#!/usr/bin/env bun
import { resolve } from 'node:path'
-import { fileURLToPath } from 'node:url'
import {
DE,
@@ -28,6 +27,8 @@ import {
userGuideSidebar
} from '#docs-config/sidebars'
+import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts-tools'
+
import { checkGuideMap } from './guides'
import { checkDocsIntegrity } from './integrity'
@@ -71,7 +72,7 @@ function localeSidebarLinks({ labels, prefix, programmable }: LocaleConfig): str
])
}
-const repoRoot = fileURLToPath(new URL('../../..', import.meta.url))
+const repoRoot = await resolveWorkspaceRoot(import.meta.dir)
const docsRoot = resolve(repoRoot, 'packages/docs')
const result = checkDocsIntegrity({
docsRoot,
diff --git a/tools/docs/src/guides.ts b/tools/checks/docs/src/guides.ts
similarity index 100%
rename from tools/docs/src/guides.ts
rename to tools/checks/docs/src/guides.ts
diff --git a/tools/docs/src/integrity.ts b/tools/checks/docs/src/integrity.ts
similarity index 100%
rename from tools/docs/src/integrity.ts
rename to tools/checks/docs/src/integrity.ts
diff --git a/tools/docs/tests/guides.test.ts b/tools/checks/docs/tests/guides.test.ts
similarity index 100%
rename from tools/docs/tests/guides.test.ts
rename to tools/checks/docs/tests/guides.test.ts
diff --git a/tools/docs/tests/integrity.test.ts b/tools/checks/docs/tests/integrity.test.ts
similarity index 100%
rename from tools/docs/tests/integrity.test.ts
rename to tools/checks/docs/tests/integrity.test.ts
diff --git a/tools/i18n/mixed-script-baseline.txt b/tools/checks/i18n/mixed-script-baseline.txt
similarity index 100%
rename from tools/i18n/mixed-script-baseline.txt
rename to tools/checks/i18n/mixed-script-baseline.txt
diff --git a/tools/i18n/package.json b/tools/checks/i18n/package.json
similarity index 77%
rename from tools/i18n/package.json
rename to tools/checks/i18n/package.json
index 1811c77ad..9185588f3 100644
--- a/tools/i18n/package.json
+++ b/tools/checks/i18n/package.json
@@ -3,6 +3,6 @@
"private": true,
"type": "module",
"scripts": {
- "test": "bun test"
+ "test": "bun test tests"
}
}
diff --git a/tools/i18n/src/check-locales.ts b/tools/checks/i18n/src/check-locales.ts
similarity index 97%
rename from tools/i18n/src/check-locales.ts
rename to tools/checks/i18n/src/check-locales.ts
index ee3995a6f..a27498668 100644
--- a/tools/i18n/src/check-locales.ts
+++ b/tools/checks/i18n/src/check-locales.ts
@@ -17,8 +17,8 @@ const LOCALE_FILE_NAMES: Record<string, string> = {
variableTypes: 'variable-types'
}
const REQUIRED_INDEX_FILE = 'index.ts'
-const TRANSLATION_BASELINE_PATH = 'tools/i18n/translation-baseline.txt'
-const MIXED_SCRIPT_BASELINE_PATH = 'tools/i18n/mixed-script-baseline.txt'
+const TRANSLATION_BASELINE_PATH = 'tools/checks/i18n/translation-baseline.txt'
+const MIXED_SCRIPT_BASELINE_PATH = 'tools/checks/i18n/mixed-script-baseline.txt'
function sourceMessage(value: unknown): string | null {
if (typeof value === 'string') return value
diff --git a/tools/i18n/src/quality.ts b/tools/checks/i18n/src/quality.ts
similarity index 100%
rename from tools/i18n/src/quality.ts
rename to tools/checks/i18n/src/quality.ts
diff --git a/tools/i18n/tests/quality.test.ts b/tools/checks/i18n/tests/quality.test.ts
similarity index 100%
rename from tools/i18n/tests/quality.test.ts
rename to tools/checks/i18n/tests/quality.test.ts
diff --git a/tools/i18n/translation-baseline.txt b/tools/checks/i18n/translation-baseline.txt
similarity index 100%
rename from tools/i18n/translation-baseline.txt
rename to tools/checks/i18n/translation-baseline.txt
diff --git a/tools/lint/NOTICE b/tools/checks/lint/NOTICE
similarity index 100%
rename from tools/lint/NOTICE
rename to tools/checks/lint/NOTICE
diff --git a/tools/lint/README.md b/tools/checks/lint/README.md
similarity index 93%
rename from tools/lint/README.md
rename to tools/checks/lint/README.md
index 27394b2e0..7b38ceedd 100644
--- a/tools/lint/README.md
+++ b/tools/checks/lint/README.md
@@ -1,6 +1,6 @@
# OpenPencil lint rules
-`src/plugin.ts` registers locally owned rules; the workspace `oxlint.json` selects policy. Run `bun run --cwd tools/lint test` for rule tests and `bun run lint` for repository enforcement.
+`src/plugin.ts` registers locally owned rules; the workspace `oxlint.json` selects policy. Run `bun run --cwd tools/checks/lint test` for rule tests and `bun run lint` for repository enforcement.
## Test and type policies
diff --git a/tools/lint/package.json b/tools/checks/lint/package.json
similarity index 60%
rename from tools/lint/package.json
rename to tools/checks/lint/package.json
index cd766e725..c40197970 100644
--- a/tools/lint/package.json
+++ b/tools/checks/lint/package.json
@@ -6,9 +6,9 @@
"#lint/*": "./src/*"
},
"scripts": {
- "test": "tsc --noEmit -p tsconfig.json && bun test tests"
+ "test": "bun test tests"
},
"devDependencies": {
- "@open-pencil/package-artifacts": "workspace:*"
+ "@open-pencil/package-artifacts-tools": "workspace:*"
}
}
diff --git a/tools/lint/src/plugin.ts b/tools/checks/lint/src/plugin.ts
similarity index 99%
rename from tools/lint/src/plugin.ts
rename to tools/checks/lint/src/plugin.ts
index 007f7fa26..f581c3626 100644
--- a/tools/lint/src/plugin.ts
+++ b/tools/checks/lint/src/plugin.ts
@@ -8,7 +8,7 @@ import { noModuleMockingRule } from '#lint/rules/quality/module-mocking.ts'
import { noReduceAccumulatorCopyRule } from '#lint/rules/quality/reduce-accumulator-copy.ts'
import { noWidenThenAssertRule } from '#lint/rules/quality/widen-then-assert.ts'
import { normalizedFilename } from '#lint/support/context.ts'
-import type { RuleDefinition } from '#lint/support/types.ts'
+import type { PluginRule, RuleDefinition } from '#lint/support/types.ts'
import type { TSESTree } from '@typescript-eslint/utils'
import type { Color } from '@open-pencil/scene-graph'
@@ -496,7 +496,7 @@ const plugin = {
'no-reduce-accumulator-copy': noReduceAccumulatorCopyRule,
'no-widen-then-assert': noWidenThenAssertRule,
'no-sibling-domain-prefixed-files': noSiblingDomainPrefixedFiles
- }
+ } satisfies Record<string, PluginRule>
}
export default plugin
diff --git a/tools/lint/src/rules/imports.ts b/tools/checks/lint/src/rules/imports.ts
similarity index 100%
rename from tools/lint/src/rules/imports.ts
rename to tools/checks/lint/src/rules/imports.ts
diff --git a/tools/lint/src/rules/policy.ts b/tools/checks/lint/src/rules/policy.ts
similarity index 98%
rename from tools/lint/src/rules/policy.ts
rename to tools/checks/lint/src/rules/policy.ts
index 1a3facb55..e62b876a3 100644
--- a/tools/lint/src/rules/policy.ts
+++ b/tools/checks/lint/src/rules/policy.ts
@@ -45,7 +45,7 @@ const noMixedCaseAcronymIdentifiers = {
},
create(context) {
const file = normalizedFilename(context)
- if (file.includes('/tools/lint/')) return {}
+ if (file.includes('/tools/checks/lint/')) return {}
const canonicalAcronym =
/(?:Acp|Ai|Api|Cli|Cors|Css|Html|Ime|Json|Jsx|Mcp|Pdf|Png|Rgb|Rpc|Rtl|Svg|Ui|Url|Uri|Xml)/g
const ignoredImports = new Set([
diff --git a/tools/lint/src/rules/quality/base64.ts b/tools/checks/lint/src/rules/quality/base64.ts
similarity index 100%
rename from tools/lint/src/rules/quality/base64.ts
rename to tools/checks/lint/src/rules/quality/base64.ts
diff --git a/tools/lint/src/rules/quality/module-mocking.ts b/tools/checks/lint/src/rules/quality/module-mocking.ts
similarity index 100%
rename from tools/lint/src/rules/quality/module-mocking.ts
rename to tools/checks/lint/src/rules/quality/module-mocking.ts
diff --git a/tools/lint/src/rules/quality/reduce-accumulator-copy.ts b/tools/checks/lint/src/rules/quality/reduce-accumulator-copy.ts
similarity index 100%
rename from tools/lint/src/rules/quality/reduce-accumulator-copy.ts
rename to tools/checks/lint/src/rules/quality/reduce-accumulator-copy.ts
diff --git a/tools/lint/src/rules/quality/widen-then-assert.ts b/tools/checks/lint/src/rules/quality/widen-then-assert.ts
similarity index 100%
rename from tools/lint/src/rules/quality/widen-then-assert.ts
rename to tools/checks/lint/src/rules/quality/widen-then-assert.ts
diff --git a/tools/lint/src/rules/runtime.ts b/tools/checks/lint/src/rules/runtime.ts
similarity index 100%
rename from tools/lint/src/rules/runtime.ts
rename to tools/checks/lint/src/rules/runtime.ts
diff --git a/tools/lint/src/rules/structure.ts b/tools/checks/lint/src/rules/structure.ts
similarity index 100%
rename from tools/lint/src/rules/structure.ts
rename to tools/checks/lint/src/rules/structure.ts
diff --git a/tools/lint/src/rules/typescript.ts b/tools/checks/lint/src/rules/typescript.ts
similarity index 100%
rename from tools/lint/src/rules/typescript.ts
rename to tools/checks/lint/src/rules/typescript.ts
diff --git a/tools/lint/src/rules/vue/browser.ts b/tools/checks/lint/src/rules/vue/browser.ts
similarity index 100%
rename from tools/lint/src/rules/vue/browser.ts
rename to tools/checks/lint/src/rules/vue/browser.ts
diff --git a/tools/lint/src/rules/vue/index.ts b/tools/checks/lint/src/rules/vue/index.ts
similarity index 100%
rename from tools/lint/src/rules/vue/index.ts
rename to tools/checks/lint/src/rules/vue/index.ts
diff --git a/tools/lint/src/rules/vue/size.ts b/tools/checks/lint/src/rules/vue/size.ts
similarity index 100%
rename from tools/lint/src/rules/vue/size.ts
rename to tools/checks/lint/src/rules/vue/size.ts
diff --git a/tools/lint/src/rules/vue/template.ts b/tools/checks/lint/src/rules/vue/template.ts
similarity index 100%
rename from tools/lint/src/rules/vue/template.ts
rename to tools/checks/lint/src/rules/vue/template.ts
diff --git a/tools/lint/src/rules/vue/test-ids.ts b/tools/checks/lint/src/rules/vue/test-ids.ts
similarity index 100%
rename from tools/lint/src/rules/vue/test-ids.ts
rename to tools/checks/lint/src/rules/vue/test-ids.ts
diff --git a/tools/lint/src/support/array-method.ts b/tools/checks/lint/src/support/array-method.ts
similarity index 100%
rename from tools/lint/src/support/array-method.ts
rename to tools/checks/lint/src/support/array-method.ts
diff --git a/tools/lint/src/support/context.ts b/tools/checks/lint/src/support/context.ts
similarity index 100%
rename from tools/lint/src/support/context.ts
rename to tools/checks/lint/src/support/context.ts
diff --git a/tools/lint/src/support/factories.ts b/tools/checks/lint/src/support/factories.ts
similarity index 100%
rename from tools/lint/src/support/factories.ts
rename to tools/checks/lint/src/support/factories.ts
diff --git a/tools/lint/src/support/scope.ts b/tools/checks/lint/src/support/scope.ts
similarity index 100%
rename from tools/lint/src/support/scope.ts
rename to tools/checks/lint/src/support/scope.ts
diff --git a/tools/lint/src/support/types.ts b/tools/checks/lint/src/support/types.ts
similarity index 57%
rename from tools/lint/src/support/types.ts
rename to tools/checks/lint/src/support/types.ts
index bba6258ac..d0f092c0b 100644
--- a/tools/lint/src/support/types.ts
+++ b/tools/checks/lint/src/support/types.ts
@@ -1,16 +1,26 @@
+import type { Rule as OxlintRule } from '@oxlint/plugins'
import type { TSESLint, TSESTree } from '@typescript-eslint/utils'
+/** The `SourceCode` members rules actually call, so tests can provide a small double. */
+export type RuleSourceCode = Pick<
+ TSESLint.SourceCode,
+ 'getAllComments' | 'getScope' | 'getText' | 'text'
+>
+
export interface RuleContext {
filename?: string
physicalFilename?: string
options: readonly unknown[]
- sourceCode: TSESLint.SourceCode
+ sourceCode: RuleSourceCode
getFilename?: () => string
report(descriptor: { node: TSESTree.Node | TSESTree.Comment; message: string }): void
}
export type RuleListener = TSESLint.RuleListener
+/** Rules are either the repo's own definition shape or an oxlint `defineRule()` result. */
+export type PluginRule = RuleDefinition | OxlintRule
+
export interface RuleDefinition {
meta: {
docs: { description: string }
diff --git a/tools/lint/src/support/vue.ts b/tools/checks/lint/src/support/vue.ts
similarity index 100%
rename from tools/lint/src/support/vue.ts
rename to tools/checks/lint/src/support/vue.ts
diff --git a/tools/lint/tests/base64.test.ts b/tools/checks/lint/tests/base64.test.ts
similarity index 100%
rename from tools/lint/tests/base64.test.ts
rename to tools/checks/lint/tests/base64.test.ts
diff --git a/tools/lint/tests/helpers/lint.ts b/tools/checks/lint/tests/helpers/lint.ts
similarity index 99%
rename from tools/lint/tests/helpers/lint.ts
rename to tools/checks/lint/tests/helpers/lint.ts
index ad51e9cee..b6d1b76df 100644
--- a/tools/lint/tests/helpers/lint.ts
+++ b/tools/checks/lint/tests/helpers/lint.ts
@@ -4,7 +4,7 @@ import { dirname, join } from 'node:path'
import * as v from 'valibot'
-import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts'
+import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts-tools'
const diagnosticSchema = v.object({
code: v.optional(v.string()),
diff --git a/tools/lint/tests/lint-helper.test.ts b/tools/checks/lint/tests/lint-helper.test.ts
similarity index 100%
rename from tools/lint/tests/lint-helper.test.ts
rename to tools/checks/lint/tests/lint-helper.test.ts
diff --git a/tools/lint/tests/module-mocking.test.ts b/tools/checks/lint/tests/module-mocking.test.ts
similarity index 100%
rename from tools/lint/tests/module-mocking.test.ts
rename to tools/checks/lint/tests/module-mocking.test.ts
diff --git a/tools/lint/tests/plugin.test.ts b/tools/checks/lint/tests/plugin.test.ts
similarity index 75%
rename from tools/lint/tests/plugin.test.ts
rename to tools/checks/lint/tests/plugin.test.ts
index 6436f7b4b..5c7417d32 100644
--- a/tools/lint/tests/plugin.test.ts
+++ b/tools/checks/lint/tests/plugin.test.ts
@@ -3,30 +3,76 @@ import { mkdir, mkdtemp, rm } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
-import lintPlugin from '#lint/plugin.ts'
+import type lintPlugin from '#lint/plugin.ts'
+import { noSiblingDomainPrefixedFiles } from '#lint/rules/structure.ts'
+import {
+ noHardcodedTipLabelsInVue,
+ noNativeTitleAttributesInVue,
+ noRawSvgInAppVueTemplates
+} from '#lint/rules/vue/template.ts'
import { normalizedFilename } from '#lint/support/context.ts'
+import type { RuleContext, RuleDefinition, RuleSourceCode } from '#lint/support/types.ts'
+import { AST_NODE_TYPES, type TSESTree } from '@typescript-eslint/utils'
-import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts'
+import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts-tools'
import { lint, ruleDiagnostics } from './helpers/lint.ts'
const temporaryDirectories: string[] = []
-async function runRule(ruleName: string, source: string, filename: string): Promise<number> {
- const plugin = lintPlugin
+const unavailable = (member: string) => () => {
+ throw new Error(`${member} is not available in the filename-only harness`)
+}
+
+/** A source-code double for rules that read only the filename and raw text; no AST is parsed. */
+function filenameOnlySourceCode(source: string): RuleSourceCode {
+ return {
+ text: source,
+ getText: () => source,
+ getAllComments: unavailable('getAllComments'),
+ getScope: unavailable('getScope')
+ }
+}
+
+function emptyProgram(): TSESTree.Program {
+ const position = { line: 1, column: 0 }
+ return {
+ type: AST_NODE_TYPES.Program,
+ body: [],
+ comments: undefined,
+ sourceType: 'module',
+ tokens: undefined,
+ range: [0, 0],
+ loc: { start: position, end: position }
+ }
+}
+
+/** Rules the filename-only harness below can drive without a parsed AST. */
+const harnessRules = {
+ 'no-sibling-domain-prefixed-files': noSiblingDomainPrefixedFiles,
+ 'no-native-title-attributes-in-vue': noNativeTitleAttributesInVue,
+ 'no-hardcoded-tip-labels-in-vue': noHardcodedTipLabelsInVue,
+ 'no-raw-svg-in-app-vue-templates': noRawSvgInAppVueTemplates
+} satisfies Record<string, RuleDefinition>
+
+async function runRule(
+ ruleName: keyof typeof harnessRules,
+ source: string,
+ filename: string
+): Promise<number> {
+ const rule: RuleDefinition = harnessRules[ruleName]
let reports = 0
- const visitors = plugin.rules[ruleName].create({
+ const context: RuleContext = {
filename,
physicalFilename: filename,
options: [],
report: () => {
reports += 1
},
- sourceCode: {
- getText: () => source
- }
- })
- visitors.Program?.({ type: 'Program' })
+ sourceCode: filenameOnlySourceCode(source)
+ }
+ const visitors = rule.create(context)
+ visitors.Program?.(emptyProgram())
return reports
}
diff --git a/tools/lint/tests/reduce-accumulator-copy.test.ts b/tools/checks/lint/tests/reduce-accumulator-copy.test.ts
similarity index 100%
rename from tools/lint/tests/reduce-accumulator-copy.test.ts
rename to tools/checks/lint/tests/reduce-accumulator-copy.test.ts
diff --git a/tools/lint/tests/vue-module.test.ts b/tools/checks/lint/tests/vue-module.test.ts
similarity index 99%
rename from tools/lint/tests/vue-module.test.ts
rename to tools/checks/lint/tests/vue-module.test.ts
index aafa16caa..07a2f0a3e 100644
--- a/tools/lint/tests/vue-module.test.ts
+++ b/tools/checks/lint/tests/vue-module.test.ts
@@ -5,7 +5,7 @@ import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { promisify } from 'node:util'
-import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts'
+import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts-tools'
const execute = promisify(execFile)
const root = await resolveWorkspaceRoot(import.meta.dir)
diff --git a/tools/lint/tests/widen-then-assert.test.ts b/tools/checks/lint/tests/widen-then-assert.test.ts
similarity index 100%
rename from tools/lint/tests/widen-then-assert.test.ts
rename to tools/checks/lint/tests/widen-then-assert.test.ts
diff --git a/tools/package-quality/package.json b/tools/checks/package-quality/package.json
similarity index 85%
rename from tools/package-quality/package.json
rename to tools/checks/package-quality/package.json
index 56c619e7f..3d96e1d2d 100644
--- a/tools/package-quality/package.json
+++ b/tools/checks/package-quality/package.json
@@ -12,7 +12,7 @@
"test": "bun test tests"
},
"dependencies": {
- "@open-pencil/package-artifacts": "workspace:*",
+ "@open-pencil/package-artifacts-tools": "workspace:*",
"citty": "^0.1.6",
"es-toolkit": "^1.51.0"
}
diff --git a/tools/package-quality/src/checks/attw.ts b/tools/checks/package-quality/src/checks/attw.ts
similarity index 89%
rename from tools/package-quality/src/checks/attw.ts
rename to tools/checks/package-quality/src/checks/attw.ts
index d2b4ea04a..63b2713d4 100644
--- a/tools/package-quality/src/checks/attw.ts
+++ b/tools/checks/package-quality/src/checks/attw.ts
@@ -1,4 +1,4 @@
-import { runCommand } from '@open-pencil/package-artifacts'
+import { runCommand } from '@open-pencil/package-artifacts-tools'
import { publicPackageDirs } from '../packages'
import { runPackageChecks } from './run'
diff --git a/tools/package-quality/src/checks/metadata.ts b/tools/checks/package-quality/src/checks/metadata.ts
similarity index 96%
rename from tools/package-quality/src/checks/metadata.ts
rename to tools/checks/package-quality/src/checks/metadata.ts
index 4b3fcb123..fe06bf973 100644
--- a/tools/package-quality/src/checks/metadata.ts
+++ b/tools/checks/package-quality/src/checks/metadata.ts
@@ -5,7 +5,7 @@ import {
readPackageManifest,
validateManifest,
type PackageDiagnostic
-} from '@open-pencil/package-artifacts'
+} from '@open-pencil/package-artifacts-tools'
export async function validatePackageMetadata(root: string): Promise<PackageDiagnostic[]> {
const packages = await discoverPublicPackages(root)
diff --git a/tools/package-quality/src/checks/publint.ts b/tools/checks/package-quality/src/checks/publint.ts
similarity index 100%
rename from tools/package-quality/src/checks/publint.ts
rename to tools/checks/package-quality/src/checks/publint.ts
diff --git a/tools/package-quality/src/checks/run.ts b/tools/checks/package-quality/src/checks/run.ts
similarity index 96%
rename from tools/package-quality/src/checks/run.ts
rename to tools/checks/package-quality/src/checks/run.ts
index f55857da1..d0dd03833 100644
--- a/tools/package-quality/src/checks/run.ts
+++ b/tools/checks/package-quality/src/checks/run.ts
@@ -1,6 +1,6 @@
import { mapAsync } from 'es-toolkit'
-import { CommandError, runCommand, type CommandRequest } from '@open-pencil/package-artifacts'
+import { CommandError, runCommand, type CommandRequest } from '@open-pencil/package-artifacts-tools'
/** Drain every check before reporting failures, so callers can safely remove shared fixtures. */
export async function runPackageChecks(
diff --git a/tools/package-quality/src/cli.ts b/tools/checks/package-quality/src/cli.ts
similarity index 100%
rename from tools/package-quality/src/cli.ts
rename to tools/checks/package-quality/src/cli.ts
diff --git a/tools/package-quality/src/commands.ts b/tools/checks/package-quality/src/commands.ts
similarity index 99%
rename from tools/package-quality/src/commands.ts
rename to tools/checks/package-quality/src/commands.ts
index b4892e81d..29ddf1fcf 100644
--- a/tools/package-quality/src/commands.ts
+++ b/tools/checks/package-quality/src/commands.ts
@@ -1,6 +1,6 @@
import { defineCommand } from 'citty'
-import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts'
+import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts-tools'
import { checkTypes } from './checks/attw'
import { formatPackageDiagnostics, validatePackageMetadata } from './checks/metadata'
diff --git a/tools/package-quality/src/packages.ts b/tools/checks/package-quality/src/packages.ts
similarity index 94%
rename from tools/package-quality/src/packages.ts
rename to tools/checks/package-quality/src/packages.ts
index bb5833756..f12003538 100644
--- a/tools/package-quality/src/packages.ts
+++ b/tools/checks/package-quality/src/packages.ts
@@ -1,4 +1,4 @@
-import { discoverPublicPackages } from '@open-pencil/package-artifacts'
+import { discoverPublicPackages } from '@open-pencil/package-artifacts-tools'
export async function publicPackageDirs(root: string): Promise<string[]> {
return (await discoverPublicPackages(root)).map(({ directory }) => directory)
diff --git a/tools/package-quality/src/smoke/consumer.ts b/tools/checks/package-quality/src/smoke/consumer.ts
similarity index 95%
rename from tools/package-quality/src/smoke/consumer.ts
rename to tools/checks/package-quality/src/smoke/consumer.ts
index 716a19cfa..5709d4cb5 100644
--- a/tools/package-quality/src/smoke/consumer.ts
+++ b/tools/checks/package-quality/src/smoke/consumer.ts
@@ -2,7 +2,7 @@ import { mkdtemp, rm } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
-import { inspectTarball } from '@open-pencil/package-artifacts/tarball'
+import { inspectTarball } from '@open-pencil/package-artifacts-tools/tarball'
import { measurePhase } from '../timing'
import { installPackedPackages } from './install'
diff --git a/tools/package-quality/src/smoke/guards.ts b/tools/checks/package-quality/src/smoke/guards.ts
similarity index 98%
rename from tools/package-quality/src/smoke/guards.ts
rename to tools/checks/package-quality/src/smoke/guards.ts
index 8ec1306d8..4bc9b165e 100644
--- a/tools/package-quality/src/smoke/guards.ts
+++ b/tools/checks/package-quality/src/smoke/guards.ts
@@ -4,8 +4,11 @@ import { dirname, join } from 'node:path'
import { isEqual } from 'es-toolkit'
-import { CommandError, parseNpmPack, runCommand } from '@open-pencil/package-artifacts'
-import { inspectTarball, type TarballDiagnostic } from '@open-pencil/package-artifacts/tarball'
+import { CommandError, parseNpmPack, runCommand } from '@open-pencil/package-artifacts-tools'
+import {
+ inspectTarball,
+ type TarballDiagnostic
+} from '@open-pencil/package-artifacts-tools/tarball'
import { installPackedPackages } from './install'
import { evaluateRuntime, type RuntimeName } from './runtime'
diff --git a/tools/package-quality/src/smoke/install.ts b/tools/checks/package-quality/src/smoke/install.ts
similarity index 90%
rename from tools/package-quality/src/smoke/install.ts
rename to tools/checks/package-quality/src/smoke/install.ts
index a62cd7732..d34a54012 100644
--- a/tools/package-quality/src/smoke/install.ts
+++ b/tools/checks/package-quality/src/smoke/install.ts
@@ -1,6 +1,6 @@
import { mkdir } from 'node:fs/promises'
-import { runCommand } from '@open-pencil/package-artifacts'
+import { runCommand } from '@open-pencil/package-artifacts-tools'
const INIT_TIMEOUT_MS = 60_000
const INSTALL_TIMEOUT_MS = 120_000
diff --git a/tools/package-quality/src/smoke/pack.ts b/tools/checks/package-quality/src/smoke/pack.ts
similarity index 90%
rename from tools/package-quality/src/smoke/pack.ts
rename to tools/checks/package-quality/src/smoke/pack.ts
index aed929a1e..82c0196dd 100644
--- a/tools/package-quality/src/smoke/pack.ts
+++ b/tools/checks/package-quality/src/smoke/pack.ts
@@ -1,8 +1,15 @@
import { mkdir } from 'node:fs/promises'
import { isAbsolute, join } from 'node:path'
-import { parseNpmPack, runCommand, type WorkspacePackage } from '@open-pencil/package-artifacts'
-import { inspectTarball, type TarballInspection } from '@open-pencil/package-artifacts/tarball'
+import {
+ parseNpmPack,
+ runCommand,
+ type WorkspacePackage
+} from '@open-pencil/package-artifacts-tools'
+import {
+ inspectTarball,
+ type TarballInspection
+} from '@open-pencil/package-artifacts-tools/tarball'
export interface PackedPackageSet {
inspections: TarballInspection[]
diff --git a/tools/package-quality/src/smoke/runtime.ts b/tools/checks/package-quality/src/smoke/runtime.ts
similarity index 98%
rename from tools/package-quality/src/smoke/runtime.ts
rename to tools/checks/package-quality/src/smoke/runtime.ts
index 6513ab738..a0b435ed5 100644
--- a/tools/package-quality/src/smoke/runtime.ts
+++ b/tools/checks/package-quality/src/smoke/runtime.ts
@@ -5,7 +5,7 @@ import {
runCommand,
type CommandRequest,
type PackageManifest
-} from '@open-pencil/package-artifacts'
+} from '@open-pencil/package-artifacts-tools'
import { runPackageChecks } from '../checks/run'
diff --git a/tools/package-quality/src/smoke/scenarios.ts b/tools/checks/package-quality/src/smoke/scenarios.ts
similarity index 100%
rename from tools/package-quality/src/smoke/scenarios.ts
rename to tools/checks/package-quality/src/smoke/scenarios.ts
diff --git a/tools/package-quality/src/smoke/type-consumer.ts b/tools/checks/package-quality/src/smoke/type-consumer.ts
similarity index 97%
rename from tools/package-quality/src/smoke/type-consumer.ts
rename to tools/checks/package-quality/src/smoke/type-consumer.ts
index 7b8a8ecbe..44b17833d 100644
--- a/tools/package-quality/src/smoke/type-consumer.ts
+++ b/tools/checks/package-quality/src/smoke/type-consumer.ts
@@ -1,7 +1,7 @@
import { writeFile } from 'node:fs/promises'
import { join } from 'node:path'
-import { runCommand } from '@open-pencil/package-artifacts'
+import { runCommand } from '@open-pencil/package-artifacts-tools'
const TYPE_CONSUMER = `import { createEditor, type Editor } from '@open-pencil/core'
import { htmlToDesignDocument, type DesignDocument } from '@open-pencil/dom-css'
diff --git a/tools/package-quality/src/smoke/verify.ts b/tools/checks/package-quality/src/smoke/verify.ts
similarity index 92%
rename from tools/package-quality/src/smoke/verify.ts
rename to tools/checks/package-quality/src/smoke/verify.ts
index 0401f19a2..7bd6092c4 100644
--- a/tools/package-quality/src/smoke/verify.ts
+++ b/tools/checks/package-quality/src/smoke/verify.ts
@@ -2,7 +2,10 @@ import { mkdtemp, rm } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
-import { discoverPublicPackages, orderPackagesByDependencies } from '@open-pencil/package-artifacts'
+import {
+ discoverPublicPackages,
+ orderPackagesByDependencies
+} from '@open-pencil/package-artifacts-tools'
import { measurePhase } from '../timing'
import { verifyArtifactConsumers } from './consumer'
diff --git a/tools/package-quality/src/timing.ts b/tools/checks/package-quality/src/timing.ts
similarity index 100%
rename from tools/package-quality/src/timing.ts
rename to tools/checks/package-quality/src/timing.ts
diff --git a/tools/package-quality/tests/checks.test.ts b/tools/checks/package-quality/tests/checks.test.ts
similarity index 99%
rename from tools/package-quality/tests/checks.test.ts
rename to tools/checks/package-quality/tests/checks.test.ts
index ea95a5e04..02c77d5a1 100644
--- a/tools/package-quality/tests/checks.test.ts
+++ b/tools/checks/package-quality/tests/checks.test.ts
@@ -2,7 +2,7 @@ import { expect, test } from 'bun:test'
import { runPackageChecks } from '#package-quality/checks/run'
-import { CommandError, type CommandRequest } from '@open-pencil/package-artifacts'
+import { CommandError, type CommandRequest } from '@open-pencil/package-artifacts-tools'
test('bounded checks drain after failures and preserve diagnostic order', async () => {
const requests = Array.from({ length: 5 }, (_, index) => ({
diff --git a/tools/checks/package-quality/tests/cli.test.ts b/tools/checks/package-quality/tests/cli.test.ts
new file mode 100644
index 000000000..ac45a35dc
--- /dev/null
+++ b/tools/checks/package-quality/tests/cli.test.ts
@@ -0,0 +1,18 @@
+import { describe, expect, test } from 'bun:test'
+
+import { checkCommand, smokeCommand, verifyCommand } from '#package-quality/commands'
+import { renderUsage, type ArgsDef, type CommandDef } from 'citty'
+
+async function metaName<T extends ArgsDef>(command: CommandDef<T>): Promise<string | undefined> {
+ const meta = await (typeof command.meta === 'function' ? command.meta() : command.meta)
+ return meta?.name
+}
+
+describe('package quality commands', () => {
+ test('exposes stable check, smoke, and verify workflows', async () => {
+ expect(await metaName(checkCommand)).toBe('check')
+ expect(await metaName(smokeCommand)).toBe('smoke')
+ expect(await metaName(verifyCommand)).toBe('verify')
+ expect(await renderUsage(verifyCommand)).toContain('built-package smoke tests')
+ })
+})
diff --git a/tools/package-quality/tests/guards.test.ts b/tools/checks/package-quality/tests/guards.test.ts
similarity index 100%
rename from tools/package-quality/tests/guards.test.ts
rename to tools/checks/package-quality/tests/guards.test.ts
diff --git a/tools/package-quality/tests/runtime.test.ts b/tools/checks/package-quality/tests/runtime.test.ts
similarity index 99%
rename from tools/package-quality/tests/runtime.test.ts
rename to tools/checks/package-quality/tests/runtime.test.ts
index 2e3bfd7ff..f2d8e4212 100644
--- a/tools/package-quality/tests/runtime.test.ts
+++ b/tools/checks/package-quality/tests/runtime.test.ts
@@ -4,7 +4,7 @@ import { setImmediate } from 'node:timers/promises'
import { verifyPublicImports } from '#package-quality/smoke/runtime'
import { measurePhase } from '#package-quality/timing'
-import type { CommandRequest } from '@open-pencil/package-artifacts'
+import type { CommandRequest } from '@open-pencil/package-artifacts-tools'
test('public imports retain separate bounded Node and Bun invocations and the stdio exclusion', async () => {
const requests: CommandRequest[] = []
diff --git a/tools/checks/secret-scan/package.json b/tools/checks/secret-scan/package.json
new file mode 100644
index 000000000..5c451ea6b
--- /dev/null
+++ b/tools/checks/secret-scan/package.json
@@ -0,0 +1,5 @@
+{
+ "name": "@open-pencil/secret-scan-tools",
+ "private": true,
+ "type": "module"
+}
diff --git a/tools/checks/secret-scan/src/index.ts b/tools/checks/secret-scan/src/index.ts
new file mode 100644
index 000000000..b66913830
--- /dev/null
+++ b/tools/checks/secret-scan/src/index.ts
@@ -0,0 +1,18 @@
+import { runSecretScan, type ScanCommand, type ScanOutcome } from './scan'
+
+function spawn({ command, args }: ScanCommand): ScanOutcome | null {
+ try {
+ const proc = Bun.spawnSync([command, ...args], { stdout: 'inherit', stderr: 'inherit' })
+ return { exitCode: proc.exitCode, success: proc.success }
+ } catch (error) {
+ if (error instanceof Error && 'code' in error && error.code === 'ENOENT') return null
+ throw error
+ }
+}
+
+const outcome = runSecretScan(spawn)
+if (!outcome.success) {
+ console.error('Secret scan failed.')
+ process.exit(outcome.exitCode || 1)
+}
+console.log('Secret scan passed.')
diff --git a/tools/checks/secret-scan/src/scan.ts b/tools/checks/secret-scan/src/scan.ts
new file mode 100644
index 000000000..982045fa9
--- /dev/null
+++ b/tools/checks/secret-scan/src/scan.ts
@@ -0,0 +1,33 @@
+export const GITLEAKS_VERSION = 'v8.30.1'
+export const GITLEAKS_MODULE = `github.com/zricethezav/gitleaks/v8@${GITLEAKS_VERSION}`
+export const GITLEAKS_ARGS = ['dir', '--config', '.gitleaks.toml', '--redact', '--no-banner', '.']
+
+export interface ScanCommand {
+ command: string
+ args: string[]
+}
+
+/** The installed `gitleaks` binary when present, otherwise the pinned module through `go run`. */
+export function scanCommands(): ScanCommand[] {
+ return [
+ { command: 'gitleaks', args: GITLEAKS_ARGS },
+ { command: 'go', args: ['run', GITLEAKS_MODULE, ...GITLEAKS_ARGS] }
+ ]
+}
+
+export interface ScanOutcome {
+ exitCode: number
+ success: boolean
+}
+
+/** `null` means the command is not installed and the next candidate should run. */
+export type ScanRunner = (command: ScanCommand) => ScanOutcome | null
+
+/** Runs the first available command; a missing binary falls through, any other result is final. */
+export function runSecretScan(run: ScanRunner, candidates = scanCommands()): ScanOutcome {
+ for (const candidate of candidates) {
+ const outcome = run(candidate)
+ if (outcome) return outcome
+ }
+ return { exitCode: 1, success: false }
+}
diff --git a/tools/checks/secret-scan/tests/scan.test.ts b/tools/checks/secret-scan/tests/scan.test.ts
new file mode 100644
index 000000000..04a28182b
--- /dev/null
+++ b/tools/checks/secret-scan/tests/scan.test.ts
@@ -0,0 +1,41 @@
+import { describe, expect, test } from 'bun:test'
+
+import { GITLEAKS_ARGS, GITLEAKS_MODULE, runSecretScan, scanCommands } from '../src/scan'
+
+describe('scanCommands', () => {
+ test('prefers the installed binary and falls back to the pinned module', () => {
+ expect(scanCommands()).toEqual([
+ { command: 'gitleaks', args: GITLEAKS_ARGS },
+ { command: 'go', args: ['run', GITLEAKS_MODULE, ...GITLEAKS_ARGS] }
+ ])
+ expect(GITLEAKS_ARGS).toContain('--redact')
+ })
+})
+
+describe('runSecretScan', () => {
+ test('stops at the first installed command and returns its outcome', () => {
+ const tried: string[] = []
+ const outcome = runSecretScan((candidate) => {
+ tried.push(candidate.command)
+ return { exitCode: 1, success: false }
+ })
+
+ expect(tried).toEqual(['gitleaks'])
+ expect(outcome).toEqual({ exitCode: 1, success: false })
+ })
+
+ test('falls through a missing binary to the next candidate', () => {
+ const tried: string[] = []
+ const outcome = runSecretScan((candidate) => {
+ tried.push(candidate.command)
+ return candidate.command === 'gitleaks' ? null : { exitCode: 0, success: true }
+ })
+
+ expect(tried).toEqual(['gitleaks', 'go'])
+ expect(outcome).toEqual({ exitCode: 0, success: true })
+ })
+
+ test('fails when no candidate is installed', () => {
+ expect(runSecretScan(() => null)).toEqual({ exitCode: 1, success: false })
+ })
+})
diff --git a/tools/unit-tests/engine-baseline.txt b/tools/checks/test-homes/engine-baseline.txt
similarity index 99%
rename from tools/unit-tests/engine-baseline.txt
rename to tools/checks/test-homes/engine-baseline.txt
index 3a35c757b..06a803c3d 100644
--- a/tools/unit-tests/engine-baseline.txt
+++ b/tools/checks/test-homes/engine-baseline.txt
@@ -1,7 +1,7 @@
# Unit tests still under tests/engine, the migration debt from
# packages/docs/development/testing.md. New tests go to the owner's canonical
# home; remove a line here when its file moves. Regenerate with
-# `bun tools/unit-tests/src/check-homes.ts --write`.
+# `bun tools/dev/unit-tests/src/check-homes.ts --write`.
tests/engine/acp/permission.test.ts
tests/engine/acp/transport.test.ts
tests/engine/app/ai/attachment/image.test.ts
diff --git a/tools/checks/test-homes/package.json b/tools/checks/test-homes/package.json
new file mode 100644
index 000000000..8abd23a0a
--- /dev/null
+++ b/tools/checks/test-homes/package.json
@@ -0,0 +1,12 @@
+{
+ "name": "@open-pencil/test-homes-tools",
+ "private": true,
+ "type": "module",
+ "scripts": {
+ "test": "bun test tests"
+ },
+ "dependencies": {
+ "@open-pencil/package-artifacts-tools": "workspace:*",
+ "@open-pencil/unit-tests-tools": "workspace:*"
+ }
+}
diff --git a/tools/unit-tests/src/homes.ts b/tools/checks/test-homes/src/homes.ts
similarity index 93%
rename from tools/unit-tests/src/homes.ts
rename to tools/checks/test-homes/src/homes.ts
index ebadde2d1..a18b90421 100644
--- a/tools/unit-tests/src/homes.ts
+++ b/tools/checks/test-homes/src/homes.ts
@@ -1,10 +1,10 @@
import { existsSync, readFileSync } from 'node:fs'
import { resolve } from 'node:path'
-import { UNIT_TEST_GROUPS } from './shards'
+import { UNIT_TEST_GROUPS } from '@open-pencil/unit-tests-tools/shards'
export const ENGINE_TESTS_ROOT = 'tests/engine'
-export const ENGINE_BASELINE_PATH = 'tools/unit-tests/engine-baseline.txt'
+export const ENGINE_BASELINE_PATH = 'tools/checks/test-homes/engine-baseline.txt'
export interface TestHomesOptions {
repoRoot: string
@@ -43,7 +43,7 @@ export function formatBaseline(files: readonly string[]): string {
'# Unit tests still under tests/engine, the migration debt from',
"# packages/docs/development/testing.md. New tests go to the owner's canonical",
'# home; remove a line here when its file moves. Regenerate with',
- '# `bun tools/unit-tests/src/check-homes.ts --write`.'
+ '# `bun tools/checks/test-homes/src/index.ts --write`.'
]
return [...header, ...[...files].sort()].join('\n') + '\n'
}
diff --git a/tools/unit-tests/src/check-homes.ts b/tools/checks/test-homes/src/index.ts
similarity index 86%
rename from tools/unit-tests/src/check-homes.ts
rename to tools/checks/test-homes/src/index.ts
index 65257dee2..085e842a5 100644
--- a/tools/unit-tests/src/check-homes.ts
+++ b/tools/checks/test-homes/src/index.ts
@@ -3,13 +3,13 @@
* Fails when a unit test is added under `tests/engine` instead of its owner's canonical home,
* or when the baseline lists a file that has moved.
*
- * bun tools/unit-tests/src/check-homes.ts # check
- * bun tools/unit-tests/src/check-homes.ts --write # rewrite the baseline from the current tree
+ * bun tools/checks/test-homes/src/index.ts # check
+ * bun tools/checks/test-homes/src/index.ts --write # rewrite the baseline from the current tree
*/
import { writeFile } from 'node:fs/promises'
import { resolve } from 'node:path'
-import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts'
+import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts-tools'
import { ENGINE_BASELINE_PATH, checkTestHomes, formatBaseline, listEngineTests } from './homes'
diff --git a/tools/unit-tests/tests/homes.test.ts b/tools/checks/test-homes/tests/homes.test.ts
similarity index 89%
rename from tools/unit-tests/tests/homes.test.ts
rename to tools/checks/test-homes/tests/homes.test.ts
index 927446581..e5fe79bf9 100644
--- a/tools/unit-tests/tests/homes.test.ts
+++ b/tools/checks/test-homes/tests/homes.test.ts
@@ -2,7 +2,8 @@ import { describe, expect, test } from 'bun:test'
import { mkdir, mkdtemp, writeFile } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
-import { fileURLToPath } from 'node:url'
+
+import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts-tools'
import {
canonicalHomeFor,
@@ -12,12 +13,15 @@ import {
parseBaseline
} from '../src/homes'
-const REPO_ROOT = fileURLToPath(new URL('../../..', import.meta.url))
+const REPO_ROOT = await resolveWorkspaceRoot(import.meta.dir)
async function repoWithBaseline(files: readonly string[]) {
const repoRoot = await mkdtemp(join(tmpdir(), 'open-pencil-test-homes-'))
- await mkdir(join(repoRoot, 'tools/unit-tests'), { recursive: true })
- await writeFile(join(repoRoot, 'tools/unit-tests/engine-baseline.txt'), formatBaseline(files))
+ await mkdir(join(repoRoot, 'tools/checks/test-homes'), { recursive: true })
+ await writeFile(
+ join(repoRoot, 'tools/checks/test-homes/engine-baseline.txt'),
+ formatBaseline(files)
+ )
return repoRoot
}
diff --git a/tools/type-shapes/package.json b/tools/checks/type-shapes/package.json
similarity index 100%
rename from tools/type-shapes/package.json
rename to tools/checks/type-shapes/package.json
diff --git a/tools/type-shapes/src/files.ts b/tools/checks/type-shapes/src/files.ts
similarity index 98%
rename from tools/type-shapes/src/files.ts
rename to tools/checks/type-shapes/src/files.ts
index ae81ecfa2..5dbd2eac4 100644
--- a/tools/type-shapes/src/files.ts
+++ b/tools/checks/type-shapes/src/files.ts
@@ -5,7 +5,6 @@ export const TYPE_SHAPE_ROOTS = [
'packages/cli/src',
'packages/mcp/src',
'tests',
- 'scripts',
'tools'
] as const
diff --git a/tools/type-shapes/src/index.ts b/tools/checks/type-shapes/src/index.ts
similarity index 100%
rename from tools/type-shapes/src/index.ts
rename to tools/checks/type-shapes/src/index.ts
diff --git a/tools/type-shapes/tests/files.test.ts b/tools/checks/type-shapes/tests/files.test.ts
similarity index 95%
rename from tools/type-shapes/tests/files.test.ts
rename to tools/checks/type-shapes/tests/files.test.ts
index e67b698c8..ed0939722 100644
--- a/tools/type-shapes/tests/files.test.ts
+++ b/tools/checks/type-shapes/tests/files.test.ts
@@ -13,7 +13,7 @@ describe('type shape source discovery', () => {
test('excludes declarations, dependencies, and generated output on every platform', () => {
expect(isTypeShapeSourcePath('src/global.d.ts')).toBe(false)
- expect(isTypeShapeSourcePath('tools/docs/node_modules/zod/src/types.ts')).toBe(false)
+ expect(isTypeShapeSourcePath('tools/checks/docs/node_modules/zod/src/types.ts')).toBe(false)
expect(isTypeShapeSourcePath('tools\\docs\\node_modules\\zod\\src\\types.ts')).toBe(false)
expect(isTypeShapeSourcePath('packages/mcp/dist/generated.ts')).toBe(false)
expect(isTypeShapeSourcePath('coverage/report.ts')).toBe(false)
diff --git a/tools/ci-images/native-contracts/Dockerfile b/tools/ci/images/ci-images/native-contracts/Dockerfile
similarity index 100%
rename from tools/ci-images/native-contracts/Dockerfile
rename to tools/ci/images/ci-images/native-contracts/Dockerfile
diff --git a/tools/ci-images/package.json b/tools/ci/images/ci-images/package.json
similarity index 50%
rename from tools/ci-images/package.json
rename to tools/ci/images/ci-images/package.json
index 389ada96b..bd9877410 100644
--- a/tools/ci-images/package.json
+++ b/tools/ci/images/ci-images/package.json
@@ -1,5 +1,5 @@
{
- "name": "@open-pencil/ci-images",
+ "name": "@open-pencil/ci-images-tools",
"private": true,
"type": "module"
}
diff --git a/tools/ci/images/package.json b/tools/ci/images/package.json
new file mode 100644
index 000000000..bd9877410
--- /dev/null
+++ b/tools/ci/images/package.json
@@ -0,0 +1,5 @@
+{
+ "name": "@open-pencil/ci-images-tools",
+ "private": true,
+ "type": "module"
+}
diff --git a/tools/ci/package.json b/tools/ci/policy/package.json
similarity index 52%
rename from tools/ci/package.json
rename to tools/ci/policy/package.json
index 91b15a8d3..1cf910a0a 100644
--- a/tools/ci/package.json
+++ b/tools/ci/policy/package.json
@@ -1,5 +1,5 @@
{
- "name": "@open-pencil/ci-tools",
+ "name": "@open-pencil/ci-policy-tools",
"private": true,
"type": "module",
"imports": {
@@ -7,5 +7,8 @@
},
"scripts": {
"test": "bun test tests"
+ },
+ "dependencies": {
+ "@open-pencil/package-artifacts-tools": "workspace:*"
}
}
diff --git a/tools/ci/src/classify.ts b/tools/ci/policy/src/classify.ts
similarity index 100%
rename from tools/ci/src/classify.ts
rename to tools/ci/policy/src/classify.ts
diff --git a/tools/ci/src/commit-attribution.ts b/tools/ci/policy/src/commit-attribution.ts
similarity index 97%
rename from tools/ci/src/commit-attribution.ts
rename to tools/ci/policy/src/commit-attribution.ts
index 340553fa6..5a2fcbc2d 100644
--- a/tools/ci/src/commit-attribution.ts
+++ b/tools/ci/policy/src/commit-attribution.ts
@@ -30,6 +30,6 @@ export function hasAICoauthor(message: string): boolean {
}
export const noAICoauthors: SyncRule = (parsed) => [
- !hasAICoauthor(parsed.raw),
+ !hasAICoauthor(parsed.raw ?? ''),
'AI-assisted contributions are welcome. Remove AI-assistant Co-authored-by trailers and keep disclosure in the PR’s AI assistance section. Preserve human co-author credits.'
]
diff --git a/tools/ci/src/gate.ts b/tools/ci/policy/src/gate.ts
similarity index 100%
rename from tools/ci/src/gate.ts
rename to tools/ci/policy/src/gate.ts
diff --git a/tools/ci/src/policy.ts b/tools/ci/policy/src/policy.ts
similarity index 100%
rename from tools/ci/src/policy.ts
rename to tools/ci/policy/src/policy.ts
diff --git a/tools/ci/tests/classify.test.ts b/tools/ci/policy/tests/classify.test.ts
similarity index 100%
rename from tools/ci/tests/classify.test.ts
rename to tools/ci/policy/tests/classify.test.ts
diff --git a/tools/ci/tests/commit-messages.test.ts b/tools/ci/policy/tests/commit-messages.test.ts
similarity index 97%
rename from tools/ci/tests/commit-messages.test.ts
rename to tools/ci/policy/tests/commit-messages.test.ts
index 75f910c21..f741895af 100644
--- a/tools/ci/tests/commit-messages.test.ts
+++ b/tools/ci/policy/tests/commit-messages.test.ts
@@ -1,11 +1,13 @@
import { expect, test } from 'bun:test'
import { mkdtemp, rm } from 'node:fs/promises'
import { tmpdir } from 'node:os'
-import { join, resolve } from 'node:path'
+import { join } from 'node:path'
import { hasAICoauthor } from '#ci/commit-attribution'
-const root = resolve(import.meta.dir, '../../..')
+import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts-tools'
+
+const root = await resolveWorkspaceRoot(import.meta.dir)
async function lint(message: string, args: string[] = [], prTitle = false) {
const child = Bun.spawn([process.execPath, 'run', 'check:commits', '--verbose', ...args], {
diff --git a/tools/ci/tests/policy.test.ts b/tools/ci/policy/tests/policy.test.ts
similarity index 100%
rename from tools/ci/tests/policy.test.ts
rename to tools/ci/policy/tests/policy.test.ts
diff --git a/tools/navigation-benchmark/package.json b/tools/ci/pr-review-guidance/package.json
similarity index 64%
rename from tools/navigation-benchmark/package.json
rename to tools/ci/pr-review-guidance/package.json
index 9203717dc..5fe00d275 100644
--- a/tools/navigation-benchmark/package.json
+++ b/tools/ci/pr-review-guidance/package.json
@@ -1,5 +1,5 @@
{
- "name": "@open-pencil/navigation-benchmark",
+ "name": "@open-pencil/pr-review-guidance-tools",
"private": true,
"type": "module",
"scripts": {
diff --git a/tools/pr-review-guidance/src/index.ts b/tools/ci/pr-review-guidance/src/index.ts
similarity index 94%
rename from tools/pr-review-guidance/src/index.ts
rename to tools/ci/pr-review-guidance/src/index.ts
index 283b86bdd..2911b45bf 100644
--- a/tools/pr-review-guidance/src/index.ts
+++ b/tools/ci/pr-review-guidance/src/index.ts
@@ -33,9 +33,12 @@ interface GitHubActionsEnvironment {
GITHUB_API_URL?: string
}
+/** The subset of `fetch` the monitor uses, so tests can inject a plain function. */
+type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>
+
interface MonitorOptions {
env?: GitHubActionsEnvironment
- fetchImpl?: typeof fetch
+ fetchImpl?: FetchLike
log?: (message: string) => void
}
@@ -109,7 +112,7 @@ async function github<T>(
apiURL: string,
token: string,
path: string,
- fetchImpl: typeof fetch,
+ fetchImpl: FetchLike,
options: RequestInit = {}
): Promise<T | null> {
const response = await fetchImpl(`${apiURL}${path}`, {
@@ -138,7 +141,7 @@ function repositoryName(repository?: string): string | undefined {
return repository?.split('/')[1]
}
-function requiredEnvironment(env: GitHubActionsEnvironment) {
+function requiredEnvironment(env: GitHubActionsEnvironment | NodeJS.ProcessEnv) {
const owner = env.GITHUB_REPOSITORY_OWNER
const repo = repositoryName(env.GITHUB_REPOSITORY)
const eventPath = env.GITHUB_EVENT_PATH
diff --git a/tools/pr-review-guidance/tests/index.test.ts b/tools/ci/pr-review-guidance/tests/index.test.ts
similarity index 96%
rename from tools/pr-review-guidance/tests/index.test.ts
rename to tools/ci/pr-review-guidance/tests/index.test.ts
index 56b434b6c..8a6525a7a 100644
--- a/tools/pr-review-guidance/tests/index.test.ts
+++ b/tools/ci/pr-review-guidance/tests/index.test.ts
@@ -97,7 +97,7 @@ describe('monitorPRReviewGuidance', () => {
GITHUB_REPOSITORY_OWNER: 'open-pencil',
GITHUB_TOKEN: 'token'
},
- fetchImpl: (async (input, init) => {
+ fetchImpl: async (input, init) => {
requests.push(`${init?.method ?? 'GET'} ${String(input)}`)
return response({
author_association: 'CONTRIBUTOR',
@@ -105,7 +105,7 @@ describe('monitorPRReviewGuidance', () => {
title: 'feat(dev-install): add script',
user: { login: 'joeycumines' }
})
- }) satisfies typeof fetch,
+ },
log: (message) => messages.push(message)
})
@@ -130,10 +130,10 @@ describe('monitorPRReviewGuidance', () => {
GITHUB_REPOSITORY_OWNER: 'open-pencil',
GITHUB_TOKEN: 'token'
},
- fetchImpl: (async (input, init) => {
+ fetchImpl: async (input, init) => {
requests.push(`${init?.method ?? 'GET'} ${String(input)}`)
return response({})
- }) satisfies typeof fetch,
+ },
log: (message) => messages.push(message)
})
diff --git a/tools/dev-server/package.json b/tools/dev/dev-server/package.json
similarity index 100%
rename from tools/dev-server/package.json
rename to tools/dev/dev-server/package.json
diff --git a/tools/dev-server/tests/watcher.test.ts b/tools/dev/dev-server/tests/watcher.test.ts
similarity index 100%
rename from tools/dev-server/tests/watcher.test.ts
rename to tools/dev/dev-server/tests/watcher.test.ts
diff --git a/tools/docs/package.json b/tools/dev/navigation-benchmark/package.json
similarity index 63%
rename from tools/docs/package.json
rename to tools/dev/navigation-benchmark/package.json
index 039bd8190..4658e7433 100644
--- a/tools/docs/package.json
+++ b/tools/dev/navigation-benchmark/package.json
@@ -1,5 +1,5 @@
{
- "name": "@open-pencil/docs-tools",
+ "name": "@open-pencil/navigation-benchmark-tools",
"private": true,
"type": "module",
"scripts": {
diff --git a/tools/navigation-benchmark/src/chromium-trace.ts b/tools/dev/navigation-benchmark/src/chromium-trace.ts
similarity index 91%
rename from tools/navigation-benchmark/src/chromium-trace.ts
rename to tools/dev/navigation-benchmark/src/chromium-trace.ts
index ad6e454d6..a882f382a 100644
--- a/tools/navigation-benchmark/src/chromium-trace.ts
+++ b/tools/dev/navigation-benchmark/src/chromium-trace.ts
@@ -32,7 +32,9 @@ export async function startChromiumTrace(
: TRACE_CATEGORIES
const session = await page.context().newCDPSession(page)
const chunks: string[] = []
- session.on('Tracing.dataCollected', ({ value }) => chunks.push(...value.map(JSON.stringify)))
+ session.on('Tracing.dataCollected', ({ value }) =>
+ chunks.push(...value.map((entry) => JSON.stringify(entry)))
+ )
await session.send('Tracing.start', {
categories: categories.join(','),
transferMode: 'ReportEvents',
diff --git a/tools/navigation-benchmark/src/cli.ts b/tools/dev/navigation-benchmark/src/cli.ts
similarity index 94%
rename from tools/navigation-benchmark/src/cli.ts
rename to tools/dev/navigation-benchmark/src/cli.ts
index 5f1fe5b13..740514a52 100644
--- a/tools/navigation-benchmark/src/cli.ts
+++ b/tools/dev/navigation-benchmark/src/cli.ts
@@ -30,7 +30,7 @@ if (command === 'compare') {
}
if (command !== 'run') {
console.log(
- 'Usage: bun tools/navigation-benchmark/src/cli.ts run --url URL --gesture FILE [--mode cdp|dom] [--scenario light|large-flat|raster-stress|current-document] [--document FILE] [--no-trace] [--cpu-profile] [--software-gpu] [--output DIR]\n bun tools/navigation-benchmark/src/cli.ts compare --baseline METRICS --candidate METRICS [--output FILE]'
+ 'Usage: bun tools/dev/navigation-benchmark/src/cli.ts run --url URL --gesture FILE [--mode cdp|dom] [--scenario light|large-flat|raster-stress|current-document] [--document FILE] [--no-trace] [--cpu-profile] [--software-gpu] [--output DIR]\n bun tools/dev/navigation-benchmark/src/cli.ts compare --baseline METRICS --candidate METRICS [--output FILE]'
)
process.exit(command ? 1 : 0)
}
@@ -118,11 +118,7 @@ try {
await page.waitForFunction(
() => {
const store = window.openPencil?.getStore?.()
- return (
- store != null &&
- !store.state.loading &&
- store.graph.getChildren(store.state.currentPageId).length > 0
- )
+ return store != null && store.graph.getChildren(store.state.currentPageId).length > 0
},
undefined,
{ timeout: 90_000 }
diff --git a/tools/navigation-benchmark/src/compare.ts b/tools/dev/navigation-benchmark/src/compare.ts
similarity index 100%
rename from tools/navigation-benchmark/src/compare.ts
rename to tools/dev/navigation-benchmark/src/compare.ts
diff --git a/tools/navigation-benchmark/src/metrics.ts b/tools/dev/navigation-benchmark/src/metrics.ts
similarity index 100%
rename from tools/navigation-benchmark/src/metrics.ts
rename to tools/dev/navigation-benchmark/src/metrics.ts
diff --git a/tools/navigation-benchmark/src/recording.ts b/tools/dev/navigation-benchmark/src/recording.ts
similarity index 100%
rename from tools/navigation-benchmark/src/recording.ts
rename to tools/dev/navigation-benchmark/src/recording.ts
diff --git a/tools/navigation-benchmark/src/replay.ts b/tools/dev/navigation-benchmark/src/replay.ts
similarity index 100%
rename from tools/navigation-benchmark/src/replay.ts
rename to tools/dev/navigation-benchmark/src/replay.ts
diff --git a/tools/navigation-benchmark/src/scenario.ts b/tools/dev/navigation-benchmark/src/scenario.ts
similarity index 100%
rename from tools/navigation-benchmark/src/scenario.ts
rename to tools/dev/navigation-benchmark/src/scenario.ts
diff --git a/tools/navigation-benchmark/src/types.ts b/tools/dev/navigation-benchmark/src/types.ts
similarity index 100%
rename from tools/navigation-benchmark/src/types.ts
rename to tools/dev/navigation-benchmark/src/types.ts
diff --git a/tools/navigation-benchmark/tests/compare.test.ts b/tools/dev/navigation-benchmark/tests/compare.test.ts
similarity index 100%
rename from tools/navigation-benchmark/tests/compare.test.ts
rename to tools/dev/navigation-benchmark/tests/compare.test.ts
diff --git a/tools/navigation-benchmark/tests/metrics.test.ts b/tools/dev/navigation-benchmark/tests/metrics.test.ts
similarity index 100%
rename from tools/navigation-benchmark/tests/metrics.test.ts
rename to tools/dev/navigation-benchmark/tests/metrics.test.ts
diff --git a/tools/navigation-benchmark/tests/recording.test.ts b/tools/dev/navigation-benchmark/tests/recording.test.ts
similarity index 100%
rename from tools/navigation-benchmark/tests/recording.test.ts
rename to tools/dev/navigation-benchmark/tests/recording.test.ts
diff --git a/tools/dev/unit-tests/package.json b/tools/dev/unit-tests/package.json
new file mode 100644
index 000000000..56d9fbd07
--- /dev/null
+++ b/tools/dev/unit-tests/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "@open-pencil/unit-tests-tools",
+ "private": true,
+ "type": "module",
+ "exports": {
+ "./shards": "./src/shards.ts"
+ },
+ "scripts": {
+ "test": "bun test tests"
+ },
+ "dependencies": {
+ "@open-pencil/package-artifacts-tools": "workspace:*"
+ }
+}
diff --git a/tools/unit-tests/src/run.ts b/tools/dev/unit-tests/src/run.ts
similarity index 93%
rename from tools/unit-tests/src/run.ts
rename to tools/dev/unit-tests/src/run.ts
index 62298f9e4..bafe3a90a 100644
--- a/tools/unit-tests/src/run.ts
+++ b/tools/dev/unit-tests/src/run.ts
@@ -5,7 +5,7 @@ import { listHeavyUnitTests, listUnitTests, type UnitTestGroup, unitTestGroupNam
/**
* Runs `bun test` over one shard group.
*
- * bun tools/unit-tests/src/run.ts [group] [--include-heavy | --heavy-only] [-- <bun test args>]
+ * bun tools/dev/unit-tests/src/run.ts [group] [--include-heavy | --heavy-only] [-- <bun test args>]
*
* Quick runs (the default) skip heavy fixture files and heavy-marked blocks;
* `--include-heavy` runs everything and `--heavy-only` runs only the heavy
diff --git a/tools/unit-tests/src/shards.ts b/tools/dev/unit-tests/src/shards.ts
similarity index 95%
rename from tools/unit-tests/src/shards.ts
rename to tools/dev/unit-tests/src/shards.ts
index 5dbcd842d..3a888814c 100644
--- a/tools/unit-tests/src/shards.ts
+++ b/tools/dev/unit-tests/src/shards.ts
@@ -1,9 +1,10 @@
import { existsSync } from 'node:fs'
import { readdir } from 'node:fs/promises'
-import { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path'
-import { fileURLToPath } from 'node:url'
+import { isAbsolute, join, relative, resolve, sep } from 'node:path'
-const REPO_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '../../..')
+import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts-tools'
+
+const REPO_ROOT = await resolveWorkspaceRoot(import.meta.dir)
/**
* Unit test shards, keyed by owning package or application area.
diff --git a/tools/unit-tests/tests/shards.test.ts b/tools/dev/unit-tests/tests/shards.test.ts
similarity index 95%
rename from tools/unit-tests/tests/shards.test.ts
rename to tools/dev/unit-tests/tests/shards.test.ts
index 83e43993a..dafcd425a 100644
--- a/tools/unit-tests/tests/shards.test.ts
+++ b/tools/dev/unit-tests/tests/shards.test.ts
@@ -1,5 +1,6 @@
import { expect, test } from 'bun:test'
-import { fileURLToPath } from 'node:url'
+
+import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts-tools'
import {
isHeavyUnitTest,
@@ -9,7 +10,7 @@ import {
unitTestGroupNames
} from '../src/shards'
-const REPO_ROOT = fileURLToPath(new URL('../../..', import.meta.url))
+const REPO_ROOT = await resolveWorkspaceRoot(import.meta.dir)
async function discover(pattern: string): Promise<string[]> {
return Array.fromAsync(new Bun.Glob(pattern).scan({ cwd: REPO_ROOT }))
diff --git a/tools/docs/tsconfig.json b/tools/docs/tsconfig.json
deleted file mode 100644
index 1018f7941..000000000
--- a/tools/docs/tsconfig.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "extends": "../../tsconfig.json",
- "compilerOptions": {
- "baseUrl": "../..",
- "paths": {
- "#docs-config/*": ["packages/docs/.vitepress/*"]
- }
- },
- "include": ["src/**/*.ts"]
-}
diff --git a/tools/authoring-reference/package.json b/tools/generate/authoring-reference/package.json
similarity index 83%
rename from tools/authoring-reference/package.json
rename to tools/generate/authoring-reference/package.json
index 3439520ea..823eb82b3 100644
--- a/tools/authoring-reference/package.json
+++ b/tools/generate/authoring-reference/package.json
@@ -10,7 +10,7 @@
},
"dependencies": {
"@open-pencil/core": "workspace:*",
- "@open-pencil/package-artifacts": "workspace:*",
+ "@open-pencil/package-artifacts-tools": "workspace:*",
"dedent": "^1.7.2"
}
}
diff --git a/tools/authoring-reference/src/artifacts.ts b/tools/generate/authoring-reference/src/artifacts.ts
similarity index 100%
rename from tools/authoring-reference/src/artifacts.ts
rename to tools/generate/authoring-reference/src/artifacts.ts
diff --git a/tools/authoring-reference/src/check.ts b/tools/generate/authoring-reference/src/check.ts
similarity index 97%
rename from tools/authoring-reference/src/check.ts
rename to tools/generate/authoring-reference/src/check.ts
index 197cd8457..0d7ec1be2 100644
--- a/tools/authoring-reference/src/check.ts
+++ b/tools/generate/authoring-reference/src/check.ts
@@ -1,7 +1,7 @@
import { staleReferences } from '#authoring-reference/artifacts'
import dedent from 'dedent'
-import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts'
+import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts-tools'
const stale = await staleReferences(await resolveWorkspaceRoot(process.cwd()))
if (stale.length > 0) {
diff --git a/tools/authoring-reference/src/generate.ts b/tools/generate/authoring-reference/src/generate.ts
similarity index 94%
rename from tools/authoring-reference/src/generate.ts
rename to tools/generate/authoring-reference/src/generate.ts
index db6674fdb..a39bca106 100644
--- a/tools/authoring-reference/src/generate.ts
+++ b/tools/generate/authoring-reference/src/generate.ts
@@ -1,5 +1,5 @@
import { writeReferences } from '#authoring-reference/artifacts'
-import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts'
+import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts-tools'
await writeReferences(await resolveWorkspaceRoot(process.cwd()))
diff --git a/tools/authoring-reference/tests/artifacts.test.ts b/tools/generate/authoring-reference/tests/artifacts.test.ts
similarity index 100%
rename from tools/authoring-reference/tests/artifacts.test.ts
rename to tools/generate/authoring-reference/tests/artifacts.test.ts
diff --git a/tools/brand/package.json b/tools/generate/brand/package.json
similarity index 82%
rename from tools/brand/package.json
rename to tools/generate/brand/package.json
index da9617c0b..e36a0ab13 100644
--- a/tools/brand/package.json
+++ b/tools/generate/brand/package.json
@@ -9,11 +9,10 @@
".": "./src/generate.ts"
},
"scripts": {
- "test": "bun test tests",
- "check": "tsc --noEmit -p tsconfig.json"
+ "test": "bun test tests"
},
"dependencies": {
- "@open-pencil/package-artifacts": "workspace:*",
+ "@open-pencil/package-artifacts-tools": "workspace:*",
"@realfavicongenerator/generate-favicon": "0.9.0",
"@realfavicongenerator/image-adapter-node": "0.9.0",
"@tauri-apps/cli": "2.11.4",
diff --git a/tools/brand/src/artwork.ts b/tools/generate/brand/src/artwork.ts
similarity index 100%
rename from tools/brand/src/artwork.ts
rename to tools/generate/brand/src/artwork.ts
diff --git a/tools/brand/src/cache.ts b/tools/generate/brand/src/cache.ts
similarity index 97%
rename from tools/brand/src/cache.ts
rename to tools/generate/brand/src/cache.ts
index 9c31830eb..c938b1838 100644
--- a/tools/brand/src/cache.ts
+++ b/tools/generate/brand/src/cache.ts
@@ -26,8 +26,8 @@ async function inputFiles(root: string, directory: string): Promise<string[]> {
export async function fingerprint(root: string): Promise<string> {
const paths = [
...(await inputFiles(root, 'assets/brand')),
- ...(await inputFiles(root, 'tools/brand/src')),
- 'tools/brand/package.json',
+ ...(await inputFiles(root, 'tools/generate/brand/src')),
+ 'tools/generate/brand/package.json',
'package.json',
'bun.lock'
]
diff --git a/tools/brand/src/check.ts b/tools/generate/brand/src/check.ts
similarity index 100%
rename from tools/brand/src/check.ts
rename to tools/generate/brand/src/check.ts
diff --git a/tools/brand/src/cli.ts b/tools/generate/brand/src/cli.ts
similarity index 100%
rename from tools/brand/src/cli.ts
rename to tools/generate/brand/src/cli.ts
diff --git a/tools/brand/src/config.ts b/tools/generate/brand/src/config.ts
similarity index 98%
rename from tools/brand/src/config.ts
rename to tools/generate/brand/src/config.ts
index af6f9e6c5..e05eebf07 100644
--- a/tools/brand/src/config.ts
+++ b/tools/generate/brand/src/config.ts
@@ -1,6 +1,6 @@
import { fileURLToPath } from 'node:url'
-import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts/workspace'
+import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts-tools/workspace'
export const repositoryRoot = await resolveWorkspaceRoot(fileURLToPath(import.meta.url))
export const targets = ['web', 'docs', 'desktop'] as const
diff --git a/tools/brand/src/desktop.ts b/tools/generate/brand/src/desktop.ts
similarity index 100%
rename from tools/brand/src/desktop.ts
rename to tools/generate/brand/src/desktop.ts
diff --git a/tools/brand/src/generate.ts b/tools/generate/brand/src/generate.ts
similarity index 100%
rename from tools/brand/src/generate.ts
rename to tools/generate/brand/src/generate.ts
diff --git a/tools/brand/src/validate.ts b/tools/generate/brand/src/validate.ts
similarity index 100%
rename from tools/brand/src/validate.ts
rename to tools/generate/brand/src/validate.ts
diff --git a/tools/brand/src/web.ts b/tools/generate/brand/src/web.ts
similarity index 100%
rename from tools/brand/src/web.ts
rename to tools/generate/brand/src/web.ts
diff --git a/tools/brand/tests/cache.test.ts b/tools/generate/brand/tests/cache.test.ts
similarity index 96%
rename from tools/brand/tests/cache.test.ts
rename to tools/generate/brand/tests/cache.test.ts
index 15e7fcc85..e70b74797 100644
--- a/tools/brand/tests/cache.test.ts
+++ b/tools/generate/brand/tests/cache.test.ts
@@ -12,8 +12,8 @@ beforeEach(async () => {
root = await mkdtemp(join(tmpdir(), 'open-pencil-brand-test-'))
for (const path of [
'assets/brand',
- 'tools/brand/src',
- 'tools/brand/package.json',
+ 'tools/generate/brand/src',
+ 'tools/generate/brand/package.json',
'package.json',
'bun.lock'
]) {
@@ -61,7 +61,7 @@ describe('brand asset preparation', () => {
const afterSource = await fingerprint(root)
expect(afterSource).not.toBe(before)
expect(await isCached(root, 'web', afterSource)).toBe(false)
- const config = join(root, 'tools/brand/src/config.ts')
+ const config = join(root, 'tools/generate/brand/src/config.ts')
await writeFile(config, `${await readFile(config, 'utf8')}\n`)
expect(await fingerprint(root)).not.toBe(afterSource)
})
diff --git a/tools/brand/tests/generation.test.ts b/tools/generate/brand/tests/generation.test.ts
similarity index 100%
rename from tools/brand/tests/generation.test.ts
rename to tools/generate/brand/tests/generation.test.ts
diff --git a/tools/tauri-menu/package.json b/tools/generate/tauri-menu/package.json
similarity index 77%
rename from tools/tauri-menu/package.json
rename to tools/generate/tauri-menu/package.json
index 14982e3b8..f3799f4bf 100644
--- a/tools/tauri-menu/package.json
+++ b/tools/generate/tauri-menu/package.json
@@ -6,7 +6,7 @@
"test": "bun test tests"
},
"devDependencies": {
- "@open-pencil/package-artifacts": "workspace:*",
+ "@open-pencil/package-artifacts-tools": "workspace:*",
"@open-pencil/vue": "workspace:*"
}
}
diff --git a/tools/tauri-menu/src/generate.ts b/tools/generate/tauri-menu/src/generate.ts
similarity index 100%
rename from tools/tauri-menu/src/generate.ts
rename to tools/generate/tauri-menu/src/generate.ts
diff --git a/tools/tauri-menu/src/menu.ts b/tools/generate/tauri-menu/src/menu.ts
similarity index 100%
rename from tools/tauri-menu/src/menu.ts
rename to tools/generate/tauri-menu/src/menu.ts
diff --git a/tools/tauri-menu/tests/artifacts.test.ts b/tools/generate/tauri-menu/tests/artifacts.test.ts
similarity index 97%
rename from tools/tauri-menu/tests/artifacts.test.ts
rename to tools/generate/tauri-menu/tests/artifacts.test.ts
index df4835d1b..4908f7725 100644
--- a/tools/tauri-menu/tests/artifacts.test.ts
+++ b/tools/generate/tauri-menu/tests/artifacts.test.ts
@@ -2,7 +2,7 @@ import { expect, test } from 'bun:test'
import { readFile } from 'node:fs/promises'
import { join } from 'node:path'
-import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts'
+import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts-tools'
import { MENU_ARTIFACTS } from '../src/menu'
diff --git a/tools/visual-oracles/package.json b/tools/generate/visual-oracles/package.json
similarity index 81%
rename from tools/visual-oracles/package.json
rename to tools/generate/visual-oracles/package.json
index ac311d8a4..4812b8c53 100644
--- a/tools/visual-oracles/package.json
+++ b/tools/generate/visual-oracles/package.json
@@ -1,5 +1,5 @@
{
- "name": "@open-pencil/visual-oracle-tools",
+ "name": "@open-pencil/visual-oracles-tools",
"private": true,
"type": "module",
"imports": {
diff --git a/tools/visual-oracles/src/cli.ts b/tools/generate/visual-oracles/src/cli.ts
similarity index 79%
rename from tools/visual-oracles/src/cli.ts
rename to tools/generate/visual-oracles/src/cli.ts
index 16ea41b3f..a5072532e 100644
--- a/tools/visual-oracles/src/cli.ts
+++ b/tools/generate/visual-oracles/src/cli.ts
@@ -12,18 +12,18 @@ const main = defineCommand({
bisect: operationCommand(
'bisect',
'Bisect page children to isolate visual differences',
- 'tools/visual-oracles/src/operations/bisect.ts'
+ 'tools/generate/visual-oracles/src/operations/bisect.ts'
),
'export-fixtures': operationCommand(
'export-fixtures',
'Export configured OpenPencil fixture images',
- 'tools/visual-oracles/src/operations/export-fixtures.ts'
+ 'tools/generate/visual-oracles/src/operations/export-fixtures.ts'
),
analyze: () => import('./commands/analyze').then((module) => module.default),
'update-report': operationCommand(
'update-report',
'Update the visual comparison report',
- 'tools/visual-oracles/src/operations/update-report.ts'
+ 'tools/generate/visual-oracles/src/operations/update-report.ts'
)
}
})
diff --git a/tools/visual-oracles/src/commands/analyze.ts b/tools/generate/visual-oracles/src/commands/analyze.ts
similarity index 74%
rename from tools/visual-oracles/src/commands/analyze.ts
rename to tools/generate/visual-oracles/src/commands/analyze.ts
index 516645b2b..98264b304 100644
--- a/tools/visual-oracles/src/commands/analyze.ts
+++ b/tools/generate/visual-oracles/src/commands/analyze.ts
@@ -8,12 +8,12 @@ export default defineCommand({
pattern: operationCommand(
'pattern',
'Analyze pattern-paint oracle captures',
- 'tools/visual-oracles/src/operations/analyze-pattern.ts'
+ 'tools/generate/visual-oracles/src/operations/analyze-pattern.ts'
),
'text-decoration': operationCommand(
'text-decoration',
'Analyze text-decoration oracle captures',
- 'tools/visual-oracles/src/operations/analyze-text-decoration.ts'
+ 'tools/generate/visual-oracles/src/operations/analyze-text-decoration.ts'
)
}
})
diff --git a/tools/visual-oracles/src/commands/compare.ts b/tools/generate/visual-oracles/src/commands/compare.ts
similarity index 76%
rename from tools/visual-oracles/src/commands/compare.ts
rename to tools/generate/visual-oracles/src/commands/compare.ts
index 30e77100a..333e5202f 100644
--- a/tools/visual-oracles/src/commands/compare.ts
+++ b/tools/generate/visual-oracles/src/commands/compare.ts
@@ -8,12 +8,12 @@ export default defineCommand({
node: operationCommand(
'node',
'Compare one Figma node or clipboard selection',
- 'tools/visual-oracles/src/operations/compare-node.ts'
+ 'tools/generate/visual-oracles/src/operations/compare-node.ts'
),
document: operationCommand(
'document',
'Compare exact imported-document targets from a manifest',
- 'tools/visual-oracles/src/operations/compare-document.ts'
+ 'tools/generate/visual-oracles/src/operations/compare-document.ts'
)
}
})
diff --git a/tools/visual-oracles/src/commands/operation.ts b/tools/generate/visual-oracles/src/commands/operation.ts
similarity index 100%
rename from tools/visual-oracles/src/commands/operation.ts
rename to tools/generate/visual-oracles/src/commands/operation.ts
diff --git a/tools/visual-oracles/src/document/manifest.ts b/tools/generate/visual-oracles/src/document/manifest.ts
similarity index 100%
rename from tools/visual-oracles/src/document/manifest.ts
rename to tools/generate/visual-oracles/src/document/manifest.ts
diff --git a/tools/visual-oracles/src/image/pixel-image.ts b/tools/generate/visual-oracles/src/image/pixel-image.ts
similarity index 100%
rename from tools/visual-oracles/src/image/pixel-image.ts
rename to tools/generate/visual-oracles/src/image/pixel-image.ts
diff --git a/tools/visual-oracles/src/operations/analyze-pattern.ts b/tools/generate/visual-oracles/src/operations/analyze-pattern.ts
similarity index 98%
rename from tools/visual-oracles/src/operations/analyze-pattern.ts
rename to tools/generate/visual-oracles/src/operations/analyze-pattern.ts
index 359a8a866..0e8b96a9e 100644
--- a/tools/visual-oracles/src/operations/analyze-pattern.ts
+++ b/tools/generate/visual-oracles/src/operations/analyze-pattern.ts
@@ -115,6 +115,7 @@ async function loadImage(path: string): Promise<PixelImage> {
})
image.delete()
if (!pixels) throw new Error(`Failed to read pixels from ${path}`)
+ if (!(pixels instanceof Uint8Array)) throw new Error(`Expected 8-bit RGBA pixels in ${path}`)
return { width, height, pixels }
}
diff --git a/tools/visual-oracles/src/operations/analyze-text-decoration.ts b/tools/generate/visual-oracles/src/operations/analyze-text-decoration.ts
similarity index 97%
rename from tools/visual-oracles/src/operations/analyze-text-decoration.ts
rename to tools/generate/visual-oracles/src/operations/analyze-text-decoration.ts
index 4f8d9f570..6d378b2e8 100644
--- a/tools/visual-oracles/src/operations/analyze-text-decoration.ts
+++ b/tools/generate/visual-oracles/src/operations/analyze-text-decoration.ts
@@ -65,6 +65,7 @@ async function loadImage(path: string): Promise<PixelImage> {
})
image.delete()
if (!pixels) throw new Error(`Failed to read pixels from ${path}`)
+ if (!(pixels instanceof Uint8Array)) throw new Error(`Expected 8-bit RGBA pixels in ${path}`)
return { width, height, pixels }
}
diff --git a/tools/visual-oracles/src/operations/bisect.ts b/tools/generate/visual-oracles/src/operations/bisect.ts
similarity index 95%
rename from tools/visual-oracles/src/operations/bisect.ts
rename to tools/generate/visual-oracles/src/operations/bisect.ts
index e12ac37d9..09beeb4cb 100644
--- a/tools/visual-oracles/src/operations/bisect.ts
+++ b/tools/generate/visual-oracles/src/operations/bisect.ts
@@ -48,7 +48,7 @@ const { values, positionals } = parseArgs({
const figPath = positionals[0]
if (!figPath || !values.page || !values['figma-page-id']) {
console.error(`Usage:
- bun tools/visual-oracles/src/cli.ts bisect <file.fig> --page Primitives --figma-page-id 1:22 [options]
+ bun tools/generate/visual-oracles/src/cli.ts bisect <file.fig> --page Primitives --figma-page-id 1:22 [options]
Options:
--output DIR Output directory (default: /tmp/open-pencil-visual-bisect)
@@ -87,6 +87,9 @@ const rootNodeId = values['root-node-id'] ?? page.id
const figmaRootId = values['figma-root-id'] ?? figmaPageId
const rootNode = graph.getNode(rootNodeId)
if (!rootNode) throw new Error(`Root node not found in .fig: ${rootNodeId}`)
+const pageId = page.id
+const rootId = rootNode.id
+const rootIsCanvas = rootNode.type === 'CANVAS'
const childIds = [...rootNode.childIds]
const childNames = childIds.map((id) => graph.getNode(id)?.name ?? id)
@@ -176,9 +179,8 @@ async function exportOpenPencilSubset(indices: number[], path: string): Promise<
}
try {
- const nodeIds =
- rootNode.type === 'CANVAS' ? indices.map((index) => childIds[index]) : [rootNode.id]
- const data = await headlessRenderNodes(graph, page.id, nodeIds, {
+ const nodeIds = rootIsCanvas ? indices.map((index) => childIds[index]) : [rootId]
+ const data = await headlessRenderNodes(graph, pageId, nodeIds, {
scale,
format: 'PNG',
trimTransparent: nodeIds.every((id) => graph.getNode(id)?.type === 'TEXT')
@@ -247,6 +249,9 @@ async function diffImages(expectedPath: string, actualPath: string): Promise<Dif
const expectedPixels = expected.readPixels(0, 0, imageInfo)
const actualPixels = actual.readPixels(0, 0, imageInfo)
if (!expectedPixels || !actualPixels) throw new Error('Failed to read image pixels')
+ if (!(expectedPixels instanceof Uint8Array) || !(actualPixels instanceof Uint8Array)) {
+ throw new Error('Expected 8-bit RGBA image pixels')
+ }
let sum = 0
let above5 = 0
diff --git a/tools/visual-oracles/src/operations/compare-document.ts b/tools/generate/visual-oracles/src/operations/compare-document.ts
similarity index 96%
rename from tools/visual-oracles/src/operations/compare-document.ts
rename to tools/generate/visual-oracles/src/operations/compare-document.ts
index 5ba85625b..7929ec023 100644
--- a/tools/visual-oracles/src/operations/compare-document.ts
+++ b/tools/generate/visual-oracles/src/operations/compare-document.ts
@@ -20,7 +20,7 @@ const { values, positionals } = parseArgs({
const manifestPath = positionals[0]
if (!manifestPath) {
console.error(
- 'Usage: bun tools/visual-oracles/src/cli.ts compare document manifest.json [--output DIR]'
+ 'Usage: bun tools/generate/visual-oracles/src/cli.ts compare document manifest.json [--output DIR]'
)
process.exit(1)
}
@@ -37,7 +37,7 @@ const context = await browser.newContext({
const page = await context.newPage()
const documentPath = '/__visual-oracle-document.fig'
await page.route(`**${documentPath}`, (route) =>
- route.fulfill({ status: 200, contentType: 'application/octet-stream', body: bytes })
+ route.fulfill({ status: 200, contentType: 'application/octet-stream', body: Buffer.from(bytes) })
)
let failed = false
@@ -145,11 +145,9 @@ async function captureOpenPencilTarget(
const pageRoots = store.graph.getChildren(pageNode.id)
const node = target.openPencilNodeId
? store.graph.getNode(target.openPencilNodeId)
- : store.graph
- .getAllNodes()
- .find(
- (candidate) => candidate.name === target.node && candidate.parentId === pageNode.id
- )
+ : [...store.graph.getAllNodes()].find(
+ (candidate) => candidate.name === target.node && candidate.parentId === pageNode.id
+ )
if (!node || node.parentId !== pageNode.id) {
throw new Error(`OpenPencil node missing from page: ${target.page} / ${target.node}`)
}
diff --git a/tools/visual-oracles/src/operations/compare-node.ts b/tools/generate/visual-oracles/src/operations/compare-node.ts
similarity index 98%
rename from tools/visual-oracles/src/operations/compare-node.ts
rename to tools/generate/visual-oracles/src/operations/compare-node.ts
index 3f39c48a9..9446f3628 100644
--- a/tools/visual-oracles/src/operations/compare-node.ts
+++ b/tools/generate/visual-oracles/src/operations/compare-node.ts
@@ -3,10 +3,10 @@
* Visual comparison pipeline: Figma vs OpenPencil renderer.
*
* Copy an element in Figma, then run:
- * bun tools/visual-oracles/src/cli.ts compare node [--scale 2] [--output /tmp/visual-compare]
+ * bun tools/generate/visual-oracles/src/cli.ts compare node [--scale 2] [--output /tmp/visual-compare]
*
* Or pass a node ID directly (skips clipboard):
- * bun tools/visual-oracles/src/cli.ts compare node --node 1:23 [--scale 2]
+ * bun tools/generate/visual-oracles/src/cli.ts compare node --node 1:23 [--scale 2]
*
* Outputs:
* figma.png — exported from real Figma
diff --git a/tools/visual-oracles/src/operations/export-fixtures.ts b/tools/generate/visual-oracles/src/operations/export-fixtures.ts
similarity index 100%
rename from tools/visual-oracles/src/operations/export-fixtures.ts
rename to tools/generate/visual-oracles/src/operations/export-fixtures.ts
diff --git a/tools/visual-oracles/src/operations/update-report.ts b/tools/generate/visual-oracles/src/operations/update-report.ts
similarity index 100%
rename from tools/visual-oracles/src/operations/update-report.ts
rename to tools/generate/visual-oracles/src/operations/update-report.ts
diff --git a/tools/visual-oracles/tests/cli.test.ts b/tools/generate/visual-oracles/tests/cli.test.ts
similarity index 100%
rename from tools/visual-oracles/tests/cli.test.ts
rename to tools/generate/visual-oracles/tests/cli.test.ts
diff --git a/tools/visual-oracles/tests/document/manifest.test.ts b/tools/generate/visual-oracles/tests/document/manifest.test.ts
similarity index 100%
rename from tools/visual-oracles/tests/document/manifest.test.ts
rename to tools/generate/visual-oracles/tests/document/manifest.test.ts
diff --git a/tools/lint/tsconfig.json b/tools/lint/tsconfig.json
deleted file mode 100644
index ff0223de9..000000000
--- a/tools/lint/tsconfig.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "extends": "../../tsconfig.json",
- "compilerOptions": {
- "types": ["node"],
- "noEmit": true,
- "paths": {
- "#lint/*": ["./src/*"]
- }
- },
- "include": ["src/**/*.ts"]
-}
diff --git a/tools/package-quality/tests/cli.test.ts b/tools/package-quality/tests/cli.test.ts
deleted file mode 100644
index dcf29e9c5..000000000
--- a/tools/package-quality/tests/cli.test.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { describe, expect, test } from 'bun:test'
-
-import { checkCommand, smokeCommand, verifyCommand } from '#package-quality/commands'
-import { renderUsage } from 'citty'
-
-describe('package quality commands', () => {
- test('exposes stable check, smoke, and verify workflows', async () => {
- expect(checkCommand.meta?.name).toBe('check')
- expect(smokeCommand.meta?.name).toBe('smoke')
- expect(verifyCommand.meta?.name).toBe('verify')
- expect(await renderUsage(verifyCommand)).toContain('built-package smoke tests')
- })
-})
diff --git a/tools/package.json b/tools/package.json
new file mode 100644
index 000000000..56bd33aa2
--- /dev/null
+++ b/tools/package.json
@@ -0,0 +1,10 @@
+{
+ "name": "@open-pencil/tools",
+ "private": true,
+ "type": "module",
+ "devDependencies": {
+ "@types/bun": "^1.3.14",
+ "@types/mdast": "^4.0.4",
+ "@types/node": "^25.9.5"
+ }
+}
diff --git a/tools/pr-review-guidance/package.json b/tools/pr-review-guidance/package.json
deleted file mode 100644
index 41a845347..000000000
--- a/tools/pr-review-guidance/package.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "name": "@open-pencil/pr-review-guidance",
- "private": true,
- "type": "module",
- "scripts": {
- "test": "bun test tests"
- }
-}
diff --git a/tools/package-artifacts/package.json b/tools/release/package-artifacts/package.json
similarity index 90%
rename from tools/package-artifacts/package.json
rename to tools/release/package-artifacts/package.json
index 54904492e..f9af48f6c 100644
--- a/tools/package-artifacts/package.json
+++ b/tools/release/package-artifacts/package.json
@@ -1,5 +1,5 @@
{
- "name": "@open-pencil/package-artifacts",
+ "name": "@open-pencil/package-artifacts-tools",
"private": true,
"type": "module",
"imports": {
diff --git a/tools/package-artifacts/src/build.ts b/tools/release/package-artifacts/src/build.ts
similarity index 100%
rename from tools/package-artifacts/src/build.ts
rename to tools/release/package-artifacts/src/build.ts
diff --git a/tools/package-artifacts/src/index.ts b/tools/release/package-artifacts/src/index.ts
similarity index 100%
rename from tools/package-artifacts/src/index.ts
rename to tools/release/package-artifacts/src/index.ts
diff --git a/tools/package-artifacts/src/json.ts b/tools/release/package-artifacts/src/json.ts
similarity index 100%
rename from tools/package-artifacts/src/json.ts
rename to tools/release/package-artifacts/src/json.ts
diff --git a/tools/package-artifacts/src/manifest/exports.ts b/tools/release/package-artifacts/src/manifest/exports.ts
similarity index 100%
rename from tools/package-artifacts/src/manifest/exports.ts
rename to tools/release/package-artifacts/src/manifest/exports.ts
diff --git a/tools/package-artifacts/src/manifest/read.ts b/tools/release/package-artifacts/src/manifest/read.ts
similarity index 100%
rename from tools/package-artifacts/src/manifest/read.ts
rename to tools/release/package-artifacts/src/manifest/read.ts
diff --git a/tools/package-artifacts/src/manifest/schema.ts b/tools/release/package-artifacts/src/manifest/schema.ts
similarity index 100%
rename from tools/package-artifacts/src/manifest/schema.ts
rename to tools/release/package-artifacts/src/manifest/schema.ts
diff --git a/tools/package-artifacts/src/manifest/types.ts b/tools/release/package-artifacts/src/manifest/types.ts
similarity index 100%
rename from tools/package-artifacts/src/manifest/types.ts
rename to tools/release/package-artifacts/src/manifest/types.ts
diff --git a/tools/package-artifacts/src/npm/pack.ts b/tools/release/package-artifacts/src/npm/pack.ts
similarity index 100%
rename from tools/package-artifacts/src/npm/pack.ts
rename to tools/release/package-artifacts/src/npm/pack.ts
diff --git a/tools/package-artifacts/src/npm/registry.ts b/tools/release/package-artifacts/src/npm/registry.ts
similarity index 100%
rename from tools/package-artifacts/src/npm/registry.ts
rename to tools/release/package-artifacts/src/npm/registry.ts
diff --git a/tools/package-artifacts/src/process.ts b/tools/release/package-artifacts/src/process.ts
similarity index 100%
rename from tools/package-artifacts/src/process.ts
rename to tools/release/package-artifacts/src/process.ts
diff --git a/tools/package-artifacts/src/tarball.ts b/tools/release/package-artifacts/src/tarball.ts
similarity index 100%
rename from tools/package-artifacts/src/tarball.ts
rename to tools/release/package-artifacts/src/tarball.ts
diff --git a/tools/package-artifacts/src/workspace/catalog.ts b/tools/release/package-artifacts/src/workspace/catalog.ts
similarity index 100%
rename from tools/package-artifacts/src/workspace/catalog.ts
rename to tools/release/package-artifacts/src/workspace/catalog.ts
diff --git a/tools/package-artifacts/src/workspace/root.ts b/tools/release/package-artifacts/src/workspace/root.ts
similarity index 100%
rename from tools/package-artifacts/src/workspace/root.ts
rename to tools/release/package-artifacts/src/workspace/root.ts
diff --git a/tools/package-artifacts/src/workspace/schema.ts b/tools/release/package-artifacts/src/workspace/schema.ts
similarity index 100%
rename from tools/package-artifacts/src/workspace/schema.ts
rename to tools/release/package-artifacts/src/workspace/schema.ts
diff --git a/tools/package-artifacts/tests/catalog.test.ts b/tools/release/package-artifacts/tests/catalog.test.ts
similarity index 100%
rename from tools/package-artifacts/tests/catalog.test.ts
rename to tools/release/package-artifacts/tests/catalog.test.ts
diff --git a/tools/package-artifacts/tests/exports.test.ts b/tools/release/package-artifacts/tests/exports.test.ts
similarity index 100%
rename from tools/package-artifacts/tests/exports.test.ts
rename to tools/release/package-artifacts/tests/exports.test.ts
diff --git a/tools/package-artifacts/tests/npm-output.test.ts b/tools/release/package-artifacts/tests/npm-output.test.ts
similarity index 100%
rename from tools/package-artifacts/tests/npm-output.test.ts
rename to tools/release/package-artifacts/tests/npm-output.test.ts
diff --git a/tools/package-artifacts/tests/process.test.ts b/tools/release/package-artifacts/tests/process.test.ts
similarity index 100%
rename from tools/package-artifacts/tests/process.test.ts
rename to tools/release/package-artifacts/tests/process.test.ts
diff --git a/tools/package-artifacts/tests/root.test.ts b/tools/release/package-artifacts/tests/root.test.ts
similarity index 100%
rename from tools/package-artifacts/tests/root.test.ts
rename to tools/release/package-artifacts/tests/root.test.ts
diff --git a/tools/package-artifacts/tests/schemas.test.ts b/tools/release/package-artifacts/tests/schemas.test.ts
similarity index 100%
rename from tools/package-artifacts/tests/schemas.test.ts
rename to tools/release/package-artifacts/tests/schemas.test.ts
diff --git a/tools/package-artifacts/tests/tarball.test.ts b/tools/release/package-artifacts/tests/tarball.test.ts
similarity index 100%
rename from tools/package-artifacts/tests/tarball.test.ts
rename to tools/release/package-artifacts/tests/tarball.test.ts
diff --git a/tools/package-artifacts/tests/workspace-identity.test.ts b/tools/release/package-artifacts/tests/workspace-identity.test.ts
similarity index 100%
rename from tools/package-artifacts/tests/workspace-identity.test.ts
rename to tools/release/package-artifacts/tests/workspace-identity.test.ts
diff --git a/tools/release-packages/README.md b/tools/release/release-packages/README.md
similarity index 100%
rename from tools/release-packages/README.md
rename to tools/release/release-packages/README.md
diff --git a/tools/release-packages/package.json b/tools/release/release-packages/package.json
similarity index 84%
rename from tools/release-packages/package.json
rename to tools/release/release-packages/package.json
index 5bb5ef667..4d9af6921 100644
--- a/tools/release-packages/package.json
+++ b/tools/release/release-packages/package.json
@@ -1,5 +1,5 @@
{
- "name": "@open-pencil/release-packages",
+ "name": "@open-pencil/release-packages-tools",
"private": true,
"type": "module",
"imports": {
@@ -14,7 +14,7 @@
"test": "bun test tests"
},
"dependencies": {
- "@open-pencil/package-artifacts": "workspace:*",
+ "@open-pencil/package-artifacts-tools": "workspace:*",
"@open-pencil/package-quality-tools": "workspace:*",
"citty": "^0.1.6",
"es-toolkit": "^1.51.0",
diff --git a/tools/release-packages/src/changelog.ts b/tools/release/release-packages/src/changelog.ts
similarity index 100%
rename from tools/release-packages/src/changelog.ts
rename to tools/release/release-packages/src/changelog.ts
diff --git a/tools/release-packages/src/check-changelog.ts b/tools/release/release-packages/src/check-changelog.ts
similarity index 100%
rename from tools/release-packages/src/check-changelog.ts
rename to tools/release/release-packages/src/check-changelog.ts
diff --git a/tools/release-packages/src/cli.ts b/tools/release/release-packages/src/cli.ts
similarity index 99%
rename from tools/release-packages/src/cli.ts
rename to tools/release/release-packages/src/cli.ts
index 5f638c2fc..2580e40a3 100644
--- a/tools/release-packages/src/cli.ts
+++ b/tools/release/release-packages/src/cli.ts
@@ -2,7 +2,7 @@
import { defineCommand, runMain } from 'citty'
-import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts'
+import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts-tools'
import {
buildReleasePackages,
diff --git a/tools/release-packages/src/extract-release-notes.ts b/tools/release/release-packages/src/extract-release-notes.ts
similarity index 100%
rename from tools/release-packages/src/extract-release-notes.ts
rename to tools/release/release-packages/src/extract-release-notes.ts
diff --git a/tools/release-packages/src/native/artifacts.ts b/tools/release/release-packages/src/native/artifacts.ts
similarity index 100%
rename from tools/release-packages/src/native/artifacts.ts
rename to tools/release/release-packages/src/native/artifacts.ts
diff --git a/tools/release-packages/src/native/assemble.ts b/tools/release/release-packages/src/native/assemble.ts
similarity index 100%
rename from tools/release-packages/src/native/assemble.ts
rename to tools/release/release-packages/src/native/assemble.ts
diff --git a/tools/release-packages/src/native/catalog.ts b/tools/release/release-packages/src/native/catalog.ts
similarity index 100%
rename from tools/release-packages/src/native/catalog.ts
rename to tools/release/release-packages/src/native/catalog.ts
diff --git a/tools/release-packages/src/native/collect.ts b/tools/release/release-packages/src/native/collect.ts
similarity index 100%
rename from tools/release-packages/src/native/collect.ts
rename to tools/release/release-packages/src/native/collect.ts
diff --git a/tools/release-packages/src/native/commands.ts b/tools/release/release-packages/src/native/commands.ts
similarity index 93%
rename from tools/release-packages/src/native/commands.ts
rename to tools/release/release-packages/src/native/commands.ts
index e0b0b05d0..87f56077a 100644
--- a/tools/release-packages/src/native/commands.ts
+++ b/tools/release/release-packages/src/native/commands.ts
@@ -1,4 +1,4 @@
-import { runCommand } from '@open-pencil/package-artifacts'
+import { runCommand } from '@open-pencil/package-artifacts-tools'
const METADATA_TIMEOUT_MS = 60_000
export const ARTIFACT_TRANSFER_TIMEOUT_MS = 15 * 60_000
diff --git a/tools/release-packages/src/native/context.ts b/tools/release/release-packages/src/native/context.ts
similarity index 100%
rename from tools/release-packages/src/native/context.ts
rename to tools/release/release-packages/src/native/context.ts
diff --git a/tools/release-packages/src/native/draft.ts b/tools/release/release-packages/src/native/draft.ts
similarity index 100%
rename from tools/release-packages/src/native/draft.ts
rename to tools/release/release-packages/src/native/draft.ts
diff --git a/tools/release-packages/src/native/frontend.ts b/tools/release/release-packages/src/native/frontend.ts
similarity index 99%
rename from tools/release-packages/src/native/frontend.ts
rename to tools/release/release-packages/src/native/frontend.ts
index aa4eb7a68..31c162354 100644
--- a/tools/release-packages/src/native/frontend.ts
+++ b/tools/release/release-packages/src/native/frontend.ts
@@ -1,7 +1,7 @@
import { writeFile } from 'node:fs/promises'
import { join } from 'node:path'
-import { readPackageManifest } from '@open-pencil/package-artifacts'
+import { readPackageManifest } from '@open-pencil/package-artifacts-tools'
import { releaseCommands } from './commands.ts'
import { createReleaseContext } from './context.ts'
diff --git a/tools/release-packages/src/native/manifest.ts b/tools/release/release-packages/src/native/manifest.ts
similarity index 100%
rename from tools/release-packages/src/native/manifest.ts
rename to tools/release/release-packages/src/native/manifest.ts
diff --git a/tools/release-packages/src/native/publish.ts b/tools/release/release-packages/src/native/publish.ts
similarity index 100%
rename from tools/release-packages/src/native/publish.ts
rename to tools/release/release-packages/src/native/publish.ts
diff --git a/tools/release-packages/src/native/resolve.ts b/tools/release/release-packages/src/native/resolve.ts
similarity index 100%
rename from tools/release-packages/src/native/resolve.ts
rename to tools/release/release-packages/src/native/resolve.ts
diff --git a/tools/release-packages/src/policy.ts b/tools/release/release-packages/src/policy.ts
similarity index 100%
rename from tools/release-packages/src/policy.ts
rename to tools/release/release-packages/src/policy.ts
diff --git a/tools/release-packages/src/publish-dirs.ts b/tools/release/release-packages/src/publish-dirs.ts
similarity index 99%
rename from tools/release-packages/src/publish-dirs.ts
rename to tools/release/release-packages/src/publish-dirs.ts
index a403e577c..da58c12d6 100644
--- a/tools/release-packages/src/publish-dirs.ts
+++ b/tools/release/release-packages/src/publish-dirs.ts
@@ -9,7 +9,7 @@ import {
runCommand,
type PackageManifest,
type WorkspacePackage
-} from '@open-pencil/package-artifacts'
+} from '@open-pencil/package-artifacts-tools'
import { NPM_RELEASE_POLICY } from './policy'
diff --git a/tools/release-packages/src/release-notes.ts b/tools/release/release-packages/src/release-notes.ts
similarity index 100%
rename from tools/release-packages/src/release-notes.ts
rename to tools/release/release-packages/src/release-notes.ts
diff --git a/tools/release-packages/src/workflow.ts b/tools/release/release-packages/src/workflow.ts
similarity index 98%
rename from tools/release-packages/src/workflow.ts
rename to tools/release/release-packages/src/workflow.ts
index b3042c1df..e3fc56bda 100644
--- a/tools/release-packages/src/workflow.ts
+++ b/tools/release/release-packages/src/workflow.ts
@@ -12,8 +12,11 @@ import {
readPackageManifest,
runCommand,
type WorkspacePackage
-} from '@open-pencil/package-artifacts'
-import { inspectTarball, validatePackedTarballs } from '@open-pencil/package-artifacts/tarball'
+} from '@open-pencil/package-artifacts-tools'
+import {
+ inspectTarball,
+ validatePackedTarballs
+} from '@open-pencil/package-artifacts-tools/tarball'
import { verifyArtifactConsumers } from '@open-pencil/package-quality-tools/consumer'
import { NPM_RELEASE_POLICY } from './policy'
diff --git a/tools/release-packages/tests/changelog.test.ts b/tools/release/release-packages/tests/changelog.test.ts
similarity index 100%
rename from tools/release-packages/tests/changelog.test.ts
rename to tools/release/release-packages/tests/changelog.test.ts
diff --git a/tools/release-packages/tests/native/artifacts.test.ts b/tools/release/release-packages/tests/native/artifacts.test.ts
similarity index 100%
rename from tools/release-packages/tests/native/artifacts.test.ts
rename to tools/release/release-packages/tests/native/artifacts.test.ts
diff --git a/tools/release-packages/tests/native/context.test.ts b/tools/release/release-packages/tests/native/context.test.ts
similarity index 99%
rename from tools/release-packages/tests/native/context.test.ts
rename to tools/release/release-packages/tests/native/context.test.ts
index 9da919edf..e8cbafda1 100644
--- a/tools/release-packages/tests/native/context.test.ts
+++ b/tools/release/release-packages/tests/native/context.test.ts
@@ -6,7 +6,7 @@ import { ARTIFACT_TRANSFER_TIMEOUT_MS, releaseCommands } from '#release/native/c
import { createReleaseContext, releaseVersion } from '#release/native/context'
import { releasePaths } from '#release/workflow'
-import type { CommandRequest } from '@open-pencil/package-artifacts'
+import type { CommandRequest } from '@open-pencil/package-artifacts-tools'
const environment = {
RELEASE_TAG: 'v0.15.0',
diff --git a/tools/release-packages/tests/native/draft.test.ts b/tools/release/release-packages/tests/native/draft.test.ts
similarity index 100%
rename from tools/release-packages/tests/native/draft.test.ts
rename to tools/release/release-packages/tests/native/draft.test.ts
diff --git a/tools/release-packages/tests/native/frontend.test.ts b/tools/release/release-packages/tests/native/frontend.test.ts
similarity index 100%
rename from tools/release-packages/tests/native/frontend.test.ts
rename to tools/release/release-packages/tests/native/frontend.test.ts
diff --git a/tools/release-packages/tests/native/manifest.test.ts b/tools/release/release-packages/tests/native/manifest.test.ts
similarity index 100%
rename from tools/release-packages/tests/native/manifest.test.ts
rename to tools/release/release-packages/tests/native/manifest.test.ts
diff --git a/tools/release-packages/tests/publication.test.ts b/tools/release/release-packages/tests/publication.test.ts
similarity index 100%
rename from tools/release-packages/tests/publication.test.ts
rename to tools/release/release-packages/tests/publication.test.ts
diff --git a/tools/release-packages/tests/publish-dirs.test.ts b/tools/release/release-packages/tests/publish-dirs.test.ts
similarity index 97%
rename from tools/release-packages/tests/publish-dirs.test.ts
rename to tools/release/release-packages/tests/publish-dirs.test.ts
index 02221410c..3f5426b3e 100644
--- a/tools/release-packages/tests/publish-dirs.test.ts
+++ b/tools/release/release-packages/tests/publish-dirs.test.ts
@@ -42,11 +42,12 @@ async function fixtureRoot({ rootLicense = true } = {}) {
describe('publishPackageJSON', () => {
test('rejects conflicting publication settings', () => {
- for (const publishConfig of [
+ const conflicts: Array<Record<string, string | boolean>> = [
{ access: 'restricted' },
{ provenance: false },
{ registry: 'https://other.invalid/' }
- ]) {
+ ]
+ for (const publishConfig of conflicts) {
expect(() =>
publishPackageJSON({ name: 'fixture', version: '1.0.0', publishConfig }, '1.0.0')
).toThrow('conflicts with the public npm release policy')
diff --git a/tools/release-packages/tests/release-notes.test.ts b/tools/release/release-packages/tests/release-notes.test.ts
similarity index 100%
rename from tools/release-packages/tests/release-notes.test.ts
rename to tools/release/release-packages/tests/release-notes.test.ts
diff --git a/tools/release-packages/tests/workflow.test.ts b/tools/release/release-packages/tests/workflow.test.ts
similarity index 98%
rename from tools/release-packages/tests/workflow.test.ts
rename to tools/release/release-packages/tests/workflow.test.ts
index f1070d34a..888034cae 100644
--- a/tools/release-packages/tests/workflow.test.ts
+++ b/tools/release/release-packages/tests/workflow.test.ts
@@ -13,7 +13,7 @@ import {
} from '#release/workflow'
import { createTarGzip } from 'nanotar'
-import { readTarball } from '@open-pencil/package-artifacts/tarball'
+import { readTarball } from '@open-pencil/package-artifacts-tools/tarball'
const FIXTURE_FILES = ['dist/index.js', 'dist/index.d.ts']
diff --git a/tools/secret-scan/package.json b/tools/secret-scan/package.json
deleted file mode 100644
index ff7609dfb..000000000
--- a/tools/secret-scan/package.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "name": "@open-pencil/tools-secret-scan",
- "version": "0.0.0",
- "private": true,
- "type": "module"
-}
diff --git a/tools/secret-scan/src/index.ts b/tools/secret-scan/src/index.ts
deleted file mode 100644
index 90da2f43d..000000000
--- a/tools/secret-scan/src/index.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-const GITLEAKS_VERSION = 'v8.30.1'
-const GITLEAKS_MODULE = `github.com/zricethezav/gitleaks/v8@${GITLEAKS_VERSION}`
-
-const gitleaksArgs = ['dir', '--config', '.gitleaks.toml', '--redact', '--no-banner', '.']
-
-function run(command: string, args: string[]): Bun.SpawnSyncReturns<Buffer> | null {
- try {
- return Bun.spawnSync([command, ...args], {
- stdout: 'inherit',
- stderr: 'inherit'
- })
- } catch (error) {
- if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
- return null
- }
- throw error
- }
-}
-
-const proc = run('gitleaks', gitleaksArgs) ?? run('go', ['run', GITLEAKS_MODULE, ...gitleaksArgs])
-
-if (!proc?.success) {
- console.error('Secret scan failed.')
- process.exit(proc?.exitCode || 1)
-}
-
-console.log('Secret scan passed.')
diff --git a/tools/test.ts b/tools/test.ts
deleted file mode 100644
index 71d562df3..000000000
--- a/tools/test.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { spawn } from 'node:child_process'
-import { readdir, readFile } from 'node:fs/promises'
-import { join } from 'node:path'
-
-interface PackageJSON {
- scripts?: Record<string, string>
-}
-
-async function run(command: string, args: string[], cwd: string): Promise<void> {
- await new Promise<void>((resolve, reject) => {
- const child = spawn(command, args, { cwd, stdio: 'inherit' })
- child.on('error', reject)
- child.on('exit', (code) => {
- if (code === 0) resolve()
- else reject(new Error(`${command} ${args.join(' ')} failed in ${cwd}`))
- })
- })
-}
-
-for (const entry of await readdir('tools', { withFileTypes: true })) {
- if (!entry.isDirectory()) continue
-
- const cwd = join('tools', entry.name)
- const packageJSON = JSON.parse(await readFile(join(cwd, 'package.json'), 'utf8')) as PackageJSON
- if (packageJSON.scripts?.test) await run('bun', ['test'], cwd)
-}
diff --git a/tools/tsconfig.json b/tools/tsconfig.json
new file mode 100644
index 000000000..fddc1ace8
--- /dev/null
+++ b/tools/tsconfig.json
@@ -0,0 +1,15 @@
+{
+ "extends": "../tsconfig.json",
+ "compilerOptions": {
+ "lib": ["ESNext", "DOM", "DOM.Iterable"],
+ "types": ["bun", "node"],
+ "noEmit": true
+ },
+ "include": [
+ "*/*/src/**/*.ts",
+ "*/*/tests/**/*.ts",
+ "../src/global.d.ts",
+ "../packages/core/src/global.d.ts",
+ "../packages/vue/src/global.d.ts"
+ ]
+}
diff --git a/tsconfig.json b/tsconfig.json
index 433ea1073..aa215c36c 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -21,8 +21,6 @@
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"paths": {
- "#authoring-reference/*": ["./tools/authoring-reference/src/*"],
- "#ci/*": ["./tools/ci/src/*"],
"#vite-config/*": ["./vite/*"],
"@/*": [
"./src/*"