@flowriki/agent 0.1.0-beta.29 → 0.1.0-beta.30

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.
@@ -6,7 +6,7 @@ import os from "os";
6
6
  import path from "path";
7
7
  import { createRequire } from "module";
8
8
  import { spawnSync } from "child_process";
9
- var AGENT_VERSION = "0.1.0-beta.29";
9
+ var AGENT_VERSION = "0.1.0-beta.30";
10
10
  async function prepareBrowsers() {
11
11
  if (browsersReady()) {
12
12
  return { ok: true, already: true, message: "chromium is already installed" };
package/dist/cli.js CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  resolveService,
19
19
  start,
20
20
  status
21
- } from "./chunk-3SU3RBVY.js";
21
+ } from "./chunk-JYXRKBN5.js";
22
22
 
23
23
  // src/cli.ts
24
24
  import { parseArgs } from "util";
@@ -136,6 +136,12 @@ var ServiceClient = class {
136
136
  projects() {
137
137
  return this.call("/api/agent/projects");
138
138
  }
139
+ createProject(name, repository, baseUrl) {
140
+ return this.call("/api/agent/projects", {
141
+ method: "POST",
142
+ body: JSON.stringify({ name, repository, ...baseUrl ? { baseUrl } : {} })
143
+ });
144
+ }
139
145
  catalog(projectId) {
140
146
  return this.call(`/api/agent/catalog?projectId=${encodeURIComponent(projectId)}`);
141
147
  }
@@ -469,6 +475,9 @@ Every step you take is performed first and kept only if it worked, so the flow
469
475
  you save already ran once. Saved flows go to a NEW branch that a person reviews
470
476
  and publishes in the Flowriki dashboard \u2014 nothing you do is published.
471
477
 
478
+ A new project \u2014 "set up Flowriki for this site, in this repository" \u2014 is made
479
+ with create_project; it then becomes the project the other tools work on.
480
+
472
481
  How to write a good Flowriki test:
473
482
  1. Call project_catalog first. Reuse an existing feature for the flow when one
474
483
  fits; otherwise name a new one. Check the existing flows so you do not write
@@ -525,6 +534,29 @@ function authoringTools(service, session) {
525
534
  return text(projects.length ? projects.map((p) => `${p.name} \u2014 id ${p.id}, you are ${p.role}`).join("\n") : "You are not on any project yet.");
526
535
  }
527
536
  },
537
+ {
538
+ name: "create_project",
539
+ title: "Create a Flowriki project",
540
+ description: "Create a new Flowriki project, connected to a git repository where its tests will be stored, and pointed at the app to test. The repository must already exist and must not hold another Flowriki project. You become its owner.",
541
+ inputSchema: {
542
+ type: "object",
543
+ properties: {
544
+ name: { type: "string", description: `The project's name, e.g. "Pizza Romano".` },
545
+ repository: { type: "string", description: "owner/name, or the repository's address, e.g. https://github.com/acme/shop-tests.git" },
546
+ baseUrl: { type: "string", description: "The app's address, e.g. https://shop.example.com/" }
547
+ },
548
+ required: ["name", "repository"],
549
+ additionalProperties: false
550
+ },
551
+ run: async (args) => {
552
+ const made = await service.createProject(str(args["name"]) ?? "", str(args["repository"]) ?? "", str(args["baseUrl"]));
553
+ defaultProject = made.id;
554
+ catalogs.delete(made.id);
555
+ return text(`Created "${made.name}" (id ${made.id}), stored in ${made.repository}${made.baseUrl ? `, testing ${made.baseUrl}` : " \u2014 no base URL yet; set one in its settings"}.${made.note ? `
556
+ Note: ${made.note}` : ""}
557
+ It is now the project these tools work on. Open it: ${service.origin}/projects/${made.id}`);
558
+ }
559
+ },
528
560
  {
529
561
  name: "project_catalog",
530
562
  title: "What a test can be built from",
package/dist/engine.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  resolveCheckouts,
10
10
  start,
11
11
  status
12
- } from "./chunk-3SU3RBVY.js";
12
+ } from "./chunk-JYXRKBN5.js";
13
13
  export {
14
14
  AGENT_VERSION,
15
15
  browsersReady,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowriki/agent",
3
- "version": "0.1.0-beta.29",
3
+ "version": "0.1.0-beta.30",
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",