kibi-cli 2.29.0 → 2.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/dist/cli-operation-metadata.d.ts +8 -8
  2. package/dist/cli-operation-metadata.js +8 -8
  3. package/dist/cli-register-reporting.d.ts.map +1 -1
  4. package/dist/cli-register-reporting.js +35 -2
  5. package/dist/commands/check-certificates.d.ts +52 -0
  6. package/dist/commands/check-certificates.d.ts.map +1 -0
  7. package/dist/commands/check-certificates.js +163 -0
  8. package/dist/commands/check.d.ts.map +1 -1
  9. package/dist/commands/check.js +4 -0
  10. package/dist/commands/discovery-table.d.ts.map +1 -1
  11. package/dist/commands/discovery-table.js +14 -2
  12. package/dist/commands/report.js +3 -3
  13. package/dist/commands/signoff.d.ts +37 -0
  14. package/dist/commands/signoff.d.ts.map +1 -0
  15. package/dist/commands/signoff.js +155 -0
  16. package/dist/operations/modeling/predicate-applicability.d.ts +5 -1
  17. package/dist/operations/modeling/predicate-applicability.d.ts.map +1 -1
  18. package/dist/operations/modeling/predicate-applicability.js +35 -2
  19. package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
  20. package/dist/operations/modeling/suggest-predicates.js +3 -1
  21. package/dist/operations/mutation/contradictions.d.ts +7 -5
  22. package/dist/operations/mutation/contradictions.d.ts.map +1 -1
  23. package/dist/operations/mutation/contradictions.js +8 -6
  24. package/dist/operations/mutation/source-authoring.d.ts +15 -0
  25. package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
  26. package/dist/operations/mutation/source-authoring.js +19 -7
  27. package/dist/operations/mutation/types.d.ts +5 -0
  28. package/dist/operations/mutation/types.d.ts.map +1 -1
  29. package/dist/operations/mutation/upsert.d.ts +14 -0
  30. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  31. package/dist/operations/mutation/upsert.js +42 -36
  32. package/dist/operations/mutation/validate-upsert.d.ts.map +1 -1
  33. package/dist/operations/mutation/validate-upsert.js +61 -37
  34. package/dist/operations/planning/apply-plan.js +5 -5
  35. package/dist/operations/proof/baseline-diff.d.ts +1 -1
  36. package/dist/operations/proof/baseline-diff.js +1 -1
  37. package/dist/operations/proof/impact.d.ts +10 -4
  38. package/dist/operations/proof/impact.d.ts.map +1 -1
  39. package/dist/operations/proof/impact.js +27 -7
  40. package/dist/public/diagnostic-usage.js +2 -2
  41. package/dist/public/operations/catalog.d.ts +31 -10
  42. package/dist/public/operations/catalog.d.ts.map +1 -1
  43. package/dist/public/operations/contracts.d.ts.map +1 -1
  44. package/dist/public/operations/contracts.js +2 -0
  45. package/dist/public/operations/specs/bootstrap.d.ts +1 -1
  46. package/dist/public/operations/specs/bootstrap.js +1 -1
  47. package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
  48. package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
  49. package/dist/public/operations/specs/check-rules.generated.js +3 -1
  50. package/dist/public/operations/specs/check.d.ts +1 -1
  51. package/dist/public/operations/specs/composite.d.ts +1 -1
  52. package/dist/public/operations/specs/composite.js +1 -1
  53. package/dist/public/operations/specs/discovery.d.ts +1 -1
  54. package/dist/public/operations/specs/discovery.js +1 -1
  55. package/dist/public/operations/specs/impact-review-preparation.d.ts +2 -1
  56. package/dist/public/operations/specs/impact-review-preparation.d.ts.map +1 -1
  57. package/dist/public/operations/specs/impact-review-preparation.js +2 -1
  58. package/dist/public/operations/specs/planning.d.ts +1 -1
  59. package/dist/public/operations/specs/planning.js +1 -1
  60. package/dist/public/operations/specs/reporting.d.ts +25 -5
  61. package/dist/public/operations/specs/reporting.d.ts.map +1 -1
  62. package/dist/public/operations/specs/reporting.js +102 -26
  63. package/dist/public/skills/kibi-commit-review/SKILL.md +125 -0
  64. package/dist/public/skills/kibi-commit-review/resources/staged-gate.md +98 -0
  65. package/dist/public/skills/kibi-decisions/SKILL.md +130 -0
  66. package/dist/public/skills/kibi-decisions/resources/decision-records.md +142 -0
  67. package/dist/public/skills/kibi-decisions/resources/signoff-views.md +66 -0
  68. package/dist/public/skills/kibi-freshness/SKILL.md +3 -1
  69. package/dist/public/skills/kibi-traceability/SKILL.md +4 -0
  70. package/dist/public/skills/kibi-usage/SKILL.md +21 -16
  71. package/dist/public/skills/kibi-usage/resources/proof.md +36 -4
  72. package/dist/public/skills/kibi-usage/resources/workflows.md +1 -1
  73. package/dist/report/html-report.css +11 -4
  74. package/dist/report/html-report.d.ts +2 -2
  75. package/dist/report/html-report.d.ts.map +1 -1
  76. package/dist/report/html-report.js +27 -21
  77. package/dist/report/report-view.d.ts +2 -2
  78. package/dist/report/report-view.js +2 -2
  79. package/dist/signoff/collect.d.ts +39 -0
  80. package/dist/signoff/collect.d.ts.map +1 -0
  81. package/dist/signoff/collect.js +402 -0
  82. package/dist/signoff/html.d.ts +4 -0
  83. package/dist/signoff/html.d.ts.map +1 -0
  84. package/dist/signoff/html.js +210 -0
  85. package/dist/signoff/markdown.d.ts +20 -0
  86. package/dist/signoff/markdown.d.ts.map +1 -0
  87. package/dist/signoff/markdown.js +203 -0
  88. package/dist/signoff/model.d.ts +139 -0
  89. package/dist/signoff/model.d.ts.map +1 -0
  90. package/dist/signoff/model.js +142 -0
  91. package/dist/traceability/staged-consistency.d.ts.map +1 -1
  92. package/dist/traceability/staged-consistency.js +3 -1
  93. package/dist/utils/rule-registry.generated.d.ts +10 -0
  94. package/dist/utils/rule-registry.generated.d.ts.map +1 -1
  95. package/dist/utils/rule-registry.generated.js +12 -0
  96. package/package.json +2 -2
  97. package/src/public/diagnostic-usage.ts +3 -3
  98. package/src/public/operations/contracts.ts +2 -0
  99. package/src/public/operations/specs/bootstrap.ts +1 -1
  100. package/src/public/operations/specs/check-rules.generated.ts +3 -1
  101. package/src/public/operations/specs/composite.ts +1 -1
  102. package/src/public/operations/specs/discovery.ts +1 -1
  103. package/src/public/operations/specs/impact-review-preparation.ts +3 -1
  104. package/src/public/operations/specs/planning.ts +1 -1
  105. package/src/public/operations/specs/reporting.ts +114 -26
  106. package/src/public/skills/kibi-commit-review/SKILL.md +125 -0
  107. package/src/public/skills/kibi-commit-review/resources/staged-gate.md +98 -0
  108. package/src/public/skills/kibi-decisions/SKILL.md +130 -0
  109. package/src/public/skills/kibi-decisions/resources/decision-records.md +142 -0
  110. package/src/public/skills/kibi-decisions/resources/signoff-views.md +66 -0
  111. package/src/public/skills/kibi-freshness/SKILL.md +3 -1
  112. package/src/public/skills/kibi-traceability/SKILL.md +4 -0
  113. package/src/public/skills/kibi-usage/SKILL.md +21 -16
  114. package/src/public/skills/kibi-usage/resources/proof.md +36 -4
  115. package/src/public/skills/kibi-usage/resources/workflows.md +1 -1
  116. package/templates/github/kibi-badge.yml +1 -1
@@ -31,19 +31,19 @@ export declare const CLI_OPERATION_METADATA: readonly [{
31
31
  }, {
32
32
  readonly name: "kb_status";
33
33
  readonly cliName: "status";
34
- readonly description: "Report current branch, KB snapshot, freshness metadata, schema status, and a typed kibi.migration-plan.v2 action graph. Read-only status inspection with no mutation side effects; damaged stores are diagnosed without starting the engine.";
34
+ readonly description: "Report current branch, KB snapshot, freshness metadata, schema status, and a typed kibi.migration-plan.v2 action graph. Call it first to orient on a branch or after a failed call; use kb_check for validation findings and kb_coverage for proof status. Read-only status inspection with no mutation side effects; damaged stores are diagnosed without starting the engine.";
35
35
  }, {
36
36
  readonly name: "kb_find_gaps";
37
37
  readonly cliName: "find-gaps";
38
- readonly description: "Run bulk missing/present relationship analysis over KB entities. Use for questions like which requirements lack scenarios or tests. No mutation side effects.";
38
+ readonly description: "List KB entities by the relationships they lack or have. Use for questions like which requirements lack scenarios or tests; all filters must match, and a relationship counts in either direction. Use kb_coverage instead for proof status and repair plans, and kb_check for rule violations. No mutation side effects.";
39
39
  }, {
40
40
  readonly name: "kb_coverage";
41
41
  readonly cliName: "coverage";
42
- readonly description: "Generate curated structural coverage and conservative end-to-end requirement proof reports for requirements, symbols, or grouped types. Reports include the compatible repair plan plus typed kibi.migration-plan.v2 actions; semantic and E2E actions remain review/execution work. Paginated plans identify incomplete scope and no mutation occurs.";
42
+ readonly description: "Generate curated structural coverage and conservative end-to-end requirement proof reports for requirements, symbols, or grouped types. Use it to ask which requirements are tested end to end, how strong each requirement's evidence is (evidenceLevel: proved, tested, asserted or unverified), and what blocks the rest; use kb_find_gaps for a plain list of missing links and kb_check for rule violations. Reports include the compatible repair plan plus typed kibi.migration-plan.v2 actions; semantic and E2E actions remain review/execution work. Paginated plans identify incomplete scope and no mutation occurs.";
43
43
  }, {
44
44
  readonly name: "kb_graph";
45
45
  readonly cliName: "graph";
46
- readonly description: "Run bounded graph traversal from one or more seed IDs across curated relationship types. No mutation side effects.";
46
+ readonly description: "Run bounded graph traversal from one or more seed IDs across curated relationship types and return the nodes and edges reached. Use it to follow links from IDs you already have, such as a requirement to its scenarios and tests or a symbol to the requirements it implements; use kb_query to find entities by filter and kb_search to ask a question. Traversal stops at depth, maxNodes or maxEdges and then sets truncated. No mutation side effects.";
47
47
  }, {
48
48
  readonly name: "kb_semantic_advisor";
49
49
  readonly cliName: "semantic-advisor";
@@ -59,11 +59,11 @@ export declare const CLI_OPERATION_METADATA: readonly [{
59
59
  }, {
60
60
  readonly name: "kb_model";
61
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. With requirementId, mode:predicates also returns a hash-bound plan (fact write plus requires_predicate link) for kb_apply_plan, whose contradictionAnalysis is the what-if over the current KB; other returned plans apply with kb_upsert, and kb_upsert dryRun with plannedFacts previews a requirement before its facts exist.";
62
+ readonly description: "Turn requirement prose into checkable structure without writing the KB. Use it for one requirement's prose; to plan a whole change request use kb_compile_intent. 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. With requirementId, mode:predicates also returns a hash-bound plan (fact write plus requires_predicate link) for kb_apply_plan, whose contradictionAnalysis is the what-if over the current KB; other returned plans apply with kb_upsert, and kb_upsert dryRun with plannedFacts previews a requirement before its facts exist.";
63
63
  }, {
64
64
  readonly name: "kb_plan_bootstrap";
65
65
  readonly cliName: "plan-bootstrap";
66
- readonly description: "Generate a deterministic, snapshot-bound kibi.bootstrap-plan.v1 for repository onboarding. Read-only analysis of the repository plus any declared knowledge sources and cited intent claims returns evidence, bounded context questions, exact dependency-ordered actions, a canonical plan hash, and no mutation side effects.";
66
+ readonly description: "Generate a deterministic, snapshot-bound kibi.bootstrap-plan.v1 for repository onboarding. Use it only to onboard a repository whose KB is empty or incomplete (the kibi-bootstrap skill drives it); for a change in an onboarded project use kb_compile_intent. Read-only analysis of the repository plus any declared knowledge sources and cited intent claims returns evidence, bounded context questions, exact dependency-ordered actions, a canonical plan hash, and no mutation side effects.";
67
67
  }, {
68
68
  readonly name: "kb_validate_upsert";
69
69
  readonly cliName: "validate-upsert";
@@ -83,7 +83,7 @@ export declare const CLI_OPERATION_METADATA: readonly [{
83
83
  }, {
84
84
  readonly name: "kb_prepare_impact_review";
85
85
  readonly cliName: "prepare-impact-review";
86
- readonly description: "Prepare complete content-bound impact-review authoring inputs from the current staged snapshot or explicitly selected immutable Git commits. Returns strict reviewer schemas and an unauthored template; it does not decide, approve, sign, stage, or prove the review.";
86
+ readonly description: "Prepare complete content-bound impact-review authoring inputs from the current staged snapshot or explicitly selected immutable Git commits. Use it when kb_check reports that changed files need an impact review; it does not plan KB changes. Returns strict reviewer schemas and an unauthored template; it does not decide, approve, sign, stage, or prove the review.";
87
87
  }, {
88
88
  readonly name: "kb_sparql_remote";
89
89
  readonly cliName: "sparql-remote";
@@ -91,7 +91,7 @@ export declare const CLI_OPERATION_METADATA: readonly [{
91
91
  }, {
92
92
  readonly name: "kb_compile_intent";
93
93
  readonly cliName: "compile-intent";
94
- readonly description: "Compile complete change intent into a deterministic, snapshot-bound read-only plan. Reuses intent-aware discovery and semantic modeling, accounts for every proposition, reports contradiction witnesses, proposes traceability links, and emits dependency-ordered kb_upsert-style steps only for resolved typed claims. contradictionAnalysis.outcome is no_conflict only when the check could decide: an unmodeled proposition or a related current requirement without logic leaves it unresolved with reasons and reviewCandidates to compare and judge through conflictReviews. No mutation side effects.";
94
+ readonly description: "Compile complete change intent into a deterministic, snapshot-bound read-only plan. Use it before editing code for a change request that may touch several requirements; use kb_model for one requirement's prose and kb_plan_bootstrap for first-time onboarding. Reuses intent-aware discovery and semantic modeling, accounts for every proposition, reports contradiction witnesses, proposes traceability links, and emits dependency-ordered kb_upsert-style steps only for resolved typed claims. contradictionAnalysis.outcome is no_conflict only when the check could decide: an unmodeled proposition or a related current requirement without logic leaves it unresolved with reasons and reviewCandidates to compare and judge through conflictReviews. No mutation side effects.";
95
95
  }, {
96
96
  readonly name: "kb_apply_plan";
97
97
  readonly cliName: "apply-plan";
@@ -35,22 +35,22 @@ export const CLI_OPERATION_METADATA = [
35
35
  {
36
36
  name: "kb_status",
37
37
  cliName: "status",
38
- description: "Report current branch, KB snapshot, freshness metadata, schema status, and a typed kibi.migration-plan.v2 action graph. Read-only status inspection with no mutation side effects; damaged stores are diagnosed without starting the engine.",
38
+ description: "Report current branch, KB snapshot, freshness metadata, schema status, and a typed kibi.migration-plan.v2 action graph. Call it first to orient on a branch or after a failed call; use kb_check for validation findings and kb_coverage for proof status. Read-only status inspection with no mutation side effects; damaged stores are diagnosed without starting the engine.",
39
39
  },
40
40
  {
41
41
  name: "kb_find_gaps",
42
42
  cliName: "find-gaps",
43
- description: "Run bulk missing/present relationship analysis over KB entities. Use for questions like which requirements lack scenarios or tests. No mutation side effects.",
43
+ description: "List KB entities by the relationships they lack or have. Use for questions like which requirements lack scenarios or tests; all filters must match, and a relationship counts in either direction. Use kb_coverage instead for proof status and repair plans, and kb_check for rule violations. No mutation side effects.",
44
44
  },
45
45
  {
46
46
  name: "kb_coverage",
47
47
  cliName: "coverage",
48
- description: "Generate curated structural coverage and conservative end-to-end requirement proof reports for requirements, symbols, or grouped types. Reports include the compatible repair plan plus typed kibi.migration-plan.v2 actions; semantic and E2E actions remain review/execution work. Paginated plans identify incomplete scope and no mutation occurs.",
48
+ description: "Generate curated structural coverage and conservative end-to-end requirement proof reports for requirements, symbols, or grouped types. Use it to ask which requirements are tested end to end, how strong each requirement's evidence is (evidenceLevel: proved, tested, asserted or unverified), and what blocks the rest; use kb_find_gaps for a plain list of missing links and kb_check for rule violations. Reports include the compatible repair plan plus typed kibi.migration-plan.v2 actions; semantic and E2E actions remain review/execution work. Paginated plans identify incomplete scope and no mutation occurs.",
49
49
  },
50
50
  {
51
51
  name: "kb_graph",
52
52
  cliName: "graph",
53
- description: "Run bounded graph traversal from one or more seed IDs across curated relationship types. No mutation side effects.",
53
+ description: "Run bounded graph traversal from one or more seed IDs across curated relationship types and return the nodes and edges reached. Use it to follow links from IDs you already have, such as a requirement to its scenarios and tests or a symbol to the requirements it implements; use kb_query to find entities by filter and kb_search to ask a question. Traversal stops at depth, maxNodes or maxEdges and then sets truncated. No mutation side effects.",
54
54
  },
55
55
  {
56
56
  name: "kb_semantic_advisor",
@@ -70,12 +70,12 @@ export const CLI_OPERATION_METADATA = [
70
70
  {
71
71
  name: "kb_model",
72
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. With requirementId, mode:predicates also returns a hash-bound plan (fact write plus requires_predicate link) for kb_apply_plan, whose contradictionAnalysis is the what-if over the current KB; other returned plans apply with kb_upsert, and kb_upsert dryRun with plannedFacts previews a requirement before its facts exist.",
73
+ description: "Turn requirement prose into checkable structure without writing the KB. Use it for one requirement's prose; to plan a whole change request use kb_compile_intent. 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. With requirementId, mode:predicates also returns a hash-bound plan (fact write plus requires_predicate link) for kb_apply_plan, whose contradictionAnalysis is the what-if over the current KB; other returned plans apply with kb_upsert, and kb_upsert dryRun with plannedFacts previews a requirement before its facts exist.",
74
74
  },
75
75
  {
76
76
  name: "kb_plan_bootstrap",
77
77
  cliName: "plan-bootstrap",
78
- description: "Generate a deterministic, snapshot-bound kibi.bootstrap-plan.v1 for repository onboarding. Read-only analysis of the repository plus any declared knowledge sources and cited intent claims returns evidence, bounded context questions, exact dependency-ordered actions, a canonical plan hash, and no mutation side effects.",
78
+ description: "Generate a deterministic, snapshot-bound kibi.bootstrap-plan.v1 for repository onboarding. Use it only to onboard a repository whose KB is empty or incomplete (the kibi-bootstrap skill drives it); for a change in an onboarded project use kb_compile_intent. Read-only analysis of the repository plus any declared knowledge sources and cited intent claims returns evidence, bounded context questions, exact dependency-ordered actions, a canonical plan hash, and no mutation side effects.",
79
79
  },
80
80
  {
81
81
  name: "kb_validate_upsert",
@@ -100,7 +100,7 @@ export const CLI_OPERATION_METADATA = [
100
100
  {
101
101
  name: "kb_prepare_impact_review",
102
102
  cliName: "prepare-impact-review",
103
- description: "Prepare complete content-bound impact-review authoring inputs from the current staged snapshot or explicitly selected immutable Git commits. Returns strict reviewer schemas and an unauthored template; it does not decide, approve, sign, stage, or prove the review.",
103
+ description: "Prepare complete content-bound impact-review authoring inputs from the current staged snapshot or explicitly selected immutable Git commits. Use it when kb_check reports that changed files need an impact review; it does not plan KB changes. Returns strict reviewer schemas and an unauthored template; it does not decide, approve, sign, stage, or prove the review.",
104
104
  },
105
105
  {
106
106
  name: "kb_sparql_remote",
@@ -110,7 +110,7 @@ export const CLI_OPERATION_METADATA = [
110
110
  {
111
111
  name: "kb_compile_intent",
112
112
  cliName: "compile-intent",
113
- description: "Compile complete change intent into a deterministic, snapshot-bound read-only plan. Reuses intent-aware discovery and semantic modeling, accounts for every proposition, reports contradiction witnesses, proposes traceability links, and emits dependency-ordered kb_upsert-style steps only for resolved typed claims. contradictionAnalysis.outcome is no_conflict only when the check could decide: an unmodeled proposition or a related current requirement without logic leaves it unresolved with reasons and reviewCandidates to compare and judge through conflictReviews. No mutation side effects.",
113
+ description: "Compile complete change intent into a deterministic, snapshot-bound read-only plan. Use it before editing code for a change request that may touch several requirements; use kb_model for one requirement's prose and kb_plan_bootstrap for first-time onboarding. Reuses intent-aware discovery and semantic modeling, accounts for every proposition, reports contradiction witnesses, proposes traceability links, and emits dependency-ordered kb_upsert-style steps only for resolved typed claims. contradictionAnalysis.outcome is no_conflict only when the check could decide: an unmodeled proposition or a related current requirement without logic leaves it unresolved with reasons and reviewCandidates to compare and judge through conflictReviews. No mutation side effects.",
114
114
  },
115
115
  {
116
116
  name: "kb_apply_plan",
@@ -1 +1 @@
1
- {"version":3,"file":"cli-register-reporting.d.ts","sourceRoot":"","sources":["../src/cli-register-reporting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYzC,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAsMhE"}
1
+ {"version":3,"file":"cli-register-reporting.d.ts","sourceRoot":"","sources":["../src/cli-register-reporting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYzC,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA+QhE"}
@@ -46,6 +46,18 @@ export function registerReportingCommands(program) {
46
46
  .action(async (options) => {
47
47
  await (await import("./commands/report.js")).reportCommand(options);
48
48
  });
49
+ program
50
+ .command("signoff")
51
+ .description("Show the requirements a change adds, rewrites or affects (or, with --questions, the decisions waiting for the person) as chat Markdown, a fenced block for host renderers, an HTML page or JSON for signoff")
52
+ .option("--staged", "Summarize staged changes instead of the working tree", false)
53
+ .option("--questions <path>", 'Render decision questions from a JSON file (use - for stdin): {"questions":[{"statement":"...","quote":"...","firmness":"firm"}]}')
54
+ .option("--format <format>", "Output format: chat (plain Markdown for a reply) | md (fenced block for host renderers) | html | json; default chat, or KIBI_SIGNOFF_FORMAT")
55
+ .option("--output <path>", "HTML file to write (default .kb/briefs/signoff/latest.html)")
56
+ .option("--open", "Open the HTML page in the default browser", false)
57
+ .option("--no-proof", "Skip the proof-state lookup (faster; no Prolog)")
58
+ .action(async (options) => {
59
+ await (await import("./commands/signoff.js")).signoffCommand(options);
60
+ });
49
61
  program
50
62
  .command("coverage")
51
63
  .description(getCliOperationMetadata("kb_coverage").description)
@@ -53,7 +65,7 @@ export function registerReportingCommands(program) {
53
65
  .option("--by <group>", "Coverage mode: req|symbol|type", "req")
54
66
  .option("--tag <tags>", "Comma-separated tag filter")
55
67
  .option("--include-passing", "Include passing rows", false)
56
- .option("--status <statuses>", "Comma-separated requirement proof-status filter (proven, missing, unresolved, not_applicable); implies include-passing")
68
+ .option("--status <statuses>", "Comma-separated requirement proof-status filter (tested, missing, unresolved, not_applicable); implies include-passing")
57
69
  .option("--no-include-transitive", "Disable transitive symbol coverage")
58
70
  .option("--limit <n>", "Limit results", "100")
59
71
  .option("--offset <n>", "Skip results", "0")
@@ -108,6 +120,8 @@ export function registerReportingCommands(program) {
108
120
  .option("--min-links <n>", "Minimum number of links required for symbol coverage", "1")
109
121
  .option("--dry-run", "Do not modify files; only print what would happen")
110
122
  .option("--format <format>", "Output format: text|json", "text")
123
+ .option("--write-certificates <file>", "Also save the kibi.certificates.v1 bundle the kb-consistency rule re-checked")
124
+ .option("--certificates <file>", "Only re-check a saved kibi.certificates.v1 bundle against the current KB with the independent checker")
111
125
  .action(withExitCode(async (options, command) => {
112
126
  if (options.input !== undefined) {
113
127
  await runJsonInvocation({
@@ -117,7 +131,26 @@ export function registerReportingCommands(program) {
117
131
  });
118
132
  return undefined;
119
133
  }
120
- return (await import("./commands/check.js")).checkCommand(options);
134
+ // implements REQ-kibi-kb-certificates
135
+ if (options.certificates !== undefined) {
136
+ if (options.writeCertificates !== undefined ||
137
+ options.staged ||
138
+ options.rules !== undefined)
139
+ throw new Error("check: --certificates only re-checks a saved bundle; it cannot be combined with --write-certificates, --staged or --rules");
140
+ return (await import("./commands/check-certificates.js")).checkCertificatesCommand({
141
+ certificates: options.certificates,
142
+ json: options.format === "json",
143
+ });
144
+ }
145
+ if (options.writeCertificates !== undefined && options.staged)
146
+ throw new Error("check: --write-certificates saves the full KB's bundle; it cannot be combined with --staged");
147
+ const { writeCertificates, ...checkOptions } = options;
148
+ const result = await (await import("./commands/check.js")).checkCommand(checkOptions);
149
+ if (writeCertificates !== undefined) {
150
+ const saved = await (await import("./commands/check-certificates.js")).writeCertificates(writeCertificates);
151
+ process.stderr.write(`Saved ${saved.certificates} certificate(s) to ${saved.path}\n`);
152
+ }
153
+ return result;
121
154
  }));
122
155
  program
123
156
  .command("check-diff")
@@ -0,0 +1,52 @@
1
+ import type { OperationContext } from "../public/operations/runtime-types.js";
2
+ type TheoremReport = Readonly<{
3
+ theorem: string;
4
+ verdict: "proved" | "disproved" | "unresolved";
5
+ groups?: number;
6
+ models?: number;
7
+ contradictions?: readonly unknown[];
8
+ unresolved?: readonly unknown[];
9
+ predicates?: number;
10
+ edges?: number;
11
+ }>;
12
+ type RejectedCertificate = Readonly<{
13
+ certificate: number;
14
+ kind: string;
15
+ reason: string;
16
+ group?: unknown;
17
+ }>;
18
+ export type VerificationReport = Readonly<{
19
+ version: string;
20
+ status: "verified" | "rejected";
21
+ certificates: number;
22
+ verified: number;
23
+ rejected: readonly RejectedCertificate[];
24
+ theorems: readonly TheoremReport[];
25
+ notCovered: readonly string[];
26
+ }>;
27
+ /**
28
+ * The exit code for re-checking a saved bundle: 0 only when every certificate
29
+ * re-verifies and no theorem is disproved. An unresolved theorem does not
30
+ * fail the run; it is reported and never counts as proved.
31
+ */
32
+ export declare function certificatesExitCode(report: VerificationReport): 0 | 1;
33
+ export declare function renderVerification(report: VerificationReport): string;
34
+ /** Re-check a saved kibi.certificates.v1 bundle against the current KB. */
35
+ export declare function recheckCertificates(bundlePath: string, context: OperationContext): Promise<VerificationReport>;
36
+ /** `kibi check --certificates <file>`: print the re-check report. */
37
+ export declare function checkCertificatesCommand(options: {
38
+ certificates: string;
39
+ json?: boolean;
40
+ }): Promise<{
41
+ exitCode: number;
42
+ }>;
43
+ /**
44
+ * `kibi check --write-certificates <file>`: save the bundle the
45
+ * kb-consistency rule re-checked, so another checker can re-check it.
46
+ */
47
+ export declare function writeCertificates(bundlePath: string): Promise<{
48
+ path: string;
49
+ certificates: number;
50
+ }>;
51
+ export {};
52
+ //# sourceMappingURL=check-certificates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-certificates.d.ts","sourceRoot":"","sources":["../../src/commands/check-certificates.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAG9E,KAAK,aAAa,GAAG,QAAQ,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,QAAQ,GAAG,WAAW,GAAG,YAAY,CAAC;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IACpC,UA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MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC,CAUD"}
@@ -0,0 +1,163 @@
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
+ import { existsSync, readFileSync } from "node:fs";
11
+ import path from "node:path";
12
+ import { escapeAtom } from "../prolog/codec.js";
13
+ import { runOperationJsonQuery } from "../public/operations/prolog-json.js";
14
+ import { createCliRuntime } from "../runtime/cli-runtime.js";
15
+ const THEOREM_LABELS = {
16
+ properties_consistent: "Property facts are consistent",
17
+ predicates_consistent: "Predicate facts are consistent",
18
+ decisions_consistent: "Allow/deny decisions are consistent",
19
+ rules_stratified: "Stored rules are stratified",
20
+ };
21
+ const NOT_COVERED_LABELS = {
22
+ rule_conflicts: "opposing rule pairs (kibi check domain-contradictions)",
23
+ scenario_feasibility: "scenario feasibility (kibi check scenario-feasibility)",
24
+ };
25
+ function assertReadableBundle(filePath) {
26
+ if (!existsSync(filePath)) {
27
+ throw new Error(`check: no certificate bundle at ${filePath}`);
28
+ }
29
+ try {
30
+ JSON.parse(readFileSync(filePath, "utf8"));
31
+ }
32
+ catch {
33
+ throw new Error(`check: ${filePath} is not valid JSON`);
34
+ }
35
+ }
36
+ function prologPath(filePath) {
37
+ return escapeAtom(path.resolve(filePath).replaceAll("\\", "/"));
38
+ }
39
+ // implements REQ-kibi-kb-certificates
40
+ /**
41
+ * The exit code for re-checking a saved bundle: 0 only when every certificate
42
+ * re-verifies and no theorem is disproved. An unresolved theorem does not
43
+ * fail the run; it is reported and never counts as proved.
44
+ */
45
+ export function certificatesExitCode(report) {
46
+ if (report.status !== "verified")
47
+ return 1;
48
+ return report.theorems.some((theorem) => theorem.verdict === "disproved")
49
+ ? 1
50
+ : 0;
51
+ }
52
+ function describeGroup(entry) {
53
+ if (entry === null || typeof entry !== "object")
54
+ return String(entry);
55
+ const record = entry;
56
+ if (typeof record.subjectKey === "string") {
57
+ const scope = typeof record.scope === "string" && record.scope !== ""
58
+ ? ` (scope ${record.scope})`
59
+ : "";
60
+ const reason = typeof record.reason === "string" ? `: ${record.reason}` : "";
61
+ return `${record.subjectKey}.${String(record.propertyKey)}${scope}${reason}`;
62
+ }
63
+ if (typeof record.name === "string") {
64
+ const args = Array.isArray(record.args)
65
+ ? record.args
66
+ : Array.isArray(record.key)
67
+ ? record.key
68
+ : [];
69
+ const reason = typeof record.reason === "string" ? `: ${record.reason}` : "";
70
+ return `${String(record.namespace)}:${record.name}(${args.join(", ")})${reason}`;
71
+ }
72
+ return JSON.stringify(entry);
73
+ }
74
+ // implements REQ-kibi-kb-certificates
75
+ export function renderVerification(report) {
76
+ const lines = [];
77
+ lines.push(report.status === "verified"
78
+ ? `Kibi certificates: all ${report.certificates} re-verified`
79
+ : `Kibi certificates: ${report.rejected.length} problem(s); ${report.verified} of ${report.certificates} certificates re-verified`);
80
+ lines.push("");
81
+ for (const theorem of report.theorems) {
82
+ const label = THEOREM_LABELS[theorem.theorem] ?? theorem.theorem;
83
+ const detail = theorem.theorem === "rules_stratified"
84
+ ? `${theorem.predicates ?? 0} predicates, ${theorem.edges ?? 0} dependencies`
85
+ : (theorem.groups ?? 0) === 0
86
+ ? "no facts of this kind"
87
+ : `${theorem.models ?? 0} of ${theorem.groups ?? 0} groups have a model`;
88
+ lines.push(`- ${label}: ${theorem.verdict} (${detail})`);
89
+ for (const contradiction of theorem.contradictions ?? []) {
90
+ lines.push(` contradiction: ${describeGroup(contradiction)}`);
91
+ }
92
+ for (const unresolved of theorem.unresolved ?? []) {
93
+ lines.push(` unresolved: ${describeGroup(unresolved)}`);
94
+ }
95
+ }
96
+ if (report.rejected.length > 0) {
97
+ lines.push("");
98
+ lines.push("Rejected:");
99
+ for (const rejected of report.rejected) {
100
+ const where = rejected.certificate > 0
101
+ ? `certificate ${rejected.certificate} (${rejected.kind})`
102
+ : describeGroup(rejected.group ?? rejected.kind);
103
+ lines.push(`- ${where}: ${rejected.reason}`);
104
+ }
105
+ }
106
+ if (report.notCovered.length > 0) {
107
+ lines.push("");
108
+ lines.push(`Not certified yet: ${report.notCovered
109
+ .map((name) => NOT_COVERED_LABELS[name] ?? name)
110
+ .join("; ")}`);
111
+ }
112
+ return `${lines.join("\n")}\n`;
113
+ }
114
+ async function withEngine(run) {
115
+ const runtime = createCliRuntime();
116
+ const context = await runtime.open({
117
+ name: "kibi_check_certificates",
118
+ effects: [],
119
+ requiresProlog: true,
120
+ execute: async () => undefined,
121
+ }, {});
122
+ let completed = false;
123
+ try {
124
+ const result = await run(context);
125
+ completed = true;
126
+ return result;
127
+ }
128
+ finally {
129
+ await runtime.close(context, completed
130
+ ? { status: "success", result: 0 }
131
+ : { status: "error", error: 1 });
132
+ }
133
+ }
134
+ function prologOf(context) {
135
+ if (context.prolog === undefined) {
136
+ throw new Error("check: the Kibi engine is not available");
137
+ }
138
+ return context.prolog;
139
+ }
140
+ // implements REQ-kibi-kb-certificates
141
+ /** Re-check a saved kibi.certificates.v1 bundle against the current KB. */
142
+ export async function recheckCertificates(bundlePath, context) {
143
+ assertReadableBundle(bundlePath);
144
+ return await runOperationJsonQuery(prologOf(context), "certificate_check.pl", `certificate_check:kb_verify_certificates_file('${prologPath(bundlePath)}', JsonString)`, "Certificate verification");
145
+ }
146
+ // implements REQ-kibi-kb-certificates
147
+ /** `kibi check --certificates <file>`: print the re-check report. */
148
+ export async function checkCertificatesCommand(options) {
149
+ const report = await withEngine((context) => recheckCertificates(options.certificates, context));
150
+ process.stdout.write(options.json
151
+ ? `${JSON.stringify(report, null, 2)}\n`
152
+ : renderVerification(report));
153
+ return { exitCode: certificatesExitCode(report) };
154
+ }
155
+ // implements REQ-kibi-kb-certificates
156
+ /**
157
+ * `kibi check --write-certificates <file>`: save the bundle the
158
+ * kb-consistency rule re-checked, so another checker can re-check it.
159
+ */
160
+ export async function writeCertificates(bundlePath) {
161
+ const target = path.resolve(bundlePath);
162
+ return await withEngine((context) => runOperationJsonQuery(prologOf(context), "certificates.pl", `certificates:kb_write_certificates('${prologPath(target)}', JsonString)`, "Certificate generation"));
163
+ }
@@ -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;AAoF7C,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;AA6hBD,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,CA0rB/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,E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BAAsB,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"}
@@ -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 { nodeGit } from "../public/operations/node-ports.js";
28
29
  import { refreshDetachedSnapshot } from "../runtime/detached-snapshot.js";
29
30
  import { amendsRootCommit } from "../traceability/commit-amend.js";
30
31
  import { KIBI_NO_IMPACT_DECLARATION, KIBI_SYMBOLS_MANIFEST_PATH, KIBI_SYMBOL_COORDINATES_PATH, } from "../traceability/evidence-model.js";
@@ -930,6 +931,9 @@ export async function checkCommand(options) {
930
931
  workspaceRoot: process.cwd(),
931
932
  signal: new AbortController().signal,
932
933
  clock: () => new Date(),
934
+ // The workspace snapshot lets quality diagnostics read the same
935
+ // proof receipt evidence as kibi coverage.
936
+ git: nodeGit,
933
937
  prolog: {
934
938
  query: (goal) => activeProlog.query(goal),
935
939
  ...(activeProlog instanceof EngineClient
@@ -1 +1 @@
1
- {"version":3,"file":"discovery-table.d.ts","sourceRoot":"","sources":["../../src/commands/discovery-table.ts"],"names":[],"mappings":"AAIA,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAmCvE;AA4ED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACzC,MAAM,CA4ER"}
1
+ {"version":3,"file":"discovery-table.d.ts","sourceRoot":"","sources":["../../src/commands/discovery-table.ts"],"names":[],"mappings":"AAIA,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAmCvE;AA4ED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACzC,MAAM,CA+ER"}
@@ -87,9 +87,10 @@ export function renderCoverageTable(payload) {
87
87
  const summaryTable = new Table({
88
88
  head: ["Metric", "Value"],
89
89
  colWidths: [24, 16],
90
+ wordWrap: true,
90
91
  });
91
92
  for (const [key, value] of Object.entries(summary)) {
92
- summaryTable.push([key, stringifyCell(value)]);
93
+ summaryTable.push([key, summaryCell(value)]);
93
94
  }
94
95
  const firstRow = firstFields(rows);
95
96
  const isRequirementCoverage = firstRow !== undefined && Object.hasOwn(firstRow, "scenarioCount");
@@ -102,13 +103,14 @@ export function renderCoverageTable(payload) {
102
103
  "Coverage",
103
104
  "Depth",
104
105
  "Proof",
106
+ "Evidence",
105
107
  "Scen",
106
108
  "Tests",
107
109
  "Symbols",
108
110
  "Structural gaps",
109
111
  "Proof gaps",
110
112
  ],
111
- colWidths: [20, 12, 12, 18, 36, 12, 8, 8, 10, 24, 36],
113
+ colWidths: [20, 12, 12, 18, 36, 12, 12, 8, 8, 10, 24, 36],
112
114
  wordWrap: true,
113
115
  })
114
116
  : new Table({
@@ -126,6 +128,7 @@ export function renderCoverageTable(payload) {
126
128
  stringifyCell(item.coverageStatus),
127
129
  stringifyCell(item.coverageDepth),
128
130
  stringifyCell(item.proofStatus),
131
+ stringifyCell(item.evidenceLevel),
129
132
  stringifyCell(item.scenarioCount),
130
133
  stringifyCell(item.testCount),
131
134
  stringifyCell(item.transitiveSymbolCount),
@@ -287,6 +290,15 @@ function stringifyCell(value) {
287
290
  }
288
291
  return String(value);
289
292
  }
293
+ // A nested summary count, such as evidenceLevels, reads as key=value pairs.
294
+ function summaryCell(value) {
295
+ if (value !== null && typeof value === "object" && !Array.isArray(value)) {
296
+ return Object.entries(value)
297
+ .map(([key, count]) => `${key}=${stringifyCell(count)}`)
298
+ .join(" ");
299
+ }
300
+ return stringifyCell(value);
301
+ }
290
302
  function joinCells(value) {
291
303
  if (!Array.isArray(value) || value.length === 0) {
292
304
  return "-";
@@ -170,16 +170,16 @@ export async function reportCommand(options, deps = {}) {
170
170
  const summary = coverage.requirements.summary;
171
171
  const total = Number(summary.total ?? 0);
172
172
  const notApplicable = Number(summary.proofNotApplicable ?? 0);
173
- const proven = Number(summary.proofProven ?? 0);
173
+ const tested = Number(summary.proofTested ?? 0);
174
174
  const currentRequirements = Math.max(0, total - notApplicable);
175
175
  const proofPercent = currentRequirements === 0
176
176
  ? 0
177
- : Math.round((proven / currentRequirements) * 100);
177
+ : Math.round((tested / currentRequirements) * 100);
178
178
  const hasContradiction = coverage.requirements.rows.some((row) => Array.isArray(row.proofGaps) &&
179
179
  row.proofGaps.includes("blocking_contradiction"));
180
180
  const snapshotStale = coverage.requirements.meta?.dirty === true ||
181
181
  coverage.requirements.meta?.proofSnapshotDirty === true;
182
- const badgeMessage = currentRequirements === 0 ? "no requirements" : `${proofPercent}% proven`;
182
+ const badgeMessage = currentRequirements === 0 ? "no requirements" : `${proofPercent}% tested`;
183
183
  const badgeColor = currentRequirements === 0
184
184
  ? KIBI_BRAND.rail
185
185
  : hasContradiction
@@ -0,0 +1,37 @@
1
+ import { type SignoffCollectDeps } from "../signoff/collect.js";
2
+ import { type SignoffView } from "../signoff/model.js";
3
+ export type SignoffOptions = Readonly<{
4
+ staged?: boolean;
5
+ questions?: string;
6
+ format?: string;
7
+ output?: string;
8
+ open?: boolean;
9
+ proof?: boolean;
10
+ }>;
11
+ export type SignoffCommandDeps = SignoffCollectDeps & Readonly<{
12
+ cwd?: () => string;
13
+ readStdin?: () => string;
14
+ write?: (text: string) => void;
15
+ writeNote?: (text: string) => void;
16
+ env?: NodeJS.ProcessEnv;
17
+ openReport?: (filePath: string) => Promise<void>;
18
+ }>;
19
+ /** Sets the default signoff format for a host (`chat`, `md`, `html`, `json`). */
20
+ export declare const SIGNOFF_FORMAT_ENV = "KIBI_SIGNOFF_FORMAT";
21
+ /**
22
+ * The format `kibi signoff` prints when `--format` is not given. A fenced
23
+ * block only helps where a host renderer draws it (the OpenCode TUI, which
24
+ * sets KIBI_SIGNOFF_FORMAT=md for its shell); every other host renders
25
+ * assistant or message Markdown directly and shows a fence as code, so the
26
+ * default is the unfenced `chat` Markdown.
27
+ */
28
+ export declare function defaultSignoffFormat(env: NodeJS.ProcessEnv): string;
29
+ /**
30
+ * `kibi signoff`: print the requirements signoff view for the current change
31
+ * (or, with `--questions`, the decisions the agent asks the person to
32
+ * confirm) as chat Markdown, a fenced Markdown block, HTML or JSON, and keep the latest view
33
+ * in `.kb/briefs/signoff/` (latest.json, latest.md, latest.html) for editor
34
+ * plugins.
35
+ */
36
+ export declare function signoffCommand(options: SignoffOptions, deps?: SignoffCommandDeps): Promise<SignoffView>;
37
+ //# sourceMappingURL=signoff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signoff.d.ts","sourceRoot":"","sources":["../../src/commands/signoff.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,EAKL,KAAK,WAAW,EACjB,MAAM,qBAAqB,CAAC;AAG7B,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC,CAAC;AAGH,MAAM,MAAM,kB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