chatroom-cli 1.55.3 → 1.55.4

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.
package/dist/index.js CHANGED
@@ -77446,17 +77446,6 @@ ${error instanceof Error ? error.message : String(error)}`);
77446
77446
  }
77447
77447
  console.error(`
77448
77448
  \uD83D\uDCA1 Check your team's workflow in the system prompt for valid handoff paths.`);
77449
- } else if (result.error.code === "WORKFLOW_REQUIRED") {
77450
- console.error("");
77451
- console.error("All tasks delegated to builder must use a workflow.");
77452
- console.error("Create one before handing off:");
77453
- console.error("");
77454
- console.error(" 1. Activate the workflow skill:");
77455
- console.error(` ${cliEnvPrefix}chatroom skill activate workflow --chatroom-id=${chatroomId} --role=${role}`);
77456
- console.error("");
77457
- console.error(" 2. Create a workflow:");
77458
- console.error(` ${cliEnvPrefix}chatroom workflow create --chatroom-id=${chatroomId} --role=${role} ...`);
77459
- console.error("");
77460
77449
  } else if (result.error.suggestedTarget) {
77461
77450
  console.error(`
77462
77451
  \uD83D\uDCA1 Try this instead:`);
@@ -85059,11 +85048,13 @@ var init_file_content_subscription = __esm(() => {
85059
85048
 
85060
85049
  // src/infrastructure/services/workspace/file-tree-scanner.ts
85061
85050
  import { exec as exec6 } from "node:child_process";
85051
+ import { promises as fsPromises } from "node:fs";
85052
+ import path3 from "node:path";
85062
85053
  import { promisify as promisify5 } from "node:util";
85063
85054
  async function scanFileTree(rootDir, options) {
85064
85055
  const maxEntries = options?.maxEntries ?? DEFAULT_MAX_ENTRIES;
85065
85056
  const scannedAt = Date.now();
85066
- const filePaths = await getGitFiles(rootDir);
85057
+ const filePaths = await isGitRepo2(rootDir) ? await getGitFiles(rootDir) : await walkFsFallback(rootDir, maxEntries, FS_FALLBACK_MAX_SUBTREE_BYTES);
85067
85058
  const filteredPaths = filePaths.filter((p) => !isExcluded(p) && !matchesExcludePattern(p));
85068
85059
  const entries2 = buildEntries(filteredPaths, rootDir, maxEntries);
85069
85060
  return {
@@ -85072,6 +85063,70 @@ async function scanFileTree(rootDir, options) {
85072
85063
  rootDir
85073
85064
  };
85074
85065
  }
85066
+ async function isGitRepo2(rootDir) {
85067
+ try {
85068
+ const { stdout } = await execAsync4("git rev-parse --is-inside-work-tree", {
85069
+ cwd: rootDir,
85070
+ env: { ...process.env, GIT_TERMINAL_PROMPT: "0", GIT_PAGER: "cat", NO_COLOR: "1" },
85071
+ maxBuffer: 1024 * 1024
85072
+ });
85073
+ return stdout.trim() === "true";
85074
+ } catch {
85075
+ return false;
85076
+ }
85077
+ }
85078
+ async function walkFsFallback(rootDir, maxEntries, maxSubtreeBytes) {
85079
+ const collected = [];
85080
+ await walkSubtree(rootDir, "", collected, maxEntries, maxSubtreeBytes);
85081
+ return collected;
85082
+ }
85083
+ async function walkSubtree(absRoot, relDir, collected, maxEntries, maxSubtreeBytes) {
85084
+ if (collected.length >= maxEntries)
85085
+ return 0;
85086
+ const absDir = relDir ? path3.join(absRoot, relDir) : absRoot;
85087
+ let dirents;
85088
+ try {
85089
+ dirents = await fsPromises.readdir(absDir, { withFileTypes: true });
85090
+ } catch {
85091
+ return 0;
85092
+ }
85093
+ const staged = [];
85094
+ let subtreeBytes = 0;
85095
+ for (const ent of dirents) {
85096
+ if (collected.length + staged.length >= maxEntries)
85097
+ break;
85098
+ if (ALWAYS_EXCLUDE.has(ent.name))
85099
+ continue;
85100
+ const childRel = relDir ? `${relDir}/${ent.name}` : ent.name;
85101
+ if (ent.isDirectory()) {
85102
+ const subCollected = [];
85103
+ const subSize = await walkSubtree(absRoot, childRel, subCollected, maxEntries - collected.length - staged.length, maxSubtreeBytes);
85104
+ if (subSize === null) {
85105
+ continue;
85106
+ }
85107
+ subtreeBytes += subSize;
85108
+ if (subtreeBytes > maxSubtreeBytes) {
85109
+ return null;
85110
+ }
85111
+ staged.push(...subCollected);
85112
+ } else if (ent.isFile()) {
85113
+ try {
85114
+ const st = await fsPromises.stat(path3.join(absRoot, childRel));
85115
+ subtreeBytes += st.size;
85116
+ if (subtreeBytes > maxSubtreeBytes) {
85117
+ return null;
85118
+ }
85119
+ staged.push(childRel);
85120
+ } catch {}
85121
+ }
85122
+ }
85123
+ for (const p of staged) {
85124
+ if (collected.length >= maxEntries)
85125
+ break;
85126
+ collected.push(p);
85127
+ }
85128
+ return subtreeBytes;
85129
+ }
85075
85130
  async function getGitFiles(rootDir) {
85076
85131
  const env2 = {
85077
85132
  ...process.env,
@@ -85132,9 +85187,10 @@ function buildEntries(filePaths, rootDir, maxEntries) {
85132
85187
  }
85133
85188
  return entries2;
85134
85189
  }
85135
- var execAsync4, DEFAULT_MAX_ENTRIES = 1e4, ALWAYS_EXCLUDE, EXCLUDE_PATTERNS;
85190
+ var execAsync4, DEFAULT_MAX_ENTRIES = 1e4, FS_FALLBACK_MAX_SUBTREE_BYTES, ALWAYS_EXCLUDE, EXCLUDE_PATTERNS;
85136
85191
  var init_file_tree_scanner = __esm(() => {
85137
85192
  execAsync4 = promisify5(exec6);
85193
+ FS_FALLBACK_MAX_SUBTREE_BYTES = 50 * 1024 * 1024;
85138
85194
  ALWAYS_EXCLUDE = new Set([
85139
85195
  "node_modules",
85140
85196
  ".git",
@@ -87891,11 +87947,11 @@ async function installTool(options = {}, deps) {
87891
87947
  const d = deps ?? await createDefaultDeps22();
87892
87948
  const { checkExisting = true } = options;
87893
87949
  const os2 = await import("os");
87894
- const path3 = await import("path");
87950
+ const path4 = await import("path");
87895
87951
  const homeDir = os2.homedir();
87896
- const toolDir = path3.join(homeDir, ".config", "opencode", "tool");
87897
- const toolPath = path3.join(toolDir, "chatroom.ts");
87898
- const handoffToolPath = path3.join(toolDir, "chatroom-handoff.ts");
87952
+ const toolDir = path4.join(homeDir, ".config", "opencode", "tool");
87953
+ const toolPath = path4.join(toolDir, "chatroom.ts");
87954
+ const handoffToolPath = path4.join(toolDir, "chatroom-handoff.ts");
87899
87955
  const toolContent = `import { tool } from "@opencode-ai/plugin";
87900
87956
 
87901
87957
  /**
@@ -88883,4 +88939,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
88883
88939
  });
88884
88940
  program2.parse();
88885
88941
 
88886
- //# debugId=7F8AA45E5D5C7F2164756E2164756E21
88942
+ //# debugId=4112CAEC73861F5764756E2164756E21