@zosmaai/zosma-qa-cli 0.0.4

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/LICENSE ADDED
@@ -0,0 +1,178 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship made available under
36
+ the License, as indicated by a copyright notice that is included in
37
+ or attached to the work (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and derivative works thereof.
46
+
47
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
48
+ in the Work by the copyright owner or by an individual or Legal Entity
49
+ authorized to submit on behalf of the copyright owner. For the purposes
50
+ of this definition, "submitted" means any form of electronic, verbal,
51
+ or written communication sent to the Licensor or its representatives,
52
+ including but not limited to communication on electronic mailing lists,
53
+ source code control systems, and issue tracking systems that are managed
54
+ by, or on behalf of, the Licensor for the purpose of discussing and
55
+ improving the Work, but excluding communication that is conspicuously
56
+ marked or otherwise designated in writing by the copyright owner as
57
+ "Not a Contribution."
58
+
59
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
60
+ whom a Contribution has been received by the Licensor and subsequently
61
+ incorporated within the Work.
62
+
63
+ 2. Grant of Copyright License. Subject to the terms and conditions of
64
+ this License, each Contributor hereby grants to You a perpetual,
65
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
66
+ copyright license to reproduce, prepare Derivative Works of,
67
+ publicly display, publicly perform, sublicense, and distribute the
68
+ Work and such Derivative Works in Source or Object form.
69
+
70
+ 3. Grant of Patent License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ (except as stated in this section) patent license to make, have made,
74
+ use, offer to sell, sell, import, and otherwise transfer the Work,
75
+ where such license applies only to those patent claims licensable
76
+ by such Contributor that are necessarily infringed by their
77
+ Contribution(s) alone or by the combination of their Contribution(s)
78
+ with the Work to which such Contribution(s) was submitted. If You
79
+ institute patent litigation against any entity (including a cross-claim
80
+ or counterclaim in a lawsuit) alleging that the Work or any
81
+ Contribution embodied within the Work constitutes direct or contributory
82
+ patent infringement, then any patent licenses granted to You under
83
+ this License for that Work shall terminate as of the date such
84
+ litigation is filed.
85
+
86
+ 4. Redistribution. You may reproduce and distribute copies of the
87
+ Work or Derivative Works thereof in any medium, with or without
88
+ modifications, and in Source or Object form, provided that You
89
+ meet the following conditions:
90
+
91
+ (a) You must give any other recipients of the Work or Derivative Works
92
+ a copy of this License; and
93
+
94
+ (b) You must cause any modified files to carry prominent notices
95
+ stating that You changed the files; and
96
+
97
+ (c) You must retain, in the Source form of any Derivative Works that
98
+ You distribute, all copyright, patent, trademark, and attribution
99
+ notices from the Source form of the Work, excluding those notices
100
+ that do not pertain to any part of the Derivative Works; and
101
+
102
+ (d) If the Work includes a "NOTICE" text file as part of its
103
+ distribution, You must include a readable copy of the attribution
104
+ notices contained within such NOTICE file, in at least one of
105
+ the following places: within a NOTICE text provided as part of
106
+ the Derivative Works; within the Source form or documentation,
107
+ if provided along with the Derivative Works; or, within a display
108
+ generated by the Derivative Works, if and wherever such
109
+ third-party notices normally appear. The contents of the NOTICE
110
+ file are for informational purposes only and do not modify the
111
+ License. You may add Your own attribution notices within
112
+ Derivative Works that You distribute, alongside or as an addendum
113
+ to the NOTICE text from the Work, provided that such additional
114
+ attribution notices cannot be construed as modifying the License.
115
+
116
+ You may add Your own license statement for Your modifications and
117
+ may provide additional grant of rights to use, copy, modify, merge,
118
+ publish, distribute, sublicense, and/or sell copies of the
119
+ Contribution, and to permit persons to whom the Contribution is
120
+ furnished to do so.
121
+
122
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
123
+ any Contribution intentionally submitted for inclusion in the Work
124
+ by You to the Licensor shall be under the terms and conditions of
125
+ this License, without any additional terms or conditions.
126
+ Notwithstanding the above, nothing herein shall supersede or modify
127
+ the terms of any separate license agreement you may have executed
128
+ with Licensor regarding such Contributions.
129
+
130
+ 6. Trademarks. This License does not grant permission to use the trade
131
+ names, trademarks, service marks, or product names of the Licensor,
132
+ except as required for reasonable and customary use in describing the
133
+ origin of the Work and reproducing the content of the NOTICE file.
134
+
135
+ 7. Disclaimer of Warranty. Unless required by applicable law or
136
+ agreed to in writing, Licensor provides the Work (and each
137
+ Contributor provides its Contributions) on an "AS IS" BASIS,
138
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
139
+ implied, including, without limitation, any warranties or conditions
140
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
141
+ PARTICULAR PURPOSE. You are solely responsible for determining the
142
+ appropriateness of using or reproducing the Work and assume any
143
+ risks associated with Your exercise of permissions under this License.
144
+
145
+ 8. Limitation of Liability. In no event and under no legal theory,
146
+ whether in tort (including negligence), contract, or otherwise,
147
+ unless required by applicable law (such as deliberate and grossly
148
+ negligent acts) or agreed to in writing, shall any Contributor be
149
+ liable to You for damages, including any direct, indirect, special,
150
+ incidental, or exemplary damages of any character arising as a
151
+ result of this License or out of the use or inability to use the
152
+ Work (including but not limited to damages for loss of goodwill,
153
+ work stoppage, computer failure or malfunction, or all other
154
+ commercial damages or losses), even if such Contributor has been
155
+ advised of the possibility of such damages.
156
+
157
+ 9. Accepting Warranty or Additional Liability. While redistributing
158
+ the Work or Derivative Works thereof, You may choose to offer,
159
+ and charge a fee for, acceptance of support, warranty, indemnity,
160
+ or other liability obligations and/or rights consistent with this
161
+ License. However, in accepting such obligations, You may offer only
162
+ conditions that are completely consistent with this License.
163
+
164
+ END OF TERMS AND CONDITIONS
165
+
166
+ Copyright 2026 Zosma AI
167
+
168
+ Licensed under the Apache License, Version 2.0 (the "License");
169
+ you may not use this file except in compliance with the License.
170
+ You may obtain a copy of the License at
171
+
172
+ http://www.apache.org/licenses/LICENSE-2.0
173
+
174
+ Unless required by applicable law or agreed to in writing, software
175
+ distributed under the License is distributed on an "AS IS" BASIS,
176
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
177
+ See the License for the specific language governing permissions and
178
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # @zosmaai/zosma-qa-cli
2
+
3
+ Interactive CLI for [zosma-qa](https://github.com/zosmaai/zosma-qa) — the zero-config QA platform.
4
+
5
+ ```bash
6
+ npx zosma-qa init
7
+ ```
8
+
9
+ ## Commands
10
+
11
+ | Command | Description |
12
+ |---|---|
13
+ | `npx zosma-qa init` | Interactive setup — configures baseURL, browsers, and AI agents |
14
+ | `npx zosma-qa run` | Run all tests (delegates to Playwright, all flags forwarded) |
15
+ | `npx zosma-qa run --project firefox` | Run tests in a specific browser |
16
+ | `npx zosma-qa run --grep "checkout"` | Run tests matching a pattern |
17
+ | `npx zosma-qa run --headed` | Run in headed (visible) browser mode |
18
+ | `npx zosma-qa agents init` | Set up Playwright AI agent definitions |
19
+ | `npx zosma-qa report` | Open the HTML test report |
20
+
21
+ ## Quick start
22
+
23
+ ```bash
24
+ # Clone the repo
25
+ git clone https://github.com/zosmaai/zosma-qa.git
26
+ cd zosma-qa
27
+ pnpm install
28
+ npx playwright install
29
+
30
+ # Interactive setup
31
+ npx zosma-qa init
32
+
33
+ # Add your tests to tests/, then run
34
+ npx zosma-qa run
35
+ ```
36
+
37
+ ## AI agents
38
+
39
+ `zosma-qa agents init` sets up Playwright's built-in **planner**, **generator**, and **healer** agents for your AI coding tool:
40
+
41
+ ```bash
42
+ npx zosma-qa agents init
43
+ # Prompts: OpenCode (default) / Claude Code / VS Code (Copilot)
44
+ ```
45
+
46
+ Once configured, prompt your AI tool:
47
+
48
+ ```
49
+ Use the planner agent. Seed: tests/seed.spec.ts.
50
+ Generate a plan for the guest checkout flow.
51
+ ```
52
+
53
+ ## Part of zosma-qa
54
+
55
+ - [`@zosmaai/zosma-qa-core`](https://www.npmjs.com/package/@zosmaai/zosma-qa-core) — shared types and plugin interface
56
+ - [`@zosmaai/zosma-qa-playwright`](https://www.npmjs.com/package/@zosmaai/zosma-qa-playwright) — Playwright runner and base config
57
+ - [`@zosmaai/zosma-qa-cli`](https://www.npmjs.com/package/@zosmaai/zosma-qa-cli) — this package
58
+
59
+ Full documentation: [github.com/zosmaai/zosma-qa](https://github.com/zosmaai/zosma-qa)
60
+
61
+ ## License
62
+
63
+ Apache-2.0
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ // Resolve the compiled CLI entry from dist/
5
+ require('../dist/index.js');
@@ -0,0 +1,9 @@
1
+ import type { AgentLoop } from '@zosmaai/zosma-qa-core';
2
+ /**
3
+ * `zosma-qa agents init` — prompts the user to choose their AI coding tool
4
+ * and runs `npx playwright init-agents --loop=<choice>`.
5
+ *
6
+ * Supports: OpenCode (default), Claude Code, VS Code (Copilot).
7
+ */
8
+ export declare function initAgents(loopOverride?: AgentLoop): Promise<void>;
9
+ //# sourceMappingURL=agents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/commands/agents.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,YAAY,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAuExE"}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.initAgents = initAgents;
7
+ const child_process_1 = require("child_process");
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const prompts_1 = require("@inquirer/prompts");
10
+ /**
11
+ * `zosma-qa agents init` — prompts the user to choose their AI coding tool
12
+ * and runs `npx playwright init-agents --loop=<choice>`.
13
+ *
14
+ * Supports: OpenCode (default), Claude Code, VS Code (Copilot).
15
+ */
16
+ async function initAgents(loopOverride) {
17
+ let loop;
18
+ if (loopOverride) {
19
+ loop = loopOverride;
20
+ }
21
+ else {
22
+ console.log('');
23
+ console.log(chalk_1.default.bold.cyan(' zosma-qa agents') + chalk_1.default.dim(' — Playwright AI agent setup'));
24
+ console.log('');
25
+ console.log(chalk_1.default.dim(' This generates agent definitions that let your AI tool act as a\n' +
26
+ ' Playwright planner, generator, and healer.\n'));
27
+ loop = await (0, prompts_1.select)({
28
+ message: 'Which AI coding tool are you using?',
29
+ choices: [
30
+ {
31
+ name: 'OpenCode (default)',
32
+ value: 'opencode',
33
+ description: 'opencode.ai — the AI coding agent',
34
+ },
35
+ {
36
+ name: 'Claude Code',
37
+ value: 'claude',
38
+ description: 'Anthropic\'s Claude Code CLI (claude.ai/code)',
39
+ },
40
+ {
41
+ name: 'VS Code (Copilot)',
42
+ value: 'vscode',
43
+ description: 'GitHub Copilot agent mode inside VS Code',
44
+ },
45
+ ],
46
+ default: 'opencode',
47
+ });
48
+ }
49
+ console.log('');
50
+ console.log(chalk_1.default.dim(` Running: npx playwright init-agents --loop=${loop}`));
51
+ console.log('');
52
+ const exitCode = await spawnAsync('npx', ['playwright', 'init-agents', `--loop=${loop}`]);
53
+ if (exitCode === 0) {
54
+ console.log('');
55
+ console.log(chalk_1.default.bold.green(' Agent definitions generated!'));
56
+ console.log('');
57
+ console.log(chalk_1.default.dim(' Three agents are now available:\n'));
58
+ console.log(` ${chalk_1.default.bold('🎭 planner')} explores your app and writes a Markdown test plan`);
59
+ console.log(` ${chalk_1.default.bold('🎭 generator')} turns the plan into Playwright test files`);
60
+ console.log(` ${chalk_1.default.bold('🎭 healer')} runs failing tests and repairs them automatically`);
61
+ console.log('');
62
+ console.log(chalk_1.default.dim(' Prompt your AI tool:\n' +
63
+ ` "${chalk_1.default.white('Use the planner agent. Seed: tests/seed.spec.ts')}"\n`));
64
+ }
65
+ else {
66
+ console.log('');
67
+ console.log(chalk_1.default.yellow(' Could not run playwright init-agents.'));
68
+ console.log(chalk_1.default.dim(' Make sure Playwright is installed:\n' +
69
+ ' pnpm install && npx playwright install\n'));
70
+ process.exit(exitCode);
71
+ }
72
+ }
73
+ function spawnAsync(cmd, args) {
74
+ return new Promise((resolve, reject) => {
75
+ const child = (0, child_process_1.spawn)(cmd, args, {
76
+ stdio: 'inherit',
77
+ cwd: process.cwd(),
78
+ env: { ...process.env },
79
+ });
80
+ child.on('close', (code) => resolve(code ?? 1));
81
+ child.on('error', reject);
82
+ });
83
+ }
84
+ //# sourceMappingURL=agents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/commands/agents.ts"],"names":[],"mappings":";;;;;AAWA,gCAuEC;A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,EAAE;QACrC,MAAM,KAAK,GAAG,IAAA,qBAAK,EAAC,GAAG,EAAE,IAAI,EAAE;YAC7B,KAAK,EAAE,SAAS;YAChB,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;YAClB,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE;SACxB,CAAC,CAAC;QACH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;QAChD,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function runInit(): Promise<void>;
2
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AA0DA,wBAAsB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CA+I7C"}
@@ -0,0 +1,191 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.runInit = runInit;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const child_process_1 = require("child_process");
10
+ const chalk_1 = __importDefault(require("chalk"));
11
+ const ora_1 = __importDefault(require("ora"));
12
+ const prompts_1 = require("@inquirer/prompts");
13
+ // ─── Template content ─────────────────────────────────────────────────────────
14
+ function seedSpecTemplate(baseURL) {
15
+ return `import { test, expect } from '@playwright/test';
16
+
17
+ /**
18
+ * seed.spec.ts — entry point for Playwright AI agents.
19
+ *
20
+ * This test bootstraps the page context that the planner, generator,
21
+ * and healer agents use as their starting point.
22
+ *
23
+ * How to use with agents:
24
+ * npx zosma-qa agents init # set up agent definitions
25
+ * # Then prompt your AI tool:
26
+ * # "Use the planner agent. Seed: tests/seed.spec.ts"
27
+ */
28
+ test('seed', async ({ page }) => {
29
+ await page.goto('${baseURL}');
30
+ await expect(page).toHaveTitle(/.+/);
31
+ });
32
+ `;
33
+ }
34
+ function playwrightConfigTemplate(baseURL, browsers) {
35
+ const browsersJson = JSON.stringify(browsers);
36
+ return `import { defineConfig } from '@zosmaai/zosma-qa-playwright';
37
+
38
+ export default defineConfig({
39
+ use: {
40
+ baseURL: '${baseURL}',
41
+ },
42
+ browsers: ${browsersJson},
43
+ });
44
+ `;
45
+ }
46
+ function zosmaConfigTemplate(baseURL, browsers) {
47
+ const browsersJson = JSON.stringify(browsers);
48
+ return `import { defineConfig } from '@zosmaai/zosma-qa-core';
49
+
50
+ export default defineConfig({
51
+ plugins: ['playwright'],
52
+ baseURL: '${baseURL}',
53
+ browsers: ${browsersJson},
54
+ });
55
+ `;
56
+ }
57
+ // ─── Main init command ────────────────────────────────────────────────────────
58
+ async function runInit() {
59
+ const cwd = process.cwd();
60
+ console.log('');
61
+ console.log(chalk_1.default.bold.cyan(' zosma-qa') + chalk_1.default.dim(' — zero-config QA platform'));
62
+ console.log('');
63
+ // ── Gather inputs ──────────────────────────────────────────────────────────
64
+ const baseURL = await (0, prompts_1.input)({
65
+ message: 'Base URL of the app under test:',
66
+ default: 'http://localhost:3000',
67
+ validate: (v) => (v.startsWith('http') ? true : 'Must start with http:// or https://'),
68
+ });
69
+ const browsers = await (0, prompts_1.checkbox)({
70
+ message: 'Which browsers to test? (space to select)',
71
+ choices: [
72
+ { name: 'Chromium (recommended)', value: 'chromium', checked: true },
73
+ { name: 'Firefox', value: 'firefox', checked: false },
74
+ { name: 'WebKit (Safari)', value: 'webkit', checked: false },
75
+ ],
76
+ validate: (v) => (v.length > 0 ? true : 'Select at least one browser'),
77
+ });
78
+ const agentLoop = await (0, prompts_1.select)({
79
+ message: 'Set up AI agents for test generation?',
80
+ choices: [
81
+ {
82
+ name: 'OpenCode (default)',
83
+ value: 'opencode',
84
+ description: 'Initialise agent definitions for the OpenCode AI coding tool',
85
+ },
86
+ {
87
+ name: 'Claude Code',
88
+ value: 'claude',
89
+ description: 'Initialise agent definitions for Claude Code (claude.ai/code)',
90
+ },
91
+ {
92
+ name: 'VS Code (Copilot)',
93
+ value: 'vscode',
94
+ description: 'Initialise agent definitions for GitHub Copilot in VS Code',
95
+ },
96
+ {
97
+ name: 'Skip for now',
98
+ value: 'skip',
99
+ description: 'You can always run `npx zosma-qa agents init` later',
100
+ },
101
+ ],
102
+ default: 'opencode',
103
+ });
104
+ console.log('');
105
+ // ── Scaffold files ─────────────────────────────────────────────────────────
106
+ const spinner = (0, ora_1.default)();
107
+ // tests/
108
+ const testsDir = path_1.default.join(cwd, 'tests');
109
+ ensureDir(testsDir);
110
+ const seedPath = path_1.default.join(testsDir, 'seed.spec.ts');
111
+ if (!fs_1.default.existsSync(seedPath)) {
112
+ fs_1.default.writeFileSync(seedPath, seedSpecTemplate(baseURL), 'utf8');
113
+ spinner.succeed(chalk_1.default.green(`Created tests/seed.spec.ts`));
114
+ }
115
+ else {
116
+ spinner.info(chalk_1.default.dim(`Skipped tests/seed.spec.ts (already exists)`));
117
+ spinner.stop();
118
+ }
119
+ // specs/
120
+ const specsDir = path_1.default.join(cwd, 'specs');
121
+ ensureDir(specsDir);
122
+ const specsKeep = path_1.default.join(specsDir, '.gitkeep');
123
+ if (!fs_1.default.existsSync(specsKeep)) {
124
+ fs_1.default.writeFileSync(specsKeep, '', 'utf8');
125
+ }
126
+ spinner.succeed(chalk_1.default.green(`Created specs/ (AI planner writes test plans here)`));
127
+ // playwright.config.ts
128
+ const pwConfigPath = path_1.default.join(cwd, 'playwright.config.ts');
129
+ if (!fs_1.default.existsSync(pwConfigPath)) {
130
+ fs_1.default.writeFileSync(pwConfigPath, playwrightConfigTemplate(baseURL, browsers), 'utf8');
131
+ spinner.succeed(chalk_1.default.green(`Created playwright.config.ts`));
132
+ }
133
+ else {
134
+ spinner.info(chalk_1.default.dim(`Skipped playwright.config.ts (already exists)`));
135
+ spinner.stop();
136
+ }
137
+ // zosma.config.ts
138
+ const zosmaConfigPath = path_1.default.join(cwd, 'zosma.config.ts');
139
+ if (!fs_1.default.existsSync(zosmaConfigPath)) {
140
+ fs_1.default.writeFileSync(zosmaConfigPath, zosmaConfigTemplate(baseURL, browsers), 'utf8');
141
+ spinner.succeed(chalk_1.default.green(`Created zosma.config.ts`));
142
+ }
143
+ else {
144
+ spinner.info(chalk_1.default.dim(`Skipped zosma.config.ts (already exists)`));
145
+ spinner.stop();
146
+ }
147
+ // .github/agents/
148
+ const agentsDir = path_1.default.join(cwd, '.github', 'agents');
149
+ ensureDir(path_1.default.join(cwd, '.github'));
150
+ ensureDir(agentsDir);
151
+ const agentsKeep = path_1.default.join(agentsDir, '.gitkeep');
152
+ if (!fs_1.default.existsSync(agentsKeep)) {
153
+ fs_1.default.writeFileSync(agentsKeep, '', 'utf8');
154
+ }
155
+ // ── Run playwright init-agents ─────────────────────────────────────────────
156
+ if (agentLoop !== 'skip') {
157
+ console.log('');
158
+ const agentSpinner = (0, ora_1.default)(`Running: npx playwright init-agents --loop=${agentLoop}`).start();
159
+ try {
160
+ await spawnAsync('npx', ['playwright', 'init-agents', `--loop=${agentLoop}`], cwd);
161
+ agentSpinner.succeed(chalk_1.default.green(`Agent definitions written to .github/agents/ (loop: ${agentLoop})`));
162
+ }
163
+ catch (err) {
164
+ agentSpinner.warn(chalk_1.default.yellow(`Could not run playwright init-agents. Run manually:\n` +
165
+ ` npx playwright install && npx playwright init-agents --loop=${agentLoop}`));
166
+ }
167
+ }
168
+ // ── Summary ────────────────────────────────────────────────────────────────
169
+ console.log('');
170
+ console.log(chalk_1.default.bold.green(' Ready!') + ' Here\'s what to do next:\n');
171
+ console.log(` ${chalk_1.default.cyan('npx zosma-qa run')} run your tests`);
172
+ console.log(` ${chalk_1.default.cyan('npx zosma-qa agents init')} re-run agent setup for a different AI tool`);
173
+ console.log(` ${chalk_1.default.cyan('npx zosma-qa report')} open the HTML report`);
174
+ console.log('');
175
+ console.log(chalk_1.default.dim(` Tip: open ${chalk_1.default.white('tests/seed.spec.ts')} and prompt your AI agent:\n` +
176
+ ` "Use the planner agent. Seed: tests/seed.spec.ts"\n`));
177
+ }
178
+ // ─── Utilities ────────────────────────────────────────────────────────────────
179
+ function ensureDir(dir) {
180
+ if (!fs_1.default.existsSync(dir)) {
181
+ fs_1.default.mkdirSync(dir, { recursive: true });
182
+ }
183
+ }
184
+ function spawnAsync(cmd, args, cwd) {
185
+ return new Promise((resolve, reject) => {
186
+ const child = (0, child_process_1.spawn)(cmd, args, { stdio: 'inherit', cwd });
187
+ child.on('close', (code) => (code === 0 ? resolve() : reject(new Error(`exit ${code}`))));
188
+ child.on('error', reject);
189
+ });
190
+ }
191
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":";;;;;AA0DA,0BA+IC;AAzMD,4CAAoB;AACpB,gDAAwB;AACxB,iDAAsC;AACtC,kDAA0B;AAC1B,8CAAsB;AACtB,+CAAqE;AAGrE,iFAAiF;AAEjF,SAAS,gBAAgB,CAAC,OAAe;IACvC,OAAO;;;;;;;;;;;;;;qBAcY,OAAO;;;CAG3B,CAAC;AACF,CAAC;AAED,SAAS,wBAAwB,CAAC,OAAe,EAAE,QAAmB;IACpE,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC9C,OAAO;;;;gBAIO,OAAO;;cAET,YAAY;;CAEzB,CAAC;AACF,CAAC;AAED,SAAS,mBAAmB,CAAC,OAAe,EAAE,QAAmB;IAC/D,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC9C,OAAO;;;;cAIK,OAAO;cACP,YAAY;;CAEzB,CAAC;AACF,CAAC;AAED,iFAAiF;AAE1E,KAAK,UAAU,OAAO;I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CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * `zosma-qa report` — opens the Playwright HTML report in the default browser.
3
+ */
4
+ export declare function openReport(): Promise<void>;
5
+ //# sourceMappingURL=report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/commands/report.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAYhD"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.openReport = openReport;
7
+ const child_process_1 = require("child_process");
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ /**
10
+ * `zosma-qa report` — opens the Playwright HTML report in the default browser.
11
+ */
12
+ async function openReport() {
13
+ console.log('');
14
+ console.log(chalk_1.default.bold.cyan(' zosma-qa') + chalk_1.default.dim(' opening HTML report…'));
15
+ console.log('');
16
+ const exitCode = await spawnAsync('npx', ['playwright', 'show-report']);
17
+ if (exitCode !== 0) {
18
+ console.log(chalk_1.default.yellow('\n No report found. Run tests first:'));
19
+ console.log(chalk_1.default.dim(' npx zosma-qa run\n'));
20
+ process.exit(exitCode);
21
+ }
22
+ }
23
+ function spawnAsync(cmd, args) {
24
+ return new Promise((resolve, reject) => {
25
+ const child = (0, child_process_1.spawn)(cmd, args, {
26
+ stdio: 'inherit',
27
+ cwd: process.cwd(),
28
+ env: { ...process.env },
29
+ });
30
+ child.on('close', (code) => resolve(code ?? 1));
31
+ child.on('error', reject);
32
+ });
33
+ }
34
+ //# sourceMappingURL=report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/commands/report.ts"],"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AC"}
@@ -0,0 +1,15 @@
1
+ export interface RunOptions {
2
+ project?: string;
3
+ grep?: string;
4
+ headed?: boolean;
5
+ debug?: boolean;
6
+ workers?: string;
7
+ shard?: string;
8
+ reporter?: string;
9
+ }
10
+ /**
11
+ * `zosma-qa run` — delegates to `npx playwright test` with all flags
12
+ * forwarded so the full Playwright feature set remains available.
13
+ */
14
+ export declare function runTests(options?: RunOptions): Promise<void>;
15
+ //# sourceMappingURL=run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBtE"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.runTests = runTests;
7
+ const child_process_1 = require("child_process");
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ /**
10
+ * `zosma-qa run` — delegates to `npx playwright test` with all flags
11
+ * forwarded so the full Playwright feature set remains available.
12
+ */
13
+ async function runTests(options = {}) {
14
+ const args = buildArgs(options);
15
+ console.log('');
16
+ console.log(chalk_1.default.bold.cyan(' zosma-qa') +
17
+ chalk_1.default.dim(' running: ') +
18
+ chalk_1.default.white(`npx playwright ${args.join(' ')}`));
19
+ console.log('');
20
+ const exitCode = await spawnPlaywright(args);
21
+ if (exitCode !== 0) {
22
+ console.log('');
23
+ console.log(chalk_1.default.dim(` View the report: `) + chalk_1.default.cyan('npx zosma-qa report'));
24
+ process.exit(exitCode);
25
+ }
26
+ }
27
+ // ─── helpers ──────────────────────────────────────────────────────────────────
28
+ function buildArgs(options) {
29
+ const args = ['test'];
30
+ if (options.project)
31
+ args.push('--project', options.project);
32
+ if (options.grep)
33
+ args.push('--grep', options.grep);
34
+ if (options.headed)
35
+ args.push('--headed');
36
+ if (options.debug)
37
+ args.push('--debug');
38
+ if (options.workers)
39
+ args.push('--workers', options.workers);
40
+ if (options.shard)
41
+ args.push('--shard', options.shard);
42
+ if (options.reporter)
43
+ args.push('--reporter', options.reporter);
44
+ return args;
45
+ }
46
+ function spawnPlaywright(args) {
47
+ return new Promise((resolve, reject) => {
48
+ const child = (0, child_process_1.spawn)('npx', ['playwright', ...args], {
49
+ stdio: 'inherit',
50
+ cwd: process.cwd(),
51
+ env: { ...process.env },
52
+ });
53
+ child.on('close', (code) => resolve(code ?? 1));
54
+ child.on('error', reject);
55
+ });
56
+ }
57
+ //# sourceMappingURL=run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":";;;;;AAiBA,4BAoBC;AArCD,iDAAsC;AACtC,kDAA0B;AAY1B;;;GAGG;AACI,KAAK,UAAU,QAAQ,CAAC,UAAsB,EAAE;IACrD,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAEhC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CACT,eAAK,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;QAC3B,eAAK,CAAC,GAAG,CAAC,aAAa,CAAC;QACxB,eAAK,CAAC,KAAK,CAAC,kBAAkB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAClD,CAAC;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IACrC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,KAAK,GAAG,IAAA,qBAAK,EAAC,KAAK,EAAE,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC,EAAE;YAClD,KAAK,EAAE,SAAS;YAChB,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;YAClB,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE;SACxB,CAAC,CAAC;QAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;QAChD,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const commander_1 = require("commander");
4
+ const init_1 = require("./commands/init");
5
+ const run_1 = require("./commands/run");
6
+ const agents_1 = require("./commands/agents");
7
+ const report_1 = require("./commands/report");
8
+ const program = new commander_1.Command();
9
+ program
10
+ .name('zosma-qa')
11
+ .description('Zero-config QA platform — Playwright, AI agents, and more')
12
+ .version('0.1.0');
13
+ // ─── init ─────────────────────────────────────────────────────────────────────
14
+ program
15
+ .command('init')
16
+ .description('Scaffold tests/, specs/, playwright.config.ts and set up AI agents')
17
+ .action(async () => {
18
+ await (0, init_1.runInit)();
19
+ });
20
+ // ─── run ──────────────────────────────────────────────────────────────────────
21
+ program
22
+ .command('run')
23
+ .description('Run all Playwright tests (delegates to npx playwright test)')
24
+ .option('-p, --project <name>', 'Run a specific Playwright project (browser)')
25
+ .option('-g, --grep <pattern>', 'Only run tests matching this pattern')
26
+ .option('--headed', 'Run tests in headed (visible) browser mode')
27
+ .option('--debug', 'Run tests in Playwright debug mode')
28
+ .option('-w, --workers <n>', 'Number of parallel workers')
29
+ .option('--shard <shard>', 'Shard tests (e.g. 1/3)')
30
+ .option('--reporter <reporter>', 'Override reporter (e.g. list, dot, html)')
31
+ .action(async (options) => {
32
+ await (0, run_1.runTests)(options);
33
+ });
34
+ // ─── agents ───────────────────────────────────────────────────────────────────
35
+ const agentsCmd = program
36
+ .command('agents')
37
+ .description('Manage Playwright AI agent definitions');
38
+ agentsCmd
39
+ .command('init')
40
+ .description('Generate Playwright AI agent definitions for your AI coding tool')
41
+ .option('--loop <loop>', 'AI loop to use: opencode | claude | vscode')
42
+ .action(async (options) => {
43
+ await (0, agents_1.initAgents)(options.loop);
44
+ });
45
+ // ─── report ───────────────────────────────────────────────────────────────────
46
+ program
47
+ .command('report')
48
+ .description('Open the latest Playwright HTML report in the browser')
49
+ .action(async () => {
50
+ await (0, report_1.openReport)();
51
+ });
52
+ // ─── fallback ─────────────────────────────────────────────────────────────────
53
+ program.parse(process.argv);
54
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,yCAAoC;AACpC,0CAA0C;AAC1C,wCAA0C;AAC1C,8CAA+C;AAC/C,8CAA+C;AAE/C,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,UAAU,CAAC;KAChB,WAAW,CAAC,2DAA2D,CAAC;KACxE,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,iFAAiF;AAEjF,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,oEAAoE,CAAC;KACjF,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,IAAA,cAAO,GAAE,CAAC;AAClB,CAAC,C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"@zosmaai/zosma-qa-cli",
3
+ "version": "0.0.4",
4
+ "description": "CLI for zosma-qa — zero-config QA platform",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/zosmaai/zosma-qa.git",
9
+ "directory": "packages/cli"
10
+ },
11
+ "homepage": "https://github.com/zosmaai/zosma-qa#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/zosmaai/zosma-qa/issues"
14
+ },
15
+ "keywords": [
16
+ "playwright",
17
+ "testing",
18
+ "qa",
19
+ "e2e",
20
+ "cli",
21
+ "zero-config",
22
+ "ai-agents"
23
+ ],
24
+ "main": "dist/index.js",
25
+ "types": "dist/index.d.ts",
26
+ "bin": {
27
+ "zosma-qa": "bin/zosma-qa.js"
28
+ },
29
+ "files": [
30
+ "dist",
31
+ "bin"
32
+ ],
33
+ "dependencies": {
34
+ "@inquirer/prompts": "^7.0.0",
35
+ "chalk": "^5.3.0",
36
+ "commander": "^12.1.0",
37
+ "ora": "^8.1.1",
38
+ "@zosmaai/zosma-qa-playwright": "0.0.4",
39
+ "@zosmaai/zosma-qa-core": "0.0.4"
40
+ },
41
+ "devDependencies": {
42
+ "@types/node": "^20.0.0",
43
+ "typescript": "^5.4.0"
44
+ },
45
+ "scripts": {
46
+ "build": "tsc --project tsconfig.json",
47
+ "typecheck": "tsc --noEmit",
48
+ "clean": "rm -rf dist *.tsbuildinfo"
49
+ }
50
+ }