# @archildata/just-bash 中文文档

规范地址：https://npmcn.com/package/%40archildata/just-bash/

版本：0\.8\.41
npm 元数据更新时间：2026-11-05T23:00:00.504Z
中文译文更新时间：2026-11-06T14:26:37.308Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40archildata/just-bash
原文对照：https://npmcn.com/package/%40archildata/just-bash/?lang=original
项目主页：https://archil.com/
源码仓库：https://github.com/archil-data/archil-sdk

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：158 kB，13 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：5 个
- 首次发布：2026-02-01T13:40:30.714Z
- 最新版本发布：2026-11-05T23:00:00.046Z
- 近 30 天下载量：80774（2026-10-07 至 2026-11-05，npm 官方下载统计）
- 已发布版本数：54（近 12 个月 54 个）

## 中文简介

Archil 文件系统适配器

## 安装

```sh
npm install @archildata/just-bash
```

也可以使用：`pnpm add @archildata/just-bash`、`yarn add @archildata/just-bash`、`bun add @archildata/just-bash`

## README

# @archildata/ just- bash (英语)

> **未建议新项目.** 随着Archil的无服务器执行(`disk <id> exec <command>`,或 `Disk.exec()` 从 [`disk`](https://www.npmjs.com/package/disk) 软件包),您可以在磁盘上运行命令,而无需站起客户端挂载或击打环境——命令运行在一个Archil管理的容器中,并带有磁盘预挂载并返回stdout/stderr/exit代码. 我们不再建议 `@archildata/just-bash`; 达到 `disk exec` 换句话说.
> 
> 这个软件包仍然为已有的用户发布,他们围绕它构建了工具.

运行针对您云存储的点击命令 [阿奇尔](https://archil.com/) 不需要本地挂载。 工作包括脚本、CI管道和互动会议.

## 快速启动

如果您已经设置了 Archil 磁盘( 请参看 [`disk`](https://www.npmjs.com/package/disk) 对于设置,您可以在一个命令中启动 shell :

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

这会让你变成一个交互式的外壳。 你看到的文件是您云桶的内容:

```
$ ls
data/  logs/  config.json

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

$ echo "hello from archil" > greeting.txt
```

你在这里所做的一切——读取,写出,重命名,删取——都通过阿奇尔到你的桶上去.

## 使用您的代码

交互外壳很适合绕来绕去,但您也可以从自己的代码运行bash命令. 这对脚本, CI 管道, AI 代理, 或任何您想要运行的外壳命令对你的云存储器有用.

```bash
npm install @archildata/just-bash @archildata/native just-bash
```

```typescript
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();
```

## 直接使用文件系统适配器

如果你不需要击打而只需要标准文件操作,你可以使用 `ArchilFs` 独自一人。 它的工作像节点Js `fs`数字 :

```typescript
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');
```

## 写入文件( 代表团)

Archil使用授权系统写作. 当多个客户端连接到同一个磁盘时,代表团会协调谁可以写到什么. 在写到文件或目录之前,你先"检查"一个代表团在上面. 完事后"入户"放出.

在交互式外壳中,使用内置 `archil` 命令 :

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

在代码中,直接使用客户端:

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

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

await client.checkin(inodeId);
```

## 子目录挂起

您可以挂载磁盘的子目录而不是根 。 这在你的桶里嵌入一个项目时有用:

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

## 交互式 shell 引用

```bash
# 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
```

贝壳命令 :

-   标准 bash 命令 (`ls`, (中文(简体) ), `cat`, (中文(简体) ), `echo`, (中文(简体) ), `cp`, (中文(简体) ), `mv`, (中文(简体) ), `rm`页:1
-   `archil checkout [--force] <path>` 获得书面授权
-   `archil checkin <path>` ——放行写代表团
-   `archil list-delegations` ——展出现有代表团
-   `archil help` ——显示拱门命令

## 平台支持

要求数 **链接** (x64 或 arm64, glibc) 或 **马科斯** (pple Silicon / arm64),用于本地文件系统客户端.

## 支助

问题、专题请求还是问题? 联系我们 **[支持@ archil.com](mailto:support@archil.com)**。 。 。 .

## 常见问题

### @archildata/just-bash 是什么？

Archil 文件系统适配器

### 如何安装 @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 和提交记录判断。

