Skip to content

[codex] Complete workspace foundation and setup specs#1029

Merged
alfred-openspec merged 4 commits intomainfrom
codex/workspace-foundation-setup-proposals
May 1, 2026
Merged

[codex] Complete workspace foundation and setup specs#1029
alfred-openspec merged 4 commits intomainfrom
codex/workspace-foundation-setup-proposals

Conversation

@TabishB
Copy link
Copy Markdown
Contributor

@TabishB TabishB commented May 1, 2026

Summary

  • complete the workspace-foundation implementation with .openspec-workspace path helpers, workspace root detection, typed shared/local/registry state parsing, write helpers, and managed workspace location helpers
  • document the coordination workspace model, stable link names, local-path separation, registry behavior, and deferred workspace slices
  • clearly mark public workspace documentation as beta so users know commands/workflows may change or may not be available in the current stable release yet
  • include the existing setup/link/relink/list/doctor planning artifacts for workspace-create-and-register-repos
  • mark workspace-foundation tasks complete after validation

Verification

  • pnpm exec vitest run test/core/global-config.test.ts test/core/workspace/foundation.test.ts
  • pnpm run build
  • pnpm run lint
  • node bin/openspec.js validate workspace-foundation --strict
  • node bin/openspec.js validate workspace-create-and-register-repos --strict

Summary by CodeRabbit

  • New Features

    • Introduced workspace CLI: workspace setup, workspace list/ls, workspace link, workspace relink, and workspace doctor; POSIX/Windows path behavior respected.
  • Documentation

    • Added workspace concepts: identity, shared vs machine-local state, managed workspace registry, link-name semantics (inferred/explicit; record-only).
    • Documented JSON (--json) and non-interactive/--no-interactive scripting behavior.
  • Behavior

    • Links record paths only (no mutation); relink repairs local paths only.
    • Doctor reports issues with suggested fixes (no auto-repair); clear selection and failure rules; shows resolved workspace paths.
  • Tests

    • Added foundation tests covering discovery, naming validation, state parsing, registry behavior, and round-trip I/O.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 1, 2026

📝 Walkthrough

Walkthrough

Adds workspace foundation code (path helpers, name validators, zod-backed YAML schemas, serializers, read/write I/O, discovery, and registry listing), extends global data-dir resolver and core exports, introduces CLI design/specs/tasks/docs for workspace setup/link/relink/list/doctor flows, and adds comprehensive foundation tests.

Changes

Cohort / File(s) Summary
Workspace foundation code
src/core/workspace/foundation.ts, src/core/workspace/index.ts, test/core/workspace/foundation.test.ts
New foundation module: constants, path helpers, validation, zod schemas and serializers, YAML I/O for shared/local/registry state, workspace discovery/listing, managed-workspaces path helpers; barrel export and extensive unit tests covering platform/path behaviour and validation.
Global config & core exports
src/core/global-config.ts, src/core/index.ts
getGlobalDataDir now accepts GlobalDataDirOptions (env/platform/homedir overrides) and uses path.win32.join for Windows joins; new GlobalDataDirOptions type exported and workspace exports re-exported from core index.
Workspace setup & linking docs/specs
openspec/changes/workspace-create-and-register-repos/... (design.md, proposal.md, tasks.md), openspec/changes/.../specs/cli-artifact-workflow/spec.md, openspec/changes/.../specs/workspace-links/spec.md
Adds design, proposal, task plan and normative specs defining workspace setup, workspace list/ls, workspace link/relink, and workspace doctor behaviors, interactive vs --no-interactive rules, JSON output requirements, link-name inference/validation, and record-only linking semantics.
Workspace foundation docs & conventions
openspec/changes/workspace-foundation/..., openspec/changes/.../specs/workspace-foundation/spec.md, openspec/changes/.../specs/openspec-conventions/spec.md, docs/concepts.md
Adds workspace product language, on-disk layout (changes/, .openspec-workspace/), shared vs machine-local state (workspace.yaml / local.yaml), managed-workspaces location and registry semantics, naming rules, and conventions for planning-first model.
Roadmap, config, and README edits
openspec/changes/workspace-reimplementation-roadmap/POC_REFERENCE_GUIDE.md, openspec/changes/.../README.md, openspec/config.yaml
Terminology updates (repo alias → workspace name / linked folders), roadmap alignment, and product-language guidance added to config and README.

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant CLI as CLI (openspec)
  participant FS as Filesystem
  participant WorkspaceMeta as .openspec-workspace
  participant Registry as Managed Registry

  User->>CLI: run `openspec workspace setup` (interactive)
  CLI->>FS: validate chosen path(s) exist
  CLI->>WorkspaceMeta: write `workspace.yaml` (shared state)
  CLI->>WorkspaceMeta: write `local.yaml` (machine-local paths)
  CLI->>Registry: create/update `registry.yaml` in managed workspaces
  Registry-->>CLI: confirm registration
  CLI-->>User: print summary and next commands
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • alfred-openspec

Poem

🐇 I hopped through dirs both far and near,

I saved each link and kept the roots clear.
No files were touched, just names that bind,
A tidy registry for curious minds.
Hooray — workspace setup, neat and dear!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Complete workspace foundation and setup specs' directly summarizes the main change: implementing workspace foundation with helpers, typing, state management, documentation, and planning artifacts for workspace setup.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/workspace-foundation-setup-proposals

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@openspec/changes/workspace-create-and-register-repos/specs/cli-artifact-workflow/spec.md`:
- Around line 6-10: In the "Preparing workspace planning before a change"
scenario update the command list to use the agreed name "doctor" instead of
"check": replace the token "check" with "doctor" so the sentence reads "setup,
list, link, relink, and doctor" (ensure any normative language referencing the
CLI commands in the same scenario or nearby paragraphs uses the same "doctor"
identifier and not "check" to avoid conflicting contract language).

In
`@openspec/changes/workspace-create-and-register-repos/specs/workspace-links/spec.md`:
- Around line 80-104: The spec is missing behavior for the zero-known-workspaces
case; add a new Scenario (e.g., "No known workspaces") under "Global Workspace
Commands" that defines what should happen when commands that require a workspace
(like workspace link, workspace relink, workspace doctor) run but the local
registry has no workspaces: state whether the command should fail with a clear
message and suggested next steps (e.g., instruct to run `workspace init` or
`workspace create` or pass `--workspace` after registering one), and clarify
interactive vs non-interactive behavior for this case and the exact error text
or suggestion to display so implementers can rely on a deterministic response.

In `@openspec/changes/workspace-reimplementation-roadmap/POC_REFERENCE_GUIDE.md`:
- Around line 145-146: The checklist currently lists commands "setup", "list",
"create", "add-repo", and "doctor" in a way that implies "create" and "add-repo"
are still part of the expected flow; update the sentence to explicitly mark
"create" and "add-repo" as deprecated (e.g., append "(deprecated)" or
"—deprecated" after each) or remove them from the flow and replace with the
current command names so the handoff guide cannot be misread; edit the line that
mentions these commands to either remove the deprecated names or annotate them
as deprecated and optionally add the preferred replacements.

In `@openspec/changes/workspace-reimplementation-roadmap/README.md`:
- Around line 45-47: Replace the non-product term "working-set entries" in the
descriptions for workspace-create-and-register-repos and
workspace-open-agent-context with the approved product-language term "workspace
components" (or explicitly "visible repositories, monorepo modules, and
planning-only code areas") and remove any usage of "working set"/"entry" to keep
wording consistent across the spec; update the two sentences so they read e.g.
workspace-create-and-register-repos creates the workspace and makes workspace
components (repos, monorepo modules, planning-only code areas) visible before a
change exists, and workspace-open-agent-context gives the agent the workspace
root, workspace components, active changes, and selected change scope.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c8584450-21b6-425c-bf19-84b0f077628f

📥 Commits

Reviewing files that changed from the base of the PR and between 347f027 and eef2257.

📒 Files selected for processing (13)
  • openspec/changes/workspace-create-and-register-repos/design.md
  • openspec/changes/workspace-create-and-register-repos/proposal.md
  • openspec/changes/workspace-create-and-register-repos/specs/cli-artifact-workflow/spec.md
  • openspec/changes/workspace-create-and-register-repos/specs/workspace-links/spec.md
  • openspec/changes/workspace-create-and-register-repos/tasks.md
  • openspec/changes/workspace-foundation/design.md
  • openspec/changes/workspace-foundation/proposal.md
  • openspec/changes/workspace-foundation/specs/openspec-conventions/spec.md
  • openspec/changes/workspace-foundation/specs/workspace-foundation/spec.md
  • openspec/changes/workspace-foundation/tasks.md
  • openspec/changes/workspace-reimplementation-roadmap/POC_REFERENCE_GUIDE.md
  • openspec/changes/workspace-reimplementation-roadmap/README.md
  • openspec/config.yaml

Comment thread openspec/changes/workspace-reimplementation-roadmap/POC_REFERENCE_GUIDE.md Outdated
Comment thread openspec/changes/workspace-reimplementation-roadmap/README.md Outdated
@TabishB TabishB changed the title Define workspace foundation and setup specs [codex] Complete workspace foundation and setup specs May 1, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
openspec/changes/workspace-create-and-register-repos/specs/workspace-links/spec.md (1)

60-79: ⚡ Quick win

Clarify stale-entry output vs required “linked repos/folders” fields.

Line 63 requires listing links for each workspace, but stale entries (missing workspace path) may not be readable. Add explicit stale-output semantics (e.g., stale: true, links omitted/null) to avoid implementation drift.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@openspec/changes/workspace-create-and-register-repos/specs/workspace-links/spec.md`
around lines 60 - 79, Update the spec for the "workspace list" (and alias
"workspace ls") output to explicitly handle stale registry entries: when a
registered workspace path is not readable/present, emit a clear indicator (e.g.,
"stale": true) and either omit the "links" field or set it to null, instead of
attempting to read or populate linked repos/folders; ensure non-stale workspaces
continue to include "name", "path" and a populated "links" list.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@openspec/changes/workspace-create-and-register-repos/specs/workspace-links/spec.md`:
- Around line 93-104: Add a new scenario to the spec that defines the behavior
when exactly one known workspace exists: state that for commands workspace link,
workspace relink, and workspace doctor (reference those command names) when
exactly one registry entry is present and --workspace is omitted the CLI SHALL
automatically select that single known workspace (no interactive picker) and
proceed deterministically; include an explicit THEN that the command uses that
workspace's name and path and an optional NOTE that users may still pass
--workspace <name> to override.

---

Nitpick comments:
In
`@openspec/changes/workspace-create-and-register-repos/specs/workspace-links/spec.md`:
- Around line 60-79: Update the spec for the "workspace list" (and alias
"workspace ls") output to explicitly handle stale registry entries: when a
registered workspace path is not readable/present, emit a clear indicator (e.g.,
"stale": true) and either omit the "links" field or set it to null, instead of
attempting to read or populate linked repos/folders; ensure non-stale workspaces
continue to include "name", "path" and a populated "links" list.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 807b053e-c87b-4e14-a691-d49d34d8fd97

📥 Commits

Reviewing files that changed from the base of the PR and between e7a13a3 and 772aad1.

📒 Files selected for processing (4)
  • openspec/changes/workspace-create-and-register-repos/specs/cli-artifact-workflow/spec.md
  • openspec/changes/workspace-create-and-register-repos/specs/workspace-links/spec.md
  • openspec/changes/workspace-reimplementation-roadmap/POC_REFERENCE_GUIDE.md
  • openspec/changes/workspace-reimplementation-roadmap/README.md
✅ Files skipped from review due to trivial changes (1)
  • openspec/changes/workspace-reimplementation-roadmap/README.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • openspec/changes/workspace-create-and-register-repos/specs/cli-artifact-workflow/spec.md
  • openspec/changes/workspace-reimplementation-roadmap/POC_REFERENCE_GUIDE.md

Comment on lines +93 to +104
#### Scenario: Picking from multiple workspaces
- **GIVEN** multiple known workspaces exist
- **WHEN** an interactive command needs one workspace and none is specified
- **THEN** OpenSpec SHALL show a workspace picker
- **AND** the picker SHALL include workspace names and paths

#### Scenario: Ambiguous non-interactive workspace selection
- **GIVEN** multiple known workspaces exist
- **WHEN** a non-interactive command needs one workspace and none is specified
- **THEN** OpenSpec SHALL fail with a clear message
- **AND** it SHALL suggest passing `--workspace <name>`

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Define behavior for the “exactly one known workspace” case.

Selection is specified for current workspace, multiple-known, and zero-known cases, but not for one-known outside any workspace. Please add a scenario so workspace link/relink/doctor are deterministic when one registry entry exists and --workspace is omitted.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@openspec/changes/workspace-create-and-register-repos/specs/workspace-links/spec.md`
around lines 93 - 104, Add a new scenario to the spec that defines the behavior
when exactly one known workspace exists: state that for commands workspace link,
workspace relink, and workspace doctor (reference those command names) when
exactly one registry entry is present and --workspace is omitted the CLI SHALL
automatically select that single known workspace (no interactive picker) and
proceed deterministically; include an explicit THEN that the command uses that
workspace's name and path and an optional NOTE that users may still pass
--workspace <name> to override.

Copy link
Copy Markdown
Collaborator

@alfred-openspec alfred-openspec left a comment

Choose a reason for hiding this comment

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

Looks good. Checks are green and the remaining CodeRabbit notes are non-blocking spec follow-ups.

@alfred-openspec alfred-openspec added this pull request to the merge queue May 1, 2026
Merged via the queue into main with commit e6d81ba May 1, 2026
12 checks passed
@alfred-openspec alfred-openspec deleted the codex/workspace-foundation-setup-proposals branch May 1, 2026 17:38
@coderabbitai coderabbitai Bot mentioned this pull request May 4, 2026
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants