@agentrhq/webcmd 0.2.2 → 0.2.3
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/cli-manifest.json +1269 -115
- package/clis/bigbasket/add-to-cart.js +82 -0
- package/clis/bigbasket/bigbasket.test.js +255 -0
- package/clis/bigbasket/cart.js +81 -0
- package/clis/bigbasket/category.js +30 -0
- package/clis/bigbasket/checkout.js +71 -0
- package/clis/bigbasket/location.js +30 -0
- package/clis/bigbasket/product.js +79 -0
- package/clis/bigbasket/search.js +30 -0
- package/clis/bigbasket/utils.js +207 -0
- package/clis/blinkit/add-to-cart.js +123 -0
- package/clis/blinkit/auth.js +99 -0
- package/clis/blinkit/blinkit.test.js +168 -0
- package/clis/blinkit/cart.js +34 -0
- package/clis/blinkit/checkout.js +32 -0
- package/clis/blinkit/location.js +29 -0
- package/clis/blinkit/place-order.js +78 -0
- package/clis/blinkit/product.js +63 -0
- package/clis/blinkit/search.js +89 -0
- package/clis/blinkit/utils.js +223 -0
- package/clis/district/checkout.js +71 -1
- package/clis/practo/appointment.js +21 -0
- package/clis/practo/appointments.js +27 -0
- package/clis/practo/book-confirm.js +35 -0
- package/clis/practo/book-preview.js +24 -0
- package/clis/practo/booking-link.js +24 -0
- package/clis/practo/cancel.js +29 -0
- package/clis/practo/contact.js +21 -0
- package/clis/practo/login.js +21 -0
- package/clis/practo/practo.test.js +136 -0
- package/clis/practo/profile.js +31 -0
- package/clis/practo/search.js +30 -0
- package/clis/practo/slots.js +19 -0
- package/clis/practo/utils.js +374 -0
- package/clis/practo/whoami.js +28 -0
- package/clis/zepto/add-to-cart.js +53 -0
- package/clis/zepto/auth.js +59 -0
- package/clis/zepto/cart.js +23 -0
- package/clis/zepto/checkout.js +60 -0
- package/clis/zepto/location.js +20 -0
- package/clis/zepto/place-order.js +47 -0
- package/clis/zepto/product.js +52 -0
- package/clis/zepto/search.js +30 -0
- package/clis/zepto/utils.js +228 -0
- package/clis/zepto/zepto.test.js +238 -0
- package/dist/src/generate-release-notes-cli.test.js +55 -1
- package/dist/src/release-notes.d.ts +3 -1
- package/dist/src/release-notes.js +44 -1
- package/dist/src/release-notes.test.js +39 -1
- package/package.json +1 -1
- package/scripts/generate-release-notes.ts +31 -0
- package/skills/webcmd-adapter-author/SKILL.md +9 -0
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
export const RELEASE_NOTE_SECTIONS = [
|
|
1
|
+
export const RELEASE_NOTE_SECTIONS = [
|
|
2
|
+
'Highlights',
|
|
3
|
+
'Improvements',
|
|
4
|
+
'Fixes',
|
|
5
|
+
'Adapters',
|
|
6
|
+
'Contributors',
|
|
7
|
+
'Reverts',
|
|
8
|
+
];
|
|
2
9
|
const SQUASH_MERGE_PR_NUMBER_PATTERN = /\(#(?<number>\d+)\)\s*$/;
|
|
3
10
|
const MERGE_COMMIT_PR_NUMBER_PATTERN = /^Merge pull request #(?<number>\d+) /;
|
|
4
11
|
const RELEASE_PLEASE_TITLE_PATTERN = /^chore(?:\([^)]+\))?: release(?:\s|$)/;
|
|
@@ -13,6 +20,39 @@ function formatSectionContent(content) {
|
|
|
13
20
|
const trimmed = content?.trim();
|
|
14
21
|
return trimmed && trimmed.length > 0 ? trimmed : 'None.';
|
|
15
22
|
}
|
|
23
|
+
function escapeRegExp(value) {
|
|
24
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
25
|
+
}
|
|
26
|
+
function formatReleaseNotesForChangelog(notes) {
|
|
27
|
+
const trimmed = notes.trim();
|
|
28
|
+
if (!trimmed)
|
|
29
|
+
return '### Highlights\nNone.';
|
|
30
|
+
return trimmed.replace(/^##\s+/gm, '### ');
|
|
31
|
+
}
|
|
32
|
+
export function releaseVersionFromTag(tag) {
|
|
33
|
+
const value = tag.trim();
|
|
34
|
+
if (value.startsWith('webcmd-v'))
|
|
35
|
+
return value.slice('webcmd-v'.length);
|
|
36
|
+
if (value.startsWith('v'))
|
|
37
|
+
return value.slice(1);
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
export function replaceChangelogReleaseNotes(changelog, tag, notes) {
|
|
41
|
+
const version = releaseVersionFromTag(tag);
|
|
42
|
+
const headingPattern = new RegExp(`^## \\[${escapeRegExp(version)}\\]\\([^\\n]+\\) \\([^\\n]+\\)\\s*$`, 'm');
|
|
43
|
+
const headingMatch = headingPattern.exec(changelog);
|
|
44
|
+
if (!headingMatch) {
|
|
45
|
+
throw new Error(`Could not find CHANGELOG.md entry for ${version}`);
|
|
46
|
+
}
|
|
47
|
+
const headingEnd = headingMatch.index + headingMatch[0].length;
|
|
48
|
+
const remaining = changelog.slice(headingEnd);
|
|
49
|
+
const nextReleaseMatch = /\n## \[/.exec(remaining);
|
|
50
|
+
const releaseEnd = nextReleaseMatch ? headingEnd + nextReleaseMatch.index : changelog.length;
|
|
51
|
+
const before = changelog.slice(0, headingEnd).trimEnd();
|
|
52
|
+
const after = changelog.slice(releaseEnd);
|
|
53
|
+
const suffix = after ? after.replace(/^\n+/, '\n\n') : '\n';
|
|
54
|
+
return `${before}\n\n${formatReleaseNotesForChangelog(notes)}${suffix}`;
|
|
55
|
+
}
|
|
16
56
|
export function extractPullRequestNumber(message) {
|
|
17
57
|
const firstLine = message.split(/\r?\n/, 1)[0] ?? message;
|
|
18
58
|
const squashMatch = firstLine.match(SQUASH_MERGE_PR_NUMBER_PATTERN);
|
|
@@ -92,6 +132,9 @@ export function buildReleaseNotesPrompt(context) {
|
|
|
92
132
|
'Use only the supplied pull requests below. Do not invent changes or pull in information from elsewhere.',
|
|
93
133
|
`Required sections: ${RELEASE_NOTE_SECTIONS.map((section) => `## ${section}`).join(', ')}.`,
|
|
94
134
|
'Each section must be present in the final notes.',
|
|
135
|
+
'In this project, CLI commands and adapters are the same thing. Treat any PR that adds, removes, or changes files under clis/** as an adapter change, even if the PR title says "CLI" instead of "adapter".',
|
|
136
|
+
'Put new site adapters/CLIs, adapter promotions, adapter hardening, adapter output changes, selector/API updates, and site-specific workflow improvements in ## Adapters.',
|
|
137
|
+
'Use ## Improvements for non-adapter product, runtime, CLI, docs, or workflow improvements.',
|
|
95
138
|
'',
|
|
96
139
|
`Pull requests included for this release:`,
|
|
97
140
|
prSummaries,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { RELEASE_NOTE_SECTIONS, buildReleaseNotesPrompt, extractPullRequestNumber, filterReleasePullRequests, normalizeReleaseNotes, } from './release-notes.js';
|
|
2
|
+
import { RELEASE_NOTE_SECTIONS, buildReleaseNotesPrompt, extractPullRequestNumber, filterReleasePullRequests, normalizeReleaseNotes, replaceChangelogReleaseNotes, } from './release-notes.js';
|
|
3
3
|
describe('release notes helpers', () => {
|
|
4
4
|
it('extracts PR numbers from squash and merge commit messages', () => {
|
|
5
5
|
expect(extractPullRequestNumber('feat: add release notes (#123)')).toBe(123);
|
|
@@ -29,10 +29,44 @@ describe('release notes helpers', () => {
|
|
|
29
29
|
for (const section of RELEASE_NOTE_SECTIONS) {
|
|
30
30
|
expect(normalized).toContain(`## ${section}`);
|
|
31
31
|
}
|
|
32
|
+
expect(normalized).toContain('## Adapters\nNone.');
|
|
32
33
|
expect(normalized).toContain('## Improvements\nNone.');
|
|
33
34
|
expect(normalized).toContain('## Contributors\n- @alice\n- @bob');
|
|
34
35
|
expect(normalized).toContain('## Reverts\nNone.');
|
|
35
36
|
});
|
|
37
|
+
it('replaces a matching changelog release entry with generated notes', () => {
|
|
38
|
+
const changelog = [
|
|
39
|
+
'# Changelog',
|
|
40
|
+
'',
|
|
41
|
+
'## [0.2.3](https://github.com/agentrhq/webcmd/compare/webcmd-v0.2.2...webcmd-v0.2.3) (2026-07-09)',
|
|
42
|
+
'',
|
|
43
|
+
'',
|
|
44
|
+
'### Features',
|
|
45
|
+
'',
|
|
46
|
+
'* release-please generated note',
|
|
47
|
+
'',
|
|
48
|
+
'## [0.2.2](https://github.com/agentrhq/webcmd/compare/webcmd-v0.2.1...webcmd-v0.2.2) (2026-07-08)',
|
|
49
|
+
'',
|
|
50
|
+
'### Bug Fixes',
|
|
51
|
+
'',
|
|
52
|
+
'* older note',
|
|
53
|
+
'',
|
|
54
|
+
].join('\n');
|
|
55
|
+
const notes = [
|
|
56
|
+
'## Highlights',
|
|
57
|
+
'- Better release notes.',
|
|
58
|
+
'',
|
|
59
|
+
'## Adapters',
|
|
60
|
+
'- Improved district checkout.',
|
|
61
|
+
].join('\n');
|
|
62
|
+
const updated = replaceChangelogReleaseNotes(changelog, 'webcmd-v0.2.3', notes);
|
|
63
|
+
expect(updated).toContain('## [0.2.3]');
|
|
64
|
+
expect(updated).toContain('### Highlights\n- Better release notes.');
|
|
65
|
+
expect(updated).toContain('### Adapters\n- Improved district checkout.');
|
|
66
|
+
expect(updated).not.toContain('release-please generated note');
|
|
67
|
+
expect(updated).toContain('## [0.2.2]');
|
|
68
|
+
expect(updated).toContain('* older note');
|
|
69
|
+
});
|
|
36
70
|
it('builds a prompt grounded in the exact release range and PR list', () => {
|
|
37
71
|
const context = {
|
|
38
72
|
tag: 'v0.2.0',
|
|
@@ -56,6 +90,10 @@ describe('release notes helpers', () => {
|
|
|
56
90
|
expect(prompt).toContain('PR #42: feat: add docs scaffold');
|
|
57
91
|
expect(prompt).toContain('docs/docs.json');
|
|
58
92
|
expect(prompt).toContain('## Highlights');
|
|
93
|
+
expect(prompt).toContain('## Adapters');
|
|
94
|
+
expect(prompt).toContain('CLI commands and adapters are the same thing');
|
|
95
|
+
expect(prompt).toContain('files under clis/** as an adapter change');
|
|
96
|
+
expect(prompt).toContain('Put new site adapters/CLIs, adapter promotions, adapter hardening');
|
|
59
97
|
expect(prompt).toContain('## Reverts');
|
|
60
98
|
});
|
|
61
99
|
});
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
2
3
|
import { pathToFileURL } from 'node:url';
|
|
3
4
|
import { GoogleGenAI } from '@google/genai';
|
|
4
5
|
import {
|
|
@@ -6,6 +7,7 @@ import {
|
|
|
6
7
|
extractPullRequestNumber,
|
|
7
8
|
filterReleasePullRequests,
|
|
8
9
|
normalizeReleaseNotes,
|
|
10
|
+
replaceChangelogReleaseNotes,
|
|
9
11
|
type PullRequestDetails,
|
|
10
12
|
type ReleaseContext,
|
|
11
13
|
} from '../src/release-notes.js';
|
|
@@ -195,12 +197,41 @@ function contributorHandles(pullRequests: PullRequestDetails[]): string[] {
|
|
|
195
197
|
return pullRequests.flatMap((pr) => (pr.author?.login ? [pr.author.login] : []));
|
|
196
198
|
}
|
|
197
199
|
|
|
200
|
+
function updateChangelog(tag: string | undefined, notesPath: string | undefined, changelogPath: string | undefined, io: Io): number {
|
|
201
|
+
if (!tag || !notesPath) {
|
|
202
|
+
io.writeStderr('Usage: generate-release-notes --update-changelog <tag> <notes-file> [changelog-file]\n');
|
|
203
|
+
return 1;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const targetChangelogPath = changelogPath ?? 'CHANGELOG.md';
|
|
207
|
+
|
|
208
|
+
try {
|
|
209
|
+
const notes = readFileSync(notesPath, 'utf8');
|
|
210
|
+
const changelog = readFileSync(targetChangelogPath, 'utf8');
|
|
211
|
+
const updated = replaceChangelogReleaseNotes(changelog, tag, notes);
|
|
212
|
+
if (updated !== changelog) {
|
|
213
|
+
writeFileSync(targetChangelogPath, updated);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
io.writeStdout(`Updated ${targetChangelogPath} for ${tag}\n`);
|
|
217
|
+
return 0;
|
|
218
|
+
} catch (error) {
|
|
219
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
220
|
+
io.writeStderr(`CHANGELOG.md update failed: ${message}\n`);
|
|
221
|
+
return 1;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
198
225
|
export async function runGenerateReleaseNotes(
|
|
199
226
|
argv: string[] = process.argv,
|
|
200
227
|
env: NodeJS.ProcessEnv = process.env,
|
|
201
228
|
deps: RunDependencies = {},
|
|
202
229
|
io: Io = DEFAULT_IO,
|
|
203
230
|
): Promise<number> {
|
|
231
|
+
if (argv[2] === '--update-changelog') {
|
|
232
|
+
return updateChangelog(argv[3], argv[4], argv[5], io);
|
|
233
|
+
}
|
|
234
|
+
|
|
204
235
|
const tag = argv[2];
|
|
205
236
|
if (!tag) {
|
|
206
237
|
io.writeStderr('Usage: generate-release-notes <tag>\n');
|
|
@@ -194,6 +194,14 @@ Check these off step by step:
|
|
|
194
194
|
[ ] `fixtures/<cmd>-<YYYYMMDDHHMM>.json`: save one complete endpoint response sample after removing cookies, tokens, and private user fields. Use it for later field comparison and offline replay.
|
|
195
195
|
[ ] If debugging dumped temporary files in the repo or adapter directory, such as `.dbg-*.html`, `raw-*.json`, or similar, **delete them before commit**. Those belong in `~/.webcmd/sites/<site>/fixtures/` or `/tmp/`.
|
|
196
196
|
|
|
197
|
+
[ ] 13. **First command for this site? Stop and ask before building more.**
|
|
198
|
+
[ ] If this was the site's first command, do not silently keep scaffolding more commands. Ask the user what use cases they have in mind for this site — who the persona is, what they're trying to accomplish end to end.
|
|
199
|
+
[ ] From the use cases, propose the full set of commands you'd recommend adding, not just the obvious next one. Cover the whole journey the use cases imply (discovery, single-item detail, comparison, account/write actions, etc.), not only what's cheapest to build.
|
|
200
|
+
[ ] If that set is small (roughly ≤6-8 commands), list it flat and ask the user to confirm or trim it.
|
|
201
|
+
[ ] If it's large, bucket the commands into named groups (e.g. "Discovery", "Single-item evaluation", "Account actions requiring login") and ask the user which bucket(s) to build first — do not dump an unbucketed wall of commands.
|
|
202
|
+
[ ] Flag any bucket that needs a capability not yet solved (login/OTP, write access, payment) as its own decision point — e.g. "these need login — how do you want to handle auth?" — separate from the command list itself.
|
|
203
|
+
[ ] Do not scaffold additional commands until the user has confirmed which ones to build.
|
|
204
|
+
|
|
197
205
|
---
|
|
198
206
|
|
|
199
207
|
## Fallback Paths
|
|
@@ -247,6 +255,7 @@ Check these off step by step:
|
|
|
247
255
|
- **Persistent sessions keep stale DOM between commands.** `siteSession: 'persistent'` shares one tab per site; leftover modals/drawers from the previous command leak into the next one. State-sensitive write commands (checkout flows) should add `freshPage: true` (new tab, same lease — cookies/login/location survive). Verify session-scoped context (login, selected city/date) *before* side effects, and embed such context in URLs/IDs your command emits for sibling commands. See `references/adapter-template.md` and "Persistent Sessions and State Hygiene" in `docs/authoring.mdx`.
|
|
248
256
|
- For private adapters, write `~/.webcmd/clis/<site>/<name>.js` to avoid a build. Copy to `clis/<site>/<name>.js` only when preparing a PR.
|
|
249
257
|
- Write site memory every round: no memory -> use skill -> produce memory -> next time becomes a five-minute task.
|
|
258
|
+
- **After a site's first command passes verify, stop and ask the user for their use cases before recommending next set of commands.** See Runbook Step 13.
|
|
250
259
|
- **Raw dumps, packet captures, and HTML samples from debugging may only be written to `~/.webcmd/sites/<site>/fixtures/` or `/tmp/`. Never leave `.dbg-*.html`, `raw-*.json`, `sample.*`, or similar temporary files in the repo root, `clis/<site>/`, or the current working directory.**
|
|
251
260
|
- **JSDOM unit-test fixtures (`clis/<site>/__fixtures__/<command>.html`) are the exception.** They are intentional review artifacts committed to the repo, not temporary dumps. Because of that, the quality bar is higher: complete the five steps in `references/jsdom-fixture-pattern.md`, including the mandatory `awk 'NF>0'` blank-line tightening, and reverse-validate once to prove the regression guard can fail.
|
|
252
261
|
|