qa 0.1.0 → 0.18.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 CHANGED
@@ -1,38 +1,77 @@
1
- <center>
2
- <img src="./assets/logo.png">
3
- </center>
1
+ # qa
4
2
 
5
- <center>
6
- <h1>VollQ CLI</h1>
7
- </center>
3
+ The CLI for Mo, Momentic's autonomous QA agent.
8
4
 
9
- <div align="center">
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
+ ```bash
6
+ $ npm i qa
7
+ ```
8
+
9
+ Point Mo at a URL. It explores the app in a real browser, writes its own test
10
+ cases, and files one report: a verdict per case, plus reproduction steps and a
11
+ recording for every bug it reproduces.
12
+
13
+ ```bash
14
+ qa start "test https://your-app.com"
15
+ ```
16
+
17
+ ![A Mo session report: bug found while exploring, with reproduction steps and
18
+ a recording](https://raw.githubusercontent.com/momentic-ai/qa/main/mo-report.png)
15
19
 
16
- The VollQ provides a CLI tool that gives you access to all your tests within the VollQ platform.
20
+ [momentic.ai/mo](https://momentic.ai/mo)
21
+
22
+ Requires Node 22.12+ or 24+ and a Momentic account (`qa login`). Mo is in beta.
23
+ [Sign up](https://momentic.ai/mo) to get onboarded.
24
+
25
+ Using a coding agent? `qa skills` installs Momentic's agent skills and MCP
26
+ servers for it.
17
27
 
18
28
  ## Install
19
29
 
20
- To install the latest version of VollQ CLI, run this command:
30
+ Install the CLI globally:
21
31
 
22
- ```sh
23
- npm i -g qa
32
+ ```bash
33
+ npm install -g qa
34
+ qa --help
24
35
  ```
25
36
 
26
- ## Usage
37
+ Or run it without a global install:
38
+
39
+ ```bash
40
+ npx qa --help
41
+ ```
42
+
43
+ The npm package is `qa`. It installs a compiled `mo` binary for your system and
44
+ exposes both `qa` and `mo` commands. Both commands show `qa` in help when
45
+ installed through npm. The standalone installer uses `mo` in help.
46
+
47
+ The npm launcher requires Node.js 22.12 or later in the 22.x series, or Node.js
48
+ 24 or later. Binaries are available for macOS ARM64/x64, Linux ARM64/x64 (glibc
49
+ and musl), and Windows x64. Linux musl requires `libstdc++`. Keep optional
50
+ dependencies enabled so npm can install your system's binary.
51
+
52
+ ## Authentication
53
+
54
+ Sign in once to share credentials with the Momentic CLIs:
55
+
56
+ ```bash
57
+ qa login
58
+ qa logout
59
+ ```
60
+
61
+ Credentials are saved to `~/.momentic/auth.json`. Existing credentials from
62
+ `momentic login` or `momentic-wizard login` are reused automatically. You can
63
+ also provide `MOMENTIC_API_KEY` or `--api-key` for a single command.
64
+
65
+ ## Update
27
66
 
28
- To quickly start a new project, run the following commands:
67
+ Update a global npm installation with:
29
68
 
30
- ```sh
31
- qa login # login or register to the VollQ platform
32
- qa init # initiate API or browser testing for your project
33
- qa test <PROJECT> # run an API or browser test
69
+ ```bash
70
+ npm install -g qa@latest
34
71
  ```
35
72
 
36
- ## Documentation
73
+ For a project dependency, update `qa` with your project's package manager.
74
+ `qa upgrade` prints these instructions without replacing npm-managed files.
37
75
 
38
- For details on how to use VollQ CLI, check out our [documentation](https://docs.vollq.ai/cli).
76
+ See the [Mo CLI reference](https://docs.momentic.ai/cli-reference/mo/overview)
77
+ 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,48 @@
1
1
  {
2
2
  "name": "qa",
3
- "version": "0.1.0",
4
- "author": "Christian Bromann <christian@vollq.ai>",
5
- "description": "VollQ CLI",
6
- "license": "Apache-2.0",
7
- "type": "module",
3
+ "version": "0.18.0",
4
+ "description": "The CLI for Mo, Momentic's autonomous QA agent.",
5
+ "private": false,
8
6
  "bin": {
9
- "qa": "./bin/qa.js"
7
+ "qa": "./cli.cjs",
8
+ "mo": "./cli.cjs"
10
9
  },
11
- "keywords": [],
12
- "dependencies": {
13
- "@clack/prompts": "^0.8.1",
14
- "@fastify/static": "^8.0.4",
15
- "@fastify/websocket": "^11.0.2",
16
- "@wdio/logger": "^9.4.4",
17
- "@wdio/types": "^9.6.3",
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.14",
29
- "@vollq/ide": "0.0.8",
30
- "localdriver": "0.0.4",
31
- "neuralspec": "0.0.5"
10
+ "files": [
11
+ "cli.cjs"
12
+ ],
13
+ "repository": "github:momentic-ai/qa",
14
+ "homepage": "https://momentic.ai/mo",
15
+ "bugs": "https://github.com/momentic-ai/qa/issues",
16
+ "keywords": [
17
+ "qa",
18
+ "testing",
19
+ "e2e",
20
+ "e2e-testing",
21
+ "test-automation",
22
+ "ai",
23
+ "ai-agent",
24
+ "agent",
25
+ "autonomous",
26
+ "qa-engineer",
27
+ "momentic",
28
+ "mo",
29
+ "playwright-alternative",
30
+ "cli"
31
+ ],
32
+ "publishConfig": {
33
+ "access": "public"
32
34
  },
33
- "devDependencies": {
34
- "@types/uuid": "^9.0.8",
35
- "@types/ws": "^8.5.10",
36
- "@types/yargs": "^17.0.32",
37
- "replace-in-files-cli": "^3.0.0",
38
- "typescript": "^5.6.3",
39
- "vitest": "^2.1.8"
35
+ "type": "module",
36
+ "engines": {
37
+ "node": "^22.12.0 || >=24.0.0"
40
38
  },
41
- "scripts": {
42
- "build": "run-s build:*",
43
- "build:ts": "tsc",
44
- "build:replace": "run-s build:replace:*",
45
- "build:replace:platform": "replace-in-files --string='process.env.PLATFORM_URL' --replacement=\"process.env.VOLLQ_PLATFORM_URL || '$PLATFORM_URL'\" ./dist/constants.js",
46
- "build:replace:worker": "replace-in-files --string='process.env.WORKER_URL' --replacement=\"process.env.VOLLQ_WORKER_URL || '$WORKER_URL'\" ./dist/constants.js",
47
- "start": "tsc --watch --preserveWatchOutput",
48
- "test": "run-s test.*",
49
- "test.unit": "echo \"Error: no test specified\" && exit 0"
39
+ "optionalDependencies": {
40
+ "@momentic/qa-darwin-arm64": "0.18.0",
41
+ "@momentic/qa-darwin-x64": "0.18.0",
42
+ "@momentic/qa-linux-arm64": "0.18.0",
43
+ "@momentic/qa-linux-arm64-musl": "0.18.0",
44
+ "@momentic/qa-linux-x64": "0.18.0",
45
+ "@momentic/qa-linux-x64-musl": "0.18.0",
46
+ "@momentic/qa-windows-x64": "0.18.0"
50
47
  }
51
- }
48
+ }
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
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- import { run } from '../dist/index.js'
3
-
4
- // eslint-disable-next-line no-undef
5
- run(process.argv.slice(2))
@@ -1,3 +0,0 @@
1
- import type { TestCommandParameters } from '../commands/types.js';
2
- export declare function runAPITest(token: string, argv: TestCommandParameters): Promise<void>;
3
- //# sourceMappingURL=index.d.ts.map
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, { testId: argv.project, filter: argv.filter });
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, testParameters) {
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(testParameters)
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
@@ -1,2 +0,0 @@
1
- export declare function getAccessToken<EnsureAuth extends boolean = true>(tokenParam?: string, ensureAuth?: EnsureAuth | true): Promise<EnsureAuth extends true ? string : string | undefined>;
2
- //# sourceMappingURL=auth.d.ts.map
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
- }
@@ -1,3 +0,0 @@
1
- import type { CommandModule } from 'yargs';
2
- export declare const commands: CommandModule[];
3
- //# sourceMappingURL=index.d.ts.map
@@ -1,5 +0,0 @@
1
- import * as login from './login.js';
2
- import * as test from './test.js';
3
- import * as init from './init.js';
4
- import * as start from './start.js';
5
- export const commands = [login, init, test, start];
@@ -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