Skip to content

fix: support branch names with slashes in workspace.source URLs#22

Merged
christso merged 1 commit intomainfrom
fix/branch-slash-support
Jan 27, 2026
Merged

fix: support branch names with slashes in workspace.source URLs#22
christso merged 1 commit intomainfrom
fix/branch-slash-support

Conversation

@christso
Copy link
Copy Markdown
Contributor

Summary

Fixes workspace sync failure when initializing with --from URLs that specify branches containing slashes (e.g., feat/my-feature).

Issues Fixed:

  1. Branch name not preserved in workspace.source when creating workspace from GitHub URL

    • Code was hardcoding 'main' instead of using the branch from --from URL
    • Now properly extracts and preserves the branch specification
  2. URL parsing failed for branches with slashes

    • parseGitHubUrl() couldn't distinguish branch names from subpaths when branch contained slashes
    • Updated to use heuristics: common directory names (plugins, src, docs, etc.) indicate where subpath begins

Test Plan

  • ✅ Unit tests pass (all 152 tests)
  • ✅ Linting and type checking pass
  • ✅ E2E test: workspace init ./test --from https://github.com/WiseTechGlobal/WTG.AI.Prompts/tree/feat/allagents-workspace/plugins/cargowise
    • ✅ Workspace created successfully
    • ✅ 65 files synced (was failing before with "File source not found")

🤖 Generated with Claude Code

When initializing a workspace with --from URL that specifies a branch with
slashes (e.g., feat/my-feature), two issues were fixed:

1. Branch name not preserved in workspace.source:
   - The code was hardcoding 'main' branch when constructing workspace.source
   - Now extracts and uses the actual branch from the --from URL
   - Falls back to 'main' if no branch is specified

2. URL parsing failed for branches with slashes:
   - parseGitHubUrl couldn't distinguish branch names from subpaths when
     the branch name contained slashes (e.g., feat/allagents-workspace)
   - Updated parsing logic to use heuristics: common directory names
     (plugins, src, docs, etc.) indicate where the subpath begins
   - Maintains backward compatibility with simple branch names

Fixes workspace sync failing with "File source not found" errors when using
workspace init with branch URLs like:
  https://github.com/owner/repo/tree/feat/feature-name/plugins/name

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying allagents with  Cloudflare Pages  Cloudflare Pages

Latest commit: c8d7274
Status: ✅  Deploy successful!
Preview URL: https://55f4a35c.allagents.pages.dev
Branch Preview URL: https://fix-branch-slash-support.allagents.pages.dev

View logs

@christso christso merged commit 8f85731 into main Jan 27, 2026
1 check passed
@christso christso deleted the fix/branch-slash-support branch January 27, 2026 12:57
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