@koda-sl/baker-cli 0.2.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 +229 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +24 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.d.ts +10 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +119 -0
- package/dist/client.js.map +1 -0
- package/dist/commands/images/delete.d.ts +19 -0
- package/dist/commands/images/delete.d.ts.map +1 -0
- package/dist/commands/images/delete.js +58 -0
- package/dist/commands/images/delete.js.map +1 -0
- package/dist/commands/images/get.d.ts +30 -0
- package/dist/commands/images/get.d.ts.map +1 -0
- package/dist/commands/images/get.js +42 -0
- package/dist/commands/images/get.js.map +1 -0
- package/dist/commands/images/index.d.ts +2 -0
- package/dist/commands/images/index.d.ts.map +1 -0
- package/dist/commands/images/index.js +27 -0
- package/dist/commands/images/index.js.map +1 -0
- package/dist/commands/images/list.d.ts +45 -0
- package/dist/commands/images/list.d.ts.map +1 -0
- package/dist/commands/images/list.js +71 -0
- package/dist/commands/images/list.js.map +1 -0
- package/dist/commands/images/search.d.ts +41 -0
- package/dist/commands/images/search.d.ts.map +1 -0
- package/dist/commands/images/search.js +59 -0
- package/dist/commands/images/search.js.map +1 -0
- package/dist/commands/images/upload.d.ts +24 -0
- package/dist/commands/images/upload.d.ts.map +1 -0
- package/dist/commands/images/upload.js +90 -0
- package/dist/commands/images/upload.js.map +1 -0
- package/dist/commands/schema.d.ts +8 -0
- package/dist/commands/schema.d.ts.map +1 -0
- package/dist/commands/schema.js +38 -0
- package/dist/commands/schema.js.map +1 -0
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +36 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/env.d.ts +7 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +16 -0
- package/dist/env.js.map +1 -0
- package/dist/output.d.ts +37 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +78 -0
- package/dist/output.js.map +1 -0
- package/dist/output.test.d.ts +2 -0
- package/dist/output.test.d.ts.map +1 -0
- package/dist/output.test.js +53 -0
- package/dist/output.test.js.map +1 -0
- package/dist/schemas.d.ts +17 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +11 -0
- package/dist/schemas.js.map +1 -0
- package/package.json +38 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { applyFieldMask, compactImage } from "./output.js";
|
|
3
|
+
describe("compactImage", () => {
|
|
4
|
+
it("extracts compact fields from full image record", () => {
|
|
5
|
+
const full = {
|
|
6
|
+
_id: "abc123",
|
|
7
|
+
name: "hero-banner",
|
|
8
|
+
imageUrl: "https://r2.example.com/images/hero.png",
|
|
9
|
+
status: "ready",
|
|
10
|
+
tags: ["logo", "illustration"],
|
|
11
|
+
description: "A detailed hero banner",
|
|
12
|
+
width: 1920,
|
|
13
|
+
height: 1080,
|
|
14
|
+
source: "uploaded",
|
|
15
|
+
};
|
|
16
|
+
const result = compactImage(full);
|
|
17
|
+
expect(result).toEqual({
|
|
18
|
+
_id: "abc123",
|
|
19
|
+
name: "hero-banner",
|
|
20
|
+
imageUrl: "https://r2.example.com/images/hero.png",
|
|
21
|
+
status: "ready",
|
|
22
|
+
tags: ["logo", "illustration"],
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
it("handles missing fields with defaults", () => {
|
|
26
|
+
const result = compactImage({});
|
|
27
|
+
expect(result).toEqual({
|
|
28
|
+
_id: "",
|
|
29
|
+
name: "",
|
|
30
|
+
imageUrl: "",
|
|
31
|
+
status: "",
|
|
32
|
+
tags: [],
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
describe("applyFieldMask", () => {
|
|
37
|
+
it("filters object to only requested fields", () => {
|
|
38
|
+
const data = { _id: "abc", name: "test", status: "ready", imageUrl: "https://example.com" };
|
|
39
|
+
const result = applyFieldMask(data, ["_id", "name"]);
|
|
40
|
+
expect(result).toEqual({ _id: "abc", name: "test" });
|
|
41
|
+
});
|
|
42
|
+
it("ignores fields that do not exist", () => {
|
|
43
|
+
const data = { _id: "abc", name: "test" };
|
|
44
|
+
const result = applyFieldMask(data, ["_id", "nonexistent"]);
|
|
45
|
+
expect(result).toEqual({ _id: "abc" });
|
|
46
|
+
});
|
|
47
|
+
it("returns empty object for empty field list", () => {
|
|
48
|
+
const data = { _id: "abc", name: "test" };
|
|
49
|
+
const result = applyFieldMask(data, []);
|
|
50
|
+
expect(result).toEqual({});
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
//# sourceMappingURL=output.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.test.js","sourceRoot":"","sources":["../src/output.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3D,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACxD,MAAM,IAAI,GAAG;YACX,GAAG,EAAE,QAAQ;YACb,IAAI,EAAE,aAAa;YACnB,QAAQ,EAAE,wCAAwC;YAClD,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC;YAC9B,WAAW,EAAE,wBAAwB;YACrC,KAAK,EAAE,IAAI;YACX,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,UAAU;SACnB,CAAC;QAEF,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;QAElC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;YACrB,GAAG,EAAE,QAAQ;YACb,IAAI,EAA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AAE,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,IAAI,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAC1C,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAExC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface ArgSchema {
|
|
2
|
+
type: string;
|
|
3
|
+
description: string;
|
|
4
|
+
required: boolean;
|
|
5
|
+
default?: unknown;
|
|
6
|
+
enum?: string[];
|
|
7
|
+
}
|
|
8
|
+
interface CommandSchema {
|
|
9
|
+
command: string;
|
|
10
|
+
description: string;
|
|
11
|
+
args: Record<string, ArgSchema>;
|
|
12
|
+
}
|
|
13
|
+
export declare function registerSchema(schema: CommandSchema): void;
|
|
14
|
+
export declare function getSchema(command: string): CommandSchema | undefined;
|
|
15
|
+
export declare function listSchemas(): string[];
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,UAAU,aAAa;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACjC;AAID,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAE1D;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAEpE;AAED,wBAAgB,WAAW,IAAI,MAAM,EAAE,CAEtC"}
|
package/dist/schemas.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const registry = new Map();
|
|
2
|
+
export function registerSchema(schema) {
|
|
3
|
+
registry.set(schema.command, schema);
|
|
4
|
+
}
|
|
5
|
+
export function getSchema(command) {
|
|
6
|
+
return registry.get(command);
|
|
7
|
+
}
|
|
8
|
+
export function listSchemas() {
|
|
9
|
+
return [...registry.keys()];
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAcA,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAyB,CAAC;AAElD,MAAM,UAAU,cAAc,CAAC,MAAqB;IAClD,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,OAAe;IACvC,OAAO,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,OAAO,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;AAC9B,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@koda-sl/baker-cli",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "AI-agent-first CLI for interacting with Baker",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"baker": "dist/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsc",
|
|
14
|
+
"dev": "tsx watch src/cli.ts",
|
|
15
|
+
"typecheck": "tsc --noEmit",
|
|
16
|
+
"test": "vitest run"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@t3-oss/env-core": "latest",
|
|
20
|
+
"citty": "latest",
|
|
21
|
+
"zod": "latest"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/node": "latest",
|
|
25
|
+
"tsx": "latest",
|
|
26
|
+
"typescript": "latest",
|
|
27
|
+
"vitest": "latest"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/koda-sl/baker.git",
|
|
32
|
+
"directory": "packages/cli"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"registry": "https://registry.npmjs.org",
|
|
36
|
+
"access": "public"
|
|
37
|
+
}
|
|
38
|
+
}
|