Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

feat(cli): add opt-in strict checkJs typecheck command (#4275)

Joeyf70a9e34c00f
diff --git a/packages/cli/CONTRIBUTING.md b/packages/cli/CONTRIBUTING.md
index 08209a2054..e95ba8c4b3 100644
--- a/packages/cli/CONTRIBUTING.md
+++ b/packages/cli/CONTRIBUTING.md
@@ -292,3 +292,22 @@ if (!json) p.log.step('Running...');
- `.github/scripts/cli-json-smoke-test.mjs` validates every `--json` command outputs valid JSON with correct envelope shape
- `.github/scripts/api-cli-parity-test.mjs` verifies the programmatic API returns identical data to `xds --json` for every command
- All three run in the `cli-smoke-test.yml` workflow on every PR
+
+## Strict type-check (checkJs + JSDoc) — opt-in for now
+
+The CLI ships as hand-written `.mjs` (no build step) but is type-checked with
+TypeScript's `checkJs` against the JSDoc annotations in the source. `tsconfig.strict.json`
+runs the compiler over the **whole package** — `src`, `bin`, `scripts`, `docs`, and the
+emitted `templates` (including their `.tsx` source) — under full `strict`, including
+`noImplicitAny`, so an un-annotated parameter is an error.
+
+```bash
+pnpm build # once, so @astryxdesign/{core,charts,lab} dist types resolve
+pnpm -F @astryxdesign/cli typecheck:strict
+```
+
+This is **not yet wired into CI** — the tree still has known strict errors. It's available
+as a command so contributors can run it locally and so the remaining errors can be burned
+down in follow-up PRs. Once the tree is clean, a later PR will make it a required CI gate.
+(The emitted `templates/**/*.tsx` import built workspace packages, so run `pnpm build` first
+or you'll see spurious "cannot find module" errors from unbuilt `dist` output.)
diff --git a/packages/cli/package.json b/packages/cli/package.json
index 644a9ae660..a042471208 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -76,7 +76,8 @@
"astryx": "node bin/astryx.mjs",
"postinstall": "node scripts/postinstall.mjs",
"typecheck:template-docs": "tsc --project tsconfig.template-docs.json",
- "typecheck:json-api": "tsc --project tsconfig.json-api.json && tsc --project tsconfig.api-contract.json"
+ "typecheck:json-api": "tsc --project tsconfig.json-api.json && tsc --project tsconfig.api-contract.json",
+ "typecheck:strict": "tsc --project tsconfig.strict.json"
},
"dependencies": {
"commander": "^12.1.0",
diff --git a/packages/cli/tsconfig.strict.json b/packages/cli/tsconfig.strict.json
new file mode 100644
index 0000000000..05fa66519f
--- /dev/null
+++ b/packages/cli/tsconfig.strict.json
@@ -0,0 +1,22 @@
+{
+ "extends": "../../tsconfig.json",
+ "compilerOptions": {
+ "rootDir": "../..",
+ "allowJs": true,
+ "checkJs": true,
+ "noEmit": true,
+ "types": ["node"],
+ "strict": true
+ },
+ "include": [
+ "src/**/*.mjs",
+ "src/**/*.ts",
+ "bin/**/*.mjs",
+ "scripts/**/*.mjs",
+ "docs/**/*.mjs",
+ "templates/**/*.mjs",
+ "templates/**/*.ts",
+ "templates/**/*.tsx"
+ ],
+ "exclude": ["src/**/*.test.mjs"]
+}