Skip to content

Workspace CLI — bowire workspace init / export / import / migrate-format #149

@thomas-stegemann

Description

@thomas-stegemann

Why

Bruno's CLI runs the same .bru files the GUI edits — bruno run collections/payments/Login.bru works straight out of a checked-out repo. Bowire's CLI today reads from ~/.bowire/ hard-wired through BowireUserContext. For a git-backed workspace (#147) to actually be useful in CI / scripts / on-call, the CLI needs to read from the workspace's configured storageRoot — same root the workbench writes to.

Proposal

Three new CLI commands + a storageRoot-aware read path.

bowire workspace init <path>

Sets up a git-backed workspace at the given directory.

$ bowire workspace init ./payments-team
Initialised workspace at ./payments-team
  → workspace.json (manifest)
  → .gitignore (excludes bodies/*, secrets/*, *.legacy)
  → environments/ collections/ recordings/ scripts/ flows/ (empty)
  → git init done — first commit pending
$ cd payments-team && git add . && git commit -m "Initial workspace"
  • Creates the directory tree expected by the per-file format (#TBD-perFileFormat).
  • Drops a workspace.json manifest seeded with name + colour + schema version.
  • Writes a default .gitignore (bodies/, secrets/, *.legacy, .bowire-cache/).
  • Runs git init unless --no-git is passed.
  • Reports next steps so the operator knows what to commit.

bowire workspace export [--from <wsId>] <path>

Copies an existing workspace's state from ~/.bowire/workspaces/<wsId>/ into the target path (= same shape as init). Used to move a personal scratchpad into a shared git repo.

  • Defaults --from to the currently active workspace.
  • Refuses to overwrite a non-empty path unless --force.
  • Doesn't modify the source workspace; the operator can later switch the workspace's storageRoot to the new path.

bowire workspace import <path>

Registers an existing git-backed workspace in the workbench's workspace list (without copying anything — storageRoot points at the directory in place).

  • Reads <path>/workspace.json for the name + colour.
  • Adds the entry to bowire_workspaces + sets storageRoot.
  • Refuses if the manifest is missing or workspaceFormatVersion is unsupported.

bowire workspace migrate-format

Walks an existing workspace storage root, splits the legacy bundles (single-file environments, collections) into per-file shape. Idempotent; bumps the manifest's workspaceFormatVersion.

Read-path: every CLI command honours storageRoot

Today:

~/.bowire/workspaces/<wsId>/recordings/...

After this issue:

<storageRoot OR default>/<entity>/...

Resolution order in BowireUserContext.GetUserPath(suffix, workspaceId?):

  1. Explicit --workspace-root <path> CLI flag wins.
  2. Active workspace's storageRoot from bowire_workspaces.
  3. Multi-tenant per-identity slot (post Multi-tenant data model + SCIM (Phase B) #28 SCIM).
  4. Default ~/.bowire/workspaces/<wsId>/.

All consumers (bowire run, bowire mock, bowire export, bowire scan, …) pick up step (1) or (2) without per-command plumbing.

Acceptance

  • bowire workspace init <path> creates the tree + manifest + .gitignore + git init.
  • bowire workspace export [--from wsId] <path> copies state with the per-file format.
  • bowire workspace import <path> registers an existing workspace.
  • bowire workspace migrate-format upgrades legacy bundles to per-file.
  • Every Bowire CLI command resolves storageRoot through BowireUserContext with the new precedence chain.
  • --workspace-root flag overrides for one-off CI runs that don't want to register a workspace.
  • Tests cover the four-level resolution chain.

Composes with

Out of scope

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:workbenchUI / workbench surfaceroadmapTracked on the public Project board

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions