@aloud/runner 0.2.2 → 0.2.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/dist/cli.js CHANGED
@@ -2666,7 +2666,7 @@ function alive(pid) {
2666
2666
  }
2667
2667
 
2668
2668
  // src/version.ts
2669
- var RUNNER_VERSION = "0.2.2";
2669
+ var RUNNER_VERSION = "0.2.3";
2670
2670
  var RUNNER_VERSION_HEADER = "x-aloud-runner-version";
2671
2671
 
2672
2672
  // src/protocol/client.ts
@@ -7658,6 +7658,25 @@ async function login(argv) {
7658
7658
  const server = stringOption(argv, "--server") ?? DEFAULT_SERVER;
7659
7659
  let token = stringOption(argv, "--token");
7660
7660
  if (!token) {
7661
+ if (!process.stdin.isTTY) {
7662
+ process.stderr.write(
7663
+ [
7664
+ "",
7665
+ "There is no terminal attached here, so there is nowhere to paste a token.",
7666
+ "",
7667
+ "If you are an agent: stop and hand this back. The person runs `aloud login` in their",
7668
+ "own terminal and pastes the token at the prompt. Do not ask them to paste it to you.",
7669
+ "",
7670
+ "To connect without a terminal, set both of these instead and skip login entirely:",
7671
+ ` export ALOUD_SERVER=${server}`,
7672
+ " export ALOUD_RUNNER_TOKEN=utar_...",
7673
+ "",
7674
+ `A token comes from ${server}/app/settings/runners and is shown once.`,
7675
+ ""
7676
+ ].join("\n")
7677
+ );
7678
+ return 1;
7679
+ }
7661
7680
  process.stdout.write(`
7662
7681
  Open ${server}/app/settings/runners and create a runner.
7663
7682
  `);
@@ -7735,7 +7754,12 @@ async function setup() {
7735
7754
  steps.push(`npm install -g @aloud/runner@latest # ${RUNNER_VERSION} is installed, ${latest} is out`);
7736
7755
  }
7737
7756
  if (!credentials) {
7738
- steps.push("aloud login # prompts for a token. The person, not you, pastes it in here.");
7757
+ steps.push(
7758
+ "aloud login # needs a terminal. If you are an agent, hand this step to the person:"
7759
+ );
7760
+ steps.push(
7761
+ " # they run it themselves and paste the token at the prompt."
7762
+ );
7739
7763
  }
7740
7764
  if (!running) {
7741
7765
  steps.push("aloud start # in a background shell. It never exits.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aloud/runner",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Run Aloud usability studies in a real browser on your own machine, so a study can reach localhost and anything else behind your network.",
5
5
  "license": "ISC",
6
6
  "repository": {
package/src/cli.ts CHANGED
@@ -106,6 +106,30 @@ async function login(argv: readonly string[]): Promise<number> {
106
106
  let token = stringOption(argv, "--token");
107
107
 
108
108
  if (!token) {
109
+ // An agent runs commands in a shell with nothing attached to stdin, so the prompt below would
110
+ // read end-of-file and the token would come back empty. That used to surface as "that does not
111
+ // look like a runner token", which blames the wrong thing and tells nobody what to do. This is
112
+ // the single step of setup that a person has to perform, so it is worth saying so precisely.
113
+ if (!process.stdin.isTTY) {
114
+ process.stderr.write(
115
+ [
116
+ "",
117
+ "There is no terminal attached here, so there is nowhere to paste a token.",
118
+ "",
119
+ "If you are an agent: stop and hand this back. The person runs `aloud login` in their",
120
+ "own terminal and pastes the token at the prompt. Do not ask them to paste it to you.",
121
+ "",
122
+ "To connect without a terminal, set both of these instead and skip login entirely:",
123
+ ` export ALOUD_SERVER=${server}`,
124
+ " export ALOUD_RUNNER_TOKEN=utar_...",
125
+ "",
126
+ `A token comes from ${server}/app/settings/runners and is shown once.`,
127
+ "",
128
+ ].join("\n"),
129
+ );
130
+ return 1;
131
+ }
132
+
109
133
  process.stdout.write(`\nOpen ${server}/app/settings/runners and create a runner.\n`);
110
134
  process.stdout.write("It shows you a token once. Paste it here.\n\n");
111
135
  const rl = createInterface({ input: process.stdin, output: process.stdout });
@@ -206,7 +230,12 @@ async function setup(): Promise<number> {
206
230
  steps.push(`npm install -g @aloud/runner@latest # ${RUNNER_VERSION} is installed, ${latest} is out`);
207
231
  }
208
232
  if (!credentials) {
209
- steps.push("aloud login # prompts for a token. The person, not you, pastes it in here.");
233
+ steps.push(
234
+ "aloud login # needs a terminal. If you are an agent, hand this step to the person:",
235
+ );
236
+ steps.push(
237
+ " # they run it themselves and paste the token at the prompt.",
238
+ );
210
239
  }
211
240
  if (!running) {
212
241
  steps.push("aloud start # in a background shell. It never exits.");
package/src/version.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  * package.json beside it to read, and importing one into the source trips the composite build's
11
11
  * rootDir. `version.test.ts` asserts this matches, so the drift this invites cannot survive CI.
12
12
  */
13
- export const RUNNER_VERSION = "0.2.2";
13
+ export const RUNNER_VERSION = "0.2.3";
14
14
 
15
15
  /** The header the server reads it from. */
16
16
  export const RUNNER_VERSION_HEADER = "x-aloud-runner-version";