@team-ai/teamai-cli 0.22.9 → 0.22.10

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.
Files changed (2) hide show
  1. package/dist/cli.js +36 -10
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -60483,6 +60483,7 @@ __export(local_agent_exports, {
60483
60483
  pullLocalAgentForCwd: () => pullLocalAgentForCwd,
60484
60484
  rebuildLocalAgentGitExcludeWithout: () => rebuildLocalAgentGitExcludeWithout,
60485
60485
  releaseClaudeModelConfig: () => releaseClaudeModelConfig,
60486
+ rememberSeenWorkspace: () => rememberSeenWorkspace,
60486
60487
  removeAllAgentHooks: () => removeAllAgentHooks,
60487
60488
  removeLocalAgentHttp: () => removeLocalAgentHttp,
60488
60489
  reportAndSyncFromHook: () => reportAndSyncFromHook,
@@ -61514,27 +61515,46 @@ async function scanModelsFromDisk(tool, workspacePath) {
61514
61515
  }
61515
61516
  async function pruneDeadWorkspaceBindings(config) {
61516
61517
  let changed = false;
61517
- for (const workspacePath of Object.keys(config.workspaceBindings)) {
61518
+ const drop = async (workspacePath, remove5) => {
61518
61519
  if (await isUserHomeDir(workspacePath)) {
61519
- delete config.workspaceBindings[workspacePath];
61520
+ remove5();
61520
61521
  changed = true;
61521
- continue;
61522
+ return;
61522
61523
  }
61523
61524
  try {
61524
61525
  await fs32.promises.stat(workspacePath);
61525
61526
  } catch (error2) {
61526
61527
  if (error2.code === "ENOENT") {
61527
- delete config.workspaceBindings[workspacePath];
61528
+ remove5();
61528
61529
  changed = true;
61529
61530
  } else {
61530
61531
  log.debug(
61531
- `local-agent: keeping workspace binding ${workspacePath} despite stat error: ${error2.message}`
61532
+ `local-agent: keeping workspace ${workspacePath} despite stat error: ${error2.message}`
61532
61533
  );
61533
61534
  }
61534
61535
  }
61536
+ };
61537
+ for (const workspacePath of Object.keys(config.workspaceBindings)) {
61538
+ await drop(workspacePath, () => {
61539
+ delete config.workspaceBindings[workspacePath];
61540
+ });
61541
+ }
61542
+ for (const workspacePath of Object.keys(config.seenWorkspaces ?? {})) {
61543
+ await drop(workspacePath, () => {
61544
+ delete config.seenWorkspaces?.[workspacePath];
61545
+ });
61535
61546
  }
61536
61547
  return changed;
61537
61548
  }
61549
+ function rememberSeenWorkspace(config, currentPath, tool) {
61550
+ if (!currentPath) return false;
61551
+ const normalized = normalizeAgentType(tool);
61552
+ const seen = config.seenWorkspaces ??= {};
61553
+ const existing2 = seen[currentPath];
61554
+ if (existing2?.ideType === normalized) return false;
61555
+ seen[currentPath] = { ideType: normalized, seenAt: existing2?.seenAt ?? (/* @__PURE__ */ new Date()).toISOString() };
61556
+ return true;
61557
+ }
61538
61558
  function stampWorkspaceTool(config, currentPath, tool) {
61539
61559
  if (!currentPath) return false;
61540
61560
  const binding = config.workspaceBindings[currentPath];
@@ -61545,11 +61565,15 @@ function stampWorkspaceTool(config, currentPath, tool) {
61545
61565
  return true;
61546
61566
  }
61547
61567
  function selectToolWorkspaces(config, currentPath, currentTool) {
61548
- const paths = new Set(Object.keys(config.workspaceBindings));
61568
+ const paths = /* @__PURE__ */ new Set([
61569
+ ...Object.keys(config.workspaceBindings),
61570
+ ...Object.keys(config.seenWorkspaces ?? {})
61571
+ ]);
61549
61572
  if (currentPath) paths.add(currentPath);
61550
61573
  return Array.from(paths).filter((wsPath) => {
61551
- const b2 = config.workspaceBindings[wsPath];
61552
- const wsTool = (b2?.ideType || void 0) ?? (wsPath === currentPath ? currentTool : void 0);
61574
+ const bindingTool = config.workspaceBindings[wsPath]?.ideType || void 0;
61575
+ const seenTool = config.seenWorkspaces?.[wsPath]?.ideType || void 0;
61576
+ const wsTool = bindingTool ?? seenTool ?? (wsPath === currentPath ? currentTool : void 0);
61553
61577
  return wsTool === currentTool;
61554
61578
  });
61555
61579
  }
@@ -63335,8 +63359,10 @@ async function syncLocalAgent(context) {
63335
63359
  }
63336
63360
  const pruned = await pruneDeadWorkspaceBindings(config);
63337
63361
  const currentPath = await resolveWorkspacePath(context.cwd);
63338
- const stamped = stampWorkspaceTool(config, currentPath, context.tool ?? "workbuddy");
63339
- if (pruned || stamped) {
63362
+ const tool = context.tool ?? "workbuddy";
63363
+ const stamped = stampWorkspaceTool(config, currentPath, tool);
63364
+ const remembered = rememberSeenWorkspace(config, currentPath, tool);
63365
+ if (pruned || stamped || remembered) {
63340
63366
  await saveLocalAgentConfig(config);
63341
63367
  }
63342
63368
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-ai/teamai-cli",
3
- "version": "0.22.9",
3
+ "version": "0.22.10",
4
4
  "description": "TeamAI — Make Every Team AI Native (skill sync + shared knowledge base, powered by Git)",
5
5
  "type": "module",
6
6
  "bin": {