@flowriki/agent 0.1.0-beta.2 → 0.1.0-beta.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -4,10 +4,11 @@ import {
4
4
  connect,
5
5
  disconnect,
6
6
  doctor,
7
+ prepareBrowsers,
7
8
  resolveCheckouts,
8
9
  start,
9
10
  status
10
- } from "./chunk-EYRGRDNB.js";
11
+ } from "./chunk-ZVX26LV7.js";
11
12
 
12
13
  // src/cli.ts
13
14
  import { parseArgs } from "util";
@@ -27,6 +28,7 @@ ${bold("USAGE")}
27
28
  flowriki-agent start run the agent (stays in the foreground)
28
29
  flowriki-agent status is it connected, and what is prepared
29
30
  flowriki-agent doctor diagnose setup problems
31
+ flowriki-agent prepare download the browser recording needs
30
32
  flowriki-agent disconnect forget this computer's credential
31
33
 
32
34
  ${bold("OPTIONS")}
@@ -35,6 +37,7 @@ ${bold("OPTIONS")}
35
37
  --name <label> how this computer appears in your dashboard
36
38
  --service <url> advanced: a self-hosted Flowriki. Defaults to the
37
39
  hosted service, which is what you want.
40
+ --no-open print the approval link without opening a browser
38
41
  --json machine-readable output for status and doctor
39
42
  -h, --help this
40
43
  -v, --version version
@@ -54,6 +57,7 @@ async function main(argv) {
54
57
  name: { type: "string" },
55
58
  service: { type: "string" },
56
59
  json: { type: "boolean" },
60
+ "no-open": { type: "boolean" },
57
61
  help: { type: "boolean", short: "h" },
58
62
  version: { type: "boolean", short: "v" }
59
63
  }
@@ -79,6 +83,7 @@ Run \`flowriki-agent --help\`.`);
79
83
  switch (command) {
80
84
  case "connect": {
81
85
  const result = await connect({
86
+ open: !values["no-open"],
82
87
  ...service ? { service } : {},
83
88
  ...values.name ? { machineName: String(values.name) } : {},
84
89
  onProgress: (note) => {
@@ -89,7 +94,7 @@ Run \`flowriki-agent --help\`.`);
89
94
  console.log(` ${url}
90
95
  `);
91
96
  if (note.detail?.["canOpen"] === false) {
92
- console.log(dim(" No graphical session here \u2014 open that link on a computer that has one.\n"));
97
+ console.log(dim(" Open the approval link in your browser.\n"));
93
98
  } else {
94
99
  console.log(dim(" Opening it for you. If nothing happens, use the link above.\n"));
95
100
  }
@@ -106,6 +111,11 @@ Run \`flowriki-agent --help\`.`);
106
111
  return 0;
107
112
  }
108
113
  case "start": {
114
+ process.on("unhandledRejection", (reason) => {
115
+ const said = reason instanceof Error ? reason.stack ?? reason.message : String(reason);
116
+ console.error(red(`! a command failed without being handled \u2014 the agent is still running`));
117
+ console.error(dim(said.split("\n").slice(0, 4).join("\n")));
118
+ });
109
119
  const started = await start({
110
120
  ...service ? { service } : {},
111
121
  ...projects.length ? { projects } : {},
@@ -129,8 +139,7 @@ Run \`flowriki-agent --help\`.`);
129
139
  console.log(`${bold("Flowriki agent")} ${dim(AGENT_VERSION)}`);
130
140
  console.log(dim(` connected as ${started.connection.machineName}`));
131
141
  if (started.projects.length === 0) {
132
- console.log(yellow(" no projects prepared \u2014 this machine is online and idle"));
133
- console.log(dim(" Add one: flowriki-agent start --project /path/to/a/checkout"));
142
+ console.log(dim(" ready \u2014 this machine records and runs whatever the dashboard asks for"));
134
143
  }
135
144
  for (const project of started.projects) {
136
145
  console.log(dim(` project ${project.name} (${project.root})`));
@@ -150,6 +159,11 @@ Run \`flowriki-agent --help\`.`);
150
159
  return await new Promise(() => {
151
160
  });
152
161
  }
162
+ case "prepare": {
163
+ const result = await prepareBrowsers();
164
+ console.log(result.ok ? green(result.message) : red(result.message));
165
+ return result.ok ? 0 : 1;
166
+ }
153
167
  case "status": {
154
168
  const state = status(service);
155
169
  if (values.json) {
@@ -182,7 +196,11 @@ Run \`flowriki-agent --help\`.`);
182
196
  console.log(` node ${found.node} ${dim(`${found.platform}/${found.arch}`)}`);
183
197
  console.log(` protocol ${found.protocolVersion}`);
184
198
  console.log(` data ${found.dataDir}`);
185
- console.log(` service ${found.service} ${found.reachable ? green("reachable") : red("unreachable")}`);
199
+ console.log(
200
+ ` service ${found.service} ${found.reachable ? green("reachable") : red("unreachable")}` + // WHICH FLOWRIKI, from the service's own mouth. Not the site being
201
+ // tested — that is a project setting and changes nothing here.
202
+ (found.environment ? dim(` [${found.environment}]`) : "")
203
+ );
186
204
  console.log(` credential ${found.credentialFingerprint ?? dim("none stored")}`);
187
205
  console.log(
188
206
  ` browsers ${found.playwright.chromiumInstalled ? green("chromium ready") : yellow("chromium not installed")} ${dim(found.playwright.browsersPath ?? "")}`
package/dist/engine.js CHANGED
@@ -1,18 +1,22 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  AGENT_VERSION,
4
+ browsersReady,
4
5
  connect,
5
6
  disconnect,
6
7
  doctor,
8
+ prepareBrowsers,
7
9
  resolveCheckouts,
8
10
  start,
9
11
  status
10
- } from "./chunk-EYRGRDNB.js";
12
+ } from "./chunk-ZVX26LV7.js";
11
13
  export {
12
14
  AGENT_VERSION,
15
+ browsersReady,
13
16
  connect,
14
17
  disconnect,
15
18
  doctor,
19
+ prepareBrowsers,
16
20
  resolveCheckouts,
17
21
  start,
18
22
  status
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowriki/agent",
3
- "version": "0.1.0-beta.2",
3
+ "version": "0.1.0-beta.20",
4
4
  "description": "Run Flowriki UI tests on your own computer. Connects this machine to your Flowriki account.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -37,7 +37,7 @@
37
37
  "repository": {
38
38
  "type": "git",
39
39
  "url": "git+https://github.com/Muhammad-Safiullah/flowriki.git",
40
- "directory": "packages/agent-npm"
40
+ "directory": "packages/agent-cli"
41
41
  },
42
42
  "keywords": [
43
43
  "flowriki",