@testsprite/testsprite-cli 0.8.0 → 0.9.0
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 +11 -7
- package/dist/commands/agent.d.ts +3 -0
- package/dist/commands/agent.js +32 -7
- package/dist/commands/ci.js +4 -1
- package/dist/commands/init.d.ts +45 -2
- package/dist/commands/init.js +190 -29
- package/dist/commands/project.js +14 -3
- package/dist/commands/test.d.ts +32 -3
- package/dist/commands/test.js +157 -29
- package/dist/lib/agent-detect.d.ts +53 -0
- package/dist/lib/agent-detect.js +198 -0
- package/dist/lib/http.d.ts +10 -0
- package/dist/lib/http.js +6 -2
- package/dist/lib/response-schemas.js +14 -0
- package/dist/lib/runs.types.d.ts +26 -0
- package/dist/lib/skill-nudge.d.ts +13 -5
- package/dist/lib/skill-nudge.js +40 -14
- package/dist/lib/target-url.d.ts +10 -1
- package/dist/lib/target-url.js +28 -11
- package/dist/lib/tunnel-session.d.ts +12 -3
- package/dist/lib/tunnel-session.js +23 -6
- package/dist/vendor/tunnel-client/client.d.ts +2 -3
- package/dist/vendor/tunnel-client/client.js +60 -7
- package/dist/vendor/tunnel-client/config.d.ts +8 -0
- package/dist/vendor/tunnel-client/config.js +8 -0
- package/dist/vendor/tunnel-client/types.d.ts +5 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ AI ships code in minutes — verifying it hasn't. `testsprite` opens your live a
|
|
|
27
27
|
<a href="https://www.testsprite.com/docs"><img src="https://img.shields.io/badge/Docs-0A0A0A?style=for-the-badge" alt="Docs"></a>
|
|
28
28
|
<a href="https://x.com/Test_Sprite"><img src="https://img.shields.io/badge/Follow%20on%20X-000000?style=for-the-badge&logo=x&logoColor=white" alt="Follow on X"></a>
|
|
29
29
|
<a href="https://www.linkedin.com/company/testsprite"><img src="https://img.shields.io/badge/LinkedIn-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white" alt="LinkedIn"></a>
|
|
30
|
-
<a href="https://discord.gg/
|
|
30
|
+
<a href="https://discord.gg/GXWFjCe4an"><img src="https://img.shields.io/badge/Join%20our%20Discord-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Join our Discord"></a>
|
|
31
31
|
</p>
|
|
32
32
|
|
|
33
33
|
⭐ _Help us reach more developers and grow the TestSprite community. Star this repo!_
|
|
@@ -61,13 +61,17 @@ npm install -g @testsprite/testsprite-cli
|
|
|
61
61
|
testsprite setup
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
`testsprite setup` prompts for your [API key](https://www.testsprite.com), verifies it, and installs the verification-loop skill for
|
|
64
|
+
`testsprite setup` prompts for your [API key](https://www.testsprite.com), verifies it, and installs the verification-loop skill for the coding agents this project uses — one command, so your agent is wired to verify its own work.
|
|
65
|
+
|
|
66
|
+
**Which agent it installs for.** Each of the eight supported targets — `claude`, `cursor`, `cline`, `windsurf`, `antigravity`, `kiro`, `copilot`, `codex` — lands its skill in a different place, so `setup` works out which you use: the agent calling it, if it identifies itself, together with every agent whose config is already in the project. It installs for all of them and prints what it found — in a terminal it shows you that list first, so you can accept it or narrow it before anything is written. If nothing identifies an agent, it installs for `claude` and says so — that is the one case where you want `--agent <target>` to name one yourself. Check the result any time with `testsprite agent status`.
|
|
67
|
+
|
|
68
|
+
Non-interactive (CI / onboarding scripts):
|
|
65
69
|
|
|
66
70
|
```bash
|
|
67
|
-
TESTSPRITE_API_KEY=sk-... testsprite setup --from-env --yes
|
|
71
|
+
TESTSPRITE_API_KEY=sk-... testsprite setup --from-env --yes
|
|
68
72
|
```
|
|
69
73
|
|
|
70
|
-
> **Pointing a coding agent (Claude Code, Cursor, Codex, Cline, …) at TestSprite?** Have it run `testsprite setup` first — that installs the verification skill, so the agent knows how to create, run, and triage tests on its own (instead of guessing from this README). New here? Start with the **[getting-started overview](https://docs.testsprite.com/cli/getting-started/overview)**.
|
|
74
|
+
> **Pointing a coding agent (Claude Code, Cursor, Codex, Cline, …) at TestSprite?** Have it run `testsprite setup` first — that installs the verification skill, so the agent knows how to create, run, and triage tests on its own (instead of guessing from this README). `setup` reports which agents it installed for; add `--agent <target>` if that list is not the one you wanted. New here? Start with the **[getting-started overview](https://docs.testsprite.com/cli/getting-started/overview)**.
|
|
71
75
|
|
|
72
76
|
> **Privacy note:** interactive runs check the npm registry at most once per 24 h to offer a "new version available" notice — package name only, never your key or data; `TESTSPRITE_NO_UPDATE_NOTIFIER=1` disables it. The backend also advertises its minimum supported CLI version — a below-floor CLI prints a one-line upgrade advisory on stderr, and a too-old client may be rejected with exit 14 (`CLIENT_TOO_OLD`). Details in [DOCUMENTATION.md → Update notice](./DOCUMENTATION.md#update-notice).
|
|
73
77
|
|
|
@@ -178,7 +182,7 @@ Prefer to configure each step by hand (or learn the surface offline with `--dry-
|
|
|
178
182
|
- ♻️ **A loop, not a one-shot.** `create → run → failure get → fix → rerun` — every pass is banked, not thrown away.
|
|
179
183
|
- 📐 **Scriptable & deterministic.** Stable `--output json` contract, predictable [exit codes](./DOCUMENTATION.md#exit-codes), and a `--dry-run` that exercises the full code path offline with canned data.
|
|
180
184
|
- 🚦 **CI-native.** On GitHub Actions, `--wait` runs annotate the PR checks tab with one `::error::` per failure and append a results table to the job summary — automatically. Add `--report junit` for a JUnit XML sidecar, `--summary-file` for a machine summary, or `--gh-output` to preview the annotations locally. Runs in any CI, not just GitHub. [Details →](./DOCUMENTATION.md#continuous-integration)
|
|
181
|
-
- 🔌 **One command to onboard your agent.** `testsprite
|
|
185
|
+
- 🔌 **One command to onboard your agent.** `testsprite setup` drops ready-made skill files into your repo — for the agents it detects you using — so your coding agent knows how to drive the loop on its own.
|
|
182
186
|
|
|
183
187
|
## How it works
|
|
184
188
|
|
|
@@ -224,7 +228,7 @@ That's the point of all of this: you no longer need the biggest, most expensive
|
|
|
224
228
|
- 📚 **CLI reference** — [DOCUMENTATION.md](./DOCUMENTATION.md)
|
|
225
229
|
- 🌐 **Platform docs** — [testsprite.com/docs](https://www.testsprite.com/docs)
|
|
226
230
|
- 🐛 **Issues & feature requests** — [GitHub issues](https://github.com/TestSprite/testsprite-cli/issues)
|
|
227
|
-
- 💬 **Quick questions** — [Discord](https://discord.gg/
|
|
231
|
+
- 💬 **Quick questions** — [Discord](https://discord.gg/GXWFjCe4an), or `testsprite --help` / `testsprite test run --help` right in your terminal
|
|
228
232
|
- 📝 **Changelog** — [CHANGELOG.md](./CHANGELOG.md)
|
|
229
233
|
|
|
230
234
|
## Contributing
|
|
@@ -242,7 +246,7 @@ npm run typecheck # tsc --noEmit
|
|
|
242
246
|
|
|
243
247
|
Pull requests target the `main` branch. The full guide — build from source, test tiers, CI checks, branches, project layout — is in [CONTRIBUTING.md](./CONTRIBUTING.md).
|
|
244
248
|
|
|
245
|
-
**Support** — if you need any help, we're responsive on [Discord](https://discord.gg/
|
|
249
|
+
**Support** — if you need any help, we're responsive on [Discord](https://discord.gg/GXWFjCe4an), and feel free to email us at [contact@testsprite.com](mailto:contact@testsprite.com) too.
|
|
246
250
|
|
|
247
251
|
## License
|
|
248
252
|
|
package/dist/commands/agent.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import type { CommonOptions as FactoryCommonOptions } from '../lib/client-factory.js';
|
|
3
|
+
import { type DetectAgentDeps } from '../lib/agent-detect.js';
|
|
3
4
|
import { type AgentTarget } from '../lib/agent-targets.js';
|
|
4
5
|
/**
|
|
5
6
|
* Codex loads AGENTS.md files lazily and has a documented 32 KiB load budget
|
|
@@ -26,6 +27,8 @@ export interface AgentDeps {
|
|
|
26
27
|
stderr?: (line: string) => void;
|
|
27
28
|
isTTY?: boolean;
|
|
28
29
|
prompt?: (question: string) => Promise<string>;
|
|
30
|
+
/** Injected fs/env for detecting which agents the project uses. */
|
|
31
|
+
detect?: DetectAgentDeps;
|
|
29
32
|
}
|
|
30
33
|
export type InstallAction = 'written' | 'skipped' | 'blocked' | 'updated' | 'dry-run' | 'section-installed' | 'section-updated' | 'section-unchanged';
|
|
31
34
|
export interface InstallResult {
|
package/dist/commands/agent.js
CHANGED
|
@@ -4,6 +4,7 @@ import { Command } from 'commander';
|
|
|
4
4
|
import { CLIError, localValidationError } from '../lib/errors.js';
|
|
5
5
|
import { GLOBAL_OPTS_HINT, Output, resolveOutputMode } from '../lib/output.js';
|
|
6
6
|
import { promptText } from '../lib/prompt.js';
|
|
7
|
+
import { FALLBACK_TARGET, resolveAgentTargets } from '../lib/agent-detect.js';
|
|
7
8
|
import { TARGETS, SKILLS, DEFAULT_SKILLS, MARKER_SKILL_SEPARATOR, pathFor, ownFileBodyFor, bodyHash12, buildCodexAggregate, buildSkillMarker, parseSkillMarker, renderForTarget, renderOwnFileWithMarker, MANAGED_SECTION_BEGIN, MANAGED_SECTION_END, } from '../lib/agent-targets.js';
|
|
8
9
|
// ---------------------------------------------------------------------------
|
|
9
10
|
// Constants
|
|
@@ -261,19 +262,38 @@ export async function runInstall(opts, deps = {}) {
|
|
|
261
262
|
.map(s => s.trim())
|
|
262
263
|
.filter(Boolean);
|
|
263
264
|
let resolvedTargetStrings;
|
|
265
|
+
// Whether the target came from the interactive prompt rather than a flag.
|
|
266
|
+
// Decides which of the two the refusal below names — telling someone their
|
|
267
|
+
// `--target` is invalid when they never typed one sends them to the wrong
|
|
268
|
+
// place.
|
|
269
|
+
let fromPrompt = false;
|
|
270
|
+
// Where the install lands, and so where detection looks (reused at step 3).
|
|
271
|
+
const dir = opts.dir ?? deps.cwd ?? process.cwd();
|
|
264
272
|
if (rawTargets.length === 0) {
|
|
273
|
+
// No target named: install for the agents this project shows rather than a
|
|
274
|
+
// fixed one, so an unnamed install cannot land where the caller cannot read.
|
|
275
|
+
const detected = resolveAgentTargets(undefined, dir, { ...deps.detect });
|
|
276
|
+
const suggestion = detected.targets.join(',');
|
|
265
277
|
const isTTY = deps.isTTY ?? Boolean(process.stdin.isTTY);
|
|
266
278
|
if (!isTTY) {
|
|
267
|
-
stderrFn(
|
|
268
|
-
|
|
279
|
+
stderrFn(detected.source === 'fallback'
|
|
280
|
+
? `[info] no coding agent detected; installing for ${FALLBACK_TARGET}. Pass --target=<target> to select a different agent.`
|
|
281
|
+
: `[info] --target not specified; installing for ${suggestion}.`);
|
|
282
|
+
resolvedTargetStrings = [...detected.targets];
|
|
269
283
|
}
|
|
270
284
|
else {
|
|
285
|
+
fromPrompt = true;
|
|
271
286
|
const promptFn = deps.prompt ?? ((q) => promptText(q));
|
|
272
|
-
const answer = (await promptFn(
|
|
273
|
-
const defaulted = answer ||
|
|
287
|
+
const answer = (await promptFn(`Targets to install (comma-separated) [${suggestion}]: `)).trim();
|
|
288
|
+
const defaulted = answer || suggestion;
|
|
289
|
+
// Lower-cased for the same reason `setup`'s prompt does it: every target
|
|
290
|
+
// name is lower case, so `Cursor` is a typo only in the sense that the
|
|
291
|
+
// shift key was down. Accepting it in one prompt and refusing it in the
|
|
292
|
+
// other is an inconsistency the user has no way to predict. A `--target`
|
|
293
|
+
// value is left alone on both sides — that is a flag, not an answer.
|
|
274
294
|
resolvedTargetStrings = defaulted
|
|
275
295
|
.split(',')
|
|
276
|
-
.map(s => s.trim())
|
|
296
|
+
.map(s => s.trim().toLowerCase())
|
|
277
297
|
.filter(Boolean);
|
|
278
298
|
}
|
|
279
299
|
}
|
|
@@ -284,6 +304,12 @@ export async function runInstall(opts, deps = {}) {
|
|
|
284
304
|
const validTargets = Object.keys(TARGETS);
|
|
285
305
|
for (const t of resolvedTargetStrings) {
|
|
286
306
|
if (!validTargets.includes(t)) {
|
|
307
|
+
if (fromPrompt) {
|
|
308
|
+
// Not `localValidationError('target', …)`: that renders as "Flag
|
|
309
|
+
// --target is invalid", and on this path the caller passed no flag.
|
|
310
|
+
throw new CLIError(`unknown target "${t}"; supported: ${validTargets.join(', ')}. ` +
|
|
311
|
+
'Re-run and answer with one of those, or pass --target <target>.', 5);
|
|
312
|
+
}
|
|
287
313
|
throw localValidationError('target', `unknown target "${t}"; supported: ${validTargets.join(', ')}`);
|
|
288
314
|
}
|
|
289
315
|
}
|
|
@@ -314,8 +340,7 @@ export async function runInstall(opts, deps = {}) {
|
|
|
314
340
|
seenSkill.add(s);
|
|
315
341
|
return true;
|
|
316
342
|
});
|
|
317
|
-
// 3. Resolve dir
|
|
318
|
-
const dir = opts.dir ?? deps.cwd ?? process.cwd();
|
|
343
|
+
// 3. Resolve dir (computed above, where detection also needed it)
|
|
319
344
|
const root = path.resolve(dir);
|
|
320
345
|
// 4. Lazy asset loaders — only touch disk if a target actually needs it.
|
|
321
346
|
// own-file bodies come from the shared per-target resolver; the codex section
|
package/dist/commands/ci.js
CHANGED
|
@@ -295,7 +295,10 @@ export async function runCiInit(opts, deps = {}) {
|
|
|
295
295
|
let endpointWarning = null;
|
|
296
296
|
if (endpointUrl) {
|
|
297
297
|
try {
|
|
298
|
-
assertNotLocal(endpointUrl
|
|
298
|
+
assertNotLocal(endpointUrl, {
|
|
299
|
+
field: 'endpoint-url',
|
|
300
|
+
helpCommand: 'testsprite ci init',
|
|
301
|
+
});
|
|
299
302
|
}
|
|
300
303
|
catch {
|
|
301
304
|
endpointWarning = `the workflow pins ${endpointUrl}, which a GitHub-hosted runner cannot reach — pass --endpoint-url <public-url>, or run this workflow on a self-hosted runner.`;
|
package/dist/commands/init.d.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* `testsprite init` — one-shot onboarding orchestrator.
|
|
3
3
|
*
|
|
4
4
|
* Chains, in order:
|
|
5
|
+
* 0. Agent-target resolution + confirmation prompt — the chosen install
|
|
6
|
+
* targets are settled here, before anything is written
|
|
5
7
|
* 1. runConfigure — writes the API-key profile (validates via GET /me first)
|
|
6
8
|
* 2. runWhoami — fetches identity for the post-configure banner
|
|
7
9
|
* 3. runInstall — installs the TestSprite verification-loop skill (unless --no-agent)
|
|
@@ -14,6 +16,7 @@ import { type CommonOptions as FactoryCommonOptions } from '../lib/client-factor
|
|
|
14
16
|
import type { AuthDeps } from './auth.js';
|
|
15
17
|
import type { AgentFs } from './agent.js';
|
|
16
18
|
import { type AgentTarget } from '../lib/agent-targets.js';
|
|
19
|
+
import { type AgentDetection, type DetectAgentDeps } from '../lib/agent-detect.js';
|
|
17
20
|
import type { FetchImpl } from '../lib/http.js';
|
|
18
21
|
type CommonOptions = FactoryCommonOptions;
|
|
19
22
|
/**
|
|
@@ -35,11 +38,18 @@ export interface InitDeps {
|
|
|
35
38
|
isTTY?: boolean;
|
|
36
39
|
/** Injected for agent install prompt (plain function, not {secret: fn}) */
|
|
37
40
|
agentPrompt?: (question: string) => Promise<string>;
|
|
41
|
+
/** Injected fs/env for caller detection; defaults to the real repo under `cwd`. */
|
|
42
|
+
detect?: DetectAgentDeps;
|
|
38
43
|
}
|
|
39
44
|
interface InitOptions extends CommonOptions {
|
|
40
45
|
apiKey?: string;
|
|
41
46
|
fromEnv: boolean;
|
|
42
|
-
|
|
47
|
+
/**
|
|
48
|
+
* The target the caller explicitly chose. Absent means "decide from what this
|
|
49
|
+
* repo shows", so it must stay unset unless `--agent` was really passed —
|
|
50
|
+
* a default filled in here would suppress detection for every run.
|
|
51
|
+
*/
|
|
52
|
+
agent?: AgentTarget;
|
|
43
53
|
noAgent: boolean;
|
|
44
54
|
force: boolean;
|
|
45
55
|
dir?: string;
|
|
@@ -63,12 +73,40 @@ export interface InitSummary {
|
|
|
63
73
|
* Agent skill install outcome. `action` is an AGGREGATE across the installed
|
|
64
74
|
* skills (setup installs {@link DEFAULT_SKILLS}); `skills` lists which skills
|
|
65
75
|
* landed. `null` when --no-agent.
|
|
76
|
+
*
|
|
77
|
+
* `targets` holds every agent installed for; `target` repeats the first so a
|
|
78
|
+
* reader of the single-target field keeps working.
|
|
66
79
|
*/
|
|
67
80
|
agent: {
|
|
68
81
|
target: string;
|
|
82
|
+
targets: string[];
|
|
83
|
+
/**
|
|
84
|
+
* How the SET was arrived at: `flag` when `--agent` named it, `fallback`
|
|
85
|
+
* when nothing was found, otherwise `detected`.
|
|
86
|
+
*
|
|
87
|
+
* Deliberately not `'env' | 'trace'`: resolution is a UNION of both
|
|
88
|
+
* signals, so a single word would label a five-target set by whichever
|
|
89
|
+
* signal happened to fire first. Per-target provenance lives in
|
|
90
|
+
* `detections` below.
|
|
91
|
+
*/
|
|
92
|
+
detectedBy: 'flag' | 'detected' | 'fallback';
|
|
93
|
+
/**
|
|
94
|
+
* One row per detected target, so a JSON consumer can tell which signal
|
|
95
|
+
* produced which install. Empty for `flag` and `fallback`.
|
|
96
|
+
*/
|
|
97
|
+
detections: Array<{
|
|
98
|
+
target: string;
|
|
99
|
+
source: AgentDetection['source'];
|
|
100
|
+
signal: string;
|
|
101
|
+
}>;
|
|
69
102
|
action: string;
|
|
70
103
|
skills?: string[];
|
|
71
104
|
} | null;
|
|
105
|
+
/**
|
|
106
|
+
* Why `agent` is null: `flag` for `--no-agent`, `prompt` when the
|
|
107
|
+
* confirmation prompt was answered `none`. Absent when skills were installed.
|
|
108
|
+
*/
|
|
109
|
+
agentSkippedBy?: 'flag' | 'prompt';
|
|
72
110
|
status: 'initialized';
|
|
73
111
|
}
|
|
74
112
|
export declare function runInit(opts: InitOptions, deps?: InitDeps): Promise<void>;
|
|
@@ -88,7 +126,12 @@ export interface SetupCmdOpts {
|
|
|
88
126
|
yes?: boolean;
|
|
89
127
|
skipIfConfigured?: boolean;
|
|
90
128
|
}
|
|
91
|
-
/**
|
|
129
|
+
/**
|
|
130
|
+
* Attach the onboarding flags shared by `setup` and the `init`/`auth configure`
|
|
131
|
+
* aliases. `--agent` deliberately carries NO default: its absence is the signal
|
|
132
|
+
* that setup should detect the agent, and a default value here is
|
|
133
|
+
* indistinguishable from the caller naming that same target.
|
|
134
|
+
*/
|
|
92
135
|
export declare function addSetupOptions(cmd: Command, validTargets: AgentTarget[], defaultAgent: AgentTarget): Command;
|
|
93
136
|
export declare function createSetupCommand(deps?: InitDeps): Command;
|
|
94
137
|
/**
|
package/dist/commands/init.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* `testsprite init` — one-shot onboarding orchestrator.
|
|
3
3
|
*
|
|
4
4
|
* Chains, in order:
|
|
5
|
+
* 0. Agent-target resolution + confirmation prompt — the chosen install
|
|
6
|
+
* targets are settled here, before anything is written
|
|
5
7
|
* 1. runConfigure — writes the API-key profile (validates via GET /me first)
|
|
6
8
|
* 2. runWhoami — fetches identity for the post-configure banner
|
|
7
9
|
* 3. runInstall — installs the TestSprite verification-loop skill (unless --no-agent)
|
|
@@ -13,11 +15,13 @@ import { Command } from 'commander';
|
|
|
13
15
|
import { parseRequestTimeoutFlag, } from '../lib/client-factory.js';
|
|
14
16
|
import { normalizeEnvVar } from '../lib/config.js';
|
|
15
17
|
import { emitDeprecationNotice } from '../lib/deprecate.js';
|
|
16
|
-
import { CLIError } from '../lib/errors.js';
|
|
18
|
+
import { CLIError, localValidationError } from '../lib/errors.js';
|
|
17
19
|
import { GLOBAL_OPTS_HINT, Output, resolveOutputMode } from '../lib/output.js';
|
|
18
20
|
import { runConfigure, runWhoami } from './auth.js';
|
|
19
21
|
import { runInstall } from './agent.js';
|
|
20
22
|
import { TARGETS, DEFAULT_SKILLS } from '../lib/agent-targets.js';
|
|
23
|
+
import { FALLBACK_TARGET, resolveAgentTargets, } from '../lib/agent-detect.js';
|
|
24
|
+
import { promptText } from '../lib/prompt.js';
|
|
21
25
|
import { readProfile } from '../lib/credentials.js';
|
|
22
26
|
/** Mirrors auth.ts's DEFAULT_API_URL (kept in sync; auth.ts owns the canonical value). */
|
|
23
27
|
const DEFAULT_API_URL = 'https://api.testsprite.com';
|
|
@@ -41,6 +45,22 @@ function resolveReportedEndpoint(opts, deps) {
|
|
|
41
45
|
}
|
|
42
46
|
return opts.endpointUrl ?? envApiUrl ?? existing ?? DEFAULT_API_URL;
|
|
43
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Provenance for the summary. `env` and `trace` both collapse to `detected`
|
|
50
|
+
* because resolution is a union of the two signals — one word cannot honestly
|
|
51
|
+
* label a set whose members came from different ones. The split is carried
|
|
52
|
+
* per target in `detections`.
|
|
53
|
+
*/
|
|
54
|
+
function agentProvenance(r) {
|
|
55
|
+
return {
|
|
56
|
+
detectedBy: r.source === 'flag' || r.source === 'fallback' ? r.source : 'detected',
|
|
57
|
+
detections: r.detections.map(d => ({
|
|
58
|
+
target: d.target,
|
|
59
|
+
source: d.source,
|
|
60
|
+
signal: d.signal,
|
|
61
|
+
})),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
44
64
|
/**
|
|
45
65
|
* Collapse the per-skill install actions into one representative action for the
|
|
46
66
|
* init summary. Precedence: a real change (updated) outranks a fresh install,
|
|
@@ -103,17 +123,119 @@ function toAgentDeps(deps, captureStdout) {
|
|
|
103
123
|
function _suppressedStdout(_line) {
|
|
104
124
|
// intentionally empty
|
|
105
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Say which agents the install covers and why. Silent when `--agent` named one
|
|
128
|
+
* (the caller already knows), and always says the fallback out loud — an
|
|
129
|
+
* unannounced fallback is how skills land where the calling agent cannot read
|
|
130
|
+
* them while the command still reports success.
|
|
131
|
+
*/
|
|
132
|
+
function emitAgentResolutionNotice(resolution, stderrFn, willPrompt = false) {
|
|
133
|
+
if (resolution.source === 'flag')
|
|
134
|
+
return;
|
|
135
|
+
if (resolution.source === 'fallback') {
|
|
136
|
+
stderrFn(`[info] no coding agent detected in this project; installing for ${FALLBACK_TARGET}. ` +
|
|
137
|
+
`Pass --agent <target> to choose (${Object.keys(TARGETS).join(', ')}).`);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const evidence = resolution.detections.map(d => `${d.target} (${d.signal})`).join(', ');
|
|
141
|
+
// When a prompt follows, the install set is not decided yet — saying
|
|
142
|
+
// "installing for X" here would read as a decision already taken.
|
|
143
|
+
if (willPrompt) {
|
|
144
|
+
stderrFn(`[info] detected ${evidence}`);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
stderrFn(`[info] detected ${evidence}; installing skills for ${resolution.targets.join(', ')}`);
|
|
148
|
+
}
|
|
149
|
+
/** Whether `confirmDetectedTargets` will actually ask. */
|
|
150
|
+
function shouldConfirmTargets(resolution, opts, isTTY) {
|
|
151
|
+
const fromDetection = resolution.source === 'env' || resolution.source === 'trace';
|
|
152
|
+
return fromDetection && isTTY && !opts.yes && !opts.dryRun && opts.output !== 'json';
|
|
153
|
+
}
|
|
154
|
+
const CONFIRM_TARGETS_MAX_ATTEMPTS = 3;
|
|
155
|
+
/**
|
|
156
|
+
* Let an operator see and edit the detected set before anything is written.
|
|
157
|
+
*
|
|
158
|
+
* Detection is a UNION of env and repo signals, so an ordinary repo carrying
|
|
159
|
+
* `AGENTS.md` plus a couple of agent config roots resolves to five targets and
|
|
160
|
+
* nine files — two of them shared, always-on rule files. `agent install`
|
|
161
|
+
* already asks when it has to choose; setup asking too keeps the two commands
|
|
162
|
+
* telling the same story.
|
|
163
|
+
*
|
|
164
|
+
* Returns the set to install, or `null` when the answer was `none` — the
|
|
165
|
+
* prompt's equivalent of `--no-agent`. Asks nothing when `--agent` named it
|
|
166
|
+
* (already explicit), on the fallback (one target, and the notice says so),
|
|
167
|
+
* under `--yes`, under `--dry-run` (nothing is written), off a TTY, or in JSON
|
|
168
|
+
* mode — a prompt there would corrupt the single-object stdout contract, the
|
|
169
|
+
* same reason the API-key prompt is refused in that mode.
|
|
170
|
+
*
|
|
171
|
+
* An unrecognised name is refused here and asked again, a bounded number of
|
|
172
|
+
* times. This runs before credentials are written, so a typo costs a retry
|
|
173
|
+
* rather than a half-finished setup that exits 5 after the key was saved.
|
|
174
|
+
*/
|
|
175
|
+
async function confirmDetectedTargets(resolution, opts, isTTY, stderrFn, promptFn) {
|
|
176
|
+
if (!shouldConfirmTargets(resolution, opts, isTTY)) {
|
|
177
|
+
return [...resolution.targets];
|
|
178
|
+
}
|
|
179
|
+
const suggestion = resolution.targets.join(',');
|
|
180
|
+
const validTargets = Object.keys(TARGETS);
|
|
181
|
+
const ask = promptFn ?? ((q) => promptText(q));
|
|
182
|
+
for (let attempt = 1; attempt <= CONFIRM_TARGETS_MAX_ATTEMPTS; attempt++) {
|
|
183
|
+
const answer = (await ask(`Install skills for (comma-separated, or "none" to skip) [${suggestion}]: `)).trim();
|
|
184
|
+
if (answer.toLowerCase() === 'none')
|
|
185
|
+
return null;
|
|
186
|
+
// Lower-cased for the same reason `none` is: every target name is lower
|
|
187
|
+
// case, so `Claude` is a typo only in the sense that the shift key was
|
|
188
|
+
// down. Refusing it while accepting `NONE` would be an inconsistency the
|
|
189
|
+
// user has no way to predict.
|
|
190
|
+
const chosen = (answer || suggestion)
|
|
191
|
+
.split(',')
|
|
192
|
+
.map((s) => s.trim().toLowerCase())
|
|
193
|
+
.filter(Boolean);
|
|
194
|
+
// An answer of only separators ("," / ", ,") parses to nothing. Treat it as
|
|
195
|
+
// the empty answer it effectively is rather than installing for no target.
|
|
196
|
+
if (chosen.length === 0)
|
|
197
|
+
return [...resolution.targets];
|
|
198
|
+
const unknown = chosen.filter(t => !validTargets.includes(t));
|
|
199
|
+
if (unknown.length === 0)
|
|
200
|
+
return [...new Set(chosen)];
|
|
201
|
+
stderrFn(`[warn] unknown target ${unknown.map(t => `"${t}"`).join(', ')}; ` +
|
|
202
|
+
`supported: ${validTargets.join(', ')} (or "none" to skip)`);
|
|
203
|
+
}
|
|
204
|
+
throw new CLIError(`No recognised agent target after ${CONFIRM_TARGETS_MAX_ATTEMPTS} attempts. ` +
|
|
205
|
+
`Re-run with --agent <target> (${validTargets.join(', ')}) or --no-agent.`, 5);
|
|
206
|
+
}
|
|
106
207
|
// ---------------------------------------------------------------------------
|
|
107
208
|
// runInit
|
|
108
209
|
// ---------------------------------------------------------------------------
|
|
109
210
|
export async function runInit(opts, deps = {}) {
|
|
110
211
|
const stderrFn = deps.stderr ?? ((line) => process.stderr.write(`${line}\n`));
|
|
111
212
|
const out = new Output(opts.output, { stdout: deps.stdout, stderr: deps.stderr });
|
|
213
|
+
// An unknown --agent is refused here, before credentials are written. Left
|
|
214
|
+
// to runInstall it surfaced as a `--target` error — a flag this command does
|
|
215
|
+
// not have — after the key was already saved, with a hint echoing the bad
|
|
216
|
+
// value back.
|
|
217
|
+
const validTargets = Object.keys(TARGETS);
|
|
218
|
+
if (opts.agent !== undefined && !opts.noAgent && !validTargets.includes(opts.agent)) {
|
|
219
|
+
throw localValidationError('agent', `unknown target "${opts.agent}"; supported: ${validTargets.join(', ')}`);
|
|
220
|
+
}
|
|
221
|
+
// -------------------------------------------------------------------------
|
|
222
|
+
// Which agents to install for: an explicit --agent, else whatever this repo
|
|
223
|
+
// shows, else the fallback. Resolved before any output so every branch below
|
|
224
|
+
// (conflict warning, dry-run preview, real install) reports the same set.
|
|
225
|
+
// -------------------------------------------------------------------------
|
|
226
|
+
let resolution = opts.noAgent
|
|
227
|
+
? null
|
|
228
|
+
: resolveAgentTargets(opts.agent, opts.dir ?? deps.cwd ?? process.cwd(), {
|
|
229
|
+
env: deps.env,
|
|
230
|
+
...deps.detect,
|
|
231
|
+
});
|
|
112
232
|
// -------------------------------------------------------------------------
|
|
113
233
|
// Fix 5: emit conflict warning when both --agent and --no-agent were given
|
|
114
234
|
// -------------------------------------------------------------------------
|
|
115
235
|
if (opts.rawArgConflict) {
|
|
116
|
-
const effectiveLabel = opts.noAgent
|
|
236
|
+
const effectiveLabel = opts.noAgent
|
|
237
|
+
? '--no-agent'
|
|
238
|
+
: `--agent ${opts.agent ?? resolution?.targets.join(',')}`;
|
|
117
239
|
stderrFn(`[warn] both --no-agent and --agent supplied; using ${effectiveLabel} (last flag wins)`);
|
|
118
240
|
}
|
|
119
241
|
// -------------------------------------------------------------------------
|
|
@@ -141,6 +263,28 @@ export async function runInit(opts, deps = {}) {
|
|
|
141
263
|
throw new CLIError('Interactive API-key prompt is unavailable in --output json mode (it would corrupt JSON stdout). ' +
|
|
142
264
|
'Pass --api-key <key> or --from-env.', 5);
|
|
143
265
|
}
|
|
266
|
+
// Announced only once the guards above have passed — otherwise a `--yes` with
|
|
267
|
+
// no key source printed "detected …" and then exited 5, describing an install
|
|
268
|
+
// that was never going to happen.
|
|
269
|
+
let agentSkippedBy = opts.noAgent ? 'flag' : undefined;
|
|
270
|
+
if (resolution) {
|
|
271
|
+
const willPrompt = shouldConfirmTargets(resolution, opts, isTTY);
|
|
272
|
+
emitAgentResolutionNotice(resolution, stderrFn, willPrompt);
|
|
273
|
+
// A detected set is confirmable before it lands; every other case passes
|
|
274
|
+
// through untouched. Narrowed here so every downstream reader — the install
|
|
275
|
+
// call, the summary, the failure hint — sees the set actually chosen.
|
|
276
|
+
const confirmed = await confirmDetectedTargets(resolution, opts, isTTY, stderrFn, deps.agentPrompt);
|
|
277
|
+
if (confirmed === null) {
|
|
278
|
+
stderrFn('[info] skipping the agent skill install (answered "none")');
|
|
279
|
+
resolution = null;
|
|
280
|
+
agentSkippedBy = 'prompt';
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
resolution = { ...resolution, targets: confirmed };
|
|
284
|
+
if (willPrompt)
|
|
285
|
+
stderrFn(`[info] installing skills for ${confirmed.join(', ')}`);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
144
288
|
// -------------------------------------------------------------------------
|
|
145
289
|
// Dry-run: zero network + zero FS writes; print preview only
|
|
146
290
|
// -------------------------------------------------------------------------
|
|
@@ -153,13 +297,12 @@ export async function runInit(opts, deps = {}) {
|
|
|
153
297
|
: opts.skipIfConfigured
|
|
154
298
|
? 'skip-if-configured'
|
|
155
299
|
: 'prompt'})`);
|
|
156
|
-
|
|
157
|
-
if (!opts.noAgent) {
|
|
300
|
+
if (resolution) {
|
|
158
301
|
// Delegate to runInstall's own dry-run for the file-listing preview.
|
|
159
302
|
// runInstall prints the would-write lines itself under dryRun.
|
|
160
303
|
await runInstall({
|
|
161
304
|
...opts,
|
|
162
|
-
target:
|
|
305
|
+
target: resolution.targets,
|
|
163
306
|
force: opts.force,
|
|
164
307
|
dir: opts.dir,
|
|
165
308
|
}, toAgentDeps(deps));
|
|
@@ -169,8 +312,14 @@ export async function runInit(opts, deps = {}) {
|
|
|
169
312
|
apiUrl: resolveReportedEndpoint(opts, deps),
|
|
170
313
|
env: 'development',
|
|
171
314
|
scopes: [],
|
|
172
|
-
agent:
|
|
173
|
-
? {
|
|
315
|
+
agent: resolution
|
|
316
|
+
? {
|
|
317
|
+
target: resolution.targets[0],
|
|
318
|
+
targets: [...resolution.targets],
|
|
319
|
+
...agentProvenance(resolution),
|
|
320
|
+
action: 'dry-run',
|
|
321
|
+
skills: [...DEFAULT_SKILLS],
|
|
322
|
+
}
|
|
174
323
|
: null,
|
|
175
324
|
status: 'initialized',
|
|
176
325
|
};
|
|
@@ -225,10 +374,10 @@ export async function runInit(opts, deps = {}) {
|
|
|
225
374
|
// -------------------------------------------------------------------------
|
|
226
375
|
// Step 3: Agent skill install (unless --no-agent)
|
|
227
376
|
// -------------------------------------------------------------------------
|
|
228
|
-
let
|
|
377
|
+
let installedTargets = null;
|
|
229
378
|
let installedAction = null;
|
|
230
379
|
let installedSkills = [];
|
|
231
|
-
if (
|
|
380
|
+
if (resolution) {
|
|
232
381
|
// Run install in JSON mode internally so we can reliably parse the result
|
|
233
382
|
// regardless of the outer --output flag. The stdout is captured here and
|
|
234
383
|
// NOT forwarded — runInit owns the output surface. setup installs the full
|
|
@@ -250,12 +399,12 @@ export async function runInit(opts, deps = {}) {
|
|
|
250
399
|
await runInstall({
|
|
251
400
|
...opts,
|
|
252
401
|
output: 'json', // parse the result; final summary is ours to print
|
|
253
|
-
target:
|
|
402
|
+
target: resolution.targets,
|
|
254
403
|
// skills omitted → runInstall installs DEFAULT_SKILLS (verify + onboard)
|
|
255
404
|
force: opts.force,
|
|
256
405
|
dir: opts.dir,
|
|
257
406
|
}, toAgentDeps(deps, captureStdout));
|
|
258
|
-
|
|
407
|
+
installedTargets = [...resolution.targets];
|
|
259
408
|
installedAction =
|
|
260
409
|
capturedInstallResults.length > 0
|
|
261
410
|
? aggregateInstallAction(capturedInstallResults.map(r => r.action))
|
|
@@ -268,17 +417,19 @@ export async function runInit(opts, deps = {}) {
|
|
|
268
417
|
// Emit a clear summary line BEFORE re-throwing so the user knows their
|
|
269
418
|
// API key was persisted — only the agent skill step failed (Fix 6).
|
|
270
419
|
stderrFn(`[info] credentials saved for profile "${opts.profile}"; only the agent skill install failed — ` +
|
|
271
|
-
`re-run 'testsprite agent install --target ${
|
|
420
|
+
`re-run 'testsprite agent install --target ${resolution.targets.join(',')}' after fixing the path`);
|
|
272
421
|
throw installErr;
|
|
273
422
|
}
|
|
274
423
|
}
|
|
275
424
|
// -------------------------------------------------------------------------
|
|
276
425
|
// Step 4: Summary
|
|
277
426
|
// -------------------------------------------------------------------------
|
|
278
|
-
const agentSummary =
|
|
427
|
+
const agentSummary = resolution === null || installedTargets === null
|
|
279
428
|
? null
|
|
280
429
|
: {
|
|
281
|
-
target:
|
|
430
|
+
target: installedTargets[0],
|
|
431
|
+
targets: installedTargets,
|
|
432
|
+
...agentProvenance(resolution),
|
|
282
433
|
action: installedAction ?? 'installed',
|
|
283
434
|
skills: installedSkills.length > 0 ? installedSkills : [...DEFAULT_SKILLS],
|
|
284
435
|
};
|
|
@@ -291,6 +442,7 @@ export async function runInit(opts, deps = {}) {
|
|
|
291
442
|
email: me.email,
|
|
292
443
|
scopes: me.scopes,
|
|
293
444
|
agent: agentSummary,
|
|
445
|
+
...(agentSummary === null && agentSkippedBy ? { agentSkippedBy } : {}),
|
|
294
446
|
status: 'initialized',
|
|
295
447
|
};
|
|
296
448
|
out.print(summary, renderInitText);
|
|
@@ -312,13 +464,16 @@ function renderInitText(data) {
|
|
|
312
464
|
lines.push(` scopes: ${s.scopes.join(', ')}`);
|
|
313
465
|
lines.push('');
|
|
314
466
|
if (s.agent) {
|
|
315
|
-
|
|
467
|
+
const targets = s.agent.targets.length > 0 ? s.agent.targets : [s.agent.target];
|
|
468
|
+
lines.push(` agent: ${targets.join(', ')} (${s.agent.action})`);
|
|
316
469
|
if (s.agent.skills && s.agent.skills.length > 0) {
|
|
317
470
|
lines.push(` skills: ${s.agent.skills.join(', ')}`);
|
|
318
471
|
}
|
|
319
472
|
}
|
|
320
473
|
else {
|
|
321
|
-
lines.push(
|
|
474
|
+
lines.push(s.agentSkippedBy === 'prompt'
|
|
475
|
+
? ' agent: skipped (answered "none" at the prompt)'
|
|
476
|
+
: ' agent: skipped (--no-agent)');
|
|
322
477
|
}
|
|
323
478
|
lines.push('');
|
|
324
479
|
// DEV-279: an agent session already open when the skills landed won't re-read
|
|
@@ -369,12 +524,18 @@ function resolveCommonOptions(command) {
|
|
|
369
524
|
};
|
|
370
525
|
}
|
|
371
526
|
const SETUP_DESCRIPTION = 'Set up TestSprite: configure your API key and install the TestSprite agent skills for your coding agent';
|
|
372
|
-
/**
|
|
527
|
+
/**
|
|
528
|
+
* Attach the onboarding flags shared by `setup` and the `init`/`auth configure`
|
|
529
|
+
* aliases. `--agent` deliberately carries NO default: its absence is the signal
|
|
530
|
+
* that setup should detect the agent, and a default value here is
|
|
531
|
+
* indistinguishable from the caller naming that same target.
|
|
532
|
+
*/
|
|
373
533
|
export function addSetupOptions(cmd, validTargets, defaultAgent) {
|
|
374
534
|
return cmd
|
|
375
535
|
.option('--api-key <key>', 'API key to configure (skips the interactive prompt)')
|
|
376
536
|
.option('--from-env', 'Read TESTSPRITE_API_KEY from the environment instead of prompting', false)
|
|
377
|
-
.option('--agent <target>', `Coding-agent target to install: ${validTargets.join(', ')}
|
|
537
|
+
.option('--agent <target>', `Coding-agent target to install: ${validTargets.join(', ')} ` +
|
|
538
|
+
`(default: every agent detected in this project, or ${defaultAgent} if none)`)
|
|
378
539
|
.option('--no-agent', 'Skip the agent skill install (configure credentials only)')
|
|
379
540
|
.option('--force', 'Overwrite an existing skill file (a .bak backup is kept)')
|
|
380
541
|
.option('--dir <path>', 'Project root for the skill install (default: current directory)')
|
|
@@ -382,13 +543,10 @@ export function addSetupOptions(cmd, validTargets, defaultAgent) {
|
|
|
382
543
|
.option('--skip-if-configured', 'Skip the API key prompt when credentials already exist for this profile (CI-safe idempotent re-run)');
|
|
383
544
|
}
|
|
384
545
|
/** Build {@link InitOptions} from raw Commander opts + globals. */
|
|
385
|
-
function buildSetupOptions(cmdOpts, command
|
|
546
|
+
function buildSetupOptions(cmdOpts, command) {
|
|
386
547
|
const common = resolveCommonOptions(command);
|
|
387
548
|
// Commander sets `agent: false` (boolean) when `--no-agent` is passed,
|
|
388
|
-
// because `--no-agent` is the negation of `--agent <target>`.
|
|
389
|
-
// this: if agent is falsy (false or empty string) default to the CLI default
|
|
390
|
-
// so runInstall never receives a non-string target.
|
|
391
|
-
const resolvedAgent = cmdOpts.agent && typeof cmdOpts.agent === 'string' ? cmdOpts.agent : defaultAgent;
|
|
549
|
+
// because `--no-agent` is the negation of `--agent <target>`.
|
|
392
550
|
const isNoAgent = cmdOpts.noAgent === true || cmdOpts.agent === false;
|
|
393
551
|
// Detect conflict when both --no-agent and --agent <target> appear in the raw
|
|
394
552
|
// args. Commander only populates `rawArgs` on the ROOT command passed to
|
|
@@ -402,11 +560,14 @@ function buildSetupOptions(cmdOpts, command, defaultAgent) {
|
|
|
402
560
|
const rawArgs = root.rawArgs ?? process.argv;
|
|
403
561
|
const rawArgConflict = rawArgs.some((a) => a === '--no-agent') &&
|
|
404
562
|
rawArgs.some((a) => a === '--agent' || a.startsWith('--agent='));
|
|
563
|
+
// Only a real `--agent <target>` reaches runInit. Left undefined otherwise, so
|
|
564
|
+
// setup detects instead of installing for a target nobody asked for.
|
|
565
|
+
const chosenAgent = typeof cmdOpts.agent === 'string' && cmdOpts.agent ? cmdOpts.agent : undefined;
|
|
405
566
|
return {
|
|
406
567
|
...common,
|
|
407
568
|
apiKey: cmdOpts.apiKey,
|
|
408
569
|
fromEnv: Boolean(cmdOpts.fromEnv),
|
|
409
|
-
agent:
|
|
570
|
+
agent: chosenAgent,
|
|
410
571
|
noAgent: isNoAgent,
|
|
411
572
|
force: Boolean(cmdOpts.force),
|
|
412
573
|
dir: cmdOpts.dir,
|
|
@@ -416,8 +577,8 @@ function buildSetupOptions(cmdOpts, command, defaultAgent) {
|
|
|
416
577
|
};
|
|
417
578
|
}
|
|
418
579
|
/** Shared action for `setup` and the deprecated `init` alias. */
|
|
419
|
-
async function runSetupAction(cmdOpts, command, deps
|
|
420
|
-
const opts = buildSetupOptions(cmdOpts, command
|
|
580
|
+
async function runSetupAction(cmdOpts, command, deps) {
|
|
581
|
+
const opts = buildSetupOptions(cmdOpts, command);
|
|
421
582
|
// When --yes is supplied without a key source, force isTTY=false so runInit
|
|
422
583
|
// emits exit 5 with a clear message rather than hanging on a prompt in a
|
|
423
584
|
// headless CI environment where a TTY fd happens to be open.
|
|
@@ -434,7 +595,7 @@ export function createSetupCommand(deps = {}) {
|
|
|
434
595
|
.description(SETUP_DESCRIPTION)
|
|
435
596
|
.addHelpText('after', GLOBAL_OPTS_HINT)
|
|
436
597
|
.action(async (cmdOpts, command) => {
|
|
437
|
-
await runSetupAction(cmdOpts, command, deps
|
|
598
|
+
await runSetupAction(cmdOpts, command, deps);
|
|
438
599
|
});
|
|
439
600
|
}
|
|
440
601
|
/**
|
|
@@ -450,7 +611,7 @@ export function createDeprecatedInitCommand(deps = {}) {
|
|
|
450
611
|
.description('(deprecated) alias for `setup`')
|
|
451
612
|
.action(async (cmdOpts, command) => {
|
|
452
613
|
emitDeprecationNotice('init', 'setup', deps.stderr);
|
|
453
|
-
await runSetupAction(cmdOpts, command, deps
|
|
614
|
+
await runSetupAction(cmdOpts, command, deps);
|
|
454
615
|
});
|
|
455
616
|
}
|
|
456
617
|
/**
|
|
@@ -466,6 +627,6 @@ export function createDeprecatedInitCommand(deps = {}) {
|
|
|
466
627
|
* `addSetupOptions` before wiring this action.
|
|
467
628
|
*/
|
|
468
629
|
export async function runConfigureViaSetup(command, deps, cmdOpts) {
|
|
469
|
-
await runSetupAction(cmdOpts, command, deps
|
|
630
|
+
await runSetupAction(cmdOpts, command, deps);
|
|
470
631
|
}
|
|
471
632
|
//# sourceMappingURL=init.js.map
|