qatools-cli 1.2.20 → 1.2.22

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/context-sync.js CHANGED
@@ -95,13 +95,17 @@ function requestsIntegrationPrompt(projectName) {
95
95
  " identifies a request, so sending all of them every time is fine — it updates, it does not duplicate;",
96
96
  " - reads the status of the same ids: action \"status\", at most 500 per call;",
97
97
  " - stores each status on the app's own request record (e.g. a field qaStatus).",
98
+ " To show the team's replies (and let users comment), read them with action comments and send users' comments with",
99
+ " action comment — both take the app's own request id, also for synced requests.",
98
100
  "4. Show the status on the request page, in the app's language, with the votes: new → received; accepted → accepted",
99
101
  " (it is linked to a requirement); planned → the release name and its planned date (releaseDate); released →",
100
102
  " released; declined → declined with the reason (members write it for the users).",
101
103
  "5. Verify it yourself before you say it works: (A) run the job once, or (B) create a request and vote through your",
102
104
  " own routes; then `qatools feature-requests` must list the requests with their votes, and the app must show",
103
- " status \"new\". Report what you saw. The user then links one request to a planned requirement in qa-tools; after",
104
- " that (and the next sync for A) its status must be \"planned\" with the release and date.",
105
+ " status \"new\". Then link one request to a requirement in a sprint yourself: `qatools feature-request-link --id",
106
+ " <app id> --requirement <key>`; after that (and the next sync for A) the app must show \"planned\" with the release",
107
+ " and date. Unless the link is right, undo it: `qatools feature-request-unlink --id <app id>`. Report what you saw.",
108
+ " Declining (`qatools feature-request-decline --id <id> --reason \"…\"`) is a member's decision — never do it yourself.",
105
109
  "6. If the app's requirements in qa-tools do not cover the request page or this sync, say so — the user decides",
106
110
  " whether to add requirements.",
107
111
  "",
@@ -129,8 +133,8 @@ function requestsIntegrationPrompt(projectName) {
129
133
  ' { "action": "comment", "userId": "u2", "userName": "Anna", "id": "qa-…", "text": "…" }',
130
134
  ' { "action": "comments", "id": "qa-…" } → { "comments": [ { "author": "Anna", "team": false, "text": "…", "at": "…" },',
131
135
  ' { "author": "team", "team": true, "text": "…", "at": "…" } ] }',
132
- " Replies from the project's members come back with author \"team\". Votes on requests the app syncs itself (A) are",
133
- " refused (409) — their votes come from the app.",
136
+ " Replies from the project's members come back with author \"team\". comment and comments also work for requests the",
137
+ " app syncs itself (A), with the app's own id. Votes on synced requests are refused (409) — their votes come from the app.",
134
138
  "",
135
139
  "Errors: 401 missing key, 403 wrong or revoked key, 400 bad body (e.g. no userId, no title, title over 300",
136
140
  "characters), 404 unknown request, 409 vote on a synced request, 429 more than 600 calls a minute from one server.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qatools-cli",
3
- "version": "1.2.20",
3
+ "version": "1.2.22",
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
@@ -101,12 +101,19 @@ function getCredentials() {
101
101
  return envKeyProject ? { ...(creds || {}), ...envKeyProject } : creds;
102
102
  }
103
103
 
104
- async function authenticate(options) {
104
+ // asMember: a member's decision (e.g. declining a user's request) — never as Claude's API key, even when one is stored.
105
+ // Explicit -e/-p always win over a stored key: they say who you want to be.
106
+ async function authenticate(options, { asMember = false } = {}) {
105
107
  const creds = getCredentials();
106
108
  const email = options.email || creds?.email;
107
109
  const password = options.password || creds?.password;
108
110
  const refreshToken = creds?.refreshToken;
109
- const apiKey = process.env.QATOOLS_API_KEY || creds?.apiKey;
111
+ const explicitLogin = !!(options.email && options.password);
112
+ const apiKey = asMember || explicitLogin ? null : (process.env.QATOOLS_API_KEY || creds?.apiKey);
113
+ if (asMember && !explicitLogin && !refreshToken && !(email && password)) {
114
+ console.error("This is a member's decision, so it needs your own login, not Claude's API key. Run: qatools login --google (your API key stays as it is)");
115
+ process.exit(1);
116
+ }
110
117
 
111
118
  if (apiKey) {
112
119
  try {
@@ -138,7 +145,7 @@ async function authenticate(options) {
138
145
  }
139
146
  }
140
147
 
141
- if (refreshToken) {
148
+ if (refreshToken && !explicitLogin) {
142
149
  try {
143
150
  // Exchange refresh token for a new ID token
144
151
  const res = await fetch(`https://securetoken.googleapis.com/v1/token?key=${firebaseConfig.apiKey}`, {
@@ -905,7 +912,8 @@ program
905
912
  if (!requests.length) { console.log("No requests from users yet. Connect the app: qatools requests-integration-prompt"); process.exit(0); }
906
913
  console.log(`${requests.length} request(s):\n`);
907
914
  for (const r of requests) {
908
- console.log(` ▲ ${String(r.votes || 0).padStart(4)} [${r.state}] ${r.title} (app id ${r.externalId}${r.requirementId ? `, requirement ${r.requirementId}` : ""})`);
915
+ const where = r.status === "planned" ? ` → ${r.sprint} (${r.releaseDate})` : r.status === "declined" && r.reason ? ` — "${r.reason}"` : "";
916
+ console.log(` ▲ ${String(r.votes || 0).padStart(4)} ${r.status.padEnd(8)} ${r.title} (id ${r.externalId}${r.requirementKey ? `, requirement ${r.requirementKey}` : ""})${where}`);
909
917
  }
910
918
  process.exit(0);
911
919
  } catch (e) {
@@ -914,6 +922,62 @@ program
914
922
  }
915
923
  });
916
924
 
925
+ // signals.feature-requests-cli: act on a request from the terminal — a request by the app's id, a requirement by its key
926
+ async function decideRequestFromCli(options, action, extra) {
927
+ // AVV-15: declining is a member's decision — use the member's own login even where Claude's key is stored
928
+ await authenticate(options, { asMember: action === "decline" });
929
+ const projectId = options.project || getCredentials()?.projectId;
930
+ if (!projectId) { console.error("No project configured. Run: qatools setup, or pass --project <id>"); process.exit(1); }
931
+ try {
932
+ const { data } = await httpsCallable(functions, "decideFeatureRequest")({ projectId, externalId: String(options.id), action, ...extra });
933
+ return data;
934
+ } catch (e) {
935
+ console.error(e.message);
936
+ process.exit(1);
937
+ }
938
+ }
939
+
940
+ program
941
+ .command("feature-request-link")
942
+ .description("Link a request from the app's users to a requirement; the app then shows it as accepted, or planned when the requirement is in a sprint")
943
+ .requiredOption("--id <id>", "The request's id in the app")
944
+ .requiredOption("--requirement <key>", "Requirement key, e.g. reports.export")
945
+ .option("--project <id>", "Target project ID (overrides default)")
946
+ .option("-e, --email <email>", "Login email")
947
+ .option("-p, --password <password>", "Login password")
948
+ .action(async (options) => {
949
+ await decideRequestFromCli(options, "link", { requirementKey: options.requirement });
950
+ console.log(`✓ Request ${options.id} linked to ${options.requirement}. Its status for the app: qatools feature-requests`);
951
+ process.exit(0);
952
+ });
953
+
954
+ program
955
+ .command("feature-request-unlink")
956
+ .description("Undo a link: the request is no longer linked to a requirement")
957
+ .requiredOption("--id <id>", "The request's id in the app")
958
+ .option("--project <id>", "Target project ID (overrides default)")
959
+ .option("-e, --email <email>", "Login email")
960
+ .option("-p, --password <password>", "Login password")
961
+ .action(async (options) => {
962
+ const res = await decideRequestFromCli(options, "unlink", {});
963
+ console.log(`✓ Request ${options.id} unlinked (status: ${res.state}).`);
964
+ process.exit(0);
965
+ });
966
+
967
+ program
968
+ .command("feature-request-decline")
969
+ .description("Decline a request with a reason the app shows to its users. A member's decision: refused for Claude's API key.")
970
+ .requiredOption("--id <id>", "The request's id in the app")
971
+ .requiredOption("--reason <text>", "Why — shown to the app's users")
972
+ .option("--project <id>", "Target project ID (overrides default)")
973
+ .option("-e, --email <email>", "Login email")
974
+ .option("-p, --password <password>", "Login password")
975
+ .action(async (options) => {
976
+ await decideRequestFromCli(options, "decline", { reason: options.reason });
977
+ console.log(`✓ Request ${options.id} declined.`);
978
+ process.exit(0);
979
+ });
980
+
917
981
  // requirements.baseline-from-code: reconstruct requirements for what is already built
918
982
  program
919
983
  .command("baseline-prompt")
@@ -4204,10 +4268,22 @@ const mcpTools = [
4204
4268
  },
4205
4269
  {
4206
4270
  name: "list_feature_requests",
4207
- description: "Requests from the app's users (signals.user-feature-requests), most votes first: title, votes, state (new / linked / declined) and the linked requirementId. Linked requirements also carry requestVotes in list_requirements. Members act on them in the web app.",
4271
+ description: "Requests from the app's users (signals.user-feature-requests), most votes first: title, votes, status as the app sees it (new / accepted / planned / released / declined), requirementKey, sprint and releaseDate. Link or unlink with link_feature_request / unlink_feature_request; declining is a member's decision (web app or CLI with a member login).",
4208
4272
  inputSchema: mcpSchema(),
4209
4273
  run: async (a) => (await mcpCall("listFeatureRequests", { projectId: a.projectId })).requests,
4210
4274
  },
4275
+ {
4276
+ name: "link_feature_request",
4277
+ description: "Link a request from the app's users to a requirement (signals.feature-requests-cli). The app then shows it as accepted, or planned with the release and date when the requirement is in a sprint — so link only where the requirement really covers the request.",
4278
+ inputSchema: mcpSchema({ id: mcpStr("The request's id in the app (externalId)"), requirementKey: mcpStr("Requirement key, e.g. reports.export") }, ["id", "requirementKey"]),
4279
+ run: async (a) => mcpCall("decideFeatureRequest", { projectId: a.projectId, externalId: a.id, action: "link", requirementKey: a.requirementKey }),
4280
+ },
4281
+ {
4282
+ name: "unlink_feature_request",
4283
+ description: "Undo a link between a request from the app's users and a requirement.",
4284
+ inputSchema: mcpSchema({ id: mcpStr("The request's id in the app (externalId)") }, ["id"]),
4285
+ run: async (a) => mcpCall("decideFeatureRequest", { projectId: a.projectId, externalId: a.id, action: "unlink" }),
4286
+ },
4211
4287
  {
4212
4288
  name: "requests_integration_prompt",
4213
4289
  description: "Procedure, API and example code for connecting this app's own feature-request page to qa-tools: requests and votes in, status (planned / released / declined) back to the app. Use when the app has a page where users request features or vote.",