-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic.ts
More file actions
29 lines (23 loc) · 1.01 KB
/
basic.ts
File metadata and controls
29 lines (23 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { TigrisShell } from "../src/index.js";
const bucket = process.env.TIGRIS_STORAGE_BUCKET;
const accessKeyId = process.env.TIGRIS_STORAGE_ACCESS_KEY_ID;
const secretAccessKey = process.env.TIGRIS_STORAGE_SECRET_ACCESS_KEY;
if (!bucket || !accessKeyId || !secretAccessKey) {
console.error(
"Set TIGRIS_STORAGE_BUCKET, TIGRIS_STORAGE_ACCESS_KEY_ID, TIGRIS_STORAGE_SECRET_ACCESS_KEY",
);
process.exit(1);
}
const shell = new TigrisShell({ bucket, accessKeyId, secretAccessKey });
// Write files
await shell.exec('echo "Hello from agent-shell" > greeting.txt');
await shell.exec("mkdir -p reports");
await shell.exec('echo "Q1: revenue up 15%" > reports/q1.txt');
// Read and process
const upper = await shell.exec("cat greeting.txt | tr a-z A-Z");
console.log(upper.stdout.trim()); // HELLO FROM AGENT-SHELL
const wc = await shell.exec("cat reports/q1.txt | wc -w");
console.log("words:", wc.stdout.trim()); // words: 4
// Persist to Tigris
await shell.flush();
console.log("Done — files written to bucket:", bucket);