qatools-cli 1.2.19 → 1.2.20
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 +65 -22
- package/package.json +1 -1
- package/qatools.js +1 -1
package/context-sync.js
CHANGED
|
@@ -55,7 +55,7 @@ function renderToolsSection() {
|
|
|
55
55
|
return [
|
|
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
59
|
"- 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.",
|
|
60
60
|
"",
|
|
61
61
|
].join("\n");
|
|
@@ -68,28 +68,40 @@ function requestsIntegrationPrompt(projectName) {
|
|
|
68
68
|
return [
|
|
69
69
|
`# Connect this app's feature requests to qa-tools${projectName ? ` (project "${projectName}")` : ""}`,
|
|
70
70
|
"",
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
71
|
+
"Users request features and vote on each other's requests. qa-tools gets the requests and votes, members link them",
|
|
72
|
+
"to requirements, and the app shows what happened to each request — so users see that their votes matter.",
|
|
73
|
+
"",
|
|
74
|
+
"Two ways, depending on the app:",
|
|
75
|
+
"- A. The app already stores requests and votes (its own collection/table and voting): keep it, add a sync (steps 3A).",
|
|
76
|
+
"- B. The app has no request store: qa-tools keeps the requests, votes and comments; the app only shows a thin page",
|
|
77
|
+
" that its server builds on the calls list / create / vote / comment / comments (steps 3B). No database, no voting",
|
|
78
|
+
" logic and no sync in the app.",
|
|
74
79
|
"",
|
|
75
80
|
"## Procedure",
|
|
76
|
-
"1. Find where the app keeps requests and votes (collection/table, fields
|
|
77
|
-
" shows them. Read the code. If
|
|
78
|
-
"
|
|
81
|
+
"1. Find out which: look for where the app keeps requests and votes (collection/table, fields) and the page that",
|
|
82
|
+
" shows them. Read the code. If there is none, it is B.",
|
|
83
|
+
" For B the page is new: write a requirement for it first (Given/When/Then in the project's language) and let the",
|
|
84
|
+
" user approve it before you build — e.g. `qatools requirement-create`.",
|
|
79
85
|
"2. Ask the user for the feature-request key. The project owner creates it in qa-tools: Members → Requests from the",
|
|
80
|
-
" app → Create key. It starts with `fr-`, is shown once, and can only send
|
|
81
|
-
" Keep it server-side as a secret named QATOOLS_FEATURE_REQUEST_KEY. Never in client code, never in the repo
|
|
82
|
-
"
|
|
86
|
+
" app → Create key. It starts with `fr-`, is shown once, and can only send and read requests, votes and comments.",
|
|
87
|
+
" Keep it server-side as a secret named QATOOLS_FEATURE_REQUEST_KEY. Never in client code, never in the repo:",
|
|
88
|
+
" the browser calls the app's own server, which calls qa-tools.",
|
|
89
|
+
"3B. (no store of its own) Add server routes that pass the logged-in user's id to qa-tools — list, create, vote,",
|
|
90
|
+
" comment, comments — and a page on them: the requests most votes first, with votes, status, comments, a vote button",
|
|
91
|
+
" (voted: true shows it as given; vote again with vote:false takes it back), a form for a new request, and the comment",
|
|
92
|
+
" thread. Send the user's display name as userName with comments. Then go to step 4.",
|
|
93
|
+
"3A. (own store) Add a scheduled server job (every 15 minutes is enough) that:",
|
|
83
94
|
" - sends every request with its current votes: action \"upsert\", at most 200 per call. The app's own id",
|
|
84
95
|
" identifies a request, so sending all of them every time is fine — it updates, it does not duplicate;",
|
|
85
96
|
" - reads the status of the same ids: action \"status\", at most 500 per call;",
|
|
86
97
|
" - stores each status on the app's own request record (e.g. a field qaStatus).",
|
|
87
|
-
"4. Show the status on the request page, in the app's language
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
98
|
+
"4. Show the status on the request page, in the app's language, with the votes: new → received; accepted → accepted",
|
|
99
|
+
" (it is linked to a requirement); planned → the release name and its planned date (releaseDate); released →",
|
|
100
|
+
" released; declined → declined with the reason (members write it for the users).",
|
|
101
|
+
"5. Verify it yourself before you say it works: (A) run the job once, or (B) create a request and vote through your",
|
|
102
|
+
" own routes; then `qatools feature-requests` must list the requests with their votes, and the app must show",
|
|
103
|
+
" status \"new\". Report what you saw. The user then links one request to a planned requirement in qa-tools; after",
|
|
104
|
+
" that (and the next sync for A) its status must be \"planned\" with the release and date.",
|
|
93
105
|
"6. If the app's requirements in qa-tools do not cover the request page or this sync, say so — the user decides",
|
|
94
106
|
" whether to add requirements.",
|
|
95
107
|
"",
|
|
@@ -101,15 +113,46 @@ function requestsIntegrationPrompt(projectName) {
|
|
|
101
113
|
' { "action": "upsert", "requests": [ { "id": "42", "title": "Dark mode", "description": "…", "votes": 15, "url": "https://…" } ] }',
|
|
102
114
|
' → { "created": 1, "updated": 0, "refused": [] } (refused: [{ "id": "", "reason": "id and title are required" }])',
|
|
103
115
|
"",
|
|
104
|
-
"Read status:",
|
|
116
|
+
"Read status (A):",
|
|
105
117
|
' { "action": "status", "ids": ["42", "43"] }',
|
|
106
|
-
' → { "statuses": [ { "id": "42", "status": "planned", "sprint": "Release 4.1", "releaseDate": "2026-11-18" },',
|
|
107
|
-
' { "id": "43", "status": "declined", "reason": "…" } ] }',
|
|
108
|
-
" status is one of: new, planned, released, declined, unknown (never sent)",
|
|
118
|
+
' → { "statuses": [ { "id": "42", "votes": 15, "status": "planned", "sprint": "Release 4.1", "releaseDate": "2026-11-18" },',
|
|
119
|
+
' { "id": "43", "votes": 2, "status": "declined", "reason": "…" } ] }',
|
|
120
|
+
" status is one of: new, accepted, planned, released, declined, unknown (never sent)",
|
|
121
|
+
"",
|
|
122
|
+
"Kept by qa-tools (B) — userId is the app's id for the user who acts; qa-tools stores only a hash of it:",
|
|
123
|
+
' { "action": "list", "userId": "u2" }',
|
|
124
|
+
' → { "requests": [ { "id": "qa-…", "title": "…", "description": "…", "votes": 3, "comments": 1, "voted": true,',
|
|
125
|
+
' "status": "planned", "sprint": "Release 4.1", "releaseDate": "2026-11-18" } ] } (most votes first)',
|
|
126
|
+
' { "action": "create", "userId": "u1", "title": "Dark mode", "description": "…" } → { "request": { …, "votes": 1, "voted": true } }',
|
|
127
|
+
' { "action": "vote", "userId": "u2", "id": "qa-…" } → { "id": "qa-…", "votes": 2, "voted": true }',
|
|
128
|
+
' { "action": "vote", "userId": "u2", "id": "qa-…", "vote": false } → takes the vote back; one vote per user and request',
|
|
129
|
+
' { "action": "comment", "userId": "u2", "userName": "Anna", "id": "qa-…", "text": "…" }',
|
|
130
|
+
' { "action": "comments", "id": "qa-…" } → { "comments": [ { "author": "Anna", "team": false, "text": "…", "at": "…" },',
|
|
131
|
+
' { "author": "team", "team": true, "text": "…", "at": "…" } ] }',
|
|
132
|
+
" Replies from the project's members come back with author \"team\". Votes on requests the app syncs itself (A) are",
|
|
133
|
+
" refused (409) — their votes come from the app.",
|
|
134
|
+
"",
|
|
135
|
+
"Errors: 401 missing key, 403 wrong or revoked key, 400 bad body (e.g. no userId, no title, title over 300",
|
|
136
|
+
"characters), 404 unknown request, 409 vote on a synced request, 429 more than 600 calls a minute from one server.",
|
|
109
137
|
"",
|
|
110
|
-
"
|
|
138
|
+
"## Example B (Node/Express routes in the app's server — adapt to the app's framework and auth)",
|
|
139
|
+
FENCE + "js",
|
|
140
|
+
`const QA = "${FEATURE_REQUESTS_URL}";`,
|
|
141
|
+
"const qa = async (body) => {",
|
|
142
|
+
' const res = await fetch(QA, { method: "POST", headers: { "Content-Type": "application/json", Authorization: "Bearer " + process.env.QATOOLS_FEATURE_REQUEST_KEY }, body: JSON.stringify(body) });',
|
|
143
|
+
" const json = await res.json();",
|
|
144
|
+
' if (!res.ok) throw Object.assign(new Error(json.error), { status: res.status });',
|
|
145
|
+
" return json;",
|
|
146
|
+
"};",
|
|
147
|
+
"// req.user is the app's logged-in user",
|
|
148
|
+
'app.get("/api/requests", async (req, res) => res.json(await qa({ action: "list", userId: req.user.id })));',
|
|
149
|
+
'app.post("/api/requests", async (req, res) => res.json(await qa({ action: "create", userId: req.user.id, title: req.body.title, description: req.body.description })));',
|
|
150
|
+
'app.post("/api/requests/:id/vote", async (req, res) => res.json(await qa({ action: "vote", userId: req.user.id, id: req.params.id, vote: req.body.vote !== false })));',
|
|
151
|
+
'app.get("/api/requests/:id/comments", async (req, res) => res.json(await qa({ action: "comments", id: req.params.id })));',
|
|
152
|
+
'app.post("/api/requests/:id/comments", async (req, res) => res.json(await qa({ action: "comment", userId: req.user.id, userName: req.user.name, id: req.params.id, text: req.body.text })));',
|
|
153
|
+
FENCE,
|
|
111
154
|
"",
|
|
112
|
-
"## Example (Node, Firebase scheduled function — adapt names to the app)",
|
|
155
|
+
"## Example A (Node, Firebase scheduled function — adapt names to the app)",
|
|
113
156
|
FENCE + "js",
|
|
114
157
|
'const { onSchedule } = require("firebase-functions/v2/scheduler");',
|
|
115
158
|
'const { defineSecret } = require("firebase-functions/params");',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qatools-cli",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.20",
|
|
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
|
@@ -2761,7 +2761,7 @@ App Context → Epics → Requirements → Sprint → Implementation → Test
|
|
|
2761
2761
|
|
|
2762
2762
|
## Tools you may not think of
|
|
2763
2763
|
- 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.
|
|
2764
|
-
-
|
|
2764
|
+
- 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 goes back to the app. See what has arrived: \`qatools feature-requests\`.
|
|
2765
2765
|
- Something more important must go into a sprint in progress: propose a swap instead of overfilling it; a member approves.
|
|
2766
2766
|
`,
|
|
2767
2767
|
|