@andrian.yablonskyy/thub-agent 1.1.10 → 1.1.14
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 +4 -4
- package/RELEASE.md +44 -0
- package/eslint.config.js +3 -0
- package/package.json +2 -2
- package/src/cli.js +7 -16
- package/src/config.js +5 -6
- package/src/report.js +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @andrian.yablonskyy/thub-agent
|
|
2
2
|
|
|
3
|
-
The Agent CLI (`thub`)
|
|
3
|
+
The Agent CLI (`thub`) is a self-hosted job network that lets CI/CD pipelines and individual developers run firmware tests on real hardware or emulators in a private lab. `thub` is the single entry point for both: it's stateless, everything it knows comes from the [Coordinator](https://github.com/andrianyablonskyy/thub-coordinator) API, and it runs identically on a GitHub-hosted runner and a developer laptop — a developer reproducing a CI failure runs exactly the same command the pipeline runs.
|
|
4
4
|
|
|
5
|
-
See the [
|
|
5
|
+
See how this fits with the [Coordinator](https://github.com/andrianyablonskyy/thub-coordinator) and the [Client](https://github.com/andrianyablonskyy/thub-client).
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -14,7 +14,7 @@ npx -y @andrian.yablonskyy/thub-agent run --type sw --download-file "$IMAGE_URL"
|
|
|
14
14
|
|
|
15
15
|
## Configuration
|
|
16
16
|
|
|
17
|
-
Read from flags (`--url`, `--key`), then environment (`THUB_URL`, `THUB_KEY
|
|
17
|
+
Read from flags (`--url`, `--key`), then environment (`THUB_URL`, `THUB_KEY`), then `~/.config/thub/agent.json`, then a bundled default. `url`/`key` are required by the time a command actually talks to the Coordinator; `group`/`user` are optional everywhere.
|
|
18
18
|
|
|
19
19
|
`npm install -g` creates `~/.config/thub/agent.json` for you (blank `url`/`token`, so nothing works until you set them) if it doesn't already exist — a re-install never overwrites it. Fill it in with `thub config set`:
|
|
20
20
|
|
|
@@ -347,7 +347,7 @@ Report only, quietly, with the verdict as a commit status:
|
|
|
347
347
|
commit-status: true
|
|
348
348
|
```
|
|
349
349
|
|
|
350
|
-
Complete workflows, every input, and how the PR comment and test table work are in
|
|
350
|
+
Complete workflows, every input, and how the PR comment and test table work are in the [thub-action README](https://github.com/andrianyablonskyy/thub-action#readme) and the main README §11.1.
|
|
351
351
|
|
|
352
352
|
With the Agent directly:
|
|
353
353
|
|
package/RELEASE.md
CHANGED
|
@@ -2,6 +2,50 @@
|
|
|
2
2
|
|
|
3
3
|
What changed in each release, newest first. `## Unreleased` collects the changes since the version on npm; `bin/publish` turns that heading into the version and date it releases.
|
|
4
4
|
|
|
5
|
+
## 1.1.14 — 2026-10-09
|
|
6
|
+
|
|
7
|
+
### Removed
|
|
8
|
+
|
|
9
|
+
- **`--token`, `THUB_TOKEN` and the config file's `token`.** Use `--key`, `THUB_KEY` and `key`; `thub config set` accepts `url` and `key` only.
|
|
10
|
+
- The unused `PLATFORMS` export of `report.js`.
|
|
11
|
+
|
|
12
|
+
## 1.1.13 — 2026-10-09
|
|
13
|
+
|
|
14
|
+
Changes since 1.1.12.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- **Back on npm.** Install with `npm i -g @andrian.yablonskyy/thub-agent`. `check-update`, `self-update` and dashboard-requested updates use npm again, and require thub-common from npm. The git-based updates in the versions released only as git tags (1.1.11–1.1.12) are gone. An install of one of those updates from git tags, which are still pushed with every release, so it keeps updating.
|
|
19
|
+
|
|
20
|
+
## 1.1.12 — 2026-10-08
|
|
21
|
+
|
|
22
|
+
Changes since 1.1.11.
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- **Updates come from the Agent's git repository.** `thub check-update` reads its newest release tag. `thub self-update` and an update requested on the dashboard install with `npm i -g --install-links git+https://github.com/andrianyablonskyy/thub-agent.git#vX.Y.Z`, retrying with sudo on a terminal.
|
|
27
|
+
- **Install:** `npm i -g --install-links git+https://github.com/andrianyablonskyy/thub-agent.git`, or in CI `npx -y --package='git+https://github.com/andrianyablonskyy/thub-agent.git#semver:*' thub …`.
|
|
28
|
+
|
|
29
|
+
### Upgrading from npm
|
|
30
|
+
|
|
31
|
+
- An Agent installed from npm (1.1.10 or older) can only update from npm, where nothing new comes: reinstall it once from git with the command above.
|
|
32
|
+
|
|
33
|
+
## 1.1.11 — 2026-10-08
|
|
34
|
+
|
|
35
|
+
Changes since 1.1.11.
|
|
36
|
+
|
|
37
|
+
### Changed
|
|
38
|
+
|
|
39
|
+
- **Not published to npm any more.** A release is its `vX.Y.Z` tag on GitHub. thub-common comes from its public repository by tag (`git+https://github.com/andrianyablonskyy/thub-common.git#semver:^…`), so installing needs `git` on the host. `package.json` has `"private": true`.
|
|
40
|
+
|
|
41
|
+
## 1.1.11 — 2026-10-08
|
|
42
|
+
|
|
43
|
+
Changes since 1.1.10.
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- When the Coordinator rejects an option this Agent sent (it's older), the hint says to update it with **Update app** on the dashboard or `thub-admin self-update` on its host. The Coordinator isn't on npm any more.
|
|
48
|
+
|
|
5
49
|
## 1.1.8 — 2026-10-08
|
|
6
50
|
|
|
7
51
|
Changes since 1.1.7.
|
package/eslint.config.js
CHANGED
|
@@ -29,6 +29,9 @@ module.exports = [
|
|
|
29
29
|
},
|
|
30
30
|
rules: {
|
|
31
31
|
// Core JS
|
|
32
|
+
// Dead code: unused variables, imports and functions. Unused trailing
|
|
33
|
+
// arguments are fine when named _x (an Express error handler's next).
|
|
34
|
+
'no-unused-vars': ['error', { args: 'after-used', argsIgnorePattern: '^_', caughtErrors: 'none', ignoreRestSiblings: true }],
|
|
32
35
|
'prefer-const': 'error',
|
|
33
36
|
strict: ['error', 'global'],
|
|
34
37
|
camelcase: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andrian.yablonskyy/thub-agent",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.14",
|
|
4
4
|
"description": "TestHub Agent CLI — the single entry point CI/CD and developers use to submit and follow test jobs",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "Andrian Yablonskyy <andrian.yablonskyy@gmail.com>",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"lint:fix": "eslint . --fix"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@andrian.yablonskyy/thub-common": "^
|
|
18
|
+
"@andrian.yablonskyy/thub-common": "^2.0.0",
|
|
19
19
|
"commander": "^13.1.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
package/src/cli.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
|
-
const { Command
|
|
18
|
+
const { Command } = require('commander'),
|
|
19
19
|
{
|
|
20
20
|
ApiClient, EXIT_CODES, ACTIVE_JOB_STATES, exitCodeForJobState, PACKAGES, fetchLatestVersion, isNewer, isValidVersion, formatDateTime,
|
|
21
21
|
parseEnvList, POWER_ACTIONS, DEFAULT_RESET_DELAY_SEC, MAX_RESET_DELAY_SEC, powerRequestErrors
|
|
@@ -33,7 +33,6 @@ program
|
|
|
33
33
|
.description('TestHub Agent — submit test jobs and follow them, from CI or your laptop')
|
|
34
34
|
.option('--url <url>', 'Coordinator URL (overrides THUB_URL / config file)')
|
|
35
35
|
.option('--key <key>', 'Your access key (overrides THUB_KEY / config file)')
|
|
36
|
-
.addOption(new Option('--token <token>', 'Old name of --key').hideHelp())
|
|
37
36
|
.version(version);
|
|
38
37
|
|
|
39
38
|
// An admin-requested self-update (README §10.2) is applied at the start of
|
|
@@ -126,7 +125,7 @@ function fail(err){
|
|
|
126
125
|
}
|
|
127
126
|
catch { /* keep the generic wording */ }
|
|
128
127
|
console.error(`Hint: the Coordinator at ${url} doesn't know an option ` +
|
|
129
|
-
`this Agent (v${version}) sent — update the Coordinator (dashboard → Update app, or
|
|
128
|
+
`this Agent (v${version}) sent — update the Coordinator (dashboard → Update app, or on its host: thub-admin self-update).`);
|
|
130
129
|
}
|
|
131
130
|
process.exit(err.status && Number.isInteger(err.status) && err.status < 100 ? err.status : EXIT_CODES.USAGE);
|
|
132
131
|
}
|
|
@@ -436,19 +435,12 @@ config
|
|
|
436
435
|
.argument('<name>', 'url | key')
|
|
437
436
|
.argument('<value>')
|
|
438
437
|
.action((name, value) => {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
if (!['url', 'key'].includes(setting)){
|
|
442
|
-
console.error(setting === 'group'
|
|
443
|
-
? 'Error: a job\'s group is set on the dashboard now (Users / CI tokens), not in the Agent'
|
|
444
|
-
: setting === 'user'
|
|
445
|
-
? 'Error: a job\'s user comes from your access key now (thub whoami shows it), not from the Agent'
|
|
446
|
-
: 'Error: the setting must be "url" or "key"');
|
|
438
|
+
if (!['url', 'key'].includes(name)){
|
|
439
|
+
console.error('Error: the setting must be "url" or "key"');
|
|
447
440
|
process.exit(EXIT_CODES.USAGE);
|
|
448
441
|
}
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
console.log(`Saved ${setting} to config`);
|
|
442
|
+
writeConfigFile({ ...readConfigFile(), [name]: value });
|
|
443
|
+
console.log(`Saved ${name} to config`);
|
|
452
444
|
});
|
|
453
445
|
|
|
454
446
|
// Who this access key belongs to (§10.3).
|
|
@@ -498,8 +490,7 @@ keyCommand
|
|
|
498
490
|
const { keySource } = resolveConnection(program.opts()),
|
|
499
491
|
{ key, username } = await client().post('/me/key/rotate');
|
|
500
492
|
if (keySource === 'file'){
|
|
501
|
-
|
|
502
|
-
writeConfigFile({ ...current, key });
|
|
493
|
+
writeConfigFile({ ...readConfigFile(), key });
|
|
503
494
|
console.log(`New access key for ${username} saved to ${CONFIG_PATH} — the old one has stopped working.`);
|
|
504
495
|
}
|
|
505
496
|
else {
|
package/src/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file packages/agent/src/config.js
|
|
3
|
-
* @description Agent config resolution: flags > env > config file > bundled default (url
|
|
3
|
+
* @description Agent config resolution: flags > env > config file > bundled default (url and access key)
|
|
4
4
|
*
|
|
5
5
|
* @author Andrian Yablonskyy
|
|
6
6
|
* @copyright Copyright (c) 2026 Andrian Yablonskyy. All rights reserved.
|
|
@@ -18,8 +18,7 @@ const fs = require('node:fs'),
|
|
|
18
18
|
path = require('node:path');
|
|
19
19
|
|
|
20
20
|
// §7: "Configuration is read from flags, then environment (THUB_URL,
|
|
21
|
-
// THUB_KEY), then ~/.config/thub/agent.json."
|
|
22
|
-
// be called a token: --token, THUB_TOKEN and a saved `token` still work.
|
|
21
|
+
// THUB_KEY), then ~/.config/thub/agent.json."
|
|
23
22
|
const CONFIG_PATH = path.join(os.homedir(), '.config', 'thub', 'agent.json'),
|
|
24
23
|
|
|
25
24
|
// Bundled with the package as a last-resort default, below the user's own
|
|
@@ -51,9 +50,9 @@ function writeConfigFile(config){
|
|
|
51
50
|
function resolveConnection(flags = {}){
|
|
52
51
|
const file = { ...readJsonFile(PACKAGE_DEFAULT_CONFIG_PATH), ...readConfigFile() },
|
|
53
52
|
url = flags.url || process.env.THUB_URL || file.url,
|
|
54
|
-
[token, keySource] = flags.key
|
|
55
|
-
: process.env.THUB_KEY
|
|
56
|
-
: file.key
|
|
53
|
+
[token, keySource] = flags.key ? [flags.key, 'flag']
|
|
54
|
+
: process.env.THUB_KEY ? [process.env.THUB_KEY, 'THUB_KEY']
|
|
55
|
+
: file.key ? [file.key, 'file'] : [null, null];
|
|
57
56
|
if (!url || !token){
|
|
58
57
|
const err = new Error(
|
|
59
58
|
'Missing Coordinator URL or access key. Set them with `thub config set url <url>` and `thub config set key <key>`, ' +
|
package/src/report.js
CHANGED