kibi-cli 2.4.0 → 2.5.1
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/cli-json-command.d.ts +6 -0
- package/dist/cli-json-command.d.ts.map +1 -1
- package/dist/cli-json-command.js +37 -9
- package/dist/cli-operation-loader.d.ts.map +1 -1
- package/dist/cli-operation-loader.js +7 -0
- package/dist/cli-operation-metadata.d.ts +12 -4
- package/dist/cli-operation-metadata.d.ts.map +1 -1
- package/dist/cli-operation-metadata.js +14 -4
- package/dist/cli-protocol.d.ts +14 -0
- package/dist/cli-protocol.d.ts.map +1 -1
- package/dist/cli-protocol.js +31 -2
- package/dist/cli-register-proof.d.ts.map +1 -1
- package/dist/cli-register-proof.js +13 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +11 -2
- package/dist/commands/discovery-shared.d.ts.map +1 -1
- package/dist/commands/discovery-shared.js +8 -2
- package/dist/commands/engine.d.ts.map +1 -1
- package/dist/commands/engine.js +4 -2
- package/dist/commands/gc.d.ts.map +1 -1
- package/dist/commands/gc.js +7 -0
- package/dist/commands/init-helpers.d.ts.map +1 -1
- package/dist/commands/init-helpers.js +38 -12
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +10 -15
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +281 -14
- package/dist/commands/proof-compact.d.ts +9 -0
- package/dist/commands/proof-compact.d.ts.map +1 -0
- package/dist/commands/proof-compact.js +58 -0
- package/dist/commands/prove.d.ts +38 -0
- package/dist/commands/prove.d.ts.map +1 -1
- package/dist/commands/prove.js +222 -47
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +61 -16
- package/dist/commands/sync.d.ts +8 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +42 -16
- package/dist/diagnostics.js +1 -1
- package/dist/engine-limits.d.ts +74 -0
- package/dist/engine-limits.d.ts.map +1 -0
- package/dist/engine-limits.js +201 -0
- package/dist/engine.d.ts +10 -0
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +57 -9
- package/dist/extractors/manifest.d.ts +8 -0
- package/dist/extractors/manifest.d.ts.map +1 -1
- package/dist/extractors/manifest.js +34 -5
- package/dist/extractors/markdown.d.ts +8 -0
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +57 -0
- package/dist/extractors/relationships.d.ts.map +1 -1
- package/dist/extractors/relationships.js +2 -0
- package/dist/intent-search.d.ts +4 -1
- package/dist/intent-search.d.ts.map +1 -1
- package/dist/intent-search.js +186 -33
- package/dist/operations/bootstrap/candidate-helpers.d.ts.map +1 -1
- package/dist/operations/bootstrap/candidate-helpers.js +8 -1
- package/dist/operations/bootstrap/candidates.d.ts.map +1 -1
- package/dist/operations/bootstrap/candidates.js +54 -38
- package/dist/operations/bootstrap/generate.d.ts +2 -0
- package/dist/operations/bootstrap/generate.d.ts.map +1 -1
- package/dist/operations/bootstrap/generate.js +87 -33
- package/dist/operations/bootstrap/intent-claims.d.ts.map +1 -1
- package/dist/operations/bootstrap/intent-claims.js +12 -4
- package/dist/operations/bootstrap/markdown-candidates.d.ts +2 -0
- package/dist/operations/bootstrap/markdown-candidates.d.ts.map +1 -1
- package/dist/operations/bootstrap/markdown-candidates.js +32 -10
- package/dist/operations/bootstrap/presentation.d.ts.map +1 -1
- package/dist/operations/bootstrap/presentation.js +6 -2
- package/dist/operations/bootstrap/requirement-claims.d.ts +1 -0
- package/dist/operations/bootstrap/requirement-claims.d.ts.map +1 -1
- package/dist/operations/bootstrap/requirement-claims.js +13 -1
- package/dist/operations/bootstrap/validation.d.ts +4 -0
- package/dist/operations/bootstrap/validation.d.ts.map +1 -0
- package/dist/operations/bootstrap/validation.js +20 -0
- package/dist/operations/migration/inventory-rederive.d.ts +81 -0
- package/dist/operations/migration/inventory-rederive.d.ts.map +1 -0
- package/dist/operations/migration/inventory-rederive.js +484 -0
- package/dist/operations/migration/kb-sources.d.ts +53 -0
- package/dist/operations/migration/kb-sources.d.ts.map +1 -0
- package/dist/operations/migration/kb-sources.js +233 -0
- package/dist/operations/migration/origin-backfill.d.ts +39 -0
- package/dist/operations/migration/origin-backfill.d.ts.map +1 -0
- package/dist/operations/migration/origin-backfill.js +164 -0
- package/dist/operations/migration/polarity-values.d.ts +10 -0
- package/dist/operations/migration/polarity-values.d.ts.map +1 -0
- package/dist/operations/migration/polarity-values.js +60 -0
- package/dist/operations/migration/schema6.d.ts +59 -0
- package/dist/operations/migration/schema6.d.ts.map +1 -0
- package/dist/operations/migration/schema6.js +379 -0
- package/dist/operations/migration/source-paths.d.ts +131 -0
- package/dist/operations/migration/source-paths.d.ts.map +1 -0
- package/dist/operations/migration/source-paths.js +308 -0
- package/dist/operations/migration/superseded-closure.d.ts +54 -0
- package/dist/operations/migration/superseded-closure.d.ts.map +1 -0
- package/dist/operations/migration/superseded-closure.js +187 -0
- package/dist/operations/modeling/logic-modeling.d.ts.map +1 -1
- package/dist/operations/modeling/logic-modeling.js +3 -5
- package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
- package/dist/operations/modeling/model-requirement.js +225 -67
- package/dist/operations/mutation/contradictions.d.ts +16 -0
- package/dist/operations/mutation/contradictions.d.ts.map +1 -1
- package/dist/operations/mutation/contradictions.js +32 -0
- package/dist/operations/mutation/delete.d.ts.map +1 -1
- package/dist/operations/mutation/delete.js +15 -7
- package/dist/operations/mutation/origin.d.ts +21 -0
- package/dist/operations/mutation/origin.d.ts.map +1 -0
- package/dist/operations/mutation/origin.js +78 -0
- package/dist/operations/mutation/plan-apply-journal.d.ts +182 -0
- package/dist/operations/mutation/plan-apply-journal.d.ts.map +1 -0
- package/dist/operations/mutation/plan-apply-journal.js +613 -0
- package/dist/operations/mutation/predicate-vocabulary-guard.d.ts +3 -1
- package/dist/operations/mutation/predicate-vocabulary-guard.d.ts.map +1 -1
- package/dist/operations/mutation/predicate-vocabulary-guard.js +13 -2
- package/dist/operations/mutation/relationships.d.ts +5 -5
- package/dist/operations/mutation/relationships.d.ts.map +1 -1
- package/dist/operations/mutation/relationships.js +31 -11
- package/dist/operations/mutation/serialization.d.ts.map +1 -1
- package/dist/operations/mutation/serialization.js +3 -1
- package/dist/operations/mutation/source-authoring.d.ts +6 -0
- package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
- package/dist/operations/mutation/source-authoring.js +7 -1
- package/dist/operations/mutation/types.d.ts +14 -0
- package/dist/operations/mutation/types.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.d.ts +30 -3
- package/dist/operations/mutation/upsert.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.js +105 -35
- package/dist/operations/mutation/validate-upsert.d.ts +6 -0
- package/dist/operations/mutation/validate-upsert.d.ts.map +1 -1
- package/dist/operations/mutation/validate-upsert.js +34 -30
- package/dist/operations/planning/apply-plan.d.ts.map +1 -1
- package/dist/operations/planning/apply-plan.js +753 -145
- package/dist/operations/planning/compile-intent.d.ts +34 -1
- package/dist/operations/planning/compile-intent.d.ts.map +1 -1
- package/dist/operations/planning/compile-intent.js +314 -98
- package/dist/operations/proof/code-scope.d.ts +28 -0
- package/dist/operations/proof/code-scope.d.ts.map +1 -1
- package/dist/operations/proof/code-scope.js +72 -0
- package/dist/operations/proof/compact-receipts.d.ts +49 -0
- package/dist/operations/proof/compact-receipts.d.ts.map +1 -0
- package/dist/operations/proof/compact-receipts.js +160 -0
- package/dist/operations/proof/ingest-proof.d.ts +2 -0
- package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
- package/dist/operations/proof/ingest-proof.js +44 -23
- package/dist/operations/proof/prune-receipts.d.ts.map +1 -1
- package/dist/operations/proof/prune-receipts.js +5 -9
- package/dist/operations/proof/receipt-compaction.d.ts +48 -0
- package/dist/operations/proof/receipt-compaction.d.ts.map +1 -0
- package/dist/operations/proof/receipt-compaction.js +121 -0
- package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analysis-receipt.js +12 -1
- package/dist/operations/semantic-advisor/analyze-prose.d.ts +2 -1
- package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analyze-prose.js +51 -5
- package/dist/operations/semantic-advisor/clauses.d.ts +1 -0
- package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/clauses.js +11 -1
- package/dist/operations/semantic-advisor/conditional-rules.d.ts +33 -0
- package/dist/operations/semantic-advisor/conditional-rules.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/conditional-rules.js +262 -0
- package/dist/operations/semantic-advisor/ingestion-boundary.d.ts +3 -1
- package/dist/operations/semantic-advisor/ingestion-boundary.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/ingestion-boundary.js +14 -6
- package/dist/operations/semantic-advisor/plugin-orchestration.js +1 -1
- package/dist/prolog/codec.d.ts.map +1 -1
- package/dist/prolog/codec.js +2 -1
- package/dist/prolog.d.ts +9 -0
- package/dist/prolog.d.ts.map +1 -1
- package/dist/prolog.js +56 -10
- package/dist/proof/command-test-report.d.ts +74 -0
- package/dist/proof/command-test-report.d.ts.map +1 -0
- package/dist/proof/command-test-report.js +206 -0
- package/dist/public/branch-resolver.d.ts +1 -0
- package/dist/public/branch-resolver.d.ts.map +1 -1
- package/dist/public/branch-resolver.js +1 -0
- package/dist/public/entity-origin.d.ts +69 -0
- package/dist/public/entity-origin.d.ts.map +1 -0
- package/dist/public/entity-origin.js +142 -0
- package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
- package/dist/public/impact/full-kb-quality.js +1 -0
- package/dist/public/impact/requirement-quality.js +1 -1
- package/dist/public/operations/catalog.d.ts +130 -19
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/catalog.js +3 -0
- package/dist/public/operations/check-executor.d.ts.map +1 -1
- package/dist/public/operations/check-executor.js +8 -0
- package/dist/public/operations/contracts.d.ts +0 -5
- package/dist/public/operations/contracts.d.ts.map +1 -1
- package/dist/public/operations/contracts.js +63 -14
- package/dist/public/operations/discovery-entities.d.ts +15 -0
- package/dist/public/operations/discovery-entities.d.ts.map +1 -1
- package/dist/public/operations/discovery-entities.js +59 -0
- package/dist/public/operations/discovery-executors.d.ts +6 -1
- package/dist/public/operations/discovery-executors.d.ts.map +1 -1
- package/dist/public/operations/discovery-executors.js +65 -6
- package/dist/public/operations/index.d.ts +1 -0
- package/dist/public/operations/index.d.ts.map +1 -1
- package/dist/public/operations/index.js +1 -0
- package/dist/public/operations/migration-plan.d.ts +5 -0
- package/dist/public/operations/migration-plan.d.ts.map +1 -1
- package/dist/public/operations/migration-plan.js +26 -1
- package/dist/public/operations/node-ports.d.ts.map +1 -1
- package/dist/public/operations/node-ports.js +24 -3
- package/dist/public/operations/origin-review.d.ts +51 -0
- package/dist/public/operations/origin-review.d.ts.map +1 -0
- package/dist/public/operations/origin-review.js +307 -0
- package/dist/public/operations/predicate-schema-conformance.js +1 -1
- package/dist/public/operations/repair-plan.d.ts.map +1 -1
- package/dist/public/operations/repair-plan.js +4 -0
- package/dist/public/operations/result-envelope.d.ts.map +1 -1
- package/dist/public/operations/result-envelope.js +17 -5
- package/dist/public/operations/runtime-types.d.ts +9 -0
- package/dist/public/operations/runtime-types.d.ts.map +1 -1
- package/dist/public/operations/schema6-check-actions.d.ts +127 -0
- package/dist/public/operations/schema6-check-actions.d.ts.map +1 -0
- package/dist/public/operations/schema6-check-actions.js +575 -0
- package/dist/public/operations/source-path-dangling.d.ts +17 -0
- package/dist/public/operations/source-path-dangling.d.ts.map +1 -0
- package/dist/public/operations/source-path-dangling.js +66 -0
- package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
- package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
- package/dist/public/operations/specs/check-rules.generated.js +15 -1
- package/dist/public/operations/specs/check.d.ts +2 -2
- package/dist/public/operations/specs/check.js +1 -1
- package/dist/public/operations/specs/composite.d.ts +351 -0
- package/dist/public/operations/specs/composite.d.ts.map +1 -0
- package/dist/public/operations/specs/composite.js +96 -0
- package/dist/public/operations/specs/discovery.d.ts +8 -3
- package/dist/public/operations/specs/discovery.d.ts.map +1 -1
- package/dist/public/operations/specs/discovery.js +8 -3
- package/dist/public/operations/specs/modeling.d.ts +2 -2
- package/dist/public/operations/specs/modeling.js +2 -2
- package/dist/public/operations/specs/mutation-schemas.d.ts +73 -8
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
- package/dist/public/operations/specs/mutation-schemas.js +43 -7
- package/dist/public/operations/specs/mutation.d.ts +1 -1
- package/dist/public/operations/specs/mutation.js +1 -1
- package/dist/public/operations/specs/planning.d.ts +2 -2
- package/dist/public/operations/specs/planning.js +4 -4
- package/dist/public/operations/specs/reporting.d.ts.map +1 -1
- package/dist/public/operations/specs/reporting.js +13 -26
- package/dist/public/operations/specs/upsert.d.ts +79 -9
- package/dist/public/operations/specs/upsert.d.ts.map +1 -1
- package/dist/public/operations/specs/upsert.js +6 -1
- package/dist/public/operations/types.d.ts +1 -1
- package/dist/public/operations/types.d.ts.map +1 -1
- package/dist/public/proof-receipt.d.ts +1 -0
- package/dist/public/proof-receipt.d.ts.map +1 -1
- package/dist/public/schemas/entity.d.ts.map +1 -1
- package/dist/public/schemas/entity.js +52 -0
- package/dist/public/schemas/relationship.d.ts.map +1 -1
- package/dist/public/schemas/relationship.js +2 -0
- package/dist/public/skills/kibi-bootstrap/SKILL.md +35 -67
- package/dist/public/skills/kibi-bootstrap/resources/bootstrap.md +6 -0
- package/dist/public/skills/kibi-usage/SKILL.md +68 -18
- package/dist/public/skills/kibi-usage/resources/fact-lanes.md +5 -5
- package/dist/public/skills/kibi-usage/resources/kb-improvement.md +1 -1
- package/dist/public/skills/kibi-usage/resources/logic-ir.md +2 -2
- package/dist/public/skills/kibi-usage/resources/operation-access.md +25 -1
- package/dist/public/skills/kibi-usage/resources/ui-requirements.md +4 -4
- package/dist/public/skills/kibi-usage/resources/workflows.md +42 -25
- package/dist/public/telemetry-acceptance.d.ts +58 -2
- package/dist/public/telemetry-acceptance.d.ts.map +1 -1
- package/dist/public/telemetry-acceptance.js +136 -10
- package/dist/public/telemetry-remediation.d.ts.map +1 -1
- package/dist/public/telemetry-remediation.js +26 -10
- package/dist/relationships/shards.d.ts +13 -0
- package/dist/relationships/shards.d.ts.map +1 -1
- package/dist/relationships/shards.js +54 -28
- package/dist/runtime/cli-runtime.d.ts.map +1 -1
- package/dist/runtime/cli-runtime.js +44 -3
- package/dist/runtime/detached-snapshot.d.ts +38 -0
- package/dist/runtime/detached-snapshot.d.ts.map +1 -0
- package/dist/runtime/detached-snapshot.js +92 -0
- package/dist/schemas/entity.schema.json +122 -0
- package/dist/search-answer.d.ts +157 -0
- package/dist/search-answer.d.ts.map +1 -0
- package/dist/search-answer.js +846 -0
- package/dist/traceability/impact-knowledge.d.ts.map +1 -1
- package/dist/traceability/impact-knowledge.js +7 -0
- package/dist/traceability/symbol-extract.js +3 -3
- package/dist/traceability/temp-kb.d.ts.map +1 -1
- package/dist/traceability/temp-kb.js +12 -0
- package/dist/types/entities.d.ts +13 -0
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/types/relationships.d.ts +1 -1
- package/dist/types/relationships.d.ts.map +1 -1
- package/dist/utils/branch-resolver.d.ts +37 -1
- package/dist/utils/branch-resolver.d.ts.map +1 -1
- package/dist/utils/branch-resolver.js +130 -3
- package/dist/utils/repo-relative-path.d.ts +18 -0
- package/dist/utils/repo-relative-path.d.ts.map +1 -0
- package/dist/utils/repo-relative-path.js +58 -0
- package/dist/utils/rule-registry.generated.d.ts +75 -3
- package/dist/utils/rule-registry.generated.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.js +89 -3
- package/dist/utils/schema-version.d.ts +1 -1
- package/dist/utils/schema-version.d.ts.map +1 -1
- package/dist/utils/schema-version.js +4 -3
- package/dist/utils/strict-modeling.d.ts +1 -1
- package/dist/utils/strict-modeling.d.ts.map +1 -1
- package/dist/utils/strict-modeling.js +23 -3
- package/package.json +3 -3
- package/schema/entities.pl +22 -0
- package/schema/relationships.pl +14 -0
- package/schema/validation.pl +45 -1
- package/src/public/branch-resolver.ts +1 -0
- package/src/public/entity-origin.ts +175 -0
- package/src/public/impact/full-kb-quality.ts +1 -0
- package/src/public/impact/requirement-quality.ts +1 -1
- package/src/public/operations/catalog.ts +3 -0
- package/src/public/operations/check-executor.ts +15 -0
- package/src/public/operations/contracts.ts +75 -15
- package/src/public/operations/discovery-entities.ts +74 -0
- package/src/public/operations/discovery-executors.ts +88 -10
- package/src/public/operations/index.ts +1 -0
- package/src/public/operations/migration-plan.ts +30 -1
- package/src/public/operations/node-ports.ts +24 -3
- package/src/public/operations/origin-review.ts +375 -0
- package/src/public/operations/predicate-schema-conformance.ts +1 -1
- package/src/public/operations/repair-plan.ts +4 -0
- package/src/public/operations/result-envelope.ts +18 -6
- package/src/public/operations/runtime-types.ts +9 -0
- package/src/public/operations/schema6-check-actions.ts +699 -0
- package/src/public/operations/source-path-dangling.ts +81 -0
- package/src/public/operations/specs/check-rules.generated.ts +15 -1
- package/src/public/operations/specs/check.ts +1 -1
- package/src/public/operations/specs/composite.ts +141 -0
- package/src/public/operations/specs/discovery.ts +9 -3
- package/src/public/operations/specs/modeling.ts +2 -2
- package/src/public/operations/specs/mutation-schemas.ts +49 -7
- package/src/public/operations/specs/mutation.ts +1 -1
- package/src/public/operations/specs/planning.ts +4 -4
- package/src/public/operations/specs/reporting.ts +13 -38
- package/src/public/operations/specs/upsert.ts +7 -1
- package/src/public/operations/types.ts +2 -0
- package/src/public/proof-receipt.ts +1 -0
- package/src/public/schemas/entity.ts +57 -0
- package/src/public/schemas/relationship.ts +2 -0
- package/src/public/skills/kibi-bootstrap/SKILL.md +35 -67
- package/src/public/skills/kibi-bootstrap/resources/bootstrap.md +6 -0
- package/src/public/skills/kibi-usage/SKILL.md +68 -18
- package/src/public/skills/kibi-usage/resources/fact-lanes.md +5 -5
- package/src/public/skills/kibi-usage/resources/kb-improvement.md +1 -1
- package/src/public/skills/kibi-usage/resources/logic-ir.md +2 -2
- package/src/public/skills/kibi-usage/resources/operation-access.md +25 -1
- package/src/public/skills/kibi-usage/resources/ui-requirements.md +4 -4
- package/src/public/skills/kibi-usage/resources/workflows.md +42 -25
- package/src/public/telemetry-acceptance-types.d.ts +4 -1
- package/src/public/telemetry-acceptance.ts +204 -10
- package/src/public/telemetry-remediation.ts +39 -10
- package/src/schemas/entity.schema.json +122 -0
- package/src/schemas/relationship.schema.json +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impact-knowledge.d.ts","sourceRoot":"","sources":["../../src/traceability/impact-knowledge.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EACL,KAAK,WAAW,EAIjB,MAAM,oBAAoB,CAAC;AAI5B,4EAA4E;AAE5E,MAAM,MAAM,SAAS,GAAG,QAAQ,CAAC;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,WAAW,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"impact-knowledge.d.ts","sourceRoot":"","sources":["../../src/traceability/impact-knowledge.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EACL,KAAK,WAAW,EAIjB,MAAM,oBAAoB,CAAC;AAI5B,4EAA4E;AAE5E,MAAM,MAAM,SAAS,GAAG,QAAQ,CAAC;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,WAAW,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC,CAAC;AAoFH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,MAAM,EACZ,SAAS,yDAAoE,GAC5E,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAyCxB;AAGD,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,MAAM,GACX,WAAW,CAiBb;AAGD,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,GACnC,WAAW,CAoBb;AAGD,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,EACpC,cAAc,EAAE,SAAS,MAAM,EAAE,GAChC,MAAM,EAAE,CAsBV;AAeD,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,MAAM,GACX,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAiBxB"}
|
|
@@ -18,6 +18,8 @@ function semanticEntityFingerprint(result) {
|
|
|
18
18
|
"updated_at",
|
|
19
19
|
"title",
|
|
20
20
|
"proof_receipts",
|
|
21
|
+
// Provenance metadata, not authored meaning.
|
|
22
|
+
"origin",
|
|
21
23
|
].includes(key))
|
|
22
24
|
.sort(([a], [b]) => a.localeCompare(b)));
|
|
23
25
|
if (entity.type === "req") {
|
|
@@ -27,11 +29,16 @@ function semanticEntityFingerprint(result) {
|
|
|
27
29
|
semantic.text_ref = entity.text_ref;
|
|
28
30
|
else
|
|
29
31
|
semantic.semantic_text = entity.semantic_text;
|
|
32
|
+
// rationale explains why a requirement exists; it is not checked meaning,
|
|
33
|
+
// so editing it does not count as a semantic change.
|
|
30
34
|
for (const key of [
|
|
31
35
|
"semantic_clauses",
|
|
32
36
|
"logic_claims",
|
|
33
37
|
"proof_exempt",
|
|
34
38
|
"proof_exempt_reason",
|
|
39
|
+
"approved_by",
|
|
40
|
+
"approval_ref",
|
|
41
|
+
"exempts_claims",
|
|
35
42
|
"proof_contract",
|
|
36
43
|
"proof_bindings",
|
|
37
44
|
])
|
|
@@ -11,7 +11,7 @@ const REQUIREMENT_ID_PATTERN = /^[A-Za-z][A-Za-z0-9\-_]*$/;
|
|
|
11
11
|
const LOCAL_MANIFEST_NAMES = ["symbols.yaml", "symbols.yml"];
|
|
12
12
|
const MANIFEST_SENTINEL_PREFIX = "__manifest__:";
|
|
13
13
|
export function createManifestLookupSentinelKey(manifestPath) {
|
|
14
|
-
// implements REQ-
|
|
14
|
+
// implements REQ-cli-staged-impact-enforcement
|
|
15
15
|
return `${MANIFEST_SENTINEL_PREFIX}${manifestPath}`;
|
|
16
16
|
}
|
|
17
17
|
function getCandidateManifestPaths(filePath) {
|
|
@@ -164,7 +164,7 @@ function analyzeWithBuiltinFallback(filePath, content) {
|
|
|
164
164
|
return provider.analyzeText(filePath, content);
|
|
165
165
|
}
|
|
166
166
|
export function extractSymbolsFromStagedFile(
|
|
167
|
-
// implements REQ-
|
|
167
|
+
// implements REQ-cli-staged-impact-enforcement
|
|
168
168
|
stagedFile, manifestLookup, options) {
|
|
169
169
|
const content = stagedFile.content ?? "";
|
|
170
170
|
const sha = computeContentSha(`${content}|${stagedFile.path}|${options?.analyzeText ? "custom" : "builtin"}`);
|
|
@@ -260,7 +260,7 @@ function intersectingHunks(startLine, endLine, hunks) {
|
|
|
260
260
|
}
|
|
261
261
|
return out;
|
|
262
262
|
}
|
|
263
|
-
// implements REQ-
|
|
263
|
+
// implements REQ-cli-staged-impact-enforcement
|
|
264
264
|
function sourceSymbolLocator(symbol, symbols, filePath, lookup) {
|
|
265
265
|
const qualified = symbol.qualifiedName;
|
|
266
266
|
if (!qualified || qualified === symbol.name)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"temp-kb.d.ts","sourceRoot":"","sources":["../../src/traceability/temp-kb.ts"],"names":[],"mappings":"AAMA,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ,OAAO,CA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Aa,GACpE,IAAI,CAEN;AAyRD,iBAAe,cAAc,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB/D;AAED,OAAO,EAAE,cAAc,EAAE,CAAC;AAe1B,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,gBAAgB,EAAE,GAC1B,OAAO,CAAC,IAAI,CAAC,CA4Df;AAED,wBAAsB,YAAY,CAChC,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,aAAa,CAAC,CA+CxB;AAGD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,MAAM,CAkBrE;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA2BlE"}
|
|
@@ -74,6 +74,7 @@ const FACT_STRING_ARRAY_FIELDS = new Set([
|
|
|
74
74
|
"argument_names",
|
|
75
75
|
"argument_types",
|
|
76
76
|
"argument_descriptions",
|
|
77
|
+
"key_arguments",
|
|
77
78
|
"aliases",
|
|
78
79
|
"examples",
|
|
79
80
|
"predicate_args",
|
|
@@ -185,6 +186,17 @@ function buildEntityAssertionGoal(entity, sourceFile) {
|
|
|
185
186
|
if (entity.type === "req" && entity.semantic_inventory) {
|
|
186
187
|
props.push(`semantic_inventory=${toPrologString(JSON.stringify(entity.semantic_inventory))}`);
|
|
187
188
|
}
|
|
189
|
+
for (const field of ["approved_by", "approval_ref", "rationale"]) {
|
|
190
|
+
const value = entity.type === "req" ? entity[field] : undefined;
|
|
191
|
+
if (value !== undefined)
|
|
192
|
+
props.push(`${field}=${toPrologString(value)}`);
|
|
193
|
+
}
|
|
194
|
+
if (entity.type === "req" && entity.exempts_claims) {
|
|
195
|
+
props.push(`exempts_claims=[${entity.exempts_claims.map(toPrologAtom).join(",")}]`);
|
|
196
|
+
}
|
|
197
|
+
if (entity.origin !== undefined) {
|
|
198
|
+
props.push(`origin=${toPrologString(JSON.stringify(entity.origin))}`);
|
|
199
|
+
}
|
|
188
200
|
if (sourceFile)
|
|
189
201
|
props.push(`sourceFile=${toPrologString(sourceFile)}`);
|
|
190
202
|
if (entity.type === "symbol") {
|
package/dist/types/entities.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EntityOrigin } from "../public/entity-origin.js";
|
|
1
2
|
import type { ProofBinding, ProofContract } from "../public/proof-protocol.js";
|
|
2
3
|
import type { ProofReceipt } from "../public/proof-receipt.js";
|
|
3
4
|
export interface BaseEntity {
|
|
@@ -13,6 +14,8 @@ export interface BaseEntity {
|
|
|
13
14
|
severity?: string;
|
|
14
15
|
links?: string[];
|
|
15
16
|
text_ref?: string;
|
|
17
|
+
/** Provenance: who authored the entity and on what authority. */
|
|
18
|
+
origin?: EntityOrigin;
|
|
16
19
|
}
|
|
17
20
|
export interface FactFields {
|
|
18
21
|
fact_kind?: "subject" | "property_value" | "observation" | "meta" | "predicate_schema" | "predicate";
|
|
@@ -39,6 +42,8 @@ export interface FactFields {
|
|
|
39
42
|
argument_names?: string[];
|
|
40
43
|
argument_types?: string[];
|
|
41
44
|
argument_descriptions?: string[];
|
|
45
|
+
/** predicate_schema only: argument names that determine the others. */
|
|
46
|
+
key_arguments?: string[];
|
|
42
47
|
argument_constants?: Record<string, string[]>;
|
|
43
48
|
argument_aliases?: Record<string, Record<string, string>>;
|
|
44
49
|
aliases?: string[];
|
|
@@ -56,6 +61,14 @@ export type Requirement = BaseEntity & {
|
|
|
56
61
|
type: "req";
|
|
57
62
|
semantic_text?: string;
|
|
58
63
|
logic_claims?: string[];
|
|
64
|
+
/** Exception requirements only: who approved the exception. */
|
|
65
|
+
approved_by?: string;
|
|
66
|
+
/** Optional reference to the approval decision record. */
|
|
67
|
+
approval_ref?: string;
|
|
68
|
+
/** Why the requirement exists; explanation, not checked meaning. */
|
|
69
|
+
rationale?: string;
|
|
70
|
+
/** Exception requirements only: claim keys of the exempted requirement it waives. */
|
|
71
|
+
exempts_claims?: string[];
|
|
59
72
|
};
|
|
60
73
|
export type Scenario = BaseEntity & {
|
|
61
74
|
type: "scenario";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../src/types/entities.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../src/types/entities.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM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A;CAAE,CAAC;AACzD,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,sBAAsB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAChF,MAAM,MAAM,GAAG,GAAG,UAAU,GAAG;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC;AAC/C,MAAM,MAAM,IAAI,GAAG,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AACjD,MAAM,MAAM,KAAK,GAAG,UAAU,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AACnD,MAAM,MAAM,MAAM,GAAG,UAAU,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AACrD,MAAM,MAAM,IAAI,GAAG,UAAU,GAAG,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,MAAM,MAAM,MAAM,GACd,WAAW,GACX,QAAQ,GACR,UAAU,GACV,GAAG,GACH,IAAI,GACJ,KAAK,GACL,MAAM,GACN,IAAI,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface BaseRelationship {
|
|
2
|
-
type: "depends_on" | "specified_by" | "verified_by" | "validates" | "implements" | "covered_by" | "executable_for" | "constrained_by" | "constrains" | "requires_property" | "requires_predicate" | "requires_rule" | "guards" | "publishes" | "consumes" | "supersedes" | "restates" | "relates_to";
|
|
2
|
+
type: "depends_on" | "specified_by" | "verified_by" | "validates" | "implements" | "covered_by" | "executable_for" | "constrained_by" | "constrains" | "requires_property" | "requires_predicate" | "requires_rule" | "guards" | "publishes" | "consumes" | "supersedes" | "restates" | "assumes" | "exempts" | "relates_to";
|
|
3
3
|
from: string;
|
|
4
4
|
to: string;
|
|
5
5
|
created_at?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relationships.d.ts","sourceRoot":"","sources":["../../src/types/relationships.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EACA,YAAY,GACZ,cAAc,GACd,aAAa,GACb,WAAW,GACX,YAAY,GACZ,YAAY,GACZ,gBAAgB,GAChB,gBAAgB,GAChB,YAAY,GACZ,mBAAmB,GACnB,oBAAoB,GACpB,eAAe,GACf,QAAQ,GACR,WAAW,GACX,UAAU,GACV,YAAY,GACZ,UAAU,GACV,YAAY,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAe,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"relationships.d.ts","sourceRoot":"","sources":["../../src/types/relationships.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EACA,YAAY,GACZ,cAAc,GACd,aAAa,GACb,WAAW,GACX,YAAY,GACZ,YAAY,GACZ,gBAAgB,GAChB,gBAAgB,GAChB,YAAY,GACZ,mBAAmB,GACnB,oBAAoB,GACpB,eAAe,GACf,QAAQ,GACR,WAAW,GACX,UAAU,GACV,YAAY,GACZ,UAAU,GACV,SAAS,GACT,SAAS,GACT,YAAY,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -12,9 +12,29 @@ export type BranchAttachment = {
|
|
|
12
12
|
kbBranch: string;
|
|
13
13
|
/** The resolved compiled-store path. Never derive this path at call sites. */
|
|
14
14
|
storePath: string;
|
|
15
|
-
kind: "exact" | "explicit_override" | "legacy_compat";
|
|
15
|
+
kind: "exact" | "explicit_override" | "legacy_compat" | "detached_snapshot";
|
|
16
16
|
migrationRequired: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Present only on a detached HEAD that no single local branch points at.
|
|
19
|
+
* The attachment then serves reads from a snapshot compiled from the
|
|
20
|
+
* checkout, and every write route must refuse it.
|
|
21
|
+
*/
|
|
22
|
+
readOnly?: DetachedReadOnlyAttachment;
|
|
17
23
|
};
|
|
24
|
+
export type DetachedReadOnlyAttachment = {
|
|
25
|
+
/** The checked-out commit. */
|
|
26
|
+
head: string;
|
|
27
|
+
/** Local branches whose tip is HEAD (zero, or two or more). */
|
|
28
|
+
branchesAtHead: readonly string[];
|
|
29
|
+
/** Human-readable account of the store used and the write refusal. */
|
|
30
|
+
notice: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Store identity of the read-only snapshot compiled from a detached checkout.
|
|
34
|
+
* It is never a Git branch's KB: reads on a bare SHA (CI checkouts) use it so
|
|
35
|
+
* no branch identity is guessed, and writes are refused while it is attached.
|
|
36
|
+
*/
|
|
37
|
+
export declare const DETACHED_SNAPSHOT_KB_BRANCH = "kibi-internal/detached-head-snapshot";
|
|
18
38
|
export type BranchErrorCode = "ENV_OVERRIDE" | "DETACHED_HEAD" | "UNBORN_BRANCH" | "GIT_NOT_AVAILABLE" | "NOT_A_GIT_REPO" | "AMBIGUOUS_ATTACHMENT" | "MIGRATION_RECOVERY_REQUIRED" | "UNKNOWN_ERROR";
|
|
19
39
|
export interface BranchResolverDeps {
|
|
20
40
|
execSync: typeof import("node:child_process").execSync;
|
|
@@ -31,6 +51,22 @@ export declare function _setBranchResolverDepsForTests(deps: Partial<BranchResol
|
|
|
31
51
|
* @returns BranchResolutionResult with either the branch name or an error
|
|
32
52
|
*/
|
|
33
53
|
export declare function resolveActiveBranch(workspaceRoot?: string): BranchResolutionResult;
|
|
54
|
+
/**
|
|
55
|
+
* Resolve the attachment for a read-only operation.
|
|
56
|
+
*
|
|
57
|
+
* Identical to {@link resolveBranchAttachment} except on a detached HEAD that
|
|
58
|
+
* no single local branch points at (a CI checkout of a bare SHA, or a commit
|
|
59
|
+
* two branches share). Such a checkout has no exact branch identity, and no
|
|
60
|
+
* other branch's KB may stand in for it, so reads are served from a snapshot
|
|
61
|
+
* compiled from this checkout's tracked sources. The result carries a notice
|
|
62
|
+
* naming that store and stating that writes are refused.
|
|
63
|
+
*/
|
|
64
|
+
export declare function resolveReadBranchAttachment(workspaceRoot?: string): BranchAttachment | BranchResolutionError;
|
|
65
|
+
/**
|
|
66
|
+
* Actionable refusal for a write attempted on a detached HEAD. Reads keep
|
|
67
|
+
* working through the snapshot; a write needs an exact branch identity.
|
|
68
|
+
*/
|
|
69
|
+
export declare function detachedHeadWriteRefusal(operation: string, workspaceRoot?: string): string;
|
|
34
70
|
/**
|
|
35
71
|
* Resolve the storage namespace without treating any branch as canonical.
|
|
36
72
|
* Literal branch-named stores are read-compatible legacy storage only. The
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branch-resolver.d.ts","sourceRoot":"","sources":["../../src/utils/branch-resolver.ts"],"names":[],"mappings":"AAsCA,MAAM,MAAM,uBAAuB,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AACzD,MAAM,MAAM,qBAAqB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,eAAe,CAAA;CAAE,CAAC;AAC7E,MAAM,MAAM,sBAAsB,GAC9B,uBAAuB,GACvB,qBAAqB,CAAC;AAE1B,wBAAgB,+BAA+B,CAC7C,WAAW,EAAE,MAAM,GAClB,qBAAqB,CAKvB;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,OAAO,GAAG,mBAAmB,GAAG,eAAe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26,19 @@ export function unreadableMigrationJournalError(journalName) {
|
|
|
26
26
|
code: "MIGRATION_RECOVERY_REQUIRED",
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Store identity of the read-only snapshot compiled from a detached checkout.
|
|
31
|
+
* It is never a Git branch's KB: reads on a bare SHA (CI checkouts) use it so
|
|
32
|
+
* no branch identity is guessed, and writes are refused while it is attached.
|
|
33
|
+
*/
|
|
34
|
+
// implements REQ-branch-store-recovery-v4
|
|
35
|
+
export const DETACHED_SNAPSHOT_KB_BRANCH = "kibi-internal/detached-head-snapshot";
|
|
29
36
|
const defaultDeps = {
|
|
30
37
|
execSync: rawExecSync,
|
|
31
38
|
execFileSync: rawExecFileSync,
|
|
32
39
|
};
|
|
33
40
|
export function _setBranchResolverDepsForTests(deps) {
|
|
34
|
-
// implements REQ-
|
|
41
|
+
// implements REQ-branch-store-recovery-v4
|
|
35
42
|
defaultDeps.execSync = deps.execSync ?? rawExecSync;
|
|
36
43
|
defaultDeps.execFileSync = deps.execFileSync ?? rawExecFileSync;
|
|
37
44
|
}
|
|
@@ -70,7 +77,7 @@ function isVolatileArtifact(fileName) {
|
|
|
70
77
|
* @returns BranchResolutionResult with either the branch name or an error
|
|
71
78
|
*/
|
|
72
79
|
export function resolveActiveBranch(workspaceRoot = process.cwd()) {
|
|
73
|
-
// implements REQ-
|
|
80
|
+
// implements REQ-branch-store-recovery-v4
|
|
74
81
|
// 1. Check KIBI_BRANCH env var first (highest precedence)
|
|
75
82
|
const envBranch = getBranchOverride();
|
|
76
83
|
if (envBranch) {
|
|
@@ -95,6 +102,9 @@ export function resolveActiveBranch(workspaceRoot = process.cwd()) {
|
|
|
95
102
|
.trim();
|
|
96
103
|
if (!branch) {
|
|
97
104
|
// Empty result means detached HEAD
|
|
105
|
+
const atHead = uniqueBranchAtHead(workspaceRoot);
|
|
106
|
+
if (atHead)
|
|
107
|
+
return { branch: atHead };
|
|
98
108
|
return {
|
|
99
109
|
error: getBranchDiagnostic(undefined, "Git is in detached HEAD state"),
|
|
100
110
|
code: "DETACHED_HEAD",
|
|
@@ -123,6 +133,9 @@ export function resolveActiveBranch(workspaceRoot = process.cwd()) {
|
|
|
123
133
|
})
|
|
124
134
|
.trim();
|
|
125
135
|
if (branch === "HEAD") {
|
|
136
|
+
const atHead = uniqueBranchAtHead(workspaceRoot);
|
|
137
|
+
if (atHead)
|
|
138
|
+
return { branch: atHead };
|
|
126
139
|
return {
|
|
127
140
|
error: getBranchDiagnostic(undefined, "Git is in detached HEAD state"),
|
|
128
141
|
code: "DETACHED_HEAD",
|
|
@@ -165,6 +178,120 @@ export function resolveActiveBranch(workspaceRoot = process.cwd()) {
|
|
|
165
178
|
}
|
|
166
179
|
}
|
|
167
180
|
}
|
|
181
|
+
// implements REQ-branch-store-recovery-v4
|
|
182
|
+
/**
|
|
183
|
+
* A detached HEAD that exactly one local branch points at is that branch's
|
|
184
|
+
* commit, so its knowledge base is the exact one for this checkout (a
|
|
185
|
+
* `git checkout <sha>` of a branch tip, or a tool that detaches before
|
|
186
|
+
* running). Zero or several candidates stay a DETACHED_HEAD diagnostic: no
|
|
187
|
+
* branch is guessed.
|
|
188
|
+
*/
|
|
189
|
+
function uniqueBranchAtHead(workspaceRoot) {
|
|
190
|
+
const names = branchesAtHead(workspaceRoot);
|
|
191
|
+
if (names.length !== 1)
|
|
192
|
+
return null;
|
|
193
|
+
const [name] = names;
|
|
194
|
+
return name !== undefined && isValidBranchName(name) ? name : null;
|
|
195
|
+
}
|
|
196
|
+
/** Local branch names whose tip is HEAD, sorted; empty when Git cannot say. */
|
|
197
|
+
function branchesAtHead(workspaceRoot) {
|
|
198
|
+
try {
|
|
199
|
+
return defaultDeps
|
|
200
|
+
.execFileSync("git", ["branch", "--points-at", "HEAD", "--format=%(refname:short)"], {
|
|
201
|
+
cwd: workspaceRoot,
|
|
202
|
+
encoding: "utf8",
|
|
203
|
+
timeout: 5000,
|
|
204
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
205
|
+
})
|
|
206
|
+
.toString()
|
|
207
|
+
.split("\n")
|
|
208
|
+
.map((name) => name.trim())
|
|
209
|
+
.filter((name) => name.length > 0 && !name.startsWith("("))
|
|
210
|
+
.sort();
|
|
211
|
+
}
|
|
212
|
+
catch {
|
|
213
|
+
return [];
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
function headCommit(workspaceRoot) {
|
|
217
|
+
try {
|
|
218
|
+
const head = defaultDeps
|
|
219
|
+
.execFileSync("git", ["rev-parse", "--verify", "HEAD"], {
|
|
220
|
+
cwd: workspaceRoot,
|
|
221
|
+
encoding: "utf8",
|
|
222
|
+
timeout: 5000,
|
|
223
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
224
|
+
})
|
|
225
|
+
.toString()
|
|
226
|
+
.trim();
|
|
227
|
+
return /^[0-9a-f]{40,64}$/u.test(head) ? head : null;
|
|
228
|
+
}
|
|
229
|
+
catch {
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function describeBranchesAtHead(branches) {
|
|
234
|
+
return branches.length === 0
|
|
235
|
+
? "no local branch points at it"
|
|
236
|
+
: `${branches.length} local branches point at it (${branches.join(", ")}), so no single branch KB is implied`;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Resolve the attachment for a read-only operation.
|
|
240
|
+
*
|
|
241
|
+
* Identical to {@link resolveBranchAttachment} except on a detached HEAD that
|
|
242
|
+
* no single local branch points at (a CI checkout of a bare SHA, or a commit
|
|
243
|
+
* two branches share). Such a checkout has no exact branch identity, and no
|
|
244
|
+
* other branch's KB may stand in for it, so reads are served from a snapshot
|
|
245
|
+
* compiled from this checkout's tracked sources. The result carries a notice
|
|
246
|
+
* naming that store and stating that writes are refused.
|
|
247
|
+
*/
|
|
248
|
+
// implements REQ-branch-store-recovery-v4
|
|
249
|
+
export function resolveReadBranchAttachment(workspaceRoot = process.cwd()) {
|
|
250
|
+
const attachment = resolveBranchAttachment(workspaceRoot);
|
|
251
|
+
if (!("error" in attachment) || attachment.code !== "DETACHED_HEAD") {
|
|
252
|
+
return attachment;
|
|
253
|
+
}
|
|
254
|
+
const head = headCommit(workspaceRoot);
|
|
255
|
+
if (head === null)
|
|
256
|
+
return attachment;
|
|
257
|
+
const branches = branchesAtHead(workspaceRoot);
|
|
258
|
+
const storePath = branchStorePath(workspaceRoot, DETACHED_SNAPSHOT_KB_BRANCH);
|
|
259
|
+
if (existsSync(storePath) &&
|
|
260
|
+
!branchStoreManifestMatches(storePath, DETACHED_SNAPSHOT_KB_BRANCH)) {
|
|
261
|
+
return {
|
|
262
|
+
error: `Detached HEAD snapshot store identity mismatch at ${storePath}; refusing to read it.`,
|
|
263
|
+
code: "AMBIGUOUS_ATTACHMENT",
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
return {
|
|
267
|
+
gitBranch: "HEAD",
|
|
268
|
+
kbBranch: DETACHED_SNAPSHOT_KB_BRANCH,
|
|
269
|
+
storePath,
|
|
270
|
+
kind: "detached_snapshot",
|
|
271
|
+
migrationRequired: false,
|
|
272
|
+
readOnly: {
|
|
273
|
+
head,
|
|
274
|
+
branchesAtHead: branches,
|
|
275
|
+
notice: `Detached HEAD at ${head.slice(0, 12)}: ${describeBranchesAtHead(branches)}. Read-only answers come from a snapshot compiled from this checkout's tracked sources (store ${storePath}); writes are refused until a branch is checked out.`,
|
|
276
|
+
},
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Actionable refusal for a write attempted on a detached HEAD. Reads keep
|
|
281
|
+
* working through the snapshot; a write needs an exact branch identity.
|
|
282
|
+
*/
|
|
283
|
+
// implements REQ-branch-store-recovery-v4
|
|
284
|
+
export function detachedHeadWriteRefusal(operation, workspaceRoot = process.cwd()) {
|
|
285
|
+
const head = headCommit(workspaceRoot);
|
|
286
|
+
const branches = branchesAtHead(workspaceRoot);
|
|
287
|
+
const where = head === null
|
|
288
|
+
? "HEAD is detached"
|
|
289
|
+
: `HEAD is detached at ${head.slice(0, 12)} and ${describeBranchesAtHead(branches)}`;
|
|
290
|
+
const switchHint = branches.length > 0
|
|
291
|
+
? `'git switch ${branches[0]}' (or another branch at HEAD)`
|
|
292
|
+
: "'git switch -c <branch>'";
|
|
293
|
+
return `${operation} writes the branch KB, but ${where}. Check out a branch first: ${switchHint}, or set KIBI_BRANCH to name the branch explicitly. Read-only operations (search, query, status, check, coverage, graph) keep working on a detached HEAD from a read-only snapshot of the checkout.`;
|
|
294
|
+
}
|
|
168
295
|
/**
|
|
169
296
|
* Resolve the storage namespace without treating any branch as canonical.
|
|
170
297
|
* Literal branch-named stores are read-compatible legacy storage only. The
|
|
@@ -237,7 +364,7 @@ export function resolveBranchAttachment(workspaceRoot = process.cwd()) {
|
|
|
237
364
|
* @returns true if in detached HEAD, false otherwise
|
|
238
365
|
*/
|
|
239
366
|
export function isDetachedHead(workspaceRoot = process.cwd()) {
|
|
240
|
-
// implements REQ-
|
|
367
|
+
// implements REQ-branch-store-recovery-v4
|
|
241
368
|
try {
|
|
242
369
|
const branch = defaultDeps
|
|
243
370
|
.execSync("git rev-parse --abbrev-ref HEAD", {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical repository-relative form of a recorded path, as proof freshness
|
|
3
|
+
* reads it: POSIX separators and no `.` segments. An absolute path that
|
|
4
|
+
* points inside `workspaceRoot` is re-expressed relative to it, so
|
|
5
|
+
* `packages/a.ts`, `./packages/a.ts`, `packages\a.ts` and
|
|
6
|
+
* `<root>/packages/a.ts` all name the same file. Returns null for a path that
|
|
7
|
+
* leaves the repository (a `..` escape, another machine's absolute path, a
|
|
8
|
+
* drive letter or UNC share outside the root): such a location exists on one
|
|
9
|
+
* machine only, so hashing it would make the same commit prove differently
|
|
10
|
+
* in CI and on a developer checkout.
|
|
11
|
+
*
|
|
12
|
+
* The Unicode form of each name is kept as recorded: the result is used to
|
|
13
|
+
* read the file, and a case- or normalization-sensitive filesystem only finds
|
|
14
|
+
* a name under the exact bytes git checked out. Where a path is an identity
|
|
15
|
+
* (the workspace snapshot), the caller compares it in NFC.
|
|
16
|
+
*/
|
|
17
|
+
export declare function normalizeRepoRelativePath(workspaceRoot: string, candidate: string): string | null;
|
|
18
|
+
//# sourceMappingURL=repo-relative-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repo-relative-path.d.ts","sourceRoot":"","sources":["../../src/utils/repo-relative-path.ts"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;;;;GAeG;AAEH,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,IAAI,CAsBf"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Kibi — repo-local, per-branch, queryable long-term memory for software projects
|
|
3
|
+
Copyright (C) 2026 Piotr Franczyk
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify
|
|
6
|
+
it under the terms of the GNU Affero General Public License as published by
|
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
(at your option) any later version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU Affero General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import path from "node:path";
|
|
19
|
+
/**
|
|
20
|
+
* Canonical repository-relative form of a recorded path, as proof freshness
|
|
21
|
+
* reads it: POSIX separators and no `.` segments. An absolute path that
|
|
22
|
+
* points inside `workspaceRoot` is re-expressed relative to it, so
|
|
23
|
+
* `packages/a.ts`, `./packages/a.ts`, `packages\a.ts` and
|
|
24
|
+
* `<root>/packages/a.ts` all name the same file. Returns null for a path that
|
|
25
|
+
* leaves the repository (a `..` escape, another machine's absolute path, a
|
|
26
|
+
* drive letter or UNC share outside the root): such a location exists on one
|
|
27
|
+
* machine only, so hashing it would make the same commit prove differently
|
|
28
|
+
* in CI and on a developer checkout.
|
|
29
|
+
*
|
|
30
|
+
* The Unicode form of each name is kept as recorded: the result is used to
|
|
31
|
+
* read the file, and a case- or normalization-sensitive filesystem only finds
|
|
32
|
+
* a name under the exact bytes git checked out. Where a path is an identity
|
|
33
|
+
* (the workspace snapshot), the caller compares it in NFC.
|
|
34
|
+
*/
|
|
35
|
+
// implements REQ-kibi-fresh-verification-receipts-v2
|
|
36
|
+
export function normalizeRepoRelativePath(workspaceRoot, candidate) {
|
|
37
|
+
if (candidate.trim() === "")
|
|
38
|
+
return null;
|
|
39
|
+
let slashed = candidate.replaceAll("\\", "/");
|
|
40
|
+
const foreignAbsolute = /^[A-Za-z]:\//.test(slashed) || slashed.startsWith("//");
|
|
41
|
+
if (slashed.startsWith("/") || foreignAbsolute) {
|
|
42
|
+
if (foreignAbsolute && path.sep === "/")
|
|
43
|
+
return null;
|
|
44
|
+
const root = path.resolve(workspaceRoot);
|
|
45
|
+
const relative = path.relative(root, path.resolve(candidate));
|
|
46
|
+
if (relative === "" || path.isAbsolute(relative))
|
|
47
|
+
return null;
|
|
48
|
+
slashed = relative.replaceAll("\\", "/");
|
|
49
|
+
}
|
|
50
|
+
const normalized = path.posix.normalize(slashed).replace(/\/+$/, "");
|
|
51
|
+
if (normalized === "" ||
|
|
52
|
+
normalized === "." ||
|
|
53
|
+
normalized === ".." ||
|
|
54
|
+
normalized.startsWith("../")) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
return normalized;
|
|
58
|
+
}
|
|
@@ -23,6 +23,11 @@ export declare const GENERATED_RULES: readonly [{
|
|
|
23
23
|
readonly description: "Authored Markdown and relationship-shard edges must exactly match the compiled KB";
|
|
24
24
|
readonly enforcementClass: "canonical";
|
|
25
25
|
readonly category: "integrity";
|
|
26
|
+
}, {
|
|
27
|
+
readonly name: "source-path-dangling";
|
|
28
|
+
readonly description: "An authored entity's source field must name an existing workspace path (a #anchor suffix is ignored), an existing entity id, or an http(s) URL; a missing source is allowed";
|
|
29
|
+
readonly enforcementClass: "canonical";
|
|
30
|
+
readonly category: "integrity";
|
|
26
31
|
}, {
|
|
27
32
|
readonly name: "no-cycles";
|
|
28
33
|
readonly description: "No circular dependency chains in requirements";
|
|
@@ -38,6 +43,36 @@ export declare const GENERATED_RULES: readonly [{
|
|
|
38
43
|
readonly description: "Deprecated ADRs must have a successor ADR that supersedes them";
|
|
39
44
|
readonly enforcementClass: "canonical";
|
|
40
45
|
readonly category: "lifecycle";
|
|
46
|
+
}, {
|
|
47
|
+
readonly name: "superseded-requirement-open";
|
|
48
|
+
readonly description: "A requirement that another requirement supersedes must have status closed, and supersedes links between requirements must not form a cycle";
|
|
49
|
+
readonly enforcementClass: "canonical";
|
|
50
|
+
readonly category: "lifecycle";
|
|
51
|
+
}, {
|
|
52
|
+
readonly name: "scenario-feasibility";
|
|
53
|
+
readonly description: "A scenario that expects success must not assume property values that cannot hold, alone or together, with what current requirements require through typed property values or rules, unless an approved exception requirement waives that requirement or the listed clauses";
|
|
54
|
+
readonly enforcementClass: "canonical";
|
|
55
|
+
readonly category: "integrity";
|
|
56
|
+
}, {
|
|
57
|
+
readonly name: "scenario-feasibility-unknown";
|
|
58
|
+
readonly description: "Advisory: a scenario that expects success assumes nothing, assumes values that contradict each other, assumes a property value no governing requirement constrains comparably (type, unit or operator mismatch, or conflicting requirements), leaves a governing rule's conditions undecided, or conflicts only with constraints whose validity window may not cover it, so its feasibility cannot be decided";
|
|
59
|
+
readonly enforcementClass: "advisory";
|
|
60
|
+
readonly category: "integrity";
|
|
61
|
+
}, {
|
|
62
|
+
readonly name: "exception-claim-keys";
|
|
63
|
+
readonly description: "An exception requirement's exempts_claims must name claim keys of a requirement it exempts, and requires an exempts link";
|
|
64
|
+
readonly enforcementClass: "canonical";
|
|
65
|
+
readonly category: "integrity";
|
|
66
|
+
}, {
|
|
67
|
+
readonly name: "numeric-string-value";
|
|
68
|
+
readonly description: "Advisory: a property value stores a numeric-looking string where the comparison is numeric (ordering operator, or an int/number fact on the same property); the finding names the fact and the typed value, without converting it";
|
|
69
|
+
readonly enforcementClass: "advisory";
|
|
70
|
+
readonly category: "integrity";
|
|
71
|
+
}, {
|
|
72
|
+
readonly name: "rule-key-arguments-missing";
|
|
73
|
+
readonly description: "Advisory: an opposing rule pair stays unresolved only because a body predicate declares no key_arguments; the finding names the predicate and the key positions that would decide the pair";
|
|
74
|
+
readonly enforcementClass: "advisory";
|
|
75
|
+
readonly category: "integrity";
|
|
41
76
|
}, {
|
|
42
77
|
readonly name: "domain-contradictions";
|
|
43
78
|
readonly description: "Detect contradictions between requirements constraining the same fact";
|
|
@@ -71,7 +106,7 @@ export declare const GENERATED_RULES: readonly [{
|
|
|
71
106
|
}, {
|
|
72
107
|
readonly name: "strict-fact-shape";
|
|
73
108
|
readonly description: "Detect malformed strict facts (facts with fact_kind that are missing required fields)";
|
|
74
|
-
readonly enforcementClass: "
|
|
109
|
+
readonly enforcementClass: "canonical";
|
|
75
110
|
readonly category: "integrity";
|
|
76
111
|
}, {
|
|
77
112
|
readonly name: "strict-req-fact-pairing";
|
|
@@ -116,12 +151,12 @@ export declare const GENERATED_RULES: readonly [{
|
|
|
116
151
|
readonly diagnosticSeverity: "info";
|
|
117
152
|
}, {
|
|
118
153
|
readonly name: "subject-key-identity";
|
|
119
|
-
readonly description: "Subject keys must name a shared component, not be derived from a requirement ID";
|
|
154
|
+
readonly description: "Subject keys must name a shared component, not be derived from a requirement ID, and one subject or claim must not be minted as several active subject facts or identical property_value facts";
|
|
120
155
|
readonly enforcementClass: "advisory";
|
|
121
156
|
readonly category: "integrity";
|
|
122
157
|
}, {
|
|
123
158
|
readonly name: "subject-key-shape";
|
|
124
|
-
readonly description: "Subject keys follow dotted component.aspect[.sub] with lowercase snake segments";
|
|
159
|
+
readonly description: "Subject keys follow dotted component.aspect[.sub] with lowercase snake segments, and property keys name a property rather than a numbered clause (clause_NN)";
|
|
125
160
|
readonly enforcementClass: "advisory";
|
|
126
161
|
readonly category: "integrity";
|
|
127
162
|
}, {
|
|
@@ -130,6 +165,43 @@ export declare const GENERATED_RULES: readonly [{
|
|
|
130
165
|
readonly enforcementClass: "advisory";
|
|
131
166
|
readonly category: "integrity";
|
|
132
167
|
readonly diagnosticSeverity: "info";
|
|
168
|
+
}, {
|
|
169
|
+
readonly name: "exception-unapproved";
|
|
170
|
+
readonly description: "Advisory: a current exception requirement exempts another requirement but has no approved_by, so it exempts nothing until a human approves it";
|
|
171
|
+
readonly enforcementClass: "advisory";
|
|
172
|
+
readonly category: "integrity";
|
|
173
|
+
}, {
|
|
174
|
+
readonly name: "exception-approval-self-attested";
|
|
175
|
+
readonly description: "Advisory: an agent-authored exception records approved_by but no human corroborated it (origin.approved_by or approval_ref is missing), so a human should confirm the approval";
|
|
176
|
+
readonly enforcementClass: "advisory";
|
|
177
|
+
readonly category: "integrity";
|
|
178
|
+
}, {
|
|
179
|
+
readonly name: "agent-requirement-unapproved";
|
|
180
|
+
readonly description: "Informational: current requirements authored by an agent (origin.kind agent) that no human has approved (origin.approved_by), listed up to 25 per check";
|
|
181
|
+
readonly enforcementClass: "advisory";
|
|
182
|
+
readonly category: "lifecycle";
|
|
183
|
+
readonly diagnosticSeverity: "info";
|
|
184
|
+
}, {
|
|
185
|
+
readonly name: "requirement-rationale-missing";
|
|
186
|
+
readonly description: "Advisory: a current requirement authored by a human or an agent (origin.kind human or agent) states no rationale: no rationale field, no Rationale or Why section in its body, and no link to an ADR; listed up to 25 per check plus one summary finding";
|
|
187
|
+
readonly enforcementClass: "advisory";
|
|
188
|
+
readonly category: "lifecycle";
|
|
189
|
+
}, {
|
|
190
|
+
readonly name: "symbol-owner-superseded";
|
|
191
|
+
readonly description: "Advisory: a symbol whose every implements target is superseded or deprecated has no current owning requirement; listed up to 25 per check plus one summary finding";
|
|
192
|
+
readonly enforcementClass: "advisory";
|
|
193
|
+
readonly category: "traceability";
|
|
194
|
+
}, {
|
|
195
|
+
readonly name: "adr-unlinked";
|
|
196
|
+
readonly description: "Advisory: an accepted ADR that no requirement or other ADR is linked with (relates_to, supersedes or any typed edge, in either direction)";
|
|
197
|
+
readonly enforcementClass: "advisory";
|
|
198
|
+
readonly category: "lifecycle";
|
|
199
|
+
}, {
|
|
200
|
+
readonly name: "adr-proposed";
|
|
201
|
+
readonly description: "Informational: an ADR that is still proposed and not superseded, so nobody accepted or withdrew the decision";
|
|
202
|
+
readonly enforcementClass: "advisory";
|
|
203
|
+
readonly category: "lifecycle";
|
|
204
|
+
readonly diagnosticSeverity: "info";
|
|
133
205
|
}, {
|
|
134
206
|
readonly name: "predicate-schema-conformance";
|
|
135
207
|
readonly description: "Predicate facts match a predicate_schema (project-local, or the built-in catalog in the default namespace) and use its declared argument constants";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule-registry.generated.d.ts","sourceRoot":"","sources":["../../src/utils/rule-registry.generated.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"rule-registry.generated.d.ts","sourceRoot":"","sources":["../../src/utils/rule-registry.generated.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiSlB,CAAC"}
|