feat(workbench): add shared package and project workbench - #1916
feat(workbench): add shared package and project workbench#1916willgriffin wants to merge 5 commits into
Conversation
fd7b9fd to
98bea42
Compare
There was a problem hiding this comment.
Pull request overview
Introduces a new shared “workbench” surface across the SMRT monorepo by adding @happyvertical/smrt-workbench (library + bundled SvelteKit host), wiring a root launcher command, and extending MCP/resources + package exports so workbench modules and embedded playground previews can be discovered in both workspace and installed-consumer contexts.
Changes:
- Added
@happyvertical/smrt-workbenchpackage with discovery/runtime/Vite plugin, UI components, tests, and a bundled SvelteKit host. - Added CLI
smrt workbench dev(and rootpnpm workbench) with consumer/workspace resolution and loopback/remote-ack safeguards. - Extended packages (content/assets/images) to export
./workbench, updated docs/standards, and added a dedicated CI job for packed-consumer + browser E2E.
Reviewed changes
Copilot reviewed 72 out of 75 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| vite.config.base.ts | Includes smrt-workbench in package config wrapper handling. |
| tsconfig.json | Adds the new package to TS project references. |
| scripts/check-standards.mjs | Enforces fixed-release-group membership/version coordination. |
| README.md | Documents the new workbench packages and root command. |
| pnpm-workspace.yaml | Adds the workbench host as a workspace package. |
| pnpm-lock.yaml | Adds lockfile entries for workbench + host dependencies. |
| packages/template-site-static-json/package.json | Adjusts template manifest shape (adds scripts key). |
| packages/smrt-workbench/vitest.config.ts | Adds Vitest config for the new workbench package. |
| packages/smrt-workbench/vite.config.ts | Adds Vite library build config for workbench. |
| packages/smrt-workbench/tsconfig.svelte.json | Adds Svelte packaging tsconfig for workbench components. |
| packages/smrt-workbench/tsconfig.json | Adds TS composite config for the workbench package. |
| packages/smrt-workbench/svelte.config.js | Adds Svelte preprocess config for workbench component packaging. |
| packages/smrt-workbench/src/vite.ts | Implements the Workbench Vite virtual-module plugin + discovery wiring. |
| packages/smrt-workbench/src/utils.ts | Adds shared helpers for naming/command IDs. |
| packages/smrt-workbench/src/types.ts | Introduces shared Workbench types/contracts. |
| packages/smrt-workbench/src/svelte/MarkdownDocument.svelte | Adds lightweight markdown rendering for docs views. |
| packages/smrt-workbench/src/svelte/index.ts | Exposes workbench Svelte entrypoint export. |
| packages/smrt-workbench/src/runtime.ts | Adds module normalization/merge utilities for workbench modules. |
| packages/smrt-workbench/src/index.ts | Adds public barrel exports for discovery/runtime/types. |
| packages/smrt-workbench/src/discovery.ts | Implements scope resolution, package summarization, and module discovery. |
| packages/smrt-workbench/src/tests/runtime.test.ts | Adds tests for module coercion/merge/qualification. |
| packages/smrt-workbench/src/tests/discovery.test.ts | Adds tests for scope resolution, summaries, and discovery patterns. |
| packages/smrt-workbench/scripts/consumer-smoke.mjs | Adds packed-consumer smoke test for host/runtime discovery. |
| packages/smrt-workbench/README.md | Documents how to run and integrate the workbench. |
| packages/smrt-workbench/package.json | Defines workbench exports, files, scripts, and dependencies. |
| packages/smrt-workbench/host/vite.config.ts | Configures SvelteKit host + loopback guard + FS denylist. |
| packages/smrt-workbench/host/tsconfig.json | Adds host TS config extending generated SvelteKit config. |
| packages/smrt-workbench/host/svelte.config.js | Configures static adapter for the host. |
| packages/smrt-workbench/host/src/routes/+page.svelte | Mounts the WorkbenchHost with discovered project/modules. |
| packages/smrt-workbench/host/src/routes/+error.svelte | Adds a basic host error page. |
| packages/smrt-workbench/host/src/hooks.client.ts | Adds client error handling hook for the host. |
| packages/smrt-workbench/host/src/app.html | Adds host HTML shell. |
| packages/smrt-workbench/host/README.md | Documents host purpose and remote-binding acknowledgement. |
| packages/smrt-workbench/host/playwright.config.ts | Adds Playwright config for host E2E tests. |
| packages/smrt-workbench/host/package.json | Defines host dev/build/e2e scripts and deps. |
| packages/smrt-workbench/host/e2e/workbench.spec.ts | Adds browser E2E asserting workbench UI flows and embedding. |
| packages/smrt-workbench/CLAUDE.md | Adds generated adapter pointer to AGENTS.md. |
| packages/smrt-workbench/ambient.d.ts | Declares the virtual module typings used by the host. |
| packages/smrt-workbench/AGENTS.md | Adds package agent guidance for workbench responsibilities/boundaries. |
| packages/smrt-playground/src/svelte/PlaygroundHost.svelte | Adds embedded mode + entry selection + theme-context inheritance. |
| packages/smrt-dev-mcp/src/mcp-stdio.test.ts | Extends MCP stdio tests for specialist tool + workbench resources. |
| packages/smrt-dev-mcp/src/knowledge/index.ts | Adds deterministic package specialist context builder and source selection. |
| packages/smrt-dev-mcp/src/knowledge/index.test.ts | Adds tests covering package specialist context output. |
| packages/smrt-dev-mcp/src/index.ts | Exposes new tool + workbench resource URIs and sanitization. |
| packages/smrt-dev-mcp/src/index.test.ts | Ensures new tool appears in MCP tool listing. |
| packages/images/vite.config.ts | Adds workbench entrypoint to images build. |
| packages/images/tsconfig.typecheck.json | Ensures ambient types are included in typecheck build. |
| packages/images/src/workbench.ts | Adds package-owned workbench module with fixtures + routes. |
| packages/images/src/svelte/routes/ImageStudioRoute.svelte | Allows injecting gallery/editor clients + initial image for embedding. |
| packages/images/src/svelte/playground.ts | Removes route preview entry; focuses playground on component previews. |
| packages/images/package.json | Adds ./workbench export for workbench module discovery. |
| packages/content/vite.config.ts | Adds workbench entrypoint to content build. |
| packages/content/tsconfig.typecheck.json | Ensures ambient types are included in typecheck build. |
| packages/content/src/workbench.ts | Adds package-owned content workbench module with fixtures + routes. |
| packages/content/src/svelte/routes/ContentWorkspaceRoute.svelte | Supports injected client for embedded workbench mode and UI toggles. |
| packages/content/src/svelte/routes/ContentGovernanceRoute.svelte | Supports injected governance manager client for embedding. |
| packages/content/src/svelte/routes/ContentFactsRoute.svelte | Supports injected client for embedded workbench mode. |
| packages/content/src/svelte/routes/ContentContributionsRoute.svelte | Supports injected client for embedded workbench mode. |
| packages/content/package.json | Adds ./workbench export for workbench module discovery. |
| packages/cli/src/commands/workbench.ts | Adds workbench:dev CLI command to launch the host safely. |
| packages/cli/src/commands/index.ts | Exposes workbench commands from CLI commands barrel. |
| packages/cli/src/commands/tests/workbench.test.ts | Adds tests for workbench command behavior and safety checks. |
| packages/cli/src/cli-generator.ts | Registers workbench namespace and wiring into help/dispatch. |
| packages/cli/src/tests/cli-generator-coverage.test.ts | Adds coverage for workbench dev preprocessing. |
| packages/assets/vite.config.ts | Adds workbench entrypoint to assets build. |
| packages/assets/tsconfig.typecheck.json | Ensures ambient types are included in typecheck build. |
| packages/assets/src/workbench.ts | Adds package-owned assets workbench module export. |
| packages/assets/src/svelte/playground.ts | Removes route preview entry; focuses playground on component previews. |
| packages/assets/package.json | Adds ./workbench export for workbench module discovery. |
| package.json | Adds root workbench script invoking CLI launcher. |
| docs/content/standards.md | Documents fixed-release train enforcement + ./workbench export convention. |
| AGENTS.md | Updates repo-level orientation to include smrt-workbench. |
| .github/workflows/test-suite.yml | Adds affected-scope filter + workbench browser/consumer CI job. |
| .changeset/config.json | Adds @happyvertical/smrt-workbench to the fixed release group. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 98bea42c95
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fa85d5ae78
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ) || null, | ||
| ); | ||
|
|
||
| const selectedRoutes = $derived(selectedModule?.routes || []); |
There was a problem hiding this comment.
Render metadata supplied by workbench modules
When a consumer's src/workbench.ts supplies docs, examples, or recommendedCommands—all fields in the public module contract—the host reads only selectedModule.routes; the Docs, Examples, and Scripts views render exclusively from the scanner-created selectedPackage. These contributions therefore disappear, including the examples declared by the new assets, content, and images modules. Merge module metadata into the package-facing collections before rendering.
AGENTS.md reference: packages/smrt-workbench/AGENTS.md:L7-L10
Useful? React with 👍 / 👎.
fa85d5a to
79a2be4
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 79a2be4f90
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ); | ||
| } | ||
| const port = resolveWorkbenchPort(options.port); | ||
| const url = `http://${workbenchUrlHost(host)}:${port}/`; |
There was a problem hiding this comment.
Make the displayed port match Vite's bound port
When the requested port is occupied, every launcher path forwards only --host and --port, while Vite defaults strictPort to false and automatically selects another port. The CLI therefore advertises this URL even though the Workbench started elsewhere—and the advertised port may belong to an unrelated service. Vite 8.1.4's --help documents --strictPort as “exit if specified port is already in use”; pass that flag or report the actual bound port.
Useful? React with 👍 / 👎.
| host === '::1' || | ||
| host === '[::1]' |
There was a problem hiding this comment.
Normalize bracketed IPv6 host literals before launch
When a user supplies --host [::1], this check accepts it as loopback and the launcher passes the brackets unchanged to Vite's --host. Vite 8.1.4 documents this option as a hostname and passes the value through to the server listener; Node resolves [::1] as a literal hostname and returns ENOTFOUND, so this accepted input cannot start the Workbench. Strip the brackets before spawning, or reject the bracketed form and require ::1.
Useful? React with 👍 / 👎.
| const methodParams = methodParameterSummaries(object, action, 'input'); | ||
| return [ |
There was a problem hiding this comment.
Mirror the generated MCP custom-action schema
For any public custom method with scanned parameters, this replaces the generated tool's options input with those parameters as top-level inputs. The actual MCP generator in packages/core/src/generators/mcp.ts exposes only required id plus optional options for custom actions, so the Workbench presents unsupported inputs and omits the input callers must use. Derive this summary from the generated tool schema or mirror its id/options contract.
AGENTS.md reference: packages/smrt-workbench/AGENTS.md:L9-L10
Useful? React with 👍 / 👎.
| function commandFor( | ||
| packageSummary: WorkbenchPackageSummary, | ||
| scriptName: string, | ||
| ) { | ||
| return `pnpm --filter ${packageSummary.name} ${scriptName}`; |
There was a problem hiding this comment.
Generate commands for the consumer's package manager
In an installed consumer using npm or Yarn, every Scripts-tab copy action still produces pnpm --filter <name> <script>. Such projects may not have pnpm installed, and a local non-workspace app should be invoked with its own package manager's run syntax rather than a workspace filter, making the advertised copyable commands unusable in the consumer modes the launcher explicitly supports. Preserve the detected package manager in the project model and format commands according to the package source and manager.
AGENTS.md reference: packages/smrt-workbench/AGENTS.md:L11-L12
Useful? React with 👍 / 👎.
Fixes #2117.
Fixes #2118.
Summary
@happyvertical/smrt-workbench, a CWD-scoped workbench for workspace, package, and installed-consumer viewspnpm workbenchandsmrt workbench devcommands, with installed-consumer resolution and explicit remote-host acknowledgementsmrt-dev-mcpwith Workbench resources and sanitized package-specialist contextStewardship fixes
The branch was rebased onto current
mainand the bounded review cycle addressed all findings:--allow-remoteis explicit.smrtmetadata through Vite filesystem accessnodeLinker: node-modulesconfigurationarc-happyvertical, check out the trusted requested revision, and install Playwright system dependencies on browser-cache hitsValidation
79a2be4f902c6be2a0b5680294936be696ac0871pnpm build: 63/63 tasks passedpnpm test: 122/122 tasks passedpnpm typecheck: 121/121 tasks passedverify:pack: passedsmrt-dev-mcp: 89 tests and typecheck passedpnpm check:standardspnpm smrt dev:knowledge-check --changed --strictpnpm install --frozen-lockfilepnpm audit:policy{"schema":"hv-agent-run:v1","runtime":"codex","session":"codex-1916-finalize-019fabf1","issue":2118,"policy_revision":"1.0.0","validation":["exact head 79a2be4f902c6be2a0b5680294936be696ac0871","pnpm build (63/63)","pnpm test (122/122)","pnpm typecheck (121/121)","workbench unit/e2e/packed-consumer/verify:pack","CLI workbench tests/typecheck","smrt-dev-mcp 89 tests/typecheck","pnpm check:standards","pnpm smrt dev:knowledge-check --changed --strict","pnpm install --frozen-lockfile","pnpm audit:policy","review-cycle findings addressed and retested"]}