@spader/dotllm 1.3.3 → 1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spader/dotllm",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "A simple CLI to clone, manage, and link repositories for LLM reference",
5
5
  "type": "module",
6
6
  "repository": {
@@ -398,10 +398,18 @@ function sync() {
398
398
  continue;
399
399
  }
400
400
  const target = path4.join(refDir, name);
401
- if (fs4.existsSync(target)) {
401
+ const stat = fs4.lstatSync(target, { throwIfNoEntry: false });
402
+ if (stat && !stat.isSymbolicLink()) {
402
403
  unchanged.push(name);
403
404
  continue;
404
405
  }
406
+ if (stat && fs4.readlinkSync(target) === store) {
407
+ unchanged.push(name);
408
+ continue;
409
+ }
410
+ if (stat) {
411
+ fs4.unlinkSync(target);
412
+ }
405
413
  fs4.symlinkSync(store, target, "dir");
406
414
  linked.push(name);
407
415
  }
@@ -441,7 +449,7 @@ function unlink(name) {
441
449
  return { ok: false, error: `"${name}" is not linked in local config` };
442
450
  }
443
451
  const target = path5.join(Config.refDir(), found.name);
444
- if (fs5.existsSync(target)) {
452
+ if (fs5.lstatSync(target, { throwIfNoEntry: false })) {
445
453
  fs5.unlinkSync(target);
446
454
  }
447
455
  Config.Local.write(Config.Local.remove(local, found.name));
@@ -398,10 +398,18 @@ function sync() {
398
398
  continue;
399
399
  }
400
400
  const target = path4.join(refDir, name);
401
- if (fs4.existsSync(target)) {
401
+ const stat = fs4.lstatSync(target, { throwIfNoEntry: false });
402
+ if (stat && !stat.isSymbolicLink()) {
402
403
  unchanged.push(name);
403
404
  continue;
404
405
  }
406
+ if (stat && fs4.readlinkSync(target) === store) {
407
+ unchanged.push(name);
408
+ continue;
409
+ }
410
+ if (stat) {
411
+ fs4.unlinkSync(target);
412
+ }
405
413
  fs4.symlinkSync(store, target, "dir");
406
414
  linked.push(name);
407
415
  }
@@ -441,7 +449,7 @@ function unlink(name) {
441
449
  return { ok: false, error: `"${name}" is not linked in local config` };
442
450
  }
443
451
  const target = path5.join(Config.refDir(), found.name);
444
- if (fs5.existsSync(target)) {
452
+ if (fs5.lstatSync(target, { throwIfNoEntry: false })) {
445
453
  fs5.unlinkSync(target);
446
454
  }
447
455
  Config.Local.write(Config.Local.remove(local, found.name));
@@ -398,10 +398,18 @@ function sync() {
398
398
  continue;
399
399
  }
400
400
  const target = path4.join(refDir, name);
401
- if (fs4.existsSync(target)) {
401
+ const stat = fs4.lstatSync(target, { throwIfNoEntry: false });
402
+ if (stat && !stat.isSymbolicLink()) {
402
403
  unchanged.push(name);
403
404
  continue;
404
405
  }
406
+ if (stat && fs4.readlinkSync(target) === store) {
407
+ unchanged.push(name);
408
+ continue;
409
+ }
410
+ if (stat) {
411
+ fs4.unlinkSync(target);
412
+ }
405
413
  fs4.symlinkSync(store, target, "dir");
406
414
  linked.push(name);
407
415
  }
@@ -441,7 +449,7 @@ function unlink(name) {
441
449
  return { ok: false, error: `"${name}" is not linked in local config` };
442
450
  }
443
451
  const target = path5.join(Config.refDir(), found.name);
444
- if (fs5.existsSync(target)) {
452
+ if (fs5.lstatSync(target, { throwIfNoEntry: false })) {
445
453
  fs5.unlinkSync(target);
446
454
  }
447
455
  Config.Local.write(Config.Local.remove(local, found.name));
@@ -398,10 +398,18 @@ function sync() {
398
398
  continue;
399
399
  }
400
400
  const target = path4.join(refDir, name);
401
- if (fs4.existsSync(target)) {
401
+ const stat = fs4.lstatSync(target, { throwIfNoEntry: false });
402
+ if (stat && !stat.isSymbolicLink()) {
402
403
  unchanged.push(name);
403
404
  continue;
404
405
  }
406
+ if (stat && fs4.readlinkSync(target) === store) {
407
+ unchanged.push(name);
408
+ continue;
409
+ }
410
+ if (stat) {
411
+ fs4.unlinkSync(target);
412
+ }
405
413
  fs4.symlinkSync(store, target, "dir");
406
414
  linked.push(name);
407
415
  }
@@ -441,7 +449,7 @@ function unlink(name) {
441
449
  return { ok: false, error: `"${name}" is not linked in local config` };
442
450
  }
443
451
  const target = path5.join(Config.refDir(), found.name);
444
- if (fs5.existsSync(target)) {
452
+ if (fs5.lstatSync(target, { throwIfNoEntry: false })) {
445
453
  fs5.unlinkSync(target);
446
454
  }
447
455
  Config.Local.write(Config.Local.remove(local, found.name));
@@ -398,10 +398,18 @@ function sync() {
398
398
  continue;
399
399
  }
400
400
  const target = path4.join(refDir, name);
401
- if (fs4.existsSync(target)) {
401
+ const stat = fs4.lstatSync(target, { throwIfNoEntry: false });
402
+ if (stat && !stat.isSymbolicLink()) {
402
403
  unchanged.push(name);
403
404
  continue;
404
405
  }
406
+ if (stat && fs4.readlinkSync(target) === store) {
407
+ unchanged.push(name);
408
+ continue;
409
+ }
410
+ if (stat) {
411
+ fs4.unlinkSync(target);
412
+ }
405
413
  fs4.symlinkSync(store, target, "dir");
406
414
  linked.push(name);
407
415
  }
@@ -441,7 +449,7 @@ function unlink(name) {
441
449
  return { ok: false, error: `"${name}" is not linked in local config` };
442
450
  }
443
451
  const target = path5.join(Config.refDir(), found.name);
444
- if (fs5.existsSync(target)) {
452
+ if (fs5.lstatSync(target, { throwIfNoEntry: false })) {
445
453
  fs5.unlinkSync(target);
446
454
  }
447
455
  Config.Local.write(Config.Local.remove(local, found.name));
@@ -398,10 +398,18 @@ function sync() {
398
398
  continue;
399
399
  }
400
400
  const target = path4.join(refDir, name);
401
- if (fs4.existsSync(target)) {
401
+ const stat = fs4.lstatSync(target, { throwIfNoEntry: false });
402
+ if (stat && !stat.isSymbolicLink()) {
402
403
  unchanged.push(name);
403
404
  continue;
404
405
  }
406
+ if (stat && fs4.readlinkSync(target) === store) {
407
+ unchanged.push(name);
408
+ continue;
409
+ }
410
+ if (stat) {
411
+ fs4.unlinkSync(target);
412
+ }
405
413
  fs4.symlinkSync(store, target, "dir");
406
414
  linked.push(name);
407
415
  }
@@ -441,7 +449,7 @@ function unlink(name) {
441
449
  return { ok: false, error: `"${name}" is not linked in local config` };
442
450
  }
443
451
  const target = path5.join(Config.refDir(), found.name);
444
- if (fs5.existsSync(target)) {
452
+ if (fs5.lstatSync(target, { throwIfNoEntry: false })) {
445
453
  fs5.unlinkSync(target);
446
454
  }
447
455
  Config.Local.write(Config.Local.remove(local, found.name));
@@ -398,10 +398,18 @@ function sync() {
398
398
  continue;
399
399
  }
400
400
  const target = path4.join(refDir, name);
401
- if (fs4.existsSync(target)) {
401
+ const stat = fs4.lstatSync(target, { throwIfNoEntry: false });
402
+ if (stat && !stat.isSymbolicLink()) {
402
403
  unchanged.push(name);
403
404
  continue;
404
405
  }
406
+ if (stat && fs4.readlinkSync(target) === store) {
407
+ unchanged.push(name);
408
+ continue;
409
+ }
410
+ if (stat) {
411
+ fs4.unlinkSync(target);
412
+ }
405
413
  fs4.symlinkSync(store, target, "dir");
406
414
  linked.push(name);
407
415
  }
@@ -441,7 +449,7 @@ function unlink(name) {
441
449
  return { ok: false, error: `"${name}" is not linked in local config` };
442
450
  }
443
451
  const target = path5.join(Config.refDir(), found.name);
444
- if (fs5.existsSync(target)) {
452
+ if (fs5.lstatSync(target, { throwIfNoEntry: false })) {
445
453
  fs5.unlinkSync(target);
446
454
  }
447
455
  Config.Local.write(Config.Local.remove(local, found.name));
@@ -398,10 +398,18 @@ function sync() {
398
398
  continue;
399
399
  }
400
400
  const target = path4.join(refDir, name);
401
- if (fs4.existsSync(target)) {
401
+ const stat = fs4.lstatSync(target, { throwIfNoEntry: false });
402
+ if (stat && !stat.isSymbolicLink()) {
402
403
  unchanged.push(name);
403
404
  continue;
404
405
  }
406
+ if (stat && fs4.readlinkSync(target) === store) {
407
+ unchanged.push(name);
408
+ continue;
409
+ }
410
+ if (stat) {
411
+ fs4.unlinkSync(target);
412
+ }
405
413
  fs4.symlinkSync(store, target, "dir");
406
414
  linked.push(name);
407
415
  }
@@ -441,7 +449,7 @@ function unlink(name) {
441
449
  return { ok: false, error: `"${name}" is not linked in local config` };
442
450
  }
443
451
  const target = path5.join(Config.refDir(), found.name);
444
- if (fs5.existsSync(target)) {
452
+ if (fs5.lstatSync(target, { throwIfNoEntry: false })) {
445
453
  fs5.unlinkSync(target);
446
454
  }
447
455
  Config.Local.write(Config.Local.remove(local, found.name));
package/src/cli/index.js CHANGED
@@ -399,10 +399,18 @@ function sync() {
399
399
  continue;
400
400
  }
401
401
  const target = path4.join(refDir, name);
402
- if (fs4.existsSync(target)) {
402
+ const stat = fs4.lstatSync(target, { throwIfNoEntry: false });
403
+ if (stat && !stat.isSymbolicLink()) {
403
404
  unchanged.push(name);
404
405
  continue;
405
406
  }
407
+ if (stat && fs4.readlinkSync(target) === store) {
408
+ unchanged.push(name);
409
+ continue;
410
+ }
411
+ if (stat) {
412
+ fs4.unlinkSync(target);
413
+ }
406
414
  fs4.symlinkSync(store, target, "dir");
407
415
  linked.push(name);
408
416
  }
@@ -442,7 +450,7 @@ function unlink(name) {
442
450
  return { ok: false, error: `"${name}" is not linked in local config` };
443
451
  }
444
452
  const target = path5.join(Config.refDir(), found.name);
445
- if (fs5.existsSync(target)) {
453
+ if (fs5.lstatSync(target, { throwIfNoEntry: false })) {
446
454
  fs5.unlinkSync(target);
447
455
  }
448
456
  Config.Local.write(Config.Local.remove(local, found.name));
@@ -718,7 +726,7 @@ function help(def, name, path = [], t = defaultTheme) {
718
726
  }
719
727
  }
720
728
  function fail(def, name, path = []) {
721
- return (msg) => {
729
+ return (msg, err) => {
722
730
  if (process.argv.includes("--help") || process.argv.includes("-h")) {
723
731
  help(def, name, path);
724
732
  process.exit(0);
@@ -727,7 +735,7 @@ function fail(def, name, path = []) {
727
735
  help(def, name, path);
728
736
  process.exit(1);
729
737
  }
730
- console.error(pc.red(msg ?? "Unknown error"));
738
+ console.error(pc.red(msg ?? err?.stack ?? err?.message ?? "Unknown error"));
731
739
  process.exit(1);
732
740
  };
733
741
  }
package/src/cli/yargs.js CHANGED
@@ -255,7 +255,7 @@ function help(def, name, path = [], t = defaultTheme) {
255
255
  }
256
256
  }
257
257
  function fail(def, name, path = []) {
258
- return (msg) => {
258
+ return (msg, err) => {
259
259
  if (process.argv.includes("--help") || process.argv.includes("-h")) {
260
260
  help(def, name, path);
261
261
  process.exit(0);
@@ -264,7 +264,7 @@ function fail(def, name, path = []) {
264
264
  help(def, name, path);
265
265
  process.exit(1);
266
266
  }
267
- console.error(pc.red(msg ?? "Unknown error"));
267
+ console.error(pc.red(msg ?? err?.stack ?? err?.message ?? "Unknown error"));
268
268
  process.exit(1);
269
269
  };
270
270
  }
package/src/core/index.js CHANGED
@@ -398,10 +398,18 @@ function sync() {
398
398
  continue;
399
399
  }
400
400
  const target = path4.join(refDir, name);
401
- if (fs4.existsSync(target)) {
401
+ const stat = fs4.lstatSync(target, { throwIfNoEntry: false });
402
+ if (stat && !stat.isSymbolicLink()) {
402
403
  unchanged.push(name);
403
404
  continue;
404
405
  }
406
+ if (stat && fs4.readlinkSync(target) === store) {
407
+ unchanged.push(name);
408
+ continue;
409
+ }
410
+ if (stat) {
411
+ fs4.unlinkSync(target);
412
+ }
405
413
  fs4.symlinkSync(store, target, "dir");
406
414
  linked.push(name);
407
415
  }
@@ -441,7 +449,7 @@ function unlink(name) {
441
449
  return { ok: false, error: `"${name}" is not linked in local config` };
442
450
  }
443
451
  const target = path5.join(Config.refDir(), found.name);
444
- if (fs5.existsSync(target)) {
452
+ if (fs5.lstatSync(target, { throwIfNoEntry: false })) {
445
453
  fs5.unlinkSync(target);
446
454
  }
447
455
  Config.Local.write(Config.Local.remove(local, found.name));
package/src/core/link.js CHANGED
@@ -299,10 +299,18 @@ function sync() {
299
299
  continue;
300
300
  }
301
301
  const target = path2.join(refDir, name);
302
- if (fs2.existsSync(target)) {
302
+ const stat = fs2.lstatSync(target, { throwIfNoEntry: false });
303
+ if (stat && !stat.isSymbolicLink()) {
303
304
  unchanged.push(name);
304
305
  continue;
305
306
  }
307
+ if (stat && fs2.readlinkSync(target) === store) {
308
+ unchanged.push(name);
309
+ continue;
310
+ }
311
+ if (stat) {
312
+ fs2.unlinkSync(target);
313
+ }
306
314
  fs2.symlinkSync(store, target, "dir");
307
315
  linked.push(name);
308
316
  }
package/src/core/sync.js CHANGED
@@ -299,10 +299,18 @@ function sync() {
299
299
  continue;
300
300
  }
301
301
  const target = path2.join(refDir, name);
302
- if (fs2.existsSync(target)) {
302
+ const stat = fs2.lstatSync(target, { throwIfNoEntry: false });
303
+ if (stat && !stat.isSymbolicLink()) {
303
304
  unchanged.push(name);
304
305
  continue;
305
306
  }
307
+ if (stat && fs2.readlinkSync(target) === store) {
308
+ unchanged.push(name);
309
+ continue;
310
+ }
311
+ if (stat) {
312
+ fs2.unlinkSync(target);
313
+ }
306
314
  fs2.symlinkSync(store, target, "dir");
307
315
  linked.push(name);
308
316
  }
@@ -163,7 +163,7 @@ function unlink(name) {
163
163
  return { ok: false, error: `"${name}" is not linked in local config` };
164
164
  }
165
165
  const target = path2.join(Config.refDir(), found.name);
166
- if (fs2.existsSync(target)) {
166
+ if (fs2.lstatSync(target, { throwIfNoEntry: false })) {
167
167
  fs2.unlinkSync(target);
168
168
  }
169
169
  Config.Local.write(Config.Local.remove(local, found.name));