@dzhng/crm.cli 0.3.2 → 0.3.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.
Files changed (2) hide show
  1. package/dist/cli.js +25 -3
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -3261,7 +3261,12 @@ function getDaemonArgs() {
3261
3261
  if (!script) {
3262
3262
  return [];
3263
3263
  }
3264
- const resolved = realpathSync(script);
3264
+ let resolved;
3265
+ try {
3266
+ resolved = realpathSync(script);
3267
+ } catch {
3268
+ return [];
3269
+ }
3265
3270
  if (/\.[tj]s$/.test(resolved)) {
3266
3271
  return [resolved];
3267
3272
  }
@@ -3497,6 +3502,23 @@ function registerFuseCommands(program) {
3497
3502
  program.command("mount").description("Mount CRM as virtual filesystem").argument("[mountpoint]", "Mount point directory").option("--readonly", "Mount read-only").action(async (mountpoint, opts) => {
3498
3503
  const { config } = await getCtx();
3499
3504
  const mp = mountpoint || config.mount.default_path;
3505
+ const pidFile = join3(tmpdir(), `crm-mount-${slugify(mp)}.pid`);
3506
+ if (existsSync3(pidFile)) {
3507
+ const pids = readFileSync2(pidFile, "utf-8").trim().split(`
3508
+ `);
3509
+ const alive = pids.some((pid) => {
3510
+ try {
3511
+ process.kill(Number(pid), 0);
3512
+ return true;
3513
+ } catch {
3514
+ return false;
3515
+ }
3516
+ });
3517
+ if (alive) {
3518
+ die(`Error: ${mp} is already mounted. Run \`crm unmount ${mp}\` first.`);
3519
+ }
3520
+ unlinkSync(pidFile);
3521
+ }
3500
3522
  if (!existsSync3(mp)) {
3501
3523
  mkdirSync4(mp, { recursive: true });
3502
3524
  }
@@ -4423,7 +4445,7 @@ async function _handleGetattr(db, p, stages) {
4423
4445
  ].includes(p)) {
4424
4446
  return { type: "dir" };
4425
4447
  }
4426
- if (p === "pipeline.json" || p === "tags.json") {
4448
+ if (p === "pipeline.json" || p === "tags.json" || p === "llm.txt") {
4427
4449
  return { type: "file" };
4428
4450
  }
4429
4451
  const parts = p.split("/");
@@ -5425,7 +5447,7 @@ if (process.argv[1]?.endsWith("fuse-daemon.ts")) {
5425
5447
 
5426
5448
  // src/cli.ts
5427
5449
  var program = new Command;
5428
- program.name("crm").description("Headless CLI-first CRM").version("0.3.2");
5450
+ program.name("crm").description("Headless CLI-first CRM").version("0.3.4");
5429
5451
  program.exitOverride();
5430
5452
  registerContactCommands(program);
5431
5453
  registerCompanyCommands(program);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dzhng/crm.cli",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "Headless CLI-first CRM",
5
5
  "author": "David Zhang",
6
6
  "license": "MIT",