Usage Guide

Installation

# Install the CLI globally
npm install -g @aigne/afs-cli

# Or use in a project
pnpm add @aigne/afs

CLI Quick Start

# Mount a local directory
afs mount add /src fs:///path/to/project

# Mount a Git repository
afs mount add /repo git://https://github.com/user/repo

# Mount a SQLite database
afs mount add /db sqlite:///path/to/data.db

# Mount a Cloudflare account
afs mount add /cf cloudflare://account-id?token=xxx

# List everything
afs ls /

# Read a file
afs read /src/README.md

# Write content
afs write /db/users/42 '{"name": "Alice"}'

# Execute an action
afs exec /cf/workers/my-app/.actions/deploy

# Interactive explorer
afs explore

SDK Usage

import { AFS } from "@aigne/afs";
import { AFSFS } from "@aigne/afs-fs";
import { AFSSQLite } from "@aigne/afs-sqlite";

const afs = new AFS();

// Mount providers
afs.mount(new AFSFS({
  localPath: "./data",
  description: "Local data files",
}));

afs.mount(new AFSSQLite({
  filePath: "./app.db",
  description: "Application database",
}));

// Unified API across all providers
const files = await afs.list("/fs");
const content = await afs.read("/fs/config.json");
const rows = await afs.list("/sqlite/users");
const user = await afs.read("/sqlite/users/42");

// Execute provider actions
await afs.exec("/sqlite/users/.actions/insert", {
  name: "Bob",
  email: "bob@example.com",
});

// Search across providers
const results = await afs.search("/", {
  pattern: "TODO",
  type: "content",
});

Provider Catalog

ProviderURI SchemeDescription
Filesystemfs://Local directories and files
Gitgit://Git branches, commits, and files
GitHubgithub://Issues, PRs, and discussions
SQLitesqlite://Database tables and rows
JSONjson://JSON/YAML as virtual FS
TOMLtoml://TOML config as virtual FS
S3s3://AWS S3 buckets and objects
GCSgcs://Google Cloud Storage
Cloudflarecloudflare://Workers, KV, Pages, Zones
MCPmcp://MCP Server tool bridge
HTTPhttp://Remote AFS over HTTP
Sandboxsandbox://Isolated in-memory FS