@floh-solutions/pharos-cli 0.3.0 → 0.12.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 (67) hide show
  1. package/dist/cli.d.ts.map +1 -1
  2. package/dist/cli.js +392 -15
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/attach.d.ts +30 -0
  5. package/dist/commands/attach.d.ts.map +1 -0
  6. package/dist/commands/attach.js +55 -0
  7. package/dist/commands/attach.js.map +1 -0
  8. package/dist/commands/create.d.ts +35 -0
  9. package/dist/commands/create.d.ts.map +1 -0
  10. package/dist/commands/create.js +82 -0
  11. package/dist/commands/create.js.map +1 -0
  12. package/dist/commands/detach.d.ts +34 -0
  13. package/dist/commands/detach.d.ts.map +1 -0
  14. package/dist/commands/detach.js +117 -0
  15. package/dist/commands/detach.js.map +1 -0
  16. package/dist/commands/discover.d.ts +66 -0
  17. package/dist/commands/discover.d.ts.map +1 -0
  18. package/dist/commands/discover.js +128 -0
  19. package/dist/commands/discover.js.map +1 -0
  20. package/dist/commands/hooks.d.ts +24 -0
  21. package/dist/commands/hooks.d.ts.map +1 -0
  22. package/dist/commands/hooks.js +184 -0
  23. package/dist/commands/hooks.js.map +1 -0
  24. package/dist/commands/image.d.ts +44 -0
  25. package/dist/commands/image.d.ts.map +1 -0
  26. package/dist/commands/image.js +114 -0
  27. package/dist/commands/image.js.map +1 -0
  28. package/dist/commands/import.d.ts +51 -0
  29. package/dist/commands/import.d.ts.map +1 -0
  30. package/dist/commands/import.js +190 -0
  31. package/dist/commands/import.js.map +1 -0
  32. package/dist/commands/link.d.ts +40 -0
  33. package/dist/commands/link.d.ts.map +1 -0
  34. package/dist/commands/link.js +150 -0
  35. package/dist/commands/link.js.map +1 -0
  36. package/dist/commands/people.d.ts +39 -0
  37. package/dist/commands/people.d.ts.map +1 -0
  38. package/dist/commands/people.js +64 -0
  39. package/dist/commands/people.js.map +1 -0
  40. package/dist/commands/query.d.ts +43 -0
  41. package/dist/commands/query.d.ts.map +1 -0
  42. package/dist/commands/query.js +202 -0
  43. package/dist/commands/query.js.map +1 -0
  44. package/dist/commands/recycle.d.ts +10 -0
  45. package/dist/commands/recycle.d.ts.map +1 -0
  46. package/dist/commands/recycle.js +118 -0
  47. package/dist/commands/recycle.js.map +1 -0
  48. package/dist/commands/setup.d.ts +4 -1
  49. package/dist/commands/setup.d.ts.map +1 -1
  50. package/dist/commands/setup.js +22 -21
  51. package/dist/commands/setup.js.map +1 -1
  52. package/dist/commands/update.d.ts +52 -0
  53. package/dist/commands/update.d.ts.map +1 -0
  54. package/dist/commands/update.js +181 -0
  55. package/dist/commands/update.js.map +1 -0
  56. package/dist/commands/wiki.d.ts.map +1 -1
  57. package/dist/commands/wiki.js +133 -2
  58. package/dist/commands/wiki.js.map +1 -1
  59. package/dist/output.d.ts.map +1 -1
  60. package/dist/output.js +32 -2
  61. package/dist/output.js.map +1 -1
  62. package/dist/wiql-build.d.ts +92 -0
  63. package/dist/wiql-build.d.ts.map +1 -0
  64. package/dist/wiql-build.js +147 -0
  65. package/dist/wiql-build.js.map +1 -0
  66. package/package.json +3 -3
  67. package/skill/SKILL.md +315 -65
@@ -0,0 +1,118 @@
1
+ import { emit, emitText, usageError } from "../output.js";
2
+ import { approve } from "../session.js";
3
+ /**
4
+ * `pharos delete`, `restore` and `deleted` — the recycle bin.
5
+ *
6
+ * **Deleting is not destroying, and the words matter.** `DELETE
7
+ * /wit/workitems/{id}` moves an item to the project's recycle bin, from which
8
+ * anybody can restore it; only `?destroy=true` is permanent, and that needs a
9
+ * project-level permission most accounts do not have. The macOS app names its
10
+ * button "Move to Recycle Bin" rather than "Delete" for exactly this reason —
11
+ * a verb that reads as irreversible when it is not teaches people to fear the
12
+ * safe thing and, worse, to trust the unsafe one.
13
+ *
14
+ * `restore` and the recycle-bin listing are the half `az boards work-item
15
+ * delete` does not have at all, which is what makes this worth building rather
16
+ * than duplicating (#590).
17
+ *
18
+ * ## There is deliberately no way to destroy anything from here
19
+ *
20
+ * `WorkItemsApi.destroyDeleted` exists in `ado-core` and this CLI does not
21
+ * expose it. @user's call, and the reasoning is worth keeping because somebody
22
+ * will eventually propose adding it back:
23
+ *
24
+ * - **The primary consumer is an agent**, and agents learn to pass `--yes` —
25
+ * it is on every destructive verb here. A flag guarded only by convention is
26
+ * one prompt away from being satisfied.
27
+ * - **It is the only verb in the surface with no way back.** A wiki page has
28
+ * git history, a field has revisions, a deleted item has this bin.
29
+ * - It usually 403s anyway: destroying needs a project-level permission most
30
+ * accounts do not hold.
31
+ * - Nothing is gained. The bin is not a scarce resource.
32
+ *
33
+ * The web UI owns it, with an admin's own confirmation, in the place an admin
34
+ * already goes for permissions work.
35
+ */
36
+ function workItemId(raw, usage) {
37
+ if (raw === undefined)
38
+ throw usageError(usage);
39
+ if (!/^\d+$/.test(raw))
40
+ throw usageError(`"${raw}" is not a work item id.`, { given: raw });
41
+ return Number(raw);
42
+ }
43
+ export async function runDelete(io, session, positionals) {
44
+ const id = workItemId(positionals[0], "Which work item? `pharos delete <id> --yes`.");
45
+ // Read first so the refusal can QUOTE what it is about to remove. "Delete 12
46
+ // work items?" is the dialog everybody clicks through; "#225 — Complete
47
+ // handover and closeout" is the one that stops the wrong hand.
48
+ const item = await session.client.workItems.get(id);
49
+ const title = item.fields?.["System.Title"];
50
+ const subject = typeof title === "string" && title !== "" ? `#${id} — ${title}` : `#${id}`;
51
+ const stop = approve(io, session, {
52
+ what: `move ${subject} to the Recycle Bin`,
53
+ would: { id, title: title ?? null, destination: "Recycle Bin", restorable: true },
54
+ });
55
+ if (stop !== undefined)
56
+ return stop;
57
+ if (session.previewOnly) {
58
+ return emit(io, { applied: false, dryRun: true, id, title: title ?? null });
59
+ }
60
+ await session.client.workItems.delete(id);
61
+ const result = {
62
+ applied: true,
63
+ id,
64
+ title: title ?? null,
65
+ restorable: true,
66
+ hint: `Undo with \`pharos restore ${id}\`.`,
67
+ };
68
+ return session.pretty ? emitText(io, `${subject} → Recycle Bin`) : emit(io, result);
69
+ }
70
+ export async function runRestore(io, session, positionals) {
71
+ const id = workItemId(positionals[0], "Which work item? `pharos restore <id>`.");
72
+ // No --yes: restoring puts something back, which is the recoverable direction
73
+ // and the one somebody reaches for when they have just made a mistake.
74
+ if (session.previewOnly) {
75
+ return emit(io, { applied: false, dryRun: true, id });
76
+ }
77
+ const restored = await session.client.workItems.restore(id);
78
+ const result = { applied: true, id, name: restored.name ?? null };
79
+ return session.pretty ? emitText(io, `#${id} restored`) : emit(io, result);
80
+ }
81
+ export async function runDeleted(io, session, options) {
82
+ const references = await session.client.workItems.listDeleted();
83
+ // The list endpoint returns SHALLOW references — `{id, url}` and nothing more
84
+ // — so without this second call the answer is a column of bare numbers. Same
85
+ // hydrate step `query` makes after WIQL, and for the same reason: a list of
86
+ // ids answers no question anybody actually asked.
87
+ const wanted = references.slice(0, options.top).map((reference) => reference.id);
88
+ const items = await session.client.workItems.getDeletedBatch(wanted);
89
+ const result = {
90
+ count: references.length,
91
+ shown: items.length,
92
+ items: items.map((item) => ({
93
+ id: item.id,
94
+ type: item.type ?? null,
95
+ name: item.name ?? null,
96
+ deletedBy: item.deletedBy ?? null,
97
+ // Not ISO-8601 — "8/4/2026 2:37:24 PM". Passed through as the label it is
98
+ // rather than parsed, because parsing it outside a US locale swaps the day
99
+ // and month for the first twelve days of any month.
100
+ deletedDate: item.deletedDate ?? null,
101
+ })),
102
+ ...(references.length === 0 ? { note: "The Recycle Bin is empty." } : {}),
103
+ ...(references.length > items.length
104
+ ? { note: `${references.length} in the bin; naming the first ${items.length}. --top for more.` }
105
+ : {}),
106
+ };
107
+ if (!session.pretty)
108
+ return emit(io, result);
109
+ if (references.length === 0)
110
+ return emitText(io, "The Recycle Bin is empty.");
111
+ const lines = result.items.map((item) => ` #${String(item.id).padEnd(6)} ${(item.type ?? "").padEnd(10)} `
112
+ + `${(item.name ?? "(unnamed)").slice(0, 50).padEnd(50)} ${item.deletedDate ?? ""}`);
113
+ if (references.length > items.length) {
114
+ lines.push("", `${references.length} in the bin; ${items.length} shown. --top for more.`);
115
+ }
116
+ return emitText(io, lines.join("\n"));
117
+ }
118
+ //# sourceMappingURL=recycle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recycle.js","sourceRoot":"","sources":["../../src/commands/recycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAA0B,MAAM,cAAc,CAAC;AAClF,OAAO,EAAE,OAAO,EAAgB,MAAM,eAAe,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,SAAS,UAAU,CAAC,GAAuB,EAAE,KAAa;IACxD,IAAI,GAAG,KAAK,SAAS;QAAE,MAAM,UAAU,CAAC,KAAK,CAAC,CAAC;IAC/C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,MAAM,UAAU,CAAC,IAAI,GAAG,0BAA0B,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5F,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,EAAM,EACN,OAAgB,EAChB,WAA8B;IAE9B,MAAM,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,8CAA8C,CAAC,CAAC;IAEtF,6EAA6E;IAC7E,wEAAwE;IACxE,+DAA+D;IAC/D,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACpD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,cAAc,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CA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AM,gBAAgB,KAAK,CAAC,MAAM,yBAAyB,CAAC,CAAC;IAC5F,CAAC;IACD,OAAO,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACxC,CAAC"}
@@ -7,7 +7,10 @@ export interface SetupOptions {
7
7
  print: boolean;
8
8
  /** Read the token from stdin instead of prompting — for scripted setup. */
9
9
  stdin: boolean;
10
- /** Install the Claude skill. Default true; `--no-skill` opts out. */
10
+ /**
11
+ * Write the skill to PERSONAL scope. Default false — see {@link installSkill}.
12
+ * `--skill` opts in, for anyone who cannot use a plugin marketplace.
13
+ */
11
14
  skill: boolean;
12
15
  }
13
16
  export declare function runSetup(io: Io, env: NodeJS.ProcessEnv, options: SetupOptions, readStdin: () => Promise<string>,
@@ -1 +1 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/commands/setup.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAW,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EAA8B,KAAK,QAAQ,EAAE,KAAK,EAAE,EAAE,MAAM,cAAc,CAAC;AA4ClF,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,2FAA2F;IAC3F,KAAK,EAAE,OAAO,CAAC;IACf,2EAA2E;IAC3E,KAAK,EAAE,OAAO,CAAC;IACf,qEAAqE;IACrE,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,wBAAsB,QAAQ,CAC5B,EAAE,EAAE,EAAE,EACN,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,OAAO,EAAE,YAAY,EACrB,SAAS,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC;AAChC,2EAA2E;AAC3E,UAAU,CAAC,EAAE,SAAS,GACrB,OAAO,CAAC,QAAQ,CAAC,CAqDnB"}
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/commands/setup.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAW,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EAA8B,KAAK,QAAQ,EAAE,KAAK,EAAE,EAAE,MAAM,cAAc,CAAC;AA4ClF,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,2FAA2F;IAC3F,KAAK,EAAE,OAAO,CAAC;IACf,2EAA2E;IAC3E,KAAK,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,wBAAsB,QAAQ,CAC5B,EAAE,EAAE,EAAE,EACN,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,OAAO,EAAE,YAAY,EACrB,SAAS,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC;AAChC,2EAA2E;AAC3E,UAAU,CAAC,EAAE,SAAS,GACrB,OAAO,CAAC,QAAQ,CAAC,CAqDnB"}
@@ -72,7 +72,7 @@ verifyWith) {
72
72
  // secret which is not there yet is worse than no profile change at all.
73
73
  await storeSecret(token, target.secret);
74
74
  const wrote = await updateProfile(target.profile, shellBlock(org, project, target.secret));
75
- const skill = options.skill ? await installSkill(env) : "skipped";
75
+ const skill = options.skill ? await installSkill(env) : MARKETPLACE_HINT;
76
76
  // Prove it, rather than declaring success and letting them find out later.
77
77
  const checks = await verify(org, project, token, verifyWith);
78
78
  return emit(io, {
@@ -151,32 +151,33 @@ function shellBlock(org, project, secret) {
151
151
  ].join("\n");
152
152
  }
153
153
  // MARK: - The skill
154
+ /** What to tell somebody who did not pass `--skill`. */
155
+ const MARKETPLACE_HINT = "not installed — get it centrally, so corrections reach you without a CLI release:\n"
156
+ + " /plugin marketplace add ASNNetworks/floh-skills\n"
157
+ + " /plugin install pharos@floh-skills";
154
158
  /**
155
- * Install the Claude skill to **user scope**.
159
+ * Write the skill into PERSONAL scope — and why that is not the default.
156
160
  *
157
- * ## Why this ships with the tool instead of living in the repo
161
+ * ## The knowledge has to travel, and a repo does not carry it
158
162
  *
159
- * Because the knowledge has to be somewhere the reader can actually reach, and
160
- * a repo is not that place for anybody but its owner. Documentation in
161
- * `AGENTS.md` or a `docs/` folder is invisible to a teammate working in their
162
- * own checkout, and a setup guide is read once at install time and never again.
163
- * Neither survives into the session three weeks later where the decision
164
- * actually gets made.
163
+ * Documentation in the tool's own repository is invisible to a teammate working
164
+ * in their own checkout, and a setup guide is read once at install time and
165
+ * never again. Neither reaches the session weeks later where the decision
166
+ * actually gets made. A skill does: it loads in every session, in any
167
+ * directory, on that person's machine.
165
168
  *
166
- * A user-scope skill does: it loads in every session, in any directory, on that
167
- * person's machine. So it travels with the npm package and gets installed by
168
- * the same command that configures the token — one step, not a thing to
169
- * remember.
169
+ * ## But personal scope SHADOWS the plugin
170
170
  *
171
- * **What is in it is deliberately NOT the API traps.** Those are handled inside
172
- * this package and a caller cannot reach them; a second copy in prose would
173
- * only be a copy that can drift. What it carries is the part no code can: which
174
- * tool to reach for, what the exit codes oblige you to do, and the handful of
175
- * Azure DevOps facts that are architectural rather than fixable — a wiki is a
176
- * git repository, there is no wiki event, ancestors are not created for you.
171
+ * Claude Code resolves skills personal project plugin, so a copy written
172
+ * here **wins over the marketplace version**. Installing it by default would
173
+ * mean every future correction published to `floh-skills` silently does nothing
174
+ * for anybody who had run `pharos setup` the worst kind of failure, because
175
+ * the update looks like it worked.
177
176
  *
178
- * Overwritten on every run so an upgrade refreshes it. Failure is reported and
179
- * never fatal: not having the skill is a worse experience, not a broken setup.
177
+ * So the marketplace is the default route and this is the opt-in, for a machine
178
+ * that cannot use plugins. Overwrites on each run, so re-running after an
179
+ * upgrade refreshes it. A failure is reported and never fatal: no skill is a
180
+ * worse experience, not a broken setup.
180
181
  */
181
182
  async function installSkill(env) {
182
183
  const home = env["HOME"] ?? homedir();
@@ -1 +1 @@
1
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,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QACxD,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC1B,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YACzB,IAAI,IAAI,KAAK,CAAC;gBAAE,OAAO,EAAE,CAAC;;gBACrB,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,OAAO,WAAW,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,cAAc,CAAC,MAAsB;IAC5C,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU;QAC/B,CAAC,CAAC,4BAA4B,gBAAgB,IAAI;QAClD,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,aAAa,CAAC;AAClC,CAAC;AAED,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC;AAC7C,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { type WorkItem } from "@floh-solutions/ado-core";
2
+ import { type ExitCode, type Io } from "../output.js";
3
+ import type { Session } from "../session.js";
4
+ /**
5
+ * `pharos update <id>` — change a field, safely.
6
+ *
7
+ * **This verb is why the Azure DevOps MCP server can be removed.** The MCP was
8
+ * the only way to set a state or a priority from here, and it authenticates
9
+ * through the Azure CLI — which opens a browser, which makes any session that
10
+ * touches it non-autonomous. That was the whole cost.
11
+ *
12
+ * ## It is safer than the thing it replaces
13
+ *
14
+ * The MCP's patch op enum is `add | replace | remove`. There is no `test`, so
15
+ * **every MCP write is last-write-wins**: it cannot express "apply this only if
16
+ * the item is still at the revision I read". This reads the item, then applies
17
+ * the change under `test` on `/rev` (PLAN.md §9, and the reason `ado-core`
18
+ * exists at all). A teammate who wrote between the read and the write gets a
19
+ * `conflict` back rather than silently losing their edit.
20
+ *
21
+ * ## Why it is not behind `--yes`
22
+ *
23
+ * A field edit is an ordinary edit, like posting a comment — Azure DevOps keeps
24
+ * every revision, so nothing here is unrecoverable. Putting the most common verb
25
+ * on a board (moving a state when the work moves) behind a confirmation flag
26
+ * teaches people to pass `--yes` reflexively, which is how the flag stops
27
+ * meaning anything on the verbs where it matters. `--dry-run` is supported for
28
+ * when you want to look first.
29
+ */
30
+ export interface UpdateCommandOptions {
31
+ state: string | undefined;
32
+ priority: string | undefined;
33
+ assignee: string | undefined;
34
+ title: string | undefined;
35
+ /** `Name=value`, repeatable. The escape hatch for every other field. */
36
+ fields: readonly string[];
37
+ /** Pin the revision explicitly instead of reading it in this command. */
38
+ expectRev: number | undefined;
39
+ }
40
+ /**
41
+ * Named fields, and the reference names they actually are.
42
+ *
43
+ * Exported because `pharos create` reads the same map. One definition means
44
+ * `--state` cannot come to mean different things on the two verbs that both
45
+ * take it — and a session that has learned one has learned the other.
46
+ */
47
+ export declare const SHORTHAND: Record<string, string>;
48
+ export declare function runUpdate(io: Io, session: Session, positionals: readonly string[], options: UpdateCommandOptions): Promise<ExitCode>;
49
+ /** Exported for the attach command, which shares the id-parsing rule. */
50
+ export declare function workItemId(raw: string | undefined, usage: string): number;
51
+ export type { WorkItem };
52
+ //# sourceMappingURL=update.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAE5F,OAAO,EAAuC,KAAK,QAAQ,EAAE,KAAK,EAAE,EAAE,MAAM,cAAc,CAAC;AAC3F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,wEAAwE;IACxE,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,yEAAyE;IACzE,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAK5C,CAAC;AAEF,wBAAsB,SAAS,CAC7B,EAAE,EAAE,EAAE,EACN,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,SAAS,MAAM,EAAE,EAC9B,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,QAAQ,CAAC,CAuEnB;AAuHD,yEAAyE;AACzE,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAIzE;AAED,YAAY,EAAE,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,181 @@
1
+ import { setField } from "@floh-solutions/ado-core";
2
+ import { EXIT_OK, emit, emitText, usageError } from "../output.js";
3
+ /**
4
+ * Named fields, and the reference names they actually are.
5
+ *
6
+ * Exported because `pharos create` reads the same map. One definition means
7
+ * `--state` cannot come to mean different things on the two verbs that both
8
+ * take it — and a session that has learned one has learned the other.
9
+ */
10
+ export const SHORTHAND = {
11
+ state: "System.State",
12
+ priority: "Microsoft.VSTS.Common.Priority",
13
+ assignee: "System.AssignedTo",
14
+ title: "System.Title",
15
+ };
16
+ export async function runUpdate(io, session, positionals, options) {
17
+ const raw = positionals[0];
18
+ if (raw === undefined)
19
+ throw usageError("Which work item? `pharos update <id> --state Doing`.");
20
+ if (!/^\d+$/.test(raw))
21
+ throw usageError(`"${raw}" is not a work item id.`, { given: raw });
22
+ const id = Number(raw);
23
+ const wanted = collect(options);
24
+ if (wanted.size === 0) {
25
+ throw usageError("Nothing to change. Pass --state, --priority, --assignee, --title, or --field Name=value.", { fields: Object.keys(SHORTHAND) });
26
+ }
27
+ // Read first, for two reasons: the revision the write is guarded on, and the
28
+ // before-values. A diff nobody can see is a write nobody can check.
29
+ const before = await session.client.workItems.get(id);
30
+ // AFTER the read, because a state is only valid for a TYPE. Measured live and
31
+ // it is why this moved: `--state "In Progress"` passed a flat check — the
32
+ // project really does have that state, on Test Suite — and then 400'd,
33
+ // because #225 is a Task and a Task has To Do, Doing, Done. Checking against
34
+ // the whole project is the same guess the caller was making, one layer down.
35
+ await assertStateExists(session, options.state, before);
36
+ const rev = options.expectRev ?? before.rev;
37
+ if (rev === undefined) {
38
+ throw usageError(`Work item #${id} did not report a revision, so the write cannot be guarded. Pass `
39
+ + "--expect-rev to override.");
40
+ }
41
+ const changes = [...wanted].map(([field, value]) => ({
42
+ field,
43
+ from: readable(before.fields?.[field]),
44
+ to: value,
45
+ }));
46
+ // A change already applied is not a change. Worth saying rather than writing:
47
+ // a no-op PATCH still bumps System.Rev, which invalidates every other cached
48
+ // revision against this item for no reason at all.
49
+ const moving = changes.filter((change) => change.from !== change.to);
50
+ if (moving.length === 0) {
51
+ return emitOrText(io, session, {
52
+ applied: false,
53
+ id,
54
+ rev,
55
+ unchanged: true,
56
+ changes,
57
+ message: "Already set to that. Nothing was written.",
58
+ });
59
+ }
60
+ if (session.previewOnly) {
61
+ return emitOrText(io, session, { applied: false, dryRun: true, id, rev, changes: moving });
62
+ }
63
+ const ops = moving.map((change) => setField(change.field, change.to));
64
+ const after = await session.client.workItems.updateWithRev(id, rev, ops, {
65
+ suppressNotifications: true,
66
+ });
67
+ return emitOrText(io, session, {
68
+ applied: true,
69
+ id,
70
+ rev: after.rev,
71
+ previousRev: rev,
72
+ changes: moving,
73
+ });
74
+ }
75
+ /**
76
+ * Refuse a state **this item's type** does not have, with the list attached.
77
+ *
78
+ * Two things matter and both were learned the hard way on a live board.
79
+ *
80
+ * **WHERE.** Without this the write goes out, Azure DevOps answers 400 with a
81
+ * sentence about supported values, and a session that cannot see the list
82
+ * guesses again — the single biggest retry cause in this CLI.
83
+ *
84
+ * **AGAINST WHAT.** The first version checked the state against the whole
85
+ * project and was wrong in the most convincing way available: `--state "In
86
+ * Progress"` sailed through, because that state genuinely exists — on Test
87
+ * Suite — and then 400'd, because the item was a Task. A project-wide check is
88
+ * the caller's own guess with an extra call in front of it. States belong to
89
+ * types.
90
+ *
91
+ * A failure to READ the catalogue is not a failure to update: if the types call
92
+ * 403s this says nothing and the write proceeds on its own merits. A validator
93
+ * that can block a legitimate write when it is the validator that is broken is
94
+ * worse than no validator.
95
+ */
96
+ async function assertStateExists(session, state, item) {
97
+ if (state === undefined || state === "")
98
+ return;
99
+ const type = item.fields?.["System.WorkItemType"];
100
+ if (typeof type !== "string" || type === "")
101
+ return;
102
+ let states;
103
+ try {
104
+ const catalog = await session.client.workItemTypes.states();
105
+ const forType = catalog.byType.get(type);
106
+ if (forType === undefined)
107
+ return;
108
+ states = [...forType.open, ...forType.terminal];
109
+ }
110
+ catch {
111
+ return;
112
+ }
113
+ if (states.length === 0)
114
+ return;
115
+ if (states.some((candidate) => candidate.toLowerCase() === state.toLowerCase()))
116
+ return;
117
+ throw usageError(`A ${type} has no state called "${state}". Run \`pharos types --type ${type}\` — states `
118
+ + "belong to a work item type, so a state that exists elsewhere in the project is still "
119
+ + "not one this item can take.", { given: state, type, states: [...states].sort() });
120
+ }
121
+ /** The requested changes, shorthand and `--field` merged, later wins. */
122
+ function collect(options) {
123
+ const wanted = new Map();
124
+ for (const [flag, field] of Object.entries(SHORTHAND)) {
125
+ const value = options[flag];
126
+ if (typeof value === "string" && value !== "")
127
+ wanted.set(field, value);
128
+ }
129
+ for (const pair of options.fields) {
130
+ // Split on the FIRST `=` only: a value can legitimately contain one, and a
131
+ // reference name never does.
132
+ const at = pair.indexOf("=");
133
+ if (at <= 0) {
134
+ throw usageError(`--field wants Name=value, not "${pair}".`, {
135
+ example: "--field Microsoft.VSTS.Scheduling.RemainingWork=3",
136
+ });
137
+ }
138
+ wanted.set(pair.slice(0, at).trim(), pair.slice(at + 1));
139
+ }
140
+ return wanted;
141
+ }
142
+ /**
143
+ * A field's current value as a string, for the before/after.
144
+ *
145
+ * Identities come back as objects and numbers as numbers; comparing those to a
146
+ * command-line string without flattening would report every write as a change,
147
+ * including the ones that are not.
148
+ */
149
+ function readable(value) {
150
+ if (value === undefined || value === null)
151
+ return "";
152
+ if (typeof value === "object") {
153
+ const display = value.displayName;
154
+ if (typeof display === "string")
155
+ return display;
156
+ return JSON.stringify(value);
157
+ }
158
+ return String(value);
159
+ }
160
+ function emitOrText(io, session, result) {
161
+ if (!session.pretty)
162
+ return emit(io, result);
163
+ const lines = [`#${result.id} · rev ${result.rev ?? "?"}`];
164
+ for (const change of result.changes) {
165
+ lines.push(` ${change.field}: ${change.from === "" ? "(empty)" : change.from} → ${change.to}`);
166
+ }
167
+ if (result.applied === false) {
168
+ lines.push("", typeof result["message"] === "string" ? result["message"] : "Nothing written.");
169
+ }
170
+ emitText(io, lines.join("\n"));
171
+ return EXIT_OK;
172
+ }
173
+ /** Exported for the attach command, which shares the id-parsing rule. */
174
+ export function workItemId(raw, usage) {
175
+ if (raw === undefined)
176
+ throw usageError(usage);
177
+ if (!/^\d+$/.test(raw))
178
+ throw usageError(`"${raw}" is not a work item id.`, { given: raw });
179
+ return Number(raw);
180
+ }
181
+ //# sourceMappingURL=update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA0C,MAAM,0BAA0B,CAAC;AAE5F,OAAO,EAAE,OAAO,EAAE,IAAI,EA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KAAK,SAAS;QAAE,MAAM,UAAU,CAAC,KAAK,CAAC,CAAC;IAC/C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,MAAM,UAAU,CAAC,IAAI,GAAG,0BAA0B,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5F,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"wiki.d.ts","sourceRoot":"","sources":["../../src/commands/wiki.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,QAAQ,EAAE,KAAK,EAAE,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAW,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAEtD;;;;;;;;;;;;;GAaG;AAEH,wBAAsB,OAAO,CAC3B,EAAE,EAAE,EAAE,EACN,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,SAAS,MAAM,EAAE,EAC9B,KAAK,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GACtC,OAAO,CAAC,QAAQ,CAAC,CAoBnB"}
1
+ {"version":3,"file":"wiki.d.ts","sourceRoot":"","sources":["../../src/commands/wiki.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,QAAQ,EAAE,KAAK,EAAE,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAW,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAEtD;;;;;;;;;;;;;GAaG;AAEH,wBAAsB,OAAO,CAC3B,EAAE,EAAE,EAAE,EACN,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,SAAS,MAAM,EAAE,EAC9B,KAAK,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GACtC,OAAO,CAAC,QAAQ,CAAC,CA+BnB"}