qatools-cli 1.2.33 → 1.2.35

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 (2) hide show
  1. package/package.json +1 -1
  2. package/qatools.js +63 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qatools-cli",
3
- "version": "1.2.33",
3
+ "version": "1.2.35",
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
@@ -962,7 +962,8 @@ program
962
962
 
963
963
  program
964
964
  .command("setup")
965
- .description("Select default project (login first with 'qatools login')")
965
+ .description("Select default project (login first with 'qatools login'). With --project the project is chosen without a prompt, so Claude can run it")
966
+ .option("--project <id>", "Project ID to select without a prompt")
966
967
  .option("-e, --email <email>", "Login email")
967
968
  .option("-p, --password <password>", "Login password")
968
969
  .action(async (options) => {
@@ -978,22 +979,32 @@ program
978
979
  process.exit(1);
979
980
  }
980
981
 
981
- console.log("Your projects:");
982
- projects.forEach((p, i) => console.log(` ${i + 1}. ${p.name} ${p.claudeEnabled ? '🤖' : ''} (${p.id})`));
983
-
984
- // Use readline for selection
985
- const readline = require("readline");
986
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
987
- const answer = await new Promise(resolve => rl.question(`\nSelect project (1-${projects.length}): `, resolve));
988
- rl.close();
989
-
990
- const idx = parseInt(answer, 10) - 1;
991
- if (idx < 0 || idx >= projects.length) {
992
- console.error("Invalid selection.");
993
- process.exit(1);
982
+ let selected;
983
+ if (options.project) {
984
+ // projects.existing-repo-start: no prompt, so a Claude session can select the project itself
985
+ selected = projects.find(p => p.id === options.project);
986
+ if (!selected) {
987
+ console.error(`Project ${options.project} is not one of yours. Your projects:`);
988
+ projects.forEach(p => console.error(` ${p.name} (${p.id})`));
989
+ process.exit(1);
990
+ }
991
+ } else {
992
+ console.log("Your projects:");
993
+ projects.forEach((p, i) => console.log(` ${i + 1}. ${p.name} ${p.claudeEnabled ? '🤖' : ''} (${p.id})`));
994
+
995
+ // Use readline for selection
996
+ const readline = require("readline");
997
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
998
+ const answer = await new Promise(resolve => rl.question(`\nSelect project (1-${projects.length}): `, resolve));
999
+ rl.close();
1000
+
1001
+ const idx = parseInt(answer, 10) - 1;
1002
+ if (idx < 0 || idx >= projects.length) {
1003
+ console.error("Invalid selection.");
1004
+ process.exit(1);
1005
+ }
1006
+ selected = projects[idx];
994
1007
  }
995
-
996
- const selected = projects[idx];
997
1008
  const configPath = path.join(process.env.HOME || process.env.USERPROFILE, ".qatools");
998
1009
  // Preserve existing credentials
999
1010
  let existing = {};
@@ -1872,6 +1883,33 @@ program
1872
1883
  process.exit(0);
1873
1884
  });
1874
1885
 
1886
+ program
1887
+ .command("context-propose")
1888
+ .description("Propose the App Context from a JSON file (e.g. read from an existing repo). It counts only when a member approves it in the web app: Requirements → App Context")
1889
+ .requiredOption("-f, --file <path>", "JSON with App Context fields (shape: qatools context-template)")
1890
+ .option("--summary <text>", "What the proposal is based on")
1891
+ .option("--project <id>", "Target project ID (overrides default)")
1892
+ .option("-e, --email <email>", "Login email")
1893
+ .option("-p, --password <password>", "Login password")
1894
+ .action(async (options) => {
1895
+ await authenticate(options);
1896
+ const projectId = options.project || getCredentials()?.projectId;
1897
+ if (!projectId) { console.error("No project configured. Run: qatools setup, or pass --project <id>"); process.exit(1); }
1898
+ let context;
1899
+ try { context = JSON.parse(fs.readFileSync(options.file, "utf8")); }
1900
+ catch (e) { console.error(`Could not read ${options.file}: ${e.message}`); process.exit(1); }
1901
+ for (const k of ["id", "projectId", "name", "aiRules", "sections", "skills", "createdAt", "updatedAt"]) delete context[k];
1902
+ try {
1903
+ const { data } = await httpsCallable(functions, "proposeAppContext")({ projectId, context, summary: options.summary || "" });
1904
+ console.log(`Proposed App Context (${data.fields.join(", ")})${data.superseded ? ` — replaces ${data.superseded} earlier pending proposal(s)` : ""}.`);
1905
+ console.log("A project member approves or rejects it in qa-tools: Requirements → App Context.");
1906
+ } catch (e) {
1907
+ console.error("Failed:", e.message);
1908
+ process.exit(1);
1909
+ }
1910
+ process.exit(0);
1911
+ });
1912
+
1875
1913
  program
1876
1914
  .command("plan-reject")
1877
1915
  .description("Reject (withdraw) a pending sprint-plan proposal — nothing gets planned. Approving is done in the web app only.")
@@ -4478,6 +4516,15 @@ const mcpTools = [
4478
4516
  }, ["subject", "message"]),
4479
4517
  run: async (a) => mcpCall("notifyUser", { projectId: a.projectId, to: "owner", subject: a.subject, message: a.message }),
4480
4518
  },
4519
+ {
4520
+ name: "propose_app_context",
4521
+ description: "Propose the project's App Context (purpose, domainObjects, actors, stack, architecture, security, constraints, conventions, environments, integrations), e.g. read from an existing repo. Only what the code shows. It counts only when a member approves it in the web app; a newer proposal replaces a pending older one.",
4522
+ inputSchema: mcpSchema({
4523
+ context: { type: "object", description: "App Context fields, shape as qatools context-template (stack: [{layer, technology, version, notes}], conventions: [{area, rule}], environments: [{name, url, notes}], integrations: [{name, purpose}], domainObjects/actors/constraints: string arrays)" },
4524
+ summary: mcpStr("What the proposal is based on (files read)"),
4525
+ }, ["context"]),
4526
+ run: async (a) => mcpCall("proposeAppContext", { projectId: a.projectId, context: a.context, summary: a.summary || "" }),
4527
+ },
4481
4528
  {
4482
4529
  name: "reject_plan_proposal",
4483
4530
  description: "Reject (withdraw) a pending sprint-plan proposal, e.g. one you created that is superseded. Nothing gets planned. There is no approve tool: approval is a human decision in the qa-tools web app.",