qatools-cli 1.2.29 → 1.2.31

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
@@ -56,6 +56,7 @@ function renderToolsSection() {
56
56
  "### qa-tools tools for this project",
57
57
  "- Code exists that no requirement covers (built before qa-tools, or on the side): `qatools baseline-prompt` — reconstruct requirements from the code; a member approves them as built.",
58
58
  "- Users should be able to request features and vote (whether or not the app already has a page for it): `qatools requests-integration-prompt` — requests, votes and comments reach qa-tools and their status (accepted / planned / released / declined) goes back to the app. See what has arrived: `qatools feature-requests`.",
59
+ "- The app runs on Azure, Google Cloud, AWS or Firebase and its resources are not set up yet: `qatools infra-prompt` — take stock, propose a plan, infrastructure code, applied only after the user approves.",
59
60
  "- A release is done: `qatools release-notes-prompt` — draft release notes for the app's users (only what they notice, no technical details), save with `qatools release-notes-draft`; a member publishes them.",
60
61
  "- Something more important must go into a sprint in progress: propose a swap (MCP `propose_sprint_plan` swaps) instead of overfilling it; a member approves.",
61
62
  "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qatools-cli",
3
- "version": "1.2.29",
3
+ "version": "1.2.31",
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",
@@ -17,7 +17,8 @@
17
17
  "hooks.js",
18
18
  "brief.js",
19
19
  "secrets.js",
20
- "agents.js"
20
+ "agents.js",
21
+ "vault.js"
21
22
  ],
22
23
  "keywords": [
23
24
  "qa",
package/qatools.js CHANGED
@@ -1093,6 +1093,50 @@ program
1093
1093
  process.exit(0);
1094
1094
  });
1095
1095
 
1096
+ // signals.feature-request-key-to-vault: the owner creates the app's feature-request key and stores it in their own
1097
+ // vault — the key is never shown or copied
1098
+ program
1099
+ .command("feature-request-key")
1100
+ .description("Create (--rotate) or revoke (--revoke) the project's feature-request key — the owner's own login. With --vault the new key goes straight into your secret vault and is never shown.")
1101
+ .option("--rotate", "Create a new key; the old one stops working")
1102
+ .option("--revoke", "Revoke the key; the app can no longer send requests")
1103
+ .option("--vault <command>", "Run this command with {key} replaced by the new key, e.g. az keyvault secret set --vault-name my-kv --name QATOOLS-FEATURE-REQUEST-KEY --value {key}")
1104
+ .option("--project <id>", "Target project ID (overrides default)")
1105
+ .option("-e, --email <email>", "Login email")
1106
+ .option("-p, --password <password>", "Login password")
1107
+ .action(async (options) => {
1108
+ const { vaultCommand, runVault, describeVault } = require("./vault");
1109
+ if (!!options.rotate === !!options.revoke) { console.error("Give exactly one of --rotate or --revoke"); process.exit(1); }
1110
+ if (options.vault && options.revoke) { console.error("--vault goes with --rotate"); process.exit(1); }
1111
+ // Refuse a bad vault command before a key is created and the old one stops working
1112
+ if (options.vault) { try { vaultCommand(options.vault, "fr-check"); } catch (e) { console.error(e.message); process.exit(1); } }
1113
+ await authenticate(options, { asMember: true });
1114
+ const projectId = options.project || getCredentials()?.projectId;
1115
+ if (!projectId) { console.error("No project configured. Run: qatools setup, or pass --project <id>"); process.exit(1); }
1116
+ let key;
1117
+ try {
1118
+ ({ data: { key } } = await httpsCallable(functions, "generateFeatureRequestKey")({ projectId, revoke: !!options.revoke }));
1119
+ } catch (e) {
1120
+ console.error("Failed:", e.message);
1121
+ process.exit(1);
1122
+ }
1123
+ if (options.revoke) { console.log("✓ The feature-request key is revoked — the app can no longer send requests."); process.exit(0); }
1124
+ if (!options.vault) {
1125
+ console.log(`New feature-request key (shown only this once — the old one no longer works):\n${key}`);
1126
+ process.exit(0);
1127
+ }
1128
+ const res = await runVault(options.vault, key);
1129
+ if (!res.ok) {
1130
+ console.error(`✗ The vault command failed (exit ${res.code}): ${describeVault(options.vault)}`);
1131
+ if (res.stderr) console.error(res.stderr);
1132
+ console.error(`The old key no longer works. The new key, so the app is not left without one — store it yourself:\n${key}`);
1133
+ process.exit(1);
1134
+ }
1135
+ console.log(`✓ New feature-request key (…${key.slice(-4)}) stored with: ${describeVault(options.vault)}`);
1136
+ console.log(" The old key no longer works — restart or redeploy the app if it reads the key at startup.");
1137
+ process.exit(0);
1138
+ });
1139
+
1096
1140
  // releases.release-notes: release notes for the app's users — Claude drafts, a member publishes in the sprint view
1097
1141
  program
1098
1142
  .command("release-notes-prompt")
@@ -1140,6 +1184,28 @@ program
1140
1184
  }
1141
1185
  });
1142
1186
 
1187
+ // projects.infra-setup-prompt: set up or configure the app's cloud resources with the user's own cloud CLI login
1188
+ program
1189
+ .command("infra-prompt")
1190
+ .description("Print the procedure for setting up the app's cloud resources (Azure, Google Cloud, AWS, Firebase) as infrastructure code, approved by you before anything is created")
1191
+ .option("--platform <name>", "azure, gcp, aws or firebase (default: from the App Context's stack)")
1192
+ .option("--project <id>", "Target project ID (overrides default)")
1193
+ .option("-e, --email <email>", "Login email")
1194
+ .option("-p, --password <password>", "Login password")
1195
+ .action(async (options) => {
1196
+ await authenticate(options);
1197
+ const projectId = options.project || getCredentials()?.projectId;
1198
+ if (!projectId) { console.error("No project configured. Run: qatools setup, or pass --project <id>"); process.exit(1); }
1199
+ try {
1200
+ const { data } = await httpsCallable(functions, "getInfraPrompt")({ projectId, platform: options.platform || "" });
1201
+ console.log(data.prompt);
1202
+ process.exit(0);
1203
+ } catch (e) {
1204
+ console.error("Failed to get the infrastructure prompt:", e.message);
1205
+ process.exit(1);
1206
+ }
1207
+ });
1208
+
1143
1209
  // requirements.baseline-from-code: reconstruct requirements for what is already built
1144
1210
  program
1145
1211
  .command("baseline-prompt")
@@ -4561,6 +4627,12 @@ const mcpTools = [
4561
4627
  inputSchema: mcpSchema({ sprintId: mcpStr("The release: sprint id or name"), text: mcpStr("The notes: short points in the users' language") }, ["sprintId", "text"]),
4562
4628
  run: async (a) => mcpCall("saveReleaseNotesDraft", { projectId: a.projectId, sprintId: a.sprintId, text: a.text }),
4563
4629
  },
4630
+ {
4631
+ name: "infra_prompt",
4632
+ description: "Procedure for setting up or configuring the app's cloud resources (projects.infra-setup-prompt): take stock with the user's own cloud CLI, propose a plan, write infrastructure code, apply only after the user approves, secrets only in the vault, environments into the App Context.",
4633
+ inputSchema: mcpSchema({ platform: mcpStr("azure, gcp, aws or firebase (default: from the App Context)", { enum: ["azure", "gcp", "aws", "firebase"] }) }),
4634
+ run: async (a) => (await mcpCall("getInfraPrompt", { projectId: a.projectId, platform: a.platform || "" })).prompt,
4635
+ },
4564
4636
  {
4565
4637
  name: "baseline_prompt",
4566
4638
  description: "Procedure for reconstructing requirements for what is already built (requirements.baseline-from-code), with the project's language, its epics and all existing requirements. Use when code exists that qa-tools has no requirements for.",
package/vault.js ADDED
@@ -0,0 +1,30 @@
1
+ // signals.feature-request-key-to-vault: store a newly created key in the owner's own secret vault by running
2
+ // their command with {key} replaced — the key is never printed, and any trace of it in error output is masked.
3
+ const { spawn } = require("child_process");
4
+
5
+ // Keys are letters, digits, '-' and '_' only, so putting one into a shell command cannot change the command
6
+ function vaultCommand(template, key) {
7
+ if (!String(template || "").includes("{key}")) throw new Error("The --vault command must contain {key} where the new key goes");
8
+ if (!/^[A-Za-z0-9_-]+$/.test(String(key || ""))) throw new Error("Unexpected key format — not passed to a shell");
9
+ return template.split("{key}").join(key);
10
+ }
11
+
12
+ const maskKey = (text, key) => String(text || "").split(key).join(`•••${key.slice(-4)}`);
13
+
14
+ // Runs the command; its output is kept from the screen (vault CLIs often echo the secret back)
15
+ function runVault(template, key, { run = spawn } = {}) {
16
+ const command = vaultCommand(template, key);
17
+ return new Promise((resolve) => {
18
+ let stderr = "";
19
+ const child = run(command, { shell: true, stdio: ["ignore", "pipe", "pipe"], windowsHide: true });
20
+ child.stdout?.on("data", () => {});
21
+ child.stderr?.on("data", (d) => { stderr += d; });
22
+ child.on("error", (e) => resolve({ ok: false, code: -1, stderr: maskKey(e.message, key) }));
23
+ child.on("close", (code) => resolve({ ok: code === 0, code, stderr: maskKey(stderr, key).trim() }));
24
+ });
25
+ }
26
+
27
+ // What the CLI shows about the command: the template, never the key
28
+ const describeVault = (template) => String(template).replace(/\s+/g, " ").trim();
29
+
30
+ module.exports = { vaultCommand, maskKey, runVault, describeVault };