dsh-logicprobe 0.9.0 → 1.0.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.
- package/README.en-US.md +79 -14
- package/README.md +79 -14
- package/lib/baseline.js +142 -0
- package/lib/client.js +56 -1
- package/lib/compose-tool.js +1 -1
- package/lib/concurrency.js +14 -0
- package/lib/data-engine.js +42 -8
- package/lib/engine.js +379 -79
- package/lib/export-tool.js +27 -2
- package/lib/granularity.js +237 -0
- package/lib/index.js +63 -41
- package/lib/report-diff-tool.js +39 -0
- package/lib/structure-tool.js +64 -0
- package/lib/structure.js +648 -0
- package/lib/tool.js +3 -3
- package/lib/types/baseline.d.ts +69 -0
- package/lib/types/concurrency.d.ts +10 -0
- package/lib/types/data-engine.d.ts +13 -1
- package/lib/types/engine.d.ts +138 -1
- package/lib/types/granularity.d.ts +106 -0
- package/lib/types/index.d.ts +9 -8
- package/lib/types/report-diff-tool.d.ts +8 -0
- package/lib/types/structure-tool.d.ts +10 -0
- package/lib/types/structure.d.ts +156 -0
- package/lib/types/tool.d.ts +2 -2
- package/lib/types/uml.d.ts +89 -0
- package/lib/uml-tool.js +36 -7
- package/lib/uml.js +217 -23
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +16 -14
- package/skills/logicprobe/SKILL.md +84 -58
- package/skills/logicprobe/references/dsh-model-schema.md +81 -10
- package/skills/logicprobe/references/gap-routing-guide.md +37 -36
- package/skills/logicprobe/references/hash-spec.md +128 -0
- package/skills/logicprobe/references/logic-verification-guide.md +27 -250
- package/skills/logicprobe-concurrency/SKILL.md +43 -0
- package/skills/{logicprobe → logicprobe-concurrency}/references/concurrency-risk-guide.md +1 -1
- package/skills/logicprobe-datamodel/SKILL.md +5 -4
- package/skills/logicprobe-datamodel/references/data-model-guide.md +1 -1
- package/skills/logicprobe-datamodel/references/data-model-schema.md +1 -1
- package/skills/logicprobe-structure/SKILL.md +95 -0
- package/skills/logicprobe-structure/references/structure-review-guide.md +177 -0
- package/skills/logicprobe-uml/SKILL.md +55 -0
- package/skills/{logicprobe → logicprobe-uml}/references/uml-modeling-guide.md +120 -8
- package/src/baseline.ts +180 -0
- package/src/client.js +56 -1
- package/src/compose-tool.ts +47 -47
- package/src/concurrency.ts +23 -0
- package/src/data-engine.ts +51 -9
- package/src/engine.ts +441 -67
- package/src/export-tool.ts +73 -48
- package/src/granularity.ts +312 -0
- package/src/index.ts +63 -41
- package/src/report-diff-tool.ts +43 -0
- package/src/structure-tool.ts +68 -0
- package/src/structure.ts +724 -0
- package/src/tool.ts +3 -3
- package/src/uml-tool.ts +38 -8
- package/src/uml.ts +275 -24
- package/skills/logicprobe/references/logicprobe-engine.py +0 -4943
- package/skills/logicprobe/references/verification-harness.py +0 -959
- package/skills/logicprobe-datamodel/references/data-model-harness.py +0 -528
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { defineTool } from '@deepseek-ai/dsh-tools'
|
|
2
|
+
import type { JsonValue } from './json-value.js'
|
|
3
|
+
import { diffReports } from './baseline.js'
|
|
4
|
+
|
|
5
|
+
export const LOGICPROBE_REPORT_DIFF_TOOL_NAME = 'logicprobe_report_diff'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Model-visible DSH tool that compares two reports of the same family — the accepted
|
|
9
|
+
* "violations must not increase" acceptance criterion, computed instead of eyeballed.
|
|
10
|
+
* A finding's identity is its check + code + machine-readable locator, so a reworded
|
|
11
|
+
* message reads as `changed`, and two runs over the same input add nothing.
|
|
12
|
+
*/
|
|
13
|
+
export const logicProbeReportDiffTool = defineTool({
|
|
14
|
+
name: LOGICPROBE_REPORT_DIFF_TOOL_NAME,
|
|
15
|
+
description:
|
|
16
|
+
'Compare two logicprobe reports of the same family: `baseline` (earlier) against `current` (newer). Use it to accept a slice by "no new findings". Findings match on a stable identity: check id, code, and a locator built from `evidence` and `path`. Reworded prose counts as `changed`, not as new. Returns added, removed and changed findings, plus `summary`. The `verdict` is about the delta: a newly added error finding fails it. `currentVerdict` keeps the run\'s own verdict, so a clean delta over a failing report still shows as failing. Two runs over the same input add nothing.',
|
|
17
|
+
parameters: {
|
|
18
|
+
baseline: {
|
|
19
|
+
type: 'json',
|
|
20
|
+
required: true,
|
|
21
|
+
description: 'The earlier report (any family: verify, compose, datamodel, uml review, structure, concurrency).',
|
|
22
|
+
},
|
|
23
|
+
current: {
|
|
24
|
+
type: 'json',
|
|
25
|
+
required: true,
|
|
26
|
+
description: 'The current report to compare against the baseline.',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
output: {
|
|
30
|
+
schema: {
|
|
31
|
+
type: 'json',
|
|
32
|
+
description: 'Baseline diff report: added/removed/changed findings, delta verdict, current verdict, summary and next steps.',
|
|
33
|
+
},
|
|
34
|
+
render(_args, value) {
|
|
35
|
+
return [{ type: 'text' as const, text: JSON.stringify(value, null, 2) }]
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
timeoutMs: 10_000,
|
|
39
|
+
isConcurrencySafe: () => true,
|
|
40
|
+
async execute(args) {
|
|
41
|
+
return diffReports(args.baseline, args.current) as unknown as JsonValue
|
|
42
|
+
},
|
|
43
|
+
})
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { defineTool } from '@deepseek-ai/dsh-tools'
|
|
2
|
+
import type { JsonValue } from './json-value.js'
|
|
3
|
+
import { REPORT_SCHEMAS } from './engine.js'
|
|
4
|
+
import { reviewStructure } from './structure.js'
|
|
5
|
+
import { reviewGranularity, type GranularityDiagram } from './granularity.js'
|
|
6
|
+
|
|
7
|
+
export const LOGICPROBE_STRUCTURE_TOOL_NAME = 'logicprobe_structure_verify'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Model-visible DSH tool that audits a *structure* diagram — components, packages,
|
|
11
|
+
* classes, deployment nodes and the dependency arrows between them — against an
|
|
12
|
+
* optional dependency matrix. A structure diagram is not a state machine: this tool
|
|
13
|
+
* reads the graph the diagram actually draws, instead of refusing it (which is what
|
|
14
|
+
* `logicprobe_uml action=parse` does) or pretending the arrows are state transitions
|
|
15
|
+
* (which is what a false `ok` used to hide).
|
|
16
|
+
*/
|
|
17
|
+
export const logicProbeStructureTool = defineTool({
|
|
18
|
+
name: LOGICPROBE_STRUCTURE_TOOL_NAME,
|
|
19
|
+
description:
|
|
20
|
+
'Audit a structure diagram as a dependency graph. Takes PlantUML component, package, class or deployment text, or a Mermaid class diagram. Reports UML020 isolated node, UML021 dangling reference, UML022 cycle (shortest path), UML023 disallowed edge and UML024 layer violation against a matrix, UML025 missing required edge, and UML026 when no node is declared. The matrix is {rules: [{id, source, allow?, deny?, require?}], layers: [{name, members}], default: "allow"|"deny"}. Ids and members accept globs (`*`, `?`). Deny beats allow, and layers run top-first, so downward edges pass and upward ones are UML024. With a matrix, every edge appears in `edgeVerdicts` with the rules it matched. Pass `diagrams` instead of `diagram` to check several levels at once: each child must refine its parent. This audits the diagram, not the code: reconcile it with a source-side scan. Read `verdict`, not `ok`. For state or activity diagrams use `logicprobe_uml` and `logicprobe_verify`.',
|
|
21
|
+
parameters: {
|
|
22
|
+
diagram: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
description: 'Structure-diagram source text: PlantUML component/package/class/deployment, or a Mermaid class diagram. Omit when `diagrams` is given.',
|
|
25
|
+
},
|
|
26
|
+
diagrams: {
|
|
27
|
+
type: 'json',
|
|
28
|
+
description: 'Multi-granularity mode: an array of {name, diagram, parent?} levels. Each diagram is checked on its own AND against its declared parent (UML028 unknown parent, UML029 refinement violation, UML030 parent cycle), with per-pair node/edge counts.',
|
|
29
|
+
},
|
|
30
|
+
notation: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
enum: ['auto', 'plantuml', 'mermaid'],
|
|
33
|
+
description: 'Diagram language. Default auto (detected from the text).',
|
|
34
|
+
},
|
|
35
|
+
matrix: {
|
|
36
|
+
type: 'json',
|
|
37
|
+
description: 'Optional dependency matrix: {rules: [{id, source, allow?, deny?, require?}], layers: [{name, members}], default: "allow"|"deny"}. Every edge is judged against it and the matched rule ids are reported.',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
output: {
|
|
41
|
+
schema: {
|
|
42
|
+
type: 'json',
|
|
43
|
+
description: 'Structure review report: graph (nodes/edges), findings UML020-UML026, per-edge matrix verdicts, summary and next steps.',
|
|
44
|
+
},
|
|
45
|
+
render(_args, value) {
|
|
46
|
+
return [{ type: 'text' as const, text: JSON.stringify(value, null, 2) }]
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
timeoutMs: 10_000,
|
|
50
|
+
isConcurrencySafe: () => true,
|
|
51
|
+
async execute(args) {
|
|
52
|
+
if (args.diagrams !== undefined) {
|
|
53
|
+
return reviewGranularity({
|
|
54
|
+
diagrams: args.diagrams as unknown as GranularityDiagram[],
|
|
55
|
+
notation: (args.notation ?? 'auto') as 'auto' | 'plantuml' | 'mermaid',
|
|
56
|
+
...(args.matrix === undefined ? {} : { matrix: args.matrix }),
|
|
57
|
+
}) as unknown as JsonValue
|
|
58
|
+
}
|
|
59
|
+
if (args.diagram === undefined) {
|
|
60
|
+
return { ok: false, ran: false, verdict: 'fail', verdictReason: 'the tool did not run: pass `diagram` (one structure diagram) or `diagrams` (several levels with parents)', schema: REPORT_SCHEMAS.structure, errorCode: 'UML_INPUT', error: 'structure review needs `diagram` or `diagrams`' } as unknown as JsonValue
|
|
61
|
+
}
|
|
62
|
+
return reviewStructure({
|
|
63
|
+
diagram: args.diagram,
|
|
64
|
+
notation: (args.notation ?? 'auto') as 'auto' | 'plantuml' | 'mermaid',
|
|
65
|
+
...(args.matrix === undefined ? {} : { matrix: args.matrix }),
|
|
66
|
+
}) as unknown as JsonValue
|
|
67
|
+
},
|
|
68
|
+
})
|