@archildata/just-bash 0.8.10 → 0.8.11
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/index.cjs +51 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +51 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -615,12 +615,62 @@ function createArchilCommand(client, fs) {
|
|
|
615
615
|
return ok("Delegations:\n" + lines.join("\n") + "\n");
|
|
616
616
|
} catch (err) {
|
|
617
617
|
return fail(`Failed to list delegations: ${err instanceof Error ? err.message : err}
|
|
618
|
+
`);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
if (subcommand === "invalidate-cache") {
|
|
622
|
+
const pathArg = args.slice(1).find((a) => !a.startsWith("-"));
|
|
623
|
+
let scopeLabel = "(mount-wide)";
|
|
624
|
+
if (pathArg) {
|
|
625
|
+
const fullPath = fs.resolvePath(ctx.cwd, pathArg);
|
|
626
|
+
try {
|
|
627
|
+
await fs.resolveInodeId(fullPath);
|
|
628
|
+
scopeLabel = `(via ${fullPath})`;
|
|
629
|
+
} catch (err) {
|
|
630
|
+
return fail(`Failed to resolve ${fullPath}: ${err instanceof Error ? err.message : err}
|
|
631
|
+
`);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
try {
|
|
635
|
+
const stats = client.invalidateCache();
|
|
636
|
+
return ok(
|
|
637
|
+
`Invalidated cache ${scopeLabel}: ${stats.totalEvictedInodes} inodes evicted (attr=${stats.attribute}, xattr=${stats.extendedAttribute}, dirent=${stats.dirent}, file=${stats.fileData})
|
|
638
|
+
`
|
|
639
|
+
);
|
|
640
|
+
} catch (err) {
|
|
641
|
+
return fail(`Failed to invalidate cache: ${err instanceof Error ? err.message : err}
|
|
642
|
+
`);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
if (subcommand === "set-cache-expiry") {
|
|
646
|
+
const rest = args.slice(1);
|
|
647
|
+
const flagIdx = rest.indexOf("--readdir-expiry");
|
|
648
|
+
if (flagIdx === -1 || flagIdx === rest.length - 1) {
|
|
649
|
+
return fail("Usage: archil set-cache-expiry <path> --readdir-expiry <seconds>\n");
|
|
650
|
+
}
|
|
651
|
+
const flagValueIdx = flagIdx + 1;
|
|
652
|
+
const expirySeconds = Number(rest[flagValueIdx]);
|
|
653
|
+
if (!Number.isInteger(expirySeconds) || expirySeconds < 0) {
|
|
654
|
+
return fail("--readdir-expiry must be a non-negative integer (seconds)\n");
|
|
655
|
+
}
|
|
656
|
+
const pathArg = rest.find((a, i) => i !== flagIdx && i !== flagValueIdx && !a.startsWith("-"));
|
|
657
|
+
if (!pathArg) {
|
|
658
|
+
return fail("Usage: archil set-cache-expiry <path> --readdir-expiry <seconds>\n");
|
|
659
|
+
}
|
|
660
|
+
const fullPath = fs.resolvePath(ctx.cwd, pathArg);
|
|
661
|
+
try {
|
|
662
|
+
const inodeId = await fs.resolveInodeId(fullPath);
|
|
663
|
+
client.setCacheExpiry(inodeId, expirySeconds);
|
|
664
|
+
return ok(`Set readdir cache expiry for ${fullPath} (inode ${inodeId}) to ${expirySeconds}s
|
|
665
|
+
`);
|
|
666
|
+
} catch (err) {
|
|
667
|
+
return fail(`Failed to set cache expiry for ${fullPath}: ${err instanceof Error ? err.message : err}
|
|
618
668
|
`);
|
|
619
669
|
}
|
|
620
670
|
}
|
|
621
671
|
if (subcommand === "help" || !subcommand) {
|
|
622
672
|
return ok(
|
|
623
|
-
"Archil commands:\n archil checkout [--force|-f] <path>
|
|
673
|
+
"Archil commands:\n archil checkout [--force|-f] <path> - Acquire write delegation\n archil checkin <path> - Release write delegation\n archil list-delegations - Show held delegations\n archil invalidate-cache [<path>] - Drop every evictable cache entry\n archil set-cache-expiry <path> --readdir-expiry <secs>\n - Set readdir cache TTL on a directory\n archil help - Show this help message\n\nThe --force flag revokes any existing delegation from other clients.\n"
|
|
624
674
|
);
|
|
625
675
|
}
|
|
626
676
|
return fail(`Unknown archil command: ${subcommand}
|
package/dist/index.d.cts
CHANGED
|
@@ -169,8 +169,9 @@ declare class ArchilFs implements IFileSystem {
|
|
|
169
169
|
/**
|
|
170
170
|
* Create the `archil` custom command for use with just-bash.
|
|
171
171
|
*
|
|
172
|
-
* Provides checkout/checkin delegation management
|
|
173
|
-
* as a shell command that
|
|
172
|
+
* Provides checkout/checkin delegation management, delegation listing, and
|
|
173
|
+
* cache control (invalidate-cache, set-cache-expiry) as a shell command that
|
|
174
|
+
* works in scripts, pipes, and interactive use.
|
|
174
175
|
*
|
|
175
176
|
* @example
|
|
176
177
|
* ```typescript
|
package/dist/index.d.ts
CHANGED
|
@@ -169,8 +169,9 @@ declare class ArchilFs implements IFileSystem {
|
|
|
169
169
|
/**
|
|
170
170
|
* Create the `archil` custom command for use with just-bash.
|
|
171
171
|
*
|
|
172
|
-
* Provides checkout/checkin delegation management
|
|
173
|
-
* as a shell command that
|
|
172
|
+
* Provides checkout/checkin delegation management, delegation listing, and
|
|
173
|
+
* cache control (invalidate-cache, set-cache-expiry) as a shell command that
|
|
174
|
+
* works in scripts, pipes, and interactive use.
|
|
174
175
|
*
|
|
175
176
|
* @example
|
|
176
177
|
* ```typescript
|
package/dist/index.js
CHANGED
|
@@ -577,12 +577,62 @@ function createArchilCommand(client, fs) {
|
|
|
577
577
|
return ok("Delegations:\n" + lines.join("\n") + "\n");
|
|
578
578
|
} catch (err) {
|
|
579
579
|
return fail(`Failed to list delegations: ${err instanceof Error ? err.message : err}
|
|
580
|
+
`);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
if (subcommand === "invalidate-cache") {
|
|
584
|
+
const pathArg = args.slice(1).find((a) => !a.startsWith("-"));
|
|
585
|
+
let scopeLabel = "(mount-wide)";
|
|
586
|
+
if (pathArg) {
|
|
587
|
+
const fullPath = fs.resolvePath(ctx.cwd, pathArg);
|
|
588
|
+
try {
|
|
589
|
+
await fs.resolveInodeId(fullPath);
|
|
590
|
+
scopeLabel = `(via ${fullPath})`;
|
|
591
|
+
} catch (err) {
|
|
592
|
+
return fail(`Failed to resolve ${fullPath}: ${err instanceof Error ? err.message : err}
|
|
593
|
+
`);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
try {
|
|
597
|
+
const stats = client.invalidateCache();
|
|
598
|
+
return ok(
|
|
599
|
+
`Invalidated cache ${scopeLabel}: ${stats.totalEvictedInodes} inodes evicted (attr=${stats.attribute}, xattr=${stats.extendedAttribute}, dirent=${stats.dirent}, file=${stats.fileData})
|
|
600
|
+
`
|
|
601
|
+
);
|
|
602
|
+
} catch (err) {
|
|
603
|
+
return fail(`Failed to invalidate cache: ${err instanceof Error ? err.message : err}
|
|
604
|
+
`);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
if (subcommand === "set-cache-expiry") {
|
|
608
|
+
const rest = args.slice(1);
|
|
609
|
+
const flagIdx = rest.indexOf("--readdir-expiry");
|
|
610
|
+
if (flagIdx === -1 || flagIdx === rest.length - 1) {
|
|
611
|
+
return fail("Usage: archil set-cache-expiry <path> --readdir-expiry <seconds>\n");
|
|
612
|
+
}
|
|
613
|
+
const flagValueIdx = flagIdx + 1;
|
|
614
|
+
const expirySeconds = Number(rest[flagValueIdx]);
|
|
615
|
+
if (!Number.isInteger(expirySeconds) || expirySeconds < 0) {
|
|
616
|
+
return fail("--readdir-expiry must be a non-negative integer (seconds)\n");
|
|
617
|
+
}
|
|
618
|
+
const pathArg = rest.find((a, i) => i !== flagIdx && i !== flagValueIdx && !a.startsWith("-"));
|
|
619
|
+
if (!pathArg) {
|
|
620
|
+
return fail("Usage: archil set-cache-expiry <path> --readdir-expiry <seconds>\n");
|
|
621
|
+
}
|
|
622
|
+
const fullPath = fs.resolvePath(ctx.cwd, pathArg);
|
|
623
|
+
try {
|
|
624
|
+
const inodeId = await fs.resolveInodeId(fullPath);
|
|
625
|
+
client.setCacheExpiry(inodeId, expirySeconds);
|
|
626
|
+
return ok(`Set readdir cache expiry for ${fullPath} (inode ${inodeId}) to ${expirySeconds}s
|
|
627
|
+
`);
|
|
628
|
+
} catch (err) {
|
|
629
|
+
return fail(`Failed to set cache expiry for ${fullPath}: ${err instanceof Error ? err.message : err}
|
|
580
630
|
`);
|
|
581
631
|
}
|
|
582
632
|
}
|
|
583
633
|
if (subcommand === "help" || !subcommand) {
|
|
584
634
|
return ok(
|
|
585
|
-
"Archil commands:\n archil checkout [--force|-f] <path>
|
|
635
|
+
"Archil commands:\n archil checkout [--force|-f] <path> - Acquire write delegation\n archil checkin <path> - Release write delegation\n archil list-delegations - Show held delegations\n archil invalidate-cache [<path>] - Drop every evictable cache entry\n archil set-cache-expiry <path> --readdir-expiry <secs>\n - Set readdir cache TTL on a directory\n archil help - Show this help message\n\nThe --force flag revokes any existing delegation from other clients.\n"
|
|
586
636
|
);
|
|
587
637
|
}
|
|
588
638
|
return fail(`Unknown archil command: ${subcommand}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@archildata/just-bash",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.11",
|
|
4
4
|
"description": "Archil filesystem adapter for just-bash",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"shell": "tsx bin/shell.ts"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@archildata/native": "^0.8.
|
|
29
|
+
"@archildata/native": "^0.8.11",
|
|
30
30
|
"commander": "^14.0.3",
|
|
31
31
|
"debug": "^4.3.4",
|
|
32
|
-
"disk": "^0.8.
|
|
32
|
+
"disk": "^0.8.11",
|
|
33
33
|
"just-bash": "^2.7.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|