litmus-cli 1.4.32 → 1.4.34
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 -0
- package/dist/commands/connect.d.ts.map +1 -1
- package/dist/commands/connect.js +59 -6
- package/dist/commands/connect.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +89 -0
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/init.d.ts +56 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +198 -37
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +72 -5
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/submit.d.ts.map +1 -1
- package/dist/commands/submit.js +12 -17
- package/dist/commands/submit.js.map +1 -1
- package/dist/lib/ai-tracking.d.ts +21 -0
- package/dist/lib/ai-tracking.d.ts.map +1 -1
- package/dist/lib/ai-tracking.js +67 -4
- package/dist/lib/ai-tracking.js.map +1 -1
- package/dist/lib/api.d.ts +24 -1
- package/dist/lib/api.d.ts.map +1 -1
- package/dist/lib/api.js +52 -1
- package/dist/lib/api.js.map +1 -1
- package/dist/lib/capture-nudge.d.ts.map +1 -1
- package/dist/lib/capture-nudge.js +5 -3
- package/dist/lib/capture-nudge.js.map +1 -1
- package/dist/lib/capture-selftest.d.ts +202 -0
- package/dist/lib/capture-selftest.d.ts.map +1 -0
- package/dist/lib/capture-selftest.js +492 -0
- package/dist/lib/capture-selftest.js.map +1 -0
- package/dist/lib/cursor-restart.d.ts +260 -0
- package/dist/lib/cursor-restart.d.ts.map +1 -0
- package/dist/lib/cursor-restart.js +308 -0
- package/dist/lib/cursor-restart.js.map +1 -0
- package/dist/lib/hook-logger.cjs +373 -42
- package/dist/lib/schemas.d.ts +5 -0
- package/dist/lib/schemas.d.ts.map +1 -1
- package/dist/lib/schemas.js +10 -0
- package/dist/lib/schemas.js.map +1 -1
- package/dist/lib/submit-route.d.ts +32 -41
- package/dist/lib/submit-route.d.ts.map +1 -1
- package/dist/lib/submit-route.js +33 -42
- package/dist/lib/submit-route.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,42 +1,39 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Which command
|
|
3
|
-
* (ENG-2130).
|
|
2
|
+
* Which command hands work in, for the install this CLI is running from.
|
|
4
3
|
*
|
|
5
|
-
* There are two flows and
|
|
4
|
+
* There are two flows, and inside a Codespaces v2 workspace both names reach the
|
|
5
|
+
* same place:
|
|
6
6
|
*
|
|
7
|
-
* * ON A LAPTOP (the CLI flow)
|
|
8
|
-
*
|
|
9
|
-
* * INSIDE A
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
7
|
+
* * ON A LAPTOP (the CLI flow) `litmus submit` zips the local checkout and
|
|
8
|
+
* uploads it to `/cli/submit`.
|
|
9
|
+
* * INSIDE A WORKSPACE `litmus push` POSTs `/workspace/submit` — the same
|
|
10
|
+
* endpoint the assessment page's Submit button calls, capturing the live
|
|
11
|
+
* container filesystem host-side (ENG-621). There is nothing local to zip.
|
|
12
|
+
* Since ENG-2523 `litmus submit` there runs `push` rather than refusing
|
|
13
|
+
* (ENG-2130), because candidates reach for `submit` and a refusal sent them
|
|
14
|
+
* back to the browser to press the button.
|
|
13
15
|
*
|
|
14
|
-
* WHY
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* therefore went out as a literal `Authorization: Bearer undefined` and was
|
|
23
|
-
* refused — AFTER the archive had been built, so a candidate read it as an
|
|
24
|
-
* upload failure rather than as the wrong command. Every surface that names a
|
|
25
|
-
* submit command was naming the laptop one to both audiences, so the answer is
|
|
26
|
-
* derived in one place and the sites ask.
|
|
16
|
+
* WHY `submit` DELEGATES RATHER THAN READING THE INJECTED TOKEN ITSELF. Giving it
|
|
17
|
+
* the env fallback `push` has would route a v2 candidate down `/cli/submit`,
|
|
18
|
+
* which grades an UPLOADED zip, while v2's canonical submit grades the live
|
|
19
|
+
* filesystem — the two flows would then disagree about what a submission is.
|
|
20
|
+
* Delegating keeps one definition. The token must also never be written into
|
|
21
|
+
* `.litmus/config.json` (what `submit` reads on a laptop): hostd stages that file
|
|
22
|
+
* with deliberately no `token` because it rides the submission zip and the R2
|
|
23
|
+
* durability tar.
|
|
27
24
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
25
|
+
* WHY THE COMMAND WE NAME IS STILL `push`. `submitCommandFor` answers `push`
|
|
26
|
+
* inside a workspace even though `submit` now works there, because the delegation
|
|
27
|
+
* is keyed on the INSTALL, not the assessment: a v2 candidate who learns
|
|
28
|
+
* `litmus submit` and runs it on their own laptop uploads whatever local folder
|
|
29
|
+
* they are in, and `/cli/submit` does not check the provider. `push` does the
|
|
30
|
+
* right thing from either place, so it is the one to teach.
|
|
34
31
|
*
|
|
35
32
|
* The predicate is `isWorkspaceInstall`, read from our own module path for the
|
|
36
33
|
* reasons its own docstring gives (an env marker is absent in an sshd session,
|
|
37
34
|
* and a marker injected alongside the token disappears in exactly the case we
|
|
38
35
|
* need to describe). Nothing security-relevant hangs off any of this: it only
|
|
39
|
-
* decides which command a candidate is told to run.
|
|
36
|
+
* decides which command runs and which one a candidate is told to run.
|
|
40
37
|
*/
|
|
41
38
|
/** The submit command inside a Codespaces v2 workspace. */
|
|
42
39
|
export declare const WORKSPACE_SUBMIT_COMMAND = "litmus push";
|
|
@@ -50,19 +47,13 @@ export declare const LOCAL_SUBMIT_COMMAND = "litmus submit";
|
|
|
50
47
|
* the laptop one.
|
|
51
48
|
*/
|
|
52
49
|
export declare function submitCommandFor(moduleUrl: string): string;
|
|
53
|
-
/** A refusal to run, as `fatal(message, hint)` takes it. */
|
|
54
|
-
export type SubmitRefusal = {
|
|
55
|
-
message: string;
|
|
56
|
-
hint: string;
|
|
57
|
-
};
|
|
58
50
|
/**
|
|
59
|
-
*
|
|
51
|
+
* Whether `litmus submit` should submit the workspace (run `push`) instead of
|
|
52
|
+
* zipping a local checkout.
|
|
60
53
|
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* problem. Both routes named in the hint reach `/workspace/submit`, so this
|
|
65
|
-
* points at the two things that work and sends the candidate nowhere new.
|
|
54
|
+
* True only for the in-workspace install. The caller must ask BEFORE doing any
|
|
55
|
+
* work: the laptop path walks the cwd, reads `.litmus/config.json` and builds an
|
|
56
|
+
* archive, none of which means anything in a workspace (ENG-2130).
|
|
66
57
|
*/
|
|
67
|
-
export declare function
|
|
58
|
+
export declare function submitsWorkspace(moduleUrl: string): boolean;
|
|
68
59
|
//# sourceMappingURL=submit-route.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submit-route.d.ts","sourceRoot":"","sources":["../../src/lib/submit-route.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"submit-route.d.ts","sourceRoot":"","sources":["../../src/lib/submit-route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAIH,2DAA2D;AAC3D,eAAO,MAAM,wBAAwB,gBAAgB,CAAA;AAErD,yDAAyD;AACzD,eAAO,MAAM,oBAAoB,kBAAkB,CAAA;AAEnD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE3D"}
|
package/dist/lib/submit-route.js
CHANGED
|
@@ -1,42 +1,39 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Which command
|
|
3
|
-
* (ENG-2130).
|
|
2
|
+
* Which command hands work in, for the install this CLI is running from.
|
|
4
3
|
*
|
|
5
|
-
* There are two flows and
|
|
4
|
+
* There are two flows, and inside a Codespaces v2 workspace both names reach the
|
|
5
|
+
* same place:
|
|
6
6
|
*
|
|
7
|
-
* * ON A LAPTOP (the CLI flow)
|
|
8
|
-
*
|
|
9
|
-
* * INSIDE A
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
7
|
+
* * ON A LAPTOP (the CLI flow) `litmus submit` zips the local checkout and
|
|
8
|
+
* uploads it to `/cli/submit`.
|
|
9
|
+
* * INSIDE A WORKSPACE `litmus push` POSTs `/workspace/submit` — the same
|
|
10
|
+
* endpoint the assessment page's Submit button calls, capturing the live
|
|
11
|
+
* container filesystem host-side (ENG-621). There is nothing local to zip.
|
|
12
|
+
* Since ENG-2523 `litmus submit` there runs `push` rather than refusing
|
|
13
|
+
* (ENG-2130), because candidates reach for `submit` and a refusal sent them
|
|
14
|
+
* back to the browser to press the button.
|
|
13
15
|
*
|
|
14
|
-
* WHY
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* therefore went out as a literal `Authorization: Bearer undefined` and was
|
|
23
|
-
* refused — AFTER the archive had been built, so a candidate read it as an
|
|
24
|
-
* upload failure rather than as the wrong command. Every surface that names a
|
|
25
|
-
* submit command was naming the laptop one to both audiences, so the answer is
|
|
26
|
-
* derived in one place and the sites ask.
|
|
16
|
+
* WHY `submit` DELEGATES RATHER THAN READING THE INJECTED TOKEN ITSELF. Giving it
|
|
17
|
+
* the env fallback `push` has would route a v2 candidate down `/cli/submit`,
|
|
18
|
+
* which grades an UPLOADED zip, while v2's canonical submit grades the live
|
|
19
|
+
* filesystem — the two flows would then disagree about what a submission is.
|
|
20
|
+
* Delegating keeps one definition. The token must also never be written into
|
|
21
|
+
* `.litmus/config.json` (what `submit` reads on a laptop): hostd stages that file
|
|
22
|
+
* with deliberately no `token` because it rides the submission zip and the R2
|
|
23
|
+
* durability tar.
|
|
27
24
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
25
|
+
* WHY THE COMMAND WE NAME IS STILL `push`. `submitCommandFor` answers `push`
|
|
26
|
+
* inside a workspace even though `submit` now works there, because the delegation
|
|
27
|
+
* is keyed on the INSTALL, not the assessment: a v2 candidate who learns
|
|
28
|
+
* `litmus submit` and runs it on their own laptop uploads whatever local folder
|
|
29
|
+
* they are in, and `/cli/submit` does not check the provider. `push` does the
|
|
30
|
+
* right thing from either place, so it is the one to teach.
|
|
34
31
|
*
|
|
35
32
|
* The predicate is `isWorkspaceInstall`, read from our own module path for the
|
|
36
33
|
* reasons its own docstring gives (an env marker is absent in an sshd session,
|
|
37
34
|
* and a marker injected alongside the token disappears in exactly the case we
|
|
38
35
|
* need to describe). Nothing security-relevant hangs off any of this: it only
|
|
39
|
-
* decides which command a candidate is told to run.
|
|
36
|
+
* decides which command runs and which one a candidate is told to run.
|
|
40
37
|
*/
|
|
41
38
|
import { isWorkspaceInstall } from "./workspace-token.js";
|
|
42
39
|
/** The submit command inside a Codespaces v2 workspace. */
|
|
@@ -54,20 +51,14 @@ export function submitCommandFor(moduleUrl) {
|
|
|
54
51
|
return isWorkspaceInstall(moduleUrl) ? WORKSPACE_SUBMIT_COMMAND : LOCAL_SUBMIT_COMMAND;
|
|
55
52
|
}
|
|
56
53
|
/**
|
|
57
|
-
*
|
|
54
|
+
* Whether `litmus submit` should submit the workspace (run `push`) instead of
|
|
55
|
+
* zipping a local checkout.
|
|
58
56
|
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* problem. Both routes named in the hint reach `/workspace/submit`, so this
|
|
63
|
-
* points at the two things that work and sends the candidate nowhere new.
|
|
57
|
+
* True only for the in-workspace install. The caller must ask BEFORE doing any
|
|
58
|
+
* work: the laptop path walks the cwd, reads `.litmus/config.json` and builds an
|
|
59
|
+
* archive, none of which means anything in a workspace (ENG-2130).
|
|
64
60
|
*/
|
|
65
|
-
export function
|
|
66
|
-
|
|
67
|
-
return null;
|
|
68
|
-
return {
|
|
69
|
-
message: "`litmus submit` cannot submit a Litmus workspace: it uploads a local checkout, and your work lives in this container.",
|
|
70
|
-
hint: `Run \`${WORKSPACE_SUBMIT_COMMAND}\` in this terminal instead, or click Submit assessment on your assessment page.`,
|
|
71
|
-
};
|
|
61
|
+
export function submitsWorkspace(moduleUrl) {
|
|
62
|
+
return isWorkspaceInstall(moduleUrl);
|
|
72
63
|
}
|
|
73
64
|
//# sourceMappingURL=submit-route.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submit-route.js","sourceRoot":"","sources":["../../src/lib/submit-route.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"submit-route.js","sourceRoot":"","sources":["../../src/lib/submit-route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAEzD,2DAA2D;AAC3D,MAAM,CAAC,MAAM,wBAAwB,GAAG,aAAa,CAAA;AAErD,yDAAyD;AACzD,MAAM,CAAC,MAAM,oBAAoB,GAAG,eAAe,CAAA;AAEnD;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAAiB;IAChD,OAAO,kBAAkB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,oBAAoB,CAAA;AACxF,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAAiB;IAChD,OAAO,kBAAkB,CAAC,SAAS,CAAC,CAAA;AACtC,CAAC"}
|