@dailephd/my-dev-kit-lab 0.4.5 → 0.4.7

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 (263) hide show
  1. package/CHANGELOG.md +26 -1
  2. package/README.md +43 -3
  3. package/dist/scripts/cli.js +9 -0
  4. package/dist/src/audits/core/typescriptJavaScriptAnalyzer.js +30 -12
  5. package/dist/src/browser/index.js +2 -0
  6. package/dist/src/browser/playwrightRuntime.js +74 -0
  7. package/dist/src/browser/types.js +10 -0
  8. package/dist/src/cli/help.js +376 -0
  9. package/dist/src/cli/index.js +2 -0
  10. package/dist/src/cli/runLabCli.js +257 -0
  11. package/dist/src/commands/runAuditCommand.js +132 -0
  12. package/dist/src/commands/runControlledExperimentCommand.js +7 -3
  13. package/dist/{scripts/experiments/describeExperiment.js → src/commands/runExperimentDescribeCommand.js} +14 -10
  14. package/dist/{scripts/experiments/listExperiments.js → src/commands/runExperimentListCommand.js} +3 -6
  15. package/dist/{scripts/experiments/runExperiment.js → src/commands/runExperimentRunCommand.js} +80 -22
  16. package/dist/src/commands/runFinalDemoCommand.js +2 -3
  17. package/dist/src/commands/runSecurityValidationCommand.js +271 -0
  18. package/dist/src/commands/runTutorialRunCommand.js +170 -0
  19. package/dist/src/commands/runTutorialValidateCommand.js +138 -0
  20. package/dist/src/core/processTree.js +52 -0
  21. package/dist/src/core/resolveCommand.js +34 -0
  22. package/dist/src/core/runMeasuredCommand.js +39 -31
  23. package/dist/src/runtime/index.js +4 -0
  24. package/dist/src/runtime/labExecutionContext.js +22 -0
  25. package/dist/src/runtime/managedProcess.js +380 -0
  26. package/dist/src/runtime/packageResource.js +22 -0
  27. package/dist/src/runtime/packageRoot.js +37 -0
  28. package/dist/src/screenshot/captureReportScreenshot.js +30 -27
  29. package/dist/src/securityValidation/packageChecks/requiredPackageContents.js +14 -1
  30. package/dist/src/tutorial/index.js +16 -0
  31. package/dist/src/tutorial/loadTutorialContracts.js +60 -0
  32. package/dist/src/tutorial/markdownTutorialWriter.js +53 -0
  33. package/dist/src/tutorial/runTutorial.js +465 -0
  34. package/dist/src/tutorial/scenarioValidation.js +383 -0
  35. package/dist/src/tutorial/subtitleWriter.js +88 -0
  36. package/dist/src/tutorial/targetContractValidation.js +212 -0
  37. package/dist/src/tutorial/tutorialActions.js +110 -0
  38. package/dist/src/tutorial/tutorialArtifacts.js +176 -0
  39. package/dist/src/tutorial/tutorialAssertions.js +249 -0
  40. package/dist/src/tutorial/tutorialCursor.js +149 -0
  41. package/dist/src/tutorial/tutorialLocators.js +37 -0
  42. package/dist/src/tutorial/tutorialManifest.js +74 -0
  43. package/dist/src/tutorial/tutorialOverlay.js +180 -0
  44. package/dist/src/tutorial/tutorialPaths.js +86 -0
  45. package/dist/src/tutorial/tutorialSession.js +398 -0
  46. package/dist/src/tutorial/types.js +48 -0
  47. package/dist/src/tutorial/validationPrimitives.js +141 -0
  48. package/examples/tutorial-browser/index.html +47 -0
  49. package/examples/tutorial-browser/prepare.mjs +14 -0
  50. package/examples/tutorial-browser/scenario.json +17 -0
  51. package/examples/tutorial-browser/server.mjs +14 -0
  52. package/package.json +13 -9
  53. package/dist/scripts/audits/runAudit.js +0 -135
  54. package/dist/scripts/build-gallery.js +0 -3
  55. package/dist/scripts/capture-demo-report.js +0 -3
  56. package/dist/scripts/evaluate-token-savings.js +0 -2
  57. package/dist/scripts/generate-experiment-plots.js +0 -3
  58. package/dist/scripts/generate-prompt-variants.js +0 -2
  59. package/dist/scripts/render-experiment-report.js +0 -2
  60. package/dist/scripts/report-context-integrity-smoke.js +0 -70
  61. package/dist/scripts/run-agent-prompt.js +0 -2
  62. package/dist/scripts/run-controlled-experiment.js +0 -2
  63. package/dist/scripts/run-lab-demo.js +0 -5
  64. package/dist/scripts/run-visualization-demos.js +0 -3
  65. package/dist/scripts/security/resolveToolRoot.js +0 -16
  66. package/dist/scripts/security/runCodeql.js +0 -58
  67. package/dist/scripts/security/runDependencyChecks.js +0 -58
  68. package/dist/scripts/security/runFuzzSmoke.js +0 -29
  69. package/dist/scripts/security/runPackageChecks.js +0 -57
  70. package/dist/scripts/security/runSemgrep.js +0 -64
  71. package/dist/scripts/security/validate.js +0 -266
  72. package/dist/scripts/verify-benchmarks.js +0 -202
  73. package/examples/demo-report-input.json +0 -78
  74. package/examples/lab-demo-cases.json +0 -35
  75. package/examples/real-agent-campaign-cases.json +0 -118
  76. package/tests/fixtures/android/advanced-security-fixtures/backup-configuration/module-a/src/debug/res/xml/ambiguous_backup_rules.xml +0 -4
  77. package/tests/fixtures/android/advanced-security-fixtures/backup-configuration/module-a/src/main/res/xml/ambiguous_backup_rules.xml +0 -4
  78. package/tests/fixtures/android/advanced-security-fixtures/backup-configuration/module-a/src/main/res/xml/backup_rules.xml +0 -5
  79. package/tests/fixtures/android/advanced-security-fixtures/backup-configuration/module-a/src/main/res/xml/broad_backup_rules.xml +0 -4
  80. package/tests/fixtures/android/advanced-security-fixtures/backup-configuration/module-a/src/main/res/xml/data_extraction_rules.xml +0 -10
  81. package/tests/fixtures/android/advanced-security-fixtures/backup-configuration/module-a/src/main/res/xml/unsupported_domain_rules.xml +0 -4
  82. package/tests/fixtures/android/advanced-security-fixtures/backup-configuration/module-b/src/main/res/xml/malformed_backup_rules.xml +0 -4
  83. package/tests/fixtures/android/advanced-security-fixtures/backup-configuration/module-b/src/main/res/xml/unsupported_root.xml +0 -4
  84. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-a/src/debug/res/xml/ambiguous_config.xml +0 -4
  85. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-a/src/main/res/xml/ambiguous_config.xml +0 -4
  86. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-a/src/main/res/xml/base_cleartext_false.xml +0 -8
  87. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-a/src/main/res/xml/broad_and_duplicate_domains.xml +0 -8
  88. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-a/src/main/res/xml/empty_domain.xml +0 -6
  89. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-a/src/main/res/xml/malformed_pin.xml +0 -11
  90. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-a/src/main/res/xml/network_security_config.xml +0 -26
  91. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-b/src/main/res/xml/malformed_network_security_config.xml +0 -6
  92. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-b/src/main/res/xml/unsupported_root.xml +0 -4
  93. package/tests/fixtures/android/advanced-security-fixtures/release-configuration/groovy-release-debuggable-dynamic.gradle +0 -7
  94. package/tests/fixtures/android/advanced-security-fixtures/release-configuration/groovy-release-debuggable-false.gradle +0 -9
  95. package/tests/fixtures/android/advanced-security-fixtures/release-configuration/groovy-release-debuggable-true.gradle +0 -13
  96. package/tests/fixtures/android/advanced-security-fixtures/release-configuration/kotlin-release-debuggable-false.gradle.kts +0 -7
  97. package/tests/fixtures/android/advanced-security-fixtures/release-configuration/kotlin-release-debuggable-true.gradle.kts +0 -10
  98. package/tests/fixtures/android/advanced-security-fixtures/release-configuration/missing-release-build-type.gradle.kts +0 -7
  99. package/tests/fixtures/android/advanced-security-fixtures/resource-resolution/module-a/src/debug/res/xml/network_security_config.xml +0 -8
  100. package/tests/fixtures/android/advanced-security-fixtures/resource-resolution/module-a/src/main/res/xml/backup_rules.xml +0 -4
  101. package/tests/fixtures/android/advanced-security-fixtures/resource-resolution/module-a/src/main/res/xml/network_security_config.xml +0 -8
  102. package/tests/fixtures/android/advanced-security-fixtures/resource-resolution/module-b/src/main/res/xml/malformed_network_security_config.xml +0 -7
  103. package/tests/fixtures/android/advanced-security-fixtures/secret-candidates/SampleActivity.java +0 -8
  104. package/tests/fixtures/android/advanced-security-fixtures/secret-candidates/SampleActivity.kt +0 -9
  105. package/tests/fixtures/android/advanced-security-fixtures/secret-candidates/build.gradle +0 -11
  106. package/tests/fixtures/android/advanced-security-fixtures/secret-candidates/build.gradle.kts +0 -11
  107. package/tests/fixtures/android/advanced-security-fixtures/secret-candidates/google-services.json +0 -16
  108. package/tests/fixtures/android/advanced-security-fixtures/secret-candidates/local.properties +0 -3
  109. package/tests/fixtures/android/advanced-security-fixtures/secret-candidates-bounds/module/binary.properties +0 -0
  110. package/tests/fixtures/android/advanced-security-fixtures/secret-candidates-bounds/module/oversized.json +0 -1
  111. package/tests/fixtures/android/advanced-security-fixtures/signing-configuration/app/fake-release-keystore.jks +0 -1
  112. package/tests/fixtures/android/advanced-security-fixtures/signing-configuration/build/generated-fake.keystore +0 -1
  113. package/tests/fixtures/android/compose-app/app/build.gradle.kts +0 -21
  114. package/tests/fixtures/android/compose-app/app/src/main/AndroidManifest.xml +0 -22
  115. package/tests/fixtures/android/compose-app/app/src/main/java/com/example/composeapp/MainActivity.kt +0 -11
  116. package/tests/fixtures/android/compose-app/build.gradle.kts +0 -4
  117. package/tests/fixtures/android/compose-app/gradle/wrapper/gradle-wrapper.properties +0 -4
  118. package/tests/fixtures/android/compose-app/settings.gradle.kts +0 -2
  119. package/tests/fixtures/android/gradle-metadata-fixtures/catalog-only-plugin/build.gradle.kts +0 -3
  120. package/tests/fixtures/android/gradle-metadata-fixtures/catalog-only-plugin/gradle/libs.versions.toml +0 -5
  121. package/tests/fixtures/android/gradle-metadata-fixtures/comment-safety.gradle.kts +0 -21
  122. package/tests/fixtures/android/gradle-metadata-fixtures/dynamic-values.gradle.kts +0 -17
  123. package/tests/fixtures/android/gradle-metadata-fixtures/groovy-literal.gradle +0 -23
  124. package/tests/fixtures/android/gradle-metadata-fixtures/wrapper-malformed.properties +0 -4
  125. package/tests/fixtures/android/gradle-metadata-fixtures/wrapper-missing-url.properties +0 -3
  126. package/tests/fixtures/android/gradle-metadata-fixtures/wrapper-with-checksum.properties +0 -5
  127. package/tests/fixtures/android/java-app/app/build.gradle +0 -16
  128. package/tests/fixtures/android/java-app/app/src/main/AndroidManifest.xml +0 -19
  129. package/tests/fixtures/android/java-app/app/src/main/java/com/example/javaapp/MainActivity.java +0 -4
  130. package/tests/fixtures/android/java-app/build.gradle +0 -3
  131. package/tests/fixtures/android/java-app/gradle/wrapper/gradle-wrapper.properties +0 -4
  132. package/tests/fixtures/android/java-app/settings.gradle +0 -2
  133. package/tests/fixtures/android/library/build.gradle.kts +0 -3
  134. package/tests/fixtures/android/library/gradle/wrapper/gradle-wrapper.properties +0 -4
  135. package/tests/fixtures/android/library/mylibrary/build.gradle.kts +0 -13
  136. package/tests/fixtures/android/library/mylibrary/src/main/AndroidManifest.xml +0 -2
  137. package/tests/fixtures/android/library/settings.gradle.kts +0 -2
  138. package/tests/fixtures/android/manifest-audit-fixtures/incomplete-intent-filter.xml +0 -14
  139. package/tests/fixtures/android/manifest-audit-fixtures/malformed-exported.xml +0 -10
  140. package/tests/fixtures/android/manifest-audit-fixtures/malformed.xml +0 -5
  141. package/tests/fixtures/android/manifest-audit-fixtures/missing-application.xml +0 -7
  142. package/tests/fixtures/android/manifest-audit-fixtures/missing-component-name.xml +0 -11
  143. package/tests/fixtures/android/manifest-audit-fixtures/permission-coverage.xml +0 -29
  144. package/tests/fixtures/android/manifest-audit-fixtures/risky-components.xml +0 -62
  145. package/tests/fixtures/android/manifest-audit-fixtures/risky-deep-links.xml +0 -45
  146. package/tests/fixtures/android/manifest-audit-fixtures/unresolved-placeholder.xml +0 -14
  147. package/tests/fixtures/android/manifest-audit-fixtures/unusual-namespace-prefix.xml +0 -11
  148. package/tests/fixtures/android/multi-module/app/build.gradle.kts +0 -22
  149. package/tests/fixtures/android/multi-module/app/src/androidTest/java/com/example/multimodule/app/ExampleInstrumentedTest.kt +0 -3
  150. package/tests/fixtures/android/multi-module/app/src/main/AndroidManifest.xml +0 -11
  151. package/tests/fixtures/android/multi-module/app/src/test/java/com/example/multimodule/app/ExampleUnitTest.kt +0 -3
  152. package/tests/fixtures/android/multi-module/build.gradle.kts +0 -5
  153. package/tests/fixtures/android/multi-module/core/build.gradle.kts +0 -14
  154. package/tests/fixtures/android/multi-module/core/src/main/AndroidManifest.xml +0 -2
  155. package/tests/fixtures/android/multi-module/feature-login/build.gradle.kts +0 -18
  156. package/tests/fixtures/android/multi-module/feature-login/src/main/AndroidManifest.xml +0 -2
  157. package/tests/fixtures/android/multi-module/gradle/libs.versions.toml +0 -8
  158. package/tests/fixtures/android/multi-module/gradle/wrapper/gradle-wrapper.properties +0 -4
  159. package/tests/fixtures/android/multi-module/settings.gradle.kts +0 -4
  160. package/tests/fixtures/android/non-android-gradle/build.gradle.kts +0 -3
  161. package/tests/fixtures/android/non-android-gradle/core/build.gradle.kts +0 -3
  162. package/tests/fixtures/android/non-android-gradle/core/src/main/java/com/example/core/Core.java +0 -4
  163. package/tests/fixtures/android/non-android-gradle/gradle/wrapper/gradle-wrapper.properties +0 -4
  164. package/tests/fixtures/android/non-android-gradle/settings.gradle.kts +0 -2
  165. package/tests/fixtures/android/partial/app/build.gradle.kts +0 -7
  166. package/tests/fixtures/android/partial/settings.gradle.kts +0 -2
  167. package/tests/fixtures/android/xml-view-app/app/build.gradle.kts +0 -17
  168. package/tests/fixtures/android/xml-view-app/app/src/main/AndroidManifest.xml +0 -31
  169. package/tests/fixtures/android/xml-view-app/app/src/main/kotlin/com/example/xmlviewapp/MainActivity.kt +0 -7
  170. package/tests/fixtures/android/xml-view-app/app/src/main/res/layout/activity_main.xml +0 -4
  171. package/tests/fixtures/android/xml-view-app/build.gradle.kts +0 -4
  172. package/tests/fixtures/android/xml-view-app/gradle/wrapper/gradle-wrapper.properties +0 -4
  173. package/tests/fixtures/android/xml-view-app/settings.gradle.kts +0 -2
  174. package/tests/fixtures/audits/mixed-language/mixed-docs-claims/README.md +0 -16
  175. package/tests/fixtures/audits/mixed-language/mixed-docs-claims/build.gradle.kts +0 -4
  176. package/tests/fixtures/audits/mixed-language/mixed-docs-claims/src/main/java/com/example/Widget.java +0 -7
  177. package/tests/fixtures/audits/mixed-language/mixed-docs-claims/src/main/kotlin/com/example/Gadget.kt +0 -7
  178. package/tests/fixtures/audits/mixed-language/mixed-generated-vendor/README.md +0 -10
  179. package/tests/fixtures/audits/mixed-language/mixed-generated-vendor/build/Main.class +0 -1
  180. package/tests/fixtures/audits/mixed-language/mixed-generated-vendor/dist/index.js +0 -1
  181. package/tests/fixtures/audits/mixed-language/mixed-generated-vendor/generated/schema.ts +0 -1
  182. package/tests/fixtures/audits/mixed-language/mixed-generated-vendor/src/index.ts +0 -3
  183. package/tests/fixtures/audits/mixed-language/mixed-generated-vendor/vendor/lib.py +0 -2
  184. package/tests/fixtures/audits/mixed-language/mixed-java-kotlin/README.md +0 -10
  185. package/tests/fixtures/audits/mixed-language/mixed-java-kotlin/build.gradle.kts +0 -8
  186. package/tests/fixtures/audits/mixed-language/mixed-java-kotlin/settings.gradle.kts +0 -1
  187. package/tests/fixtures/audits/mixed-language/mixed-java-kotlin/src/main/java/com/example/FooService.java +0 -7
  188. package/tests/fixtures/audits/mixed-language/mixed-java-kotlin/src/main/kotlin/com/example/BarService.kt +0 -7
  189. package/tests/fixtures/audits/mixed-language/mixed-java-kotlin/src/test/java/com/example/FooServiceTest.java +0 -8
  190. package/tests/fixtures/audits/mixed-language/mixed-java-kotlin/src/test/kotlin/com/example/BarServiceTest.kt +0 -8
  191. package/tests/fixtures/audits/mixed-language/mixed-python-ts/README.md +0 -8
  192. package/tests/fixtures/audits/mixed-language/mixed-python-ts/src/app.py +0 -7
  193. package/tests/fixtures/audits/mixed-language/mixed-python-ts/src/index.ts +0 -3
  194. package/tests/fixtures/audits/mixed-language/mixed-python-ts/tests/test_app.py +0 -5
  195. package/tests/fixtures/audits/mixed-language/mixed-ts-js/README.md +0 -7
  196. package/tests/fixtures/audits/mixed-language/mixed-ts-js/src/helper.js +0 -5
  197. package/tests/fixtures/audits/mixed-language/mixed-ts-js/src/index.ts +0 -3
  198. package/tests/fixtures/audits/mixed-language/mixed-ts-js/tests/index.sample.ts +0 -5
  199. package/tests/fixtures/audits/mixed-language/mixed-ts-python-jvm/README.md +0 -10
  200. package/tests/fixtures/audits/mixed-language/mixed-ts-python-jvm/build.gradle.kts +0 -4
  201. package/tests/fixtures/audits/mixed-language/mixed-ts-python-jvm/pytests/test_app.py +0 -5
  202. package/tests/fixtures/audits/mixed-language/mixed-ts-python-jvm/src/app.py +0 -2
  203. package/tests/fixtures/audits/mixed-language/mixed-ts-python-jvm/src/helper.js +0 -5
  204. package/tests/fixtures/audits/mixed-language/mixed-ts-python-jvm/src/index.ts +0 -3
  205. package/tests/fixtures/audits/mixed-language/mixed-ts-python-jvm/src/main/java/com/example/Multiplier.java +0 -7
  206. package/tests/fixtures/audits/mixed-language/mixed-ts-python-jvm/src/main/kotlin/com/example/Divider.kt +0 -7
  207. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/corrected-replay/derived/run-integrity-evidence.json +0 -99
  208. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/corrected-replay/producer/implementation-audit.json +0 -1585
  209. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/corrected-replay/producer/implementation-capsule.json +0 -11455
  210. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/00-request.txt +0 -1
  211. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/artifacts/architecture-context-packet.txt +0 -82
  212. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/artifacts/behavior-model.txt +0 -104
  213. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/artifacts/final-report.txt +0 -41
  214. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/artifacts/implementation-context-packet.txt +0 -114
  215. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/artifacts/implementation-report.txt +0 -92
  216. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/artifacts/judge-report.txt +0 -34
  217. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/artifacts/pseudocode-packet.txt +0 -244
  218. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/artifacts/request-brief.txt +0 -40
  219. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/artifacts/test-context-packet.txt +0 -93
  220. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/artifacts/test-implementation-report.txt +0 -69
  221. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/artifacts/test-strategy-packet.txt +0 -354
  222. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/artifacts/verification-report.txt +0 -85
  223. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/derived/run-integrity-evidence.json +0 -98
  224. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/producer/architecture-audit.json +0 -1169
  225. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/producer/architecture-request.json +0 -29
  226. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/producer/implementation-audit.json +0 -1494
  227. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/producer/implementation-capsule.json +0 -11364
  228. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/producer/implementation-request.json +0 -33
  229. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/producer/test-request.json +0 -74
  230. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/reports/architecture-context-retrieval-report.txt +0 -58
  231. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/reports/implementation-context-retrieval-report.txt +0 -75
  232. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/reports/test-context-retrieval-report.txt +0 -84
  233. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/run.json +0 -62
  234. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/tool-versions/my-dev-kit-version.txt +0 -1
  235. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/failed-run/tool-versions/orchestrator-version.txt +0 -1
  236. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/manifests/corrected-replay-manifest.json +0 -19
  237. package/tests/fixtures/ecosystem/context-integrity/v0.4.5/manifests/failed-run-manifest.json +0 -56
  238. package/tests/fixtures/fake-adversarial-cli.js +0 -152
  239. package/tests/fixtures/fake-my-dev-kit-cli.js +0 -83
  240. package/tests/fixtures/full-workflow-library/complete-v1.0.0.json +0 -24
  241. package/tests/fixtures/full-workflow-library/future-minor-v1.1.0-additive.json +0 -25
  242. package/tests/fixtures/stage-context-expectations/complete-v1.0.0.json +0 -230
  243. package/tests/fixtures/stage-context-expectations/future-minor-v1.1.0-additive.json +0 -232
  244. package/tests/fixtures/stage-context-expectations/invalid/malformed-json.txt +0 -1
  245. package/tests/fixtures/stage-context-expectations/invalid/non-object-root.json +0 -1
  246. package/tests/fixtures/stage-context-expectations/minimal-v1.0.0.json +0 -18
  247. package/tests/fixtures/upstream-artifacts/invalid/malformed-json.txt +0 -1
  248. package/tests/fixtures/upstream-artifacts/invalid/non-object-root.json +0 -1
  249. package/tests/fixtures/upstream-artifacts/my-dev-kit/1.10.2/context-capsule/complete-v1.0.0.json +0 -504
  250. package/tests/fixtures/upstream-artifacts/my-dev-kit/1.10.2/context-capsule/future-minor-v1.1.0-additive.json +0 -955
  251. package/tests/fixtures/upstream-artifacts/my-dev-kit/1.10.2/retrieval-audit-record/complete-v1.0.0.json +0 -190
  252. package/tests/fixtures/upstream-artifacts/my-dev-kit/1.10.2/retrieval-audit-record/future-minor-v1.1.0-additive.json +0 -327
  253. package/tests/fixtures/upstream-artifacts/my-dev-kit/1.10.4/PROVENANCE.txt +0 -18
  254. package/tests/fixtures/upstream-artifacts/my-dev-kit/1.10.4/context-capsule/complete-v1.0.0.json +0 -556
  255. package/tests/fixtures/upstream-artifacts/my-dev-kit/1.10.4/retrieval-audit-record/complete-v1.0.0.json +0 -238
  256. package/tests/fixtures/upstream-artifacts/my-dev-kit-1.10.2-identity/PROVENANCE.txt +0 -13
  257. package/tests/fixtures/upstream-artifacts/my-dev-kit-1.10.2-identity/context-capsule.json +0 -7874
  258. package/tests/fixtures/upstream-artifacts/my-dev-kit-1.10.2-identity/retrieval-audit-record.json +0 -1076
  259. package/tests/fixtures/upstream-artifacts/my-dev-kit-orchestrator/1.2.1/workflow-instruction-packet/complete-v1.0.0.json +0 -160
  260. package/tests/fixtures/upstream-artifacts/my-dev-kit-orchestrator/1.2.1/workflow-instruction-packet/future-minor-v1.1.0-additive.json +0 -186
  261. package/tests/fixtures/upstream-artifacts/my-dev-kit-orchestrator/1.2.3/run-integrity/PROVENANCE.txt +0 -31
  262. package/tests/fixtures/upstream-artifacts/my-dev-kit-orchestrator/1.2.3/run-integrity/ready-pass-final-pass.json +0 -132
  263. package/tests/fixtures/upstream-artifacts/my-dev-kit-orchestrator/1.2.3/run-integrity/refresh-required-need-context.json +0 -146
@@ -0,0 +1,376 @@
1
+ export function renderTopLevelHelp() {
2
+ return [
3
+ "my-dev-kit-lab - benchmark, evidence, and evaluation companion for my-dev-kit.",
4
+ "",
5
+ "Usage:",
6
+ " my-dev-kit-lab --help",
7
+ " my-dev-kit-lab --version",
8
+ " my-dev-kit-lab [--workspace <path>] security validate [options]",
9
+ " my-dev-kit-lab [--workspace <path>] audit [options]",
10
+ " my-dev-kit-lab [--workspace <path>] experiment list",
11
+ " my-dev-kit-lab [--workspace <path>] experiment describe --experiment <id>",
12
+ " my-dev-kit-lab [--workspace <path>] experiment run --experiment <id> [options]",
13
+ " my-dev-kit-lab [--workspace <path>] experiment controlled --cases <path> --out <dir> [options]",
14
+ " my-dev-kit-lab [--workspace <path>] report render --experiment <dir> --out <dir> [options]",
15
+ " my-dev-kit-lab [--workspace <path>] plots generate --experiment <dir> --out <dir>",
16
+ " my-dev-kit-lab [--workspace <path>] gallery build --out <dir> [options]",
17
+ " my-dev-kit-lab tutorial validate --scenario <path> [--target-contract <path>]",
18
+ " my-dev-kit-lab [--workspace <path>] tutorial run --scenario <path> --target-contract <path> [options]",
19
+ " my-dev-kit-lab demo final --cases <path> --out <dir> --kit-command <command> [options]",
20
+ "",
21
+ "Options:",
22
+ " -h, --help Show this help message",
23
+ " -V, --version Show the installed my-dev-kit-lab package version",
24
+ " --workspace <path> Writable my-dev-kit-lab workspace root (default: <home>/.my-dev-kit-lab).",
25
+ " Must appear before the command when used.",
26
+ "",
27
+ "Commands:",
28
+ " security validate Run security validation",
29
+ " audit Run a project audit",
30
+ " experiment list List registered experiment plugins",
31
+ " experiment describe Describe a registered experiment plugin",
32
+ " experiment run Run a registered experiment plugin",
33
+ " experiment controlled Run a controlled context-strategy-comparison experiment",
34
+ " report render Render an experiment report from controlled-experiment artifacts",
35
+ " plots generate Generate experiment plot artifacts",
36
+ " gallery build Build a gallery manifest/index",
37
+ " tutorial validate Validate a tutorial scenario and optional target contract",
38
+ " tutorial run Run a declarative browser tutorial scenario",
39
+ " demo final Run the full final demo workflow",
40
+ "",
41
+ "Run \"my-dev-kit-lab <command> --help\" (or \"my-dev-kit-lab <family> <command> --help\") for details.",
42
+ "",
43
+ "Note: the historical direct invocation form (flags without \"demo final\", e.g.",
44
+ "\"my-dev-kit-lab --cases <path> --out <dir> --kit-command <command>\") remains",
45
+ "supported for backward compatibility."
46
+ ].join("\n");
47
+ }
48
+ export function renderDemoHelp() {
49
+ return [
50
+ "my-dev-kit-lab demo - demo command family",
51
+ "",
52
+ "Usage:",
53
+ " my-dev-kit-lab demo final [options]",
54
+ " my-dev-kit-lab demo --help",
55
+ "",
56
+ "Commands:",
57
+ " final Run the full final demo. Run \"my-dev-kit-lab demo final --help\" for details."
58
+ ].join("\n");
59
+ }
60
+ export function renderFinalDemoHelp() {
61
+ return [
62
+ "my-dev-kit-lab demo final - run the full final demo workflow",
63
+ "",
64
+ "Usage:",
65
+ " my-dev-kit-lab demo final --cases <path> --out <dir> --kit-command <command> [options]",
66
+ "",
67
+ "Required:",
68
+ " --cases <path> Path to the evaluation cases file",
69
+ " --out <dir> Output directory for demo artifacts",
70
+ " --kit-command <command> Command used to invoke my-dev-kit for the visualization demos",
71
+ "",
72
+ "Options:",
73
+ " --agents <list> Comma-separated agent ids (default: fake-agent)",
74
+ " --strategies <list> Comma-separated strategies: raw-full-file,my-dev-kit-guided (default: both)",
75
+ " --complexities <list> Comma-separated complexity levels: short,medium,long,multi-step (default: short)",
76
+ " --case <ids> Comma-separated case ids to run",
77
+ " --benchmark-project <ids> Comma-separated benchmark project ids to run",
78
+ " --max-runs <n> Maximum number of runs",
79
+ " --screenshot / --no-screenshot Enable/disable report screenshot capture (default: disabled)",
80
+ " --include-real-agents Allow real agent ids (codex, claude)",
81
+ " --continue-on-failure / --no-continue-on-failure Continue after a failed run (default: continue-on-failure)",
82
+ " --timeout-ms <ms> Per-run timeout in milliseconds",
83
+ "",
84
+ "The legacy direct invocation form (the same flags without a leading \"demo final\")",
85
+ "remains supported for backward compatibility."
86
+ ].join("\n");
87
+ }
88
+ export function renderExperimentHelp() {
89
+ return [
90
+ "my-dev-kit-lab experiment - experiment command family",
91
+ "",
92
+ "Usage:",
93
+ " my-dev-kit-lab experiment list",
94
+ " my-dev-kit-lab experiment describe --experiment <id>",
95
+ " my-dev-kit-lab experiment run --experiment <id> [options]",
96
+ " my-dev-kit-lab experiment controlled [options]",
97
+ " my-dev-kit-lab experiment --help",
98
+ "",
99
+ "Commands:",
100
+ " list List registered experiment plugins.",
101
+ " Run \"my-dev-kit-lab experiment list --help\" for details.",
102
+ " describe Describe a registered experiment plugin.",
103
+ " Run \"my-dev-kit-lab experiment describe --help\" for details.",
104
+ " run Run a registered experiment plugin through the generic runner.",
105
+ " Run \"my-dev-kit-lab experiment run --help\" for details.",
106
+ " controlled Run a controlled context-strategy-comparison experiment.",
107
+ " Run \"my-dev-kit-lab experiment controlled --help\" for details."
108
+ ].join("\n");
109
+ }
110
+ export function renderExperimentListHelp() {
111
+ return [
112
+ "my-dev-kit-lab experiment list - list registered experiment plugins",
113
+ "",
114
+ "Usage:",
115
+ " my-dev-kit-lab experiment list [--json]",
116
+ "",
117
+ "Options:",
118
+ " --json Print the experiment list as JSON instead of a human-readable summary"
119
+ ].join("\n");
120
+ }
121
+ export function renderExperimentDescribeHelp() {
122
+ return [
123
+ "my-dev-kit-lab experiment describe - describe a registered experiment plugin",
124
+ "",
125
+ "Usage:",
126
+ " my-dev-kit-lab experiment describe --experiment <id> [--json]",
127
+ "",
128
+ "Required:",
129
+ " --experiment <id> Registered experiment plugin id (see \"my-dev-kit-lab experiment list\")",
130
+ "",
131
+ "Options:",
132
+ " --json Print the description as JSON instead of a human-readable summary"
133
+ ].join("\n");
134
+ }
135
+ export function renderExperimentRunHelp() {
136
+ return [
137
+ "my-dev-kit-lab experiment run - run a registered experiment plugin through the generic runner",
138
+ "",
139
+ "Usage:",
140
+ " my-dev-kit-lab experiment run --experiment <id> [options]",
141
+ "",
142
+ "Required:",
143
+ " --experiment <id> Registered experiment plugin id (see \"my-dev-kit-lab experiment list\")",
144
+ "",
145
+ "Options:",
146
+ " --target <path> Local target project path (default: self)",
147
+ " --out <dir> Output directory for experiment artifacts",
148
+ " (default: beneath the workspace when installed)",
149
+ " --cases <path> Path to the evaluation cases file",
150
+ " (default: the bundled package resource)",
151
+ " --project-profiles <path> Path to the benchmark project profiles file",
152
+ " (default: the bundled package resource)",
153
+ " --case <ids> Comma-separated case ids to run",
154
+ " --benchmark-project <ids> Comma-separated benchmark project ids to run",
155
+ " --agents <list> Comma-separated agent ids (default: fake-agent)",
156
+ " --strategies <list> Comma-separated strategies: raw-full-file,my-dev-kit-guided",
157
+ " --complexities <list> Comma-separated complexity levels: short,medium,long,multi-step",
158
+ " --timeout-ms <ms> Per-run timeout in milliseconds",
159
+ " --max-runs <n> Maximum number of runs",
160
+ " --continue-on-failure / --no-continue-on-failure Continue after a failed run (default: continue-on-failure)",
161
+ " --require-agents Fail if no real agent command templates are configured",
162
+ " --include-real-agents Allow real agent ids (codex, claude)",
163
+ " --command-template-codex <template> Command template used to invoke the codex agent",
164
+ " --command-template-claude <template> Command template used to invoke the claude agent",
165
+ " --no-screenshot Accepted for compatibility; the plugin-aware report",
166
+ " path does not capture screenshots yet"
167
+ ].join("\n");
168
+ }
169
+ export function renderExperimentControlledHelp() {
170
+ return [
171
+ "my-dev-kit-lab experiment controlled - run a controlled context-strategy-comparison experiment",
172
+ "",
173
+ "Usage:",
174
+ " my-dev-kit-lab experiment controlled --cases <path> --out <dir> [options]",
175
+ "",
176
+ "Required:",
177
+ " --cases <path> Path to the evaluation cases file",
178
+ " --out <dir> Output directory for experiment artifacts",
179
+ "",
180
+ "Options:",
181
+ " --project-profiles <path> Path to the benchmark project profiles file",
182
+ " (default: the bundled package resource)",
183
+ " --case <ids> Comma-separated case ids to run",
184
+ " --benchmark-project <ids> Comma-separated benchmark project ids to run",
185
+ " --agents <list> Comma-separated agent ids (default: fake-agent)",
186
+ " --strategies <list> Comma-separated strategies: raw-full-file,my-dev-kit-guided",
187
+ " --complexities <list> Comma-separated complexity levels: short,medium,long,multi-step",
188
+ " --timeout-ms <ms> Per-run timeout in milliseconds",
189
+ " --max-runs <n> Maximum number of runs",
190
+ " --continue-on-failure / --no-continue-on-failure Continue after a failed run (default: continue-on-failure)",
191
+ " --require-agents Fail if no real agent command templates are configured",
192
+ " --include-real-agents Allow real agent ids (codex, claude)",
193
+ " --command-template-codex <template> Command template used to invoke the codex agent",
194
+ " --command-template-claude <template> Command template used to invoke the claude agent"
195
+ ].join("\n");
196
+ }
197
+ export function renderReportHelp() {
198
+ return [
199
+ "my-dev-kit-lab report - report command family",
200
+ "",
201
+ "Usage:",
202
+ " my-dev-kit-lab report render [options]",
203
+ " my-dev-kit-lab report --help",
204
+ "",
205
+ "Commands:",
206
+ " render Render an HTML/JSON experiment report from controlled-experiment artifacts.",
207
+ " Run \"my-dev-kit-lab report render --help\" for details."
208
+ ].join("\n");
209
+ }
210
+ export function renderReportRenderHelp() {
211
+ return [
212
+ "my-dev-kit-lab report render - render an HTML/JSON experiment report from controlled-experiment artifacts",
213
+ "",
214
+ "Usage:",
215
+ " my-dev-kit-lab report render --experiment <dir> --out <dir> [options]",
216
+ "",
217
+ "Required:",
218
+ " --experiment <dir> Path to a controlled-experiment output directory",
219
+ " --out <dir> Output directory for the rendered report",
220
+ "",
221
+ "Options:",
222
+ " --title <title> Report title",
223
+ " --subtitle <subtitle> Report subtitle",
224
+ " --screenshot / --no-screenshot Enable/disable PNG screenshot capture (default: disabled)",
225
+ " --require-screenshot Fail unless a screenshot was captured (implies --screenshot)",
226
+ " --max-prompt-chars <n> Maximum characters of prompt text to include",
227
+ " --max-file-tree-entries <n> Maximum file tree entries to include",
228
+ " --plots <dir> Optional plots directory to include in the report",
229
+ " --visualizations <dir> Optional visualization-demos directory to include in the report"
230
+ ].join("\n");
231
+ }
232
+ export function renderPlotsHelp() {
233
+ return [
234
+ "my-dev-kit-lab plots - plots command family",
235
+ "",
236
+ "Usage:",
237
+ " my-dev-kit-lab plots generate [options]",
238
+ " my-dev-kit-lab plots --help",
239
+ "",
240
+ "Commands:",
241
+ " generate Generate experiment plot artifacts from controlled-experiment artifacts.",
242
+ " Run \"my-dev-kit-lab plots generate --help\" for details."
243
+ ].join("\n");
244
+ }
245
+ export function renderPlotsGenerateHelp() {
246
+ return [
247
+ "my-dev-kit-lab plots generate - generate chart/plot artifacts from controlled-experiment artifacts",
248
+ "",
249
+ "Usage:",
250
+ " my-dev-kit-lab plots generate --experiment <dir> --out <dir>",
251
+ "",
252
+ "Required:",
253
+ " --experiment <dir> Path to a controlled-experiment output directory",
254
+ " --out <dir> Output directory for plot artifacts"
255
+ ].join("\n");
256
+ }
257
+ export function renderGalleryHelp() {
258
+ return [
259
+ "my-dev-kit-lab gallery - gallery command family",
260
+ "",
261
+ "Usage:",
262
+ " my-dev-kit-lab gallery build [options]",
263
+ " my-dev-kit-lab gallery --help",
264
+ "",
265
+ "Commands:",
266
+ " build Build a gallery manifest/index from report, plots, and visualization artifacts.",
267
+ " Run \"my-dev-kit-lab gallery build --help\" for details."
268
+ ].join("\n");
269
+ }
270
+ export function renderGalleryBuildHelp() {
271
+ return [
272
+ "my-dev-kit-lab gallery build - build a gallery manifest/index from existing artifacts",
273
+ "",
274
+ "Usage:",
275
+ " my-dev-kit-lab gallery build --out <dir> [options]",
276
+ "",
277
+ "Required:",
278
+ " --out <dir> Output directory for the gallery manifest and index",
279
+ "",
280
+ "Options:",
281
+ " --report <dir> Path to a rendered report directory",
282
+ " --plots <dir> Path to a plots output directory",
283
+ " --visualizations <dir> Path to a visualization-demos output directory",
284
+ " --experiment <dir> Path to a controlled-experiment output directory"
285
+ ].join("\n");
286
+ }
287
+ export function renderSecurityHelp() {
288
+ return [
289
+ "my-dev-kit-lab security - security command family",
290
+ "",
291
+ "Usage:",
292
+ " my-dev-kit-lab security validate [options]",
293
+ " my-dev-kit-lab security --help",
294
+ "",
295
+ "Commands:",
296
+ " validate Run security validation. Run \"my-dev-kit-lab security validate --help\" for details."
297
+ ].join("\n");
298
+ }
299
+ export function renderUnknownCommandError(command) {
300
+ return [
301
+ `Unknown command: ${command}`,
302
+ "Run \"my-dev-kit-lab --help\" for usage."
303
+ ].join("\n");
304
+ }
305
+ export function renderTutorialHelp() {
306
+ return [
307
+ "my-dev-kit-lab tutorial - declarative browser tutorial command family",
308
+ "",
309
+ "Usage:",
310
+ " my-dev-kit-lab tutorial validate --scenario <path> [--target-contract <path>] [--json]",
311
+ " my-dev-kit-lab [--workspace <path>] tutorial run --scenario <path> --target-contract <path> [options]",
312
+ " my-dev-kit-lab tutorial --help",
313
+ "",
314
+ "Commands:",
315
+ " validate Validate a tutorial scenario, and optionally a target contract and their",
316
+ " declared target identity. Does not start processes or a browser.",
317
+ " Run \"my-dev-kit-lab tutorial validate --help\" for details.",
318
+ " run Prepare a disposable target, start its declared processes, and execute a",
319
+ " tutorial scenario in a persistent browser session.",
320
+ " Run \"my-dev-kit-lab tutorial run --help\" for details."
321
+ ].join("\n");
322
+ }
323
+ export function renderTutorialValidateHelp() {
324
+ return [
325
+ "my-dev-kit-lab tutorial validate - validate tutorial contracts",
326
+ "",
327
+ "Usage:",
328
+ " my-dev-kit-lab tutorial validate --scenario <path> [--target-contract <path>] [--json]",
329
+ "",
330
+ "Required:",
331
+ " --scenario <path> Path to a TutorialScenarioV1 JSON file",
332
+ "",
333
+ "Options:",
334
+ " --target-contract <path> Also validate a TutorialTargetContractV1 JSON file and",
335
+ " verify that the scenario targetId matches its id",
336
+ " --json Print a deterministic JSON report instead of a summary",
337
+ "",
338
+ "Relative paths resolve against the directory the command was invoked from.",
339
+ "This command is read-only: it creates no directories, runs no commands, starts no",
340
+ "processes, and does not require a browser runtime.",
341
+ "",
342
+ "Exit codes:",
343
+ " 0 Contracts are valid",
344
+ " 1 Contract validation failed",
345
+ " 2 Invalid command usage"
346
+ ].join("\n");
347
+ }
348
+ export function renderTutorialRunHelp() {
349
+ return [
350
+ "my-dev-kit-lab tutorial run - run a declarative browser tutorial scenario",
351
+ "",
352
+ "Usage:",
353
+ " my-dev-kit-lab [--workspace <path>] tutorial run --scenario <path> --target-contract <path> [--out <dir>] [--json]",
354
+ "",
355
+ "Required:",
356
+ " --scenario <path> Path to a TutorialScenarioV1 JSON file",
357
+ " --target-contract <path> Path to a TutorialTargetContractV1 JSON file",
358
+ "",
359
+ "Options:",
360
+ " --out <dir> Explicit run directory. An absolute path is used as given;",
361
+ " a relative path resolves against the invocation directory.",
362
+ " When omitted, the run is written to",
363
+ " <workspace>/tutorials/<scenario-id>/<run-id>/",
364
+ " --json Print the TutorialRunResultV1 JSON instead of a summary",
365
+ "",
366
+ "The run prepares a disposable target working copy beneath the run directory, starts the",
367
+ "processes the target contract declares, waits for each declared local readiness probe,",
368
+ "then executes every scenario step in one persistent browser page. Process logs are",
369
+ "written beneath the run directory and are not printed to the terminal.",
370
+ "",
371
+ "Exit codes:",
372
+ " 0 The tutorial run passed",
373
+ " 1 The invocation was valid but the tutorial did not pass",
374
+ " 2 Invalid command usage"
375
+ ].join("\n");
376
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./runLabCli.js";
2
+ export * from "./help.js";
@@ -0,0 +1,257 @@
1
+ import { readFileSync } from "node:fs";
2
+ import path from "node:path";
3
+ import { runFinalDemoCommand } from "../commands/runFinalDemoCommand.js";
4
+ import { runAuditCommandFromArgs } from "../commands/runAuditCommand.js";
5
+ import { runSecurityValidationCommandFromArgs } from "../commands/runSecurityValidationCommand.js";
6
+ import { runControlledExperimentCommand } from "../commands/runControlledExperimentCommand.js";
7
+ import { runExperimentListCommandFromArgs } from "../commands/runExperimentListCommand.js";
8
+ import { runExperimentDescribeCommandFromArgs } from "../commands/runExperimentDescribeCommand.js";
9
+ import { runExperimentRunCommandFromArgs } from "../commands/runExperimentRunCommand.js";
10
+ import { runRenderExperimentReportCommand } from "../commands/renderExperimentReportCommand.js";
11
+ import { runGenerateExperimentPlotsCommand } from "../commands/generateExperimentPlotsCommand.js";
12
+ import { runBuildGalleryCommand } from "../commands/buildGalleryCommand.js";
13
+ import { runTutorialValidateCommandFromArgs } from "../commands/runTutorialValidateCommand.js";
14
+ import { runTutorialRunCommandFromArgs } from "../commands/runTutorialRunCommand.js";
15
+ import { createLabExecutionContext, discoverPackageRoot } from "../runtime/index.js";
16
+ import { renderDemoHelp, renderExperimentControlledHelp, renderExperimentDescribeHelp, renderExperimentHelp, renderExperimentListHelp, renderExperimentRunHelp, renderFinalDemoHelp, renderGalleryBuildHelp, renderGalleryHelp, renderPlotsGenerateHelp, renderPlotsHelp, renderReportHelp, renderReportRenderHelp, renderSecurityHelp, renderTopLevelHelp, renderTutorialHelp, renderTutorialRunHelp, renderTutorialValidateHelp, renderUnknownCommandError } from "./help.js";
17
+ export const CLI_USAGE_EXIT_CODE = 2;
18
+ /**
19
+ * Recognized legacy final-demo flag tokens (mirrors parseRunFinalDemoArgs in
20
+ * src/commands/runFinalDemoCommand.ts). Used only to detect the historical
21
+ * direct invocation form; the legacy argument list itself is delegated to the
22
+ * existing final-demo parser unchanged, never reinterpreted here.
23
+ */
24
+ const LEGACY_FINAL_DEMO_FLAGS = new Set([
25
+ "--cases",
26
+ "--out",
27
+ "--kit-command",
28
+ "--agents",
29
+ "--strategies",
30
+ "--complexities",
31
+ "--case",
32
+ "--benchmark-project",
33
+ "--max-runs",
34
+ "--screenshot",
35
+ "--no-screenshot",
36
+ "--include-real-agents",
37
+ "--continue-on-failure",
38
+ "--no-continue-on-failure",
39
+ "--timeout-ms"
40
+ ]);
41
+ const DEFAULT_WRITERS = {
42
+ stdout: (message) => {
43
+ console.log(message);
44
+ },
45
+ stderr: (message) => {
46
+ console.error(message);
47
+ }
48
+ };
49
+ export async function runLabCli(argv, options = {}) {
50
+ const writers = options.writers ?? DEFAULT_WRITERS;
51
+ const globalOptions = parseGlobalOptions(argv);
52
+ if (!globalOptions.ok) {
53
+ writers.stderr(globalOptions.error);
54
+ return CLI_USAGE_EXIT_CODE;
55
+ }
56
+ const remaining = globalOptions.remaining;
57
+ const context = createLabExecutionContext(globalOptions.workspaceRoot !== undefined ? { workspaceRoot: globalOptions.workspaceRoot } : {});
58
+ const [command, ...rest] = remaining;
59
+ if (remaining.length === 0 || command === "--help" || command === "-h") {
60
+ writers.stdout(renderTopLevelHelp());
61
+ return 0;
62
+ }
63
+ if (command === "--version" || command === "-V") {
64
+ writers.stdout(readPackageVersion());
65
+ return 0;
66
+ }
67
+ if (command === "security") {
68
+ return runSecurityFamily(rest, writers, context);
69
+ }
70
+ if (command === "audit") {
71
+ return runAuditCommandFromArgs(rest, { context, defaultOutRoot: context.workspaceRoot });
72
+ }
73
+ if (command === "experiment") {
74
+ return runExperimentFamily(rest, writers, context);
75
+ }
76
+ if (command === "report") {
77
+ return runReportFamily(rest, writers);
78
+ }
79
+ if (command === "plots") {
80
+ return runPlotsFamily(rest, writers);
81
+ }
82
+ if (command === "gallery") {
83
+ return runGalleryFamily(rest, writers);
84
+ }
85
+ if (command === "tutorial") {
86
+ return runTutorialFamily(rest, writers, context);
87
+ }
88
+ if (command === "demo") {
89
+ return runDemoCommand(rest, writers);
90
+ }
91
+ if (LEGACY_FINAL_DEMO_FLAGS.has(command)) {
92
+ return runFinalDemoCommand(remaining);
93
+ }
94
+ writers.stderr(renderUnknownCommandError(command));
95
+ return CLI_USAGE_EXIT_CODE;
96
+ }
97
+ /**
98
+ * Only recognizes a leading "--workspace <path>" pair (must be argv[0]).
99
+ * A --workspace token appearing anywhere else is left untouched for normal
100
+ * command/legacy routing to handle (or reject), per the batch requirement
101
+ * that global options must precede the command.
102
+ */
103
+ function parseGlobalOptions(argv) {
104
+ if (argv[0] !== "--workspace") {
105
+ return { ok: true, remaining: argv };
106
+ }
107
+ const value = argv[1];
108
+ if (value === undefined) {
109
+ return { ok: false, error: "Missing value for --workspace. Expected a path after --workspace." };
110
+ }
111
+ return { ok: true, workspaceRoot: value, remaining: argv.slice(2) };
112
+ }
113
+ async function runDemoCommand(argv, writers) {
114
+ const [subcommand, ...rest] = argv;
115
+ if (argv.length === 0 || subcommand === "--help" || subcommand === "-h") {
116
+ writers.stdout(renderDemoHelp());
117
+ return 0;
118
+ }
119
+ if (subcommand === "final") {
120
+ if (rest[0] === "--help" || rest[0] === "-h") {
121
+ writers.stdout(renderFinalDemoHelp());
122
+ return 0;
123
+ }
124
+ return runFinalDemoCommand(rest);
125
+ }
126
+ writers.stderr(renderUnknownCommandError(`demo ${subcommand}`));
127
+ return CLI_USAGE_EXIT_CODE;
128
+ }
129
+ async function runSecurityFamily(argv, writers, context) {
130
+ const [subcommand, ...rest] = argv;
131
+ if (argv.length === 0 || subcommand === "--help" || subcommand === "-h") {
132
+ writers.stdout(renderSecurityHelp());
133
+ return 0;
134
+ }
135
+ if (subcommand === "validate") {
136
+ return runSecurityValidationCommandFromArgs(rest, { context, defaultOutRoot: context.workspaceRoot });
137
+ }
138
+ writers.stderr(renderUnknownCommandError(`security ${subcommand}`));
139
+ return CLI_USAGE_EXIT_CODE;
140
+ }
141
+ async function runExperimentFamily(argv, writers, context) {
142
+ const [subcommand, ...rest] = argv;
143
+ if (argv.length === 0 || subcommand === "--help" || subcommand === "-h") {
144
+ writers.stdout(renderExperimentHelp());
145
+ return 0;
146
+ }
147
+ if (subcommand === "list") {
148
+ if (rest[0] === "--help" || rest[0] === "-h") {
149
+ writers.stdout(renderExperimentListHelp());
150
+ return 0;
151
+ }
152
+ return runExperimentListCommandFromArgs(rest);
153
+ }
154
+ if (subcommand === "describe") {
155
+ if (rest[0] === "--help" || rest[0] === "-h") {
156
+ writers.stdout(renderExperimentDescribeHelp());
157
+ return 0;
158
+ }
159
+ return runExperimentDescribeCommandFromArgs(rest);
160
+ }
161
+ if (subcommand === "run") {
162
+ if (rest[0] === "--help" || rest[0] === "-h") {
163
+ writers.stdout(renderExperimentRunHelp());
164
+ return 0;
165
+ }
166
+ return runExperimentRunCommandFromArgs(rest, { context, installedDefaultOutputRoot: context.workspaceRoot });
167
+ }
168
+ if (subcommand === "controlled") {
169
+ if (rest[0] === "--help" || rest[0] === "-h") {
170
+ writers.stdout(renderExperimentControlledHelp());
171
+ return 0;
172
+ }
173
+ return runControlledExperimentCommand(rest);
174
+ }
175
+ writers.stderr(renderUnknownCommandError(`experiment ${subcommand}`));
176
+ return CLI_USAGE_EXIT_CODE;
177
+ }
178
+ async function runReportFamily(argv, writers) {
179
+ const [subcommand, ...rest] = argv;
180
+ if (argv.length === 0 || subcommand === "--help" || subcommand === "-h") {
181
+ writers.stdout(renderReportHelp());
182
+ return 0;
183
+ }
184
+ if (subcommand === "render") {
185
+ if (rest[0] === "--help" || rest[0] === "-h") {
186
+ writers.stdout(renderReportRenderHelp());
187
+ return 0;
188
+ }
189
+ return runRenderExperimentReportCommand(rest);
190
+ }
191
+ writers.stderr(renderUnknownCommandError(`report ${subcommand}`));
192
+ return CLI_USAGE_EXIT_CODE;
193
+ }
194
+ async function runPlotsFamily(argv, writers) {
195
+ const [subcommand, ...rest] = argv;
196
+ if (argv.length === 0 || subcommand === "--help" || subcommand === "-h") {
197
+ writers.stdout(renderPlotsHelp());
198
+ return 0;
199
+ }
200
+ if (subcommand === "generate") {
201
+ if (rest[0] === "--help" || rest[0] === "-h") {
202
+ writers.stdout(renderPlotsGenerateHelp());
203
+ return 0;
204
+ }
205
+ return runGenerateExperimentPlotsCommand(rest);
206
+ }
207
+ writers.stderr(renderUnknownCommandError(`plots ${subcommand}`));
208
+ return CLI_USAGE_EXIT_CODE;
209
+ }
210
+ async function runTutorialFamily(argv, writers, context) {
211
+ const [subcommand, ...rest] = argv;
212
+ if (argv.length === 0 || subcommand === "--help" || subcommand === "-h") {
213
+ writers.stdout(renderTutorialHelp());
214
+ return 0;
215
+ }
216
+ if (subcommand === "validate") {
217
+ if (rest[0] === "--help" || rest[0] === "-h") {
218
+ writers.stdout(renderTutorialValidateHelp());
219
+ return 0;
220
+ }
221
+ return runTutorialValidateCommandFromArgs(rest, { context });
222
+ }
223
+ if (subcommand === "run") {
224
+ if (rest[0] === "--help" || rest[0] === "-h") {
225
+ writers.stdout(renderTutorialRunHelp());
226
+ return 0;
227
+ }
228
+ return runTutorialRunCommandFromArgs(rest, { context });
229
+ }
230
+ writers.stderr(renderUnknownCommandError(`tutorial ${subcommand}`));
231
+ return CLI_USAGE_EXIT_CODE;
232
+ }
233
+ async function runGalleryFamily(argv, writers) {
234
+ const [subcommand, ...rest] = argv;
235
+ if (argv.length === 0 || subcommand === "--help" || subcommand === "-h") {
236
+ writers.stdout(renderGalleryHelp());
237
+ return 0;
238
+ }
239
+ if (subcommand === "build") {
240
+ if (rest[0] === "--help" || rest[0] === "-h") {
241
+ writers.stdout(renderGalleryBuildHelp());
242
+ return 0;
243
+ }
244
+ return runBuildGalleryCommand(rest);
245
+ }
246
+ writers.stderr(renderUnknownCommandError(`gallery ${subcommand}`));
247
+ return CLI_USAGE_EXIT_CODE;
248
+ }
249
+ function readPackageVersion() {
250
+ const packageRoot = discoverPackageRoot();
251
+ const packageJsonPath = path.join(packageRoot, "package.json");
252
+ const parsed = JSON.parse(readFileSync(packageJsonPath, "utf8"));
253
+ if (typeof parsed.version !== "string" || parsed.version.length === 0) {
254
+ throw new Error(`Unable to read a valid version from ${packageJsonPath}`);
255
+ }
256
+ return parsed.version;
257
+ }