qatools-cli 1.2.21 → 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/package.json +1 -1
- package/qatools.js +12 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qatools-cli",
|
|
3
|
-
"version": "1.2.
|
|
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
|
-
|
|
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
|
|
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}`, {
|
|
@@ -917,7 +924,8 @@ program
|
|
|
917
924
|
|
|
918
925
|
// signals.feature-requests-cli: act on a request from the terminal — a request by the app's id, a requirement by its key
|
|
919
926
|
async function decideRequestFromCli(options, action, extra) {
|
|
920
|
-
|
|
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" });
|
|
921
929
|
const projectId = options.project || getCredentials()?.projectId;
|
|
922
930
|
if (!projectId) { console.error("No project configured. Run: qatools setup, or pass --project <id>"); process.exit(1); }
|
|
923
931
|
try {
|