@shrkcrft/inspector 0.1.0-alpha.29 → 0.1.0-alpha.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acceptance-replay.js +1 -1
- package/dist/agent-contract-templates.js +6 -6
- package/dist/agent-contract.d.ts.map +1 -1
- package/dist/agent-contract.js +13 -8
- package/dist/agent-orchestration.js +2 -2
- package/dist/agent-task-prep.d.ts +16 -0
- package/dist/agent-task-prep.d.ts.map +1 -1
- package/dist/agent-task-prep.js +51 -4
- package/dist/ai-readiness.d.ts.map +1 -1
- package/dist/ai-readiness.js +21 -3
- package/dist/architecture-map.d.ts +16 -0
- package/dist/architecture-map.d.ts.map +1 -1
- package/dist/architecture-map.js +42 -26
- package/dist/area-explore.d.ts +2 -2
- package/dist/area-explore.d.ts.map +1 -1
- package/dist/area-explore.js +36 -16
- package/dist/area-map.d.ts +56 -11
- package/dist/area-map.d.ts.map +1 -1
- package/dist/area-map.js +106 -25
- package/dist/asset-doctor-proposed-exit.d.ts +21 -0
- package/dist/asset-doctor-proposed-exit.d.ts.map +1 -0
- package/dist/asset-doctor-proposed-exit.js +22 -0
- package/dist/asset-provenance.js +1 -1
- package/dist/boundaries-changed-only.d.ts +24 -1
- package/dist/boundaries-changed-only.d.ts.map +1 -1
- package/dist/boundaries-changed-only.js +12 -2
- package/dist/boundary-check-options.model.d.ts +40 -0
- package/dist/boundary-check-options.model.d.ts.map +1 -0
- package/dist/boundary-check-options.model.js +1 -0
- package/dist/boundary-check-result.model.d.ts +89 -0
- package/dist/boundary-check-result.model.d.ts.map +1 -0
- package/dist/boundary-check-result.model.js +1 -0
- package/dist/boundary-configuration-status.d.ts +38 -0
- package/dist/boundary-configuration-status.d.ts.map +1 -0
- package/dist/boundary-configuration-status.js +118 -0
- package/dist/boundary-configuration-status.model.d.ts +37 -0
- package/dist/boundary-configuration-status.model.d.ts.map +1 -0
- package/dist/boundary-configuration-status.model.js +1 -0
- package/dist/boundary-load-issue.model.d.ts +30 -0
- package/dist/boundary-load-issue.model.d.ts.map +1 -0
- package/dist/boundary-load-issue.model.js +1 -0
- package/dist/boundary-rule-check.model.d.ts +44 -0
- package/dist/boundary-rule-check.model.d.ts.map +1 -0
- package/dist/boundary-rule-check.model.js +1 -0
- package/dist/boundary-rule-invalidation.model.d.ts +31 -0
- package/dist/boundary-rule-invalidation.model.d.ts.map +1 -0
- package/dist/boundary-rule-invalidation.model.js +1 -0
- package/dist/boundary-rule-set-diff.model.d.ts +75 -0
- package/dist/boundary-rule-set-diff.model.d.ts.map +1 -0
- package/dist/boundary-rule-set-diff.model.js +1 -0
- package/dist/boundary-rule-sources.d.ts +28 -0
- package/dist/boundary-rule-sources.d.ts.map +1 -0
- package/dist/boundary-rule-sources.js +110 -0
- package/dist/boundary-stale-exception-finding.model.d.ts +12 -0
- package/dist/boundary-stale-exception-finding.model.d.ts.map +1 -0
- package/dist/boundary-stale-exception-finding.model.js +1 -0
- package/dist/boundary-unit-liveness.d.ts +35 -0
- package/dist/boundary-unit-liveness.d.ts.map +1 -0
- package/dist/boundary-unit-liveness.js +71 -0
- package/dist/change-intent.d.ts +3 -0
- package/dist/change-intent.d.ts.map +1 -1
- package/dist/change-intent.js +61 -27
- package/dist/changes-summary.d.ts.map +1 -1
- package/dist/changes-summary.js +19 -9
- package/dist/ci-integrity-report.js +1 -1
- package/dist/ci-predict.d.ts.map +1 -1
- package/dist/ci-predict.js +38 -5
- package/dist/code-intelligence-doctor.d.ts +40 -0
- package/dist/code-intelligence-doctor.d.ts.map +1 -1
- package/dist/code-intelligence-doctor.js +86 -12
- package/dist/command-recommender.d.ts +45 -2
- package/dist/command-recommender.d.ts.map +1 -1
- package/dist/command-recommender.js +41 -263
- package/dist/command-resolution-status.d.ts +44 -0
- package/dist/command-resolution-status.d.ts.map +1 -0
- package/dist/command-resolution-status.js +44 -0
- package/dist/command-safety-level.d.ts +15 -0
- package/dist/command-safety-level.d.ts.map +1 -0
- package/dist/command-safety-level.js +43 -0
- package/dist/command-taxonomy.js +1 -1
- package/dist/compliance-evidence.js +1 -1
- package/dist/compliance-profiles.js +1 -1
- package/dist/construct-registry.d.ts +40 -0
- package/dist/construct-registry.d.ts.map +1 -1
- package/dist/construct-registry.js +186 -82
- package/dist/context-tuning.d.ts +4 -0
- package/dist/context-tuning.d.ts.map +1 -1
- package/dist/context-tuning.js +10 -7
- package/dist/contract-template-registry.d.ts +10 -0
- package/dist/contract-template-registry.d.ts.map +1 -1
- package/dist/contract-template-registry.js +59 -33
- package/dist/contribution-kind.d.ts +52 -0
- package/dist/contribution-kind.d.ts.map +1 -0
- package/dist/contribution-kind.js +52 -0
- package/dist/contribution-load-failures.d.ts +106 -0
- package/dist/contribution-load-failures.d.ts.map +1 -0
- package/dist/contribution-load-failures.js +575 -0
- package/dist/contributions-report.d.ts +28 -0
- package/dist/contributions-report.d.ts.map +1 -0
- package/dist/contributions-report.js +242 -0
- package/dist/convention-registry.d.ts +22 -0
- package/dist/convention-registry.d.ts.map +1 -1
- package/dist/convention-registry.js +79 -39
- package/dist/coverage-report.d.ts.map +1 -1
- package/dist/coverage-report.js +6 -6
- package/dist/custom-checks.d.ts +60 -1
- package/dist/custom-checks.d.ts.map +1 -1
- package/dist/custom-checks.js +159 -6
- package/dist/dashboard/dashboard-data.d.ts +6 -0
- package/dist/dashboard/dashboard-data.d.ts.map +1 -1
- package/dist/dashboard/dashboard-data.js +99 -8
- package/dist/dashboard/dashboard-knowledge.d.ts.map +1 -1
- package/dist/dashboard/dashboard-knowledge.js +14 -2
- package/dist/decision-records.d.ts +20 -0
- package/dist/decision-records.d.ts.map +1 -1
- package/dist/decision-records.js +68 -20
- package/dist/declared-cross-references.d.ts +61 -0
- package/dist/declared-cross-references.d.ts.map +1 -0
- package/dist/declared-cross-references.js +550 -0
- package/dist/declared-gate-plane-rules.d.ts +24 -0
- package/dist/declared-gate-plane-rules.d.ts.map +1 -0
- package/dist/declared-gate-plane-rules.js +39 -0
- package/dist/declared-reference-coverage.d.ts +27 -0
- package/dist/declared-reference-coverage.d.ts.map +1 -0
- package/dist/declared-reference-coverage.js +50 -0
- package/dist/declared-xref-status.d.ts +19 -0
- package/dist/declared-xref-status.d.ts.map +1 -0
- package/dist/declared-xref-status.js +19 -0
- package/dist/delegate-pack-recipes.d.ts +13 -2
- package/dist/delegate-pack-recipes.d.ts.map +1 -1
- package/dist/delegate-pack-recipes.js +45 -14
- package/dist/demo-package.js +2 -2
- package/dist/demo-script.js +2 -2
- package/dist/demo-workflow.js +3 -3
- package/dist/dev-cycle.js +1 -1
- package/dist/dev-session.js +1 -1
- package/dist/doc-references.d.ts +80 -0
- package/dist/doc-references.d.ts.map +1 -0
- package/dist/doc-references.js +269 -0
- package/dist/doctor-result.d.ts +8 -0
- package/dist/doctor-result.d.ts.map +1 -1
- package/dist/doctor-verdict-kind.d.ts +19 -0
- package/dist/doctor-verdict-kind.d.ts.map +1 -0
- package/dist/doctor-verdict-kind.js +19 -0
- package/dist/doctor-verdict.d.ts +18 -0
- package/dist/doctor-verdict.d.ts.map +1 -0
- package/dist/doctor-verdict.js +28 -0
- package/dist/drift.d.ts +17 -0
- package/dist/drift.d.ts.map +1 -1
- package/dist/drift.js +40 -10
- package/dist/entrypoint-matrix.d.ts.map +1 -1
- package/dist/entrypoint-matrix.js +4 -1
- package/dist/feedback-ingestion.d.ts +28 -2
- package/dist/feedback-ingestion.d.ts.map +1 -1
- package/dist/feedback-ingestion.js +68 -19
- package/dist/fix-preview.d.ts.map +1 -1
- package/dist/fix-preview.js +9 -5
- package/dist/framework-extractor-outcomes.d.ts +27 -0
- package/dist/framework-extractor-outcomes.d.ts.map +1 -0
- package/dist/framework-extractor-outcomes.js +83 -0
- package/dist/fuzzy-impact.d.ts.map +1 -1
- package/dist/fuzzy-impact.js +12 -21
- package/dist/healing-plan.d.ts.map +1 -1
- package/dist/healing-plan.js +3 -4
- package/dist/helper-catalog.d.ts +25 -0
- package/dist/helper-catalog.d.ts.map +1 -0
- package/dist/helper-catalog.js +91 -0
- package/dist/helper-registry.d.ts.map +1 -1
- package/dist/helper-registry.js +17 -1
- package/dist/helper-view.d.ts +33 -0
- package/dist/helper-view.d.ts.map +1 -0
- package/dist/helper-view.js +1 -0
- package/dist/i-asset-doctor-flags.d.ts +16 -0
- package/dist/i-asset-doctor-flags.d.ts.map +1 -0
- package/dist/i-asset-doctor-flags.js +1 -0
- package/dist/i-command-resolution.d.ts +22 -0
- package/dist/i-command-resolution.d.ts.map +1 -0
- package/dist/i-command-resolution.js +1 -0
- package/dist/i-command-resolve-options.d.ts +24 -0
- package/dist/i-command-resolve-options.d.ts.map +1 -0
- package/dist/i-command-resolve-options.js +1 -0
- package/dist/i-command-safety.d.ts +13 -0
- package/dist/i-command-safety.d.ts.map +1 -0
- package/dist/i-command-safety.js +1 -0
- package/dist/i-contribution-accepted-entry.d.ts +18 -0
- package/dist/i-contribution-accepted-entry.d.ts.map +1 -0
- package/dist/i-contribution-accepted-entry.js +1 -0
- package/dist/i-contribution-entry-rejection.d.ts +21 -0
- package/dist/i-contribution-entry-rejection.d.ts.map +1 -0
- package/dist/i-contribution-entry-rejection.js +1 -0
- package/dist/i-contribution-file-issue.d.ts +18 -0
- package/dist/i-contribution-file-issue.d.ts.map +1 -0
- package/dist/i-contribution-file-issue.js +1 -0
- package/dist/i-contribution-file-report.d.ts +40 -0
- package/dist/i-contribution-file-report.d.ts.map +1 -0
- package/dist/i-contribution-file-report.js +1 -0
- package/dist/i-contribution-file-validation.d.ts +24 -0
- package/dist/i-contribution-file-validation.d.ts.map +1 -0
- package/dist/i-contribution-file-validation.js +1 -0
- package/dist/i-contributions-report.d.ts +31 -0
- package/dist/i-contributions-report.d.ts.map +1 -0
- package/dist/i-contributions-report.js +1 -0
- package/dist/i-declared-xref-field.d.ts +25 -0
- package/dist/i-declared-xref-field.d.ts.map +1 -0
- package/dist/i-declared-xref-field.js +1 -0
- package/dist/i-declared-xref-issue.d.ts +25 -0
- package/dist/i-declared-xref-issue.d.ts.map +1 -0
- package/dist/i-declared-xref-issue.js +1 -0
- package/dist/i-declared-xref-report.d.ts +48 -0
- package/dist/i-declared-xref-report.d.ts.map +1 -0
- package/dist/i-declared-xref-report.js +1 -0
- package/dist/i-declared-xref-row.d.ts +29 -0
- package/dist/i-declared-xref-row.d.ts.map +1 -0
- package/dist/i-declared-xref-row.js +1 -0
- package/dist/i-doctor-verdict.d.ts +10 -0
- package/dist/i-doctor-verdict.d.ts.map +1 -0
- package/dist/i-doctor-verdict.js +1 -0
- package/dist/i-kind-outcomes.d.ts +13 -0
- package/dist/i-kind-outcomes.d.ts.map +1 -0
- package/dist/i-kind-outcomes.js +1 -0
- package/dist/i-pack-doctor-verdict.d.ts +15 -0
- package/dist/i-pack-doctor-verdict.d.ts.map +1 -0
- package/dist/i-pack-doctor-verdict.js +1 -0
- package/dist/i-probed-id-field.d.ts +17 -0
- package/dist/i-probed-id-field.d.ts.map +1 -0
- package/dist/i-probed-id-field.js +1 -0
- package/dist/i-reference-kind-declaration.d.ts +38 -0
- package/dist/i-reference-kind-declaration.d.ts.map +1 -0
- package/dist/i-reference-kind-declaration.js +1 -0
- package/dist/i-reference-warm-options.d.ts +21 -0
- package/dist/i-reference-warm-options.d.ts.map +1 -0
- package/dist/i-reference-warm-options.js +1 -0
- package/dist/i-registry-outcomes.d.ts +16 -0
- package/dist/i-registry-outcomes.d.ts.map +1 -0
- package/dist/i-registry-outcomes.js +1 -0
- package/dist/i-scaffold-pattern-doctor-report.d.ts +35 -0
- package/dist/i-scaffold-pattern-doctor-report.d.ts.map +1 -0
- package/dist/i-scaffold-pattern-doctor-report.js +1 -0
- package/dist/i-search-tuning-key-probe.d.ts +30 -0
- package/dist/i-search-tuning-key-probe.d.ts.map +1 -0
- package/dist/i-search-tuning-key-probe.js +1 -0
- package/dist/i-search-tuning-lint-issue.d.ts +61 -0
- package/dist/i-search-tuning-lint-issue.d.ts.map +1 -0
- package/dist/i-search-tuning-lint-issue.js +1 -0
- package/dist/i-search-tuning-lint-report.d.ts +38 -0
- package/dist/i-search-tuning-lint-report.d.ts.map +1 -0
- package/dist/i-search-tuning-lint-report.js +1 -0
- package/dist/i-unresolvable-reference-scan.d.ts +14 -0
- package/dist/i-unresolvable-reference-scan.d.ts.map +1 -0
- package/dist/i-unresolvable-reference-scan.js +1 -0
- package/dist/i-unresolvable-reference.d.ts +29 -0
- package/dist/i-unresolvable-reference.d.ts.map +1 -0
- package/dist/i-unresolvable-reference.js +1 -0
- package/dist/i-workspace-profile-payload.d.ts +12 -0
- package/dist/i-workspace-profile-payload.d.ts.map +1 -0
- package/dist/i-workspace-profile-payload.js +1 -0
- package/dist/impact-analysis.d.ts +15 -0
- package/dist/impact-analysis.d.ts.map +1 -1
- package/dist/impact-analysis.js +58 -13
- package/dist/impact-render.d.ts.map +1 -1
- package/dist/impact-render.js +22 -0
- package/dist/import-hygiene.d.ts +35 -1
- package/dist/import-hygiene.d.ts.map +1 -1
- package/dist/import-hygiene.js +107 -13
- package/dist/index.d.ts +145 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +176 -0
- package/dist/inspection-discovery.d.ts +45 -0
- package/dist/inspection-discovery.d.ts.map +1 -0
- package/dist/inspection-discovery.js +70 -0
- package/dist/knowledge-advisory-code.d.ts +17 -0
- package/dist/knowledge-advisory-code.d.ts.map +1 -0
- package/dist/knowledge-advisory-code.js +17 -0
- package/dist/knowledge-aged-entry.d.ts +10 -0
- package/dist/knowledge-aged-entry.d.ts.map +1 -0
- package/dist/knowledge-aged-entry.js +1 -0
- package/dist/knowledge-authoring.d.ts +24 -1
- package/dist/knowledge-authoring.d.ts.map +1 -1
- package/dist/knowledge-authoring.js +46 -7
- package/dist/knowledge-entry-verdict-record.d.ts +22 -0
- package/dist/knowledge-entry-verdict-record.d.ts.map +1 -0
- package/dist/knowledge-entry-verdict-record.js +1 -0
- package/dist/knowledge-entry-verdict.d.ts +17 -0
- package/dist/knowledge-entry-verdict.d.ts.map +1 -0
- package/dist/knowledge-entry-verdict.js +17 -0
- package/dist/knowledge-graph.d.ts +6 -0
- package/dist/knowledge-graph.d.ts.map +1 -1
- package/dist/knowledge-graph.js +18 -7
- package/dist/knowledge-kind-bucket.d.ts +19 -0
- package/dist/knowledge-kind-bucket.d.ts.map +1 -0
- package/dist/knowledge-kind-bucket.js +1 -0
- package/dist/knowledge-load-failure.d.ts +23 -0
- package/dist/knowledge-load-failure.d.ts.map +1 -0
- package/dist/knowledge-load-failure.js +1 -0
- package/dist/knowledge-reference-kind-bucket.d.ts +11 -0
- package/dist/knowledge-reference-kind-bucket.d.ts.map +1 -0
- package/dist/knowledge-reference-kind-bucket.js +1 -0
- package/dist/knowledge-stale-advisory.d.ts +14 -0
- package/dist/knowledge-stale-advisory.d.ts.map +1 -0
- package/dist/knowledge-stale-advisory.js +1 -0
- package/dist/knowledge-stale-coverage.d.ts +19 -0
- package/dist/knowledge-stale-coverage.d.ts.map +1 -0
- package/dist/knowledge-stale-coverage.js +1 -0
- package/dist/knowledge-stale-gate-flags.d.ts +33 -0
- package/dist/knowledge-stale-gate-flags.d.ts.map +1 -0
- package/dist/knowledge-stale-gate-flags.js +1 -0
- package/dist/knowledge-stale-gate-input.d.ts +46 -0
- package/dist/knowledge-stale-gate-input.d.ts.map +1 -0
- package/dist/knowledge-stale-gate-input.js +1 -0
- package/dist/knowledge-stale-gate-result.d.ts +33 -0
- package/dist/knowledge-stale-gate-result.d.ts.map +1 -0
- package/dist/knowledge-stale-gate-result.js +1 -0
- package/dist/knowledge-stale-gate-rule.d.ts +33 -0
- package/dist/knowledge-stale-gate-rule.d.ts.map +1 -0
- package/dist/knowledge-stale-gate-rule.js +1 -0
- package/dist/knowledge-stale-gate-violation.d.ts +13 -0
- package/dist/knowledge-stale-gate-violation.d.ts.map +1 -0
- package/dist/knowledge-stale-gate-violation.js +1 -0
- package/dist/knowledge-stale-gate.d.ts +83 -0
- package/dist/knowledge-stale-gate.d.ts.map +1 -0
- package/dist/knowledge-stale-gate.js +429 -0
- package/dist/knowledge-stale-quality-gate.d.ts +26 -0
- package/dist/knowledge-stale-quality-gate.d.ts.map +1 -0
- package/dist/knowledge-stale-quality-gate.js +110 -0
- package/dist/knowledge-stale.d.ts +122 -9
- package/dist/knowledge-stale.d.ts.map +1 -1
- package/dist/knowledge-stale.js +1002 -316
- package/dist/knowledge-unverifiable-reason.d.ts +12 -0
- package/dist/knowledge-unverifiable-reason.d.ts.map +1 -0
- package/dist/knowledge-unverifiable-reason.js +12 -0
- package/dist/loader-diagnostics.d.ts +14 -2
- package/dist/loader-diagnostics.d.ts.map +1 -1
- package/dist/match-terms.d.ts +48 -0
- package/dist/match-terms.d.ts.map +1 -0
- package/dist/match-terms.js +155 -0
- package/dist/migration-profile-registry.d.ts +10 -0
- package/dist/migration-profile-registry.d.ts.map +1 -1
- package/dist/migration-profile-registry.js +57 -34
- package/dist/migration-readiness.d.ts.map +1 -1
- package/dist/migration-readiness.js +1 -3
- package/dist/nearest-id.d.ts +14 -0
- package/dist/nearest-id.d.ts.map +1 -0
- package/dist/nearest-id.js +12 -0
- package/dist/pack-asset-freshness.d.ts +65 -0
- package/dist/pack-asset-freshness.d.ts.map +1 -0
- package/dist/pack-asset-freshness.js +340 -0
- package/dist/pack-author-ux.d.ts +24 -3
- package/dist/pack-author-ux.d.ts.map +1 -1
- package/dist/pack-author-ux.js +87 -93
- package/dist/pack-contributions-inventory.d.ts +79 -39
- package/dist/pack-contributions-inventory.d.ts.map +1 -1
- package/dist/pack-contributions-inventory.js +443 -286
- package/dist/pack-doctor-verdict.d.ts +29 -0
- package/dist/pack-doctor-verdict.d.ts.map +1 -0
- package/dist/pack-doctor-verdict.js +45 -0
- package/dist/pack-doctor.d.ts +74 -1
- package/dist/pack-doctor.d.ts.map +1 -1
- package/dist/pack-doctor.js +281 -1
- package/dist/pack-helper-plan.d.ts +24 -0
- package/dist/pack-helper-plan.d.ts.map +1 -0
- package/dist/pack-helper-plan.js +77 -0
- package/dist/pack-helper-registry.d.ts +14 -0
- package/dist/pack-helper-registry.d.ts.map +1 -1
- package/dist/pack-helper-registry.js +76 -37
- package/dist/pack-manifest-reader.d.ts +8 -0
- package/dist/pack-manifest-reader.d.ts.map +1 -0
- package/dist/pack-manifest-reader.js +79 -0
- package/dist/pack-release-check.d.ts +14 -1
- package/dist/pack-release-check.d.ts.map +1 -1
- package/dist/pack-release-check.js +23 -1
- package/dist/pack-signature-status.d.ts +18 -6
- package/dist/pack-signature-status.d.ts.map +1 -1
- package/dist/pack-signature-status.js +59 -105
- package/dist/pack-test-runner.d.ts +27 -5
- package/dist/pack-test-runner.d.ts.map +1 -1
- package/dist/pack-test-runner.js +91 -35
- package/dist/pack-typecheck.d.ts +8 -0
- package/dist/pack-typecheck.d.ts.map +1 -0
- package/dist/pack-typecheck.js +76 -0
- package/dist/plan-review.d.ts +2 -0
- package/dist/plan-review.d.ts.map +1 -1
- package/dist/plan-review.js +17 -5
- package/dist/plan-simulation.d.ts.map +1 -1
- package/dist/plan-simulation.js +16 -5
- package/dist/playbook-load-issue.d.ts +16 -0
- package/dist/playbook-load-issue.d.ts.map +1 -0
- package/dist/playbook-load-issue.js +1 -0
- package/dist/playbook-registry.d.ts +32 -1
- package/dist/playbook-registry.d.ts.map +1 -1
- package/dist/playbook-registry.js +144 -55
- package/dist/policy-declaration.d.ts +18 -0
- package/dist/policy-declaration.d.ts.map +1 -0
- package/dist/policy-declaration.js +1 -0
- package/dist/policy-engine.d.ts +8 -0
- package/dist/policy-engine.d.ts.map +1 -1
- package/dist/policy-engine.js +26 -9
- package/dist/policy-overrides.d.ts.map +1 -1
- package/dist/policy-overrides.js +4 -4
- package/dist/policy-registry.d.ts +42 -0
- package/dist/policy-registry.d.ts.map +1 -0
- package/dist/policy-registry.js +131 -0
- package/dist/probed-id-fields.d.ts +21 -0
- package/dist/probed-id-fields.d.ts.map +1 -0
- package/dist/probed-id-fields.js +25 -0
- package/dist/probed-id-source.d.ts +11 -0
- package/dist/probed-id-source.d.ts.map +1 -0
- package/dist/probed-id-source.js +11 -0
- package/dist/profile-registry.d.ts +25 -2
- package/dist/profile-registry.d.ts.map +1 -1
- package/dist/profile-registry.js +59 -6
- package/dist/quality-gate-examination.d.ts +15 -0
- package/dist/quality-gate-examination.d.ts.map +1 -0
- package/dist/quality-gate-examination.js +15 -0
- package/dist/quality-gate-row-status.d.ts +19 -0
- package/dist/quality-gate-row-status.d.ts.map +1 -0
- package/dist/quality-gate-row-status.js +28 -0
- package/dist/quality-gate-status.d.ts +16 -0
- package/dist/quality-gate-status.d.ts.map +1 -0
- package/dist/quality-gate-status.js +16 -0
- package/dist/quality-html.d.ts.map +1 -1
- package/dist/quality-html.js +14 -3
- package/dist/quality-report-coverage.d.ts +26 -0
- package/dist/quality-report-coverage.d.ts.map +1 -0
- package/dist/quality-report-coverage.js +48 -0
- package/dist/quality-report.d.ts +28 -1
- package/dist/quality-report.d.ts.map +1 -1
- package/dist/quality-report.js +263 -35
- package/dist/query-intent-kind.d.ts +18 -0
- package/dist/query-intent-kind.d.ts.map +1 -0
- package/dist/query-intent-kind.js +18 -0
- package/dist/query-intent-result.d.ts +23 -0
- package/dist/query-intent-result.d.ts.map +1 -0
- package/dist/query-intent-result.js +1 -0
- package/dist/query-intent.d.ts +18 -0
- package/dist/query-intent.d.ts.map +1 -0
- package/dist/query-intent.js +336 -0
- package/dist/query-resolver.d.ts +18 -0
- package/dist/query-resolver.d.ts.map +1 -1
- package/dist/query-resolver.js +15 -12
- package/dist/ranked-recommendations.d.ts +36 -0
- package/dist/ranked-recommendations.d.ts.map +1 -0
- package/dist/ranked-recommendations.js +1 -0
- package/dist/ranker-explainability.d.ts.map +1 -1
- package/dist/ranker-explainability.js +38 -10
- package/dist/recommend-recipe.d.ts +17 -0
- package/dist/recommend-recipe.d.ts.map +1 -0
- package/dist/recommend-recipe.js +1 -0
- package/dist/recommend-recipes.d.ts +9 -0
- package/dist/recommend-recipes.d.ts.map +1 -0
- package/dist/recommend-recipes.js +106 -0
- package/dist/recommendation-candidate.d.ts +30 -0
- package/dist/recommendation-candidate.d.ts.map +1 -0
- package/dist/recommendation-candidate.js +1 -0
- package/dist/recommendation-confidence.d.ts +27 -0
- package/dist/recommendation-confidence.d.ts.map +1 -0
- package/dist/recommendation-confidence.js +1 -0
- package/dist/recommendation-ranking-options.d.ts +24 -0
- package/dist/recommendation-ranking-options.d.ts.map +1 -0
- package/dist/recommendation-ranking-options.js +1 -0
- package/dist/recommendation-ranking.d.ts +50 -0
- package/dist/recommendation-ranking.d.ts.map +1 -0
- package/dist/recommendation-ranking.js +527 -0
- package/dist/recommendation-source.d.ts +23 -0
- package/dist/recommendation-source.d.ts.map +1 -0
- package/dist/recommendation-source.js +23 -0
- package/dist/recommendation-suppression.d.ts +14 -0
- package/dist/recommendation-suppression.d.ts.map +1 -0
- package/dist/recommendation-suppression.js +14 -0
- package/dist/reference-asset-kind.d.ts +14 -0
- package/dist/reference-asset-kind.d.ts.map +1 -0
- package/dist/reference-asset-kind.js +14 -0
- package/dist/reference-content-check.d.ts +32 -0
- package/dist/reference-content-check.d.ts.map +1 -0
- package/dist/reference-content-check.js +143 -0
- package/dist/reference-failure.d.ts +31 -0
- package/dist/reference-failure.d.ts.map +1 -0
- package/dist/reference-failure.js +31 -0
- package/dist/reference-id-status.d.ts +15 -0
- package/dist/reference-id-status.d.ts.map +1 -0
- package/dist/reference-id-status.js +15 -0
- package/dist/reference-kind-declarations.d.ts +42 -0
- package/dist/reference-kind-declarations.d.ts.map +1 -0
- package/dist/reference-kind-declarations.js +142 -0
- package/dist/reference-lookup.d.ts +6 -0
- package/dist/reference-lookup.d.ts.map +1 -1
- package/dist/reference-lookup.js +13 -5
- package/dist/reference-registry.d.ts +210 -0
- package/dist/reference-registry.d.ts.map +1 -0
- package/dist/reference-registry.js +395 -0
- package/dist/reference-subject.d.ts +20 -0
- package/dist/reference-subject.d.ts.map +1 -0
- package/dist/reference-subject.js +1 -0
- package/dist/registration-hint-discovery-status.d.ts +25 -0
- package/dist/registration-hint-discovery-status.d.ts.map +1 -0
- package/dist/registration-hint-discovery-status.js +25 -0
- package/dist/registration-hint-registry.d.ts +80 -0
- package/dist/registration-hint-registry.d.ts.map +1 -1
- package/dist/registration-hint-registry.js +356 -138
- package/dist/registry-lifecycle.d.ts +200 -19
- package/dist/registry-lifecycle.d.ts.map +1 -1
- package/dist/registry-lifecycle.js +526 -136
- package/dist/release-readiness.d.ts.map +1 -1
- package/dist/release-readiness.js +10 -7
- package/dist/release-smoke.d.ts.map +1 -1
- package/dist/release-smoke.js +11 -7
- package/dist/report-site.d.ts.map +1 -1
- package/dist/report-site.js +25 -7
- package/dist/repository-intelligence.d.ts.map +1 -1
- package/dist/repository-intelligence.js +3 -2
- package/dist/repository-knowledge-model.d.ts.map +1 -1
- package/dist/repository-knowledge-model.js +18 -5
- package/dist/resolve-project-config.d.ts +64 -0
- package/dist/resolve-project-config.d.ts.map +1 -1
- package/dist/resolve-project-config.js +258 -32
- package/dist/reuse/compute-reuse-coverage.d.ts +29 -0
- package/dist/reuse/compute-reuse-coverage.d.ts.map +1 -0
- package/dist/reuse/compute-reuse-coverage.js +198 -0
- package/dist/reuse/rank-reuse-candidates.d.ts +38 -0
- package/dist/reuse/rank-reuse-candidates.d.ts.map +1 -0
- package/dist/reuse/rank-reuse-candidates.js +212 -0
- package/dist/reuse/rank-reuse-options.d.ts +20 -0
- package/dist/reuse/rank-reuse-options.d.ts.map +1 -0
- package/dist/reuse/rank-reuse-options.js +1 -0
- package/dist/reuse/rank-reuse-suggestions.d.ts +15 -0
- package/dist/reuse/rank-reuse-suggestions.d.ts.map +1 -0
- package/dist/reuse/rank-reuse-suggestions.js +31 -0
- package/dist/reuse/resolve-curated-reuse.d.ts +43 -0
- package/dist/reuse/resolve-curated-reuse.d.ts.map +1 -0
- package/dist/reuse/resolve-curated-reuse.js +115 -0
- package/dist/reuse/reuse-candidate.d.ts +29 -0
- package/dist/reuse/reuse-candidate.d.ts.map +1 -0
- package/dist/reuse/reuse-candidate.js +1 -0
- package/dist/reuse/reuse-coverage-report.d.ts +74 -0
- package/dist/reuse/reuse-coverage-report.d.ts.map +1 -0
- package/dist/reuse/reuse-coverage-report.js +1 -0
- package/dist/reuse/reuse-curated-coverage.d.ts +36 -0
- package/dist/reuse/reuse-curated-coverage.d.ts.map +1 -0
- package/dist/reuse/reuse-curated-coverage.js +1 -0
- package/dist/reuse/reuse-curated-resolution.d.ts +36 -0
- package/dist/reuse/reuse-curated-resolution.d.ts.map +1 -0
- package/dist/reuse/reuse-curated-resolution.js +1 -0
- package/dist/reuse/reuse-curated-status.d.ts +21 -0
- package/dist/reuse/reuse-curated-status.d.ts.map +1 -0
- package/dist/reuse/reuse-curated-status.js +21 -0
- package/dist/reuse/reuse-match-detail.d.ts +15 -0
- package/dist/reuse/reuse-match-detail.d.ts.map +1 -0
- package/dist/reuse/reuse-match-detail.js +1 -0
- package/dist/reuse/reuse-ranking.d.ts +37 -0
- package/dist/reuse/reuse-ranking.d.ts.map +1 -0
- package/dist/reuse/reuse-ranking.js +1 -0
- package/dist/reuse/reuse-suggestion.d.ts +19 -0
- package/dist/reuse/reuse-suggestion.d.ts.map +1 -0
- package/dist/reuse/reuse-suggestion.js +1 -0
- package/dist/reuse/reuse-symbol-lookup.d.ts +28 -0
- package/dist/reuse/reuse-symbol-lookup.d.ts.map +1 -0
- package/dist/reuse/reuse-symbol-lookup.js +1 -0
- package/dist/reuse/reuse-tokenize.d.ts +11 -0
- package/dist/reuse/reuse-tokenize.d.ts.map +1 -0
- package/dist/reuse/reuse-tokenize.js +26 -0
- package/dist/reuse/score-reuse-name.d.ts +16 -0
- package/dist/reuse/score-reuse-name.d.ts.map +1 -0
- package/dist/reuse/score-reuse-name.js +35 -0
- package/dist/reuse/score-reuse-primitive.d.ts +33 -0
- package/dist/reuse/score-reuse-primitive.d.ts.map +1 -0
- package/dist/reuse/score-reuse-primitive.js +92 -0
- package/dist/review-packet.d.ts +2 -0
- package/dist/review-packet.d.ts.map +1 -1
- package/dist/review-packet.js +13 -6
- package/dist/role-views.d.ts.map +1 -1
- package/dist/role-views.js +16 -16
- package/dist/routing-recommends-channels.d.ts +24 -0
- package/dist/routing-recommends-channels.d.ts.map +1 -0
- package/dist/routing-recommends-channels.js +19 -0
- package/dist/run-boundary-check.d.ts +118 -0
- package/dist/run-boundary-check.d.ts.map +1 -0
- package/dist/run-boundary-check.js +592 -0
- package/dist/safety-audit.js +1 -1
- package/dist/scaffold-coverage.js +1 -1
- package/dist/scaffold-pattern-doctor-report.d.ts +19 -0
- package/dist/scaffold-pattern-doctor-report.d.ts.map +1 -0
- package/dist/scaffold-pattern-doctor-report.js +54 -0
- package/dist/scaffold-patterns.d.ts +75 -1
- package/dist/scaffold-patterns.d.ts.map +1 -1
- package/dist/scaffold-patterns.js +375 -84
- package/dist/schema-inventory.d.ts.map +1 -1
- package/dist/schema-inventory.js +4 -3
- package/dist/search-document-id.d.ts +52 -0
- package/dist/search-document-id.d.ts.map +1 -0
- package/dist/search-document-id.js +72 -0
- package/dist/search-document-prefix.d.ts +7 -0
- package/dist/search-document-prefix.d.ts.map +1 -0
- package/dist/search-document-prefix.js +1 -0
- package/dist/search-index.d.ts.map +1 -1
- package/dist/search-index.js +20 -23
- package/dist/search-tuning-explain.d.ts +6 -0
- package/dist/search-tuning-explain.d.ts.map +1 -1
- package/dist/search-tuning-explain.js +19 -17
- package/dist/search-tuning-key-probes.d.ts +16 -0
- package/dist/search-tuning-key-probes.d.ts.map +1 -0
- package/dist/search-tuning-key-probes.js +65 -0
- package/dist/search-tuning-key-resolution.d.ts +25 -0
- package/dist/search-tuning-key-resolution.d.ts.map +1 -0
- package/dist/search-tuning-key-resolution.js +1 -0
- package/dist/search-tuning-key-resolver.d.ts +4 -0
- package/dist/search-tuning-key-resolver.d.ts.map +1 -0
- package/dist/search-tuning-key-resolver.js +107 -0
- package/dist/search-tuning-key-status.d.ts +24 -0
- package/dist/search-tuning-key-status.d.ts.map +1 -0
- package/dist/search-tuning-key-status.js +24 -0
- package/dist/search-tuning-lint.d.ts +9 -0
- package/dist/search-tuning-lint.d.ts.map +1 -0
- package/dist/search-tuning-lint.js +468 -0
- package/dist/search-tuning-registry.d.ts +43 -0
- package/dist/search-tuning-registry.d.ts.map +1 -1
- package/dist/search-tuning-registry.js +214 -49
- package/dist/self-audit.d.ts +12 -0
- package/dist/self-audit.d.ts.map +1 -1
- package/dist/self-audit.js +36 -10
- package/dist/self-config-doctor-v2.d.ts +145 -3
- package/dist/self-config-doctor-v2.d.ts.map +1 -1
- package/dist/self-config-doctor-v2.js +1329 -255
- package/dist/self-config-doctor.d.ts +20 -1
- package/dist/self-config-doctor.d.ts.map +1 -1
- package/dist/self-config-doctor.js +65 -309
- package/dist/settled-unit-states.d.ts +9 -0
- package/dist/settled-unit-states.d.ts.map +1 -0
- package/dist/settled-unit-states.js +14 -0
- package/dist/sharkcraft-inspector.d.ts +47 -1
- package/dist/sharkcraft-inspector.d.ts.map +1 -1
- package/dist/sharkcraft-inspector.js +278 -29
- package/dist/spec/spec-evidence.d.ts.map +1 -1
- package/dist/spec/spec-evidence.js +14 -20
- package/dist/split-identifier.d.ts +21 -0
- package/dist/split-identifier.d.ts.map +1 -0
- package/dist/split-identifier.js +27 -0
- package/dist/start-here.d.ts.map +1 -1
- package/dist/start-here.js +1 -2
- package/dist/substitute-placeholders.d.ts +8 -0
- package/dist/substitute-placeholders.d.ts.map +1 -0
- package/dist/substitute-placeholders.js +9 -0
- package/dist/symbol-index.d.ts +33 -0
- package/dist/symbol-index.d.ts.map +1 -1
- package/dist/symbol-index.js +241 -3
- package/dist/symbol-member-entry.d.ts +26 -0
- package/dist/symbol-member-entry.d.ts.map +1 -0
- package/dist/symbol-member-entry.js +1 -0
- package/dist/symbol-member-kind.d.ts +14 -0
- package/dist/symbol-member-kind.d.ts.map +1 -0
- package/dist/symbol-member-kind.js +14 -0
- package/dist/task-packet.d.ts.map +1 -1
- package/dist/task-packet.js +52 -9
- package/dist/task-ranker.d.ts +8 -0
- package/dist/task-ranker.d.ts.map +1 -1
- package/dist/task-ranker.js +25 -13
- package/dist/task-risk.js +1 -1
- package/dist/task-routing-hint-registry.d.ts +20 -1
- package/dist/task-routing-hint-registry.d.ts.map +1 -1
- package/dist/task-routing-hint-registry.js +186 -42
- package/dist/template-drift.d.ts.map +1 -1
- package/dist/template-drift.js +30 -9
- package/dist/template-lint.d.ts.map +1 -1
- package/dist/template-lint.js +160 -2
- package/dist/term-query.d.ts +10 -0
- package/dist/term-query.d.ts.map +1 -0
- package/dist/term-query.js +1 -0
- package/dist/test-definitions.d.ts +6 -3
- package/dist/test-definitions.d.ts.map +1 -1
- package/dist/test-runner.d.ts +95 -10
- package/dist/test-runner.d.ts.map +1 -1
- package/dist/test-runner.js +309 -318
- package/dist/tuning-query-tokens.d.ts +29 -0
- package/dist/tuning-query-tokens.d.ts.map +1 -0
- package/dist/tuning-query-tokens.js +51 -0
- package/dist/typecheck-files.d.ts +36 -0
- package/dist/typecheck-files.d.ts.map +1 -0
- package/dist/typecheck-files.js +158 -0
- package/dist/uncertainty.js +1 -1
- package/dist/universal-search.d.ts.map +1 -1
- package/dist/universal-search.js +5 -3
- package/dist/unregistered-exports.d.ts +19 -0
- package/dist/unregistered-exports.d.ts.map +1 -0
- package/dist/unregistered-exports.js +141 -0
- package/dist/unresolvable-reason.d.ts +11 -0
- package/dist/unresolvable-reason.d.ts.map +1 -0
- package/dist/unresolvable-reason.js +11 -0
- package/dist/upgrade-advisor.d.ts.map +1 -1
- package/dist/upgrade-advisor.js +16 -9
- package/dist/validate-contribution-file.d.ts +4 -0
- package/dist/validate-contribution-file.d.ts.map +1 -0
- package/dist/validate-contribution-file.js +228 -0
- package/dist/why-file.d.ts +3 -0
- package/dist/why-file.d.ts.map +1 -1
- package/dist/why-file.js +7 -3
- package/package.json +17 -17
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE pack-asset freshness authority — divergence by CONTENT, never age.
|
|
3
|
+
*
|
|
4
|
+
* Three mtime heuristics used to answer "is this pack stale?" (dev-status:
|
|
5
|
+
* signed-file mtime vs `src/assets` +500ms; signature-status and the
|
|
6
|
+
* contributions inventory: `signedAt` vs contribution mtimes +1000ms). They
|
|
7
|
+
* disagreed in both directions on the same pack, and none of them could see
|
|
8
|
+
* the case that actually bites: a compiled `dist/*.js` contribution built from
|
|
9
|
+
* an OLDER `src/*.ts` — shrk serves the previous build while every surface
|
|
10
|
+
* says OK.
|
|
11
|
+
*
|
|
12
|
+
* One question, one answer, from recorded content:
|
|
13
|
+
*
|
|
14
|
+
* - **signature** — `shrk packs sign` records `sha256` of every contribution
|
|
15
|
+
* file (and each compiled artifact's mapped source) on the signature
|
|
16
|
+
* (`contentDigests`). Fresh iff every recorded file still has that content.
|
|
17
|
+
* A signature with no record for a file is `unrecorded` — NOT verified,
|
|
18
|
+
* never fresh.
|
|
19
|
+
* - **build** — for each compiled contribution with a mapped source on disk,
|
|
20
|
+
* the build-time record is the source map's `sourcesContent` (what the
|
|
21
|
+
* compiler actually read) or, failing that, the signature's digests of the
|
|
22
|
+
* artifact + source pair. Stale iff the source's content differs from the
|
|
23
|
+
* record; `unrecorded` when no record exists.
|
|
24
|
+
*
|
|
25
|
+
* Consumed by `packs signature-status`, `packs dev-status`, the contributions
|
|
26
|
+
* inventory's stale-signature conflict, `packs doctor`, `shrk doctor` and the
|
|
27
|
+
* CLI startup warning — all of them read this function, none recompute it.
|
|
28
|
+
* Computed on read (never cached on the discovery object, whose cache is keyed
|
|
29
|
+
* by the lockfile and would itself go stale).
|
|
30
|
+
*/
|
|
31
|
+
import { createHash } from 'node:crypto';
|
|
32
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
33
|
+
import * as nodePath from 'node:path';
|
|
34
|
+
import { CONTRIBUTION_FILE_KEYS, FUTURE_CONTRIBUTION_FILE_KEYS, } from '@shrkcrft/plugin-api';
|
|
35
|
+
const COMPILED_EXT = /\.(?:js|mjs|cjs)$/i;
|
|
36
|
+
const BUILD_DIRS = new Set(['dist', 'build', 'lib', 'out']);
|
|
37
|
+
/** `sha256:<hex>` of a file's bytes (or of a string's UTF-8 bytes). */
|
|
38
|
+
export function packContentDigest(content) {
|
|
39
|
+
return 'sha256:' + createHash('sha256').update(content).digest('hex');
|
|
40
|
+
}
|
|
41
|
+
function toPosix(p) {
|
|
42
|
+
return p.split(nodePath.sep).join('/');
|
|
43
|
+
}
|
|
44
|
+
function relToPack(packageRoot, abs) {
|
|
45
|
+
return toPosix(nodePath.relative(packageRoot, abs));
|
|
46
|
+
}
|
|
47
|
+
function digestFile(abs) {
|
|
48
|
+
try {
|
|
49
|
+
return packContentDigest(readFileSync(abs));
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function readJsonTolerant(file) {
|
|
56
|
+
try {
|
|
57
|
+
const raw = readFileSync(file, 'utf8')
|
|
58
|
+
.replace(/\/\*[\s\S]*?\*\//g, '')
|
|
59
|
+
.replace(/(^|[^:"'\\])\/\/.*$/gm, '$1')
|
|
60
|
+
.replace(/,(\s*[}\]])/g, '$1');
|
|
61
|
+
return JSON.parse(raw);
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/** Every declared contribution file that exists, pack-relative, deduped, sorted. */
|
|
68
|
+
function contributionFiles(packageRoot, manifest) {
|
|
69
|
+
const out = new Set();
|
|
70
|
+
const contributions = (manifest?.contributions ?? {});
|
|
71
|
+
for (const key of [...CONTRIBUTION_FILE_KEYS, ...FUTURE_CONTRIBUTION_FILE_KEYS]) {
|
|
72
|
+
for (const rel of contributions[key] ?? []) {
|
|
73
|
+
if (typeof rel !== 'string' || rel.length === 0)
|
|
74
|
+
continue;
|
|
75
|
+
const abs = nodePath.resolve(packageRoot, rel);
|
|
76
|
+
if (existsSync(abs))
|
|
77
|
+
out.add(relToPack(packageRoot, abs));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return [...out].sort();
|
|
81
|
+
}
|
|
82
|
+
function sourceExtensionsFor(artifactExt) {
|
|
83
|
+
if (artifactExt === '.mjs')
|
|
84
|
+
return ['.mts', '.ts'];
|
|
85
|
+
if (artifactExt === '.cjs')
|
|
86
|
+
return ['.cts', '.ts'];
|
|
87
|
+
return ['.ts', '.tsx'];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The source a compiled artifact was built from: tsconfig `outDir` → `rootDir`
|
|
91
|
+
* (or `src` / `.` when `rootDir` is unset), else the `dist|build|lib|out` →
|
|
92
|
+
* `src` convention. `null` when no candidate exists on disk.
|
|
93
|
+
*/
|
|
94
|
+
function mapCompiledSource(packageRoot, artifactRel) {
|
|
95
|
+
const ext = nodePath.extname(artifactRel).toLowerCase();
|
|
96
|
+
const stem = artifactRel.slice(0, -ext.length);
|
|
97
|
+
const candidates = [];
|
|
98
|
+
const tsconfig = readJsonTolerant(nodePath.join(packageRoot, 'tsconfig.json'));
|
|
99
|
+
const co = (tsconfig?.['compilerOptions'] ?? {});
|
|
100
|
+
if (typeof co.outDir === 'string') {
|
|
101
|
+
const outDir = toPosix(nodePath.normalize(co.outDir)).replace(/^\.\//, '').replace(/\/$/, '');
|
|
102
|
+
if (stem.startsWith(outDir + '/')) {
|
|
103
|
+
const rest = stem.slice(outDir.length + 1);
|
|
104
|
+
const roots = typeof co.rootDir === 'string'
|
|
105
|
+
? [toPosix(nodePath.normalize(co.rootDir)).replace(/^\.\//, '').replace(/\/$/, '')]
|
|
106
|
+
: ['src', '.'];
|
|
107
|
+
for (const r of roots)
|
|
108
|
+
candidates.push(r === '.' || r === '' ? rest : `${r}/${rest}`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const [first, ...rest] = stem.split('/');
|
|
112
|
+
if (first && BUILD_DIRS.has(first) && rest.length > 0)
|
|
113
|
+
candidates.push(`src/${rest.join('/')}`);
|
|
114
|
+
for (const c of candidates) {
|
|
115
|
+
for (const e of sourceExtensionsFor(ext)) {
|
|
116
|
+
const rel = c + e;
|
|
117
|
+
if (existsSync(nodePath.join(packageRoot, rel)))
|
|
118
|
+
return rel;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
/** The compiled contributions of a pack and their mapped sources. */
|
|
124
|
+
function compiledArtifacts(packageRoot, files) {
|
|
125
|
+
return files
|
|
126
|
+
.filter((f) => COMPILED_EXT.test(f))
|
|
127
|
+
.map((artifact) => ({ artifact, source: mapCompiledSource(packageRoot, artifact) }));
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The digest the artifact's source map recorded for `sourceRel` at build time
|
|
131
|
+
* (`sourcesContent`), or null when there is no map or it carries no content.
|
|
132
|
+
*/
|
|
133
|
+
function sourceMapRecordedDigest(packageRoot, artifactRel, sourceRel) {
|
|
134
|
+
const artifactAbs = nodePath.join(packageRoot, artifactRel);
|
|
135
|
+
let text;
|
|
136
|
+
try {
|
|
137
|
+
text = readFileSync(artifactAbs, 'utf8');
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
let map = null;
|
|
143
|
+
let mapDir = nodePath.dirname(artifactAbs);
|
|
144
|
+
const urlMatch = /\/\/[#@]\s*sourceMappingURL=(\S+)\s*$/m.exec(text.slice(-4096));
|
|
145
|
+
const url = urlMatch?.[1];
|
|
146
|
+
try {
|
|
147
|
+
if (url && url.startsWith('data:')) {
|
|
148
|
+
const b64 = url.slice(url.indexOf(',') + 1);
|
|
149
|
+
map = JSON.parse(Buffer.from(b64, 'base64').toString('utf8'));
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
const mapAbs = url ? nodePath.resolve(mapDir, url) : `${artifactAbs}.map`;
|
|
153
|
+
if (existsSync(mapAbs)) {
|
|
154
|
+
map = JSON.parse(readFileSync(mapAbs, 'utf8'));
|
|
155
|
+
mapDir = nodePath.dirname(mapAbs);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
map = null;
|
|
161
|
+
}
|
|
162
|
+
if (!map || !Array.isArray(map.sources) || !Array.isArray(map.sourcesContent))
|
|
163
|
+
return null;
|
|
164
|
+
const sourceAbs = nodePath.join(packageRoot, sourceRel);
|
|
165
|
+
const root = typeof map.sourceRoot === 'string' ? map.sourceRoot : '';
|
|
166
|
+
for (let i = 0; i < map.sources.length; i += 1) {
|
|
167
|
+
const s = map.sources[i];
|
|
168
|
+
const content = map.sourcesContent[i];
|
|
169
|
+
if (typeof s !== 'string' || typeof content !== 'string')
|
|
170
|
+
continue;
|
|
171
|
+
const cleaned = s.replace(/^(?:file|webpack):\/+/, s.startsWith('file://') ? '/' : '');
|
|
172
|
+
if (nodePath.resolve(mapDir, root, cleaned) === sourceAbs)
|
|
173
|
+
return packContentDigest(content);
|
|
174
|
+
}
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The content record `shrk packs sign` stores on the signature: every
|
|
179
|
+
* contribution file plus each compiled artifact's mapped source. The SAME
|
|
180
|
+
* enumeration {@link detectPackAssetFreshness} compares against — one function
|
|
181
|
+
* records, the other reads, so they cannot disagree about which files count.
|
|
182
|
+
*/
|
|
183
|
+
export function computePackContentDigests(packageRoot, manifest) {
|
|
184
|
+
const out = {};
|
|
185
|
+
const files = contributionFiles(packageRoot, manifest);
|
|
186
|
+
const tracked = new Set(files);
|
|
187
|
+
for (const a of compiledArtifacts(packageRoot, files))
|
|
188
|
+
if (a.source)
|
|
189
|
+
tracked.add(a.source);
|
|
190
|
+
for (const rel of [...tracked].sort()) {
|
|
191
|
+
const d = digestFile(nodePath.join(packageRoot, rel));
|
|
192
|
+
if (d)
|
|
193
|
+
out[rel] = d;
|
|
194
|
+
}
|
|
195
|
+
return out;
|
|
196
|
+
}
|
|
197
|
+
/** True when any contribution is a compiled `.js`/`.mjs`/`.cjs` file (cheap; no hashing). */
|
|
198
|
+
export function packHasCompiledContributions(manifest) {
|
|
199
|
+
const contributions = (manifest?.contributions ?? {});
|
|
200
|
+
for (const key of [...CONTRIBUTION_FILE_KEYS, ...FUTURE_CONTRIBUTION_FILE_KEYS]) {
|
|
201
|
+
if ((contributions[key] ?? []).some((rel) => typeof rel === 'string' && COMPILED_EXT.test(rel)))
|
|
202
|
+
return true;
|
|
203
|
+
}
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
function rebuildCommandFor(packageRoot) {
|
|
207
|
+
const pkg = readJsonTolerant(nodePath.join(packageRoot, 'package.json'));
|
|
208
|
+
const scripts = (pkg?.['scripts'] ?? {});
|
|
209
|
+
return typeof scripts['build'] === 'string' ? 'npm run build' : null;
|
|
210
|
+
}
|
|
211
|
+
/** Detect one pack's signature + build freshness from recorded content. */
|
|
212
|
+
export function detectPackAssetFreshness(pack) {
|
|
213
|
+
const { packageRoot, manifest } = pack;
|
|
214
|
+
const files = contributionFiles(packageRoot, manifest);
|
|
215
|
+
const artifacts = compiledArtifacts(packageRoot, files);
|
|
216
|
+
const current = new Map();
|
|
217
|
+
const digestOf = (rel) => {
|
|
218
|
+
if (!current.has(rel))
|
|
219
|
+
current.set(rel, digestFile(nodePath.join(packageRoot, rel)));
|
|
220
|
+
return current.get(rel) ?? null;
|
|
221
|
+
};
|
|
222
|
+
// ── signature ──
|
|
223
|
+
const sig = manifest?.signature;
|
|
224
|
+
const recorded = sig?.contentDigests ?? {};
|
|
225
|
+
const diverged = [];
|
|
226
|
+
const unrecorded = [];
|
|
227
|
+
let signatureState = 'unsigned';
|
|
228
|
+
if (sig) {
|
|
229
|
+
const checked = new Set([...files, ...artifacts.flatMap((a) => (a.source ? [a.source] : []))]);
|
|
230
|
+
for (const rel of [...checked].sort()) {
|
|
231
|
+
const was = recorded[rel];
|
|
232
|
+
if (was === undefined)
|
|
233
|
+
unrecorded.push(rel);
|
|
234
|
+
else if (digestOf(rel) !== was)
|
|
235
|
+
diverged.push(rel);
|
|
236
|
+
}
|
|
237
|
+
// A recorded file that no longer exists diverged too (deleted since signing).
|
|
238
|
+
for (const rel of Object.keys(recorded).sort()) {
|
|
239
|
+
if (!checked.has(rel) && !existsSync(nodePath.join(packageRoot, rel)))
|
|
240
|
+
diverged.push(rel);
|
|
241
|
+
}
|
|
242
|
+
signatureState = diverged.length > 0 ? 'diverged' : unrecorded.length > 0 ? 'unrecorded' : 'fresh';
|
|
243
|
+
}
|
|
244
|
+
// ── build ──
|
|
245
|
+
const artifactStates = artifacts.map((a) => {
|
|
246
|
+
if (!a.source)
|
|
247
|
+
return { artifact: a.artifact, source: null, state: 'no-source' };
|
|
248
|
+
const sourceNow = digestOf(a.source);
|
|
249
|
+
const mapRecord = sourceMapRecordedDigest(packageRoot, a.artifact, a.source);
|
|
250
|
+
if (mapRecord) {
|
|
251
|
+
return {
|
|
252
|
+
artifact: a.artifact,
|
|
253
|
+
source: a.source,
|
|
254
|
+
state: mapRecord === sourceNow ? 'fresh' : 'stale',
|
|
255
|
+
recordedBy: 'source-map',
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
const recArtifact = recorded[a.artifact];
|
|
259
|
+
const recSource = recorded[a.source];
|
|
260
|
+
if (recArtifact !== undefined && recSource !== undefined && digestOf(a.artifact) === recArtifact) {
|
|
261
|
+
// The artifact is exactly the signed build; its source must still be the signed source.
|
|
262
|
+
return {
|
|
263
|
+
artifact: a.artifact,
|
|
264
|
+
source: a.source,
|
|
265
|
+
state: sourceNow === recSource ? 'fresh' : 'stale',
|
|
266
|
+
recordedBy: 'signature',
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
return { artifact: a.artifact, source: a.source, state: 'unrecorded' };
|
|
270
|
+
});
|
|
271
|
+
const buildState = artifactStates.length === 0
|
|
272
|
+
? 'not-compiled'
|
|
273
|
+
: artifactStates.some((a) => a.state === 'stale')
|
|
274
|
+
? 'stale'
|
|
275
|
+
: artifactStates.some((a) => a.state === 'unrecorded')
|
|
276
|
+
? 'unrecorded'
|
|
277
|
+
: artifactStates.every((a) => a.state === 'no-source')
|
|
278
|
+
? 'no-source'
|
|
279
|
+
: 'fresh';
|
|
280
|
+
return {
|
|
281
|
+
packageName: pack.packageName,
|
|
282
|
+
packageRoot,
|
|
283
|
+
basis: 'content-digest',
|
|
284
|
+
signature: {
|
|
285
|
+
state: signatureState,
|
|
286
|
+
...(sig?.signedAt ? { signedAt: sig.signedAt } : {}),
|
|
287
|
+
dev: sig?.dev === true,
|
|
288
|
+
diverged,
|
|
289
|
+
unrecorded,
|
|
290
|
+
},
|
|
291
|
+
build: {
|
|
292
|
+
state: buildState,
|
|
293
|
+
artifacts: artifactStates,
|
|
294
|
+
rebuildCommand: artifactStates.length > 0 ? rebuildCommandFor(packageRoot) : null,
|
|
295
|
+
},
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
function firstWith(f, state) {
|
|
299
|
+
return f.build.artifacts.find((a) => a.state === state);
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* THE wording of a pack's freshness — every surface prints these sentences
|
|
303
|
+
* rather than composing its own. `undefined` when there is nothing to say.
|
|
304
|
+
*/
|
|
305
|
+
export function describePackAssetFreshness(f) {
|
|
306
|
+
const out = {};
|
|
307
|
+
const where = f.build.rebuildCommand ? ` — run \`${f.build.rebuildCommand}\` in ${f.packageRoot}` : '';
|
|
308
|
+
if (f.build.state === 'stale') {
|
|
309
|
+
const n = f.build.artifacts.filter((a) => a.state === 'stale').length;
|
|
310
|
+
const eg = firstWith(f, 'stale');
|
|
311
|
+
out.build =
|
|
312
|
+
`pack ${f.packageName}: ${n} compiled artifact(s) differ from their source` +
|
|
313
|
+
(eg ? ` (e.g. ${eg.artifact} was built from an older ${eg.source})` : '') +
|
|
314
|
+
` — shrk is serving the previous build${where || '; rebuild the pack'}`;
|
|
315
|
+
}
|
|
316
|
+
else if (f.build.state === 'unrecorded') {
|
|
317
|
+
const n = f.build.artifacts.filter((a) => a.state === 'unrecorded').length;
|
|
318
|
+
const eg = firstWith(f, 'unrecorded');
|
|
319
|
+
out.build =
|
|
320
|
+
`pack ${f.packageName}: ${n} compiled artifact(s)` +
|
|
321
|
+
(eg ? ` (e.g. ${eg.artifact})` : '') +
|
|
322
|
+
` have no build record, so shrk cannot tell whether they match ${eg?.source ?? 'their source'} — NOT VERIFIED. ` +
|
|
323
|
+
'Emit source maps with sourcesContent ("sourceMap": true, "inlineSources": true) or record one with `shrk packs sign`.';
|
|
324
|
+
}
|
|
325
|
+
if (f.signature.state === 'diverged') {
|
|
326
|
+
const first = f.signature.diverged[0];
|
|
327
|
+
const more = f.signature.diverged.length > 1 ? ` (+${f.signature.diverged.length - 1} more)` : '';
|
|
328
|
+
out.signature =
|
|
329
|
+
`pack ${f.packageName}: signature is stale — "${first}"${more} changed since it was signed` +
|
|
330
|
+
(f.signature.signedAt ? ` (${f.signature.signedAt})` : '');
|
|
331
|
+
}
|
|
332
|
+
else if (f.signature.state === 'unrecorded') {
|
|
333
|
+
const first = f.signature.unrecorded[0];
|
|
334
|
+
const more = f.signature.unrecorded.length > 1 ? ` (+${f.signature.unrecorded.length - 1} more)` : '';
|
|
335
|
+
out.signature =
|
|
336
|
+
`pack ${f.packageName}: signature freshness NOT verified — it records no content digest for "${first}"${more} ` +
|
|
337
|
+
'(signed before content digests existed, or the file was added since); re-sign to record one';
|
|
338
|
+
}
|
|
339
|
+
return out;
|
|
340
|
+
}
|
package/dist/pack-author-ux.d.ts
CHANGED
|
@@ -2,23 +2,42 @@
|
|
|
2
2
|
* Pack-author developer UX.
|
|
3
3
|
*
|
|
4
4
|
* - buildPackDevStatus({ packPath, consumerPath }) — what the consumer sees:
|
|
5
|
-
* source vs node_modules vs symlink,
|
|
6
|
-
*
|
|
5
|
+
* source vs node_modules vs symlink, signature + compiled-build freshness
|
|
6
|
+
* (from THE pack-asset freshness authority — content digests, never mtimes),
|
|
7
|
+
* and the contribution FILES the manifest declares.
|
|
7
8
|
* - planPackWatchCommand({ packPath, command }) — pure helper that returns
|
|
8
9
|
* the resolved watch command and the file globs to observe (no spawning
|
|
9
10
|
* happens here — the CLI command spawns the child).
|
|
10
11
|
*/
|
|
12
|
+
import { type IPackAssetFreshness } from './pack-asset-freshness.js';
|
|
11
13
|
export interface IPackDevStatus {
|
|
12
14
|
schema: 'sharkcraft.pack-dev-status/v1';
|
|
13
15
|
packPath: string;
|
|
14
16
|
consumerPath?: string | undefined;
|
|
15
17
|
packExists: boolean;
|
|
18
|
+
/** The manifest `package.json` `sharkcraft.manifest` points at. */
|
|
16
19
|
manifestPath: string | null;
|
|
20
|
+
/** The signed manifest (`<manifest>.signed.json`, as `packs sign` writes it), when present. */
|
|
17
21
|
signedManifestPath: string | null;
|
|
18
22
|
packVersion: string | null;
|
|
19
23
|
consumerSeesPackFrom: 'source' | 'node_modules' | 'symlink' | 'not-installed' | 'self';
|
|
24
|
+
/**
|
|
25
|
+
* Signature freshness from the one authority: `stale` = a contribution's
|
|
26
|
+
* content changed since signing; `unknown` = the signature records no
|
|
27
|
+
* content digests (NOT verified) or the manifest could not be read.
|
|
28
|
+
*/
|
|
20
29
|
signatureStaleness: 'fresh' | 'stale' | 'missing' | 'unknown';
|
|
30
|
+
/** Pack-relative files whose content changed since signing. */
|
|
21
31
|
staleAssets: ReadonlyArray<string>;
|
|
32
|
+
/** Compiled-artifact freshness (`dist/*.js` vs its source) from the one authority. */
|
|
33
|
+
buildStaleness: IPackAssetFreshness['build']['state'] | 'unknown';
|
|
34
|
+
/** Compiled artifacts built from an older source. */
|
|
35
|
+
staleArtifacts: ReadonlyArray<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Declared contribution FILES per kind, read from the manifest
|
|
38
|
+
* (`countContributions`) — never a regex count of array entries, which used
|
|
39
|
+
* to split the default-export text on commas and report nonsense.
|
|
40
|
+
*/
|
|
22
41
|
contributionCounts: Readonly<{
|
|
23
42
|
rules: number;
|
|
24
43
|
paths: number;
|
|
@@ -31,13 +50,15 @@ export interface IPackDevStatus {
|
|
|
31
50
|
constructs: number;
|
|
32
51
|
docsFiles: number;
|
|
33
52
|
}>;
|
|
53
|
+
/** The full freshness record (null when the manifest could not be read). */
|
|
54
|
+
freshness: IPackAssetFreshness | null;
|
|
34
55
|
warnings: ReadonlyArray<string>;
|
|
35
56
|
nextCommandHint: string;
|
|
36
57
|
}
|
|
37
58
|
export declare function buildPackDevStatus(input: {
|
|
38
59
|
packPath: string;
|
|
39
60
|
consumerPath?: string;
|
|
40
|
-
}): IPackDevStatus
|
|
61
|
+
}): Promise<IPackDevStatus>;
|
|
41
62
|
export interface IPackWatchPlan {
|
|
42
63
|
schema: 'sharkcraft.pack-watch-plan/v1';
|
|
43
64
|
packPath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack-author-ux.d.ts","sourceRoot":"","sources":["../src/pack-author-ux.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pack-author-ux.d.ts","sourceRoot":"","sources":["../src/pack-author-ux.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,2BAA2B,CAAC;AAGnC,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,+BAA+B,CAAC;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,mEAAmE;IACnE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,+FAA+F;IAC/F,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,oBAAoB,EAAE,QAAQ,GAAG,cAAc,GAAG,SAAS,GAAG,eAAe,GAAG,MAAM,CAAC;IACvF;;;;OAIG;IACH,kBAAkB,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;IAC9D,+DAA+D;IAC/D,WAAW,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACnC,sFAAsF;IACtF,cAAc,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;IAClE,qDAAqD;IACrD,cAAc,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACtC;;;;OAIG;IACH,kBAAkB,EAAE,QAAQ,CAAC;QAC3B,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC;IACH,4EAA4E;IAC5E,SAAS,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACtC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAChC,eAAe,EAAE,MAAM,CAAC;CACzB;AAwDD,wBAAsB,kBAAkB,CAAC,KAAK,EAAE;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,cAAc,CAAC,CA+F1B;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,+BAA+B,CAAC;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5B,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC;CACjB;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,cAAc,CAYjB;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CA8BtE"}
|
package/dist/pack-author-ux.js
CHANGED
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
* Pack-author developer UX.
|
|
3
3
|
*
|
|
4
4
|
* - buildPackDevStatus({ packPath, consumerPath }) — what the consumer sees:
|
|
5
|
-
* source vs node_modules vs symlink,
|
|
6
|
-
*
|
|
5
|
+
* source vs node_modules vs symlink, signature + compiled-build freshness
|
|
6
|
+
* (from THE pack-asset freshness authority — content digests, never mtimes),
|
|
7
|
+
* and the contribution FILES the manifest declares.
|
|
7
8
|
* - planPackWatchCommand({ packPath, command }) — pure helper that returns
|
|
8
9
|
* the resolved watch command and the file globs to observe (no spawning
|
|
9
10
|
* happens here — the CLI command spawns the child).
|
|
10
11
|
*/
|
|
11
|
-
import { existsSync, lstatSync,
|
|
12
|
-
import {
|
|
12
|
+
import { existsSync, lstatSync, readFileSync } from 'node:fs';
|
|
13
|
+
import { basename, join, resolve } from 'node:path';
|
|
14
|
+
import { countContributions } from '@shrkcrft/packs';
|
|
15
|
+
import { describePackAssetFreshness, detectPackAssetFreshness, } from "./pack-asset-freshness.js";
|
|
16
|
+
import { readPackManifest } from "./pack-manifest-reader.js";
|
|
13
17
|
const WATCHED_GLOBS = Object.freeze([
|
|
14
18
|
'src/assets/**/*.ts',
|
|
15
19
|
'package.json',
|
|
@@ -18,6 +22,18 @@ const WATCHED_GLOBS = Object.freeze([
|
|
|
18
22
|
'README.md',
|
|
19
23
|
'SECURITY.md',
|
|
20
24
|
]);
|
|
25
|
+
const ZERO_COUNTS = Object.freeze({
|
|
26
|
+
rules: 0,
|
|
27
|
+
paths: 0,
|
|
28
|
+
templates: 0,
|
|
29
|
+
pipelines: 0,
|
|
30
|
+
presets: 0,
|
|
31
|
+
boundaries: 0,
|
|
32
|
+
knowledge: 0,
|
|
33
|
+
playbooks: 0,
|
|
34
|
+
constructs: 0,
|
|
35
|
+
docsFiles: 0,
|
|
36
|
+
});
|
|
21
37
|
function readJsonSafe(p) {
|
|
22
38
|
try {
|
|
23
39
|
return JSON.parse(readFileSync(p, 'utf8'));
|
|
@@ -26,41 +42,6 @@ function readJsonSafe(p) {
|
|
|
26
42
|
return null;
|
|
27
43
|
}
|
|
28
44
|
}
|
|
29
|
-
function countTsExports(absFile) {
|
|
30
|
-
if (!existsSync(absFile))
|
|
31
|
-
return 0;
|
|
32
|
-
const txt = readFileSync(absFile, 'utf8');
|
|
33
|
-
// Count default array entries: lines like ` pluginContract,` at brace depth 1.
|
|
34
|
-
const m = txt.match(/^export default \[([\s\S]*?)\];/m);
|
|
35
|
-
if (m && m[1]) {
|
|
36
|
-
return m[1].split(',').filter((s) => s.trim().length > 0).length;
|
|
37
|
-
}
|
|
38
|
-
// Fallback: count named exports.
|
|
39
|
-
const named = txt.match(/^export const /gm);
|
|
40
|
-
return named ? named.length : 0;
|
|
41
|
-
}
|
|
42
|
-
function walkSourceAssetMtimes(packPath) {
|
|
43
|
-
const root = join(packPath, 'src', 'assets');
|
|
44
|
-
let newestMtimeMs = 0;
|
|
45
|
-
const out = [];
|
|
46
|
-
if (!existsSync(root))
|
|
47
|
-
return { newestMtimeMs, files: out };
|
|
48
|
-
const walk = (dir) => {
|
|
49
|
-
for (const e of readdirSync(dir, { withFileTypes: true })) {
|
|
50
|
-
const p = join(dir, e.name);
|
|
51
|
-
if (e.isDirectory())
|
|
52
|
-
walk(p);
|
|
53
|
-
else if (e.isFile() && e.name.endsWith('.ts')) {
|
|
54
|
-
const st = statSync(p);
|
|
55
|
-
out.push(p);
|
|
56
|
-
if (st.mtimeMs > newestMtimeMs)
|
|
57
|
-
newestMtimeMs = st.mtimeMs;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
walk(root);
|
|
62
|
-
return { newestMtimeMs, files: out };
|
|
63
|
-
}
|
|
64
45
|
function detectConsumerSource(packPath, consumerPath) {
|
|
65
46
|
// Read consumer package.json to find pack name.
|
|
66
47
|
const pkgPath = join(packPath, 'package.json');
|
|
@@ -86,7 +67,7 @@ function detectConsumerSource(packPath, consumerPath) {
|
|
|
86
67
|
return 'self';
|
|
87
68
|
return 'source';
|
|
88
69
|
}
|
|
89
|
-
export function buildPackDevStatus(input) {
|
|
70
|
+
export async function buildPackDevStatus(input) {
|
|
90
71
|
const { packPath } = input;
|
|
91
72
|
const warnings = [];
|
|
92
73
|
if (!existsSync(packPath)) {
|
|
@@ -100,79 +81,86 @@ export function buildPackDevStatus(input) {
|
|
|
100
81
|
consumerSeesPackFrom: 'not-installed',
|
|
101
82
|
signatureStaleness: 'unknown',
|
|
102
83
|
staleAssets: [],
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
pipelines: 0,
|
|
108
|
-
presets: 0,
|
|
109
|
-
boundaries: 0,
|
|
110
|
-
knowledge: 0,
|
|
111
|
-
playbooks: 0,
|
|
112
|
-
constructs: 0,
|
|
113
|
-
docsFiles: 0,
|
|
114
|
-
},
|
|
84
|
+
buildStaleness: 'unknown',
|
|
85
|
+
staleArtifacts: [],
|
|
86
|
+
contributionCounts: ZERO_COUNTS,
|
|
87
|
+
freshness: null,
|
|
115
88
|
warnings: [`Pack path does not exist: ${packPath}`],
|
|
116
89
|
nextCommandHint: 'shrk packs new <name>',
|
|
117
90
|
};
|
|
118
91
|
}
|
|
119
|
-
const manifestPath = join(packPath, 'manifest.json');
|
|
120
|
-
const signedManifestPath = join(packPath, 'sharkcraft.plugin.signed.json');
|
|
121
92
|
const pkg = readJsonSafe(join(packPath, 'package.json'));
|
|
93
|
+
const loaded = await readPackManifest(packPath);
|
|
94
|
+
const { manifestPath, signedManifestPath } = loaded;
|
|
95
|
+
if (loaded.error)
|
|
96
|
+
warnings.push(`Cannot read the pack manifest: ${loaded.error}. Freshness NOT verified.`);
|
|
97
|
+
const manifest = loaded.manifest;
|
|
98
|
+
const c = countContributions(manifest?.contributions);
|
|
122
99
|
const contributionCounts = {
|
|
123
|
-
rules:
|
|
124
|
-
paths:
|
|
125
|
-
templates:
|
|
126
|
-
pipelines:
|
|
127
|
-
presets:
|
|
128
|
-
boundaries:
|
|
129
|
-
knowledge:
|
|
130
|
-
playbooks:
|
|
131
|
-
constructs:
|
|
132
|
-
docsFiles: 0,
|
|
100
|
+
rules: c['ruleFiles'] ?? 0,
|
|
101
|
+
paths: (c['pathFiles'] ?? 0) + (c['pathConventionFiles'] ?? 0),
|
|
102
|
+
templates: c['templateFiles'] ?? 0,
|
|
103
|
+
pipelines: c['pipelineFiles'] ?? 0,
|
|
104
|
+
presets: c['presetFiles'] ?? 0,
|
|
105
|
+
boundaries: c['boundaryFiles'] ?? 0,
|
|
106
|
+
knowledge: c['knowledgeFiles'] ?? 0,
|
|
107
|
+
playbooks: c['playbookFiles'] ?? 0,
|
|
108
|
+
constructs: c['constructFiles'] ?? 0,
|
|
109
|
+
docsFiles: c['docsFiles'] ?? 0,
|
|
133
110
|
};
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
111
|
+
const freshness = manifest
|
|
112
|
+
? detectPackAssetFreshness({ packageName: pkg?.name ?? basename(packPath), packageRoot: packPath, manifest })
|
|
113
|
+
: null;
|
|
114
|
+
const signatureStaleness = !freshness
|
|
115
|
+
? 'unknown'
|
|
116
|
+
: freshness.signature.state === 'unsigned'
|
|
117
|
+
? 'missing'
|
|
118
|
+
: freshness.signature.state === 'diverged'
|
|
119
|
+
? 'stale'
|
|
120
|
+
: freshness.signature.state === 'unrecorded'
|
|
121
|
+
? 'unknown'
|
|
122
|
+
: 'fresh';
|
|
123
|
+
if (freshness) {
|
|
124
|
+
const said = describePackAssetFreshness(freshness);
|
|
125
|
+
if (said.signature)
|
|
126
|
+
warnings.push(said.signature);
|
|
127
|
+
if (said.build)
|
|
128
|
+
warnings.push(said.build);
|
|
129
|
+
if (freshness.signature.state === 'unsigned') {
|
|
130
|
+
warnings.push('No signed manifest found. Run `shrk packs sign` before publishing.');
|
|
147
131
|
}
|
|
148
|
-
else {
|
|
149
|
-
signatureStaleness = 'fresh';
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
signatureStaleness = 'missing';
|
|
154
|
-
warnings.push('No signed manifest found. Run `shrk packs sign` before publishing.');
|
|
155
132
|
}
|
|
133
|
+
const staleArtifacts = freshness
|
|
134
|
+
? freshness.build.artifacts.filter((a) => a.state === 'stale').map((a) => a.artifact)
|
|
135
|
+
: [];
|
|
156
136
|
const consumerPath = input.consumerPath ? resolve(input.consumerPath) : undefined;
|
|
157
137
|
const consumerSeesPackFrom = consumerPath
|
|
158
138
|
? detectConsumerSource(packPath, consumerPath)
|
|
159
139
|
: 'not-installed';
|
|
140
|
+
const nextCommandHint = freshness?.build.state === 'stale'
|
|
141
|
+
? freshness.build.rebuildCommand
|
|
142
|
+
? `(cd ${packPath} && ${freshness.build.rebuildCommand})`
|
|
143
|
+
: `rebuild ${packPath}`
|
|
144
|
+
: signatureStaleness === 'stale' || signatureStaleness === 'unknown'
|
|
145
|
+
? `shrk packs sign ${packPath}`
|
|
146
|
+
: `shrk packs doctor --release --cwd ${packPath}`;
|
|
160
147
|
return {
|
|
161
148
|
schema: 'sharkcraft.pack-dev-status/v1',
|
|
162
149
|
packPath,
|
|
163
150
|
consumerPath: consumerPath ?? undefined,
|
|
164
151
|
packExists: true,
|
|
165
|
-
manifestPath
|
|
166
|
-
signedManifestPath
|
|
152
|
+
manifestPath,
|
|
153
|
+
signedManifestPath,
|
|
167
154
|
packVersion: pkg?.version ?? null,
|
|
168
155
|
consumerSeesPackFrom,
|
|
169
156
|
signatureStaleness,
|
|
170
|
-
staleAssets,
|
|
157
|
+
staleAssets: freshness?.signature.diverged ?? [],
|
|
158
|
+
buildStaleness: freshness?.build.state ?? 'unknown',
|
|
159
|
+
staleArtifacts,
|
|
171
160
|
contributionCounts,
|
|
161
|
+
freshness,
|
|
172
162
|
warnings,
|
|
173
|
-
nextCommandHint
|
|
174
|
-
? `shrk packs sign --pack ${packPath.split(sep).pop()}`
|
|
175
|
-
: `shrk packs doctor --release --cwd ${packPath}`,
|
|
163
|
+
nextCommandHint,
|
|
176
164
|
};
|
|
177
165
|
}
|
|
178
166
|
export function planPackWatchCommand(input) {
|
|
@@ -196,14 +184,20 @@ export function renderPackDevStatusText(status) {
|
|
|
196
184
|
lines.push(` consumer ${status.consumerPath}`);
|
|
197
185
|
lines.push(` version ${status.packVersion ?? '(unknown)'}`);
|
|
198
186
|
lines.push(` seen as ${status.consumerSeesPackFrom}`);
|
|
199
|
-
lines.push(` signature ${status.signatureStaleness}`);
|
|
187
|
+
lines.push(` signature ${status.signatureStaleness}${status.signatureStaleness === 'unknown' ? ' (NOT verified)' : ''}`);
|
|
200
188
|
if (status.staleAssets.length > 0) {
|
|
201
|
-
lines.push(`
|
|
189
|
+
lines.push(` changed since signing ${status.staleAssets.length}`);
|
|
202
190
|
for (const a of status.staleAssets.slice(0, 8))
|
|
203
191
|
lines.push(` • ${a}`);
|
|
204
192
|
}
|
|
193
|
+
lines.push(` build ${status.buildStaleness}${status.buildStaleness === 'unrecorded' ? ' (NOT verified)' : ''}`);
|
|
194
|
+
if (status.staleArtifacts.length > 0) {
|
|
195
|
+
lines.push(` stale artifacts ${status.staleArtifacts.length}`);
|
|
196
|
+
for (const a of status.staleArtifacts.slice(0, 8))
|
|
197
|
+
lines.push(` • ${a}`);
|
|
198
|
+
}
|
|
205
199
|
lines.push('');
|
|
206
|
-
lines.push('
|
|
200
|
+
lines.push('Contribution files (declared in the manifest):');
|
|
207
201
|
for (const [k, v] of Object.entries(status.contributionCounts)) {
|
|
208
202
|
lines.push(` ${k.padEnd(12)} ${v}`);
|
|
209
203
|
}
|