@archildata/just-bash 0.1.1 → 0.1.3

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 (3) hide show
  1. package/README.md +13 -1
  2. package/dist/shell.js +36 -21
  3. package/package.json +3 -2
package/README.md CHANGED
@@ -78,7 +78,17 @@ const fs = new ArchilFs(client, {
78
78
  The package includes an interactive shell for testing:
79
79
 
80
80
  ```bash
81
- ARCHIL_REGION=aws-us-east-1 ARCHIL_DISK=myaccount/mydisk ARCHIL_TOKEN=xxx npx @archildata/just-bash
81
+ # Positional arguments (recommended)
82
+ npx @archildata/just-bash aws-us-east-1 myaccount/mydisk
83
+
84
+ # With flags
85
+ npx @archildata/just-bash --region aws-us-east-1 --disk myaccount/mydisk
86
+
87
+ # With token (use env var to keep out of shell history)
88
+ ARCHIL_TOKEN=xxx npx @archildata/just-bash aws-us-east-1 myaccount/mydisk
89
+
90
+ # With debug logging
91
+ npx @archildata/just-bash aws-us-east-1 myaccount/mydisk --log-level debug
82
92
  ```
83
93
 
84
94
  Shell commands:
@@ -134,6 +144,8 @@ DEBUG=archil:* node myapp.js
134
144
  - **Chunked reads** - Large files read in 4 MiB chunks
135
145
  - **Native protocol** - Direct Archil protocol access, no FUSE overhead
136
146
 
147
+ > **Note:** For best performance, run your application in the same region as your Archil disk (e.g., if your disk is in `aws-us-east-1`, deploy your app to AWS us-east-1).
148
+
137
149
  ## License
138
150
 
139
151
  MIT
package/dist/shell.js CHANGED
@@ -2,28 +2,43 @@
2
2
 
3
3
  // bin/shell.ts
4
4
  import * as readline from "readline";
5
+ import { Command } from "commander";
5
6
  import { ArchilClient } from "@archildata/client";
6
7
  import { Bash } from "just-bash";
7
8
  import { ArchilFs } from "@archildata/just-bash";
9
+ var program = new Command();
10
+ program.name("archil-shell").description("Interactive bash shell with Archil filesystem").version("0.1.0").argument("[region]", "Region identifier (e.g., aws-us-east-1)").argument("[disk]", "Disk name (e.g., myaccount/mydisk)").option("-r, --region <region>", "Region identifier (e.g., aws-us-east-1)").option("-d, --disk <disk>", "Disk name (e.g., myaccount/mydisk)").option("-t, --token <token>", "Auth token (defaults to IAM)").option("-l, --log-level <level>", "Log level: trace, debug, info, warn, error").addHelpText("after", `
11
+ Environment variables:
12
+ ARCHIL_REGION Fallback for --region
13
+ ARCHIL_DISK Fallback for --disk
14
+ ARCHIL_TOKEN Fallback for --token (recommended for secrets)
15
+ ARCHIL_LOG_LEVEL Fallback for --log-level
16
+
17
+ Examples:
18
+ $ npx @archildata/just-bash aws-us-east-1 myaccount/mydisk
19
+ $ npx @archildata/just-bash --region aws-us-east-1 --disk myaccount/mydisk
20
+ $ ARCHIL_TOKEN=xxx npx @archildata/just-bash aws-us-east-1 myaccount/mydisk
21
+ $ npx @archildata/just-bash -r aws-us-east-1 -d myaccount/mydisk -l debug
22
+ `);
23
+ program.parse();
24
+ var opts = program.opts();
25
+ var args = program.args;
26
+ var region = args[0] || opts.region || process.env.ARCHIL_REGION;
27
+ var diskName = args[1] || opts.disk || process.env.ARCHIL_DISK;
28
+ var authToken = opts.token || process.env.ARCHIL_TOKEN;
29
+ var logLevel = opts.logLevel || process.env.ARCHIL_LOG_LEVEL;
30
+ if (!region || !diskName) {
31
+ console.error("Error: region and disk are required\n");
32
+ console.error("Usage:");
33
+ console.error(" npx @archildata/just-bash <region> <disk>");
34
+ console.error(" npx @archildata/just-bash --region <region> --disk <disk>");
35
+ console.error("\nExamples:");
36
+ console.error(" npx @archildata/just-bash aws-us-east-1 myaccount/mydisk");
37
+ console.error(" ARCHIL_TOKEN=xxx npx @archildata/just-bash aws-us-east-1 myaccount/mydisk");
38
+ console.error("\nRun with --help for more options.");
39
+ process.exit(1);
40
+ }
8
41
  async function main() {
9
- const region = process.env.ARCHIL_REGION;
10
- const diskName = process.env.ARCHIL_DISK;
11
- const authToken = process.env.ARCHIL_TOKEN;
12
- const logLevel = process.env.ARCHIL_LOG_LEVEL;
13
- if (!region || !diskName) {
14
- console.error("Missing required environment variables:");
15
- console.error(" ARCHIL_REGION - e.g., aws-us-east-1");
16
- console.error(" ARCHIL_DISK - e.g., myaccount/mydisk");
17
- console.error(" ARCHIL_TOKEN - (optional) auth token, defaults to IAM");
18
- console.error(" ARCHIL_LOG_LEVEL - (optional) log level: trace, debug, info, warn, error");
19
- console.error("");
20
- console.error("Usage:");
21
- console.error(" ARCHIL_REGION=aws-us-east-1 ARCHIL_DISK=myaccount/mydisk npx tsx bin/shell.ts");
22
- console.error("");
23
- console.error("For debug logging:");
24
- console.error(" ARCHIL_LOG_LEVEL=debug ARCHIL_REGION=... ARCHIL_DISK=... npx tsx bin/shell.ts");
25
- process.exit(1);
26
- }
27
42
  console.log("Connecting to Archil...");
28
43
  console.log(` Region: ${region}`);
29
44
  console.log(` Disk: ${diskName}`);
@@ -105,9 +120,9 @@ Received ${signal}, cleaning up...`);
105
120
  const subcommand = parts[1];
106
121
  const targetPath = parts[2];
107
122
  if (subcommand === "checkout") {
108
- const args = parts.slice(2);
109
- const force = args.includes("--force") || args.includes("-f");
110
- const pathArg = args.find((a) => !a.startsWith("-"));
123
+ const args2 = parts.slice(2);
124
+ const force = args2.includes("--force") || args2.includes("-f");
125
+ const pathArg = args2.find((a) => !a.startsWith("-"));
111
126
  if (!pathArg) {
112
127
  console.error("Usage: archil checkout [--force|-f] <path>");
113
128
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archildata/just-bash",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Archil filesystem adapter for just-bash",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -26,7 +26,8 @@
26
26
  "shell": "tsx bin/shell.ts"
27
27
  },
28
28
  "dependencies": {
29
- "@archildata/client": "^0.1.0",
29
+ "@archildata/client": "^0.1.5",
30
+ "commander": "^14.0.3",
30
31
  "debug": "^4.3.4",
31
32
  "just-bash": "^2.7.0"
32
33
  },