@wrenautomation/aerie 0.4.1 → 0.4.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.js CHANGED
@@ -14969,77 +14969,6 @@ function rolesOn(grants, actor2, area2) {
14969
14969
  return [...new Set(grants.filter((g) => g.actor === actor2 && up.has(g.area)).map((g) => g.role))];
14970
14970
  }
14971
14971
 
14972
- // src/core/edit.ts
14973
- var PARA = "\n\n";
14974
- var append = (base, more) => more?.length ? [base, ...more].filter((x) => x?.trim()).join(PARA) : base;
14975
- var uniq = (xs) => [...new Set(xs)];
14976
- function checks3(cs, e, what) {
14977
- if (!e) return cs;
14978
- let out = cs.map((c) => ({ ...c }));
14979
- const at2 = (n) => {
14980
- const c = out[n - 1];
14981
- if (!c) throw new Error(`${what} #${n} does not exist (has ${out.length})`);
14982
- return c;
14983
- };
14984
- if (e.clear) out = [];
14985
- if (e.replace) {
14986
- const was = new Map(out.map((c) => [c.text.trim(), c.done]));
14987
- out = e.replace.map((text3) => ({ text: text3.trim(), done: was.get(text3.trim()) ?? false }));
14988
- }
14989
- for (const n of e.check ?? []) at2(n).done = true;
14990
- for (const n of e.uncheck ?? []) at2(n).done = false;
14991
- if (e.remove?.length) {
14992
- for (const n of e.remove) at2(n);
14993
- const drop = new Set(e.remove);
14994
- out = out.filter((_, i) => !drop.has(i + 1));
14995
- }
14996
- for (const text3 of e.add ?? []) out.push({ text: text3.trim(), done: false });
14997
- return out;
14998
- }
14999
- function applyEdit(t, e, now) {
15000
- const n = { ...t, extra: { ...t.extra } };
15001
- const set2 = (k, v) => {
15002
- if (v === void 0) return;
15003
- if (v === null || v === "") delete n[k];
15004
- else n[k] = v;
15005
- };
15006
- if (e.title !== void 0) {
15007
- if (!e.title.trim()) throw new Error("title is empty");
15008
- n.title = e.title.trim();
15009
- }
15010
- set2("description", e.description);
15011
- if (e.status !== void 0) {
15012
- if (e.status !== t.status && e.status === "Done") n.closedAt = now;
15013
- if (e.status !== "Done") delete n.closedAt;
15014
- n.status = e.status;
15015
- }
15016
- set2("priority", e.priority);
15017
- set2("type", e.type);
15018
- set2("milestone", e.milestone);
15019
- set2("ordinal", e.ordinal);
15020
- set2("parentId", e.parentId);
15021
- if (e.assignees) n.assignees = uniq(e.assignees.map((a) => a.trim()).filter(Boolean));
15022
- if (e.labels) n.labels = uniq(e.labels);
15023
- if (e.removeLabels) n.labels = n.labels.filter((l) => !e.removeLabels?.includes(l));
15024
- if (e.addLabels) n.labels = uniq([...n.labels, ...e.addLabels]);
15025
- if (e.clearDeps) n.dependencies = [];
15026
- if (e.addDeps) n.dependencies = uniq([...n.dependencies, ...e.addDeps]);
15027
- if (e.references) n.references = uniq(e.references);
15028
- n.ac = checks3(n.ac, e.ac, "AC");
15029
- n.dod = checks3(n.dod, e.dod, "DoD");
15030
- set2("plan", e.plan);
15031
- set2("plan", append(n.plan, e.appendPlan));
15032
- set2("notes", e.notes);
15033
- set2("notes", append(n.notes, e.appendNotes));
15034
- if (e.clearFinalSummary) delete n.finalSummary;
15035
- set2("finalSummary", e.finalSummary);
15036
- set2("finalSummary", append(n.finalSummary, e.appendFinalSummary));
15037
- if (e.comments?.length)
15038
- n.comments = [...n.comments, ...e.comments.map((c) => ({ ...c, created: now }))];
15039
- n.updatedAt = now;
15040
- return n;
15041
- }
15042
-
15043
14972
  // src/core/filter.ts
15044
14973
  var MARK = "@peers:";
15045
14974
  var holdersOf = (t) => t.assignees.filter((a) => a.startsWith(MARK)).map((a) => a.slice(MARK.length));
@@ -15122,7 +15051,7 @@ function cmp(a, b, f) {
15122
15051
 
15123
15052
  // src/core/fields.ts
15124
15053
  var one = (v) => v ? [v] : [];
15125
- var checks4 = (t) => {
15054
+ var checks3 = (t) => {
15126
15055
  const all = [...t.ac, ...t.dod];
15127
15056
  return all.length ? [`${all.filter((c) => c.done).length}/${all.length}`] : [];
15128
15057
  };
@@ -15166,7 +15095,7 @@ var FIELDS = [
15166
15095
  },
15167
15096
  { key: "parent", label: "Parent", kind: "id", values: (t) => one(t.parentId), group: true },
15168
15097
  { key: "type", label: "Type", kind: "text", values: (t) => one(t.type), group: true },
15169
- { key: "checks", label: "Checks", kind: "progress", values: checks4 },
15098
+ { key: "checks", label: "Checks", kind: "progress", values: checks3 },
15170
15099
  {
15171
15100
  key: "createdAt",
15172
15101
  label: "Created",
@@ -15191,6 +15120,77 @@ var FIELDS = [
15191
15120
  ];
15192
15121
  var GROUP_KEYS = FIELDS.filter((f) => f.group).map((f) => f.key);
15193
15122
 
15123
+ // src/core/edit.ts
15124
+ var PARA = "\n\n";
15125
+ var append = (base, more) => more?.length ? [base, ...more].filter((x) => x?.trim()).join(PARA) : base;
15126
+ var uniq = (xs) => [...new Set(xs)];
15127
+ function checks4(cs, e, what) {
15128
+ if (!e) return cs;
15129
+ let out = cs.map((c) => ({ ...c }));
15130
+ const at2 = (n) => {
15131
+ const c = out[n - 1];
15132
+ if (!c) throw new Error(`${what} #${n} does not exist (has ${out.length})`);
15133
+ return c;
15134
+ };
15135
+ if (e.clear) out = [];
15136
+ if (e.replace) {
15137
+ const was = new Map(out.map((c) => [c.text.trim(), c.done]));
15138
+ out = e.replace.map((text3) => ({ text: text3.trim(), done: was.get(text3.trim()) ?? false }));
15139
+ }
15140
+ for (const n of e.check ?? []) at2(n).done = true;
15141
+ for (const n of e.uncheck ?? []) at2(n).done = false;
15142
+ if (e.remove?.length) {
15143
+ for (const n of e.remove) at2(n);
15144
+ const drop = new Set(e.remove);
15145
+ out = out.filter((_, i) => !drop.has(i + 1));
15146
+ }
15147
+ for (const text3 of e.add ?? []) out.push({ text: text3.trim(), done: false });
15148
+ return out;
15149
+ }
15150
+ function applyEdit(t, e, now) {
15151
+ const n = { ...t, extra: { ...t.extra } };
15152
+ const set2 = (k, v) => {
15153
+ if (v === void 0) return;
15154
+ if (v === null || v === "") delete n[k];
15155
+ else n[k] = v;
15156
+ };
15157
+ if (e.title !== void 0) {
15158
+ if (!e.title.trim()) throw new Error("title is empty");
15159
+ n.title = e.title.trim();
15160
+ }
15161
+ set2("description", e.description);
15162
+ if (e.status !== void 0) {
15163
+ if (e.status !== t.status && e.status === "Done") n.closedAt = now;
15164
+ if (e.status !== "Done") delete n.closedAt;
15165
+ n.status = e.status;
15166
+ }
15167
+ set2("priority", e.priority);
15168
+ set2("type", e.type);
15169
+ set2("milestone", e.milestone);
15170
+ set2("ordinal", e.ordinal);
15171
+ set2("parentId", e.parentId);
15172
+ if (e.assignees) n.assignees = uniq(e.assignees.map((a) => a.trim()).filter(Boolean));
15173
+ if (e.labels) n.labels = uniq(e.labels);
15174
+ if (e.removeLabels) n.labels = n.labels.filter((l) => !e.removeLabels?.includes(l));
15175
+ if (e.addLabels) n.labels = uniq([...n.labels, ...e.addLabels]);
15176
+ if (e.clearDeps) n.dependencies = [];
15177
+ if (e.addDeps) n.dependencies = uniq([...n.dependencies, ...e.addDeps]);
15178
+ if (e.references) n.references = uniq(e.references);
15179
+ n.ac = checks4(n.ac, e.ac, "AC");
15180
+ n.dod = checks4(n.dod, e.dod, "DoD");
15181
+ set2("plan", e.plan);
15182
+ set2("plan", append(n.plan, e.appendPlan));
15183
+ set2("notes", e.notes);
15184
+ set2("notes", append(n.notes, e.appendNotes));
15185
+ if (e.clearFinalSummary) delete n.finalSummary;
15186
+ set2("finalSummary", e.finalSummary);
15187
+ set2("finalSummary", append(n.finalSummary, e.appendFinalSummary));
15188
+ if (e.comments?.length)
15189
+ n.comments = [...n.comments, ...e.comments.map((c) => ({ ...c, created: now }))];
15190
+ n.updatedAt = now;
15191
+ return n;
15192
+ }
15193
+
15194
15194
  // src/mirror.ts
15195
15195
  import { spawnSync } from "node:child_process";
15196
15196
  import { createHash } from "node:crypto";