@ghostystudio/cli 0.5.0 → 0.6.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/dist/index.js +28 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -275,7 +275,7 @@ async function request(path, opts = {}, retried = false) {
|
|
|
275
275
|
method: opts.method ?? (opts.body !== void 0 || opts.raw !== void 0 ? "POST" : "GET"),
|
|
276
276
|
headers: {
|
|
277
277
|
authorization: `Bearer ${token}`,
|
|
278
|
-
"user-agent": `ghosty-cli/${"0.
|
|
278
|
+
"user-agent": `ghosty-cli/${"0.6.0"}`,
|
|
279
279
|
...opts.body !== void 0 ? { "content-type": "application/json" } : {},
|
|
280
280
|
...opts.headers
|
|
281
281
|
},
|
|
@@ -364,7 +364,11 @@ async function agentsSet(id, v) {
|
|
|
364
364
|
if (v["prompt-file"]) body.prompt = await readFile2(v["prompt-file"], "utf8");
|
|
365
365
|
const env = parseEnv(v.env);
|
|
366
366
|
if (env) body.env = env;
|
|
367
|
-
|
|
367
|
+
const connectors = {};
|
|
368
|
+
for (const c of (v.connect ?? "").split(",").map((s) => s.trim()).filter(Boolean)) connectors[c] = {};
|
|
369
|
+
for (const c of (v.disconnect ?? "").split(",").map((s) => s.trim()).filter(Boolean)) connectors[c] = null;
|
|
370
|
+
if (Object.keys(connectors).length) body.connectors = connectors;
|
|
371
|
+
if (!Object.keys(body).length) throw usage("Nothing to change.", "Use --name, --engine, --model, --prompt, --prompt-file, --env, --connect or --disconnect.");
|
|
368
372
|
const r = await api(agentPath(id), { method: "PATCH", body });
|
|
369
373
|
out(r, () => `${lavender("\u2713")} Updated ${Object.keys(body).join(", ")}.`);
|
|
370
374
|
}
|
|
@@ -635,6 +639,20 @@ ${dim(`${(r.storage.usedBytes / 1e9).toFixed(2)} GB of ${r.storage.limitGb} GB u
|
|
|
635
639
|
throw usage(`Unknown files subcommand: ${sub ?? "(none)"}.`, ex);
|
|
636
640
|
}
|
|
637
641
|
}
|
|
642
|
+
async function meUsage() {
|
|
643
|
+
const r = await api("/api/v2/me/usage");
|
|
644
|
+
const pct = (p) => `${Math.round(p * 100)}%`;
|
|
645
|
+
out(
|
|
646
|
+
r,
|
|
647
|
+
() => [
|
|
648
|
+
`Plan ${r.plan.name}${r.exhausted ? " \u2014 out of usage for now" : ""}`,
|
|
649
|
+
` This week ${pct(r.week.pct).padStart(4)} used ${dim(`resets ${r.week.resetsAt.slice(0, 10)}`)}`,
|
|
650
|
+
...r.month.pct !== null ? [` This month ${pct(r.month.pct).padStart(4)} used ${dim(`resets ${r.month.resetsAt.slice(0, 10)}`)}`] : [],
|
|
651
|
+
` Top-ups ${r.creditMxn > 0 ? "available" : "none"}`,
|
|
652
|
+
dim("Change plan or top up: https://www.ghosty.studio/c/uso")
|
|
653
|
+
].join("\n")
|
|
654
|
+
);
|
|
655
|
+
}
|
|
638
656
|
|
|
639
657
|
// src/commands/schedule.ts
|
|
640
658
|
var enc3 = encodeURIComponent;
|
|
@@ -728,12 +746,14 @@ ${bold("Session")}
|
|
|
728
746
|
--device Sign in from another device with a link + code (auto over SSH/CI)
|
|
729
747
|
logout Sign out and revoke this device's session
|
|
730
748
|
whoami Show who you are signed in as
|
|
749
|
+
usage Your plan and how much you've used this week and month
|
|
731
750
|
|
|
732
751
|
${bold("Agents")}
|
|
733
752
|
agents ls List your agents
|
|
734
753
|
agents create Create an agent --name [--engine] [--model] [--prompt | --prompt-file FILE] [--env K=V,\u2026]
|
|
735
754
|
agents get <id> Show an agent's config [--fields name,model,prompt]
|
|
736
755
|
agents set <id> Change identity or engine [--name] [--engine] [--model] [--prompt | --prompt-file FILE] [--env K=V,\u2026]
|
|
756
|
+
[--connect google-drive,\u2026] [--disconnect \u2026] give/remove access to your connectors
|
|
737
757
|
agents rm <id> Delete an agent (owner only)
|
|
738
758
|
agents restart <id> Restart an ACP agent (needsRestart) so it loads new skills
|
|
739
759
|
|
|
@@ -782,6 +802,8 @@ async function main() {
|
|
|
782
802
|
name: { type: "string" },
|
|
783
803
|
model: { type: "string" },
|
|
784
804
|
engine: { type: "string" },
|
|
805
|
+
connect: { type: "string" },
|
|
806
|
+
disconnect: { type: "string" },
|
|
785
807
|
env: { type: "string" },
|
|
786
808
|
prompt: { type: "string" },
|
|
787
809
|
"prompt-file": { type: "string" },
|
|
@@ -801,7 +823,7 @@ async function main() {
|
|
|
801
823
|
});
|
|
802
824
|
globals.json = Boolean(v.json);
|
|
803
825
|
globals.token = v.token;
|
|
804
|
-
if (v.version) return out({ version: "0.
|
|
826
|
+
if (v.version) return out({ version: "0.6.0" }, () => "0.6.0");
|
|
805
827
|
const [cmd, sub, a1, a2] = pos;
|
|
806
828
|
if (!cmd || v.help || cmd === "help") return showHelp();
|
|
807
829
|
switch (cmd) {
|
|
@@ -846,8 +868,11 @@ async function main() {
|
|
|
846
868
|
throw usage(`Unknown conversations subcommand: ${sub ?? "(none)"}.`, "Try: ghosty conversations ls <agent-id>");
|
|
847
869
|
case "schedule":
|
|
848
870
|
return scheduleCmd(sub, a1, a2, v);
|
|
871
|
+
case "usage":
|
|
872
|
+
return meUsage();
|
|
849
873
|
case "me":
|
|
850
874
|
if (sub === "files") return meFiles(a1, a2, v);
|
|
875
|
+
if (sub === "usage") return meUsage();
|
|
851
876
|
throw usage(`Unknown me subcommand: ${sub ?? "(none)"}.`, "Try: ghosty me files ls");
|
|
852
877
|
case "docs": {
|
|
853
878
|
const url = `${await baseUrl()}/docs${sub ? `/${encodeURIComponent(sub)}` : "/cli"}`;
|
package/package.json
CHANGED