qa 0.0.33 → 0.17.0
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/README.md +41 -25
- package/cli.cjs +52 -0
- package/package.json +24 -44
- package/LICENSE +0 -201
- package/assets/logo.png +0 -0
- package/bin/qa.js +0 -5
- package/dist/api/index.d.ts +0 -3
- package/dist/api/index.js +0 -103
- package/dist/auth.d.ts +0 -2
- package/dist/auth.js +0 -28
- package/dist/commands/index.d.ts +0 -3
- package/dist/commands/index.js +0 -5
- package/dist/commands/init.d.ts +0 -19
- package/dist/commands/init.js +0 -48
- package/dist/commands/login.d.ts +0 -20
- package/dist/commands/login.js +0 -67
- package/dist/commands/start.d.ts +0 -19
- package/dist/commands/start.js +0 -34
- package/dist/commands/test.d.ts +0 -42
- package/dist/commands/test.js +0 -45
- package/dist/commands/types.d.ts +0 -5
- package/dist/commands/types.js +0 -1
- package/dist/commands/utils/index.d.ts +0 -16
- package/dist/commands/utils/index.js +0 -59
- package/dist/commands/utils/nodeVersion.d.ts +0 -2
- package/dist/commands/utils/nodeVersion.js +0 -24
- package/dist/commands/utils/prompts.d.ts +0 -19
- package/dist/commands/utils/prompts.js +0 -236
- package/dist/constants.d.ts +0 -6
- package/dist/constants.js +0 -12
- package/dist/ide/index.d.ts +0 -8
- package/dist/ide/index.js +0 -184
- package/dist/ide/utils.d.ts +0 -19
- package/dist/ide/utils.js +0 -102
- package/dist/index.d.ts +0 -10
- package/dist/index.js +0 -24
- package/dist/reporter.d.ts +0 -8
- package/dist/reporter.js +0 -24
- package/dist/ui/index.d.ts +0 -3
- package/dist/ui/index.js +0 -29
package/README.md
CHANGED
|
@@ -1,38 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
<img src="./assets/logo.png">
|
|
3
|
-
</center>
|
|
1
|
+
# qa
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
<h1>VollQ CLI</h1>
|
|
7
|
-
</center>
|
|
3
|
+
Run Momentic's Mo agent from your terminal.
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
<a href="https://npmjs.com/package/qa"><img src="https://img.shields.io/npm/v/qa?style=flat&colorA=080f12&colorB=1fa669"></a>
|
|
11
|
-
<a href="https://npmjs.com/package/qa"><img src="https://img.shields.io/npm/dm/qa?style=flat&colorA=080f12&colorB=1fa669"></a>
|
|
12
|
-
<a href="https://bundlephobia.com/result?p=oat"><img src="https://img.shields.io/bundlephobia/minzip/qa?style=flat&colorA=080f12&colorB=1fa669&label=minzip"></a>
|
|
13
|
-
<!-- <a href="https://github.com/vollq-ai/qa/blob/main/LICENSE"><img src="https://img.shields.io/github/license/vollq-ai/qa.svg?style=flat&colorA=080f12&colorB=1fa669"></a> -->
|
|
14
|
-
</div>
|
|
5
|
+
## Install
|
|
15
6
|
|
|
16
|
-
|
|
7
|
+
Install the CLI globally:
|
|
17
8
|
|
|
18
|
-
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g qa
|
|
11
|
+
qa --help
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Or run it without a global install:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npx qa --help
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The npm package is `qa`. It installs a compiled `mo` binary for your system and
|
|
21
|
+
exposes both `qa` and `mo` commands. Both commands show `qa` in help when
|
|
22
|
+
installed through npm. The standalone installer uses `mo` in help.
|
|
23
|
+
|
|
24
|
+
The npm launcher requires Node.js 22.12 or later in the 22.x series, or Node.js
|
|
25
|
+
24 or later. Binaries are available for macOS ARM64/x64, Linux ARM64/x64 (glibc
|
|
26
|
+
and musl), and Windows x64. Linux musl requires `libstdc++`. Keep optional
|
|
27
|
+
dependencies enabled so npm can install your system's binary.
|
|
19
28
|
|
|
20
|
-
|
|
29
|
+
## Authentication
|
|
21
30
|
|
|
22
|
-
|
|
23
|
-
|
|
31
|
+
Sign in once to share credentials with the Momentic CLIs:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
qa login
|
|
35
|
+
qa logout
|
|
24
36
|
```
|
|
25
37
|
|
|
26
|
-
|
|
38
|
+
Credentials are saved to `~/.momentic/auth.json`. Existing credentials from
|
|
39
|
+
`momentic login` or `momentic-wizard login` are reused automatically. You can
|
|
40
|
+
also provide `MOMENTIC_API_KEY` or `--api-key` for a single command.
|
|
41
|
+
|
|
42
|
+
## Update
|
|
27
43
|
|
|
28
|
-
|
|
44
|
+
Update a global npm installation with:
|
|
29
45
|
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
qa init # initiate API or browser testing for your project
|
|
33
|
-
qa test <PROJECT> # run an API or browser test
|
|
46
|
+
```bash
|
|
47
|
+
npm install -g qa@latest
|
|
34
48
|
```
|
|
35
49
|
|
|
36
|
-
|
|
50
|
+
For a project dependency, update `qa` with your project's package manager.
|
|
51
|
+
`qa upgrade` prints these instructions without replacing npm-managed files.
|
|
37
52
|
|
|
38
|
-
|
|
53
|
+
See the [Mo CLI reference](https://docs.momentic.ai/cli-reference/mo/overview)
|
|
54
|
+
for commands and examples. The reference's `mo` commands also work with `qa`.
|
package/cli.cjs
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require("node:child_process");
|
|
4
|
+
|
|
5
|
+
const os = process.platform === "win32" ? "windows" : process.platform;
|
|
6
|
+
const report = os === "linux" ? process.report.getReport() : undefined;
|
|
7
|
+
const header =
|
|
8
|
+
typeof report === "object" && report && "header" in report
|
|
9
|
+
? report.header
|
|
10
|
+
: undefined;
|
|
11
|
+
const libc =
|
|
12
|
+
os === "linux" &&
|
|
13
|
+
!(typeof header === "object" && header && "glibcVersionRuntime" in header)
|
|
14
|
+
? "-musl"
|
|
15
|
+
: "";
|
|
16
|
+
const target = `${os}-${process.arch}${libc}`;
|
|
17
|
+
const packageName = `@momentic/qa-${target}`;
|
|
18
|
+
const executable = process.platform === "win32" ? "mo.exe" : "mo";
|
|
19
|
+
|
|
20
|
+
let binary;
|
|
21
|
+
try {
|
|
22
|
+
binary = require.resolve(`${packageName}/bin/${executable}`);
|
|
23
|
+
} catch {
|
|
24
|
+
console.error(
|
|
25
|
+
`Cannot find the mo binary for ${target}. Reinstall qa with optional dependencies enabled (npm install --include=optional qa). See https://docs.momentic.ai/cli-reference/mo/overview for supported platforms.`,
|
|
26
|
+
);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const child = spawn(binary, process.argv.slice(2), {
|
|
31
|
+
stdio: "inherit",
|
|
32
|
+
env: { ...process.env, MOMENTIC_MO_INSTALL_METHOD: "npm" },
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
/** @type {NodeJS.Signals[]} */
|
|
36
|
+
const signals = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
37
|
+
for (const signal of signals) {
|
|
38
|
+
process.on(signal, () => child.kill(signal));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
child.on("error", (err) => {
|
|
42
|
+
console.error(`Could not start mo: ${err.message}`);
|
|
43
|
+
process.exitCode = 1;
|
|
44
|
+
});
|
|
45
|
+
child.on("exit", (code, signal) => {
|
|
46
|
+
if (signal) {
|
|
47
|
+
process.removeAllListeners(signal);
|
|
48
|
+
process.kill(process.pid, signal);
|
|
49
|
+
} else {
|
|
50
|
+
process.exitCode = code ?? 1;
|
|
51
|
+
}
|
|
52
|
+
});
|
package/package.json
CHANGED
|
@@ -1,51 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qa",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"license": "Apache-2.0",
|
|
7
|
-
"type": "module",
|
|
3
|
+
"version": "0.17.0",
|
|
4
|
+
"description": "The mo CLI for Momentic's autonomous QA agent",
|
|
5
|
+
"private": false,
|
|
8
6
|
"bin": {
|
|
9
|
-
"qa": "./
|
|
7
|
+
"qa": "./cli.cjs",
|
|
8
|
+
"mo": "./cli.cjs"
|
|
10
9
|
},
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
"@wdio/utils": "^9.6.4",
|
|
19
|
-
"fastify": "^5.2.1",
|
|
20
|
-
"get-port": "^7.1.0",
|
|
21
|
-
"openapi-types": "^12.1.3",
|
|
22
|
-
"picocolors": "^1.1.1",
|
|
23
|
-
"tap-mocha-reporter": "^5.0.4",
|
|
24
|
-
"uuid": "^11.0.3",
|
|
25
|
-
"ws": "^8.18.0",
|
|
26
|
-
"yargs": "^17.7.2",
|
|
27
|
-
"webdriverio": "^9.6.4",
|
|
28
|
-
"@vollq/contracts": "0.0.13",
|
|
29
|
-
"localdriver": "0.0.4",
|
|
30
|
-
"neuralspec": "0.0.5",
|
|
31
|
-
"@vollq/ide": "0.0.8"
|
|
10
|
+
"files": [
|
|
11
|
+
"cli.cjs"
|
|
12
|
+
],
|
|
13
|
+
"repository": "github:momentic-ai/qa",
|
|
14
|
+
"homepage": "https://github.com/momentic-ai/qa",
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
32
17
|
},
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
"@types/yargs": "^17.0.32",
|
|
37
|
-
"replace-in-files-cli": "^3.0.0",
|
|
38
|
-
"typescript": "^5.6.3",
|
|
39
|
-
"vitest": "^2.1.8"
|
|
18
|
+
"type": "module",
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": "^22.12.0 || >=24.0.0"
|
|
40
21
|
},
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"test.unit": "echo \"Error: no test specified\" && exit 0"
|
|
22
|
+
"optionalDependencies": {
|
|
23
|
+
"@momentic/qa-darwin-arm64": "0.17.0",
|
|
24
|
+
"@momentic/qa-darwin-x64": "0.17.0",
|
|
25
|
+
"@momentic/qa-linux-arm64": "0.17.0",
|
|
26
|
+
"@momentic/qa-linux-arm64-musl": "0.17.0",
|
|
27
|
+
"@momentic/qa-linux-x64": "0.17.0",
|
|
28
|
+
"@momentic/qa-linux-x64-musl": "0.17.0",
|
|
29
|
+
"@momentic/qa-windows-x64": "0.17.0"
|
|
50
30
|
}
|
|
51
|
-
}
|
|
31
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
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, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright 2025 VollQ
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|
package/assets/logo.png
DELETED
|
Binary file
|
package/bin/qa.js
DELETED
package/dist/api/index.d.ts
DELETED
package/dist/api/index.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import WebSocket from 'ws';
|
|
2
|
-
import { CLIReporter } from '../reporter.js';
|
|
3
|
-
import { WORKER_URL, PLATFORM_URL } from '../constants.js';
|
|
4
|
-
const PROBLEMATIC_ERROR_CODES = ['ECONNREFUSED', 'ECONNRESET', 'EPIPE', 'ETIMEDOUT'];
|
|
5
|
-
const WORKER_ENDPOINT = `http${WORKER_URL.slice(2)}/api`;
|
|
6
|
-
export async function runAPITest(token, argv) {
|
|
7
|
-
const { sessionId } = await initiateSession(token, argv.project);
|
|
8
|
-
await runTest(sessionId);
|
|
9
|
-
const { passed } = await deleteSession(token, sessionId);
|
|
10
|
-
console.log(`\n➡️ See more test details at ${PLATFORM_URL}/api-testing/tests/${sessionId}`);
|
|
11
|
-
process.exit(passed ? 0 : 1);
|
|
12
|
-
}
|
|
13
|
-
async function initiateSession(token, testId) {
|
|
14
|
-
try {
|
|
15
|
-
const res = await fetch(WORKER_ENDPOINT, {
|
|
16
|
-
method: 'POST',
|
|
17
|
-
headers: {
|
|
18
|
-
'Content-Type': 'application/json',
|
|
19
|
-
Authorization: token
|
|
20
|
-
},
|
|
21
|
-
body: JSON.stringify({ testId })
|
|
22
|
-
});
|
|
23
|
-
if (!res.ok || res.status !== 200) {
|
|
24
|
-
const error = await res.json();
|
|
25
|
-
if (res.statusText === 'Unauthorized') {
|
|
26
|
-
throw new Error('\n🚨 Failed to authenticate with the platform, please login, via:\n\n' +
|
|
27
|
-
' > qa login\n\n' +
|
|
28
|
-
'If you are already logged in, please check if the token is correct.\n' +
|
|
29
|
-
'More information can be found at: https://docs.vollq.ai/cli\n');
|
|
30
|
-
}
|
|
31
|
-
throw new Error(`Failed to initiate session: ${res.statusText}: ${error.message}`);
|
|
32
|
-
}
|
|
33
|
-
return await res.json();
|
|
34
|
-
}
|
|
35
|
-
catch (err) {
|
|
36
|
-
const error = err instanceof Error ? err : new Error('Unknown error');
|
|
37
|
-
if (error.message === 'fetch failed') {
|
|
38
|
-
console.error('⚠️ Failed to connect to the platform!\n' +
|
|
39
|
-
'Please check your internet connection and try again.\n\n' +
|
|
40
|
-
'If the problem persists, please let us know at: support@vollq.ai');
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
console.error(error.message);
|
|
44
|
-
}
|
|
45
|
-
process.exit(1);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
async function runTest(sessionId) {
|
|
49
|
-
const workerUrl = `${WORKER_URL}/api/${sessionId}`;
|
|
50
|
-
const ws = new WebSocket(workerUrl);
|
|
51
|
-
ws.on('error', (error) => {
|
|
52
|
-
if ('code' in error && PROBLEMATIC_ERROR_CODES.includes(error.code)) {
|
|
53
|
-
console.error(`⚠️ Failed to connect to worker at ${workerUrl}: ${error.code}!\n` +
|
|
54
|
-
'This is unexpected, we apologize for the inconvenience!\n' +
|
|
55
|
-
'Please send us a message and let us know at: support@vollq.ai\n\n' +
|
|
56
|
-
'Thank you! 🙏');
|
|
57
|
-
process.exit(1);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
console.error(error);
|
|
61
|
-
});
|
|
62
|
-
const reporter = new CLIReporter();
|
|
63
|
-
await new Promise((resolve, reject) => {
|
|
64
|
-
ws.on('message', function message(data) {
|
|
65
|
-
try {
|
|
66
|
-
const msg = JSON.parse(data.toString());
|
|
67
|
-
if (msg.type === 'error') {
|
|
68
|
-
return reject(new Error(msg.error));
|
|
69
|
-
}
|
|
70
|
-
if (msg.type === 'log') {
|
|
71
|
-
return reporter.emitEvent(msg.payload);
|
|
72
|
-
}
|
|
73
|
-
if (msg.type === 'end') {
|
|
74
|
-
reporter.end();
|
|
75
|
-
return resolve(null);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
catch (err) {
|
|
79
|
-
const error = err instanceof Error ? err : new Error('Unknown error');
|
|
80
|
-
return reject(new Error(`Uups! Something went wrong: ${error.message}`));
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
async function deleteSession(token, sessionId) {
|
|
86
|
-
try {
|
|
87
|
-
const res = await fetch(`${WORKER_ENDPOINT}/${sessionId}`, {
|
|
88
|
-
method: 'DELETE',
|
|
89
|
-
headers: {
|
|
90
|
-
Authorization: token
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
if (!res.ok || res.status !== 200) {
|
|
94
|
-
throw new Error(`Failed to delete session: ${res.statusText}`);
|
|
95
|
-
}
|
|
96
|
-
return await res.json();
|
|
97
|
-
}
|
|
98
|
-
catch (err) {
|
|
99
|
-
const error = err instanceof Error ? err : new Error('Unknown error');
|
|
100
|
-
console.error(`Failed to delete session: ${error.message}`);
|
|
101
|
-
return { passed: false };
|
|
102
|
-
}
|
|
103
|
-
}
|
package/dist/auth.d.ts
DELETED
package/dist/auth.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs/promises';
|
|
2
|
-
import { intro } from '@clack/prompts';
|
|
3
|
-
import { askForUserAuth } from './commands/utils/prompts.js';
|
|
4
|
-
import { TOKEN_PATH } from './constants.js';
|
|
5
|
-
export async function getAccessToken(tokenParam, ensureAuth) {
|
|
6
|
-
if (tokenParam) {
|
|
7
|
-
return tokenParam;
|
|
8
|
-
}
|
|
9
|
-
const envVar = process.env.VOLLQ_TOKEN;
|
|
10
|
-
if (envVar) {
|
|
11
|
-
return envVar;
|
|
12
|
-
}
|
|
13
|
-
const hasAccess = await fs.access(TOKEN_PATH).then(() => true).catch(() => false);
|
|
14
|
-
if (!hasAccess) {
|
|
15
|
-
if (ensureAuth) {
|
|
16
|
-
intro('Log into VollQ');
|
|
17
|
-
return askForUserAuth();
|
|
18
|
-
}
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
21
|
-
const rc = await fs.readFile(TOKEN_PATH, 'utf-8');
|
|
22
|
-
const token = rc.split('\n').filter(Boolean).find((line) => line.startsWith('token='))?.split('=')[1];
|
|
23
|
-
if (!token && ensureAuth) {
|
|
24
|
-
intro('Log into VollQ');
|
|
25
|
-
return askForUserAuth();
|
|
26
|
-
}
|
|
27
|
-
return token;
|
|
28
|
-
}
|
package/dist/commands/index.d.ts
DELETED
package/dist/commands/index.js
DELETED
package/dist/commands/init.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Argv } from 'yargs';
|
|
2
|
-
export declare const command = "init [option]";
|
|
3
|
-
export declare const desc = "Create a new VollQ project";
|
|
4
|
-
export declare const cmdArgs: {
|
|
5
|
-
readonly token: {
|
|
6
|
-
readonly alias: "t";
|
|
7
|
-
readonly desc: "Provide an access token to authenticate with the platform";
|
|
8
|
-
readonly type: "string";
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export declare const builder: (yargs: Argv) => Argv<import("yargs").Omit<{}, "token"> & import("yargs").InferredOptionTypes<{
|
|
12
|
-
readonly token: {
|
|
13
|
-
readonly alias: "t";
|
|
14
|
-
readonly desc: "Provide an access token to authenticate with the platform";
|
|
15
|
-
readonly type: "string";
|
|
16
|
-
};
|
|
17
|
-
}>>;
|
|
18
|
-
export declare const handler: (argv: typeof cmdArgs) => Promise<void>;
|
|
19
|
-
//# sourceMappingURL=init.d.ts.map
|
package/dist/commands/init.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { intro, outro, spinner } from '@clack/prompts';
|
|
2
|
-
import { getAccessToken } from '../auth.js';
|
|
3
|
-
import { fetchProjectNames, generateTests, validateAuthToken, createSpecification } from './utils/index.js';
|
|
4
|
-
import { askTestingType, askSpecLocation, askProjectDetails, askSecurityParams, askServerParams, askForUserAuth } from './utils/prompts.js';
|
|
5
|
-
import { CLI_EPILOGUE } from '../constants.js';
|
|
6
|
-
export const command = 'init [option]';
|
|
7
|
-
export const desc = 'Create a new VollQ project';
|
|
8
|
-
export const cmdArgs = {
|
|
9
|
-
token: {
|
|
10
|
-
alias: 't',
|
|
11
|
-
desc: 'Provide an access token to authenticate with the platform',
|
|
12
|
-
type: 'string',
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
export const builder = (yargs) => {
|
|
16
|
-
return yargs
|
|
17
|
-
.options(cmdArgs)
|
|
18
|
-
.example('qa init', desc)
|
|
19
|
-
.epilogue(CLI_EPILOGUE)
|
|
20
|
-
.help();
|
|
21
|
-
};
|
|
22
|
-
export const handler = async (argv) => {
|
|
23
|
-
let token = await getAccessToken(argv.token);
|
|
24
|
-
const s = spinner();
|
|
25
|
-
intro('Start new VollQ project');
|
|
26
|
-
await askTestingType();
|
|
27
|
-
const { specPath, spec } = await askSpecLocation();
|
|
28
|
-
s.start('Looking up user account...');
|
|
29
|
-
let userAuth = await validateAuthToken(token);
|
|
30
|
-
if (!userAuth.valid) {
|
|
31
|
-
s.stop('Couldn\'t authenticate with the platform.');
|
|
32
|
-
console.log('\n');
|
|
33
|
-
token = await askForUserAuth();
|
|
34
|
-
userAuth = await validateAuthToken(token);
|
|
35
|
-
}
|
|
36
|
-
const projectNames = await fetchProjectNames(token);
|
|
37
|
-
s.stop(`User ${userAuth.email} authenticated!`);
|
|
38
|
-
const projectProps = await askProjectDetails(projectNames, spec);
|
|
39
|
-
const securityPayloads = await askSecurityParams(spec);
|
|
40
|
-
const serverObject = await askServerParams(spec);
|
|
41
|
-
s.start('Uploading specification...');
|
|
42
|
-
const id = await createSpecification(token, projectProps, specPath, s);
|
|
43
|
-
s.stop(`Project "${projectProps.name}" created!`);
|
|
44
|
-
s.start('Creating API tests...');
|
|
45
|
-
await generateTests(token, id, s, { securityPayloads, serverObject });
|
|
46
|
-
s.stop('API tests created!');
|
|
47
|
-
outro(`You're all set!\n\nNow run your first test with:\n> qa test "${projectProps.name}"`);
|
|
48
|
-
};
|
package/dist/commands/login.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { Argv } from 'yargs';
|
|
2
|
-
export declare const command = "login [option]";
|
|
3
|
-
export declare const desc = "Log in to the vollq.ai platform";
|
|
4
|
-
export declare const cmdArgs: {
|
|
5
|
-
readonly token: {
|
|
6
|
-
readonly alias: "t";
|
|
7
|
-
readonly desc: "Provide an access token if you don't want to log in via the UI";
|
|
8
|
-
readonly type: "string";
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export declare const builder: (yargs: Argv) => Argv<import("yargs").Omit<{}, "token"> & import("yargs").InferredOptionTypes<{
|
|
12
|
-
readonly token: {
|
|
13
|
-
readonly alias: "t";
|
|
14
|
-
readonly desc: "Provide an access token if you don't want to log in via the UI";
|
|
15
|
-
readonly type: "string";
|
|
16
|
-
};
|
|
17
|
-
}>>;
|
|
18
|
-
export declare const handler: (argv?: Record<keyof typeof cmdArgs, string>) => Promise<string>;
|
|
19
|
-
export declare function login(ticket: string, log?: (message?: any, ...optionalParams: any[]) => void): Promise<string>;
|
|
20
|
-
//# sourceMappingURL=login.d.ts.map
|