Add namespace option to customize the sandcastle prefix#553
Open
elkinjosetm wants to merge 2 commits into
Open
Add namespace option to customize the sandcastle prefix#553elkinjosetm wants to merge 2 commits into
namespace option to customize the sandcastle prefix#553elkinjosetm wants to merge 2 commits into
Conversation
… paths Adds an optional `namespace?: string` field to `RunOptions`, `CreateSandboxOptions`, and `CreateWorktreeOptions`. When set, replaces the hardcoded `sandcastle` prefix in: - branch ref (`<namespace>/<timestamp>` or `<namespace>/<name>/<timestamp>`) - worktree directory (`<namespace>-<timestamp>`) - worktree parent (`.<namespace>/worktrees/`) - log directory (`.<namespace>/logs/`) - patches directory (`.<namespace>/patches/`) Defaults to `"sandcastle"`, preserving existing behavior byte-for-byte. The `.sandcastle/.env` lookup is intentionally unchanged — renaming would force migration on every existing user. Closes mattpocock#552.
|
@elkinjosetm is attempting to deploy a commit to the Matt Pocock's projects Team on Vercel. A member of the Team first needs to authorize it. |
…ytona)
Threads the resolved `namespace` from RunOptions through `BindMountCreateOptions`
and `IsolatedCreateOptions` so the docker, podman, and daytona providers use
`<namespace>-<uuid>` instead of the hardcoded `sandcastle-<uuid>` for container
names (visible in `docker ps`, `podman ps`) and Daytona session ids.
- `BindMountCreateOptions.namespace?: string` — provider reads this for naming.
- `IsolatedCreateOptions.namespace?: string` — same, for isolated providers.
- `startSandbox()` accepts an optional `namespace` and forwards it to
`provider.create({ ..., namespace })`.
- `createSandbox`, `createSandboxFromWorktree`, `createWorktree`, `worktreeRun`,
`worktreeInteractive`, and `run()` now pass the resolved namespace through.
- Providers fall back to `"sandcastle"` when the field is omitted, preserving
byte-for-byte behavior for callers that don't thread it (e.g. `interactive()`).
Tests: docker/podman provider tests verify the prefix flips with
`createOptions.namespace`. Changeset + issue body updated.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
namespace option to customize sandcastle prefix in branch + pathsnamespace option to customize the sandcastle prefix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #552.
Changes
namespace?: stringfield onRunOptions,CreateSandboxOptions, andCreateWorktreeOptions(default"sandcastle").WorktreeManager— branch (<ns>/<ts>or<ns>/<sanitized-name>/<ts>), worktree dir (<ns>-<ts>/<ns>-<sanitized-name>-<ts>), parent dir (.<ns>/worktrees/).run(),createSandbox(),createWorktree()(and the methods returned by the latter two) — log path under.<ns>/logs/.syncOut()— patches path under.<ns>/patches/.BindMountCreateOptions+IsolatedCreateOptions— new optionalnamespace?: stringfield forwarded to providers viastartSandbox().sandboxes/docker.ts,sandboxes/podman.ts— container name<ns>-<uuid>(visible indocker ps/podman ps).sandboxes/daytona.ts— session id<ns>-<uuid>..sandcastle/.envlookup intentionally unchanged (user-managed config; renaming would force migration on every existing user).sandcastle:<slug>) is already overridable viadocker({ imageName })and stays as-is.sanitizeNamerules as the existingnameoption. Empty strings are rejected synchronously at the public API entry point. A value that sanitizes to no alphanumeric characters (e.g."///") is rejected with a descriptive error.src/WorktreeManager.test.ts—resolveNamespacedefaults / sanitizes / rejects invalid;generateTempBranchNamehonors namespace;WorktreeManager.createpropagates namespace to branch + worktree dir;WorktreeManager.pruneStaleoperates on the namespaced worktrees dir without touching others; default behavior preserved whennamespaceis omitted.src/sandboxes/docker.test.ts— provider usescreateOptions.namespaceas container prefix; falls back to"sandcastle"when omitted.src/sandboxes/podman.test.ts— provider usescreateOptions.namespaceas container prefix."sandcastle"whencreateOptions.namespaceis omitted, so callers that don't thread it (e.g.interactive()) and any third-party provider continue to work unchanged.patch.RunOptionsexample +RunOptions/CreateSandboxOptions/CreateWorktreeOptionsreference tables.Backwards compatibility
Default
"sandcastle"keeps current behavior byte-for-byte. Pure additive opt-in — no existing call sites need changes.Verification
npm run typecheck(only pre-existing@daytona/sdkoptional-peer warnings remain — unchanged frommain).npm test— namespace tests pass (WorktreeManager+sandboxes/docker); pre-existing failure count unchanged frommain(Mac/private/var/folderssymlink-related failures + Podman Machine env failures already onmain).namesemantics still flow through the existing path (no change to thenameoption).