terminal-pilot 0.0.39 → 0.0.41
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 +13 -1
- package/dist/cli.js +24 -4
- package/dist/cli.js.map +2 -2
- package/dist/commands/close-session.js +9 -1
- package/dist/commands/close-session.js.map +2 -2
- package/dist/commands/create-session.js +9 -1
- package/dist/commands/create-session.js.map +2 -2
- package/dist/commands/daemon-runtime.js +13 -2
- package/dist/commands/daemon-runtime.js.map +2 -2
- package/dist/commands/fill.js +9 -1
- package/dist/commands/fill.js.map +2 -2
- package/dist/commands/get-session.js +9 -1
- package/dist/commands/get-session.js.map +2 -2
- package/dist/commands/index.d.ts +4 -0
- package/dist/commands/index.js +19 -2
- package/dist/commands/index.js.map +2 -2
- package/dist/commands/list-sessions.js +9 -1
- package/dist/commands/list-sessions.js.map +2 -2
- package/dist/commands/press-key.js +9 -1
- package/dist/commands/press-key.js.map +2 -2
- package/dist/commands/read-history.js +9 -1
- package/dist/commands/read-history.js.map +2 -2
- package/dist/commands/read-screen.js +9 -1
- package/dist/commands/read-screen.js.map +2 -2
- package/dist/commands/resize.js +9 -1
- package/dist/commands/resize.js.map +2 -2
- package/dist/commands/runtime.js +9 -1
- package/dist/commands/runtime.js.map +2 -2
- package/dist/commands/screenshot.js +9 -1
- package/dist/commands/screenshot.js.map +2 -2
- package/dist/commands/send-signal.js +9 -1
- package/dist/commands/send-signal.js.map +2 -2
- package/dist/commands/type.js +9 -1
- package/dist/commands/type.js.map +2 -2
- package/dist/commands/wait-for-exit.js +9 -1
- package/dist/commands/wait-for-exit.js.map +2 -2
- package/dist/commands/wait-for.d.ts +2 -0
- package/dist/commands/wait-for.js +19 -2
- package/dist/commands/wait-for.js.map +2 -2
- package/dist/index.js +9 -1
- package/dist/index.js.map +2 -2
- package/dist/terminal-pilot.js +9 -1
- package/dist/terminal-pilot.js.map +2 -2
- package/dist/terminal-session.d.ts +1 -0
- package/dist/terminal-session.js +9 -1
- package/dist/terminal-session.js.map +2 -2
- package/dist/testing/cli-repl.js +24 -4
- package/dist/testing/cli-repl.js.map +2 -2
- package/dist/testing/qa-cli.js +24 -4
- package/dist/testing/qa-cli.js.map +2 -2
- package/node_modules/toolcraft-design/dist/index.d.ts +2 -2
- package/node_modules/toolcraft-design/dist/index.js +1 -1
- package/node_modules/toolcraft-design/dist/render-markdown-plaintext.d.ts +2 -0
- package/node_modules/toolcraft-design/dist/render-markdown-plaintext.js +1 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/index.d.ts +2 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/index.js +1 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/parser/inline.js +38 -2
- package/node_modules/toolcraft-design/dist/terminal-markdown/plaintext-renderer.d.ts +11 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/plaintext-renderer.js +228 -0
- package/node_modules/toolcraft-design/package.json +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -168,7 +168,10 @@ class TerminalSession {
|
|
|
168
168
|
press(key: TerminalKey): Promise<void>;
|
|
169
169
|
send(raw: string): Promise<void>; // raw bytes / escape sequences
|
|
170
170
|
signal(signal: string): Promise<void>;
|
|
171
|
-
waitFor(
|
|
171
|
+
waitFor(
|
|
172
|
+
pattern: string | RegExp,
|
|
173
|
+
options?: { timeout?: number; scope?: "history" | "screen" }
|
|
174
|
+
): Promise<string>;
|
|
172
175
|
waitForExit(options?: { timeout?: number }): Promise<number>; // throws on timeout
|
|
173
176
|
waitForQuiet(ms: number): Promise<void>;
|
|
174
177
|
screen(): Promise<TerminalScreen>;
|
|
@@ -249,6 +252,15 @@ Typical fixture workflow:
|
|
|
249
252
|
4. Assert with `screen()` or `history()`
|
|
250
253
|
5. `close()` the session
|
|
251
254
|
|
|
255
|
+
`waitFor(...)` searches captured output history by default. Use
|
|
256
|
+
`waitFor(pattern, { scope: "screen" })` when command echoes or previous output could match before
|
|
257
|
+
the expected interactive screen is visible.
|
|
258
|
+
|
|
259
|
+
When launching an interactive program through `npm run`, npm can buffer printable raw keys such as
|
|
260
|
+
`q` until `Enter` is pressed. Prefer launching the underlying executable directly for raw-key tests.
|
|
261
|
+
If the npm wrapper is part of the behavior under test, use `Control+c` for teardown and treat
|
|
262
|
+
printable-key delivery as npm-wrapper behavior rather than application behavior.
|
|
263
|
+
|
|
252
264
|
Example fixture-based test:
|
|
253
265
|
|
|
254
266
|
```ts
|
package/dist/cli.js
CHANGED
|
@@ -18995,10 +18995,13 @@ var TerminalSession = class {
|
|
|
18995
18995
|
}
|
|
18996
18996
|
async waitFor(pattern, opts) {
|
|
18997
18997
|
const timeout = opts?.timeout ?? DEFAULT_TIMEOUT_MS;
|
|
18998
|
+
const scope = opts?.scope ?? "history";
|
|
18998
18999
|
assertTimeout(timeout);
|
|
19000
|
+
assertWaitScope(scope);
|
|
18999
19001
|
const startedAt = Date.now();
|
|
19000
19002
|
while (Date.now() - startedAt <= timeout) {
|
|
19001
|
-
const
|
|
19003
|
+
const source = scope === "screen" ? (await this.screen()).text : this.rawBuffer;
|
|
19004
|
+
const matched = matchPattern(source, pattern);
|
|
19002
19005
|
if (matched !== null) {
|
|
19003
19006
|
return matched;
|
|
19004
19007
|
}
|
|
@@ -19119,6 +19122,11 @@ function assertTimeout(timeout) {
|
|
|
19119
19122
|
throw new Error("Timeout must be a finite non-negative number.");
|
|
19120
19123
|
}
|
|
19121
19124
|
}
|
|
19125
|
+
function assertWaitScope(scope) {
|
|
19126
|
+
if (scope !== "history" && scope !== "screen") {
|
|
19127
|
+
throw new Error('Wait scope must be either "history" or "screen".');
|
|
19128
|
+
}
|
|
19129
|
+
}
|
|
19122
19130
|
function assertQuietPeriod(duration) {
|
|
19123
19131
|
if (!Number.isFinite(duration) || duration < 0) {
|
|
19124
19132
|
throw new Error("Quiet period must be a finite non-negative number.");
|
|
@@ -22819,6 +22827,11 @@ var params15 = S.Object({
|
|
|
22819
22827
|
timeout: S.Optional(
|
|
22820
22828
|
S.Number({ short: "t", description: "Maximum wait time in milliseconds", minimum: 0 })
|
|
22821
22829
|
),
|
|
22830
|
+
scope: S.Optional(
|
|
22831
|
+
S.Enum(["history", "screen"], {
|
|
22832
|
+
description: "Search all captured output or only the current visible screen"
|
|
22833
|
+
})
|
|
22834
|
+
),
|
|
22822
22835
|
literal: S.Optional(
|
|
22823
22836
|
S.Boolean({
|
|
22824
22837
|
short: "l",
|
|
@@ -22842,7 +22855,11 @@ var waitFor = defineCommand({
|
|
|
22842
22855
|
env
|
|
22843
22856
|
);
|
|
22844
22857
|
const pattern = params17.literal === true ? params17.pattern : new RegExp(params17.pattern);
|
|
22845
|
-
const
|
|
22858
|
+
const options = params17.timeout === void 0 && params17.scope === void 0 ? void 0 : {
|
|
22859
|
+
...params17.timeout === void 0 ? {} : { timeout: params17.timeout },
|
|
22860
|
+
...params17.scope === void 0 ? {} : { scope: params17.scope }
|
|
22861
|
+
};
|
|
22862
|
+
const line = await namedSession.session.waitFor(pattern, options);
|
|
22846
22863
|
return { matched: true, line };
|
|
22847
22864
|
}
|
|
22848
22865
|
});
|
|
@@ -23030,7 +23047,10 @@ function createDaemonTerminalPilotRuntime() {
|
|
|
23030
23047
|
return {
|
|
23031
23048
|
async createSession(params17, env) {
|
|
23032
23049
|
const result = await request("createSession", {
|
|
23033
|
-
params:
|
|
23050
|
+
params: {
|
|
23051
|
+
...params17,
|
|
23052
|
+
cwd: params17.cwd ?? process.cwd()
|
|
23053
|
+
},
|
|
23034
23054
|
envSession: env?.get(SESSION_ENV_VAR)
|
|
23035
23055
|
});
|
|
23036
23056
|
return { name: result.name, session: proxySession(result.name, result.session) };
|
|
@@ -23305,7 +23325,7 @@ function sleep2(ms) {
|
|
|
23305
23325
|
// src/cli.ts
|
|
23306
23326
|
configureTheme({ brand: "green", label: "Terminal Pilot" });
|
|
23307
23327
|
function getBundledPackageVersion() {
|
|
23308
|
-
return true ? "0.0.
|
|
23328
|
+
return true ? "0.0.41" : void 0;
|
|
23309
23329
|
}
|
|
23310
23330
|
function normalizeArgv(argv) {
|
|
23311
23331
|
if (argv.includes("--json") && !argv.some((argument) => argument === "--output" || argument.startsWith("--output="))) {
|