@desplega.ai/agent-fs 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/cli.js +137 -58
- package/package.json +2 -2
- package/dist/__tests__/api-client.test.d.ts +0 -2
- package/dist/__tests__/api-client.test.d.ts.map +0 -1
- package/dist/__tests__/api-client.test.js +0 -86
- package/dist/__tests__/api-client.test.js.map +0 -1
- package/dist/__tests__/param-mapping.test.d.ts +0 -2
- package/dist/__tests__/param-mapping.test.d.ts.map +0 -1
- package/dist/__tests__/param-mapping.test.js +0 -53
- package/dist/__tests__/param-mapping.test.js.map +0 -1
- package/dist/api-client.d.ts +0 -17
- package/dist/api-client.d.ts.map +0 -1
- package/dist/api-client.js +0 -63
- package/dist/api-client.js.map +0 -1
- package/dist/commands/auth.d.ts +0 -4
- package/dist/commands/auth.d.ts.map +0 -1
- package/dist/commands/auth.js +0 -81
- package/dist/commands/auth.js.map +0 -1
- package/dist/commands/comment.d.ts +0 -4
- package/dist/commands/comment.d.ts.map +0 -1
- package/dist/commands/comment.js +0 -165
- package/dist/commands/comment.js.map +0 -1
- package/dist/commands/config-cmd.d.ts +0 -3
- package/dist/commands/config-cmd.d.ts.map +0 -1
- package/dist/commands/config-cmd.js +0 -147
- package/dist/commands/config-cmd.js.map +0 -1
- package/dist/commands/daemon.d.ts +0 -3
- package/dist/commands/daemon.d.ts.map +0 -1
- package/dist/commands/daemon.js +0 -33
- package/dist/commands/daemon.js.map +0 -1
- package/dist/commands/docs.d.ts +0 -3
- package/dist/commands/docs.d.ts.map +0 -1
- package/dist/commands/docs.js +0 -13
- package/dist/commands/docs.js.map +0 -1
- package/dist/commands/drive.d.ts +0 -4
- package/dist/commands/drive.d.ts.map +0 -1
- package/dist/commands/drive.js +0 -171
- package/dist/commands/drive.js.map +0 -1
- package/dist/commands/init.d.ts +0 -3
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -20
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/onboard.d.ts +0 -3
- package/dist/commands/onboard.d.ts.map +0 -1
- package/dist/commands/onboard.js +0 -229
- package/dist/commands/onboard.js.map +0 -1
- package/dist/commands/ops.d.ts +0 -4
- package/dist/commands/ops.d.ts.map +0 -1
- package/dist/commands/ops.js +0 -100
- package/dist/commands/ops.js.map +0 -1
- package/dist/commands/org.d.ts +0 -4
- package/dist/commands/org.d.ts.map +0 -1
- package/dist/commands/org.js +0 -84
- package/dist/commands/org.js.map +0 -1
- package/dist/formatters.d.ts +0 -11
- package/dist/formatters.d.ts.map +0 -1
- package/dist/formatters.js +0 -257
- package/dist/formatters.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -83
- package/dist/index.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@desplega.ai/agent-fs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Agent-first filesystem backed by S3",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"agent-fs": "dist/cli.js"
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
|
-
"dist",
|
|
25
|
+
"dist/cli.js",
|
|
26
26
|
"README.md"
|
|
27
27
|
],
|
|
28
28
|
"scripts": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api-client.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/api-client.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { describe, test, expect, beforeAll, afterAll } from "bun:test";
|
|
2
|
-
import { createTestDb, MockS3Client } from "../../../core/src/test-utils.js";
|
|
3
|
-
import { createApp } from "../../../server/src/app.js";
|
|
4
|
-
// We test ApiClient by pointing it at a real in-memory Hono server.
|
|
5
|
-
let server;
|
|
6
|
-
let port = 0;
|
|
7
|
-
let apiKey;
|
|
8
|
-
let orgId;
|
|
9
|
-
beforeAll(async () => {
|
|
10
|
-
const db = createTestDb();
|
|
11
|
-
const s3 = new MockS3Client();
|
|
12
|
-
const app = createApp(db, s3);
|
|
13
|
-
// Start on a random port
|
|
14
|
-
server = Bun.serve({
|
|
15
|
-
port: 0,
|
|
16
|
-
fetch: app.fetch,
|
|
17
|
-
});
|
|
18
|
-
port = server.port;
|
|
19
|
-
// Register a user to get an API key
|
|
20
|
-
const res = await fetch(`http://localhost:${port}/auth/register`, {
|
|
21
|
-
method: "POST",
|
|
22
|
-
headers: { "Content-Type": "application/json" },
|
|
23
|
-
body: JSON.stringify({ email: "cli-test@example.com" }),
|
|
24
|
-
});
|
|
25
|
-
const body = await res.json();
|
|
26
|
-
apiKey = body.apiKey;
|
|
27
|
-
orgId = body.orgId;
|
|
28
|
-
// Set env vars so ApiClient picks them up
|
|
29
|
-
process.env.AGENT_FS_API_URL = `http://localhost:${port}`;
|
|
30
|
-
process.env.AGENT_FS_API_KEY = apiKey;
|
|
31
|
-
});
|
|
32
|
-
afterAll(() => {
|
|
33
|
-
server?.stop();
|
|
34
|
-
delete process.env.AGENT_FS_API_URL;
|
|
35
|
-
delete process.env.AGENT_FS_API_KEY;
|
|
36
|
-
});
|
|
37
|
-
describe("ApiClient", () => {
|
|
38
|
-
// Dynamic import so env vars are set before constructor runs
|
|
39
|
-
async function makeClient() {
|
|
40
|
-
const { ApiClient } = await import("../api-client.js");
|
|
41
|
-
return new ApiClient();
|
|
42
|
-
}
|
|
43
|
-
test("get() fetches data", async () => {
|
|
44
|
-
const client = await makeClient();
|
|
45
|
-
const result = await client.get("/orgs");
|
|
46
|
-
expect(result.orgs).toBeDefined();
|
|
47
|
-
expect(result.orgs.length).toBeGreaterThan(0);
|
|
48
|
-
});
|
|
49
|
-
test("post() sends data", async () => {
|
|
50
|
-
const client = await makeClient();
|
|
51
|
-
const result = await client.post("/orgs", { name: "cli-test-org" });
|
|
52
|
-
expect(result.name).toBe("cli-test-org");
|
|
53
|
-
});
|
|
54
|
-
test("callOp() dispatches operation", async () => {
|
|
55
|
-
const client = await makeClient();
|
|
56
|
-
// Write a file
|
|
57
|
-
const writeResult = await client.callOp(orgId, "write", {
|
|
58
|
-
path: "/cli-test.txt",
|
|
59
|
-
content: "Hello from CLI",
|
|
60
|
-
});
|
|
61
|
-
expect(writeResult.version).toBe(1);
|
|
62
|
-
// Read it back
|
|
63
|
-
const catResult = await client.callOp(orgId, "cat", {
|
|
64
|
-
path: "/cli-test.txt",
|
|
65
|
-
});
|
|
66
|
-
expect(catResult.content).toBe("Hello from CLI");
|
|
67
|
-
});
|
|
68
|
-
test("setApiKey() changes auth", async () => {
|
|
69
|
-
const client = await makeClient();
|
|
70
|
-
client.setApiKey("af_invalid_key");
|
|
71
|
-
// Should fail with auth error
|
|
72
|
-
await expect(client.get("/orgs")).rejects.toThrow();
|
|
73
|
-
});
|
|
74
|
-
test("connection error gives helpful message", async () => {
|
|
75
|
-
process.env.AGENT_FS_API_URL = "http://localhost:1"; // Nothing running
|
|
76
|
-
const client = await makeClient();
|
|
77
|
-
await expect(client.get("/health")).rejects.toThrow(/Cannot connect/);
|
|
78
|
-
// Restore
|
|
79
|
-
process.env.AGENT_FS_API_URL = `http://localhost:${port}`;
|
|
80
|
-
});
|
|
81
|
-
test("server error includes message from response", async () => {
|
|
82
|
-
const client = await makeClient();
|
|
83
|
-
await expect(client.callOp(orgId, "cat", { path: "/nonexistent.txt" })).rejects.toThrow(/not found|NoSuchKey/i);
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
//# sourceMappingURL=api-client.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api-client.test.js","sourceRoot":"","sources":["../../src/__tests__/api-client.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,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KAAK,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAC1D,CAAC,OAAO,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"param-mapping.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/param-mapping.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { describe, test, expect } from "bun:test";
|
|
2
|
-
/**
|
|
3
|
-
* Tests for CLI flag → Zod schema param mapping.
|
|
4
|
-
* The CLI uses --old/--new flags but the edit Zod schema expects old_string/new_string.
|
|
5
|
-
* The CLI uses --expected-version but the write Zod schema expects expectedVersion.
|
|
6
|
-
*/
|
|
7
|
-
function applyParamMapping(params) {
|
|
8
|
-
const mapped = { ...params };
|
|
9
|
-
// These mappings mirror packages/cli/src/commands/ops.ts
|
|
10
|
-
if (mapped["expected-version"] !== undefined) {
|
|
11
|
-
mapped.expectedVersion = mapped["expected-version"];
|
|
12
|
-
delete mapped["expected-version"];
|
|
13
|
-
}
|
|
14
|
-
if (mapped["old"] !== undefined) {
|
|
15
|
-
mapped.old_string = mapped["old"];
|
|
16
|
-
delete mapped["old"];
|
|
17
|
-
}
|
|
18
|
-
if (mapped["new"] !== undefined) {
|
|
19
|
-
mapped.new_string = mapped["new"];
|
|
20
|
-
delete mapped["new"];
|
|
21
|
-
}
|
|
22
|
-
return mapped;
|
|
23
|
-
}
|
|
24
|
-
describe("CLI param mapping", () => {
|
|
25
|
-
test("maps --old to old_string and --new to new_string", () => {
|
|
26
|
-
const input = { path: "/test.md", old: "hello", new: "world" };
|
|
27
|
-
const result = applyParamMapping(input);
|
|
28
|
-
expect(result.old_string).toBe("hello");
|
|
29
|
-
expect(result.new_string).toBe("world");
|
|
30
|
-
expect(result.old).toBeUndefined();
|
|
31
|
-
expect(result.new).toBeUndefined();
|
|
32
|
-
expect(result.path).toBe("/test.md");
|
|
33
|
-
});
|
|
34
|
-
test("maps --expected-version to expectedVersion", () => {
|
|
35
|
-
const input = { path: "/test.md", "expected-version": "3" };
|
|
36
|
-
const result = applyParamMapping(input);
|
|
37
|
-
expect(result.expectedVersion).toBe("3");
|
|
38
|
-
expect(result["expected-version"]).toBeUndefined();
|
|
39
|
-
});
|
|
40
|
-
test("does not affect params without CLI flag names", () => {
|
|
41
|
-
const input = { path: "/test.md", content: "hello", message: "update" };
|
|
42
|
-
const result = applyParamMapping(input);
|
|
43
|
-
expect(result).toEqual(input);
|
|
44
|
-
});
|
|
45
|
-
test("handles missing optional params gracefully", () => {
|
|
46
|
-
const input = { path: "/test.md", old: "hello" };
|
|
47
|
-
const result = applyParamMapping(input);
|
|
48
|
-
expect(result.old_string).toBe("hello");
|
|
49
|
-
expect(result.new_string).toBeUndefined();
|
|
50
|
-
expect(result.old).toBeUndefined();
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
//# sourceMappingURL=param-mapping.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"param-mapping.test.js","sourceRoot":"","sources":["../../src/__tests__/param-mapping.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElD;;;;GAIG;AAEH,SAAS,iBAAiB,CAAC,MAA2B;IACpD,MAAM,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;IAE7B,yDAAyD;IACzD,IAAI,MAAM,CAAC,kBAAkB,CAAC,KAAK,SAAS,EAAE,CAAC;QAC7C,MAAM,CAAC,eAAe,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAC;QACpD,OAAO,MAAM,CAAC,kBAAkB,CAAC,CAAC;IACpC,CAAC;IACD,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,SAAS,EAAE,CAAC;QAChC,MAAM,CAAC,UAAU,GAAG,MAAM,C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AAkB,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACzD,MAAM,KAAK,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;QACxE,MAAM,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAExC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,4CAA4C,EAAE,GAAG,EAAE;QACtD,MAAM,KAAK,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;QACjD,MAAM,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAExC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,aAAa,EAAE,CAAC;QAC1C,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,CAAC;IACrC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/api-client.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare class ApiClient {
|
|
2
|
-
private baseUrl;
|
|
3
|
-
private apiKey;
|
|
4
|
-
constructor();
|
|
5
|
-
private request;
|
|
6
|
-
get(path: string): Promise<any>;
|
|
7
|
-
post(path: string, body: any): Promise<any>;
|
|
8
|
-
callOp(orgId: string, op: string, params: Record<string, any>): Promise<any>;
|
|
9
|
-
getMe(): Promise<{
|
|
10
|
-
userId: string;
|
|
11
|
-
email: string;
|
|
12
|
-
defaultOrgId: string | null;
|
|
13
|
-
defaultDriveId: string | null;
|
|
14
|
-
}>;
|
|
15
|
-
setApiKey(key: string): void;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=api-client.d.ts.map
|
package/dist/api-client.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IACpB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAS;;YAcT,OAAO;IA+Bf,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAI/B,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAO3C,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;IAI5E,KAAK,IAAI,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAIrH,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;CAG7B"}
|
package/dist/api-client.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { getConfig } from "@/core";
|
|
2
|
-
export class ApiClient {
|
|
3
|
-
baseUrl;
|
|
4
|
-
apiKey;
|
|
5
|
-
constructor() {
|
|
6
|
-
const config = getConfig();
|
|
7
|
-
this.baseUrl =
|
|
8
|
-
process.env.AGENT_FS_API_URL ??
|
|
9
|
-
config.apiUrl ??
|
|
10
|
-
`http://${config.server.host}:${config.server.port}`;
|
|
11
|
-
this.apiKey =
|
|
12
|
-
process.env.AGENT_FS_API_KEY ??
|
|
13
|
-
config.apiKey ??
|
|
14
|
-
config.auth.apiKey;
|
|
15
|
-
}
|
|
16
|
-
async request(path, opts) {
|
|
17
|
-
const headers = new Headers(opts?.headers);
|
|
18
|
-
if (this.apiKey) {
|
|
19
|
-
headers.set("Authorization", `Bearer ${this.apiKey}`);
|
|
20
|
-
}
|
|
21
|
-
headers.set("Content-Type", "application/json");
|
|
22
|
-
let res;
|
|
23
|
-
try {
|
|
24
|
-
res = await fetch(`${this.baseUrl}${path}`, { ...opts, headers });
|
|
25
|
-
}
|
|
26
|
-
catch (err) {
|
|
27
|
-
throw new Error(`Cannot connect to agent-fs daemon at ${this.baseUrl}. Is it running? Start with: agent-fs daemon start`);
|
|
28
|
-
}
|
|
29
|
-
let body;
|
|
30
|
-
try {
|
|
31
|
-
body = await res.json();
|
|
32
|
-
}
|
|
33
|
-
catch {
|
|
34
|
-
const text = await res.text().catch(() => "");
|
|
35
|
-
throw new Error(`Unexpected response from daemon (${res.status}): ${text || "empty"}`);
|
|
36
|
-
}
|
|
37
|
-
if (!res.ok) {
|
|
38
|
-
const msg = body.message ?? body.error ?? "Request failed";
|
|
39
|
-
const suggestion = body.suggestion ? `\n Suggestion: ${body.suggestion}` : "";
|
|
40
|
-
throw new Error(`${msg}${suggestion}`);
|
|
41
|
-
}
|
|
42
|
-
return body;
|
|
43
|
-
}
|
|
44
|
-
async get(path) {
|
|
45
|
-
return this.request(path);
|
|
46
|
-
}
|
|
47
|
-
async post(path, body) {
|
|
48
|
-
return this.request(path, {
|
|
49
|
-
method: "POST",
|
|
50
|
-
body: JSON.stringify(body),
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
async callOp(orgId, op, params) {
|
|
54
|
-
return this.post(`/orgs/${orgId}/ops`, { op, ...params });
|
|
55
|
-
}
|
|
56
|
-
async getMe() {
|
|
57
|
-
return this.get("/auth/me");
|
|
58
|
-
}
|
|
59
|
-
setApiKey(key) {
|
|
60
|
-
this.apiKey = key;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
//# sourceMappingURL=api-client.js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AO,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC9B,CAAC;IAED,SAAS,CAAC,GAAW;QACnB,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;IACpB,CAAC;CACF"}
|
package/dist/commands/auth.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAQlD,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,WAqE7C"}
|
package/dist/commands/auth.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
import { setConfigValue, createUser, createDatabase, listUserOrgs, } from "@/core";
|
|
3
|
-
export function authCommands(client) {
|
|
4
|
-
const cmd = new Command("auth").description("Authentication commands");
|
|
5
|
-
cmd
|
|
6
|
-
.command("register")
|
|
7
|
-
.argument("<email>", "Email address")
|
|
8
|
-
.description("Register a new user")
|
|
9
|
-
.action(async (email) => {
|
|
10
|
-
// Try daemon first, fall back to direct DB registration
|
|
11
|
-
try {
|
|
12
|
-
const result = await client.post("/auth/register", { email });
|
|
13
|
-
printRegistration(result, client);
|
|
14
|
-
}
|
|
15
|
-
catch {
|
|
16
|
-
// Daemon not running — register directly against DB
|
|
17
|
-
try {
|
|
18
|
-
const db = createDatabase();
|
|
19
|
-
const result = createUser(db, { email });
|
|
20
|
-
const orgs = listUserOrgs(db, result.user.id);
|
|
21
|
-
printRegistration({
|
|
22
|
-
apiKey: result.apiKey,
|
|
23
|
-
userId: result.user.id,
|
|
24
|
-
orgId: orgs[0]?.id,
|
|
25
|
-
}, client);
|
|
26
|
-
}
|
|
27
|
-
catch (err) {
|
|
28
|
-
if (err.message?.includes("UNIQUE")) {
|
|
29
|
-
console.error("Error: User with this email already exists.");
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
console.error(`Error: ${err.message}`);
|
|
33
|
-
}
|
|
34
|
-
process.exit(1);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
cmd
|
|
39
|
-
.command("whoami")
|
|
40
|
-
.description("Show current user info")
|
|
41
|
-
.action(async () => {
|
|
42
|
-
try {
|
|
43
|
-
const result = await client.get("/auth/me");
|
|
44
|
-
console.log(JSON.stringify(result, null, 2));
|
|
45
|
-
}
|
|
46
|
-
catch {
|
|
47
|
-
// Daemon not running — look up directly from DB
|
|
48
|
-
try {
|
|
49
|
-
const { getConfig, getUserByApiKey, createDatabase, listUserOrgs } = await import("@/core");
|
|
50
|
-
const config = getConfig();
|
|
51
|
-
if (!config.auth.apiKey) {
|
|
52
|
-
console.error("Not logged in. Run: agent-fs auth register <email>");
|
|
53
|
-
process.exit(1);
|
|
54
|
-
}
|
|
55
|
-
const db = createDatabase();
|
|
56
|
-
const user = getUserByApiKey(db, config.auth.apiKey);
|
|
57
|
-
if (!user) {
|
|
58
|
-
console.error("Invalid API key in config.");
|
|
59
|
-
process.exit(1);
|
|
60
|
-
}
|
|
61
|
-
const orgs = listUserOrgs(db, user.id);
|
|
62
|
-
console.log(JSON.stringify({ ...user, orgs }, null, 2));
|
|
63
|
-
}
|
|
64
|
-
catch (err) {
|
|
65
|
-
console.error(`Error: ${err.message}`);
|
|
66
|
-
process.exit(1);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
return cmd;
|
|
71
|
-
}
|
|
72
|
-
function printRegistration(result, client) {
|
|
73
|
-
console.log(`Registered successfully!`);
|
|
74
|
-
console.log(`API Key: ${result.apiKey}`);
|
|
75
|
-
console.log(`User ID: ${result.userId}`);
|
|
76
|
-
console.log(`Org ID: ${result.orgId}`);
|
|
77
|
-
setConfigValue("auth.apiKey", result.apiKey);
|
|
78
|
-
client.setApiKey(result.apiKey);
|
|
79
|
-
console.log("\nAPI key saved to config.");
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=auth.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EACL,cAAc,EACd,UAAU,EACV,cAAc,EACd,YAAY,GACb,MAAM,QAAQ,CAAC;AAEhB,MAAM,UAAU,YAAY,CAAC,MAAiB;IAC5C,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;IAEvE,GAAG;SACA,OAAO,CAAC,UAAU,CAAC;SACnB,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAC;SACpC,WAAW,CAAC,qBAAqB,CAAC;SAClC,MAAM,CAAC,KAAK,EAAE,KAAa,EAAE,EAAE;QAC9B,wDAAwD;QACxD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;YAC9D,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACpC,CAAC;QAAC,MAAM,CAAC;YACP,oDAAoD;YACpD,IAAI,CAAC;gBACH,MAAM,EAAE,GAAG,cAAc,EAAE,CAAC;gBAC5B,MAAM,MAAM,GAAG,UAAU,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;gBACzC,MAAM,IAAI,GAAG,YAAY,CAAC,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAC9C,iBAAiB,CACf;oBACE,MAAM,EAAE,MAAM,CAAC,MAAM;oBACrB,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE;oBACtB,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;iBACnB,EACD,M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O,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,WA8J1F"}
|
package/dist/commands/comment.js
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
export function commentCommands(client, getOrgId) {
|
|
3
|
-
const cmd = new Command("comment").description("Document comments");
|
|
4
|
-
async function callOp(opName, params) {
|
|
5
|
-
try {
|
|
6
|
-
return await client.callOp(await getOrgId(), opName, params);
|
|
7
|
-
}
|
|
8
|
-
catch (err) {
|
|
9
|
-
if (err?.cause?.code === "ECONNREFUSED" || err?.message?.includes("fetch failed")) {
|
|
10
|
-
console.error("Cannot connect to agent-fs daemon.\n" +
|
|
11
|
-
"Start with: agent-fs daemon start\n" +
|
|
12
|
-
"Or set AGENT_FS_API_URL to connect to a remote server.");
|
|
13
|
-
process.exit(1);
|
|
14
|
-
}
|
|
15
|
-
throw err;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
cmd
|
|
19
|
-
.command("add")
|
|
20
|
-
.argument("<path>", "File path to comment on")
|
|
21
|
-
.requiredOption("--body <text>", "Comment body")
|
|
22
|
-
.option("--line <n>", "Line number (sets both line-start and line-end)")
|
|
23
|
-
.option("--line-start <n>", "Start line")
|
|
24
|
-
.option("--line-end <n>", "End line")
|
|
25
|
-
.option("--quoted-content <text>", "Quoted content from the file")
|
|
26
|
-
.description("Add a comment to a file")
|
|
27
|
-
.action(async (path, opts) => {
|
|
28
|
-
try {
|
|
29
|
-
const params = { path, body: opts.body };
|
|
30
|
-
if (opts.quotedContent)
|
|
31
|
-
params.quotedContent = opts.quotedContent;
|
|
32
|
-
if (opts.line) {
|
|
33
|
-
params.lineStart = parseInt(opts.line);
|
|
34
|
-
params.lineEnd = parseInt(opts.line);
|
|
35
|
-
}
|
|
36
|
-
if (opts.lineStart)
|
|
37
|
-
params.lineStart = parseInt(opts.lineStart);
|
|
38
|
-
if (opts.lineEnd)
|
|
39
|
-
params.lineEnd = parseInt(opts.lineEnd);
|
|
40
|
-
const result = await callOp("comment-add", params);
|
|
41
|
-
console.log(JSON.stringify(result, null, 2));
|
|
42
|
-
}
|
|
43
|
-
catch (err) {
|
|
44
|
-
console.error(`Error: ${err.message}`);
|
|
45
|
-
process.exit(1);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
cmd
|
|
49
|
-
.command("reply")
|
|
50
|
-
.argument("<comment-id>", "Parent comment ID to reply to")
|
|
51
|
-
.requiredOption("--body <text>", "Reply body")
|
|
52
|
-
.description("Reply to a comment")
|
|
53
|
-
.action(async (commentId, opts) => {
|
|
54
|
-
try {
|
|
55
|
-
const result = await callOp("comment-add", {
|
|
56
|
-
parentId: commentId,
|
|
57
|
-
body: opts.body,
|
|
58
|
-
});
|
|
59
|
-
console.log(JSON.stringify(result, null, 2));
|
|
60
|
-
}
|
|
61
|
-
catch (err) {
|
|
62
|
-
console.error(`Error: ${err.message}`);
|
|
63
|
-
process.exit(1);
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
cmd
|
|
67
|
-
.command("list")
|
|
68
|
-
.argument("[path]", "File path to list comments for")
|
|
69
|
-
.option("--resolved", "Show resolved comments")
|
|
70
|
-
.option("--limit <n>", "Max results")
|
|
71
|
-
.option("--offset <n>", "Skip N results")
|
|
72
|
-
.description("List comments")
|
|
73
|
-
.action(async (path, opts) => {
|
|
74
|
-
try {
|
|
75
|
-
const params = {};
|
|
76
|
-
if (path)
|
|
77
|
-
params.path = path;
|
|
78
|
-
if (opts.resolved)
|
|
79
|
-
params.resolved = true;
|
|
80
|
-
if (opts.limit)
|
|
81
|
-
params.limit = parseInt(opts.limit);
|
|
82
|
-
if (opts.offset)
|
|
83
|
-
params.offset = parseInt(opts.offset);
|
|
84
|
-
const result = await callOp("comment-list", params);
|
|
85
|
-
console.log(JSON.stringify(result, null, 2));
|
|
86
|
-
}
|
|
87
|
-
catch (err) {
|
|
88
|
-
console.error(`Error: ${err.message}`);
|
|
89
|
-
process.exit(1);
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
cmd
|
|
93
|
-
.command("get")
|
|
94
|
-
.argument("<id>", "Comment ID")
|
|
95
|
-
.description("Get a comment with its replies")
|
|
96
|
-
.action(async (id) => {
|
|
97
|
-
try {
|
|
98
|
-
const result = await callOp("comment-get", { id });
|
|
99
|
-
console.log(JSON.stringify(result, null, 2));
|
|
100
|
-
}
|
|
101
|
-
catch (err) {
|
|
102
|
-
console.error(`Error: ${err.message}`);
|
|
103
|
-
process.exit(1);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
cmd
|
|
107
|
-
.command("update")
|
|
108
|
-
.argument("<id>", "Comment ID")
|
|
109
|
-
.requiredOption("--body <text>", "New comment body")
|
|
110
|
-
.description("Update a comment")
|
|
111
|
-
.action(async (id, opts) => {
|
|
112
|
-
try {
|
|
113
|
-
const result = await callOp("comment-update", { id, body: opts.body });
|
|
114
|
-
console.log(JSON.stringify(result, null, 2));
|
|
115
|
-
}
|
|
116
|
-
catch (err) {
|
|
117
|
-
console.error(`Error: ${err.message}`);
|
|
118
|
-
process.exit(1);
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
cmd
|
|
122
|
-
.command("delete")
|
|
123
|
-
.argument("<id>", "Comment ID")
|
|
124
|
-
.description("Delete a comment (soft delete)")
|
|
125
|
-
.action(async (id) => {
|
|
126
|
-
try {
|
|
127
|
-
const result = await callOp("comment-delete", { id });
|
|
128
|
-
console.log(JSON.stringify(result, null, 2));
|
|
129
|
-
}
|
|
130
|
-
catch (err) {
|
|
131
|
-
console.error(`Error: ${err.message}`);
|
|
132
|
-
process.exit(1);
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
cmd
|
|
136
|
-
.command("resolve")
|
|
137
|
-
.argument("<id>", "Comment ID")
|
|
138
|
-
.description("Resolve a comment")
|
|
139
|
-
.action(async (id) => {
|
|
140
|
-
try {
|
|
141
|
-
const result = await callOp("comment-resolve", { id, resolved: true });
|
|
142
|
-
console.log(JSON.stringify(result, null, 2));
|
|
143
|
-
}
|
|
144
|
-
catch (err) {
|
|
145
|
-
console.error(`Error: ${err.message}`);
|
|
146
|
-
process.exit(1);
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
cmd
|
|
150
|
-
.command("reopen")
|
|
151
|
-
.argument("<id>", "Comment ID")
|
|
152
|
-
.description("Reopen a resolved comment")
|
|
153
|
-
.action(async (id) => {
|
|
154
|
-
try {
|
|
155
|
-
const result = await callOp("comment-resolve", { id, resolved: false });
|
|
156
|
-
console.log(JSON.stringify(result, null, 2));
|
|
157
|
-
}
|
|
158
|
-
catch (err) {
|
|
159
|
-
console.error(`Error: ${err.message}`);
|
|
160
|
-
process.exit(1);
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
return cmd;
|
|
164
|
-
}
|
|
165
|
-
//# sourceMappingURL=comment.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"comment.js","sourceRoot":"","sources":["../../src/commands/comment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,UAAU,eAAe,CAAC,MAAiB,EAAE,QAAwC;IACzF,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IAEpE,KAAK,UAAU,MAAM,CAAC,MAAc,EAAE,MAA2B;QAC/D,IAAI,CAAC;YACH,OAAO,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,QAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC/D,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,IAAI,GAAG,EAAE,KAAK,EAAE,IAAI,KAAK,c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