diff --git a/.agents/skills/quality-remediation/SKILL.md b/.agents/skills/quality-remediation/SKILL.md new file mode 100644 index 0000000..b900ce4 --- /dev/null +++ b/.agents/skills/quality-remediation/SKILL.md @@ -0,0 +1,54 @@ +--- +name: quality-remediation +description: > + Use when workspace reliability defects appear as missing root packageManager + metadata, dead dependency peer warnings, fake lint coverage, or CI commands + that bypass the root workspace contract. +--- + +# Quality Remediation + +Fix reliability defects at the contract boundary instead of suppressing symptoms. + +## When to use this skill + +- Root workspace commands fail because package-manager metadata is missing. +- Install logs show peer warnings for libraries with no active imports. +- A package exposes a `lint` target but the workspace contract does not execute + a real static check. +- CI runs package-local commands that hide a broken root workspace path. +- Warning, lint, or security findings need removal by root cause. + +## Workflow + +1. Reproduce the failure or warning from the repo root. +2. Trace the contract boundary causing it: root manifest, package manifest, + compiler config, or workflow. +3. Confirm active imports before removing any dependency chain. +4. Remove dead config with the dead dependency, such as JSX settings after + `.tsx` sources disappear. +5. Make package lint commands execute a real static check. +6. Update CI to use the root workspace contract and derive tool versions from + canonical metadata. +7. Re-run install, lint, test, and build, then keep smoke paths that prove + packaged artifacts still work. + +## Quick checks + +- `bun run build` fails with missing `packageManager` -> add root + `packageManager` using the installed Bun version. +- `bun install` warns about Ink or React peers without imports -> remove the + unused dependency chain and refresh the lockfile. +- `bun run lint` is hollow -> add a package `lint` script that typechecks or + lints real sources. +- Workflow runs `cd packages/... && bun run build` while root build is broken + -> switch CI back to root `bun run` commands and keep smoke steps after + build. + +## Common mistakes + +- Pinning CI to `latest` instead of the root `packageManager` contract. +- Keeping dead dependencies because they were once planned for future + features. +- Leaving stale TS JSX config after the last `.tsx` file is gone. +- Treating warnings as acceptable background noise. diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fca41f0..4bbd1c5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,19 +25,22 @@ jobs: steps: - uses: actions/checkout@v4 - + - uses: oven-sh/setup-bun@v2 with: - bun-version: latest - + bun-version-file: package.json + - name: Install dependencies run: bun install + + - name: Run lint + run: bun run lint - - name: Run tests - run: bun test + - name: Run workspace tests + run: bun run test - - name: Build CLI - run: cd packages/cli && bun run build + - name: Run workspace build + run: bun run build - name: Node.js Smoke Test run: node packages/cli/dist/index.js lint examples/atmospheric-glass/DESIGN.md @@ -51,4 +54,3 @@ jobs: echo -e '---\ncolors:\n primary: "#0000ff"\n---' > DESIGN.md npx design.md lint DESIGN.md node -e "import('@google/design.md/linter').then(m => console.log('OK:', Object.keys(m).length, 'exports'))" - diff --git a/README.md b/README.md index c7d9f0b..2ddfda9 100644 --- a/README.md +++ b/README.md @@ -293,4 +293,4 @@ The DESIGN.md format is at version `alpha`. The spec, token schema, and CLI are ## Disclaimer This project is not eligible for the [Google Open Source Software Vulnerability -Rewards Program](https://bughunters.google.com/open-source-security). \ No newline at end of file +Rewards Program](https://bughunters.google.com/open-source-security). diff --git a/bun.lock b/bun.lock index 81516a9..167ca87 100644 --- a/bun.lock +++ b/bun.lock @@ -1,6 +1,5 @@ { "lockfileVersion": 1, - "configVersion": 1, "workspaces": { "": { "name": "design-monorepo", @@ -13,30 +12,29 @@ }, "packages/cli": { "name": "@google/design.md", - "version": "0.1.0", + "version": "0.1.1", "bin": { "design.md": "./dist/index.js", - "designmd": "./dist/index.js", }, "dependencies": { - "zod": "^3.24.0", - }, - "devDependencies": { - "@types/bun": "latest", - "@types/mdast": "^4.0.4", - "@types/node": "^20.11.24", - "bun-types": "^1.3.12", "citty": "^0.1.6", "mdast": "^3.0.0", "remark-frontmatter": "^5.0.0", "remark-mdx": "^3.1.1", "remark-parse": "^11.0.0", "remark-stringify": "^11.0.0", - "tailwindcss": "3", - "typescript": "^5.7.3", "unified": "^11.0.5", "unist-util-visit": "^5.1.0", "yaml": "^2.7.1", + "zod": "^3.24.0", + }, + "devDependencies": { + "@types/bun": "latest", + "@types/mdast": "^4.0.4", + "@types/node": "^20.11.24", + "bun-types": "^1.3.12", + "tailwindcss": "3", + "typescript": "^5.7.3", }, }, }, @@ -71,7 +69,7 @@ "@turbo/windows-arm64": ["@turbo/windows-arm64@2.9.6", "", { "os": "win32", "cpu": "arm64" }, "sha512-1XUUyWW0W6FTSqGEhU8RHVqb2wP1SPkr7hIvBlMEwH9jr+sJQK5kqeosLJ/QaUv4ecSAd1ZhIrLoW7qslAzT4A=="], - "@types/bun": ["@types/bun@1.3.12", "", { "dependencies": { "bun-types": "1.3.12" } }, "sha512-DBv81elK+/VSwXHDlnH3Qduw+KxkTIWi7TXkAeh24zpi5l0B2kUg9Ga3tb4nJaPcOFswflgi/yAvMVBPrxMB+A=="], + "@types/bun": ["@types/bun@1.3.13", "", { "dependencies": { "bun-types": "1.3.13" } }, "sha512-9fqXWk5YIHGGnUau9TEi+qdlTYDAnOj+xLCmSTwXfAIqXr2x4tytJb43E9uCvt09zJURKXwAtkoH4nLQfzeTXw=="], "@types/debug": ["@types/debug@4.1.13", "", { "dependencies": { "@types/ms": "*" } }, "sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw=="], @@ -393,8 +391,12 @@ "@google/design.md/@types/node": ["@types/node@20.19.39", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-orrrD74MBUyK8jOAD/r0+lfa1I2MO6I+vAkmAWzMYbCcgrN4lCrmK52gRFQq/JRxfYPfonkr4b0jcY7Olqdqbw=="], + "@google/design.md/bun-types": ["bun-types@1.3.13", "", { "dependencies": { "@types/node": "*" } }, "sha512-QXKeHLlOLqQX9LgYaHJfzdBaV21T63HhFJnvuRCcjZiaUDpbs5ED1MgxbMra71CsryN/1dAoXuJJJwIv/2drVA=="], + "@google/design.md/typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], + "@types/bun/bun-types": ["bun-types@1.3.13", "", { "dependencies": { "@types/node": "*" } }, "sha512-QXKeHLlOLqQX9LgYaHJfzdBaV21T63HhFJnvuRCcjZiaUDpbs5ED1MgxbMra71CsryN/1dAoXuJJJwIv/2drVA=="], + "chokidar/glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="], "fast-glob/glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="], @@ -404,5 +406,7 @@ "tinyglobby/picomatch": ["picomatch@4.0.4", "", {}, "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A=="], "@google/design.md/@types/node/undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="], + + "@google/design.md/bun-types/@types/node": ["@types/node@25.6.0", "", { "dependencies": { "undici-types": "~7.19.0" } }, "sha512-+qIYRKdNYJwY3vRCZMdJbPLJAtGjQBudzZzdzwQYkEPQd+PJGixUL5QfvCLDaULoLv+RhT3LDkwEfKaAkgSmNQ=="], } } diff --git a/docs/plans/2026-04-23-workspace-reliability-design.md b/docs/plans/2026-04-23-workspace-reliability-design.md new file mode 100644 index 0000000..8c994d7 --- /dev/null +++ b/docs/plans/2026-04-23-workspace-reliability-design.md @@ -0,0 +1,175 @@ +# Workspace Reliability and Interoperability Program Design + +## Goal + +Restore a trustworthy repository baseline for `design.md` so the active export +and interoperability roadmap can run without hidden build breakage, stale +dependency warnings, or CI-only workarounds. + +## Context + +This design captures the baseline `origin/main` failure state observed at the +start of this run and the first delivery slice needed to unblock the broader +interoperability roadmap. + +- At the start of this run, `bun run build` at the repo root failed because + Turbo could not resolve workspaces without a root `packageManager` field. +- At the start of this run, `bun run test` failed through the same missing root + contract. +- At the start of this run, `bun install` emitted + `warn: incorrect peer dependency "ink@7.0.1"` because the CLI package still + declared an Ink / React dependency chain that was not imported by the current + source tree. +- At the start of this run, `.github/workflows/test.yml` validated `bun test` + and `cd packages/cli && bun run build`, which masked the broken root build + contract instead of enforcing it. +- GitHub already has a canonical roadmap issue (#29) and a concrete blocker + issue (#30), but milestone and formal sub-issue metadata may still require + refresh or fallback documentation. + +## Constraints + +- Work from a fresh worktree created from the current default branch reference. +- Keep repo-facing artifacts in English. +- Do not wait for human review by default. +- Do not proactively summon a robot reviewer when the repository does not + appear to use one. +- Treat warnings, deprecations, lint findings, and security findings as + remediation targets rather than suppressing them. +- Consider Kubernetes and deployment surfaces explicitly, even if the result is + that none are present in the current repository. +- Keep the first slice small enough to merge autonomously from `origin/main`. + +## Candidate Approaches + +### Approach A — Baseline-first cleanup, then continue the roadmap (recommended) + +1. Refresh the issue program around the existing roadmap and blocker issues. +2. Fix the root build/test contract, remove the stale dependency warning, and + align CI with the repo-level contract. +3. Merge that blocker slice. +4. Re-scan the roadmap and continue with the next executable issue. + +#### Approach A pros + +- Smallest mergeable diff with direct operational value. +- Removes warning noise before feature work. +- Creates a reliable baseline for #15, #19, #27, and #28. + +#### Approach A cons + +- Delays direct feature delivery by one PR. + +### Approach B — Combine baseline cleanup with Tailwind v4 export work + +Implement the workspace cleanup and one export feature in the same branch. + +#### Approach B pros + +- Fewer PRs overall. +- Immediate user-facing feature delivery. + +#### Approach B cons + +- Larger diff, harder review, mixed responsibility. +- Harder to separate blocker remediation from feature regressions. + +### Approach C — Issue-program refresh only + +Refresh GitHub issues and milestone metadata without changing code. + +#### Approach C pros + +- Fastest GitHub housekeeping path. + +#### Approach C cons + +- Leaves the broken repo baseline and warning unresolved. +- Does not satisfy the requirement to fix warnings by root cause. + +## Recommendation + +Use **Approach A**. + +The strongest current-code concern is the broken root workspace contract. The +roadmap already has an explicit blocker issue (#30), and every downstream +interoperability change depends on being able to trust the repository baseline. + +## Proposed Issue Program Topology + +- **Milestone intent:** `Interop & Workspace Reliability` +- **Canonical meta issue:** #29 `Token interoperability roadmap` +- **Concrete blocker issue:** #30 `Restore root Bun/Turbo build contract and + remove stale Ink peer mismatch` +- **Related execution issues:** + - #15 CSS custom properties export + - #19 Tailwind v4 export support + - #28 DTCG `tokens.json` -> `DESIGN.md` +- **Cross-cutting issue:** + - #27 OKLCH color support + +Relationship intent: + +- #30 remains the first executable blocker under #29. +- #15, #19, and #28 remain direct roadmap children or explicitly linked + follow-up issues. +- #27 remains a cross-cutting spec/fidelity dependency rather than a hard + blocker for the baseline cleanup. +- If milestone or formal sub-issue wiring is unavailable from the current + account, the fallback is to record the same hierarchy in issue bodies and + comments. + +## Implementation Shape + +### Code changes + +- Add `packageManager` to the root `package.json` using the currently installed + Bun version. +- Remove unused CLI dependencies that trigger the Ink peer mismatch if the + source tree has no imports of them. +- Remove stale TS React / JSX compiler settings if no JSX sources remain. +- Add a package-level lint script so `bun run lint` becomes a meaningful static + check instead of a no-op workspace placeholder. +- Update CI so the workflow: + - reads Bun from the root `packageManager` contract, + - runs root workspace `test` and `build`, and + - preserves package smoke coverage. + +### Documentation changes + +- Record the investigation and execution plan under `docs/plans/`. +- Add a repo-local remediation skill for warning, lint, and security-class + defects observed during this run. + +### GitHub changes + +- Re-check milestone creation and issue-linking capabilities. +- Refresh #29 and #30 if the latest evidence or hierarchy wording changed. +- Create comments or issue-body relationship sections when first-class metadata + edges are unavailable. + +## Verification Strategy + +- `bun install` should complete without the Ink peer warning. +- `bun run lint` should execute a real package-level static check and pass. +- `bun run test` should pass from the repo root. +- `bun run build` should pass from the repo root. +- Built CLI smoke and tarball smoke should continue to pass. +- PR checks should validate the same root contract used locally. + +## Deployment / Runtime / Kubernetes Notes + +- No Kubernetes manifests, Helm charts, Dockerfiles, or runtime deployment + manifests are present in the current repository tree. +- Kubernetes is therefore considered explicitly and found to be out of direct + runtime scope for this slice. +- The relevant deployment surface here is CI, package build, tarball smoke, and + default-branch health after merge. + +## Decisions + +- Fix the workspace baseline before continuing feature delivery. +- Treat the peer warning as a dead-dependency / config drift problem unless code + inspection proves active runtime use. +- Keep the first PR scoped to repository reliability plus issue-program + maintenance. diff --git a/docs/plans/2026-04-23-workspace-reliability.md b/docs/plans/2026-04-23-workspace-reliability.md new file mode 100644 index 0000000..cf1c955 --- /dev/null +++ b/docs/plans/2026-04-23-workspace-reliability.md @@ -0,0 +1,253 @@ +# Workspace Reliability and Interoperability Implementation Plan + +> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to +> implement this plan task-by-task. + +**Goal:** Restore the root Bun/Turbo build contract, remove the stale Ink peer +warning, refresh the interoperability issue program, and deliver the change +through PR and merge. + +**Architecture:** Keep the diff focused on repository reliability. Use the +existing roadmap issue (#29) and blocker issue (#30) as the canonical GitHub +anchors, and keep feature delivery for #15 / #19 / #28 as follow-up work after +the baseline is repaired. + +**Tech Stack:** Bun, Turbo, TypeScript, GitHub Issues/PRs, GitHub Actions, +markdown docs. + +**Baseline note:** Any step that expects a failure or warning refers to the +`origin/main` snapshot captured before remediation in this worktree. + +--- + +## Task 1: Capture baseline evidence and current issue topology + +**Files:** + +- Create: `docs/plans/2026-04-23-workspace-reliability-design.md` +- Create: `docs/plans/2026-04-23-workspace-reliability.md` +- Read: `package.json` +- Read: `packages/cli/package.json` +- Read: `.github/workflows/test.yml` + +### Step 1: Reproduce the root build failure + +Run: `bun run build` + +Expected on the baseline snapshot: Turbo fails with `Missing packageManager` +field in `package.json`. + +### Step 2: Reproduce the root test failure + +Run: `bun run test` + +Expected on the baseline snapshot: Turbo fails through the same missing-root +contract path. + +### Step 3: Reproduce the install warning + +Run: `bun install` + +Expected on the baseline snapshot: Bun prints +`warn: incorrect peer dependency "ink@7.0.1"`. + +### Step 4: Confirm dependency use is absent + +Run repo search for `@json-render/ink`, `@json-render/core`, `ink`, and +`react` imports under `packages/cli/src`. + +Expected: No active runtime imports. + +### Step 5: Re-check the issue program + +Inspect #29, #30, #15, #19, #27, and #28 plus open PRs #20 and #21. + +Expected: #29 remains the canonical roadmap issue and #30 remains the first +executable blocker. + +## Task 2: Refresh GitHub milestone and hierarchy metadata + +**Files:** + +- Modify remotely via GitHub CLI only + +### Step 1: Attempt milestone creation + +Create milestone: `Interop & Workspace Reliability`. + +### Step 2: Re-check issue hierarchy support + +Attempt formal sub-issue or dependency wiring from #29 to #30, #15, #19, and +issue #28. + +### Step 3: Apply fallback documentation if metadata APIs fail + +Update issue bodies or add comments so the roadmap, blocker, related issues, +follow-ups, and blockers remain explicit. + +### Step 4: Verify the resulting issue program + +Run GitHub reads for the affected issues. + +Expected: hierarchy and sequencing are current, even if stored as text rather +than first-class metadata. + +## Task 3: Restore the root workspace contract + +**Files:** + +- Modify: `package.json` +- Modify: `.github/workflows/test.yml` + +### Step 1: Use the captured failing root build as the red state + +Run: `bun run build` + +Expected on the baseline snapshot: failure before the root manifest is fixed. + +### Step 2: Add the minimal root metadata + +Add the root `packageManager` field using the current Bun version. + +### Step 3: Re-run the root build + +Run: `bun run build` + +Expected: build succeeds. + +### Step 4: Update CI to use the same root contract + +Replace the package-local build invocation with root workspace `test` and +`build`, preserve smoke steps, and pin the workflow Bun version from the root +`packageManager` contract. + +## Task 4: Eliminate the stale Ink peer warning by root cause + +**Files:** + +- Modify: `packages/cli/package.json` +- Modify: `packages/cli/tsconfig.json` +- Modify: `bun.lock` + +### Step 1: Keep the captured warning as red evidence + +Run: `bun install` + +Expected on the baseline snapshot: incorrect peer dependency warning for Ink. + +### Step 2: Remove dead dependencies and stale TS config + +- Remove `@json-render/core`, `@json-render/ink`, `ink`, `react`, and + `@types/react` if unused. +- Remove `jsx: "react-jsx"` if no JSX files remain. + +### Step 3: Refresh the lockfile + +Run: `bun install` + +Expected: lockfile updates with no Ink peer warning. + +## Task 5: Make lint verification real and add the remediation skill + +**Files:** + +- Modify: `packages/cli/package.json` +- Create: `.agents/skills/quality-remediation/SKILL.md` + +### Step 1: Add a real package-level lint command + +Add the smallest static-check script that makes `bun run lint` meaningful for +the current TypeScript-only package. + +### Step 2: Write the remediation skill from the observed failures + +Cover: + +- missing `packageManager` causing Turbo workspace failure +- dead dependency / peer mismatch diagnosis +- CI workaround detection and correction +- warning, lint, and security remediation expectations + +### Step 3: Verify the lint contract + +Run: `bun run lint` + +Expected: the workspace lint step executes a real static check and passes. + +## Task 6: Full verification and smoke checks + +**Files:** + +- No new files unless verification reveals required fixes + +### Step 1: Run install, lint, test, and build + +Run: + +- `bun install` +- `bun run lint` +- `bun run test` +- `bun run build` + +Expected: all four commands pass from the repo root with no peer warning. + +### Step 2: Run built CLI smoke + +Run: `node packages/cli/dist/index.js lint examples/atmospheric-glass/DESIGN.md` + +Expected: no errors, and only repository-baseline warnings if the sample file +itself contains them. + +### Step 3: Run tarball smoke + +Run the equivalent of the workflow tarball path: + +- `cd packages/cli && npm pack` +- install the tarball in a temp directory +- run `npx design.md lint DESIGN.md` +- import `@google/design.md/linter` + +Expected: the tarball installs and both CLI and library smoke paths work. + +### Step 4: Check deployment and Kubernetes surfaces + +Expected: no Kubernetes or runtime deployment assets exist; package and CI +verification remain the only relevant deployment surfaces. + +## Task 7: Commit, push, PR, merge, and rescan + +**Files:** + +- All modified files above + +### Step 1: Review git status, diff, and recent log + +Gather commit context and draft a concise message explaining why the repository +baseline cleanup is needed. + +### Step 2: Commit and push + +Push branch `continuous-delivery-20260423` to origin. + +### Step 3: Create a draft PR + +The PR should summarize: + +- root build and test contract restored +- stale Ink peer warning removed +- CI now validates the root build path and Bun contract +- roadmap / blocker issue program refreshed + +### Step 4: Advance the PR to merge + +- Refresh the branch if GitHub reports it as behind. +- Wait for required checks. +- Do not proactively request human or robot review in a repo that does not + appear to use one. +- Merge when checks and repository gates allow. + +### Step 5: Rescan and continue + +After merge, verify default-branch health, update linked issues, and begin the +next executable follow-up issue from #29 if a clean, non-conflicting slice +remains. diff --git a/package.json b/package.json index bd7f76a..37b071d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "design-monorepo", "private": true, + "packageManager": "bun@1.2.10", "workspaces": [ "packages/*" ], diff --git a/packages/cli/package.json b/packages/cli/package.json index 5f66e7c..0d0c3d3 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -37,19 +37,16 @@ "access": "public" }, "scripts": { - "build": "bun build src/index.ts src/linter/index.ts --outdir dist --target node && npx tsc --project tsconfig.build.json --emitDeclarationOnly --skipLibCheck && cp src/linter/spec-config.yaml dist/linter/ && cp src/linter/spec-config.yaml dist/ && cp ../../docs/spec.md dist/linter/", + "build": "bun build src/index.ts src/linter/index.ts --outdir dist --target node && npx tsc --project tsconfig.build.json --emitDeclarationOnly --skipLibCheck && cp src/linter/spec-config.yaml dist/linter/ && cp src/linter/spec-config.yaml dist/ && cp ../../docs/spec.md dist/ && cp ../../docs/spec.md dist/linter/", "dev": "bun run src/index.ts", + "lint": "bun x tsc --project tsconfig.json --noEmit --skipLibCheck", "test": "bun test", "spec:gen": "bun run src/linter/spec-gen/generate.ts", "check-package": "bun run scripts/check-package.ts" }, "dependencies": { - "@json-render/core": "^0.16.0", - "@json-render/ink": "^0.16.0", "citty": "^0.1.6", - "ink": "^7.0.0", "mdast": "^3.0.0", - "react": "^19.2.5", "remark-frontmatter": "^5.0.0", "remark-mdx": "^3.1.1", "remark-parse": "^11.0.0", @@ -63,7 +60,6 @@ "@types/bun": "latest", "@types/mdast": "^4.0.4", "@types/node": "^20.11.24", - "@types/react": "^19.2.14", "bun-types": "^1.3.12", "tailwindcss": "3", "typescript": "^5.7.3" diff --git a/packages/cli/src/commands/spec.test.ts b/packages/cli/src/commands/spec.test.ts index 29f4ada..b7ecc35 100644 --- a/packages/cli/src/commands/spec.test.ts +++ b/packages/cli/src/commands/spec.test.ts @@ -13,8 +13,17 @@ // limitations under the License. import { describe, it, expect, beforeEach, afterEach, spyOn } from 'bun:test'; +import { execFileSync } from 'node:child_process'; +import { existsSync, rmSync } from 'node:fs'; +import { resolve, dirname } from 'node:path'; +import { fileURLToPath } from 'node:url'; import specCommand from './spec.js'; +const currentDir = dirname(fileURLToPath(import.meta.url)); +const packageRoot = resolve(currentDir, '../..'); +const distDir = resolve(packageRoot, 'dist'); +const bundledCliPath = resolve(distDir, 'index.js'); + describe('spec command', () => { let logSpy: any; @@ -91,4 +100,24 @@ describe('spec command', () => { expect(output.rules).toBeDefined(); expect(output.rules.length).toBe(8); }); + + it('outputs the spec from the built CLI bundle', () => { + if (existsSync(distDir)) { + rmSync(distDir, { recursive: true, force: true }); + } + + execFileSync('bun', ['run', 'build'], { + cwd: packageRoot, + encoding: 'utf-8', + stdio: ['ignore', 'pipe', 'pipe'], + }); + + const output = execFileSync('node', [bundledCliPath, 'spec'], { + cwd: packageRoot, + encoding: 'utf-8', + stdio: ['ignore', 'pipe', 'pipe'], + }); + + expect(output).toContain('# DESIGN.md Format'); + }); }); diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json index 40298d8..5739aa4 100644 --- a/packages/cli/tsconfig.json +++ b/packages/cli/tsconfig.json @@ -8,8 +8,7 @@ "outDir": "./dist", "rootDir": "./src", "declaration": true, - "types": ["bun"], - "jsx": "react-jsx" + "types": ["bun"] }, - "include": ["src/**/*.ts", "src/**/*.tsx"] + "include": ["src/**/*.ts"] }