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.
Files changed (46) hide show
  1. package/README.md +11 -0
  2. package/dist/commands/connect.d.ts.map +1 -1
  3. package/dist/commands/connect.js +59 -6
  4. package/dist/commands/connect.js.map +1 -1
  5. package/dist/commands/doctor.d.ts.map +1 -1
  6. package/dist/commands/doctor.js +89 -0
  7. package/dist/commands/doctor.js.map +1 -1
  8. package/dist/commands/init.d.ts +56 -0
  9. package/dist/commands/init.d.ts.map +1 -1
  10. package/dist/commands/init.js +198 -37
  11. package/dist/commands/init.js.map +1 -1
  12. package/dist/commands/push.d.ts.map +1 -1
  13. package/dist/commands/push.js +72 -5
  14. package/dist/commands/push.js.map +1 -1
  15. package/dist/commands/submit.d.ts.map +1 -1
  16. package/dist/commands/submit.js +12 -17
  17. package/dist/commands/submit.js.map +1 -1
  18. package/dist/lib/ai-tracking.d.ts +21 -0
  19. package/dist/lib/ai-tracking.d.ts.map +1 -1
  20. package/dist/lib/ai-tracking.js +67 -4
  21. package/dist/lib/ai-tracking.js.map +1 -1
  22. package/dist/lib/api.d.ts +24 -1
  23. package/dist/lib/api.d.ts.map +1 -1
  24. package/dist/lib/api.js +52 -1
  25. package/dist/lib/api.js.map +1 -1
  26. package/dist/lib/capture-nudge.d.ts.map +1 -1
  27. package/dist/lib/capture-nudge.js +5 -3
  28. package/dist/lib/capture-nudge.js.map +1 -1
  29. package/dist/lib/capture-selftest.d.ts +202 -0
  30. package/dist/lib/capture-selftest.d.ts.map +1 -0
  31. package/dist/lib/capture-selftest.js +492 -0
  32. package/dist/lib/capture-selftest.js.map +1 -0
  33. package/dist/lib/cursor-restart.d.ts +260 -0
  34. package/dist/lib/cursor-restart.d.ts.map +1 -0
  35. package/dist/lib/cursor-restart.js +308 -0
  36. package/dist/lib/cursor-restart.js.map +1 -0
  37. package/dist/lib/hook-logger.cjs +373 -42
  38. package/dist/lib/schemas.d.ts +5 -0
  39. package/dist/lib/schemas.d.ts.map +1 -1
  40. package/dist/lib/schemas.js +10 -0
  41. package/dist/lib/schemas.js.map +1 -1
  42. package/dist/lib/submit-route.d.ts +32 -41
  43. package/dist/lib/submit-route.d.ts.map +1 -1
  44. package/dist/lib/submit-route.js +33 -42
  45. package/dist/lib/submit-route.js.map +1 -1
  46. package/package.json +1 -1
@@ -1,42 +1,39 @@
1
1
  /**
2
- * Which command actually hands work in, for the install this CLI is running from
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 each has exactly one submit command:
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) it is `litmus submit`, which zips the local
8
- * checkout and uploads it to `/cli/submit`.
9
- * * INSIDE A CODESPACES v2 WORKSPACE it is `litmus push`, which POSTs
10
- * `/workspace/submit` — the same endpoint the assessment page's Submit
11
- * button calls, capturing the live container filesystem host-side (ENG-621).
12
- * There is nothing local to zip.
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 THIS MODULE EXISTS RATHER THAN A CHECK PER SITE. Before ENG-2064 the CLI
15
- * was not in the container at all, so `litmus submit` there was `command not
16
- * found` — useless but unambiguous. That ticket put the CLI on the container's
17
- * PATH and wired the injected `LITMUS_ASSESSMENT_TOKEN` into `push` alone, so
18
- * `submit` became present, runnable, and unable to authenticate: it reads its
19
- * bearer from `.litmus/config.json`, and `hostd._stage_litmus_config` writes
20
- * that file with DELIBERATELY no `token` because it rides the submission zip and
21
- * the R2 durability tar, where a live credential must never sit. The upload
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
- * NOT FIXED BY GIVING `submit` THE ENV FALLBACK `push` HAS. That would make the
29
- * command "work", but it routes a v2 candidate down `/cli/submit`, which grades
30
- * an uploaded zip, while v2's canonical submit grades the live filesystem — the
31
- * two flows would then disagree about what a submission is. That is a product
32
- * decision, not a patch. And it must NOT be fixed by writing the token into
33
- * `.litmus/config.json`, for the reason that file has none today.
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
- * Why `litmus submit` must not run here, or `null` when it may.
51
+ * Whether `litmus submit` should submit the workspace (run `push`) instead of
52
+ * zipping a local checkout.
60
53
  *
61
- * Non-null only for the in-workspace install. The caller is expected to refuse
62
- * on it BEFORE doing any work — the whole defect is that the failure used to
63
- * arrive after a full archive build, which is what made it read as an upload
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 workspaceSubmitRefusal(moduleUrl: string): SubmitRefusal | null;
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;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,4DAA4D;AAC5D,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAO9E"}
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"}
@@ -1,42 +1,39 @@
1
1
  /**
2
- * Which command actually hands work in, for the install this CLI is running from
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 each has exactly one submit command:
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) it is `litmus submit`, which zips the local
8
- * checkout and uploads it to `/cli/submit`.
9
- * * INSIDE A CODESPACES v2 WORKSPACE it is `litmus push`, which POSTs
10
- * `/workspace/submit` — the same endpoint the assessment page's Submit
11
- * button calls, capturing the live container filesystem host-side (ENG-621).
12
- * There is nothing local to zip.
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 THIS MODULE EXISTS RATHER THAN A CHECK PER SITE. Before ENG-2064 the CLI
15
- * was not in the container at all, so `litmus submit` there was `command not
16
- * found` — useless but unambiguous. That ticket put the CLI on the container's
17
- * PATH and wired the injected `LITMUS_ASSESSMENT_TOKEN` into `push` alone, so
18
- * `submit` became present, runnable, and unable to authenticate: it reads its
19
- * bearer from `.litmus/config.json`, and `hostd._stage_litmus_config` writes
20
- * that file with DELIBERATELY no `token` because it rides the submission zip and
21
- * the R2 durability tar, where a live credential must never sit. The upload
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
- * NOT FIXED BY GIVING `submit` THE ENV FALLBACK `push` HAS. That would make the
29
- * command "work", but it routes a v2 candidate down `/cli/submit`, which grades
30
- * an uploaded zip, while v2's canonical submit grades the live filesystem — the
31
- * two flows would then disagree about what a submission is. That is a product
32
- * decision, not a patch. And it must NOT be fixed by writing the token into
33
- * `.litmus/config.json`, for the reason that file has none today.
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
- * Why `litmus submit` must not run here, or `null` when it may.
54
+ * Whether `litmus submit` should submit the workspace (run `push`) instead of
55
+ * zipping a local checkout.
58
56
  *
59
- * Non-null only for the in-workspace install. The caller is expected to refuse
60
- * on it BEFORE doing any work — the whole defect is that the failure used to
61
- * arrive after a full archive build, which is what made it read as an upload
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 workspaceSubmitRefusal(moduleUrl) {
66
- if (!isWorkspaceInstall(moduleUrl))
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;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;AAQD;;;;;;;;GAQG;AACH,MAAM,UAAU,sBAAsB,CAAC,SAAiB;IACtD,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC;QAAE,OAAO,IAAI,CAAA;IAC/C,OAAO;QACL,OAAO,EACL,uHAAuH;QACzH,IAAI,EAAE,SAAS,wBAAwB,kFAAkF;KAC1H,CAAA;AACH,CAAC"}
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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "litmus-cli",
3
- "version": "1.4.32",
3
+ "version": "1.4.34",
4
4
  "description": "CLI tool for Litmus engineering assessments",
5
5
  "license": "MIT",
6
6
  "author": "elenazhao",