litmus-cli 1.4.7-eng1502.4 → 1.4.8
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 +0 -29
- package/dist/commands/connect.d.ts.map +1 -1
- package/dist/commands/connect.js +20 -2
- package/dist/commands/connect.js.map +1 -1
- package/dist/commands/doctor.d.ts +1 -41
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +26 -188
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/init.d.ts +1 -3
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +36 -77
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +25 -1
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/submit.d.ts.map +1 -1
- package/dist/commands/submit.js +4 -83
- package/dist/commands/submit.js.map +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/ai-tracking.d.ts +10 -0
- package/dist/lib/ai-tracking.d.ts.map +1 -1
- package/dist/lib/ai-tracking.js +25 -0
- package/dist/lib/ai-tracking.js.map +1 -1
- package/dist/lib/backlog-flush.d.ts +118 -0
- package/dist/lib/backlog-flush.d.ts.map +1 -0
- package/dist/lib/backlog-flush.js +268 -0
- package/dist/lib/backlog-flush.js.map +1 -0
- package/dist/lib/config.d.ts +0 -20
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +0 -27
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/detect-project.d.ts +46 -1
- package/dist/lib/detect-project.d.ts.map +1 -1
- package/dist/lib/detect-project.js +40 -19
- package/dist/lib/detect-project.js.map +1 -1
- package/dist/lib/hook-logger.cjs +136 -2
- package/dist/lib/keepalive.d.ts +33 -0
- package/dist/lib/keepalive.d.ts.map +1 -0
- package/dist/lib/keepalive.js +39 -0
- package/dist/lib/keepalive.js.map +1 -0
- package/dist/lib/shadow.d.ts +14 -0
- package/dist/lib/shadow.d.ts.map +1 -1
- package/dist/lib/shadow.js +33 -0
- package/dist/lib/shadow.js.map +1 -1
- package/dist/lib/tracker.d.ts.map +1 -1
- package/dist/lib/tracker.js +9 -1
- package/dist/lib/tracker.js.map +1 -1
- package/dist/lib/watcher.js +31 -7
- package/dist/lib/watcher.js.map +1 -1
- package/package.json +1 -1
- package/dist/lib/editor.d.ts +0 -73
- package/dist/lib/editor.d.ts.map +0 -1
- package/dist/lib/editor.js +0 -222
- package/dist/lib/editor.js.map +0 -1
- package/dist/lib/open-url.d.ts +0 -9
- package/dist/lib/open-url.d.ts.map +0 -1
- package/dist/lib/open-url.js +0 -45
- package/dist/lib/open-url.js.map +0 -1
- package/dist/lib/select.d.ts +0 -64
- package/dist/lib/select.d.ts.map +0 -1
- package/dist/lib/select.js +0 -170
- package/dist/lib/select.js.map +0 -1
- package/dist/lib/session.d.ts +0 -104
- package/dist/lib/session.d.ts.map +0 -1
- package/dist/lib/session.js +0 -327
- package/dist/lib/session.js.map +0 -1
package/dist/lib/select.d.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A single-choice arrow-key picker for the candidate-facing prompts.
|
|
3
|
-
*
|
|
4
|
-
* Written by hand rather than pulled from a prompt library: the CLI ships to
|
|
5
|
-
* candidates' machines, so every dependency is one more thing that can fail to
|
|
6
|
-
* install on an unknown Node/npm. The surface here is one function.
|
|
7
|
-
*
|
|
8
|
-
* Non-interactive stdin (piped, CI, the watcher's auto-submit) never blocks —
|
|
9
|
-
* `select` resolves to null immediately and the caller falls back to printing
|
|
10
|
-
* instructions.
|
|
11
|
-
*/
|
|
12
|
-
export interface SelectChoice<T> {
|
|
13
|
-
value: T;
|
|
14
|
-
label: string;
|
|
15
|
-
/** Dim trailing text — e.g. "not installed", "recommended". */
|
|
16
|
-
hint?: string;
|
|
17
|
-
}
|
|
18
|
-
export type SelectKey = "up" | "down" | "select" | "abort";
|
|
19
|
-
/**
|
|
20
|
-
* Escape sequence → intent. Exported for tests; there is no other way to
|
|
21
|
-
* exercise key handling without a real TTY.
|
|
22
|
-
*
|
|
23
|
-
* A bare ESC deliberately means nothing. An arrow key IS an ESC followed by two
|
|
24
|
-
* more bytes, and a terminal is free to deliver those bytes in separate reads —
|
|
25
|
-
* so a lone ESC is far more likely to be half an arrow than a candidate asking
|
|
26
|
-
* to dismiss the picker. Dismissing has its own row in the list; navigation
|
|
27
|
-
* that closes the picker at random does not.
|
|
28
|
-
*/
|
|
29
|
-
export declare function decodeKey(seq: string): SelectKey | null;
|
|
30
|
-
/**
|
|
31
|
-
* Pull every complete keypress out of the bytes read so far, and hand back
|
|
32
|
-
* whatever trailing fragment is still the start of a sequence.
|
|
33
|
-
*
|
|
34
|
-
* Reads are not keypresses in either direction: holding an arrow key down
|
|
35
|
-
* coalesces several presses into one read, and a slow link or a multiplexer can
|
|
36
|
-
* split a single arrow across two. The caller carries `pending` into the next
|
|
37
|
-
* read, so a split arrow still arrives as one "up".
|
|
38
|
-
*
|
|
39
|
-
* A fragment that turns out NOT to be a sequence start — ESC then a plain
|
|
40
|
-
* letter — drops just the ESC and re-reads the rest, so the letter is not
|
|
41
|
-
* swallowed along with it.
|
|
42
|
-
*/
|
|
43
|
-
export declare function consumeKeys(buffer: string): {
|
|
44
|
-
keys: SelectKey[];
|
|
45
|
-
pending: string;
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* The rendered block, one string per terminal line. Pure, so tests can assert
|
|
49
|
-
* which row carries the pointer without driving a TTY.
|
|
50
|
-
*/
|
|
51
|
-
export declare function renderBlock<T>(title: string, choices: SelectChoice<T>[], active: number): string[];
|
|
52
|
-
/** Whether we can drive a picker at all: both ends must be a TTY. */
|
|
53
|
-
export declare function isInteractive(): boolean;
|
|
54
|
-
/**
|
|
55
|
-
* Show `title` above `choices` and let the candidate move with ↑/↓ and confirm
|
|
56
|
-
* with enter. Resolves to the chosen value, or to null when the picker can't
|
|
57
|
-
* run at all (non-TTY). Ctrl-C exits with 130 — the same thing an un-swallowed
|
|
58
|
-
* SIGINT would have done.
|
|
59
|
-
*
|
|
60
|
-
* The block is erased on exit, so the caller owns what the candidate is left
|
|
61
|
-
* looking at.
|
|
62
|
-
*/
|
|
63
|
-
export declare function select<T>(title: string, choices: SelectChoice<T>[]): Promise<T | null>;
|
|
64
|
-
//# sourceMappingURL=select.d.ts.map
|
package/dist/lib/select.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/lib/select.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,KAAK,EAAE,CAAC,CAAA;IACR,KAAK,EAAE,MAAM,CAAA;IACb,+DAA+D;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;AAK1D;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAkBvD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAgBlF;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAelG;AAED,qEAAqE;AACrE,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAED;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CA4DtF"}
|
package/dist/lib/select.js
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A single-choice arrow-key picker for the candidate-facing prompts.
|
|
3
|
-
*
|
|
4
|
-
* Written by hand rather than pulled from a prompt library: the CLI ships to
|
|
5
|
-
* candidates' machines, so every dependency is one more thing that can fail to
|
|
6
|
-
* install on an unknown Node/npm. The surface here is one function.
|
|
7
|
-
*
|
|
8
|
-
* Non-interactive stdin (piped, CI, the watcher's auto-submit) never blocks —
|
|
9
|
-
* `select` resolves to null immediately and the caller falls back to printing
|
|
10
|
-
* instructions.
|
|
11
|
-
*/
|
|
12
|
-
import { stdin, stdout } from "process";
|
|
13
|
-
import chalk from "chalk";
|
|
14
|
-
const ESC = "\u001b";
|
|
15
|
-
const CTRL_C = "\u0003";
|
|
16
|
-
/** The starts of sequences we understand — held back rather than acted on. */
|
|
17
|
-
const SEQUENCE_PREFIXES = new Set([ESC, `${ESC}[`, `${ESC}O`]);
|
|
18
|
-
/**
|
|
19
|
-
* Escape sequence → intent. Exported for tests; there is no other way to
|
|
20
|
-
* exercise key handling without a real TTY.
|
|
21
|
-
*
|
|
22
|
-
* A bare ESC deliberately means nothing. An arrow key IS an ESC followed by two
|
|
23
|
-
* more bytes, and a terminal is free to deliver those bytes in separate reads —
|
|
24
|
-
* so a lone ESC is far more likely to be half an arrow than a candidate asking
|
|
25
|
-
* to dismiss the picker. Dismissing has its own row in the list; navigation
|
|
26
|
-
* that closes the picker at random does not.
|
|
27
|
-
*/
|
|
28
|
-
export function decodeKey(seq) {
|
|
29
|
-
switch (seq) {
|
|
30
|
-
case `${ESC}[A`: // arrow up, normal mode
|
|
31
|
-
case `${ESC}OA`: // arrow up, application mode (tmux, some terminals)
|
|
32
|
-
case "k":
|
|
33
|
-
return "up";
|
|
34
|
-
case `${ESC}[B`:
|
|
35
|
-
case `${ESC}OB`:
|
|
36
|
-
case "j":
|
|
37
|
-
return "down";
|
|
38
|
-
case "\r":
|
|
39
|
-
case "\n":
|
|
40
|
-
return "select";
|
|
41
|
-
case CTRL_C: // raw mode swallows SIGINT, so we handle Ctrl-C ourselves
|
|
42
|
-
return "abort";
|
|
43
|
-
default:
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Pull every complete keypress out of the bytes read so far, and hand back
|
|
49
|
-
* whatever trailing fragment is still the start of a sequence.
|
|
50
|
-
*
|
|
51
|
-
* Reads are not keypresses in either direction: holding an arrow key down
|
|
52
|
-
* coalesces several presses into one read, and a slow link or a multiplexer can
|
|
53
|
-
* split a single arrow across two. The caller carries `pending` into the next
|
|
54
|
-
* read, so a split arrow still arrives as one "up".
|
|
55
|
-
*
|
|
56
|
-
* A fragment that turns out NOT to be a sequence start — ESC then a plain
|
|
57
|
-
* letter — drops just the ESC and re-reads the rest, so the letter is not
|
|
58
|
-
* swallowed along with it.
|
|
59
|
-
*/
|
|
60
|
-
export function consumeKeys(buffer) {
|
|
61
|
-
const keys = [];
|
|
62
|
-
let rest = buffer;
|
|
63
|
-
while (rest.length > 0) {
|
|
64
|
-
const three = rest.length >= 3 ? decodeKey(rest.slice(0, 3)) : null;
|
|
65
|
-
if (three) {
|
|
66
|
-
keys.push(three);
|
|
67
|
-
rest = rest.slice(3);
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
if (SEQUENCE_PREFIXES.has(rest))
|
|
71
|
-
break; // incomplete — wait for the rest
|
|
72
|
-
const one = decodeKey(rest[0]);
|
|
73
|
-
if (one)
|
|
74
|
-
keys.push(one);
|
|
75
|
-
rest = rest.slice(1);
|
|
76
|
-
}
|
|
77
|
-
return { keys, pending: rest };
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* The rendered block, one string per terminal line. Pure, so tests can assert
|
|
81
|
-
* which row carries the pointer without driving a TTY.
|
|
82
|
-
*/
|
|
83
|
-
export function renderBlock(title, choices, active) {
|
|
84
|
-
const rows = choices.map((c, i) => {
|
|
85
|
-
const on = i === active;
|
|
86
|
-
const pointer = on ? chalk.cyan("❯") : " ";
|
|
87
|
-
const label = on ? chalk.cyan.bold(c.label) : c.label;
|
|
88
|
-
const hint = c.hint ? " " + chalk.dim(c.hint) : "";
|
|
89
|
-
return ` ${pointer} ${label}${hint}`;
|
|
90
|
-
});
|
|
91
|
-
return [
|
|
92
|
-
` ${chalk.bold(title)}`,
|
|
93
|
-
"",
|
|
94
|
-
...rows,
|
|
95
|
-
"",
|
|
96
|
-
chalk.dim(" ↑/↓ to move · enter to choose"),
|
|
97
|
-
];
|
|
98
|
-
}
|
|
99
|
-
/** Whether we can drive a picker at all: both ends must be a TTY. */
|
|
100
|
-
export function isInteractive() {
|
|
101
|
-
return Boolean(stdin.isTTY && stdout.isTTY && typeof stdin.setRawMode === "function");
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Show `title` above `choices` and let the candidate move with ↑/↓ and confirm
|
|
105
|
-
* with enter. Resolves to the chosen value, or to null when the picker can't
|
|
106
|
-
* run at all (non-TTY). Ctrl-C exits with 130 — the same thing an un-swallowed
|
|
107
|
-
* SIGINT would have done.
|
|
108
|
-
*
|
|
109
|
-
* The block is erased on exit, so the caller owns what the candidate is left
|
|
110
|
-
* looking at.
|
|
111
|
-
*/
|
|
112
|
-
export function select(title, choices) {
|
|
113
|
-
if (!isInteractive() || choices.length === 0)
|
|
114
|
-
return Promise.resolve(null);
|
|
115
|
-
let active = 0;
|
|
116
|
-
const lineCount = renderBlock(title, choices, active).length;
|
|
117
|
-
const paint = (first) => {
|
|
118
|
-
if (!first)
|
|
119
|
-
stdout.write(`${ESC}[${lineCount}A`);
|
|
120
|
-
for (const line of renderBlock(title, choices, active)) {
|
|
121
|
-
stdout.write(`${ESC}[2K${line}\n`);
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
const erase = () => {
|
|
125
|
-
stdout.write(`${ESC}[${lineCount}A${ESC}[0J`);
|
|
126
|
-
};
|
|
127
|
-
return new Promise((resolve) => {
|
|
128
|
-
const wasRaw = stdin.isRaw;
|
|
129
|
-
stdout.write(`${ESC}[?25l`); // hide cursor
|
|
130
|
-
stdin.setRawMode(true);
|
|
131
|
-
stdin.resume();
|
|
132
|
-
stdin.setEncoding("utf8");
|
|
133
|
-
paint(true);
|
|
134
|
-
const cleanup = () => {
|
|
135
|
-
stdin.off("data", onData);
|
|
136
|
-
stdin.setRawMode(Boolean(wasRaw));
|
|
137
|
-
stdin.pause();
|
|
138
|
-
stdout.write(`${ESC}[?25h`); // show cursor
|
|
139
|
-
};
|
|
140
|
-
// Carries a half-delivered escape sequence from one read to the next.
|
|
141
|
-
let pending = "";
|
|
142
|
-
const onData = (chunk) => {
|
|
143
|
-
const read = consumeKeys(pending + chunk);
|
|
144
|
-
pending = read.pending;
|
|
145
|
-
for (const key of read.keys) {
|
|
146
|
-
if (key === "up") {
|
|
147
|
-
active = (active - 1 + choices.length) % choices.length;
|
|
148
|
-
paint(false);
|
|
149
|
-
}
|
|
150
|
-
else if (key === "down") {
|
|
151
|
-
active = (active + 1) % choices.length;
|
|
152
|
-
paint(false);
|
|
153
|
-
}
|
|
154
|
-
else if (key === "select") {
|
|
155
|
-
erase();
|
|
156
|
-
cleanup();
|
|
157
|
-
resolve(choices[active].value);
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
else if (key === "abort") {
|
|
161
|
-
erase();
|
|
162
|
-
cleanup();
|
|
163
|
-
process.exit(130);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
stdin.on("data", onData);
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
//# sourceMappingURL=select.js.map
|
package/dist/lib/select.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/lib/select.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,KAAK,EAAE,M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AAC,CAAA;oBAC9B,OAAM;gBACR,CAAC;qBAAM,IAAI,GAAG,KAAK,OAAO,EAAE,CAAC;oBAC3B,KAAK,EAAE,CAAA;oBACP,OAAO,EAAE,CAAA;oBACT,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;gBACnB,CAAC;YACH,CAAC;QACH,CAAC,CAAA;QAED,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC1B,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/lib/session.d.ts
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The assessment shell — how `litmus init` puts the candidate *inside* their
|
|
3
|
-
* assessment folder, and how `litmus submit` takes them back out.
|
|
4
|
-
*
|
|
5
|
-
* A process cannot change its parent shell's working directory, so "cd into the
|
|
6
|
-
* folder for them" has exactly one honest implementation: init spawns an
|
|
7
|
-
* interactive shell rooted in the assessment directory and waits on it. The
|
|
8
|
-
* candidate works in that shell. When submit succeeds it hangs that shell up,
|
|
9
|
-
* the shell exits, init's wait returns, and the candidate is back at the prompt
|
|
10
|
-
* they started from, in the directory they started in — the `cd ..` they never
|
|
11
|
-
* had to type.
|
|
12
|
-
*
|
|
13
|
-
* Two independent facts have to line up before we signal anything:
|
|
14
|
-
* - LITMUS_ASSESSMENT_SHELL=1 in our own environment, which only a shell we
|
|
15
|
-
* spawned can have set, and
|
|
16
|
-
* - a .litmus/shell.pid written by that same init, for this same folder,
|
|
17
|
-
* naming a process that is genuinely one of our ancestors.
|
|
18
|
-
* Either alone could be stale; together they can only describe the shell we are
|
|
19
|
-
* actually standing in.
|
|
20
|
-
*/
|
|
21
|
-
/** Set in the spawned shell's environment; read back by `litmus submit`. */
|
|
22
|
-
export declare const SHELL_ENV_MARKER = "LITMUS_ASSESSMENT_SHELL";
|
|
23
|
-
/**
|
|
24
|
-
* Whether init should hand the candidate a shell at all. Piped stdin (the e2e
|
|
25
|
-
* suite, a CI script, `litmus init | tee`) must never get one — it would hang
|
|
26
|
-
* forever on a shell nobody can type into.
|
|
27
|
-
*/
|
|
28
|
-
export declare function shouldEnterShell(optIn: boolean | undefined): boolean;
|
|
29
|
-
/** The candidate's own shell, falling back to something that certainly exists. */
|
|
30
|
-
export declare function resolveShell(): {
|
|
31
|
-
command: string;
|
|
32
|
-
args: string[];
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Drop the candidate into `projectRoot` in their own shell and block until they
|
|
36
|
-
* leave it — by typing exit, or by `litmus submit` hanging it up.
|
|
37
|
-
*
|
|
38
|
-
* Resolves to "submitted" when the folder is gone by the time the shell exits
|
|
39
|
-
* (submit deleted it), "exited" when the candidate just left.
|
|
40
|
-
*
|
|
41
|
-
* Closing the shell has two triggers, because the two cases know different
|
|
42
|
-
* things: an in-shell `litmus submit` signals it directly (instant, and ordered
|
|
43
|
-
* against its own output), while a submit that happens elsewhere — the deadline
|
|
44
|
-
* auto-submit in the watcher, or a second terminal — is noticed here by the
|
|
45
|
-
* assessment folder disappearing.
|
|
46
|
-
*/
|
|
47
|
-
export declare function enterAssessmentShell(projectRoot: string, folderName: string): Promise<"submitted" | "exited">;
|
|
48
|
-
/** The pid init recorded for this folder's shell, if there is one. */
|
|
49
|
-
export declare function readAssessmentShellPid(projectRoot: string): number | null;
|
|
50
|
-
/**
|
|
51
|
-
* Are we running inside the shell init opened for this folder? Both the
|
|
52
|
-
* environment marker and an ancestry check have to agree — see the file header.
|
|
53
|
-
*
|
|
54
|
-
* Callers use this before printing anything about where the candidate will end
|
|
55
|
-
* up, since leaving the shell moves them out of the folder for free.
|
|
56
|
-
*/
|
|
57
|
-
export declare function inAssessmentShell(shellPid: number | null): boolean;
|
|
58
|
-
/** End the assessment shell. Returns true when the hang-up went out. */
|
|
59
|
-
export declare function hangUpAssessmentShell(shellPid: number | null): boolean;
|
|
60
|
-
/**
|
|
61
|
-
* The shell that launched this command, if it is one a human is typing into.
|
|
62
|
-
*
|
|
63
|
-
* This is NOT the assessment shell — it is whatever terminal the candidate
|
|
64
|
-
* happened to run `litmus submit` in, most often their editor's integrated
|
|
65
|
-
* terminal. Two independent checks, because getting this wrong means signalling
|
|
66
|
-
* something we don't own: the streams must be a TTY (the watcher's auto-submit
|
|
67
|
-
* runs on pipes), and the parent process must actually be a shell by name.
|
|
68
|
-
*/
|
|
69
|
-
export declare function readHostShellPid(): number | null;
|
|
70
|
-
/**
|
|
71
|
-
* Close the terminal the candidate ran submit in, when we have just deleted the
|
|
72
|
-
* directory it is standing in.
|
|
73
|
-
*
|
|
74
|
-
* This is the other half of "cd them back out". The assessment shell only helps
|
|
75
|
-
* candidates who stayed in it; the common flow is to run init in one terminal
|
|
76
|
-
* and then work in the editor's integrated one, and that terminal is left
|
|
77
|
-
* pointing at a directory that no longer exists — `ls` fails, the prompt lies.
|
|
78
|
-
* We cannot change its directory (no process can change its parent's), so the
|
|
79
|
-
* only way out is to end it.
|
|
80
|
-
*
|
|
81
|
-
* Deliberately narrow: only when submit's own working directory was inside the
|
|
82
|
-
* folder it just deleted, only for a real interactive shell, and only when that
|
|
83
|
-
* shell has a virtualenv active.
|
|
84
|
-
*
|
|
85
|
-
* The virtualenv gate is what keeps this proportional. Closing someone's
|
|
86
|
-
* terminal is intrusive, so it should only happen when the deletion actually
|
|
87
|
-
* broke the shell rather than merely emptied its directory — and for a Python
|
|
88
|
-
* assessment the venv is one init created INSIDE the assessment folder, so it
|
|
89
|
-
* has just gone with it: the interpreter on that shell's PATH no longer exists,
|
|
90
|
-
* and there is no way to deactivate a venv from outside the shell holding it
|
|
91
|
-
* any more than there is to cd one. With no venv, the shell is only pointing at
|
|
92
|
-
* a directory that vanished, which the printed `cd` note covers.
|
|
93
|
-
*/
|
|
94
|
-
export declare function hostShellToHangUp(deletedDir: string, startCwd: string): number | null;
|
|
95
|
-
/**
|
|
96
|
-
* Everything except "the folder is actually gone" — so a caller can know, while
|
|
97
|
-
* the folder is still standing, whether deleting it is going to end this
|
|
98
|
-
* terminal. Submit uses that to keep from printing a `cd` instruction into a
|
|
99
|
-
* tab it is about to close.
|
|
100
|
-
*/
|
|
101
|
-
export declare function willCloseHostShell(assessmentDir: string, startCwd: string): boolean;
|
|
102
|
-
/** Send the hang-up to a pid a caller has already qualified. */
|
|
103
|
-
export declare function hangUpPid(pid: number): boolean;
|
|
104
|
-
//# sourceMappingURL=session.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/lib/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAOH,4EAA4E;AAC5E,eAAO,MAAM,gBAAgB,4BAA4B,CAAA;AAQzD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,CAIpE;AAED,kFAAkF;AAClF,wBAAgB,YAAY,IAAI;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAOlE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,WAAW,GAAG,QAAQ,CAAC,CA8EjC;AAED,sEAAsE;AACtE,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOzE;AA6BD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAIlE;AAgCD,wEAAwE;AACxE,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAGtE;AAQD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAuBhD;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,E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