@basou/cli 0.13.0 → 0.13.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.
package/dist/program.js CHANGED
@@ -1443,6 +1443,7 @@ async function doRunImportClaudeCode(options, ctx) {
1443
1443
  });
1444
1444
  const projectsRoot = ctx.claudeProjectsDir ?? join3(homedir2(), ".claude", "projects");
1445
1445
  const files = await selectTranscriptFiles(projectsRoot, projectPaths, options);
1446
+ const projectSet = new Set(projectPaths);
1446
1447
  const candidates = files.map((file) => {
1447
1448
  const externalId = basename(file, ".jsonl");
1448
1449
  return {
@@ -1450,6 +1451,8 @@ async function doRunImportClaudeCode(options, ctx) {
1450
1451
  sourcePath: file,
1451
1452
  toPayload: async () => {
1452
1453
  const { records, sizeBytes } = await readJsonlRecords(file);
1454
+ const cwd = firstTranscriptCwd(records);
1455
+ if (cwd === void 0 || !projectSet.has(cwd)) return null;
1453
1456
  return claudeTranscriptToImportPayload(records, {
1454
1457
  workspaceId: manifest.workspace.id,
1455
1458
  externalId,
@@ -1623,7 +1626,14 @@ async function classifyReimport(priors, sourcePath, externalId, counts) {
1623
1626
  return prior;
1624
1627
  }
1625
1628
  function encodeProjectDir(projectPath) {
1626
- return projectPath.replaceAll("/", "-");
1629
+ return projectPath.replace(/[^a-zA-Z0-9]/g, "-");
1630
+ }
1631
+ function firstTranscriptCwd(records) {
1632
+ for (const record of records) {
1633
+ const cwd = record.cwd;
1634
+ if (typeof cwd === "string" && cwd.length > 0) return cwd;
1635
+ }
1636
+ return void 0;
1627
1637
  }
1628
1638
  async function loadExistingByExternalId(paths, sourceKind) {
1629
1639
  const byExternalId = /* @__PURE__ */ new Map();