@sideboard-ai/core 0.1.15 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,7 +11,7 @@ import {
11
11
  listBrightsyChatTargets,
12
12
  opencodeAdapter,
13
13
  permissionMode
14
- } from "./chunk-MEI4AXV4.js";
14
+ } from "./chunk-V54GKKCI.js";
15
15
  import "./chunk-ILQK4P5R.js";
16
16
  import {
17
17
  cursorSdkMessageToEvents,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveGithubRepoSlug
3
- } from "./chunk-L44AX7IG.js";
3
+ } from "./chunk-UFWEANLU.js";
4
4
  import {
5
5
  globalAgentCwd,
6
6
  sideboardReposDir
@@ -31,7 +31,8 @@ function coordinatorGreenfieldPlaybook(reposDir) {
31
31
  "- Examples:",
32
32
  ` - Clone: \`git clone <url> ${reposDir}/<name>\``,
33
33
  ` - New GitHub repo: \`gh repo create <owner>/<name> --private --clone -- ${reposDir}/<name>\` (or mkdir + git init + gh repo create + remote add + push)`,
34
- "- Then: add_workspace with that absolute path \u2192 create_thread (repoPath + parentThreadId) \u2192 send_to_thread (build) \u2192 wait_for_turn \u2192 send_to_thread (`gh pr create --draft`) or create_draft_pr.",
34
+ "- Then: add_workspace with that absolute path \u2192 create_thread (repoPath + parentThreadId) \u2192 send_to_thread (build) \u2192 wait_for_turn \u2192 send_to_thread (`gh pr create --draft -R <origin-owner/name>`).",
35
+ "- Always target the child worktree's **origin** (`github:` slug from list_workspaces / `git remote get-url origin` in that worktree). Never open PRs against `upstream`.",
35
36
  "- Do coding work in the child worktree thread, not by editing files in this home cwd."
36
37
  ].join("\n");
37
38
  }
@@ -55,10 +56,8 @@ var COORDINATOR_TOOL_PLAYBOOK = [
55
56
  "- list_run_scripts / run_dev_script / stop_dev_script \u2014 start/stop named run scripts",
56
57
  "Inspect / PRs:",
57
58
  "- get_diff \u2014 compact diff summary",
58
- "- preview_land \u2014 preview push+PR (does not push)",
59
- "- Prefer asking the worktree agent via send_to_thread to open a draft PR (`gh pr create --draft`) so it owns title/body from the diff.",
60
- "- create_draft_pr \u2014 fallback: commit (if dirty), push, open/update a DRAFT PR from the orchestrator",
61
- "Human-only (do not attempt): ready-for-review confirm_land, purge_thread.",
59
+ "- Ask the worktree agent via send_to_thread to open a draft PR with `gh pr create --draft -R <origin-owner/name>` (workspace `github:` slug / that worktree's origin \u2014 never upstream). Do not open PRs from the orchestrator yourself.",
60
+ "Human-only (do not attempt): merge, ready-for-review land, purge_thread.",
62
61
  "Thread links in replies: when mentioning a chat/thread for the user, include a markdown link `[Title](sideboard://thread/<id>)` using the full id (or the link field from create_thread / list_threads). Sideboard renders these as clickable opens.",
63
62
  "Bash / Read / etc: allowed for (1) inspecting target worktrees / registered repo paths from MCP, and (2) greenfield setup under ~/sideboard/repos (git clone, gh repo create, git init+remote). Never git init/clone *inside* this synthetic home cwd \u2014 emptiness here is expected, not a bug."
64
63
  ].join("\n");
@@ -97,8 +96,8 @@ function ensureGlobalCoordinatorCwd() {
97
96
  "",
98
97
  "When creating threads, pass `repoPath` from `list_workspaces` (or the path you just registered) and `parentThreadId` for children.",
99
98
  "Typical flow (existing): list_workspaces \u2192 list_branches|list_prs|list_issues \u2192 create_thread \u2192 send_to_thread \u2192 wait_for_turn.",
100
- "Typical flow (new app): Bash create/clone under repos dir \u2192 add_workspace \u2192 create_thread \u2192 send_to_thread (implement) \u2192 wait_for_turn \u2192 draft PR.",
101
- "Prefer asking worktree agents to open draft PRs; use create_draft_pr as fallback."
99
+ "Typical flow (new app): Bash create/clone under repos dir \u2192 add_workspace \u2192 create_thread \u2192 send_to_thread (implement) \u2192 wait_for_turn \u2192 draft PR via worktree agent.",
100
+ "Always ask worktree agents to open draft PRs (`send_to_thread` + `gh pr create --draft -R <origin>`); never open PRs from the orchestrator."
102
101
  ].join("\n");
103
102
  writeFileSync(join(dir, "CLAUDE.md"), `${body}
104
103
  `, "utf8");
@@ -123,8 +122,8 @@ function coordinatorSystemPrompt(opts) {
123
122
  COORDINATOR_TOOL_PLAYBOOK,
124
123
  coordinatorGreenfieldPlaybook(reposDir),
125
124
  "When creating threads, pass the correct repoPath for the target workspace and parentThreadId for children.",
126
- "Typical flow (existing): list_workspaces \u2192 list_branches|list_prs|list_issues \u2192 create_thread \u2192 send_to_thread (implement) \u2192 wait_for_turn \u2192 send_to_thread (ask for `gh pr create --draft`) \u2192 wait_for_turn. Use create_draft_pr only if the child cannot open the PR.",
127
- "Typical flow (new app): Bash under repos dir (clone or gh repo create) \u2192 add_workspace \u2192 create_thread \u2192 send_to_thread \u2192 wait_for_turn \u2192 draft PR.",
125
+ "Typical flow (existing): list_workspaces \u2192 list_branches|list_prs|list_issues \u2192 create_thread \u2192 send_to_thread (implement) \u2192 wait_for_turn \u2192 send_to_thread (ask for `gh pr create --draft -R <origin-owner/name>` using the workspace github slug) \u2192 wait_for_turn. Never target upstream. Never open PRs from the orchestrator.",
126
+ "Typical flow (new app): Bash under repos dir (clone or gh repo create) \u2192 add_workspace \u2192 create_thread \u2192 send_to_thread \u2192 wait_for_turn \u2192 draft PR via worktree agent.",
128
127
  `Goal: ${opts.goal}`,
129
128
  `Parent thread id (pass as parentThreadId when creating children): ${opts.parentId}`,
130
129
  "Registered workspaces:",
@@ -1,9 +1,10 @@
1
1
  import {
2
2
  isGlobalRepoPath
3
- } from "./chunk-3OJG4LP4.js";
3
+ } from "./chunk-Y2EWQ4TL.js";
4
4
  import {
5
+ ensureGhPreferOrigin,
5
6
  resolveRepoRoot
6
- } from "./chunk-L44AX7IG.js";
7
+ } from "./chunk-UFWEANLU.js";
7
8
  import {
8
9
  appDataDir
9
10
  } from "./chunk-M37RITA6.js";
@@ -57,7 +58,9 @@ function forgetRemoved(repoPath) {
57
58
  }
58
59
  function listWorkspaces() {
59
60
  const all = readAll();
60
- const valid = all.filter((w) => Boolean(w.path) && w.path !== "/" && w.path !== ".");
61
+ const valid = all.filter(
62
+ (w) => Boolean(w.path) && w.path !== "/" && w.path !== "." && !isGlobalRepoPath(w.path)
63
+ );
61
64
  if (valid.length !== all.length) writeAll(valid);
62
65
  return valid.sort((a, b) => a.name.localeCompare(b.name));
63
66
  }
@@ -66,6 +69,7 @@ async function addWorkspace(repoPath) {
66
69
  if (!root || root === "/") throw new Error(`Invalid repo path: ${repoPath}`);
67
70
  if (!existsSync(root)) throw new Error(`Repo not found: ${root}`);
68
71
  forgetRemoved(root);
72
+ await ensureGhPreferOrigin(root);
69
73
  const current = readAll();
70
74
  const existing = current.find((w) => w.path === root);
71
75
  if (existing) return existing;