Skip to content

feat(workbench): add shared package and project workbench - #1916

Draft
willgriffin wants to merge 5 commits into
mainfrom
codex/workbench-appshell-pr1882
Draft

feat(workbench): add shared package and project workbench#1916
willgriffin wants to merge 5 commits into
mainfrom
codex/workbench-appshell-pr1882

Conversation

@willgriffin

@willgriffin willgriffin commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Fixes #2117.
Fixes #2118.

Summary

  • add @happyvertical/smrt-workbench, a CWD-scoped workbench for workspace, package, and installed-consumer views
  • compose package documentation, API/REST/MCP/CLI surfaces, knowledge, specialist context, migrations, examples, routes, and embedded playground previews
  • add the root pnpm workbench and smrt workbench dev commands, with installed-consumer resolution and explicit remote-host acknowledgement
  • extend smrt-dev-mcp with Workbench resources and sanitized package-specialist context
  • add package-owned Workbench modules for content, assets, and images
  • add packed-consumer smoke coverage and a dedicated browser CI job

Stewardship fixes

The branch was rebased onto current main and the bounded review cycle addressed all findings:

  • removed workspace-relative Workbench scripts from published package manifests
  • wired custom package discovery patterns and corrected singular route-module merge behavior
  • added installed-consumer CLI and packed-artifact host coverage
  • fail closed for non-loopback hosts unless --allow-remote is explicit
  • deny database files, sidecars, and .smrt metadata through Vite filesystem access
  • sanitize specialist baseline paths so repository roots are not exposed over MCP
  • resolve fixed-release groups by canonical package name and fail closed on missing references
  • launch installed consumers with their nearest pnpm/Yarn lockfile or npm fallback; Yarn PnP now reports the required nodeLinker: node-modules configuration
  • map embedded route fragments across all Workbench modules, including direct-load/reload selection of the owning package
  • remove dead Vite plugin state and resolve every review thread
  • resolve Windows package managers without a shell, confine shim entrypoints to the exact package root, validate ports, and format IPv6 hosts safely
  • run the browser gate on arc-happyvertical, check out the trusted requested revision, and install Playwright system dependencies on browser-cache hits

Validation

  • exact reviewed head 79a2be4f902c6be2a0b5680294936be696ac0871
  • pnpm build: 63/63 tasks passed
  • pnpm test: 122/122 tasks passed
  • pnpm typecheck: 121/121 tasks passed
  • Workbench unit tests: 12 passed
  • Workbench Playwright E2E: passed, including embedded navigation and direct hash reload
  • packed-consumer smoke and verify:pack: passed
  • CLI Workbench tests: 12 passed; CLI typecheck passed
  • smrt-dev-mcp: 89 tests and typecheck passed
  • pnpm check:standards
  • pnpm smrt dev:knowledge-check --changed --strict
  • pnpm install --frozen-lockfile
  • pnpm audit:policy
  • full Biome, workflow validation, package DAG, knowledge, and repository pre-push gates
  • bounded code, architecture, security, and test review findings addressed and retested
{"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"]}

@willgriffin
willgriffin force-pushed the codex/workbench-appshell-pr1882 branch from fd7b9fd to 98bea42 Compare July 26, 2026 06:55
@willgriffin
willgriffin marked this pull request as ready for review July 26, 2026 06:56
Copilot AI review requested due to automatic review settings July 26, 2026 06:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-workbench package with discovery/runtime/Vite plugin, UI components, tests, and a bundled SvelteKit host.
  • Added CLI smrt workbench dev (and root pnpm 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

Comment thread scripts/check-standards.mjs Outdated
Comment thread packages/smrt-workbench/src/vite.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread packages/cli/src/commands/workbench.ts
Comment thread packages/smrt-workbench/src/svelte/WorkbenchHost.svelte
@willgriffin
willgriffin marked this pull request as draft July 26, 2026 12:52
@willgriffin
willgriffin marked this pull request as ready for review July 29, 2026 17:24

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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 || []);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@willgriffin
willgriffin force-pushed the codex/workbench-appshell-pr1882 branch from fa85d5a to 79a2be4 Compare July 29, 2026 18:11
@willgriffin

Copy link
Copy Markdown
Contributor Author

@codex review exact head 79a2be4. Please review the complete Workbench candidate after the current-main rebase, hardened Windows launcher, strict port/IPv6 handling, and arc-happyvertical browser validation fixes; report actionable findings or explicitly clean.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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}/`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +270 to +271
host === '::1' ||
host === '[::1]'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +899 to +900
const methodParams = methodParameterSummaries(object, action, 'input');
return [

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +481 to +485
function commandFor(
packageSummary: WorkbenchPackageSummary,
scriptName: string,
) {
return `pnpm --filter ${packageSummary.name} ${scriptName}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@willgriffin willgriffin added the status: blocked Reviewable but blocked from merge label Jul 30, 2026
@willgriffin

Copy link
Copy Markdown
Contributor Author

PR #1916 still depends on the knowledge-discovery work and requires rebase plus exact-head CI; next: original owner should resume after #2154 is settled.

@willgriffin

Copy link
Copy Markdown
Contributor Author

PR #1916 still depends on the knowledge-discovery work and requires rebase plus exact-head CI; next: original owner should resume after #2154 is settled.

@willgriffin
willgriffin marked this pull request as draft August 2, 2026 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: blocked Reviewable but blocked from merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(workbench): address post-push review findings Rebase and steward workbench PR #1916

2 participants