@dailephd/my-dev-kit-lab 0.4.4 → 0.4.6

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 (225) hide show
  1. package/CHANGELOG.md +484 -0
  2. package/README.md +39 -3
  3. package/dist/scripts/cli.js +9 -0
  4. package/dist/src/audits/core/typescriptJavaScriptAnalyzer.js +30 -12
  5. package/dist/src/cli/help.js +300 -0
  6. package/dist/src/cli/index.js +2 -0
  7. package/dist/src/cli/runLabCli.js +229 -0
  8. package/dist/src/commands/runAuditCommand.js +132 -0
  9. package/dist/src/commands/runControlledExperimentCommand.js +7 -3
  10. package/dist/{scripts/experiments/describeExperiment.js → src/commands/runExperimentDescribeCommand.js} +14 -10
  11. package/dist/{scripts/experiments/listExperiments.js → src/commands/runExperimentListCommand.js} +3 -6
  12. package/dist/{scripts/experiments/runExperiment.js → src/commands/runExperimentRunCommand.js} +80 -22
  13. package/dist/src/commands/runFinalDemoCommand.js +2 -3
  14. package/dist/src/commands/runSecurityValidationCommand.js +271 -0
  15. package/dist/src/evaluation/ecosystemFixtures/index.js +3 -0
  16. package/dist/src/evaluation/ecosystemFixtures/loadContextIntegrityFixture.js +102 -0
  17. package/dist/src/evaluation/ecosystemFixtures/manifestTypes.js +1 -0
  18. package/dist/src/evaluation/ecosystemFixtures/validateManifest.js +82 -0
  19. package/dist/src/evaluation/ecosystemFixtures/verifyFixtureHashes.js +45 -0
  20. package/dist/src/evaluation/stageContextMetrics/calculateAllocationMetrics.js +169 -0
  21. package/dist/src/evaluation/stageContextMetrics/calculateConditionCoverageMetrics.js +74 -0
  22. package/dist/src/evaluation/stageContextMetrics/calculateProducerConditionAgreement.js +113 -0
  23. package/dist/src/evaluation/stageContextMetrics/calculateReadinessAgreement.js +60 -0
  24. package/dist/src/evaluation/stageContextMetrics/calculateRunIntegrityAgreement.js +309 -0
  25. package/dist/src/evaluation/stageContextMetrics/calculateSupplementalRawAgreement.js +12 -2
  26. package/dist/src/evaluation/stageContextMetrics/calculateTruncationClassification.js +100 -0
  27. package/dist/src/evaluation/stageContextMetrics/evaluateProducerReadinessBridge.js +76 -5
  28. package/dist/src/evaluation/stageContextMetrics/index.js +4 -0
  29. package/dist/src/evaluation/stageContextMetrics/runIntegrityAgreementTypes.js +1 -0
  30. package/dist/src/evaluation/stageContextSelectors/contextArtifactConsistency.js +7 -0
  31. package/dist/src/evaluation/stageContextSelectors/index.js +1 -0
  32. package/dist/src/evaluation/stageContextSelectors/orchestratorRunIntegritySelectors.js +64 -0
  33. package/dist/src/evaluation/upstreamArtifacts/index.js +2 -0
  34. package/dist/src/evaluation/upstreamArtifacts/orchestratorRunIntegrityV1.js +33 -0
  35. package/dist/src/evaluation/upstreamArtifacts/readOrchestratorRunIntegrityV1.js +9 -0
  36. package/dist/src/evaluation/upstreamArtifacts/validateMyDevKitContextCapsuleV1.js +59 -2
  37. package/dist/src/evaluation/upstreamArtifacts/validateMyDevKitRetrievalAuditRecordV1.js +6 -1
  38. package/dist/src/evaluation/upstreamArtifacts/validateOrchestratorRunIntegrityV1.js +177 -0
  39. package/dist/src/report/experiments/buildContextIntegrityReport.js +204 -0
  40. package/dist/src/report/experiments/contextIntegrityReportModel.js +1 -0
  41. package/dist/src/report/experiments/index.js +5 -0
  42. package/dist/src/report/experiments/renderContextIntegrityHtml.js +98 -0
  43. package/dist/src/report/experiments/renderContextIntegrityJsonReport.js +3 -0
  44. package/dist/src/report/experiments/renderContextIntegrityText.js +111 -0
  45. package/dist/src/runtime/index.js +3 -0
  46. package/dist/src/runtime/labExecutionContext.js +22 -0
  47. package/dist/src/runtime/packageResource.js +22 -0
  48. package/dist/src/runtime/packageRoot.js +37 -0
  49. package/dist/src/securityValidation/packageChecks/requiredPackageContents.js +46 -0
  50. package/dist/src/securityValidation/packageChecks/runPackageChecks.js +11 -5
  51. package/docs/METRICS.md +83 -0
  52. package/package.json +10 -8
  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/run-agent-prompt.js +0 -2
  61. package/dist/scripts/run-controlled-experiment.js +0 -2
  62. package/dist/scripts/run-lab-demo.js +0 -5
  63. package/dist/scripts/run-visualization-demos.js +0 -3
  64. package/dist/scripts/security/resolveToolRoot.js +0 -16
  65. package/dist/scripts/security/runCodeql.js +0 -58
  66. package/dist/scripts/security/runDependencyChecks.js +0 -58
  67. package/dist/scripts/security/runFuzzSmoke.js +0 -29
  68. package/dist/scripts/security/runPackageChecks.js +0 -57
  69. package/dist/scripts/security/runSemgrep.js +0 -64
  70. package/dist/scripts/security/validate.js +0 -266
  71. package/dist/scripts/verify-benchmarks.js +0 -202
  72. package/examples/demo-report-input.json +0 -78
  73. package/examples/lab-demo-cases.json +0 -35
  74. package/examples/real-agent-campaign-cases.json +0 -118
  75. package/tests/fixtures/android/advanced-security-fixtures/backup-configuration/module-a/src/debug/res/xml/ambiguous_backup_rules.xml +0 -4
  76. package/tests/fixtures/android/advanced-security-fixtures/backup-configuration/module-a/src/main/res/xml/ambiguous_backup_rules.xml +0 -4
  77. package/tests/fixtures/android/advanced-security-fixtures/backup-configuration/module-a/src/main/res/xml/backup_rules.xml +0 -5
  78. package/tests/fixtures/android/advanced-security-fixtures/backup-configuration/module-a/src/main/res/xml/broad_backup_rules.xml +0 -4
  79. package/tests/fixtures/android/advanced-security-fixtures/backup-configuration/module-a/src/main/res/xml/data_extraction_rules.xml +0 -10
  80. package/tests/fixtures/android/advanced-security-fixtures/backup-configuration/module-a/src/main/res/xml/unsupported_domain_rules.xml +0 -4
  81. package/tests/fixtures/android/advanced-security-fixtures/backup-configuration/module-b/src/main/res/xml/malformed_backup_rules.xml +0 -4
  82. package/tests/fixtures/android/advanced-security-fixtures/backup-configuration/module-b/src/main/res/xml/unsupported_root.xml +0 -4
  83. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-a/src/debug/res/xml/ambiguous_config.xml +0 -4
  84. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-a/src/main/res/xml/ambiguous_config.xml +0 -4
  85. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-a/src/main/res/xml/base_cleartext_false.xml +0 -8
  86. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-a/src/main/res/xml/broad_and_duplicate_domains.xml +0 -8
  87. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-a/src/main/res/xml/empty_domain.xml +0 -6
  88. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-a/src/main/res/xml/malformed_pin.xml +0 -11
  89. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-a/src/main/res/xml/network_security_config.xml +0 -26
  90. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-b/src/main/res/xml/malformed_network_security_config.xml +0 -6
  91. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-b/src/main/res/xml/unsupported_root.xml +0 -4
  92. package/tests/fixtures/android/advanced-security-fixtures/release-configuration/groovy-release-debuggable-dynamic.gradle +0 -7
  93. package/tests/fixtures/android/advanced-security-fixtures/release-configuration/groovy-release-debuggable-false.gradle +0 -9
  94. package/tests/fixtures/android/advanced-security-fixtures/release-configuration/groovy-release-debuggable-true.gradle +0 -13
  95. package/tests/fixtures/android/advanced-security-fixtures/release-configuration/kotlin-release-debuggable-false.gradle.kts +0 -7
  96. package/tests/fixtures/android/advanced-security-fixtures/release-configuration/kotlin-release-debuggable-true.gradle.kts +0 -10
  97. package/tests/fixtures/android/advanced-security-fixtures/release-configuration/missing-release-build-type.gradle.kts +0 -7
  98. package/tests/fixtures/android/advanced-security-fixtures/resource-resolution/module-a/src/debug/res/xml/network_security_config.xml +0 -8
  99. package/tests/fixtures/android/advanced-security-fixtures/resource-resolution/module-a/src/main/res/xml/backup_rules.xml +0 -4
  100. package/tests/fixtures/android/advanced-security-fixtures/resource-resolution/module-a/src/main/res/xml/network_security_config.xml +0 -8
  101. package/tests/fixtures/android/advanced-security-fixtures/resource-resolution/module-b/src/main/res/xml/malformed_network_security_config.xml +0 -7
  102. package/tests/fixtures/android/advanced-security-fixtures/secret-candidates/SampleActivity.java +0 -8
  103. package/tests/fixtures/android/advanced-security-fixtures/secret-candidates/SampleActivity.kt +0 -9
  104. package/tests/fixtures/android/advanced-security-fixtures/secret-candidates/build.gradle +0 -11
  105. package/tests/fixtures/android/advanced-security-fixtures/secret-candidates/build.gradle.kts +0 -11
  106. package/tests/fixtures/android/advanced-security-fixtures/secret-candidates/google-services.json +0 -16
  107. package/tests/fixtures/android/advanced-security-fixtures/secret-candidates/local.properties +0 -3
  108. package/tests/fixtures/android/advanced-security-fixtures/secret-candidates-bounds/module/binary.properties +0 -0
  109. package/tests/fixtures/android/advanced-security-fixtures/secret-candidates-bounds/module/oversized.json +0 -1
  110. package/tests/fixtures/android/advanced-security-fixtures/signing-configuration/app/fake-release-keystore.jks +0 -1
  111. package/tests/fixtures/android/advanced-security-fixtures/signing-configuration/build/generated-fake.keystore +0 -1
  112. package/tests/fixtures/android/compose-app/app/build.gradle.kts +0 -21
  113. package/tests/fixtures/android/compose-app/app/src/main/AndroidManifest.xml +0 -22
  114. package/tests/fixtures/android/compose-app/app/src/main/java/com/example/composeapp/MainActivity.kt +0 -11
  115. package/tests/fixtures/android/compose-app/build.gradle.kts +0 -4
  116. package/tests/fixtures/android/compose-app/gradle/wrapper/gradle-wrapper.properties +0 -4
  117. package/tests/fixtures/android/compose-app/settings.gradle.kts +0 -2
  118. package/tests/fixtures/android/gradle-metadata-fixtures/catalog-only-plugin/build.gradle.kts +0 -3
  119. package/tests/fixtures/android/gradle-metadata-fixtures/catalog-only-plugin/gradle/libs.versions.toml +0 -5
  120. package/tests/fixtures/android/gradle-metadata-fixtures/comment-safety.gradle.kts +0 -21
  121. package/tests/fixtures/android/gradle-metadata-fixtures/dynamic-values.gradle.kts +0 -17
  122. package/tests/fixtures/android/gradle-metadata-fixtures/groovy-literal.gradle +0 -23
  123. package/tests/fixtures/android/gradle-metadata-fixtures/wrapper-malformed.properties +0 -4
  124. package/tests/fixtures/android/gradle-metadata-fixtures/wrapper-missing-url.properties +0 -3
  125. package/tests/fixtures/android/gradle-metadata-fixtures/wrapper-with-checksum.properties +0 -5
  126. package/tests/fixtures/android/java-app/app/build.gradle +0 -16
  127. package/tests/fixtures/android/java-app/app/src/main/AndroidManifest.xml +0 -19
  128. package/tests/fixtures/android/java-app/app/src/main/java/com/example/javaapp/MainActivity.java +0 -4
  129. package/tests/fixtures/android/java-app/build.gradle +0 -3
  130. package/tests/fixtures/android/java-app/gradle/wrapper/gradle-wrapper.properties +0 -4
  131. package/tests/fixtures/android/java-app/settings.gradle +0 -2
  132. package/tests/fixtures/android/library/build.gradle.kts +0 -3
  133. package/tests/fixtures/android/library/gradle/wrapper/gradle-wrapper.properties +0 -4
  134. package/tests/fixtures/android/library/mylibrary/build.gradle.kts +0 -13
  135. package/tests/fixtures/android/library/mylibrary/src/main/AndroidManifest.xml +0 -2
  136. package/tests/fixtures/android/library/settings.gradle.kts +0 -2
  137. package/tests/fixtures/android/manifest-audit-fixtures/incomplete-intent-filter.xml +0 -14
  138. package/tests/fixtures/android/manifest-audit-fixtures/malformed-exported.xml +0 -10
  139. package/tests/fixtures/android/manifest-audit-fixtures/malformed.xml +0 -5
  140. package/tests/fixtures/android/manifest-audit-fixtures/missing-application.xml +0 -7
  141. package/tests/fixtures/android/manifest-audit-fixtures/missing-component-name.xml +0 -11
  142. package/tests/fixtures/android/manifest-audit-fixtures/permission-coverage.xml +0 -29
  143. package/tests/fixtures/android/manifest-audit-fixtures/risky-components.xml +0 -62
  144. package/tests/fixtures/android/manifest-audit-fixtures/risky-deep-links.xml +0 -45
  145. package/tests/fixtures/android/manifest-audit-fixtures/unresolved-placeholder.xml +0 -14
  146. package/tests/fixtures/android/manifest-audit-fixtures/unusual-namespace-prefix.xml +0 -11
  147. package/tests/fixtures/android/multi-module/app/build.gradle.kts +0 -22
  148. package/tests/fixtures/android/multi-module/app/src/androidTest/java/com/example/multimodule/app/ExampleInstrumentedTest.kt +0 -3
  149. package/tests/fixtures/android/multi-module/app/src/main/AndroidManifest.xml +0 -11
  150. package/tests/fixtures/android/multi-module/app/src/test/java/com/example/multimodule/app/ExampleUnitTest.kt +0 -3
  151. package/tests/fixtures/android/multi-module/build.gradle.kts +0 -5
  152. package/tests/fixtures/android/multi-module/core/build.gradle.kts +0 -14
  153. package/tests/fixtures/android/multi-module/core/src/main/AndroidManifest.xml +0 -2
  154. package/tests/fixtures/android/multi-module/feature-login/build.gradle.kts +0 -18
  155. package/tests/fixtures/android/multi-module/feature-login/src/main/AndroidManifest.xml +0 -2
  156. package/tests/fixtures/android/multi-module/gradle/libs.versions.toml +0 -8
  157. package/tests/fixtures/android/multi-module/gradle/wrapper/gradle-wrapper.properties +0 -4
  158. package/tests/fixtures/android/multi-module/settings.gradle.kts +0 -4
  159. package/tests/fixtures/android/non-android-gradle/build.gradle.kts +0 -3
  160. package/tests/fixtures/android/non-android-gradle/core/build.gradle.kts +0 -3
  161. package/tests/fixtures/android/non-android-gradle/core/src/main/java/com/example/core/Core.java +0 -4
  162. package/tests/fixtures/android/non-android-gradle/gradle/wrapper/gradle-wrapper.properties +0 -4
  163. package/tests/fixtures/android/non-android-gradle/settings.gradle.kts +0 -2
  164. package/tests/fixtures/android/partial/app/build.gradle.kts +0 -7
  165. package/tests/fixtures/android/partial/settings.gradle.kts +0 -2
  166. package/tests/fixtures/android/xml-view-app/app/build.gradle.kts +0 -17
  167. package/tests/fixtures/android/xml-view-app/app/src/main/AndroidManifest.xml +0 -31
  168. package/tests/fixtures/android/xml-view-app/app/src/main/kotlin/com/example/xmlviewapp/MainActivity.kt +0 -7
  169. package/tests/fixtures/android/xml-view-app/app/src/main/res/layout/activity_main.xml +0 -4
  170. package/tests/fixtures/android/xml-view-app/build.gradle.kts +0 -4
  171. package/tests/fixtures/android/xml-view-app/gradle/wrapper/gradle-wrapper.properties +0 -4
  172. package/tests/fixtures/android/xml-view-app/settings.gradle.kts +0 -2
  173. package/tests/fixtures/audits/mixed-language/mixed-docs-claims/README.md +0 -16
  174. package/tests/fixtures/audits/mixed-language/mixed-docs-claims/build.gradle.kts +0 -4
  175. package/tests/fixtures/audits/mixed-language/mixed-docs-claims/src/main/java/com/example/Widget.java +0 -7
  176. package/tests/fixtures/audits/mixed-language/mixed-docs-claims/src/main/kotlin/com/example/Gadget.kt +0 -7
  177. package/tests/fixtures/audits/mixed-language/mixed-generated-vendor/README.md +0 -10
  178. package/tests/fixtures/audits/mixed-language/mixed-generated-vendor/build/Main.class +0 -1
  179. package/tests/fixtures/audits/mixed-language/mixed-generated-vendor/dist/index.js +0 -1
  180. package/tests/fixtures/audits/mixed-language/mixed-generated-vendor/generated/schema.ts +0 -1
  181. package/tests/fixtures/audits/mixed-language/mixed-generated-vendor/src/index.ts +0 -3
  182. package/tests/fixtures/audits/mixed-language/mixed-generated-vendor/vendor/lib.py +0 -2
  183. package/tests/fixtures/audits/mixed-language/mixed-java-kotlin/README.md +0 -10
  184. package/tests/fixtures/audits/mixed-language/mixed-java-kotlin/build.gradle.kts +0 -8
  185. package/tests/fixtures/audits/mixed-language/mixed-java-kotlin/settings.gradle.kts +0 -1
  186. package/tests/fixtures/audits/mixed-language/mixed-java-kotlin/src/main/java/com/example/FooService.java +0 -7
  187. package/tests/fixtures/audits/mixed-language/mixed-java-kotlin/src/main/kotlin/com/example/BarService.kt +0 -7
  188. package/tests/fixtures/audits/mixed-language/mixed-java-kotlin/src/test/java/com/example/FooServiceTest.java +0 -8
  189. package/tests/fixtures/audits/mixed-language/mixed-java-kotlin/src/test/kotlin/com/example/BarServiceTest.kt +0 -8
  190. package/tests/fixtures/audits/mixed-language/mixed-python-ts/README.md +0 -8
  191. package/tests/fixtures/audits/mixed-language/mixed-python-ts/src/app.py +0 -7
  192. package/tests/fixtures/audits/mixed-language/mixed-python-ts/src/index.ts +0 -3
  193. package/tests/fixtures/audits/mixed-language/mixed-python-ts/tests/test_app.py +0 -5
  194. package/tests/fixtures/audits/mixed-language/mixed-ts-js/README.md +0 -7
  195. package/tests/fixtures/audits/mixed-language/mixed-ts-js/src/helper.js +0 -5
  196. package/tests/fixtures/audits/mixed-language/mixed-ts-js/src/index.ts +0 -3
  197. package/tests/fixtures/audits/mixed-language/mixed-ts-js/tests/index.sample.ts +0 -5
  198. package/tests/fixtures/audits/mixed-language/mixed-ts-python-jvm/README.md +0 -10
  199. package/tests/fixtures/audits/mixed-language/mixed-ts-python-jvm/build.gradle.kts +0 -4
  200. package/tests/fixtures/audits/mixed-language/mixed-ts-python-jvm/pytests/test_app.py +0 -5
  201. package/tests/fixtures/audits/mixed-language/mixed-ts-python-jvm/src/app.py +0 -2
  202. package/tests/fixtures/audits/mixed-language/mixed-ts-python-jvm/src/helper.js +0 -5
  203. package/tests/fixtures/audits/mixed-language/mixed-ts-python-jvm/src/index.ts +0 -3
  204. package/tests/fixtures/audits/mixed-language/mixed-ts-python-jvm/src/main/java/com/example/Multiplier.java +0 -7
  205. package/tests/fixtures/audits/mixed-language/mixed-ts-python-jvm/src/main/kotlin/com/example/Divider.kt +0 -7
  206. package/tests/fixtures/fake-adversarial-cli.js +0 -152
  207. package/tests/fixtures/fake-my-dev-kit-cli.js +0 -83
  208. package/tests/fixtures/full-workflow-library/complete-v1.0.0.json +0 -24
  209. package/tests/fixtures/full-workflow-library/future-minor-v1.1.0-additive.json +0 -25
  210. package/tests/fixtures/stage-context-expectations/complete-v1.0.0.json +0 -230
  211. package/tests/fixtures/stage-context-expectations/future-minor-v1.1.0-additive.json +0 -232
  212. package/tests/fixtures/stage-context-expectations/invalid/malformed-json.txt +0 -1
  213. package/tests/fixtures/stage-context-expectations/invalid/non-object-root.json +0 -1
  214. package/tests/fixtures/stage-context-expectations/minimal-v1.0.0.json +0 -18
  215. package/tests/fixtures/upstream-artifacts/invalid/malformed-json.txt +0 -1
  216. package/tests/fixtures/upstream-artifacts/invalid/non-object-root.json +0 -1
  217. package/tests/fixtures/upstream-artifacts/my-dev-kit/1.10.2/context-capsule/complete-v1.0.0.json +0 -504
  218. package/tests/fixtures/upstream-artifacts/my-dev-kit/1.10.2/context-capsule/future-minor-v1.1.0-additive.json +0 -955
  219. package/tests/fixtures/upstream-artifacts/my-dev-kit/1.10.2/retrieval-audit-record/complete-v1.0.0.json +0 -190
  220. package/tests/fixtures/upstream-artifacts/my-dev-kit/1.10.2/retrieval-audit-record/future-minor-v1.1.0-additive.json +0 -327
  221. package/tests/fixtures/upstream-artifacts/my-dev-kit-1.10.2-identity/PROVENANCE.txt +0 -13
  222. package/tests/fixtures/upstream-artifacts/my-dev-kit-1.10.2-identity/context-capsule.json +0 -7874
  223. package/tests/fixtures/upstream-artifacts/my-dev-kit-1.10.2-identity/retrieval-audit-record.json +0 -1076
  224. package/tests/fixtures/upstream-artifacts/my-dev-kit-orchestrator/1.2.1/workflow-instruction-packet/complete-v1.0.0.json +0 -160
  225. package/tests/fixtures/upstream-artifacts/my-dev-kit-orchestrator/1.2.1/workflow-instruction-packet/future-minor-v1.1.0-additive.json +0 -186
@@ -1,135 +0,0 @@
1
- #!/usr/bin/env node
2
- import { parseAuditArgs, normalizeAuditConfig } from "../../src/audits/core/auditConfig.js";
3
- import { resolveAuditTarget } from "../../src/audits/core/auditTarget.js";
4
- import { runAudit } from "../../src/audits/core/auditRunner.js";
5
- import { AUDIT_EXIT_CODES } from "../../src/audits/core/auditExitCode.js";
6
- import { resolveToolRoot } from "../security/resolveToolRoot.js";
7
- import { buildAuditReportModel } from "../../src/audits/report/auditReportModel.js";
8
- import { writeAuditReports } from "../../src/audits/report/writeAuditReports.js";
9
- // ---------------------------------------------------------------------------
10
- // v0.3.0 Batch 5 -- npm run audit entrypoint.
11
- //
12
- // Thin wiring only: parse args -> normalize config -> resolve target ->
13
- // runAudit() -> buildAuditReportModel() -> writeAuditReports() -> print a
14
- // concise console summary -> set process.exitCode. All report-shaping logic
15
- // (the former inline buildJsonReport()/renderMinimalTextSummary()/
16
- // summarizeInventory()/summarizeSourceOfTruth() functions from Batch 1/2)
17
- // now lives in src/audits/report/ -- see auditReportModel.ts,
18
- // renderAuditJsonReport.ts, renderAuditTextReport.ts, writeAuditReports.ts.
19
- // Mirrors the structure of scripts/security/validate.ts.
20
- // ---------------------------------------------------------------------------
21
- const USAGE = "Usage: npm run audit -- [--target <path>] [--types code-rot,security] " +
22
- "[--include docs,tests,package,architecture,cli] [--format text,json] " +
23
- "[--fail-on blocker|high|medium|low|none] [--out <path>] [--android]\n" +
24
- "\n" +
25
- " --android opts into Batch 2's programmatic Android security integration.\n" +
26
- " Requires --types to include \"security\" (e.g. --types security or --types\n" +
27
- " code-rot,security). Runs the same static, read-only, nineteen-check\n" +
28
- " Android validation security:validate --profile android performs --\n" +
29
- " detection, manifest parsing, and internal advanced security checks --\n" +
30
- " through the existing security adapter, never a subprocess. Confirmed\n" +
31
- " findings are mapped into the normal issue collection; CandidateEvidence\n" +
32
- " remains a separate, bounded summary and is never treated as a confirmed\n" +
33
- " issue. Starts zero Gradle operations, zero external tools, and zero\n" +
34
- " network operations by default; --android does not expose any of those.\n" +
35
- " Example: npm run audit -- --target \"<android-project-path>\" --types security --android --format text,json --fail-on none";
36
- const rawArgs = process.argv.slice(2);
37
- const toolRoot = resolveToolRoot(import.meta.url);
38
- // Help deliberately wins over every other argument, mirroring
39
- // scripts/security/validate.ts -- no config normalization, target
40
- // resolution, audit execution, or report write.
41
- if (rawArgs.includes("--help") || rawArgs.includes("-h")) {
42
- console.log(USAGE);
43
- process.exitCode = 0;
44
- process.exit(0);
45
- }
46
- let config;
47
- try {
48
- const args = parseAuditArgs(rawArgs);
49
- config = normalizeAuditConfig(args, toolRoot);
50
- }
51
- catch (err) {
52
- const msg = err instanceof Error ? err.message : String(err);
53
- console.error(`\nERROR: ${msg}`);
54
- console.error(USAGE);
55
- process.exitCode = AUDIT_EXIT_CODES.FATAL_ERROR;
56
- process.exit(AUDIT_EXIT_CODES.FATAL_ERROR);
57
- }
58
- let target;
59
- try {
60
- target = resolveAuditTarget(config.targetPathArg, toolRoot);
61
- }
62
- catch (err) {
63
- const msg = err instanceof Error ? err.message : String(err);
64
- console.error(`\nERROR: ${msg}`);
65
- console.error(USAGE);
66
- process.exitCode = AUDIT_EXIT_CODES.FATAL_ERROR;
67
- process.exit(AUDIT_EXIT_CODES.FATAL_ERROR);
68
- }
69
- console.log("=".repeat(60));
70
- console.log("my-dev-kit-lab audit");
71
- console.log("=".repeat(60));
72
- console.log(`Tool root : ${toolRoot}`);
73
- if (!target.isSelf) {
74
- console.log(`Target : ${target.rootPath}`);
75
- }
76
- else {
77
- console.log(`Mode : self-audit`);
78
- }
79
- console.log(`Types : ${config.types.join(", ")}`);
80
- console.log(`Include : ${config.include.join(", ")}`);
81
- console.log("");
82
- let result;
83
- try {
84
- result = await runAudit({ config, toolRoot, target });
85
- }
86
- catch (err) {
87
- const msg = err instanceof Error ? err.message : String(err);
88
- console.error(`\nERROR: audit runtime failure: ${msg}`);
89
- process.exitCode = AUDIT_EXIT_CODES.FATAL_ERROR;
90
- process.exit(AUDIT_EXIT_CODES.FATAL_ERROR);
91
- }
92
- const model = buildAuditReportModel(result, { target });
93
- const { writtenPaths } = writeAuditReports({ model, config, outDir: config.out });
94
- console.log(`Issues found : ${model.summary.totalIssues}`);
95
- console.log(` blocker=${model.summary.issuesBySeverity.blocker} high=${model.summary.issuesBySeverity.high} medium=${model.summary.issuesBySeverity.medium} low=${model.summary.issuesBySeverity.low} info=${model.summary.issuesBySeverity.info}`);
96
- console.log(`Skipped detectors : ${model.summary.skippedDetectorCount}`);
97
- if (model.summary.detectorErrorCount > 0) {
98
- console.log(`Detector errors : ${model.summary.detectorErrorCount}`);
99
- for (const e of model.detectorErrors) {
100
- console.log(` [${e.id}] ${e.message}`);
101
- }
102
- }
103
- if (model.summary.noDetectorsRegistered && !model.securitySummary.ran) {
104
- console.log(`Note: no code-rot detectors are registered for this run's --types/--include selection -- this run collected inventory/source-of-truth data only.`);
105
- }
106
- if (model.securitySummary.ran) {
107
- console.log(`\nSecurity validation: verdict=${model.securitySummary.verdictLabel} checks=${model.securitySummary.totalChecks} findings(blocker=${model.securitySummary.findingCounts.blocker} major=${model.securitySummary.findingCounts.major} minor=${model.securitySummary.findingCounts.minor} info=${model.securitySummary.findingCounts.informational})`);
108
- if (model.securitySummary.reportPaths.text) {
109
- console.log(` Full report: ${model.securitySummary.reportPaths.text}`);
110
- }
111
- }
112
- if (model.androidSecurity.summary.requested) {
113
- const android = model.androidSecurity.summary;
114
- console.log(`\nAndroid security validation: status=${android.status} applicable=${android.applicable ?? "n/a"} verdict=${android.verdict ?? "(unknown)"} checks=${android.totalChecks} confirmed=${android.confirmedFindingCount} mappedIssues=${android.mappedIssueCount} candidates=${android.candidateSummary.totalCount}`);
115
- if (android.reportPaths.text) {
116
- console.log(` Full report: ${android.reportPaths.text}`);
117
- }
118
- }
119
- console.log(`\nInventory: ${model.inventory.totalScannedFileCount} file(s) scanned, ${model.inventory.skippedFileCount} skipped`);
120
- console.log(` source=${model.inventory.filesByCategory.source} tests=${model.inventory.filesByCategory.tests} docs=${model.inventory.filesByCategory.docs} package=${model.inventory.filesByCategory.package} config=${model.inventory.filesByCategory.config} scripts=${model.inventory.filesByCategory.scripts} ci=${model.inventory.filesByCategory.ci}`);
121
- console.log(`Source of truth: package=${model.sourceOfTruth.packageName ?? "(none)"}@${model.sourceOfTruth.packageVersion ?? "?"} readme=${model.sourceOfTruth.hasReadme} changelog=${model.sourceOfTruth.hasChangelog} ciWorkflows=${model.sourceOfTruth.ciWorkflowCount}`);
122
- console.log(`Source facts: ${model.sourceFacts.totalFilesAnalyzed} file(s) analyzed (parsed=${model.sourceFacts.filesByParseStatus.parsed} file-level-only=${model.sourceFacts.filesByParseStatus["file-level-only"]} unsupported=${model.sourceFacts.filesByParseStatus.unsupported})`);
123
- if (writtenPaths.length > 0) {
124
- console.log(`\nReports written:`);
125
- for (const p of writtenPaths) {
126
- console.log(` ${p}`);
127
- }
128
- }
129
- console.log(`\nHighest severity: ${model.summary.highestSeverity ?? "(none)"}`);
130
- console.log(`Verdict: ${model.summary.finalVerdictLabel}`);
131
- console.log(`Exit reason: ${model.exit.reason}`);
132
- console.log(model.exit.code === AUDIT_EXIT_CODES.SUCCESS
133
- ? `Exit 0 -- audit completed.`
134
- : `Exit 1 -- fail-on threshold breached.`);
135
- process.exitCode = model.exit.code;
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { runBuildGalleryCommand } from "../src/commands/buildGalleryCommand.js";
3
- process.exitCode = await runBuildGalleryCommand(process.argv.slice(2));
@@ -1,3 +0,0 @@
1
- import { runCaptureDemoReportCommand } from "../src/commands/captureDemoReport.js";
2
- const exitCode = await runCaptureDemoReportCommand(process.argv.slice(2));
3
- process.exitCode = exitCode;
@@ -1,2 +0,0 @@
1
- import { runEvaluateTokenSavingsCommand } from "../src/commands/evaluateTokenSavings.js";
2
- process.exitCode = await runEvaluateTokenSavingsCommand(process.argv.slice(2));
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { runGenerateExperimentPlotsCommand } from "../src/commands/generateExperimentPlotsCommand.js";
3
- process.exitCode = await runGenerateExperimentPlotsCommand(process.argv.slice(2));
@@ -1,2 +0,0 @@
1
- import { runGeneratePromptVariantsCommand } from "../src/commands/generatePromptVariants.js";
2
- process.exitCode = await runGeneratePromptVariantsCommand(process.argv.slice(2));
@@ -1,2 +0,0 @@
1
- import { runRenderExperimentReportCommand } from "../src/commands/renderExperimentReportCommand.js";
2
- process.exitCode = await runRenderExperimentReportCommand(process.argv.slice(2));
@@ -1,2 +0,0 @@
1
- import { runAgentPromptCommand } from "../src/commands/runAgentPromptCommand.js";
2
- process.exitCode = await runAgentPromptCommand(process.argv.slice(2));
@@ -1,2 +0,0 @@
1
- import { runControlledExperimentCommand } from "../src/commands/runControlledExperimentCommand.js";
2
- process.exitCode = await runControlledExperimentCommand(process.argv.slice(2));
@@ -1,5 +0,0 @@
1
- import { runLabDemoCommand } from "../src/commands/runLabDemo.js";
2
- const exitCode = await runLabDemoCommand(process.argv.slice(2));
3
- if (exitCode !== 0) {
4
- process.exitCode = exitCode;
5
- }
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { runVisualizationDemosCommand } from "../src/commands/runVisualizationDemosCommand.js";
3
- process.exitCode = await runVisualizationDemosCommand(process.argv.slice(2));
@@ -1,16 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- import { fileURLToPath } from "node:url";
4
- export function resolveToolRoot(moduleUrl) {
5
- let current = path.dirname(fileURLToPath(moduleUrl));
6
- while (true) {
7
- if (fs.existsSync(path.join(current, "package.json"))) {
8
- return current;
9
- }
10
- const parent = path.dirname(current);
11
- if (parent === current) {
12
- return process.cwd();
13
- }
14
- current = parent;
15
- }
16
- }
@@ -1,58 +0,0 @@
1
- #!/usr/bin/env node
2
- import { runCodeqlCheck } from "../../src/securityValidation/staticScans/codeql.js";
3
- import { resolveValidationTarget } from "../../src/securityValidation/validate/resolveTarget.js";
4
- import { resolveToolRoot } from "./resolveToolRoot.js";
5
- const rawArgs = process.argv.slice(2);
6
- const args = parseArgs(rawArgs);
7
- const toolRoot = resolveToolRoot(import.meta.url);
8
- let targetRoot;
9
- try {
10
- const target = resolveValidationTarget(args.target, toolRoot);
11
- targetRoot = target.targetRoot;
12
- if (!target.isSelf) {
13
- console.log(`Target: ${targetRoot}`);
14
- }
15
- }
16
- catch (err) {
17
- console.error(`ERROR: ${err instanceof Error ? err.message : String(err)}`);
18
- process.exitCode = 1;
19
- process.exit(1);
20
- }
21
- console.log("Running CodeQL static analysis check...");
22
- const result = await runCodeqlCheck({
23
- cwd: toolRoot,
24
- targetRoot,
25
- timeoutMs: 30_000,
26
- });
27
- const label = result.status === "skipped"
28
- ? `SKIPPED — ${result.skippedReason ?? "tool unavailable"}`
29
- : result.status.toUpperCase();
30
- console.log(`Status: ${label}`);
31
- if (result.findings.length > 0) {
32
- console.log("\nFindings:");
33
- for (const f of result.findings) {
34
- console.log(` [${f.severity.toUpperCase()}] ${f.title}`);
35
- if (f.description)
36
- console.log(` ${f.description.slice(0, 120)}`);
37
- }
38
- }
39
- console.log(`\nDuration: ${result.durationMs}ms`);
40
- if (result.status === "skipped") {
41
- console.log("\nCodeQL is optional. Absence does not block release.");
42
- process.exitCode = 0;
43
- }
44
- else if (result.status === "failed") {
45
- process.exitCode = 1;
46
- }
47
- else {
48
- process.exitCode = 0;
49
- }
50
- function parseArgs(argv) {
51
- const result = {};
52
- for (let i = 0; i < argv.length; i++) {
53
- if ((argv[i] === "--target" || argv[i] === "-t") && i + 1 < argv.length) {
54
- result.target = argv[++i];
55
- }
56
- }
57
- return result;
58
- }
@@ -1,58 +0,0 @@
1
- #!/usr/bin/env node
2
- import path from "node:path";
3
- import { runDependencyChecks } from "../../src/securityValidation/index.js";
4
- import { DEFAULT_SECURITY_CONFIG } from "../../src/securityValidation/index.js";
5
- import { resolveValidationTarget } from "../../src/securityValidation/validate/resolveTarget.js";
6
- import { resolveToolRoot } from "./resolveToolRoot.js";
7
- const rawArgs = process.argv.slice(2);
8
- const args = parseArgs(rawArgs);
9
- const toolRoot = resolveToolRoot(import.meta.url);
10
- let targetRoot;
11
- try {
12
- const target = resolveValidationTarget(args.target, toolRoot);
13
- targetRoot = target.targetRoot;
14
- if (!target.isSelf) {
15
- console.log(`Target: ${targetRoot}`);
16
- }
17
- }
18
- catch (err) {
19
- console.error(`ERROR: ${err instanceof Error ? err.message : String(err)}`);
20
- process.exitCode = 1;
21
- process.exit(1);
22
- }
23
- const config = {
24
- ...DEFAULT_SECURITY_CONFIG,
25
- reportDir: path.join(toolRoot, DEFAULT_SECURITY_CONFIG.reportDir),
26
- rawOutputDir: path.join(toolRoot, DEFAULT_SECURITY_CONFIG.rawOutputDir),
27
- };
28
- console.log("Running dependency checks...");
29
- console.log(`Report directory: ${config.reportDir}`);
30
- const output = await runDependencyChecks({ cwd: targetRoot, config });
31
- const passed = output.checks.filter((c) => c.status === "passed").length;
32
- const failed = output.checks.filter((c) => c.status === "failed").length;
33
- const warned = output.checks.filter((c) => c.status === "warning").length;
34
- const skipped = output.checks.filter((c) => c.status === "skipped").length;
35
- console.log(`\nDependency checks complete:`);
36
- console.log(` Passed: ${passed}`);
37
- console.log(` Warned: ${warned}`);
38
- console.log(` Failed: ${failed}`);
39
- console.log(` Skipped: ${skipped}`);
40
- console.log(` Findings: ${output.findings.length}`);
41
- if (output.findings.length > 0) {
42
- console.log("\nFindings:");
43
- for (const f of output.findings) {
44
- console.log(` [${f.severity.toUpperCase()}] ${f.title}`);
45
- }
46
- }
47
- console.log(`\nResults written to ${config.reportDir}`);
48
- const hasBlocker = output.findings.some((f) => f.severity === "blocker");
49
- process.exitCode = hasBlocker ? 1 : 0;
50
- function parseArgs(argv) {
51
- const result = {};
52
- for (let i = 0; i < argv.length; i++) {
53
- if ((argv[i] === "--target" || argv[i] === "-t") && i + 1 < argv.length) {
54
- result.target = argv[++i];
55
- }
56
- }
57
- return result;
58
- }
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env node
2
- import { runAllFuzzTargets } from "../../src/securityValidation/fuzz/fuzzHarness.js";
3
- import { ALL_FUZZ_TARGETS } from "../../src/securityValidation/fuzz/fuzzTargets.js";
4
- const SEED = parseInt(process.env["FUZZ_SEED"] ?? "0xDEADBEEF", 16);
5
- const ITERATIONS = parseInt(process.env["FUZZ_ITERATIONS"] ?? "50", 10);
6
- console.log(`Running fuzz smoke tests...`);
7
- console.log(` Targets : ${ALL_FUZZ_TARGETS.length}`);
8
- console.log(` Seed : 0x${SEED.toString(16).toUpperCase()}`);
9
- console.log(` Iterations: ${ITERATIONS} per target`);
10
- const result = await runAllFuzzTargets(ALL_FUZZ_TARGETS, {
11
- seed: SEED,
12
- iterations: ITERATIONS,
13
- });
14
- console.log(`\nStatus : ${result.status.toUpperCase()}`);
15
- console.log(`Duration: ${result.durationMs}ms`);
16
- console.log(`Crashes : ${result.findings.length}`);
17
- if (result.findings.length > 0) {
18
- console.log("\nCrash findings:");
19
- for (const f of result.findings) {
20
- console.log(` [${f.severity.toUpperCase()}] ${f.title}`);
21
- if (f.evidence)
22
- console.log(` Evidence: ${f.evidence.slice(0, 160)}`);
23
- }
24
- process.exitCode = 1;
25
- }
26
- else {
27
- console.log("\nAll fuzz targets completed without crashes.");
28
- process.exitCode = 0;
29
- }
@@ -1,57 +0,0 @@
1
- #!/usr/bin/env node
2
- import path from "node:path";
3
- import { runPackageChecks } from "../../src/securityValidation/index.js";
4
- import { DEFAULT_SECURITY_CONFIG } from "../../src/securityValidation/index.js";
5
- import { resolveValidationTarget } from "../../src/securityValidation/validate/resolveTarget.js";
6
- import { resolveToolRoot } from "./resolveToolRoot.js";
7
- const rawArgs = process.argv.slice(2);
8
- const args = parseArgs(rawArgs);
9
- const toolRoot = resolveToolRoot(import.meta.url);
10
- let targetRoot;
11
- try {
12
- const target = resolveValidationTarget(args.target, toolRoot);
13
- targetRoot = target.targetRoot;
14
- if (!target.isSelf) {
15
- console.log(`Target: ${targetRoot}`);
16
- }
17
- }
18
- catch (err) {
19
- console.error(`ERROR: ${err instanceof Error ? err.message : String(err)}`);
20
- process.exitCode = 1;
21
- process.exit(1);
22
- }
23
- const config = {
24
- ...DEFAULT_SECURITY_CONFIG,
25
- reportDir: path.join(toolRoot, DEFAULT_SECURITY_CONFIG.reportDir),
26
- rawOutputDir: path.join(toolRoot, DEFAULT_SECURITY_CONFIG.rawOutputDir),
27
- };
28
- console.log("Running package content checks...");
29
- console.log(`Report directory: ${config.reportDir}`);
30
- const output = await runPackageChecks({ cwd: targetRoot, config });
31
- const passed = output.checks.filter((c) => c.status === "passed").length;
32
- const failed = output.checks.filter((c) => c.status === "failed").length;
33
- const warned = output.checks.filter((c) => c.status === "warning").length;
34
- console.log(`\nPackage checks complete:`);
35
- console.log(` Passed: ${passed}`);
36
- console.log(` Warned: ${warned}`);
37
- console.log(` Failed: ${failed}`);
38
- console.log(` Findings: ${output.findings.length}`);
39
- if (output.findings.length > 0) {
40
- console.log("\nFindings:");
41
- for (const f of output.findings) {
42
- console.log(` [${f.severity.toUpperCase()}] ${f.title}`);
43
- }
44
- }
45
- console.log(`\nResults written to ${config.reportDir}`);
46
- const hasBlocker = output.findings.some((f) => f.severity === "blocker");
47
- const hasMajor = output.findings.some((f) => f.severity === "major");
48
- process.exitCode = hasBlocker || hasMajor ? 1 : 0;
49
- function parseArgs(argv) {
50
- const result = {};
51
- for (let i = 0; i < argv.length; i++) {
52
- if ((argv[i] === "--target" || argv[i] === "-t") && i + 1 < argv.length) {
53
- result.target = argv[++i];
54
- }
55
- }
56
- return result;
57
- }
@@ -1,64 +0,0 @@
1
- #!/usr/bin/env node
2
- import path from "node:path";
3
- import { runSemgrepCheck } from "../../src/securityValidation/staticScans/semgrep.js";
4
- import { resolveValidationTarget } from "../../src/securityValidation/validate/resolveTarget.js";
5
- import { resolveToolRoot } from "./resolveToolRoot.js";
6
- const rawArgs = process.argv.slice(2);
7
- const args = parseArgs(rawArgs);
8
- const toolRoot = resolveToolRoot(import.meta.url);
9
- let targetRoot;
10
- try {
11
- const target = resolveValidationTarget(args.target, toolRoot);
12
- targetRoot = target.targetRoot;
13
- if (!target.isSelf) {
14
- console.log(`Target: ${targetRoot}`);
15
- }
16
- }
17
- catch (err) {
18
- console.error(`ERROR: ${err instanceof Error ? err.message : String(err)}`);
19
- process.exitCode = 1;
20
- process.exit(1);
21
- }
22
- console.log("Running Semgrep static analysis check...");
23
- console.log(`Config: ${path.join(toolRoot, ".semgrep.yml")}`);
24
- const result = await runSemgrepCheck({
25
- targetRoot,
26
- toolRoot,
27
- configPath: path.join(toolRoot, ".semgrep.yml"),
28
- timeoutMs: 120_000,
29
- });
30
- const label = result.status === "skipped"
31
- ? `SKIPPED — ${result.skippedReason ?? "tool unavailable"}`
32
- : result.status.toUpperCase();
33
- console.log(`\nStatus: ${label}`);
34
- if (result.findings.length > 0) {
35
- console.log("\nFindings:");
36
- for (const f of result.findings) {
37
- console.log(` [${f.severity.toUpperCase()}] ${f.title}`);
38
- if (f.affectedFiles && f.affectedFiles.length > 0) {
39
- console.log(` Location: ${f.affectedFiles[0]}`);
40
- }
41
- if (f.description)
42
- console.log(` ${f.description.slice(0, 120)}`);
43
- }
44
- }
45
- console.log(`\nDuration: ${result.durationMs}ms`);
46
- if (result.status === "skipped") {
47
- console.log("\nSemgrep is optional. Absence does not block release.");
48
- process.exitCode = 0;
49
- }
50
- else if (result.status === "failed") {
51
- process.exitCode = 1;
52
- }
53
- else {
54
- process.exitCode = 0;
55
- }
56
- function parseArgs(argv) {
57
- const result = {};
58
- for (let i = 0; i < argv.length; i++) {
59
- if ((argv[i] === "--target" || argv[i] === "-t") && i + 1 < argv.length) {
60
- result.target = argv[++i];
61
- }
62
- }
63
- return result;
64
- }