qatools-cli 1.1.10 → 1.1.12
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/package.json +1 -1
- package/qatools.js +71 -31
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qatools-cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.12",
|
|
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
|
@@ -129,6 +129,50 @@ program
|
|
|
129
129
|
.description("CLI for QA Tools")
|
|
130
130
|
.version(require("./package.json").version);
|
|
131
131
|
|
|
132
|
+
// Update nudge: before every command, print (from cache) if the installed CLI is behind npm,
|
|
133
|
+
// and refresh the cache in the background (throttled to once/day). sync can't upgrade the tool itself.
|
|
134
|
+
// Kept fully non-blocking and fail-open so it never slows or breaks a command (parse() is sync).
|
|
135
|
+
const VERSION_CACHE_FILE = path.join(process.env.HOME || process.env.USERPROFILE || ".", ".qatools-version");
|
|
136
|
+
function cmpVersion(a, b) {
|
|
137
|
+
const pa = String(a).split(".").map(Number), pb = String(b).split(".").map(Number);
|
|
138
|
+
for (let i = 0; i < 3; i++) { const d = (pa[i] || 0) - (pb[i] || 0); if (d) return d < 0 ? -1 : 1; }
|
|
139
|
+
return 0;
|
|
140
|
+
}
|
|
141
|
+
function printUpdateNoticeFromCache() {
|
|
142
|
+
try {
|
|
143
|
+
const current = require("./package.json").version;
|
|
144
|
+
const cache = JSON.parse(fs.readFileSync(VERSION_CACHE_FILE, "utf8"));
|
|
145
|
+
if (cache.latest && cmpVersion(current, cache.latest) < 0) {
|
|
146
|
+
// stderr so it never corrupts parseable stdout (e.g. -o json output)
|
|
147
|
+
console.error(`\n⚠ qatools-cli ${current} → ${cache.latest} available. Upgrade: npm i -g qatools-cli@latest\n`);
|
|
148
|
+
}
|
|
149
|
+
} catch { /* no cache yet or unreadable — skip */ }
|
|
150
|
+
}
|
|
151
|
+
function refreshVersionCacheInBackground() {
|
|
152
|
+
try {
|
|
153
|
+
let cache = {};
|
|
154
|
+
try { cache = JSON.parse(fs.readFileSync(VERSION_CACHE_FILE, "utf8")); } catch { /* none */ }
|
|
155
|
+
if (cache.checkedAt && Date.now() - cache.checkedAt < 24 * 3600 * 1000) return; // throttled: at most once/day
|
|
156
|
+
const req = require("https").get("https://registry.npmjs.org/qatools-cli/latest", { timeout: 3000 }, (res) => {
|
|
157
|
+
let body = "";
|
|
158
|
+
res.on("data", (c) => (body += c));
|
|
159
|
+
res.on("end", () => {
|
|
160
|
+
try {
|
|
161
|
+
const latest = JSON.parse(body).version;
|
|
162
|
+
if (latest) fs.writeFileSync(VERSION_CACHE_FILE, JSON.stringify({ latest, checkedAt: Date.now() }));
|
|
163
|
+
} catch { /* malformed — skip */ }
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
req.on("error", () => {});
|
|
167
|
+
req.on("timeout", () => req.destroy());
|
|
168
|
+
if (req.unref) req.unref(); // don't keep the process alive for this
|
|
169
|
+
} catch { /* never block the command */ }
|
|
170
|
+
}
|
|
171
|
+
program.hook("preAction", () => {
|
|
172
|
+
printUpdateNoticeFromCache();
|
|
173
|
+
refreshVersionCacheInBackground();
|
|
174
|
+
});
|
|
175
|
+
|
|
132
176
|
program
|
|
133
177
|
.command("upload-analysis")
|
|
134
178
|
.description("Upload a Claude analysis JSON to a test session")
|
|
@@ -290,6 +334,31 @@ program
|
|
|
290
334
|
process.exit(0);
|
|
291
335
|
});
|
|
292
336
|
|
|
337
|
+
program
|
|
338
|
+
.command("member-add")
|
|
339
|
+
.description("Add a member to the project by email — sends them an invite email automatically")
|
|
340
|
+
.requiredOption("--member <email>", "Email of the person to add as a member")
|
|
341
|
+
.option("--project <id>", "Target project ID (overrides default)")
|
|
342
|
+
.option("-e, --email <email>", "Login email")
|
|
343
|
+
.option("-p, --password <password>", "Login password")
|
|
344
|
+
.action(async (options) => {
|
|
345
|
+
await authenticate(options);
|
|
346
|
+
const creds = getCredentials();
|
|
347
|
+
const projectId = options.project || creds?.projectId;
|
|
348
|
+
if (!projectId) { console.error("No project configured. Run: qatools setup, or pass --project <id>"); process.exit(1); }
|
|
349
|
+
|
|
350
|
+
const addMember = httpsCallable(functions, "addProjectMember");
|
|
351
|
+
try {
|
|
352
|
+
const result = await addMember({ projectId, email: options.member });
|
|
353
|
+
if (result.data.alreadyMember) console.log(`${result.data.email} is already a member.`);
|
|
354
|
+
else console.log(`Added ${result.data.email} — an invite email has been sent.`);
|
|
355
|
+
} catch (e) {
|
|
356
|
+
console.error("Failed:", e.message);
|
|
357
|
+
process.exit(1);
|
|
358
|
+
}
|
|
359
|
+
process.exit(0);
|
|
360
|
+
});
|
|
361
|
+
|
|
293
362
|
program
|
|
294
363
|
.command("pending")
|
|
295
364
|
.description("List test sessions awaiting Claude analysis")
|
|
@@ -740,36 +809,6 @@ program
|
|
|
740
809
|
process.exit(0);
|
|
741
810
|
});
|
|
742
811
|
|
|
743
|
-
// Non-blocking: warn if a newer qatools-cli is published on npm (sync can't upgrade the tool itself)
|
|
744
|
-
function cmpVersion(a, b) {
|
|
745
|
-
const pa = String(a).split(".").map(Number), pb = String(b).split(".").map(Number);
|
|
746
|
-
for (let i = 0; i < 3; i++) { const d = (pa[i] || 0) - (pb[i] || 0); if (d) return d < 0 ? -1 : 1; }
|
|
747
|
-
return 0;
|
|
748
|
-
}
|
|
749
|
-
function checkCliVersion() {
|
|
750
|
-
return new Promise((resolve) => {
|
|
751
|
-
try {
|
|
752
|
-
const current = require("./package.json").version;
|
|
753
|
-
const req = require("https").get("https://registry.npmjs.org/qatools-cli/latest", { timeout: 3000 }, (res) => {
|
|
754
|
-
let body = "";
|
|
755
|
-
res.on("data", (c) => (body += c));
|
|
756
|
-
res.on("end", () => {
|
|
757
|
-
try {
|
|
758
|
-
const latest = JSON.parse(body).version;
|
|
759
|
-
if (latest && cmpVersion(current, latest) < 0) {
|
|
760
|
-
console.log(`\n⚠ A newer qatools-cli is available: ${current} → ${latest}`);
|
|
761
|
-
console.log(` Upgrade so commands, skills and rules are current: npm i -g qatools-cli@latest\n`);
|
|
762
|
-
}
|
|
763
|
-
} catch { /* malformed response — skip */ }
|
|
764
|
-
resolve();
|
|
765
|
-
});
|
|
766
|
-
});
|
|
767
|
-
req.on("error", () => resolve());
|
|
768
|
-
req.on("timeout", () => { req.destroy(); resolve(); });
|
|
769
|
-
} catch { resolve(); }
|
|
770
|
-
});
|
|
771
|
-
}
|
|
772
|
-
|
|
773
812
|
program
|
|
774
813
|
.command("sync")
|
|
775
814
|
.description("Sync App Context from qa-tools into a CLAUDE.md block")
|
|
@@ -780,7 +819,6 @@ program
|
|
|
780
819
|
.option("-e, --email <email>", "Login email")
|
|
781
820
|
.option("-p, --password <password>", "Login password")
|
|
782
821
|
.action(async (options) => {
|
|
783
|
-
await checkCliVersion();
|
|
784
822
|
await authenticate(options);
|
|
785
823
|
const creds = getCredentials();
|
|
786
824
|
const projectId = options.project || creds?.projectId;
|
|
@@ -2091,6 +2129,7 @@ qatools backlog-tags # List existing tags (MUST check before tag
|
|
|
2091
2129
|
qatools backlog-create -d "..." -t bug --requirement-key <key> --assigned <email> --developer <email> --sprint <id> --tags tag1,tag2
|
|
2092
2130
|
qatools backlog-update -i <id> --status resolved --sprint <id> --priority 1 --requirement-key <key> --developer <email> --tags tag1,tag2
|
|
2093
2131
|
qatools notify --to <email> --subject "..." --message "..." # email a project member directly (e.g. "ready to test"); respects their opt-out
|
|
2132
|
+
qatools member-add --member <email> # add a member to the project (sends them an invite email)
|
|
2094
2133
|
qatools backlog-duplicates --local # Output for local AI analysis (no API key needed)
|
|
2095
2134
|
qatools backlog-duplicates # AI-powered duplicate detection (requires API key)
|
|
2096
2135
|
|
|
@@ -2587,6 +2626,7 @@ export QATOOLS_API_KEY=${apiKey || "<din-nyckel>"}
|
|
|
2587
2626
|
- \`qatools backlog-create -d "..." -t bug\` — create backlog item
|
|
2588
2627
|
- \`qatools backlog-update -i <id> --status resolved --evidence "..."\` — mark resolved (evidence required)
|
|
2589
2628
|
- \`qatools notify --to <email> --subject "..." --message "..."\` — email a project member directly (respects opt-out)
|
|
2629
|
+
- \`qatools member-add --member <email>\` — add a member to the project (sends an invite email)
|
|
2590
2630
|
- \`qatools access show\` — view access model
|
|
2591
2631
|
|
|
2592
2632
|
### Skills
|