@mechasm/cli 0.1.1 → 0.1.3
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/AGENT_GUIDE.md +17 -3
- package/README.md +14 -2
- package/package.json +2 -1
- package/src/cli.js +7 -2
package/AGENT_GUIDE.md
CHANGED
|
@@ -5,11 +5,25 @@ Use Node.js 22 or newer. Install `@mechasm/cli`, sign in with `mechasm login`, t
|
|
|
5
5
|
Keep each test request in Markdown. Name the project ID, target URL, expected result, and limits. Reuse configured test accounts; do not ask agents to expose credentials or change data outside the named test scope.
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
|
-
mechasm tests create --project PROJECT_ID --name "Sign-in" --prompt-file prompt.md --
|
|
8
|
+
mechasm tests create --project PROJECT_ID --name "Sign-in" --prompt-file prompt.md --json
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Save the returned `testId`, `runId` and `runUrl`. Follow execution using the run ID:
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
```sh
|
|
14
|
+
mechasm runs logs RUN_ID --project PROJECT_ID --follow --json
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
When the stream finishes, check the final result:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
mechasm runs status RUN_ID --project PROJECT_ID --json
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Log streaming alone does not report pass/fail through its exit code. Do not infer success from a closed stream or an individual log line. For scripts that only need the final result, `--wait` on create/edit/run or `runs wait` waits silently and returns the final result without displaying live logs. With `--json`, it returns one final JSON result.
|
|
24
|
+
|
|
25
|
+
Use explicit project, test, and run IDs. Do not assume a default project. Use `--json` for scripts; stdout contains JSON and errors go to stderr. Log following emits JSON lines. Save run IDs and log cursors in workflow state. Resume logs with `--after CURSOR` after reconnecting.
|
|
26
|
+
|
|
27
|
+
Exit code `5` from a status/get/wait command or a test command using `--wait` means the run failed or was stopped. Code `2` means invalid arguments, `3` authentication failed, and `4` permission was denied. The optional npm update notice runs only in interactive non-JSON sessions; CI skips it.
|
|
14
28
|
|
|
15
29
|
See [CLI documentation](https://mechasm.ai/docs/mechasm-cli/getting-started) for full command details.
|
package/README.md
CHANGED
|
@@ -38,12 +38,24 @@ Pass project IDs explicitly to test, run, variable, and local-app commands. The
|
|
|
38
38
|
```sh
|
|
39
39
|
mechasm teams list
|
|
40
40
|
mechasm projects create --name "Store QA" --url https://app.example.com --team TEAM_ID
|
|
41
|
-
mechasm tests create --project PROJECT_ID --name "Home page" --prompt "Open the home page and check that it loads." --
|
|
41
|
+
mechasm tests create --project PROJECT_ID --name "Home page" --prompt "Open the home page and check that it loads." --json
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
Replace `TEAM_ID`, `PROJECT_ID`, and the example URL with your values. `--team` is optional when exactly one team is approved. The project creation response contains the project ID to use in later commands.
|
|
45
45
|
|
|
46
|
-
Commands that start a run return its `runId` and workspace `runUrl`.
|
|
46
|
+
Commands that start a run return its `runId` and workspace `runUrl`. Use the returned run ID to follow execution:
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
mechasm runs logs RUN_ID --project PROJECT_ID --follow
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
After the log stream finishes, check the final result:
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
mechasm runs status RUN_ID --project PROJECT_ID --json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Log streaming alone does not report pass/fail through its exit code. Status/get commands return exit code 5 for failed or stopped runs. For scripts that only need the final result, add the optional `--wait` to create/edit/run, or use `runs wait`. Waiting is silent until completion and does not display live logs. With `--json`, it returns one final JSON result; failed or stopped runs exit with code 5.
|
|
47
59
|
|
|
48
60
|
## Manage variables safely
|
|
49
61
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mechasm/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Mechasm command line client",
|
|
5
|
+
"homepage": "https://mechasm.ai/docs/mechasm-cli/getting-started",
|
|
5
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
7
|
"publishConfig": {
|
|
7
8
|
"access": "public"
|
package/src/cli.js
CHANGED
|
@@ -60,14 +60,19 @@ Options:
|
|
|
60
60
|
--idempotency-key KEY Reuse key after an unknown mutation result
|
|
61
61
|
--url URL Project or local app URL
|
|
62
62
|
--ports LIST Comma-separated local ports
|
|
63
|
-
--wait Wait for
|
|
63
|
+
--wait Wait silently for the final result; metadata-only edits return immediately
|
|
64
64
|
--follow Follow run logs until it finishes
|
|
65
65
|
--after CURSOR Resume run log history
|
|
66
66
|
--out FILE Save video or trace to a new file
|
|
67
67
|
--json JSON output on stdout; errors on stderr
|
|
68
68
|
|
|
69
|
-
Commands that start a run return
|
|
69
|
+
Commands that start a run return runId and runUrl; --wait delays output until completion.
|
|
70
|
+
To watch progress, start without --wait, then use: mechasm runs logs RUN_ID --project ID --follow
|
|
71
|
+
After following logs, use runs status to check the result. Log streaming alone does not report pass/fail via its exit code.
|
|
70
72
|
No command opens a local public listener. Project IDs are required for test and run operations.
|
|
73
|
+
|
|
74
|
+
Documentation: https://mechasm.ai/docs/mechasm-cli/getting-started
|
|
75
|
+
Agent workflows: https://mechasm.ai/docs/mechasm-cli/agent-workflows
|
|
71
76
|
`;
|
|
72
77
|
const RUNNER_MANAGED_VARIABLES = new Set(['CI_TOKEN', 'RUN_WS_TOKEN', 'WS_AUTH_COOKIE']);
|
|
73
78
|
|