@archildata/just-bash 0.8.47 → 0.8.48-next.20261201221409
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/README.md +23 -128
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,149 +1,44 @@
|
|
|
1
1
|
# @archildata/just-bash
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
> This package is still published for existing users who have tooling built around it.
|
|
3
|
+
A [just-bash](https://www.npmjs.com/package/just-bash) filesystem backed by an
|
|
4
|
+
[Archil](https://archil.com) disk, so bash commands in Node.js read and write the disk.
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
For new projects, use serverless execution instead: `disk.exec()` from
|
|
7
|
+
[`disk`](https://www.npmjs.com/package/disk) runs commands in an Archil-managed container
|
|
8
|
+
with the disk mounted.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
Full documentation is at [docs.archil.com](https://docs.archil.com/integrations/just-bash).
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
## Install
|
|
12
13
|
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
This drops you into an interactive shell. The files you see are the contents of your cloud bucket:
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
$ ls
|
|
21
|
-
data/ logs/ config.json
|
|
22
|
-
|
|
23
|
-
$ cat config.json
|
|
24
|
-
{"version": 2, "debug": false}
|
|
25
|
-
|
|
26
|
-
$ echo "hello from archil" > greeting.txt
|
|
14
|
+
```sh
|
|
15
|
+
npm install @archildata/just-bash @archildata/native just-bash
|
|
27
16
|
```
|
|
28
17
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
## Using in Your Code
|
|
32
|
-
|
|
33
|
-
The interactive shell is great for poking around, but you can also run bash commands from your own code. This is useful for scripts, CI pipelines, AI agents, or anywhere you want to run shell commands against your cloud storage.
|
|
18
|
+
It runs on Linux (glibc, x64 and arm64) and macOS (arm64).
|
|
34
19
|
|
|
35
|
-
|
|
36
|
-
npm install @archildata/just-bash @archildata/native just-bash
|
|
37
|
-
```
|
|
20
|
+
## Usage
|
|
38
21
|
|
|
39
|
-
```
|
|
40
|
-
import { ArchilClient } from
|
|
41
|
-
import { ArchilFs, createArchilCommand } from
|
|
42
|
-
import { Bash } from
|
|
22
|
+
```ts
|
|
23
|
+
import { ArchilClient } from "@archildata/native";
|
|
24
|
+
import { ArchilFs, createArchilCommand } from "@archildata/just-bash";
|
|
25
|
+
import { Bash } from "just-bash";
|
|
43
26
|
|
|
44
|
-
// Connect to your disk
|
|
45
27
|
const client = await ArchilClient.connect({
|
|
46
|
-
region:
|
|
47
|
-
diskName:
|
|
48
|
-
authToken:
|
|
28
|
+
region: "aws-us-east-1",
|
|
29
|
+
diskName: "myaccount/my-disk",
|
|
30
|
+
authToken: process.env.ARCHIL_DISK_TOKEN!,
|
|
49
31
|
});
|
|
50
32
|
|
|
51
|
-
// Create a filesystem adapter and a bash executor
|
|
52
33
|
const fs = await ArchilFs.create(client);
|
|
53
|
-
const bash = new Bash({
|
|
54
|
-
fs,
|
|
55
|
-
customCommands: [createArchilCommand(client, fs)],
|
|
56
|
-
});
|
|
34
|
+
const bash = new Bash({ fs, customCommands: [createArchilCommand(client, fs)] });
|
|
57
35
|
|
|
58
|
-
|
|
59
|
-
const result = await bash.exec('ls -la /');
|
|
36
|
+
const result = await bash.exec("ls -la /");
|
|
60
37
|
console.log(result.stdout);
|
|
61
|
-
|
|
62
|
-
// Write a file
|
|
63
|
-
await bash.exec('echo "hello world" > /greeting.txt');
|
|
64
|
-
|
|
65
|
-
// Read it back
|
|
66
|
-
const cat = await bash.exec('cat /greeting.txt');
|
|
67
|
-
console.log(cat.stdout); // "hello world"
|
|
68
|
-
|
|
69
|
-
// Clean up
|
|
70
|
-
await client.close();
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## Using the Filesystem Adapter Directly
|
|
74
|
-
|
|
75
|
-
If you don't need bash and just want standard file operations, you can use `ArchilFs` on its own. It works like Node.js `fs`:
|
|
76
|
-
|
|
77
|
-
```typescript
|
|
78
|
-
const fs = await ArchilFs.create(client);
|
|
79
|
-
|
|
80
|
-
await fs.writeFile('/notes.txt', 'some content');
|
|
81
|
-
const content = await fs.readFile('/notes.txt');
|
|
82
|
-
const entries = await fs.readdir('/');
|
|
83
|
-
const stats = await fs.stat('/notes.txt');
|
|
84
|
-
await fs.mkdir('/mydir', { recursive: true });
|
|
85
|
-
await fs.cp('/notes.txt', '/mydir/notes-copy.txt');
|
|
86
|
-
await fs.rm('/notes.txt');
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
## Writing Files (Delegations)
|
|
90
|
-
|
|
91
|
-
Archil uses a delegation system for writes. When multiple clients connect to the same disk, delegations coordinate who can write to what. Before writing to a file or directory, you "check out" a delegation on it. When you're done, you "check in" to release it.
|
|
92
|
-
|
|
93
|
-
In the interactive shell, use the built-in `archil` command:
|
|
94
|
-
|
|
95
|
-
```
|
|
96
|
-
$ archil checkout /mydir
|
|
97
|
-
$ echo "hello" > /mydir/newfile.txt
|
|
98
|
-
$ archil checkin /mydir
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
In code, use the client directly:
|
|
102
|
-
|
|
103
|
-
```typescript
|
|
104
|
-
const inodeId = await fs.resolveInodeId('/mydir');
|
|
105
|
-
await client.checkout(inodeId);
|
|
106
|
-
|
|
107
|
-
await bash.exec('echo "hello" > /mydir/newfile.txt');
|
|
108
|
-
|
|
109
|
-
await client.checkin(inodeId);
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
## Subdirectory Mounting
|
|
113
|
-
|
|
114
|
-
You can mount a subdirectory of a disk instead of the root. This is useful when your bucket has a project nested inside it:
|
|
115
|
-
|
|
116
|
-
```bash
|
|
117
|
-
ARCHIL_DISK_TOKEN=my-secret-mount-token npx @archildata/just-bash aws-us-east-1 myaccount/my-disk:/data/project
|
|
118
38
|
```
|
|
119
39
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
```bash
|
|
123
|
-
# Basic usage
|
|
124
|
-
npx @archildata/just-bash <region> <org>/<disk>
|
|
125
|
-
|
|
126
|
-
# With mount token
|
|
127
|
-
ARCHIL_DISK_TOKEN=xxx npx @archildata/just-bash aws-us-east-1 myaccount/my-disk
|
|
128
|
-
|
|
129
|
-
# With subdirectory
|
|
130
|
-
npx @archildata/just-bash aws-us-east-1 myaccount/my-disk:/path/to/subdir
|
|
40
|
+
To open an interactive shell on a disk, run the `archil-shell` command:
|
|
131
41
|
|
|
132
|
-
|
|
133
|
-
npx @archildata/just-bash aws-us-east-1 myaccount/my-disk
|
|
42
|
+
```sh
|
|
43
|
+
ARCHIL_DISK_TOKEN=... npx @archildata/just-bash aws-us-east-1 myaccount/my-disk
|
|
134
44
|
```
|
|
135
|
-
|
|
136
|
-
Shell commands:
|
|
137
|
-
- Standard bash commands (`ls`, `cat`, `echo`, `cp`, `mv`, `rm`, etc.)
|
|
138
|
-
- `archil checkout [--force] <path>` — acquire write delegation
|
|
139
|
-
- `archil checkin <path>` — release write delegation
|
|
140
|
-
- `archil list-delegations` — show currently held delegations
|
|
141
|
-
- `archil help` — show archil commands
|
|
142
|
-
|
|
143
|
-
## Platform Support
|
|
144
|
-
|
|
145
|
-
Requires **Linux** (x64 or arm64, glibc) or **macOS** (Apple Silicon / arm64) for the native filesystem client.
|
|
146
|
-
|
|
147
|
-
## Support
|
|
148
|
-
|
|
149
|
-
Questions, feature requests, or issues? Reach us at **support@archil.com**.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@archildata/just-bash",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.48-next.20261201221409",
|
|
4
4
|
"description": "Archil filesystem adapter for just-bash",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"archil",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@archildata/native": "^0.8.18",
|
|
36
|
-
"disk": "1.16.
|
|
36
|
+
"disk": "1.16.1-next.20261201221409",
|
|
37
37
|
"commander": "^14.0.3",
|
|
38
38
|
"debug": "^4.3.4",
|
|
39
39
|
"just-bash": "^2.7.0"
|