qatools-cli 1.3.1 → 1.3.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.
Files changed (4) hide show
  1. package/brief.js +9 -1
  2. package/mcp-core.js +1208 -1156
  3. package/package.json +1 -1
  4. package/qatools.js +20 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qatools-cli",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "CLI for QA Tools — requirements, epics, sprints, sessions, App Context sync, project agenda. The companion to qa-tools.com.",
5
5
  "scripts": {
6
6
  "release": "npm version patch --no-git-tag-version && npm publish",
package/qatools.js CHANGED
@@ -724,11 +724,18 @@ async function latestPublishedVersion() {
724
724
  if (c.latest && Date.now() - c.checkedAt < 3600 * 1000) return c.latest; // cli.self-upgrade: a new version is noticed within the hour
725
725
  } catch {}
726
726
  try {
727
- const ctrl = new AbortController();
728
- const timer = setTimeout(() => ctrl.abort(), 2000);
729
- const res = await fetch(process.env.QATOOLS_UPDATE_URL || "https://registry.npmjs.org/qatools-cli/latest", { signal: ctrl.signal });
730
- clearTimeout(timer);
731
- const latest = (await res.json()).version;
727
+ // Not fetch: its keep-alive socket can still be closing when a command calls process.exit, and on Windows libuv
728
+ // then aborts ("Assertion failed: !(handle->flags & UV_HANDLE_CLOSING)", exit 0xC0000409). agent:false closes
729
+ // the connection with the response.
730
+ const url = new URL(process.env.QATOOLS_UPDATE_URL || "https://registry.npmjs.org/qatools-cli/latest");
731
+ const body = await new Promise((resolve, reject) => {
732
+ const req = require(url.protocol === "http:" ? "http" : "https").get(url, { agent: false, headers: { accept: "application/json" } }, (res) => {
733
+ let s = ""; res.setEncoding("utf8"); res.on("data", d => s += d); res.on("end", () => resolve(s)); res.on("error", reject);
734
+ });
735
+ req.setTimeout(2000, () => req.destroy(new Error("timeout")));
736
+ req.on("error", reject);
737
+ });
738
+ const latest = JSON.parse(body).version;
732
739
  if (latest) try { fs.writeFileSync(file, JSON.stringify({ checkedAt: Date.now(), latest })); } catch {}
733
740
  return latest || null;
734
741
  } catch { return null; }
@@ -1696,7 +1703,7 @@ async function briefText({ projectId, projectName = "", cwd = process.cwd() }) {
1696
1703
  const { renderBrief } = require("./brief");
1697
1704
  const warnings = await staleWarnings().catch(() => []); // cli.self-upgrade: the session sees it first thing
1698
1705
  return renderBrief({ projectName, requirements, agenda: agendaRes?.agenda || null,
1699
- requests: reqsRes?.requests || [], branch, main, branchKeys, warnings, scheduledRuns: agendaRes?.scheduledRuns || null });
1706
+ requests: reqsRes?.requests || [], branch, main, branchKeys, warnings, scheduledRuns: agendaRes?.scheduledRuns || null, approvalPolicy: agendaRes?.approvalPolicy || "" });
1700
1707
  }
1701
1708
 
1702
1709
  program
@@ -2776,8 +2783,11 @@ program
2776
2783
  .option("--title <text>", "Set title")
2777
2784
  .option("--description <text>", "Set description")
2778
2785
  .option("--ac <text>", "Set acceptance criteria")
2786
+ .option("--negative <text>", "Set negative criteria (what must not happen)")
2779
2787
  .option("--points <n>", "Set size in points: 1, 2, 3, 5 or 8 (empty string clears). Not for non-functional requirements.")
2780
- .option("--reason <text>", "REQUIRED when status=rejected: why it is rejected (min 5 chars), kept with the requirement")
2788
+ .option("--reason <text>", "REQUIRED when status=rejected: why it is rejected (min 5 chars), kept with the requirement. With status=approved by an agent itself (where the project allows it): why")
2789
+ .option("--on-behalf-of <email>", "status=approved because this member said so in the conversation (approvals.in-conversation); needs --quote")
2790
+ .option("--quote <text>", "The member's own words approving it, verbatim")
2781
2791
  .option("--project <id>", "Target project ID (overrides default; requires access to that project)")
2782
2792
  .option("-e, --email <email>", "Login email")
2783
2793
  .option("-p, --password <password>", "Login password")
@@ -2806,6 +2816,7 @@ program
2806
2816
  if (options.title) u.title = options.title;
2807
2817
  if (options.description) u.description = options.description;
2808
2818
  if (options.ac) u.acceptanceCriteria = options.ac;
2819
+ if (options.negative) u.negativeCriteria = options.negative;
2809
2820
  if (options.points !== undefined) u.points = options.points === "" ? null : Number(options.points);
2810
2821
  updates[options.id] = u;
2811
2822
  if (options.evidence) evidenceById[options.id] = options.evidence;
@@ -2858,6 +2869,8 @@ program
2858
2869
  payload.attachments = await uploadEvidenceFiles(projectId, options.attach);
2859
2870
  }
2860
2871
  if (reasonById[requirementId]) payload.reason = reasonById[requirementId];
2872
+ if (options.onBehalfOf) payload.onBehalfOf = options.onBehalfOf;
2873
+ if (options.quote) payload.quote = options.quote;
2861
2874
  if (evidenceById[requirementId]) {
2862
2875
  payload.evidence = evidenceById[requirementId];
2863
2876
  const commit = options.commit === false ? null : (typeof options.commit === "string" ? options.commit : currentGitCommit());