@docyrus/docyrus 0.0.74 → 0.0.76

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/main.js CHANGED
@@ -139349,7 +139349,7 @@ function buildInputSchema(args2, env2, options2) {
139349
139349
  // package.json
139350
139350
  var package_default = {
139351
139351
  name: "@docyrus/docyrus",
139352
- version: "0.0.74",
139352
+ version: "0.0.76",
139353
139353
  private: false,
139354
139354
  description: "Docyrus API CLI",
139355
139355
  main: "./main.js",
@@ -154051,15 +154051,13 @@ async function migrateLegacyTrackedSessions(params) {
154051
154051
  await (0, import_promises22.mkdir)(params.trackedSessionsRootPath, { recursive: true });
154052
154052
  for (const dir of legacyDirs) {
154053
154053
  const legacyDirPath = (0, import_node_path28.join)(legacyRoot, dir.name);
154054
- const trackedDirPath = (0, import_node_path28.join)(params.trackedSessionsRootPath, dir.name);
154055
- await (0, import_promises22.mkdir)(trackedDirPath, { recursive: true });
154056
154054
  const fileEntries = await (0, import_promises22.readdir)(legacyDirPath, { withFileTypes: true }).catch(() => []);
154057
154055
  for (const file2 of fileEntries) {
154058
154056
  if (!file2.isFile()) {
154059
154057
  continue;
154060
154058
  }
154061
154059
  const source = (0, import_node_path28.join)(legacyDirPath, file2.name);
154062
- const destination = (0, import_node_path28.join)(trackedDirPath, file2.name);
154060
+ const destination = (0, import_node_path28.join)(params.trackedSessionsRootPath, file2.name);
154063
154061
  if (await pathExists(destination)) {
154064
154062
  result.skippedFiles += 1;
154065
154063
  continue;
@@ -154077,6 +154075,10 @@ async function migrateLegacyTrackedSessions(params) {
154077
154075
  });
154078
154076
  }
154079
154077
  }
154078
+ await flattenStaleSessionSubdirs({
154079
+ trackedSessionsRootPath: params.trackedSessionsRootPath,
154080
+ result
154081
+ });
154080
154082
  const remainingTop = await (0, import_promises22.readdir)(legacyRoot).catch(() => null);
154081
154083
  if (remainingTop && remainingTop.length === 0) {
154082
154084
  await (0, import_promises22.rm)(legacyRoot, { recursive: true, force: true }).catch(() => {
@@ -154092,6 +154094,42 @@ async function migrateLegacyTrackedSessions(params) {
154092
154094
  }
154093
154095
  return result;
154094
154096
  }
154097
+ async function flattenStaleSessionSubdirs(params) {
154098
+ const trackedRoot = await safeResolveRealPath(params.trackedSessionsRootPath);
154099
+ if (!trackedRoot) {
154100
+ return;
154101
+ }
154102
+ const entries = await (0, import_promises22.readdir)(trackedRoot, { withFileTypes: true }).catch(() => []);
154103
+ for (const entry of entries) {
154104
+ if (!entry.isDirectory()) {
154105
+ continue;
154106
+ }
154107
+ const subdirPath = (0, import_node_path28.join)(trackedRoot, entry.name);
154108
+ const subdirEntries = await (0, import_promises22.readdir)(subdirPath, { withFileTypes: true }).catch(() => []);
154109
+ for (const file2 of subdirEntries) {
154110
+ if (!file2.isFile()) {
154111
+ continue;
154112
+ }
154113
+ const source = (0, import_node_path28.join)(subdirPath, file2.name);
154114
+ const destination = (0, import_node_path28.join)(trackedRoot, file2.name);
154115
+ if (await pathExists(destination)) {
154116
+ params.result.skippedFiles += 1;
154117
+ continue;
154118
+ }
154119
+ try {
154120
+ await moveFile(source, destination);
154121
+ params.result.movedFiles += 1;
154122
+ } catch {
154123
+ params.result.skippedFiles += 1;
154124
+ }
154125
+ }
154126
+ const remaining = await (0, import_promises22.readdir)(subdirPath).catch(() => null);
154127
+ if (remaining && remaining.length === 0) {
154128
+ await (0, import_promises22.rm)(subdirPath, { recursive: true, force: true }).catch(() => {
154129
+ });
154130
+ }
154131
+ }
154132
+ }
154095
154133
 
154096
154134
  // src/services/soulRegistry.ts
154097
154135
  var import_promises23 = require("node:fs/promises");
@@ -154981,6 +155019,10 @@ function createPiAgentServerLauncher(options2) {
154981
155019
  globalRootPath: agentRootPath
154982
155020
  }).catch(() => {
154983
155021
  });
155022
+ await migrateLegacyTrackedSessions({
155023
+ legacyTrackedSessionsRootPath: (0, import_node_path31.join)(resolveDocyrusPiAgentRootPath(settingsRootPath), "sessions"),
155024
+ trackedSessionsRootPath: resolveDocyrusTrackedSessionsRootPath(cwd)
155025
+ });
154984
155026
  const resourceRoot = resolvePackagedPiResourceRoot({ cwd });
154985
155027
  spinner.update("Syncing skills...");
154986
155028
  await syncPackagedSkills({