Skip to content

feat: let one task work across several repositories - #257

Open
hongkongkiwi wants to merge 14 commits into
aicodeking:mainfrom
hongkongkiwi:multi-repo-tasks
Open

hongkongkiwi wants to merge 14 commits into
aicodeking:mainfrom
hongkongkiwi:multi-repo-tasks

Conversation

@hongkongkiwi

@hongkongkiwi hongkongkiwi commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

What and why

A project can hold several folders, so one task works across a backend, a frontend and shared libraries at once. Fixes #213.

The design follows the converged pattern of other desktop agents (ZCode Desktop, ChatGPT Projects, Claude Code's --add-dir, Codex): one primary folder keeps the working directory, discovery, run script and Deploy; every folder belongs to at most one project; git stays per repository.

  • Projects own folders (Settings → Projects: add, remove, make primary). Any folder can be attached; git features light up per folder that contains a repository, plain folders are context only. Single-folder projects behave exactly as before. Storage is schema 37: project_folders, session_repos (the primary is pinned at creation so a later primary change cannot relabel a task), and task_links re-keyed (session_id, kind, repo) with repo='' meaning the primary.
  • One agent, shared context. Harnesses get the other folders natively (--add-dir for Claude-family CLIs, sandbox writableRoots for Codex, additionalDirectories for ZCode and, when advertised, ACP) plus a per-message note with absolute paths. Agents address the primary with project-relative paths and other folders with label/relative or absolute paths; resolve_in_folders applies the existing per-root containment rules to every folder, and turn-change tracking covers all of them.
  • Independent worktrees. A worktree task creates one worktree per git folder on the same branch, each beside its own folder. A failed checkout never stops the task; it is reported per repository (UI toast and the agent tool's reply).
  • Unified task view. The inspector's file tree, search and @-mentions cover every folder; the Changes view groups by repository with per-repo stage, commit and push; the branch chip lists each repository.
  • Independent PRs. Creation picks the repository, detection links a PR to the repository whose branch it is on, and the PR tab lists them all. The primary keeps the legacy single link, so the mobile app and other existing readers see the same thing as before.
  • Refused for now (documented in docs/multi-folder.md): remote mirrors and cloud agents refuse multi-folder projects until they can sync several repositories; the mobile app shows the primary repository.

How it was tested

  • npm run build (typecheck + bundle)
  • npm test (217/218; the one failure is a locale-dependent date-format test that also fails on main)
  • cargo test --manifest-path src-tauri/Cargo.toml (1834 passed; also cargo clippy --all-targets -- -D warnings clean)
  • Relevant Playwright tests in Chrome and WebKit (full chromium suite 1122 passed; the touched specs re-run in both browsers)

36 storage, workspace, turn-change and GitHub tests were written fail-first against the new surfaces before implementation and stayed frozen during repair; preview mocks (?folders sample) cover every new IPC command.

Checklist

  • Commit messages follow <type>: <description>
  • Docs in docs/ updated if behavior changed (docs/multi-folder.md, AGENTS.md)
  • Preview mocks added in src/preview.ts for new IPC commands
  • No telemetry, secrets or personal paths added

@hongkongkiwi
hongkongkiwi force-pushed the multi-repo-tasks branch 2 times, most recently from ca9d9e9 to df7b15a Compare November 1, 2026 04:52
@hongkongkiwi hongkongkiwi changed the title Multi-repository projects and tasks feat: let one task work across several repositories Nov 1, 2026
project_folders and session_repos tables; projects keep a primary folder
(write-through to projects.path), tasks can pin per-repo worktrees, and
task_links keys per repo. Groundwork for aicodeking#213.
resolve_in_folders routes agent paths across a task's folder set
(longest-prefix match, scoped_path containment per folder), and the
turn-change tracker covers every folder with label-qualified paths;
pandacode_track_files accepts label/ and absolute forms. aicodeking#213
RunConfig carries extra_dirs; claude gets --add-dir, codex sandbox
writableRoots covers every folder, zcode passes additionalDirectories,
ACP only when advertised; warm key and the per-message note follow;
cloud bridge payload carries the dirs for later. aicodeking#213
Worktree task creation loops every git folder (same branch each,
per-repo failures reported, non-git folders skipped); git diff/stage/
commit/push/status gain a folder qualifier; git_status returns a
per-repo array over today's primary fields. aicodeking#213
Folder to link-key mapping (primary keeps the legacy key, others use
their GitHub origin), detect loops every repository and shields only
its own open link, PR create links under the chosen repository, and
linked_pulls lists them all. aicodeking#213
project_folders/add/remove/set_primary + workspace_folders commands,
typed payloads, and a ?folders preview sample seeding a three-folder
project. aicodeking#213
Settings > Projects lists each project's folders with primary marking,
add/remove/set-primary wired to the new commands; the project picker
shows folder counts. aicodeking#213
The Files tree renders one section per folder with its label heading, file
tabs key as label/path for non-primary folders and read through the folder
qualifier, search fans out across folders grouped by label, and the @-mention
pickers index every folder (non-primary hits inserted as label/relative, the
form the folders note and turn changes use). list_files, search_files,
search_text, read_file, read_document_file and workspace_image take the
optional folder qualifier; unqualified calls keep byte-identical behavior.
Changes groups per repository with per-repo stage/commit/push, the
branch chip lists each repository, and the PR tab shows every linked
pull request routed to its repository. aicodeking#213
…ument the model

Mirror tasks and cloud agents fail closed with a clear error until
they can sync several repositories; AGENTS.md notes schema 37 and the
feature, docs/multi-folder.md explains it. aicodeking#213
…own repository

Worktree creation failures surface per repository instead of passing
silently; pull requests of removed repositories route to their own
link or render disabled instead of falling back to the primary; labels
disambiguate across every parent level and a primary-relative path
beats a label match; the task's primary is pinned at creation so a
later primary change cannot relabel it, and the primary never moves
while tasks hold primary-keyed links; link refresh keys on the
repository; cloud prompts drop folders the machine does not have. aicodeking#213
The agent's worktree tool reports per-repo failures in its reply,
attached worktrees pin their primary like created ones, and file-tree,
search and mention results carry their folder explicitly instead of
re-deriving it from the path string. aicodeking#213
is_none_or over map_or, no needless borrows, test-only tracker and
lease helpers marked, and search_text takes its qualifier alongside
the seven existing parameters.
Register the three new folder specs in the WebKit config's testMatch
and match their titles in its grep, so the suite's second browser
really covers them instead of silently skipping. aicodeking#213
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.

Native Multi-Repository Tasks

1 participant