Skip to content

Feat/conductor parity#8

Merged
drivasperez merged 5 commits into
feat/dwm-extensionsfrom
feat/conductor-parity
May 21, 2026
Merged

Feat/conductor parity#8
drivasperez merged 5 commits into
feat/dwm-extensionsfrom
feat/conductor-parity

Conversation

@drivasperez

Copy link
Copy Markdown
Owner

No description provided.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 12, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
dwm 82a400c May 21 2026, 09:51 AM

drivasperez and others added 4 commits May 12, 2026 09:02
New trait method returns the repo's trunk/main branch (e.g. "main"). jj
detects via `jj log -r 'trunk()' -T 'bookmarks'`, git via the existing
detect_trunk helper which already checks main/master/origin HEAD. Both
fall back to "main" when detection fails. Used by the Conductor-compat
hooks layer to populate `CONDUCTOR_DEFAULT_BRANCH`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Each workspace gets a stable, unique 10-port slot persisted in
`<repo>/.dwm/<name>/.dwm-port`. ensure_port() reads the marker if
present, otherwise scans sibling workspaces for occupied slots and
picks the lowest free multiple of 10 starting at 3000.

Holes left by deleted workspaces are filled. Allocations are
idempotent — repeat calls return the same number. Malformed marker
files are silently treated as "not occupied" so a corrupt file in
one workspace doesn't bork others.

Tests cover empty repo, sequential allocation, hole-filling,
idempotence, self-marker exclusion, and malformed-file tolerance.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…port)

Extends src/hooks.rs to cover the rest of Conductor's lifecycle surface:

- New `run_run_script` runner. Honours `runScriptMode`: in concurrent
  mode (default) the child is spawned detached via `setsid` (Unix) and
  inherits dwm's stdio, returning immediately. In nonconcurrent mode it
  blocks like setup.
- New `run_archive_script` runner. Returns Ok(true) on success/no-script,
  Ok(false) on non-zero exit so the caller can prompt.
- New `RunScriptMode` enum, parsed from top-level `runScriptMode` in
  both `.dwm.toml` and `conductor.json` (concurrent default; invalid
  values fall back to concurrent rather than erroring).
- Single `apply_env` helper shared by all three runners. Now sets the
  full DWM_*/CONDUCTOR_* set: WORKSPACE_NAME, WORKSPACE_PATH,
  ROOT_PATH, DEFAULT_BRANCH, PORT, plus DWM_FROM_WORKSPACE
  conditionally.
- HookContext gains `default_branch: String`, populated by callers from
  VcsBackend::default_branch_name.

Bug fix: CONDUCTOR_ROOT_PATH was previously aliased to the workspace
path, which broke recipes like `cp $CONDUCTOR_ROOT_PATH/.env.local .`
that rely on it being the *source* repo. It now points at
ctx.repo_root, matching Conductor's actual semantics. The
`run_setup_executes_script_with_env` test was updated to assert the
distinction.

Detached-spawn tradeoff: the concurrent run-script child inherits
stdout/stderr (so the user sees output) and gets its own session via
`setsid` (so Ctrl-C in dwm's terminal doesn't kill it). The dwm
process returns immediately and `mem::forget`s the child handle; the
OS reaps it when the user kills it or its session ends.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- New `dwm run` subcommand. Loads hooks from the repo and invokes
  `scripts.run` for the workspace dwm thinks the user is currently in
  (determined from cwd via find_dwm_workspace). Errors clearly when
  invoked outside a workspace or when `scripts.run` is missing. Not
  added to the shell wrapper's CD_SUBCOMMANDS list, since it doesn't
  produce a path.
- delete_workspace_inner now runs `scripts.archive` (if configured)
  before tearing the workspace down. Hooks are loaded once per delete
  so the behaviour is consistent across all entry points (named delete,
  cwd-inferred delete, TUI delete).
- Verbose deletes prompt on archive failure ("delete anyway? [y/N]"),
  reading from /dev/tty so piped invocations don't hang. If stdin is
  not a tty, deletion is aborted with a clear error.
- TUI delete (DeleteOutput::Quiet) does NOT prompt — a failed archive
  script is logged to stderr and deletion proceeds. This is option (a)
  from the design discussion: ratatui has the alternate screen, so an
  inline prompt would be awkward, and TUI deletion is a deliberate user
  gesture they've already committed to. The warning becomes visible
  once the TUI tears down.
- new_workspace_inner now populates HookContext.default_branch via the
  new VcsBackend::default_branch_name call.

Tests cover: archive hook running on success, quiet path proceeding on
archive failure, no-archive workspaces deleting cleanly, and the
existing `dwm run` clap parsing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@drivasperez
drivasperez force-pushed the feat/conductor-parity branch from c385813 to 7a80083 Compare May 12, 2026 08:13
- New "Lifecycle hooks" section documenting all three scripts (setup,
  run, archive), when each fires, and their failure semantics.
- Document `runScriptMode` (concurrent default, nonconcurrent
  alternative) with the tradeoff that concurrent run scripts inherit
  the parent's stdio.
- Full DWM_*/CONDUCTOR_* env-var table, calling out that
  CONDUCTOR_ROOT_PATH is the source repo path (not the workspace).
- Document the CONDUCTOR_PORT allocator: 10-port slots from 3000 up,
  persisted to <repo>/.dwm/<name>/.dwm-port, holes are filled.
- "Conductor users" callout: drop conductor.json into the repo and dwm
  reads it as-is.
- New `dwm run` row in the usage table.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@drivasperez
drivasperez force-pushed the feat/conductor-parity branch from 7a80083 to 82a400c Compare May 21, 2026 09:51
@drivasperez
drivasperez merged commit 4089531 into feat/dwm-extensions May 21, 2026
10 checks passed
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.

1 participant