@archildata/just-bash

中文文档
0.8.41发布于 2026/11/06MITTypeScriptESM + CJS构建来源已验证近 30 天下载 8.1万

Archil filesystem adapter for just-bash

原始使用文档
文档目录8 节
  1. Quick Start
  2. Using in Your Code
  3. Using the Filesystem Adapter Directly
  4. Writing Files (Delegations)
  5. Subdirectory Mounting
  6. Interactive Shell Reference
  7. Platform Support
  8. Support

@archildata/just-bash

Not recommended for new projects. With Archil's serverless execution (disk <id> exec <command>, or Disk.exec() from the disk package), you can run commands against your disk without standing up a client-side mount or bash environment at all — the command runs in an Archil-managed container with the disk pre-mounted and returns stdout/stderr/exit code. We no longer recommend @archildata/just-bash; reach for disk exec instead.

This package is still published for existing users who have tooling built around it.

Run bash commands against your cloud storage through Archil — no local mount required. Works in scripts, CI pipelines, and interactive sessions.

Quick Start

If you already have an Archil disk set up (see disk for setup), you can start a shell in one command:

ARCHIL_DISK_TOKEN=my-secret-mount-token npx @archildata/just-bash aws-us-east-1 myaccount/my-disk

This drops you into an interactive shell. The files you see are the contents of your cloud bucket:

$ ls
data/  logs/  config.json

$ cat config.json
{"version": 2, "debug": false}

$ echo "hello from archil" > greeting.txt

Everything you do here — reads, writes, renames, deletes — goes through Archil to your bucket.

Using in Your Code

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.

npm install @archildata/just-bash @archildata/native just-bash
import { ArchilClient } from '@archildata/native';
import { ArchilFs, createArchilCommand } from '@archildata/just-bash';
import { Bash } from 'just-bash';

// Connect to your disk
const client = await ArchilClient.connect({
  region: 'aws-us-east-1',
  diskName: 'myaccount/my-disk',
  authToken: 'my-secret-mount-token',
});

// Create a filesystem adapter and a bash executor
const fs = await ArchilFs.create(client);
const bash = new Bash({
  fs,
  customCommands: [createArchilCommand(client, fs)],
});

// Run commands just like you would in a terminal
const result = await bash.exec('ls -la /');
console.log(result.stdout);

// Write a file
await bash.exec('echo "hello world" > /greeting.txt');

// Read it back
const cat = await bash.exec('cat /greeting.txt');
console.log(cat.stdout); // "hello world"

// Clean up
await client.close();

Using the Filesystem Adapter Directly

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:

const fs = await ArchilFs.create(client);

await fs.writeFile('/notes.txt', 'some content');
const content = await fs.readFile('/notes.txt');
const entries = await fs.readdir('/');
const stats = await fs.stat('/notes.txt');
await fs.mkdir('/mydir', { recursive: true });
await fs.cp('/notes.txt', '/mydir/notes-copy.txt');
await fs.rm('/notes.txt');

Writing Files (Delegations)

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.

In the interactive shell, use the built-in archil command:

$ archil checkout /mydir
$ echo "hello" > /mydir/newfile.txt
$ archil checkin /mydir

In code, use the client directly:

const inodeId = await fs.resolveInodeId('/mydir');
await client.checkout(inodeId);

await bash.exec('echo "hello" > /mydir/newfile.txt');

await client.checkin(inodeId);

Subdirectory Mounting

You can mount a subdirectory of a disk instead of the root. This is useful when your bucket has a project nested inside it:

ARCHIL_DISK_TOKEN=my-secret-mount-token npx @archildata/just-bash aws-us-east-1 myaccount/my-disk:/data/project

Interactive Shell Reference

# Basic usage
npx @archildata/just-bash <region> <org>/<disk>

# With mount token
ARCHIL_DISK_TOKEN=xxx npx @archildata/just-bash aws-us-east-1 myaccount/my-disk

# With subdirectory
npx @archildata/just-bash aws-us-east-1 myaccount/my-disk:/path/to/subdir

# With debug logging
npx @archildata/just-bash aws-us-east-1 myaccount/my-disk --log-level debug

Shell commands:

  • Standard bash commands (ls, cat, echo, cp, mv, rm, etc.)
  • archil checkout [--force] <path> — acquire write delegation
  • archil checkin <path> — release write delegation
  • archil list-delegations — show currently held delegations
  • archil help — show archil commands

Platform Support

Requires Linux (x64 or arm64, glibc) or macOS (Apple Silicon / arm64) for the native filesystem client.

Support

Questions, feature requests, or issues? Reach us at [email protected].

版本与发布记录

@archildata/just-bash 共发布 54 个版本,首次发布于 2026/02/01;过去 12 个月发布了 54 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.8.41latest2026/11/061 天前
0.8.402026/11/034 天前
0.8.392026/10/2811 天前
0.8.382026/10/1524 天前
0.8.372026/10/0930 天前
0.8.362026/10/031 个月前

关于 @archildata/just-bash 的常见问题

@archildata/just-bash 是什么?

Archil filesystem adapter for just-bash

如何安装 @archildata/just-bash?

在项目目录运行 npm install @archildata/just-bash,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 archil-shell,可以用 npx archil-shell 直接运行。

@archildata/just-bash 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@archildata/just-bash 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@archildata/just-bash 可以商用吗?

@archildata/just-bash 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@archildata/just-bash 的下载量有多少?

根据 npm 官方下载统计,@archildata/just-bash 在 2026/10/07 – 2026/11/05 这 30 天内被下载 80,774 次,日均约 2,692 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@archildata/just-bash 还在维护吗?

最新版本 0.8.41 发布于 2026/11/06(1 天前);至今共发布 54 个版本,其中过去 12 个月发布了 54 个;首次发布于 2026/02/01。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。