@robbeverhelst/do 1.178.0 → 1.180.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.
Files changed (2) hide show
  1. package/dist/do.js +211 -1
  2. package/package.json +1 -1
package/dist/do.js CHANGED
@@ -19327,6 +19327,22 @@ var restAreaInputSchema = object({
19327
19327
  until: exports_iso.date(),
19328
19328
  habits: _enum2(["keep", "pause"]).default("keep")
19329
19329
  }).strict();
19330
+ var areaToProjectInputSchema = object({ projectId: ulidSchema, intoAreaId: ulidSchema.nullable() }).strict();
19331
+ var areaMovedSchema = object({
19332
+ tasks: array(string2()),
19333
+ projects: array(string2()),
19334
+ habits: array(string2()),
19335
+ routines: array(string2()),
19336
+ notes: array(string2()),
19337
+ collectionItems: array(string2())
19338
+ });
19339
+ var areaToProjectResultSchema = object({
19340
+ areaId: string2(),
19341
+ projectId: string2(),
19342
+ intoAreaId: string2().nullable(),
19343
+ moved: areaMovedSchema
19344
+ });
19345
+ var undoAreaToProjectInputSchema = object({ projectId: ulidSchema, moved: areaMovedSchema }).strict();
19330
19346
 
19331
19347
  // ../../packages/schema/src/presets/facets.ts
19332
19348
  var PANTRY_DISPLAY_KIND = "pantry";
@@ -21624,7 +21640,7 @@ function parseCapture2(input, now) {
21624
21640
 
21625
21641
  // src/meta.ts
21626
21642
  var CLI_NAME = "do";
21627
- var VERSION = "1.178.0";
21643
+ var VERSION = "1.180.0";
21628
21644
  var API_PREFIX = "/api/v1";
21629
21645
  var DEFAULT_API_URL = "http://localhost:3001";
21630
21646
 
@@ -23170,6 +23186,80 @@ var COMMAND_SPECS = [
23170
23186
  returns: "EchoThreadSummary",
23171
23187
  notes: "For later and Silent posts never push. The home thread and conversations start at all, a standing thread you add at needs_you."
23172
23188
  },
23189
+ {
23190
+ path: ["echo", "threads", "add"],
23191
+ summary: "Add a standing thread of your own (Build, Business), pinned under the agent's.",
23192
+ args: [{ name: "title", required: true, description: "Its name (`Build`)." }],
23193
+ flags: [
23194
+ {
23195
+ name: "slug",
23196
+ type: "string",
23197
+ description: "What the agent and scripts address it by (default: from the title)."
23198
+ },
23199
+ { name: "areas", type: "string", description: "Area ids it covers, comma-separated." }
23200
+ ],
23201
+ scopes: ["agents:write"],
23202
+ returns: "EchoThread",
23203
+ notes: "A slug you already use is a 409; an archived thread's slug brings that thread back. The agent can post to it with `do echo post --thread <slug>`."
23204
+ },
23205
+ {
23206
+ path: ["echo", "thread", "add"],
23207
+ summary: "Same as `echo threads add`.",
23208
+ args: [{ name: "title", required: true, description: "Its name (`Build`)." }],
23209
+ flags: [
23210
+ {
23211
+ name: "slug",
23212
+ type: "string",
23213
+ description: "What the agent and scripts address it by (default: from the title)."
23214
+ },
23215
+ { name: "areas", type: "string", description: "Area ids it covers, comma-separated." }
23216
+ ],
23217
+ scopes: ["agents:write"],
23218
+ returns: "EchoThread"
23219
+ },
23220
+ {
23221
+ path: ["echo", "threads", "rename"],
23222
+ summary: "Rename one of your agent threads.",
23223
+ args: [
23224
+ { name: "thread", required: true, description: "Its id, or a standing thread's slug." },
23225
+ { name: "title", required: true, description: "The new name." }
23226
+ ],
23227
+ flags: [],
23228
+ scopes: ["agents:write"],
23229
+ returns: "EchoThreadSummary"
23230
+ },
23231
+ {
23232
+ path: ["echo", "threads", "link"],
23233
+ summary: "Set the Areas a standing thread covers, so its brief knows where to look.",
23234
+ args: [{ name: "thread", required: true, description: "Its id, or its slug." }],
23235
+ flags: [
23236
+ {
23237
+ name: "areas",
23238
+ type: "string",
23239
+ description: "Area ids, comma-separated (replaces the list; '' unlinks them all)."
23240
+ }
23241
+ ],
23242
+ scopes: ["agents:write"],
23243
+ returns: "EchoThreadSummary",
23244
+ notes: "Links only: a thread never becomes an Area."
23245
+ },
23246
+ {
23247
+ path: ["echo", "threads", "archive"],
23248
+ summary: "Archive one of your agent threads.",
23249
+ args: [{ name: "thread", required: true, description: "Its id, or a standing thread's slug." }],
23250
+ flags: [],
23251
+ scopes: ["agents:write"],
23252
+ returns: "EchoThreadSummary",
23253
+ notes: "It leaves your list and its slug no longer reaches it. The home thread (the agent's) can't be archived."
23254
+ },
23255
+ {
23256
+ path: ["echo", "threads", "restore"],
23257
+ summary: "Bring an archived thread back.",
23258
+ args: [{ name: "id", required: true, description: "Thread ULID." }],
23259
+ flags: [],
23260
+ scopes: ["agents:write"],
23261
+ returns: "EchoThreadSummary"
23262
+ },
23173
23263
  {
23174
23264
  path: ["settings", "get"],
23175
23265
  summary: "Show the caller's settings for the Space.",
@@ -23548,6 +23638,36 @@ var COMMAND_SPECS = [
23548
23638
  returns: "UserSettings",
23549
23639
  notes: "Reads then patches settings.pinnedAreaIds."
23550
23640
  },
23641
+ {
23642
+ path: ["areas", "make-project"],
23643
+ summary: "Make an Area that finishes a Project (prints the receipt for undo).",
23644
+ args: [{ name: "id", required: true, description: "Area ULID." }],
23645
+ flags: [
23646
+ {
23647
+ name: "into",
23648
+ type: "string",
23649
+ description: "The Area to file the new Project under (none when left out)."
23650
+ }
23651
+ ],
23652
+ scopes: ["areas:write", "projects:write"],
23653
+ returns: "AreaToProjectResult",
23654
+ notes: "POST /api/v1/areas/{id}/to-project (Areas 8). The Project takes the Area's title; its loose tasks go inside, its Projects, habits, routines and notes move beside it, and the Area is archived. An agent proposes this; only the member runs it."
23655
+ },
23656
+ {
23657
+ path: ["areas", "undo-make-project"],
23658
+ summary: "Undo `areas make-project` from its receipt.",
23659
+ args: [{ name: "id", required: true, description: "Area ULID." }],
23660
+ flags: [
23661
+ {
23662
+ name: "data",
23663
+ type: "string",
23664
+ description: "The receipt as JSON: { projectId, moved } from `areas make-project`."
23665
+ }
23666
+ ],
23667
+ scopes: ["areas:write", "projects:write"],
23668
+ returns: "AreaView",
23669
+ notes: "POST /api/v1/areas/{id}/to-project/undo (Areas 8). Everything comes back; the Project goes."
23670
+ },
23551
23671
  {
23552
23672
  path: ["places", "import"],
23553
23673
  summary: "Import the rooms of the house once from Gaard's house.json.",
@@ -25727,6 +25847,44 @@ var HANDLERS = {
25727
25847
  }),
25728
25848
  render: renderRecord
25729
25849
  }),
25850
+ "echo threads add": echoThreadAdd,
25851
+ "echo thread add": echoThreadAdd,
25852
+ "echo threads rename": async ({ args, requireClient }) => {
25853
+ const client = requireClient();
25854
+ const id = await echoThreadId(client, requireArg(args, 0, "thread"));
25855
+ const title = args.slice(1).join(" ").trim();
25856
+ if (!title)
25857
+ throw usageError("missing required argument: <title>");
25858
+ return { data: await client.patch(`/echo/threads/${id}`, { title }), render: renderRecord };
25859
+ },
25860
+ "echo threads link": async ({ args, flags, requireClient }) => {
25861
+ const client = requireClient();
25862
+ const id = await echoThreadId(client, requireArg(args, 0, "thread"));
25863
+ const areas = flagString(flags, "areas");
25864
+ if (areas === undefined)
25865
+ throw usageError("pass --areas <id,id> (--areas '' unlinks them all)");
25866
+ const areaIds = splitList(areas);
25867
+ return {
25868
+ data: await client.patch(`/echo/threads/${id}`, { areaIds }),
25869
+ render: renderRecord
25870
+ };
25871
+ },
25872
+ "echo threads archive": async ({ args, requireClient }) => {
25873
+ const client = requireClient();
25874
+ const id = await echoThreadId(client, requireArg(args, 0, "thread"));
25875
+ return {
25876
+ data: await client.patch(`/echo/threads/${id}`, { archived: true }),
25877
+ render: renderRecord
25878
+ };
25879
+ },
25880
+ "echo threads restore": async ({ args, requireClient }) => {
25881
+ const client = requireClient();
25882
+ const id = requireArg(args, 0, "thread id");
25883
+ return {
25884
+ data: await client.patch(`/echo/threads/${id}`, { archived: false }),
25885
+ render: renderRecord
25886
+ };
25887
+ },
25730
25888
  "settings get": async ({ requireClient }) => ({
25731
25889
  data: await requireClient().get("/settings"),
25732
25890
  render: renderRecord
@@ -25965,6 +26123,29 @@ var HANDLERS = {
25965
26123
  },
25966
26124
  "areas pin": async ({ args, requireClient }) => setAreaPinned(args, requireClient, true),
25967
26125
  "areas unpin": async ({ args, requireClient }) => setAreaPinned(args, requireClient, false),
26126
+ "areas make-project": async ({ args, flags, requireClient }) => {
26127
+ const id = requireArg(args, 0, "area id");
26128
+ const input = parseInput(areaToProjectInputSchema, {
26129
+ projectId: ulid3(),
26130
+ intoAreaId: flagString(flags, "into") ?? null
26131
+ });
26132
+ return {
26133
+ data: await requireClient().post(`/areas/${id}/to-project`, input),
26134
+ render: renderRecord
26135
+ };
26136
+ },
26137
+ "areas undo-make-project": async ({ args, flags, requireClient }) => {
26138
+ const id = requireArg(args, 0, "area id");
26139
+ const receipt = readDataFlag(flags);
26140
+ const input = parseInput(undoAreaToProjectInputSchema, {
26141
+ projectId: receipt.projectId,
26142
+ moved: receipt.moved
26143
+ });
26144
+ return {
26145
+ data: await requireClient().post(`/areas/${id}/to-project/undo`, input),
26146
+ render: renderRecord
26147
+ };
26148
+ },
25968
26149
  "places import": async ({ args, flags, requireClient }) => {
25969
26150
  const path = requireArg(args, 0, "house.json path");
25970
26151
  let file;
@@ -26224,6 +26405,35 @@ function standardLink(flags) {
26224
26405
  return { kind: "metric", key: metric };
26225
26406
  return null;
26226
26407
  }
26408
+ async function echoThreadAdd({ args, flags, requireClient }) {
26409
+ const title = args.join(" ").trim();
26410
+ if (!title)
26411
+ throw usageError("missing required argument: <title>");
26412
+ const slug = flagString(flags, "slug");
26413
+ const areas = flagString(flags, "areas");
26414
+ return {
26415
+ data: await requireClient().post("/echo/threads/standing", {
26416
+ title,
26417
+ ...slug ? { slug } : {},
26418
+ ...areas === undefined ? {} : { areaIds: splitList(areas) }
26419
+ }),
26420
+ render: renderEchoThread
26421
+ };
26422
+ }
26423
+ async function echoThreadId(client, ref) {
26424
+ if (ULID.test(ref))
26425
+ return ref;
26426
+ const threads = await client.get("/echo/threads", {
26427
+ query: { limit: "50" }
26428
+ });
26429
+ const found = threads.find((t) => t.slug === ref);
26430
+ if (!found)
26431
+ throw usageError(`no thread \`${ref}\` (see \`do echo threads list\`)`);
26432
+ return found.id;
26433
+ }
26434
+ function splitList(value) {
26435
+ return value.split(",").map((v) => v.trim()).filter((v) => v.length > 0);
26436
+ }
26227
26437
  function requireArg(args, index, name) {
26228
26438
  const value = args[index];
26229
26439
  if (value === undefined || value.length === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robbeverhelst/do",
3
- "version": "1.178.0",
3
+ "version": "1.180.0",
4
4
  "private": false,
5
5
  "description": "do — the agent-drivable CLI over the public /api/v1 surface",
6
6
  "homepage": "https://github.com/robbeverhelst/do/tree/main/apps/cli",