@dayofweek/dcli 1.0.5 → 1.1.3
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/dist/bin/dcli.js +25 -1
- package/dist/client.d.ts +8 -0
- package/dist/client.js +18 -0
- package/package.json +1 -1
package/dist/bin/dcli.js
CHANGED
|
@@ -6,10 +6,13 @@ import { readFileSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
|
6
6
|
import { join, dirname } from "node:path";
|
|
7
7
|
import { homedir } from "node:os";
|
|
8
8
|
import { createInterface } from "node:readline/promises";
|
|
9
|
+
import { fileURLToPath } from "node:url";
|
|
10
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, "../../package.json"), "utf-8"));
|
|
9
12
|
const program = new Command()
|
|
10
13
|
.name("dcli")
|
|
11
14
|
.description("CLI for the Day of Week AgTech platform")
|
|
12
|
-
.version(
|
|
15
|
+
.version(pkg.version)
|
|
13
16
|
.option("--token <token>", "Auth token (overrides DCLI_AUTH_TOKEN)")
|
|
14
17
|
.option("--api-url <url>", "API base URL (overrides DCLI_API_URL)")
|
|
15
18
|
.option("--json", "Output JSON (default for non-interactive use)");
|
|
@@ -128,6 +131,27 @@ read
|
|
|
128
131
|
const result = await client.listContacts(opts);
|
|
129
132
|
output(result);
|
|
130
133
|
});
|
|
134
|
+
read
|
|
135
|
+
.command("entity-types")
|
|
136
|
+
.description("List available entity types")
|
|
137
|
+
.action(async () => {
|
|
138
|
+
const client = getClient();
|
|
139
|
+
const result = await client.listEntityTypes();
|
|
140
|
+
output(result);
|
|
141
|
+
});
|
|
142
|
+
read
|
|
143
|
+
.command("catalog")
|
|
144
|
+
.description("Search or browse the produce catalog (selectable items only by default)")
|
|
145
|
+
.option("--search <query>", "Search by name")
|
|
146
|
+
.option("--parent <conceptId>", "List children of a category")
|
|
147
|
+
.option("--type <nodeType>", "Filter by type (category, produce, variety)")
|
|
148
|
+
.option("--include-categories", "Include non-selectable categories in results")
|
|
149
|
+
.option("--limit <count>", "Max results", parseInt)
|
|
150
|
+
.action(async (opts) => {
|
|
151
|
+
const client = getClient();
|
|
152
|
+
const result = await client.searchCatalog(opts);
|
|
153
|
+
output(result);
|
|
154
|
+
});
|
|
131
155
|
// ── Agent Commands ───────────────────────────────────────────────────────────
|
|
132
156
|
const agent = program.command("agent").description("Submit and view proposals");
|
|
133
157
|
agent
|
package/dist/client.d.ts
CHANGED
|
@@ -41,6 +41,14 @@ export declare class DayOfWeekClient {
|
|
|
41
41
|
entity?: string;
|
|
42
42
|
limit?: number;
|
|
43
43
|
}): Promise<any[]>;
|
|
44
|
+
listEntityTypes(): Promise<any[]>;
|
|
45
|
+
searchCatalog(opts?: {
|
|
46
|
+
search?: string;
|
|
47
|
+
parent?: string;
|
|
48
|
+
type?: string;
|
|
49
|
+
includeCategories?: boolean;
|
|
50
|
+
limit?: number;
|
|
51
|
+
}): Promise<any[]>;
|
|
44
52
|
listProposals(opts?: {
|
|
45
53
|
status?: string;
|
|
46
54
|
source?: string;
|
package/dist/client.js
CHANGED
|
@@ -64,6 +64,24 @@ export class DayOfWeekClient {
|
|
|
64
64
|
const qs = params.toString();
|
|
65
65
|
return this.get(`/contacts${qs ? `?${qs}` : ""}`);
|
|
66
66
|
}
|
|
67
|
+
async listEntityTypes() {
|
|
68
|
+
return this.get("/entity-types");
|
|
69
|
+
}
|
|
70
|
+
async searchCatalog(opts) {
|
|
71
|
+
const params = new URLSearchParams();
|
|
72
|
+
if (opts?.search)
|
|
73
|
+
params.set("search", opts.search);
|
|
74
|
+
if (opts?.parent)
|
|
75
|
+
params.set("parent", opts.parent);
|
|
76
|
+
if (opts?.type)
|
|
77
|
+
params.set("type", opts.type);
|
|
78
|
+
if (opts?.includeCategories)
|
|
79
|
+
params.set("includeCategories", "true");
|
|
80
|
+
if (opts?.limit)
|
|
81
|
+
params.set("limit", String(opts.limit));
|
|
82
|
+
const qs = params.toString();
|
|
83
|
+
return this.get(`/catalog${qs ? `?${qs}` : ""}`);
|
|
84
|
+
}
|
|
67
85
|
// ── Proposals ─────────────────────────────────────────────────────────────
|
|
68
86
|
async listProposals(opts) {
|
|
69
87
|
const params = new URLSearchParams();
|