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,6 +1,12 @@
|
|
|
1
1
|
import type { Command } from "commander";
|
|
2
2
|
import type { OperationName } from "./public/operations/types.js";
|
|
3
3
|
export declare function writeOptionalStderr(stderr: string | undefined): void;
|
|
4
|
+
/**
|
|
5
|
+
* Runs `fn` with console.log and console.info sent to stderr. Commands that a
|
|
6
|
+
* JSON route reuses (sync, branch ensure, migrate) print progress; on stdout
|
|
7
|
+
* it would land ahead of the JSON document and make it unparseable.
|
|
8
|
+
*/
|
|
9
|
+
export declare function withConsoleOnStderr<T>(fn: () => Promise<T>): Promise<T>;
|
|
4
10
|
export type JsonInvocation = {
|
|
5
11
|
readonly operationName: OperationName;
|
|
6
12
|
readonly inputPath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-json-command.d.ts","sourceRoot":"","sources":["../src/cli-json-command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"cli-json-command.d.ts","sourceRoot":"","sources":["../src/cli-json-command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAazC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGlE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAIpE;AAGD;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAW7E;AAGD,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS;QAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;KACpC,EAAE,CAAC;CACL,CAAC;AAkDF,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,cAAc,GACzB,OAAO,CAAC,IAAI,CAAC,CA+Gf"}
|
package/dist/cli-json-command.js
CHANGED
|
@@ -2,7 +2,7 @@ import { once } from "node:events";
|
|
|
2
2
|
import { InputError } from "./cli-errors.js";
|
|
3
3
|
import { loadInput } from "./cli-input.js";
|
|
4
4
|
import { loadOperationSpec } from "./cli-operation-loader.js";
|
|
5
|
-
import { executeOperation as executeProtocolOperation } from "./cli-protocol.js";
|
|
5
|
+
import { executeOperation as executeProtocolOperation, openFailureResult, } from "./cli-protocol.js";
|
|
6
6
|
import { prepareOperationInput } from "./cli-validate.js";
|
|
7
7
|
import { appendCliDiagnosticUsage, diagnosticEnvOptIn, } from "./public/diagnostic-usage.js";
|
|
8
8
|
import { createCliRuntime } from "./runtime/cli-runtime.js";
|
|
@@ -11,6 +11,25 @@ export function writeOptionalStderr(stderr) {
|
|
|
11
11
|
process.stderr.write(stderr);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
+
// implements REQ-kibi-operation-interface-parity
|
|
15
|
+
/**
|
|
16
|
+
* Runs `fn` with console.log and console.info sent to stderr. Commands that a
|
|
17
|
+
* JSON route reuses (sync, branch ensure, migrate) print progress; on stdout
|
|
18
|
+
* it would land ahead of the JSON document and make it unparseable.
|
|
19
|
+
*/
|
|
20
|
+
export async function withConsoleOnStderr(fn) {
|
|
21
|
+
const { log, info } = console;
|
|
22
|
+
const toStderr = (...args) => console.error(...args);
|
|
23
|
+
console.log = toStderr;
|
|
24
|
+
console.info = toStderr;
|
|
25
|
+
try {
|
|
26
|
+
return await fn();
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
console.log = log;
|
|
30
|
+
console.info = info;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
14
33
|
function writeInputError(error) {
|
|
15
34
|
process.stderr.write(`Error [${error.code}]: ${error.detail}\n`);
|
|
16
35
|
process.exitCode = error.exitCode;
|
|
@@ -103,14 +122,23 @@ export async function runJsonInvocation(invocation) {
|
|
|
103
122
|
const runtime = createCliRuntime({ workspaceRoot });
|
|
104
123
|
let result;
|
|
105
124
|
try {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
125
|
+
result = await withConsoleOnStderr(async () => {
|
|
126
|
+
let context;
|
|
127
|
+
try {
|
|
128
|
+
context = await runtime.open(spec, { workspaceRoot });
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
return openFailureResult(invocation.operationName, spec, error);
|
|
132
|
+
}
|
|
133
|
+
const executed = await executeProtocolOperation(invocation.operationName, input, context);
|
|
134
|
+
if (executed.exitCode === 0 && spec.effects.includes("kb-write")) {
|
|
135
|
+
await runtime.afterSuccess(spec, context);
|
|
136
|
+
}
|
|
137
|
+
await runtime.close(context, {
|
|
138
|
+
status: "success",
|
|
139
|
+
result: executed,
|
|
140
|
+
});
|
|
141
|
+
return executed;
|
|
114
142
|
});
|
|
115
143
|
}
|
|
116
144
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-operation-loader.d.ts","sourceRoot":"","sources":["../src/cli-operation-loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACd,MAAM,8BAA8B,CAAC;AAOtC,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"cli-operation-loader.d.ts","sourceRoot":"","sources":["../src/cli-operation-loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACd,MAAM,8BAA8B,CAAC;AAOtC,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,aAAa,CAAC,CAgGxB"}
|
|
@@ -85,6 +85,13 @@ export async function loadOperationSpec(name) {
|
|
|
85
85
|
spec = (await import("./public/operations/specs/planning.js"))
|
|
86
86
|
.applyPlanSpec;
|
|
87
87
|
break;
|
|
88
|
+
case "kb_skills":
|
|
89
|
+
spec = (await import("./public/operations/specs/composite.js"))
|
|
90
|
+
.skillsSpec;
|
|
91
|
+
break;
|
|
92
|
+
case "kb_model":
|
|
93
|
+
spec = (await import("./public/operations/specs/composite.js")).modelSpec;
|
|
94
|
+
break;
|
|
88
95
|
case "kb_ingest_proof":
|
|
89
96
|
spec = (await import("./public/operations/specs/proof.js"))
|
|
90
97
|
.ingestProofSpec;
|
|
@@ -16,6 +16,10 @@ export declare const CLI_OPERATION_METADATA: readonly [{
|
|
|
16
16
|
readonly name: "kb_skills_read";
|
|
17
17
|
readonly cliName: "skills read";
|
|
18
18
|
readonly description: "Read a declared resource from a bundled Kibi agent skill. Resource paths are restricted to the skill manifest; arbitrary file paths are not exposed. Read-only; does not require Prolog.";
|
|
19
|
+
}, {
|
|
20
|
+
readonly name: "kb_skills";
|
|
21
|
+
readonly cliName: "skill";
|
|
22
|
+
readonly description: "Read bundled Kibi agent skills (workflow guidance). action:list returns the catalog; action:load returns a skill's metadata, Markdown body, declared resources and content hash (start with id 'kibi-usage'); action:read returns one manifest-declared resource. Read-only; does not require Prolog.";
|
|
19
23
|
}, {
|
|
20
24
|
readonly name: "kb_query";
|
|
21
25
|
readonly cliName: "query";
|
|
@@ -23,7 +27,7 @@ export declare const CLI_OPERATION_METADATA: readonly [{
|
|
|
23
27
|
}, {
|
|
24
28
|
readonly name: "kb_search";
|
|
25
29
|
readonly cliName: "search";
|
|
26
|
-
readonly description: "
|
|
30
|
+
readonly description: "Ask the KB a question or search it. Default intent-v1 ranking accepts questions, host-agent semantic facets and changed-code source locations, returns evidence, abstains below its confidence threshold and adds an answer layer: the current requirements that govern the topic, what must stay true (linked facts), why (ADRs) and what verifies it (scenarios, tests). Use before changing behavior, then kb_query for exact follow-up. No mutation side effects.";
|
|
27
31
|
}, {
|
|
28
32
|
readonly name: "kb_status";
|
|
29
33
|
readonly cliName: "status";
|
|
@@ -52,6 +56,10 @@ export declare const CLI_OPERATION_METADATA: readonly [{
|
|
|
52
56
|
readonly name: "kb_suggest_predicates";
|
|
53
57
|
readonly cliName: "suggest-predicates";
|
|
54
58
|
readonly description: "Suggest ontology predicate schemas for prose requirements before agents write facts. Retrieval/ranking is followed by a semantic applicability gate and conservative binding review; complete-looking generic placeholders never trigger application. Read-only guidance returns additive candidate diagnostics, an applicable predicate-fact plan only for a semantically eligible candidate with reviewed bindings, or an explicit ontology-gap observation plus a deterministic review-only predicate schema draft when no schema fits.";
|
|
59
|
+
}, {
|
|
60
|
+
readonly name: "kb_model";
|
|
61
|
+
readonly cliName: "model";
|
|
62
|
+
readonly description: "Turn requirement prose into checkable structure without writing the KB. mode:analyze returns the semantic advisor receipt: the clause ledger, what is grounded, what is ambiguous and suggested modeling (pass clauses for compound prose and optional typed kibi.logic.v1 interpretations). mode:requirement converts one claim (subjectKey, propertyKey, operator, value, or typed logic) into a strict-lane write set and applyPlan. mode:predicates ranks ontology predicate schemas and returns an applicable predicate-fact plan only for reviewed bindings, otherwise an ontology-gap observation. Apply returned plans with kb_upsert.";
|
|
55
63
|
}, {
|
|
56
64
|
readonly name: "kb_plan_bootstrap";
|
|
57
65
|
readonly cliName: "plan-bootstrap";
|
|
@@ -59,11 +67,11 @@ export declare const CLI_OPERATION_METADATA: readonly [{
|
|
|
59
67
|
}, {
|
|
60
68
|
readonly name: "kb_validate_upsert";
|
|
61
69
|
readonly cliName: "validate-upsert";
|
|
62
|
-
readonly description: "Validate a kb_upsert payload without mutating the KB. Use this read-only preflight before kb_upsert, especially for requirements, because it returns schema/modeling errors plus semantic advisor receipts that identify prose likely needing
|
|
70
|
+
readonly description: "Validate a kb_upsert payload without mutating the KB. Use this read-only preflight before kb_upsert, especially for requirements, because it returns schema/modeling errors plus semantic advisor receipts that identify prose likely needing kb_model mode requirement or predicates, ambiguity review, or an ontology-gap observation.";
|
|
63
71
|
}, {
|
|
64
72
|
readonly name: "kb_upsert";
|
|
65
73
|
readonly cliName: "upsert";
|
|
66
|
-
readonly description: "Create or update one entity and optional relationships. Use for KB mutations after validating intent; prefer
|
|
74
|
+
readonly description: "Create or update one entity and optional relationships. Use for KB mutations after validating intent; prefer a dryRun:true call first because it validates without writing and returns semantic advisor receipts for prose-heavy requirements. Use kb_model (mode requirement) before hand-writing strict property facts from prose, and kb_model (mode predicates) before hand-writing ontology predicate facts. Use the `relationships` array for batch creation of multiple links in a single call (e.g., linking a requirement to multiple tests or facts). Prefer modeling requirements as reusable fact links (`constrains`, `requires_property`, or `requires_predicate`) so consistency and contradiction checks remain queryable. Relationship endpoints must already exist in KB. For requirements, the write will be rejected if it contradicts existing current requirements that constrain the same subject with incompatible properties. To replace a conflicting requirement, include a `supersedes` relationship from the new requirement to the old one in the same request, then upsert the old requirement with status closed (kb_check blocks a superseded requirement that is not closed). Successful writes may return non-blocking semantic advisor warnings; inspect and repair those warnings before treating prose as contradiction-checkable. Do not use for read-only inspection. Side effects: writes KB, may refresh symbol coordinates; dryRun:true writes nothing.";
|
|
67
75
|
}, {
|
|
68
76
|
readonly name: "kb_delete";
|
|
69
77
|
readonly cliName: "delete";
|
|
@@ -87,7 +95,7 @@ export declare const CLI_OPERATION_METADATA: readonly [{
|
|
|
87
95
|
}, {
|
|
88
96
|
readonly name: "kb_apply_plan";
|
|
89
97
|
readonly cliName: "apply-plan";
|
|
90
|
-
readonly description: "Apply an explicitly approved kibi.bootstrap-plan.v1, kibi.compile-plan.v1, kibi.migration-plan.v2, or entity-deletion plan after revalidating its canonical hash and live snapshots. Bootstrap actions are dependency-ordered, sequential, source-first, and recoverable from a typed journal.";
|
|
98
|
+
readonly description: "Apply an explicitly approved kibi.bootstrap-plan.v1, kibi.compile-plan.v1, kibi.migration-plan.v2, or entity-deletion plan after revalidating its canonical hash and live snapshots. Compile plans apply all-or-nothing: a durable journal records every source write and store mutation before the first write, all steps commit in one store transaction, and an interrupted application is completed or rolled back by the next mutating call. Bootstrap actions are dependency-ordered, sequential, source-first, and recoverable from a typed journal.";
|
|
91
99
|
}, {
|
|
92
100
|
readonly name: "kb_ingest_proof";
|
|
93
101
|
readonly cliName: "ingest-proof";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-operation-metadata.d.ts","sourceRoot":"","sources":["../src/cli-operation-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B,CAAC;AAKF,eAAO,MAAM,sBAAsB
|
|
1
|
+
{"version":3,"file":"cli-operation-metadata.d.ts","sourceRoot":"","sources":["../src/cli-operation-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B,CAAC;AAKF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiJiB,CAAC;AAMrD,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,oBAAoB,GAAG,SAAS,EAC1C,IAAI,EAAE,aAAa,GAClB,oBAAoB,CAKtB;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,aAAa,GAClB,oBAAoB,CAEtB;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,aAAa,CAEnE"}
|
|
@@ -17,6 +17,11 @@ export const CLI_OPERATION_METADATA = [
|
|
|
17
17
|
cliName: "skills read",
|
|
18
18
|
description: "Read a declared resource from a bundled Kibi agent skill. Resource paths are restricted to the skill manifest; arbitrary file paths are not exposed. Read-only; does not require Prolog.",
|
|
19
19
|
},
|
|
20
|
+
{
|
|
21
|
+
name: "kb_skills",
|
|
22
|
+
cliName: "skill",
|
|
23
|
+
description: "Read bundled Kibi agent skills (workflow guidance). action:list returns the catalog; action:load returns a skill's metadata, Markdown body, declared resources and content hash (start with id 'kibi-usage'); action:read returns one manifest-declared resource. Read-only; does not require Prolog.",
|
|
24
|
+
},
|
|
20
25
|
{
|
|
21
26
|
name: "kb_query",
|
|
22
27
|
cliName: "query",
|
|
@@ -25,7 +30,7 @@ export const CLI_OPERATION_METADATA = [
|
|
|
25
30
|
{
|
|
26
31
|
name: "kb_search",
|
|
27
32
|
cliName: "search",
|
|
28
|
-
description: "
|
|
33
|
+
description: "Ask the KB a question or search it. Default intent-v1 ranking accepts questions, host-agent semantic facets and changed-code source locations, returns evidence, abstains below its confidence threshold and adds an answer layer: the current requirements that govern the topic, what must stay true (linked facts), why (ADRs) and what verifies it (scenarios, tests). Use before changing behavior, then kb_query for exact follow-up. No mutation side effects.",
|
|
29
34
|
},
|
|
30
35
|
{
|
|
31
36
|
name: "kb_status",
|
|
@@ -62,6 +67,11 @@ export const CLI_OPERATION_METADATA = [
|
|
|
62
67
|
cliName: "suggest-predicates",
|
|
63
68
|
description: "Suggest ontology predicate schemas for prose requirements before agents write facts. Retrieval/ranking is followed by a semantic applicability gate and conservative binding review; complete-looking generic placeholders never trigger application. Read-only guidance returns additive candidate diagnostics, an applicable predicate-fact plan only for a semantically eligible candidate with reviewed bindings, or an explicit ontology-gap observation plus a deterministic review-only predicate schema draft when no schema fits.",
|
|
64
69
|
},
|
|
70
|
+
{
|
|
71
|
+
name: "kb_model",
|
|
72
|
+
cliName: "model",
|
|
73
|
+
description: "Turn requirement prose into checkable structure without writing the KB. mode:analyze returns the semantic advisor receipt: the clause ledger, what is grounded, what is ambiguous and suggested modeling (pass clauses for compound prose and optional typed kibi.logic.v1 interpretations). mode:requirement converts one claim (subjectKey, propertyKey, operator, value, or typed logic) into a strict-lane write set and applyPlan. mode:predicates ranks ontology predicate schemas and returns an applicable predicate-fact plan only for reviewed bindings, otherwise an ontology-gap observation. Apply returned plans with kb_upsert.",
|
|
74
|
+
},
|
|
65
75
|
{
|
|
66
76
|
name: "kb_plan_bootstrap",
|
|
67
77
|
cliName: "plan-bootstrap",
|
|
@@ -70,12 +80,12 @@ export const CLI_OPERATION_METADATA = [
|
|
|
70
80
|
{
|
|
71
81
|
name: "kb_validate_upsert",
|
|
72
82
|
cliName: "validate-upsert",
|
|
73
|
-
description: "Validate a kb_upsert payload without mutating the KB. Use this read-only preflight before kb_upsert, especially for requirements, because it returns schema/modeling errors plus semantic advisor receipts that identify prose likely needing
|
|
83
|
+
description: "Validate a kb_upsert payload without mutating the KB. Use this read-only preflight before kb_upsert, especially for requirements, because it returns schema/modeling errors plus semantic advisor receipts that identify prose likely needing kb_model mode requirement or predicates, ambiguity review, or an ontology-gap observation.",
|
|
74
84
|
},
|
|
75
85
|
{
|
|
76
86
|
name: "kb_upsert",
|
|
77
87
|
cliName: "upsert",
|
|
78
|
-
description: "Create or update one entity and optional relationships. Use for KB mutations after validating intent; prefer
|
|
88
|
+
description: "Create or update one entity and optional relationships. Use for KB mutations after validating intent; prefer a dryRun:true call first because it validates without writing and returns semantic advisor receipts for prose-heavy requirements. Use kb_model (mode requirement) before hand-writing strict property facts from prose, and kb_model (mode predicates) before hand-writing ontology predicate facts. Use the `relationships` array for batch creation of multiple links in a single call (e.g., linking a requirement to multiple tests or facts). Prefer modeling requirements as reusable fact links (`constrains`, `requires_property`, or `requires_predicate`) so consistency and contradiction checks remain queryable. Relationship endpoints must already exist in KB. For requirements, the write will be rejected if it contradicts existing current requirements that constrain the same subject with incompatible properties. To replace a conflicting requirement, include a `supersedes` relationship from the new requirement to the old one in the same request, then upsert the old requirement with status closed (kb_check blocks a superseded requirement that is not closed). Successful writes may return non-blocking semantic advisor warnings; inspect and repair those warnings before treating prose as contradiction-checkable. Do not use for read-only inspection. Side effects: writes KB, may refresh symbol coordinates; dryRun:true writes nothing.",
|
|
79
89
|
},
|
|
80
90
|
{
|
|
81
91
|
name: "kb_delete",
|
|
@@ -105,7 +115,7 @@ export const CLI_OPERATION_METADATA = [
|
|
|
105
115
|
{
|
|
106
116
|
name: "kb_apply_plan",
|
|
107
117
|
cliName: "apply-plan",
|
|
108
|
-
description: "Apply an explicitly approved kibi.bootstrap-plan.v1, kibi.compile-plan.v1, kibi.migration-plan.v2, or entity-deletion plan after revalidating its canonical hash and live snapshots. Bootstrap actions are dependency-ordered, sequential, source-first, and recoverable from a typed journal.",
|
|
118
|
+
description: "Apply an explicitly approved kibi.bootstrap-plan.v1, kibi.compile-plan.v1, kibi.migration-plan.v2, or entity-deletion plan after revalidating its canonical hash and live snapshots. Compile plans apply all-or-nothing: a durable journal records every source write and store mutation before the first write, all steps commit in one store transaction, and an interrupted application is completed or rolled back by the next mutating call. Bootstrap actions are dependency-ordered, sequential, source-first, and recoverable from a typed journal.",
|
|
109
119
|
},
|
|
110
120
|
{
|
|
111
121
|
name: "kb_ingest_proof",
|
package/dist/cli-protocol.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { InputError, OperationError } from "./cli-errors.js";
|
|
1
2
|
import { type DiagnosticTelemetry } from "./cli-validate.js";
|
|
2
3
|
import type { OperationContext } from "./public/operations/runtime-types.js";
|
|
4
|
+
import type { OperationEffect } from "./public/operations/types.js";
|
|
3
5
|
export type CliContext = OperationContext & {
|
|
4
6
|
readonly diagnosticTelemetry?: DiagnosticTelemetry;
|
|
5
7
|
};
|
|
@@ -8,5 +10,17 @@ export type CliProtocolResult = {
|
|
|
8
10
|
readonly stdout?: string;
|
|
9
11
|
readonly stderr?: string;
|
|
10
12
|
};
|
|
13
|
+
declare function errorResult(operation: string, error: InputError | OperationError, spec?: {
|
|
14
|
+
name: string;
|
|
15
|
+
effects: readonly OperationEffect[];
|
|
16
|
+
resultVersion?: string;
|
|
17
|
+
}, attempted?: boolean, details?: unknown): CliProtocolResult;
|
|
18
|
+
/**
|
|
19
|
+
* The error envelope for a route that never ran because its runtime could
|
|
20
|
+
* not open (no branch to attach, a detached HEAD refusing a write), so
|
|
21
|
+
* stdout still carries one JSON document.
|
|
22
|
+
*/
|
|
23
|
+
export declare function openFailureResult(catalogName: string, spec: Parameters<typeof errorResult>[2], error: unknown): CliProtocolResult;
|
|
11
24
|
export declare function executeOperation(catalogName: string, input: unknown, context: CliContext): Promise<CliProtocolResult>;
|
|
25
|
+
export {};
|
|
12
26
|
//# sourceMappingURL=cli-protocol.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-protocol.d.ts","sourceRoot":"","sources":["../src/cli-protocol.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli-protocol.d.ts","sourceRoot":"","sources":["../src/cli-protocol.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAG7D,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,mBAAmB,CAAC;AAS3B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAMpE,MAAM,MAAM,UAAU,GAAG,gBAAgB,GAAG;IAC1C,QAAQ,CAAC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;CACpD,CAAC;AAGF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,iBAAS,WAAW,CAClB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,UAAU,GAAG,cAAc,EAClC,IAAI,CAAC,EAAE;IACL,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,SAAS,eAAe,EAAE,CAAC;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,EACD,SAAS,UAAO,EAChB,OAAO,CAAC,EAAE,OAAO,GAChB,iBAAiB,CAwBnB;AA4BD;;;;GAIG;AAEH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,EACvC,KAAK,EAAE,OAAO,GACb,iBAAiB,CAWnB;AAGD,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,iBAAiB,CAAC,CAwE5B"}
|
package/dist/cli-protocol.js
CHANGED
|
@@ -3,9 +3,11 @@ import { InputError, OperationError } from "./cli-errors.js";
|
|
|
3
3
|
import { loadOperationSpec } from "./cli-operation-loader.js";
|
|
4
4
|
import { isOperationName } from "./cli-operation-metadata.js";
|
|
5
5
|
import { prepareOperationInput, } from "./cli-validate.js";
|
|
6
|
+
import { QUERY_LIMIT_EXCEEDED_CODE, queryLimitExceededOf, } from "./engine-limits.js";
|
|
6
7
|
import { operationData, toKibiResult, } from "./public/operations/result-envelope.js";
|
|
8
|
+
import { detachedReadOnlyDiagnostic } from "./runtime/detached-snapshot.js";
|
|
7
9
|
const outputValidator = new Ajv2020({ strict: false, allErrors: true });
|
|
8
|
-
function errorResult(operation, error, spec, attempted = true) {
|
|
10
|
+
function errorResult(operation, error, spec, attempted = true, details) {
|
|
9
11
|
const envelope = toKibiResult(spec ?? {
|
|
10
12
|
name: operation,
|
|
11
13
|
effects: [],
|
|
@@ -17,6 +19,7 @@ function errorResult(operation, error, spec, attempted = true) {
|
|
|
17
19
|
code: error.code,
|
|
18
20
|
message: error.detail,
|
|
19
21
|
retryable: error.retryable,
|
|
22
|
+
...(details !== undefined ? { details } : {}),
|
|
20
23
|
},
|
|
21
24
|
});
|
|
22
25
|
return {
|
|
@@ -25,6 +28,17 @@ function errorResult(operation, error, spec, attempted = true) {
|
|
|
25
28
|
stderr: `Error [${error.code}]: ${error.detail}\n`,
|
|
26
29
|
};
|
|
27
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* An answer from a detached HEAD's read-only snapshot says so in the
|
|
33
|
+
* envelope: which store was read and that writes are refused.
|
|
34
|
+
*/
|
|
35
|
+
// implements REQ-branch-store-recovery-v4
|
|
36
|
+
function withDetachedReadOnlyNotice(envelope, context) {
|
|
37
|
+
const notice = detachedReadOnlyDiagnostic(context.branchAttachment);
|
|
38
|
+
return notice
|
|
39
|
+
? { ...envelope, diagnostics: [...envelope.diagnostics, notice] }
|
|
40
|
+
: envelope;
|
|
41
|
+
}
|
|
28
42
|
function protocolValid(spec, envelope) {
|
|
29
43
|
if (!spec.outputSchema)
|
|
30
44
|
return true;
|
|
@@ -35,6 +49,15 @@ function protocolValid(spec, envelope) {
|
|
|
35
49
|
return false;
|
|
36
50
|
}
|
|
37
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* The error envelope for a route that never ran because its runtime could
|
|
54
|
+
* not open (no branch to attach, a detached HEAD refusing a write), so
|
|
55
|
+
* stdout still carries one JSON document.
|
|
56
|
+
*/
|
|
57
|
+
// implements REQ-kibi-operation-interface-parity, REQ-branch-store-recovery-v4
|
|
58
|
+
export function openFailureResult(catalogName, spec, error) {
|
|
59
|
+
return errorResult(catalogName, new OperationError("OPERATION_FAILED", error instanceof Error ? error.message : String(error), false), spec, false);
|
|
60
|
+
}
|
|
38
61
|
// implements REQ-kibi-operation-interface-parity
|
|
39
62
|
export async function executeOperation(catalogName, input, context) {
|
|
40
63
|
if (!isOperationName(catalogName)) {
|
|
@@ -51,7 +74,7 @@ export async function executeOperation(catalogName, input, context) {
|
|
|
51
74
|
: context;
|
|
52
75
|
const result = await spec.execute(prepared.businessInput, executionContext);
|
|
53
76
|
const output = operationData(result);
|
|
54
|
-
const envelope = toKibiResult(spec, output);
|
|
77
|
+
const envelope = withDetachedReadOnlyNotice(toKibiResult(spec, output), context);
|
|
55
78
|
if (!protocolValid(spec, envelope)) {
|
|
56
79
|
return errorResult(catalogName, new OperationError("PROTOCOL_VALIDATION_FAILED", "Operation produced a result that does not satisfy its generated output contract."), spec);
|
|
57
80
|
}
|
|
@@ -61,6 +84,12 @@ export async function executeOperation(catalogName, input, context) {
|
|
|
61
84
|
if (error instanceof InputError || error instanceof OperationError) {
|
|
62
85
|
return errorResult(catalogName, error, spec);
|
|
63
86
|
}
|
|
87
|
+
// A read stopped at its engine limit reports the limit, not a failure
|
|
88
|
+
// that could pass for a missing answer.
|
|
89
|
+
const limitExceeded = queryLimitExceededOf(error);
|
|
90
|
+
if (error instanceof Error && limitExceeded !== null) {
|
|
91
|
+
return errorResult(catalogName, new OperationError(QUERY_LIMIT_EXCEEDED_CODE, error.message, false), spec, true, { limitExceeded });
|
|
92
|
+
}
|
|
64
93
|
if (error instanceof Error) {
|
|
65
94
|
return errorResult(catalogName, new OperationError("OPERATION_FAILED", error.message), spec);
|
|
66
95
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-register-proof.d.ts","sourceRoot":"","sources":["../src/cli-register-proof.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"cli-register-proof.d.ts","sourceRoot":"","sources":["../src/cli-register-proof.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAsL3D"}
|
|
@@ -85,6 +85,19 @@ export function registerProofCommand(program) {
|
|
|
85
85
|
...(options.keep === undefined ? {} : { keep: options.keep }),
|
|
86
86
|
});
|
|
87
87
|
}));
|
|
88
|
+
proof
|
|
89
|
+
.command("compact")
|
|
90
|
+
.description("Drop superseded proof receipts while keeping every receipt that decides current proof (newest per scope and contract for the live snapshot and current binding, plus the newest and newest passing receipt); coverage results are unchanged")
|
|
91
|
+
.option("--test <id>", "Compact a single test entity")
|
|
92
|
+
.option("--dry-run", "Report what would be removed without writing", false)
|
|
93
|
+
.option("--json", "Emit structured JSON", false)
|
|
94
|
+
.action(withExitCode(async (options) => {
|
|
95
|
+
return await (await import("./commands/proof-compact.js")).proofCompactCommand({
|
|
96
|
+
...(options.test === undefined ? {} : { test: options.test }),
|
|
97
|
+
dryRun: options.dryRun === true,
|
|
98
|
+
json: options.json === true,
|
|
99
|
+
});
|
|
100
|
+
}));
|
|
88
101
|
proof
|
|
89
102
|
.command("migrate-legacy")
|
|
90
103
|
.description("Remove legacy verification_receipts blocks from test documents that already carry a proof_contract")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAqCA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAqCA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAyE7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAE3D,YAAY,EAAE,SAAS,EAAE,CAAC;AAE1B,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AA8gBD,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,CAAC,EACtC,MAAM,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EAC5B,MAAM,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,GAC3B,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAMpB;AAGD,wBAAsB,YAAY,CAChC,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAymB/B;AAED,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,SAAS,EAAE,CAAC,CAoDtB;AAID,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,MAAM,EAAE,CAAC,CAgBnB;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,aAAa,EACrB,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,EAAE,CAAC,CAiBnB;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,SAAS,EAAE,CAAC,CAkEtB;AAID,wBAAsB,aAAa,CACjC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,SAAS,EAAE,CAAC,CAmGtB;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,aAAa,EACrB,YAAY,EAAE,MAAM,EAAE,GACrB,OAAO,CAAC,SAAS,EAAE,CAAC,CAyCtB;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,SAAS,EAAE,CAAC,CAgDtB;AAED,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,SAAS,EAAE,CAAC,CA0BtB;AAED,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,SAAS,EAAE,CAAC,CAqBtB;AAED,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,SAAS,EAAE,CAAC,CAqBtB;AAED,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,SAAS,EAAE,CAAC,CAqBtB;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,SAAS,EAAE,CAAC,CA+BtB"}
|
package/dist/commands/check.js
CHANGED
|
@@ -25,6 +25,7 @@ import { PrologProcess } from "../prolog.js";
|
|
|
25
25
|
import { escapeAtom, normalizeEntityId, parseTriples, parseViolationRows, } from "../prolog/codec.js";
|
|
26
26
|
import { createSemanticReviewDiagnostics, createSymbolGranularityDiagnostics, createSymbolQualityDiagnostics, hasBlockingImpactDiagnostics, } from "../public/impact-diagnostics.js";
|
|
27
27
|
import { executeCheck } from "../public/operations/check-executor.js";
|
|
28
|
+
import { refreshDetachedSnapshot } from "../runtime/detached-snapshot.js";
|
|
28
29
|
import { KIBI_NO_IMPACT_DECLARATION, KIBI_SYMBOLS_MANIFEST_PATH, KIBI_SYMBOL_COORDINATES_PATH, } from "../traceability/evidence-model.js";
|
|
29
30
|
import { captureStagedSnapshot } from "../traceability/git-change-snapshot.js";
|
|
30
31
|
import { supportedStagedFiles, } from "../traceability/git-staged.js";
|
|
@@ -40,7 +41,7 @@ import { assessStagedSymbolsManifest, collectStagedAuthoredSymbolsManifestEviden
|
|
|
40
41
|
import { createManifestLookupSentinelKey, extractSymbolsFromStagedFileAsync, } from "../traceability/symbol-extract.js";
|
|
41
42
|
import { cleanupTempKb, consultOverlay, createOverlayFacts, createTempKb, projectStagedEntities, } from "../traceability/temp-kb.js";
|
|
42
43
|
import { formatViolations as formatStagedViolations, validateStagedSymbols, } from "../traceability/validate.js";
|
|
43
|
-
import {
|
|
44
|
+
import { resolveReadBranchAttachment } from "../utils/branch-resolver.js";
|
|
44
45
|
import { CANONICAL_ENTITY_PATHS, isEntityLanePath } from "../utils/kb-paths.js";
|
|
45
46
|
import { safeCleanupProlog } from "../utils/prolog-cleanup.js";
|
|
46
47
|
function getMatchGroup(match, index = 1) {
|
|
@@ -438,10 +439,15 @@ export async function checkCommand(options) {
|
|
|
438
439
|
resolvedKbPath = options.kbPath;
|
|
439
440
|
}
|
|
440
441
|
else {
|
|
441
|
-
const attachment =
|
|
442
|
+
const attachment = resolveReadBranchAttachment(process.cwd());
|
|
442
443
|
if ("error" in attachment)
|
|
443
444
|
throw new Error(attachment.error);
|
|
444
445
|
resolvedBranch = attachment.kbBranch;
|
|
446
|
+
if (attachment.readOnly !== undefined) {
|
|
447
|
+
// Check reads only: a detached HEAD checks its read-only snapshot.
|
|
448
|
+
console.warn(`[KIBI] ${attachment.readOnly.notice}`);
|
|
449
|
+
await refreshDetachedSnapshot(process.cwd(), attachment);
|
|
450
|
+
}
|
|
445
451
|
if (attachment.migrationRequired) {
|
|
446
452
|
console.warn(`Warning: reading legacy KB attachment ${attachment.gitBranch} -> ${attachment.kbBranch}; migrate before writes or sync.`);
|
|
447
453
|
}
|
|
@@ -983,6 +989,7 @@ export async function getAllEntityIds(prolog, type) {
|
|
|
983
989
|
}
|
|
984
990
|
return content.split(",").map((id) => id.trim().replace(/^'|'$/g, ""));
|
|
985
991
|
}
|
|
992
|
+
// implements REQ-cli-check
|
|
986
993
|
export async function checkNoDanglingRefs(prolog) {
|
|
987
994
|
const violations = [];
|
|
988
995
|
const allEntityIds = new Set(await getAllEntityIds(prolog));
|
|
@@ -995,6 +1002,8 @@ export async function checkNoDanglingRefs(prolog) {
|
|
|
995
1002
|
"requires_property",
|
|
996
1003
|
"supersedes",
|
|
997
1004
|
"restates",
|
|
1005
|
+
"assumes",
|
|
1006
|
+
"exempts",
|
|
998
1007
|
"relates_to",
|
|
999
1008
|
];
|
|
1000
1009
|
const allRels = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery-shared.d.ts","sourceRoot":"","sources":["../../src/commands/discovery-shared.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,EACL,KAAK,cAAc,EAEpB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"discovery-shared.d.ts","sourceRoot":"","sources":["../../src/commands/discovery-shared.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,EACL,KAAK,cAAc,EAEpB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAUnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B;AAED,qDAAqD;AACrD,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,aAAa,CAAC;IAC3D,WAAW,EAAE,OAAO,eAAe,CAAC;CACrC;AAGD,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,OAAO,EACxD,IAAI,EAAE,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,cAAmB,6EAG7B;AAGD,wBAAsB,wBAAwB,CAAC,CAAC,EAC9C,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,CAAC,CAAC,EAC/C,IAAI,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC5B,OAAO,CAAC,CAAC,CAAC,CAoDZ;AAID,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,CAI5D;AAGD,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC5B,MAAM,CAGR;AAGD,wBAAsB,kBAAkB,CAAC,CAAC,EACxC,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC5B,OAAO,CAAC,CAAC,CAAC,CAwBZ;AAGD,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,EACpC,UAAU,EAAE,OAAO,EACnB,YAAY,EAAE,MAAM,GACnB,IAAI,CAQN"}
|
|
@@ -4,7 +4,8 @@ import { PrologProcess, resolveKbPlPath } from "../prolog.js";
|
|
|
4
4
|
import { escapeAtom } from "../prolog/codec.js";
|
|
5
5
|
import { executeOperation, } from "../public/operations/runtime-types.js";
|
|
6
6
|
import { createCliRuntime } from "../runtime/cli-runtime.js";
|
|
7
|
-
import {
|
|
7
|
+
import { refreshDetachedSnapshot } from "../runtime/detached-snapshot.js";
|
|
8
|
+
import { resolveBranchAttachment, resolveReadBranchAttachment, } from "../utils/branch-resolver.js";
|
|
8
9
|
import { safeCleanupProlog } from "../utils/prolog-cleanup.js";
|
|
9
10
|
import { renderDiscoveryTable } from "./discovery-table.js";
|
|
10
11
|
export { renderCoverageTable } from "./discovery-table.js";
|
|
@@ -21,10 +22,15 @@ export async function withAttachedBranchProlog(callback, deps) {
|
|
|
21
22
|
let attached = false;
|
|
22
23
|
let branchName;
|
|
23
24
|
try {
|
|
24
|
-
|
|
25
|
+
// Callers only read: a detached HEAD reads its read-only snapshot.
|
|
26
|
+
const attachment = resolveReadBranchAttachment(process.cwd());
|
|
25
27
|
if ("error" in attachment)
|
|
26
28
|
throw new Error(attachment.error);
|
|
27
29
|
branchName = attachment.kbBranch;
|
|
30
|
+
if (attachment.readOnly !== undefined) {
|
|
31
|
+
console.warn(`[KIBI] ${attachment.readOnly.notice}`);
|
|
32
|
+
await refreshDetachedSnapshot(process.cwd(), attachment);
|
|
33
|
+
}
|
|
28
34
|
if (usesEngine) {
|
|
29
35
|
engine = new EngineClient({
|
|
30
36
|
workspaceRoot: process.cwd(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/commands/engine.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/commands/engine.ts"],"names":[],"mappings":"AAuCA,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CA4BzD;AAED,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAWvD;AAED,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,CAE1D;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AAEH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,IAAI,CAAC,CA2Cf;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAkB3D;AAED,wBAAsB,oBAAoB,CAAC,OAAO,EAAE;IAClD,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,IAAI,CAAC,CAWhB"}
|
package/dist/commands/engine.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { EngineClient } from "../engine.js";
|
|
3
|
-
import { resolveBranchAttachment } from "../utils/branch-resolver.js";
|
|
3
|
+
import { resolveBranchAttachment, resolveReadBranchAttachment, } from "../utils/branch-resolver.js";
|
|
4
|
+
// Engine maintenance never writes the KB, so a detached HEAD addresses the
|
|
5
|
+
// daemon serving its read-only snapshot.
|
|
4
6
|
function currentBranch(root) {
|
|
5
|
-
const resolved =
|
|
7
|
+
const resolved = resolveReadBranchAttachment(root);
|
|
6
8
|
if ("error" in resolved) {
|
|
7
9
|
throw new Error(resolved.error);
|
|
8
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gc.d.ts","sourceRoot":"","sources":["../../src/commands/gc.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gc.d.ts","sourceRoot":"","sources":["../../src/commands/gc.ts"],"names":[],"mappings":"AAeA,KAAK,SAAS,GAAG;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AA0GF,wBAAsB,SAAS,CAAC,OAAO,GAAE,SAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAsFtE;AAED,eAAe,SAAS,CAAC"}
|
package/dist/commands/gc.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { spawnSync } from "node:child_process";
|
|
2
2
|
import * as fs from "node:fs";
|
|
3
3
|
import * as path from "node:path";
|
|
4
|
+
import { DETACHED_SNAPSHOT_KB_BRANCH, resolveReadBranchAttachment, } from "../utils/branch-resolver.js";
|
|
4
5
|
import { branchStoreKey, branchStoresRoot, readBranchStoreManifest, } from "../utils/branch-store-locator.js";
|
|
5
6
|
const DEFAULT_RETENTION_DAYS = 30;
|
|
6
7
|
function localBranches(workspaceRoot) {
|
|
@@ -101,6 +102,12 @@ export async function gcCommand(options = {}) {
|
|
|
101
102
|
return;
|
|
102
103
|
}
|
|
103
104
|
const live = localBranches(workspaceRoot);
|
|
105
|
+
// The detached-HEAD snapshot is a regenerable read cache: live while this
|
|
106
|
+
// checkout is detached on it, stale (collectable) once a branch is out.
|
|
107
|
+
const readAttachment = resolveReadBranchAttachment(workspaceRoot);
|
|
108
|
+
if (!("error" in readAttachment) && readAttachment.readOnly !== undefined) {
|
|
109
|
+
live.add(DETACHED_SNAPSHOT_KB_BRANCH);
|
|
110
|
+
}
|
|
104
111
|
const candidates = [];
|
|
105
112
|
const visit = (dir, relativeBranch) => {
|
|
106
113
|
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-helpers.d.ts","sourceRoot":"","sources":["../../src/commands/init-helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init-helpers.d.ts","sourceRoot":"","sources":["../../src/commands/init-helpers.ts"],"names":[],"mappings":"AA6IA,wBAAsB,gBAAgB,CACpC,GAAG,GAAE,MAAsB,GAC1B,OAAO,CAAC,MAAM,CAAC,CASjB;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,MAAM,GACpB,IAAI,CA0BN;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAGtD;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CA6BjD;AAkDD,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAU3D;AAED,wBAAsB,eAAe,CACnC,KAAK,EAAE,MAAM,EACb,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,IAAI,CAAC,CAuBf;AASD,MAAM,MAAM,iBAAiB,GACzB,WAAW,GACX,SAAS,GACT,iBAAiB,GACjB,iBAAiB,GACjB,qBAAqB,CAAC;AAoB1B,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,iBAAiB,CAwEnB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,YAAY,GAAG,eAAe,GAAG,YAAY,GAAG,cAAc,CAAC;IACrE,MAAM,EAAE,iBAAiB,CAAC;CAC3B;AAiBD;;;;GAIG;AAEH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAU/D;AAED,wEAAwE;AAExE,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAQzD;AAED,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IAAE,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAO,GAChD,oBAAoB,EAAE,CA8CxB"}
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
You should have received a copy of the GNU Affero General Public License
|
|
16
16
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
|
-
import { chmodSync, copyFileSync, existsSync, lstatSync, mkdirSync, readFileSync, writeFileSync, } from "node:fs";
|
|
18
|
+
import { chmodSync, constants, copyFileSync, existsSync, lstatSync, mkdirSync, readFileSync, writeFileSync, } from "node:fs";
|
|
19
19
|
import * as path from "node:path";
|
|
20
20
|
import fg from "fast-glob";
|
|
21
21
|
import { getBranchDiagnostic, resolveActiveBranch, } from "../utils/branch-resolver.js";
|
|
22
|
-
import { ensureBranchStoreManifest } from "../utils/branch-store-locator.js";
|
|
22
|
+
import { branchStorePath, ensureBranchStoreManifest, } from "../utils/branch-store-locator.js";
|
|
23
23
|
import { defaultKbManifest, writeKbManifest } from "../utils/kb-manifest.js";
|
|
24
24
|
import { ENTITY_LANES, KB_PATHS } from "../utils/kb-paths.js";
|
|
25
25
|
import { SYMBOLS_MANIFEST_COMMENT_BLOCK } from "./sync/manifest.js";
|
|
@@ -125,15 +125,31 @@ export async function getCurrentBranch(cwd = process.cwd()) {
|
|
|
125
125
|
return result.branch;
|
|
126
126
|
}
|
|
127
127
|
export function createKbDirectoryStructure(kbDir, currentBranch) {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
128
|
+
// Preflight all directories before writing; never follow a substituted lane
|
|
129
|
+
// into another location while completing a partial installation.
|
|
130
|
+
const directories = [
|
|
131
|
+
kbDir,
|
|
132
|
+
path.join(kbDir, "schema"),
|
|
133
|
+
...ENTITY_LANES.map((lane) => path.join(kbDir, lane)),
|
|
134
|
+
path.join(kbDir, "branches"),
|
|
135
|
+
branchStorePath(path.dirname(kbDir), currentBranch),
|
|
136
|
+
];
|
|
137
|
+
for (const directory of directories) {
|
|
138
|
+
try {
|
|
139
|
+
if (!lstatSync(directory).isDirectory()) {
|
|
140
|
+
throw new Error(`Refusing to initialize non-directory or symlink: ${directory}`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
if (error.code !== "ENOENT")
|
|
145
|
+
throw error;
|
|
146
|
+
}
|
|
133
147
|
}
|
|
148
|
+
for (const directory of directories)
|
|
149
|
+
mkdirSync(directory, { recursive: true });
|
|
134
150
|
ensureBranchStoreManifest(path.dirname(kbDir), currentBranch);
|
|
135
|
-
console.log("✓
|
|
136
|
-
console.log(`✓
|
|
151
|
+
console.log("✓ Ensured .kb/ directory structure");
|
|
152
|
+
console.log(`✓ Verified hashed branch store for ${currentBranch}`);
|
|
137
153
|
}
|
|
138
154
|
export function createManifestFile(kbDir) {
|
|
139
155
|
writeKbManifest(path.dirname(kbDir), defaultKbManifest());
|
|
@@ -227,9 +243,20 @@ export async function copySchemaFiles(kbDir, schemaSourceDir) {
|
|
|
227
243
|
for (const file of schemaFiles) {
|
|
228
244
|
const sourcePath = path.join(schemaSourceDir, file);
|
|
229
245
|
const destPath = path.join(kbDir, "schema", file);
|
|
230
|
-
|
|
246
|
+
// Init completes missing schema files; existing files belong to the current
|
|
247
|
+
// installation and must not be overwritten by a repeated initialization.
|
|
248
|
+
try {
|
|
249
|
+
copyFileSync(sourcePath, destPath, constants.COPYFILE_EXCL);
|
|
250
|
+
}
|
|
251
|
+
catch (error) {
|
|
252
|
+
if (error.code !== "EEXIST")
|
|
253
|
+
throw error;
|
|
254
|
+
if (!lstatSync(destPath).isFile()) {
|
|
255
|
+
throw new Error(`Refusing non-file or symlink schema destination: ${destPath}`);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
231
258
|
}
|
|
232
|
-
console.log(`✓
|
|
259
|
+
console.log(`✓ Ensured ${schemaFiles.length} schema files`);
|
|
233
260
|
}
|
|
234
261
|
const KIBI_HOOK_BEGIN = "# BEGIN kibi-managed";
|
|
235
262
|
const KIBI_HOOK_END = "# END kibi-managed";
|
|
@@ -254,7 +281,6 @@ function hookIntegrationRecipe(hook) {
|
|
|
254
281
|
}
|
|
255
282
|
}
|
|
256
283
|
export function installHook(hookPath, content) {
|
|
257
|
-
// implements REQ-008
|
|
258
284
|
// implements REQ-git-hook-effective-install
|
|
259
285
|
const kibiSection = `${KIBI_HOOK_BEGIN}\n${content}\n${KIBI_HOOK_END}`;
|
|
260
286
|
let hookStats;
|