qatools-cli 1.2.43 → 1.2.45

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/own-login.js CHANGED
@@ -20,7 +20,7 @@ function findProjectMarker(cwd = process.cwd()) {
20
20
  const f = path.join(dir, MARKER);
21
21
  try {
22
22
  const m = JSON.parse(fs.readFileSync(f, "utf8"));
23
- if (m && typeof m.projectId === "string" && m.projectId) return { projectId: m.projectId, projectName: m.projectName || "", dir };
23
+ if (m && typeof m.projectId === "string" && m.projectId) return { projectId: m.projectId, projectName: m.projectName || "", agents: Array.isArray(m.agents) ? m.agents : [], dir };
24
24
  } catch {}
25
25
  const up = path.dirname(dir);
26
26
  if (up === dir) return null;
@@ -37,20 +37,25 @@ function readProjectLogin(projectId, home = os.homedir()) {
37
37
 
38
38
  // Which login a qatools process should use:
39
39
  // { use: "own" } — the person's own (~/.qatools) as before
40
- // { use: "project", creds } — Claude, in a marked repo, with the project's own login
41
- // { use: "refuse", message } — Claude in a marked repo without its own login: never the person's
42
- // An explicit QATOOLS_API_KEY always wins (scheduled runs, CI).
40
+ // { use: "project", creds, agent } — an AI agent, in a marked repo, with the project's own login
41
+ // { use: "refuse", message } — an agent in a marked repo without its own login: never the person's
42
+ // An explicit QATOOLS_API_KEY always wins (scheduled runs, CI). The agent is Claude Code, Codex or Copilot
43
+ // (agents.any-coding-agent); QATOOLS_PROJECT names the project when there is no marker to find (an MCP server
44
+ // started outside the repo).
43
45
  function chooseLogin({ env = process.env, cwd = process.cwd(), home = os.homedir() } = {}) {
44
46
  if (env.QATOOLS_API_KEY) return { use: "own" };
45
- if (env.CLAUDECODE !== "1") return { use: "own" };
46
- const marker = findProjectMarker(cwd);
47
+ const { detectAgent, agentName } = require("./coding-agents");
48
+ const agent = detectAgent(env);
49
+ if (!agent) return { use: "own" };
50
+ const pid = String(env.QATOOLS_PROJECT || "").trim();
51
+ const marker = findProjectMarker(cwd) || (pid ? { projectId: pid, projectName: "", agents: [], dir: null } : null);
47
52
  if (!marker) return { use: "own" };
48
53
  const creds = readProjectLogin(marker.projectId, home);
49
- if (creds) return { use: "project", creds, marker };
54
+ if (creds) return { use: "project", creds, marker, agent };
50
55
  return {
51
56
  use: "refuse",
52
- message: `This repo belongs to the qa-tools project ${marker.projectName || marker.projectId}, and Claude works there with the project's own login — not the person's. ` +
53
- `Ask the person to run, in their own terminal in this repo: qatools init --claude-login`,
57
+ message: `This repo belongs to the qa-tools project ${marker.projectName || marker.projectId}, and ${agentName(agent)} works there with the project's own login — not the person's. ` +
58
+ `Ask the person to run, in their own terminal in this repo: qatools init --agent ${agent}`,
54
59
  };
55
60
  }
56
61
 
@@ -62,10 +67,14 @@ function writeProjectLogin({ projectId, projectName, apiKey }, home = os.homedir
62
67
  return dir;
63
68
  }
64
69
 
65
- function writeMarker(repoRoot, { projectId, projectName }) {
70
+ // agents: the coding agents set up for this repo — added to, never removed (setting up a second agent keeps the first)
71
+ function writeMarker(repoRoot, { projectId, projectName, agents = [] }) {
66
72
  const f = path.join(repoRoot, MARKER);
73
+ let before = [];
74
+ try { const m = JSON.parse(fs.readFileSync(f, "utf8")); if (m.projectId === projectId && Array.isArray(m.agents)) before = m.agents; } catch {}
75
+ const all = [...new Set([...before, ...agents])];
67
76
  fs.mkdirSync(path.dirname(f), { recursive: true });
68
- fs.writeFileSync(f, JSON.stringify({ projectId, projectName: projectName || "", note: "qa-tools project of this repo (no secret). Claude's login is in ~/.qatools-projects/<projectId>, outside the repo." }, null, 2) + "\n");
77
+ fs.writeFileSync(f, JSON.stringify({ projectId, projectName: projectName || "", ...(all.length ? { agents: all } : {}), note: "qa-tools project of this repo (no secret). The coding agents' login is in ~/.qatools-projects/<projectId>, outside the repo." }, null, 2) + "\n");
69
78
  return f;
70
79
  }
71
80
 
package/package.json CHANGED
@@ -1,39 +1,41 @@
1
- {
2
- "name": "qatools-cli",
3
- "version": "1.2.43",
4
- "description": "CLI for QA Tools — requirements, epics, sprints, sessions, App Context sync, project agenda. The companion to qa-tools.com.",
5
- "scripts": {
6
- "release": "npm version patch --no-git-tag-version && npm publish",
7
- "release:minor": "npm version minor --no-git-tag-version && npm publish",
8
- "test": "node --test \"test/*.test.js\""
9
- },
10
- "bin": {
11
- "qatools": "qatools.js"
12
- },
13
- "files": [
14
- "qatools.js",
15
- "mcp-core.js",
16
- "own-login.js",
17
- "impact.js",
18
- "context-sync.js",
19
- "hooks.js",
20
- "brief.js",
21
- "secrets.js",
22
- "agents.js",
23
- "vault.js"
24
- ],
25
- "keywords": [
26
- "qa",
27
- "testing",
28
- "claude",
29
- "ai",
30
- "test-management"
31
- ],
32
- "license": "MIT",
33
- "dependencies": {
34
- "@firebase/app": "^0.13.2",
35
- "@firebase/auth": "^1.10.8",
36
- "@firebase/functions": "^0.12.9",
37
- "commander": "^12.0.0"
38
- }
39
- }
1
+ {
2
+ "name": "qatools-cli",
3
+ "version": "1.2.45",
4
+ "description": "CLI for QA Tools — requirements, epics, sprints, sessions, App Context sync, project agenda. The companion to qa-tools.com.",
5
+ "scripts": {
6
+ "release": "npm version patch --no-git-tag-version && npm publish",
7
+ "release:minor": "npm version minor --no-git-tag-version && npm publish",
8
+ "test": "node --test \"test/*.test.js\""
9
+ },
10
+ "bin": {
11
+ "qatools": "qatools.js"
12
+ },
13
+ "files": [
14
+ "qatools.js",
15
+ "mcp-core.js",
16
+ "security-severity.js",
17
+ "own-login.js",
18
+ "impact.js",
19
+ "context-sync.js",
20
+ "hooks.js",
21
+ "brief.js",
22
+ "secrets.js",
23
+ "agents.js",
24
+ "coding-agents.js",
25
+ "vault.js"
26
+ ],
27
+ "keywords": [
28
+ "qa",
29
+ "testing",
30
+ "claude",
31
+ "ai",
32
+ "test-management"
33
+ ],
34
+ "license": "MIT",
35
+ "dependencies": {
36
+ "@firebase/app": "^0.13.2",
37
+ "@firebase/auth": "^1.10.8",
38
+ "@firebase/functions": "^0.12.9",
39
+ "commander": "^12.0.0"
40
+ }
41
+ }