first-tree-staging 0.5.7-staging.412.1 → 0.5.7-staging.413.1

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.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { $ as canonicalizeResourceRepoUrl, At as initConfig, B as printResults, Bt as FirstTreeHubSDK, Dt as defaultDataDir, Et as defaultConfigDir, F as checkBackgroundService, Ft as setConfigValue, G as isServiceSupported, Gt as discoverClaudeCodeSkills, H as runtimeProviderChecks, Ht as SessionRegistry, I as checkClientConfig, It as channelConfig, J as restartClientService, Jt as setCliBinding, K as isServiceUnitDriftDetected, Kt as probeCapabilities, L as checkNodeVersion, Lt as resetConfig, M as createApiNameResolver, Mt as readConfigFile, N as migrateLocalAgentDirs, Nt as resetConfigMeta, Ot as defaultHome, P as checkAgentConfigs, Pt as resolveConfigReadonly, Q as ClientRuntime, R as checkServerReachable, Rt as ClientOrgMismatchError, St as setJsonMode, Tt as clientConfigSchema, U as getClientServiceStatus, Ut as buildMessageDocumentSnapshots, V as reconcileAgentConfigs, Vt as SdkError, W as installClientService, Wt as cleanWorkspaces, X as stopClientService, Xt as configureClientLoggerForService, Y as startClientService, Yt as applyClientLoggerConfig, _ as uploadClientCapabilities, _t as formatStaleReason, a as declineUpdate, b as promptMissingFields, bt as isJsonMode, c as PACKAGE_NAME, ct as loadCredentials, d as fetchServerCommandVersion, dt as saveAgentConfig, et as documentContextSchema, f as installGlobalLatest, ft as saveCredentials, g as uploadAgentSkills, gt as findStaleAliases, h as reconcileLocalRuntimeProviders, ht as COMMAND_VERSION, i as createExecuteUpdate, jt as loadAgents, kt as getConfigValue, l as detectInstallMode, m as listPinnedAgents, mt as CLI_USER_AGENT, n as decodeJwtPayload, nt as handleClientOrgMismatch, o as promptUpdate, ot as ensureFreshAccessToken, p as installGlobalSpec, pt as cliFetch, qt as reprobeOnReconnect, r as deriveHubUrlFromToken, rt as rotateClientIdWithBackup, s as refreshServerUpdateTarget, st as ensureFreshAdminToken, t as HubUrlDerivationError, tt as findAssembledBriefingFingerprint, u as fetchLatestVersion, ut as resolveServerUrl, vt as removeLocalAgent, wt as agentConfigSchema, xt as print, y as promptAddAgent, z as checkWebSocket, zt as ClientUserMismatchError } from "../connect-token-1vCjV_0K.mjs";
2
+ import { $ as canonicalizeResourceRepoUrl, At as initConfig, B as printResults, Bt as FirstTreeHubSDK, Dt as defaultDataDir, Et as defaultConfigDir, F as checkBackgroundService, Ft as setConfigValue, G as isServiceSupported, Gt as discoverClaudeCodeSkills, H as runtimeProviderChecks, Ht as SessionRegistry, I as checkClientConfig, It as channelConfig, J as restartClientService, Jt as setCliBinding, K as isServiceUnitDriftDetected, Kt as probeCapabilities, L as checkNodeVersion, Lt as resetConfig, M as createApiNameResolver, Mt as readConfigFile, N as migrateLocalAgentDirs, Nt as resetConfigMeta, Ot as defaultHome, P as checkAgentConfigs, Pt as resolveConfigReadonly, Q as ClientRuntime, R as checkServerReachable, Rt as ClientOrgMismatchError, St as setJsonMode, Tt as clientConfigSchema, U as getClientServiceStatus, Ut as buildMessageDocumentSnapshots, V as reconcileAgentConfigs, Vt as SdkError, W as installClientService, Wt as cleanWorkspaces, X as stopClientService, Xt as configureClientLoggerForService, Y as startClientService, Yt as applyClientLoggerConfig, _ as uploadClientCapabilities, _t as formatStaleReason, a as declineUpdate, b as promptMissingFields, bt as isJsonMode, c as PACKAGE_NAME, ct as loadCredentials, d as fetchServerCommandVersion, dt as saveAgentConfig, et as documentContextSchema, f as installGlobalLatest, ft as saveCredentials, g as uploadAgentSkills, gt as findStaleAliases, h as reconcileLocalRuntimeProviders, ht as COMMAND_VERSION, i as createExecuteUpdate, jt as loadAgents, kt as getConfigValue, l as detectInstallMode, m as listPinnedAgents, mt as CLI_USER_AGENT, n as decodeJwtPayload, nt as handleClientOrgMismatch, o as promptUpdate, ot as ensureFreshAccessToken, p as installGlobalSpec, pt as cliFetch, qt as reprobeOnReconnect, r as deriveHubUrlFromToken, rt as rotateClientIdWithBackup, s as refreshServerUpdateTarget, st as ensureFreshAdminToken, t as HubUrlDerivationError, tt as findAssembledBriefingFingerprint, u as fetchLatestVersion, ut as resolveServerUrl, vt as removeLocalAgent, wt as agentConfigSchema, xt as print, y as promptAddAgent, z as checkWebSocket, zt as ClientUserMismatchError } from "../connect-token-CBfV_I1k.mjs";
3
3
  import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
4
4
  import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, statSync, unlinkSync } from "node:fs";
5
5
  import "node:crypto";
@@ -11105,7 +11105,7 @@ function sourceRepositoriesBlock(sourceRepos) {
11105
11105
  }
11106
11106
  lines.push("");
11107
11107
  lines.push("Each path is a **bare** clone — a git object store with no working", "tree. You never read or write files at the clone path directly;", "**every read AND write happens inside a worktree** you create off it", "(see `## Worktrees`). Bare is deliberate: with no checked-out files", "the clone can never go stale-mislead or dirty, and concurrent chats", "can't trip over a shared working tree.", "", "Management protocol (shared by every chat of this agent):", "", "1. **Ensure** — if a listed path is missing, create it as a bare clone.", " Each listed path is an immediate child of your workspace's", " `source-repos/` directory (`<workspace>/source-repos/<name>`). Create the", " `source-repos/` parent first, then clone into it:", "", " ```bash", " mkdir -p \"$(dirname <path>)\" # ensure the source-repos/ parent exists", " git clone --bare <url> <path>", " git -C <path> config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'", " git -C <path> fetch origin", " ```", "", " The refspec + fetch populate `refs/remotes/origin/*` so worktrees can", " branch off `origin/<default>`.", "2. **Verify before reuse — fail closed on a repo mismatch.** If the path", " **already exists**, do NOT blindly reuse it. The same `localPath` can be", " repointed to a different `url` in config, so first confirm the existing", " clone is the SAME repo as the declared `url` above:", "", " ```bash", " git -C <path> remote get-url origin", " ```", "", " Compare that to the declared `url` canonically (ignore a trailing", " `.git` and the http/https/ssh form). **If it matches**, reuse the clone", " as-is — never delete or re-clone it (sibling chats may hold worktrees", " rooted in it). **If it does NOT match** — the directory was cloned from", " a different repo — STOP: do not fetch, do not add a worktree, and do", " NOT delete, re-clone, or re-point it (a sibling chat may have a worktree", " on the old repo). Report the mismatch to a human in the chat (declared", " `url` vs. the clone's actual `origin`) and stop using that source until", " they resolve it. Silently serving worktrees off the wrong repo is the", " exact failure this guard exists to prevent.", "3. **Refresh** — once the clone is confirmed to match (or you just created", " it), before creating any worktree run `git -C <path> fetch origin` so", " `origin/<default>` is current.", "4. **Read through a worktree, not the clone path.** A bare clone has no", " files to read. To read source — `grep`, `cat`, `git log`, or a", " shipped skill scan (`first-tree-seed`, `first-tree-sync`) — create a", " read worktree off `origin/<default>` (or the pinned `ref`), read", " inside it, and remove it when done. To write, create a task worktree", " on a new branch. Both flows are in `## Worktrees`.", "5. **Credential failures are reportable events** — if clone/fetch fails", " with an auth error, tell a human in the chat what failed and continue", " with what you have locally; do not retry silently.");
11108
- lines.push("", "**One-time legacy-layout migration — do this once, and only in your", "OWN workspace.** Some agents were first provisioned with a single", "**non-bare** checkout at the workspace root (instead of a bare clone", "under `source-repos/`), often with task worktrees hanging off it. If", "you find one, migrate it — never reach into a sibling agent's", "workspace. Create the bare clone per **Ensure** above (its new home),", "then retire the legacy checkout. Clear the same safety bar for **both**", "its linked worktrees AND its own working tree delete a tree only when", "it has no uncommitted changes AND its HEAD is already merged into", "`origin/<default>`, so no work is lost. `git worktree remove` refuses", "the main checkout, so verify that one by hand before the `rm -rf`:", "", "```bash", "git -C <legacy> fetch origin # refresh origin/<default> so the merge checks are real", "git -C <legacy> worktree list # the checkout + every worktree on it", "# each LINKED worktree — clean + already merged, then drop it:", "git -C <wt> status --porcelain # empty ⇒ no uncommitted work", "git -C <legacy> merge-base --is-ancestor <wt-HEAD> origin/<default> # exit 0 ⇒ already merged", "git -C <legacy> worktree remove <wt> # repeat per worktree; refuses if dirty", "# the checkout ITSELF — `worktree remove` won't touch a main tree, so", "# clear the same bar by hand before deleting it:", "git -C <legacy> status --porcelain # empty ⇒ no uncommitted work", "git -C <legacy> merge-base --is-ancestor HEAD origin/<default> # exit 0 ⇒ already merged", "rm -rf <legacy> # only after BOTH checks pass", "```", "", "The legacy `context-tree` **symlink** migrates the same one-time way —", "see `## Tree Location` (remove the symlink only, then clone).");
11108
+ lines.push("", "**One-time legacy-layout migration — do this once, and only in your", "OWN workspace.** Some agents were first provisioned with a single", "**non-bare** checkout at the workspace root (instead of a bare clone", "under `source-repos/`), often with task worktrees hanging off it. If", "you find one, migrate it — never reach into a sibling agent's", "workspace. Create the bare clone per **Ensure** above (its new home),", "then retire the legacy checkout. Clear the same zero-data-loss bar for", "**everything** the final `rm -rf` would destroy — its linked worktrees,", "its own working tree, AND any local-only history in its `.git` (branches", "checked out in no worktree, plus stashes). Delete a tree only when it has", "no uncommitted changes and its HEAD is merged into `origin/<default>`;", "`git worktree remove` refuses the main checkout, so verify it by hand. If", "any check below is non-empty, stop — push / migrate that work or ask a", "human before deleting:", "", "```bash", "git -C <legacy> fetch origin # refresh origin/<default> so the merge checks are real", "git -C <legacy> worktree list # the checkout + every worktree on it", "# each LINKED worktree — clean + already merged, then drop it:", "git -C <wt> status --porcelain # empty ⇒ no uncommitted work", "git -C <legacy> merge-base --is-ancestor <wt-HEAD> origin/<default> # exit 0 ⇒ already merged", "git -C <legacy> worktree remove <wt> # repeat per worktree; refuses if dirty", "# the checkout ITSELF — `worktree remove` won't touch a main tree, and", "# `rm -rf` also drops local-only refs/stashes; clear the full bar by hand:", "git -C <legacy> status --porcelain # empty ⇒ no uncommitted work", "git -C <legacy> merge-base --is-ancestor HEAD origin/<default> # exit 0 ⇒ HEAD merged", "git -C <legacy> branch --no-merged origin/<default> # empty ⇒ no unmerged local branch", "git -C <legacy> stash list # empty ⇒ no stashed work", "rm -rf <legacy> # only after ALL of the above are clear", "```", "", "The legacy `context-tree` **symlink** migrates the same one-time way —", "see `## Tree Location` (remove the symlink only, then clone).");
11109
11109
  return lines.join("\n");
11110
11110
  }
11111
11111
  function worktreesBlock(agentHome, sourceRepos) {
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { A as readWorkspaceManifest, B as printResults, Bt as FirstTreeHubSDK, C as onboardCreate, Ct as status, D as computeWorkspaceStatus, E as promoteToWorkspace, G as isServiceSupported, I as checkClientConfig, J as restartClientService, L as checkNodeVersion, O as discoverWorkspaceRoot, P as checkAgentConfigs, Q as ClientRuntime, R as checkServerReachable, S as onboardCheck, T as migrateWorkspaceToW1, U as getClientServiceStatus, Vt as SdkError, W as installClientService, X as stopClientService, Y as startClientService, Z as uninstallClientService, at as AuthRefreshRateLimitedError, b as promptMissingFields, it as AuthRefreshFailedError, j as writeWorkspaceManifest, k as pickImmediateWorkspaceSources, lt as resolveAccessToken, nt as handleClientOrgMismatch, ot as ensureFreshAccessToken, q as resolveCliInvocation, r as deriveHubUrlFromToken, rt as rotateClientIdWithBackup, st as ensureFreshAdminToken, t as HubUrlDerivationError, ut as resolveServerUrl, v as isInteractive, w as detectMigrationState, x as formatCheckReport, y as promptAddAgent, yt as blank, z as checkWebSocket } from "./connect-token-1vCjV_0K.mjs";
1
+ import { A as readWorkspaceManifest, B as printResults, Bt as FirstTreeHubSDK, C as onboardCreate, Ct as status, D as computeWorkspaceStatus, E as promoteToWorkspace, G as isServiceSupported, I as checkClientConfig, J as restartClientService, L as checkNodeVersion, O as discoverWorkspaceRoot, P as checkAgentConfigs, Q as ClientRuntime, R as checkServerReachable, S as onboardCheck, T as migrateWorkspaceToW1, U as getClientServiceStatus, Vt as SdkError, W as installClientService, X as stopClientService, Y as startClientService, Z as uninstallClientService, at as AuthRefreshRateLimitedError, b as promptMissingFields, it as AuthRefreshFailedError, j as writeWorkspaceManifest, k as pickImmediateWorkspaceSources, lt as resolveAccessToken, nt as handleClientOrgMismatch, ot as ensureFreshAccessToken, q as resolveCliInvocation, r as deriveHubUrlFromToken, rt as rotateClientIdWithBackup, st as ensureFreshAdminToken, t as HubUrlDerivationError, ut as resolveServerUrl, v as isInteractive, w as detectMigrationState, x as formatCheckReport, y as promptAddAgent, yt as blank, z as checkWebSocket } from "./connect-token-CBfV_I1k.mjs";
2
2
  export { AuthRefreshFailedError, AuthRefreshRateLimitedError, ClientRuntime, FirstTreeHubSDK, FirstTreeHubSDK as FirstTreeSDK, HubUrlDerivationError, SdkError, blank, checkAgentConfigs, checkClientConfig, checkNodeVersion, checkServerReachable, checkWebSocket, computeWorkspaceStatus, deriveHubUrlFromToken, detectMigrationState, discoverWorkspaceRoot, ensureFreshAccessToken, ensureFreshAdminToken, formatCheckReport, getClientServiceStatus, handleClientOrgMismatch, installClientService, isInteractive, isServiceSupported, migrateWorkspaceToW1, onboardCheck, onboardCreate, pickImmediateWorkspaceSources, printResults, promoteToWorkspace, promptAddAgent, promptMissingFields, readWorkspaceManifest, resolveAccessToken, resolveCliInvocation, resolveServerUrl, restartClientService, rotateClientIdWithBackup, startClientService, status, stopClientService, uninstallClientService, writeWorkspaceManifest };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "first-tree-staging",
3
- "version": "0.5.7-staging.412.1",
3
+ "version": "0.5.7-staging.413.1",
4
4
  "type": "module",
5
5
  "description": "First Tree — unified CLI for Context Tree onboarding, agent management, and team messaging. (Source-tree dev build; CI rewrites `name` and `bin` for prod / staging publishes — see docs/local-dev-isolation.md.)",
6
6
  "keywords": [