Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"bin": {
"tigris-shell": "dist/cli.js"
"tigris-agent-shell": "dist/cli.js"
},
"exports": {
".": {
Expand Down
9 changes: 7 additions & 2 deletions playground/src/welcome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ const RESET = "\x1b[0m";

export function showWelcome(terminal: Terminal) {
terminal.writeln(`${GREEN}Tigris Agent Shell${RESET}`);
terminal.writeln(`${DIM}Persistent sandboxed storage for AI agents${RESET}`);
terminal.writeln(
`${DIM}A virtual bash environment with a persistent filesystem backed by Tigris object storage${RESET}`,
);
terminal.writeln("");
terminal.writeln(
`${YELLOW}WARNING: This is a browser-based shell. Credentials you enter${RESET}`,
Expand All @@ -20,7 +22,10 @@ export function showWelcome(terminal: Terminal) {
);
terminal.writeln("");
terminal.writeln(`${DIM}Connect to Tigris:${RESET}`);
terminal.writeln(`${DIM} configure --key <id> --secret <key> Set credentials${RESET}`);
terminal.writeln(
`${DIM} login Login with your Tigris account${RESET}`,
);
terminal.writeln(`${DIM} configure --key <id> --secret <key> Set credentials manually${RESET}`);
terminal.writeln("");
terminal.writeln(`${DIM}Type 'help' for all commands.${RESET}`);
}
35 changes: 34 additions & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,41 @@ function parseArgs(args: string[]): {
return result;
}

function printHelp() {
process.stdout.write(`Tigris Agent Shell — A virtual bash environment with a persistent filesystem backed by Tigris object storage

Usage:
tigris-agent-shell [options]

Options:
--key <id> Access key ID
--secret <key> Secret access key
--bucket <name> Bucket to mount
--endpoint <url> Tigris endpoint
--help Show this help
--version Show version

Inside the shell, type 'help' for available commands.
`);
}

async function main() {
const args = parseArgs(process.argv.slice(2));
const rawArgs = process.argv.slice(2);

if (rawArgs.includes("--help") || rawArgs.includes("-h")) {
printHelp();
return;
}

if (rawArgs.includes("--version") || rawArgs.includes("-v")) {
const { createRequire } = await import("node:module");
const require = createRequire(import.meta.url);
const pkg = require("../package.json") as { version: string };
process.stdout.write(`${pkg.version}\n`);
return;
}

const args = parseArgs(rawArgs);
const session = new ReplSession({ loginFn: deviceLogin });

const rl = readline.createInterface({
Expand Down
31 changes: 28 additions & 3 deletions src/repl/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ export class ReplSession {
case "flush":
await this.handleFlush(parts.slice(1), io);
return;
case "whoami":
this.handleWhoami(io);
return;
case "help":
this.handleHelp(io);
return;
Expand Down Expand Up @@ -373,6 +376,29 @@ export class ReplSession {
}
}

private handleWhoami(io: ReplIO): void {
if (!this.config) {
io.write("Not logged in.\n");
return;
}

if (this.authMethod === "oauth") {
io.write(`Logged in as ${this.email ?? "unknown"} (OAuth)\n`);
} else {
io.write(
`Access key: ${this.config.accessKeyId ? this.config.accessKeyId.slice(0, 8) : "unknown"}...\n`,
);
}

const mounts = this.shell?.listMounts() ?? [];
if (mounts.length > 0) {
io.write("Mounts:\n");
for (const m of mounts) {
io.write(` ${m.bucket} → ${m.mountPoint}\n`);
}
}
}
Comment thread
designcode marked this conversation as resolved.

private handleLogout(io: ReplIO): void {
this.shell = null;
this.config = null;
Expand All @@ -384,15 +410,14 @@ export class ReplSession {

private handleHelp(io: ReplIO): void {
io.write("Commands:\n");
io.write(
" login Login via browser (OAuth)\n",
);
io.write(" login Login (OAuth)\n");
io.write(" configure --key <id> --secret <key> [--bucket <name>] [--endpoint <url>]\n");
io.write(" mount <bucket> <path> Mount a bucket\n");
io.write(" mount List mounts\n");
io.write(" umount <path> Unmount a path\n");
io.write(" df List mounts\n");
io.write(" flush [path] Flush to Tigris\n");
io.write(" whoami Show current session\n");
io.write(" logout Clear session\n");
io.write(" clear Clear screen\n");
io.write(" help Show this help\n");
Expand Down