@robbeverhelst/do 1.169.0 → 1.171.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 +124 -4
  2. package/package.json +1 -1
package/dist/do.js CHANGED
@@ -3606,7 +3606,8 @@ var areas = pgTable("areas", {
3606
3606
  reviewCadence: reviewCadence("review_cadence"),
3607
3607
  archivedAt: timestamp("archived_at", { withTimezone: true }),
3608
3608
  purpose: text("purpose"),
3609
- standards: jsonb("standards").$type().notNull().default(sql`'[]'::jsonb`)
3609
+ standards: jsonb("standards").$type().notNull().default(sql`'[]'::jsonb`),
3610
+ restingUntil: date("resting_until", { mode: "string" })
3610
3611
  }, (t) => [
3611
3612
  index("areas_tenant_idx").on(t.tenantId),
3612
3613
  check("areas_standards_chk", sql`jsonb_typeof(${t.standards}) = 'array' AND jsonb_array_length(${t.standards}) <= 5`)
@@ -19217,16 +19218,18 @@ var createAreaInputSchema = createInsertSchema(areas, {
19217
19218
  id: ulidSchema,
19218
19219
  icon: areaIconSchema.nullish(),
19219
19220
  purpose: areaPurposeSchema.nullish()
19220
- }).omit({ tenantId: true, archivedAt: true, standards: true }).extend({ title: string2().min(1) });
19221
+ }).omit({ tenantId: true, archivedAt: true, standards: true, restingUntil: true }).extend({ title: string2().min(1) });
19221
19222
  var updateAreaInputSchema = createUpdateSchema(areas, {
19222
19223
  icon: areaIconSchema.nullish(),
19223
19224
  archivedAt: exports_coerce.date().nullish(),
19224
19225
  purpose: areaPurposeSchema.nullish(),
19225
- standards: array(areaStandardInputSchema).max(5).optional()
19226
+ standards: array(areaStandardInputSchema).max(5).optional(),
19227
+ restingUntil: exports_iso.date().nullish()
19226
19228
  }).omit({ id: true, tenantId: true }).extend({ title: string2().min(1).optional() }).strict();
19227
19229
  var areaViewSchema = areaSchema.extend({
19228
19230
  title: string2(),
19229
19231
  archivedAt: exports_coerce.date().nullable().default(null),
19232
+ restingUntil: exports_iso.date().nullable().default(null),
19230
19233
  createdAt: exports_coerce.date(),
19231
19234
  updatedAt: exports_coerce.date(),
19232
19235
  deletedAt: exports_coerce.date().nullable(),
@@ -19247,6 +19250,38 @@ var areaDetailSchema = areaViewSchema.extend({
19247
19250
  tasks: array(taskViewSchema),
19248
19251
  notes: array(noteViewSchema)
19249
19252
  });
19253
+ var areaOwnerLensSchema = _enum2(["mine", "agents", "all"]);
19254
+ var areaOverviewQuerySchema = object({
19255
+ owner: areaOwnerLensSchema.default("mine")
19256
+ });
19257
+ var areaAttentionKindSchema = _enum2(["busier", "steady", "quiet", "resting"]);
19258
+ var areaAttentionSchema = object({
19259
+ kind: areaAttentionKindSchema,
19260
+ word: string2().min(1),
19261
+ reason: string2().nullable()
19262
+ });
19263
+ var areaMovingLineSchema = object({
19264
+ kind: _enum2(["project", "task", "habits"]),
19265
+ id: string2().nullable(),
19266
+ title: string2(),
19267
+ detail: string2().nullable()
19268
+ });
19269
+ var areaOverviewItemSchema = object({
19270
+ id: string2(),
19271
+ title: string2(),
19272
+ color: areaSchema.shape.color,
19273
+ icon: string2().nullable(),
19274
+ purpose: string2().nullable().default(null),
19275
+ attention: areaAttentionSchema,
19276
+ moving: array(areaMovingLineSchema).max(2),
19277
+ waiting: number2().int().min(0),
19278
+ standardsWorthALook: number2().int().min(0).default(0),
19279
+ restingUntil: exports_iso.date().nullable()
19280
+ });
19281
+ var areaOverviewSchema = object({
19282
+ owner: areaOwnerLensSchema,
19283
+ areas: array(areaOverviewItemSchema)
19284
+ });
19250
19285
 
19251
19286
  // ../../packages/schema/src/presets/facets.ts
19252
19287
  var PANTRY_DISPLAY_KIND = "pantry";
@@ -21299,7 +21334,7 @@ function parseCapture2(input, now) {
21299
21334
 
21300
21335
  // src/meta.ts
21301
21336
  var CLI_NAME = "do";
21302
- var VERSION = "1.169.0";
21337
+ var VERSION = "1.171.0";
21303
21338
  var API_PREFIX = "/api/v1";
21304
21339
  var DEFAULT_API_URL = "http://localhost:3001";
21305
21340
 
@@ -22987,6 +23022,45 @@ var COMMAND_SPECS = [
22987
23022
  returns: "AreaDetail",
22988
23023
  notes: "DELETE /api/v1/areas/:id/standards/:standardId."
22989
23024
  },
23025
+ {
23026
+ path: ["areas", "overview"],
23027
+ summary: "How each Area is going, in words: attention against its own usual, what's moving, and what waits on you.",
23028
+ args: [],
23029
+ flags: [
23030
+ {
23031
+ name: "owner",
23032
+ type: "string",
23033
+ description: "Whose work counts: mine (default; agents' work doesn't), agents or all."
23034
+ }
23035
+ ],
23036
+ scopes: ["areas:read"],
23037
+ returns: "AreaOverview",
23038
+ notes: 'GET /api/v1/areas/overview. Words, never a score: "Busier than usual", "Steady", "Quiet for three weeks", "Resting", each with a short reason. The only count is what waits on you. Resting Areas come last.'
23039
+ },
23040
+ {
23041
+ path: ["areas", "rest"],
23042
+ summary: "Rest an Area until a day: it keeps everything and folds to the foot of the overview.",
23043
+ args: [{ name: "id", required: true, description: "Area ULID." }],
23044
+ flags: [
23045
+ {
23046
+ name: "until",
23047
+ type: "string",
23048
+ description: "The day it's back (YYYY-MM-DD). Required."
23049
+ }
23050
+ ],
23051
+ scopes: ["areas:write"],
23052
+ returns: "AreaView",
23053
+ notes: "PATCH /api/v1/areas/{id} { restingUntil }. Between active and archived: its attention reads Resting, back in that month. Bring it back early with `do areas back`."
23054
+ },
23055
+ {
23056
+ path: ["areas", "back"],
23057
+ summary: "Bring a resting Area back today.",
23058
+ args: [{ name: "id", required: true, description: "Area ULID." }],
23059
+ flags: [],
23060
+ scopes: ["areas:write"],
23061
+ returns: "AreaView",
23062
+ notes: "PATCH /api/v1/areas/{id} { restingUntil: null }. Nothing was lost while it rested."
23063
+ },
22990
23064
  {
22991
23065
  path: ["places", "import"],
22992
23066
  summary: "Import the rooms of the house once from Gaard's house.json.",
@@ -23705,6 +23779,31 @@ function renderFromEarlier(data, mode) {
23705
23779
  ].join(`
23706
23780
  `);
23707
23781
  }
23782
+ function renderAreaOverview(data, mode) {
23783
+ const d = data;
23784
+ const all = d.areas ?? [];
23785
+ if (all.length === 0)
23786
+ return paint(mode, "dim", "No areas yet.");
23787
+ const active = all.filter((a) => a.attention.kind !== "resting");
23788
+ const resting = all.filter((a) => a.attention.kind === "resting");
23789
+ const lens = d.owner === "agents" ? "Agents" : d.owner === "all" ? "All" : "Mine";
23790
+ const out = [paint(mode, "bold", `Your areas \xB7 ${lens}`)];
23791
+ for (const a of active) {
23792
+ const waiting = a.waiting ? paint(mode, "yellow", ` ${a.waiting} waiting`) : "";
23793
+ out.push(` ${paint(mode, "bold", a.title)}${waiting} ${paint(mode, "dim", a.id)}`);
23794
+ if (a.purpose)
23795
+ out.push(` ${paint(mode, "dim", a.purpose)}`);
23796
+ const reason = a.attention.reason ? paint(mode, "dim", ` \xB7 ${a.attention.reason}`) : "";
23797
+ out.push(` ${a.attention.word}${reason}`);
23798
+ for (const m of a.moving ?? [])
23799
+ out.push(` \xB7 ${m.title}${m.detail ? `, ${m.detail}` : ""}`);
23800
+ }
23801
+ if (resting.length > 0) {
23802
+ out.push("", paint(mode, "dim", `Resting: ${resting.map((a) => `${a.title}${a.attention.reason ? `, ${a.attention.reason.replace(/^B/, "b")}` : ""}`).join("; ")}.`));
23803
+ }
23804
+ return out.join(`
23805
+ `);
23806
+ }
23708
23807
  function renderFromEarlierAnswer(data, mode) {
23709
23808
  const d = data;
23710
23809
  const n = d.tasks ?? 0;
@@ -25200,6 +25299,27 @@ var HANDLERS = {
25200
25299
  const area = await requireClient().delete(`/areas/${id}/standards/${standard}`);
25201
25300
  return { data: area.standards ?? [], render: renderStandards };
25202
25301
  },
25302
+ "areas overview": async ({ flags, requireClient }) => {
25303
+ const owner = flagString(flags, "owner");
25304
+ const query = parseInput(areaOverviewQuerySchema, owner ? { owner } : {});
25305
+ return {
25306
+ data: await requireClient().get("/areas/overview", { query }),
25307
+ render: renderAreaOverview
25308
+ };
25309
+ },
25310
+ "areas rest": async ({ args, flags, requireClient }) => {
25311
+ const id = requireArg(args, 0, "area id");
25312
+ const until = flagString(flags, "until");
25313
+ if (!until)
25314
+ throw usageError("areas rest needs --until <YYYY-MM-DD>, the day it's back");
25315
+ const input = parseInput(updateAreaInputSchema, { restingUntil: until });
25316
+ return { data: await requireClient().patch(`/areas/${id}`, input), render: renderRecord };
25317
+ },
25318
+ "areas back": async ({ args, requireClient }) => {
25319
+ const id = requireArg(args, 0, "area id");
25320
+ const input = parseInput(updateAreaInputSchema, { restingUntil: null });
25321
+ return { data: await requireClient().patch(`/areas/${id}`, input), render: renderRecord };
25322
+ },
25203
25323
  "places import": async ({ args, flags, requireClient }) => {
25204
25324
  const path = requireArg(args, 0, "house.json path");
25205
25325
  let file;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robbeverhelst/do",
3
- "version": "1.169.0",
3
+ "version": "1.171.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",