dsh-logicprobe 0.9.0 → 1.1.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 (63) hide show
  1. package/README.en-US.md +128 -66
  2. package/README.md +128 -66
  3. package/lib/baseline.js +142 -0
  4. package/lib/client.js +56 -1
  5. package/lib/compose-tool.js +1 -1
  6. package/lib/concurrency.js +14 -0
  7. package/lib/data-engine.js +42 -8
  8. package/lib/engine.js +3151 -2801
  9. package/lib/export-tool.js +27 -2
  10. package/lib/granularity.js +237 -0
  11. package/lib/index.js +63 -41
  12. package/lib/report-diff-tool.js +39 -0
  13. package/lib/structure-tool.js +64 -0
  14. package/lib/structure.js +648 -0
  15. package/lib/tool.js +3 -3
  16. package/lib/types/baseline.d.ts +69 -0
  17. package/lib/types/concurrency.d.ts +10 -0
  18. package/lib/types/data-engine.d.ts +13 -1
  19. package/lib/types/engine.d.ts +419 -277
  20. package/lib/types/granularity.d.ts +106 -0
  21. package/lib/types/index.d.ts +9 -8
  22. package/lib/types/report-diff-tool.d.ts +8 -0
  23. package/lib/types/structure-tool.d.ts +10 -0
  24. package/lib/types/structure.d.ts +156 -0
  25. package/lib/types/tool.d.ts +2 -2
  26. package/lib/types/uml.d.ts +89 -0
  27. package/lib/uml-tool.js +146 -104
  28. package/lib/uml.js +1748 -1544
  29. package/locale/en.json +6 -0
  30. package/locale/zh.json +6 -0
  31. package/package.json +16 -14
  32. package/skills/logicprobe/SKILL.md +84 -58
  33. package/skills/logicprobe/references/dsh-model-schema.md +102 -10
  34. package/skills/logicprobe/references/gap-routing-guide.md +37 -36
  35. package/skills/logicprobe/references/hash-spec.md +153 -0
  36. package/skills/logicprobe/references/logic-verification-guide.md +27 -250
  37. package/skills/logicprobe-concurrency/SKILL.md +43 -0
  38. package/skills/{logicprobe → logicprobe-concurrency}/references/concurrency-risk-guide.md +1 -1
  39. package/skills/logicprobe-datamodel/SKILL.md +5 -4
  40. package/skills/logicprobe-datamodel/references/data-model-guide.md +1 -1
  41. package/skills/logicprobe-datamodel/references/data-model-schema.md +1 -1
  42. package/skills/logicprobe-structure/SKILL.md +95 -0
  43. package/skills/logicprobe-structure/references/structure-review-guide.md +177 -0
  44. package/skills/logicprobe-uml/SKILL.md +57 -0
  45. package/skills/{logicprobe → logicprobe-uml}/references/uml-modeling-guide.md +121 -8
  46. package/src/baseline.ts +180 -0
  47. package/src/client.js +56 -1
  48. package/src/compose-tool.ts +47 -47
  49. package/src/concurrency.ts +23 -0
  50. package/src/data-engine.ts +51 -9
  51. package/src/engine.ts +503 -72
  52. package/src/export-tool.ts +73 -48
  53. package/src/granularity.ts +312 -0
  54. package/src/index.ts +63 -41
  55. package/src/report-diff-tool.ts +43 -0
  56. package/src/structure-tool.ts +68 -0
  57. package/src/structure.ts +724 -0
  58. package/src/tool.ts +3 -3
  59. package/src/uml-tool.ts +53 -10
  60. package/src/uml.ts +288 -24
  61. package/skills/logicprobe/references/logicprobe-engine.py +0 -4943
  62. package/skills/logicprobe/references/verification-harness.py +0 -959
  63. package/skills/logicprobe-datamodel/references/data-model-harness.py +0 -528
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Report diffing: "did this slice add findings, or remove them?"
3
+ *
4
+ * The acceptance criterion of a refactoring slice is usually *not* "zero findings" —
5
+ * it is "no NEW findings, and none of the old ones got worse". Comparing two JSON
6
+ * reports by hand is how that gets fudged, so the comparison is code.
7
+ *
8
+ * A finding's identity is its machine-readable locator, never its prose:
9
+ * `check|code|<canonical evidence + path>`. Findings that carry neither evidence nor a
10
+ * path fall back to their message, because an engine that reports nothing structured
11
+ * has nothing stabler to match on. Two runs over the same input must produce zero
12
+ * added and zero removed findings.
13
+ *
14
+ * @module logicprobe-baseline
15
+ */
16
+ import { type Finding, type Verdict, type VerdictSummary } from './engine.js';
17
+ /** A finding as it appears in any report family, after flattening. */
18
+ export interface ReportFinding extends Finding {
19
+ /** The check that emitted it (verify/datamodel: `S2`, `C1`, …); absent for flat families. */
20
+ check?: string;
21
+ }
22
+ export interface BaselineChange {
23
+ identity: string;
24
+ code: string;
25
+ before: {
26
+ severity: string;
27
+ message: string;
28
+ };
29
+ after: {
30
+ severity: string;
31
+ message: string;
32
+ };
33
+ }
34
+ export interface BaselineReport {
35
+ ok: boolean;
36
+ ran: boolean;
37
+ verdict: Verdict;
38
+ verdictReason: string;
39
+ /** The versioned report contract this result follows. */
40
+ schema: string;
41
+ /** The current report's own verdict, echoed so "no new findings" cannot hide a failing run. */
42
+ currentVerdict: Verdict;
43
+ added: ReportFinding[];
44
+ removed: ReportFinding[];
45
+ changed: BaselineChange[];
46
+ summary: {
47
+ baseline: number;
48
+ current: number;
49
+ added: number;
50
+ removed: number;
51
+ changed: number;
52
+ addedErrors: number;
53
+ addedWarnings: number;
54
+ };
55
+ nextSteps: string[];
56
+ }
57
+ /**
58
+ * The stable identity of a finding: check + file + code + a canonical locator. Prose is
59
+ * excluded so a reworded message reads as `changed`, not as a new finding.
60
+ */
61
+ export declare function findingIdentity(finding: ReportFinding): string;
62
+ /** Flatten a report of any family into one finding list (`checks[].findings` or `findings[]`). */
63
+ export declare function flattenReportFindings(report: unknown): ReportFinding[];
64
+ /**
65
+ * Compare a baseline report with the current one. The verdict describes the *delta*
66
+ * (a new error fails it), while `currentVerdict` keeps the absolute result visible.
67
+ */
68
+ export declare function diffReports(baseline: unknown, current: unknown): BaselineReport;
69
+ export type { VerdictSummary };
@@ -1,3 +1,4 @@
1
+ import { type ReportSchema, type Verdict } from './engine.js';
1
2
  export interface ConcurrencyFinding {
2
3
  code: 'CONCURRENCY_KEYWORD' | 'CONCURRENCY_ABSOLUTE_CLAIM';
3
4
  severity: 'warning' | 'error';
@@ -10,6 +11,11 @@ export interface ConcurrencyFinding {
10
11
  }
11
12
  export interface ConcurrencyScanReport {
12
13
  ok: boolean;
14
+ ran: boolean;
15
+ verdict: Verdict;
16
+ verdictReason: string;
17
+ /** The versioned report contract this result follows. */
18
+ schema: ReportSchema;
13
19
  findings: ConcurrencyFinding[];
14
20
  summary: {
15
21
  lines: number;
@@ -18,5 +24,9 @@ export interface ConcurrencyScanReport {
18
24
  warnings: number;
19
25
  errors: number;
20
26
  };
27
+ /** This scan hashes no model; the field is present so every report has the same shape. */
28
+ hashes: Record<string, string>;
29
+ /** What to do next, derived from the findings — never empty. */
30
+ nextSteps: string[];
21
31
  }
22
32
  export declare function runConcurrencyScan(text: string): ConcurrencyScanReport;
@@ -1,4 +1,4 @@
1
- import type { CheckResult } from './engine.js';
1
+ import { type CheckResult, type ReportSchema, type Verdict } from './engine.js';
2
2
  export declare const DATA_ENGINE_SCHEMA_VERSION = 1;
3
3
  export type DataValue = number | string | boolean | null;
4
4
  export type DataType = 'string' | 'integer' | 'number' | 'boolean' | 'uuid' | 'date' | 'datetime' | 'timestamp' | 'json' | 'enum' | 'array' | 'object' | 'binary';
@@ -174,9 +174,19 @@ export interface DataComparisonSummary {
174
174
  removedRelationships: string[];
175
175
  }
176
176
  export interface DataVerificationReport {
177
+ /** The engine ran and the input was well-formed enough to produce this report. Read `verdict` for the review outcome. */
177
178
  ok: boolean;
179
+ ran: boolean;
180
+ verdict: Verdict;
181
+ verdictReason: string;
182
+ /** The versioned report contract this result follows. */
183
+ schema: ReportSchema;
178
184
  schemaVersion: 1;
179
185
  modelHash: string;
186
+ /** Every hash this report carries, in one place. The data-model hash follows the same normalization as the published spec, but is not covered by it. */
187
+ hashes: {
188
+ modelHash: string;
189
+ };
180
190
  summary: {
181
191
  entities: number;
182
192
  fields: number;
@@ -187,6 +197,8 @@ export interface DataVerificationReport {
187
197
  };
188
198
  checks: CheckResult[];
189
199
  comparison?: DataComparisonSummary;
200
+ /** What to do next, derived from the findings — never empty. */
201
+ nextSteps: string[];
190
202
  }
191
203
  export declare function dataModelHash(model: DataModelV1): string;
192
204
  export declare function validateDataModel(input: unknown): {