dsh-model-everything 0.0.0-stage → 0.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.
- package/LICENSE +21 -0
- package/README.en-US.md +319 -0
- package/README.md +319 -3
- package/cordis.patch.yml +20 -0
- package/examples/README.md +48 -0
- package/examples/control-dispatcher.json +113 -0
- package/examples/control-dispatcher.overbudget.json +113 -0
- package/examples/ecommerce-data-model.json +185 -0
- package/examples/order-state-machine.after.json +116 -0
- package/examples/order-state-machine.before.json +101 -0
- package/examples/user-migration.after.json +29 -0
- package/examples/user-migration.before.json +29 -0
- package/gate/locale/en.json +6 -0
- package/gate/locale/zh.json +6 -0
- package/gate/package.json +5 -0
- package/lib/baseline.js +249 -0
- package/lib/compose-tool.js +76 -0
- package/lib/concurrency-tool.js +40 -0
- package/lib/concurrency.js +206 -0
- package/lib/data-engine.js +1141 -0
- package/lib/data-tool.js +79 -0
- package/lib/design-engine.js +1149 -0
- package/lib/design-tool.js +55 -0
- package/lib/engine.js +4343 -0
- package/lib/export-tool.js +78 -0
- package/lib/exporters.js +434 -0
- package/lib/gate.js +274 -0
- package/lib/granularity.js +237 -0
- package/lib/index.js +237 -0
- package/lib/json-value.js +18 -0
- package/lib/option-shape.js +62 -0
- package/lib/report-diff-tool.js +63 -0
- package/lib/report-view.js +408 -0
- package/lib/structure-tool.js +91 -0
- package/lib/structure.js +711 -0
- package/lib/tool.js +85 -0
- package/lib/types/baseline.d.ts +65 -0
- package/lib/types/compose-tool.d.ts +7 -0
- package/lib/types/concurrency-tool.d.ts +8 -0
- package/lib/types/concurrency.d.ts +37 -0
- package/lib/types/data-engine.d.ts +211 -0
- package/lib/types/data-tool.d.ts +10 -0
- package/lib/types/design-engine.d.ts +215 -0
- package/lib/types/design-tool.d.ts +11 -0
- package/lib/types/engine.d.ts +494 -0
- package/lib/types/export-tool.d.ts +7 -0
- package/lib/types/exporters.d.ts +37 -0
- package/lib/types/gate.d.ts +91 -0
- package/lib/types/granularity.d.ts +106 -0
- package/lib/types/index.d.ts +45 -0
- package/lib/types/json-value.d.ts +21 -0
- package/lib/types/option-shape.d.ts +22 -0
- package/lib/types/report-diff-tool.d.ts +8 -0
- package/lib/types/report-view.d.ts +43 -0
- package/lib/types/structure-tool.d.ts +10 -0
- package/lib/types/structure.d.ts +152 -0
- package/lib/types/tool.d.ts +11 -0
- package/lib/types/uml-communication.d.ts +109 -0
- package/lib/types/uml-composite.d.ts +107 -0
- package/lib/types/uml-interaction-overview.d.ts +91 -0
- package/lib/types/uml-profile.d.ts +112 -0
- package/lib/types/uml-structure.d.ts +53 -0
- package/lib/types/uml-syntax.d.ts +296 -0
- package/lib/types/uml-timing.d.ts +152 -0
- package/lib/types/uml-tool.d.ts +12 -0
- package/lib/types/uml-usecase.d.ts +58 -0
- package/lib/types/uml.d.ts +303 -0
- package/lib/uml-communication.js +353 -0
- package/lib/uml-composite.js +442 -0
- package/lib/uml-interaction-overview.js +277 -0
- package/lib/uml-profile.js +373 -0
- package/lib/uml-structure.js +306 -0
- package/lib/uml-syntax.js +545 -0
- package/lib/uml-timing.js +974 -0
- package/lib/uml-tool.js +213 -0
- package/lib/uml-usecase.js +532 -0
- package/lib/uml.js +2110 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +124 -6
- package/skills/model-everything/SKILL.md +482 -0
- package/skills/model-everything/references/dsh-model-schema.md +437 -0
- package/skills/model-everything/references/gap-routing-guide.md +42 -0
- package/skills/model-everything/references/hash-spec.md +152 -0
- package/skills/model-everything/references/logic-verification-guide.md +422 -0
- package/skills/model-everything-datamodel/SKILL.md +130 -0
- package/skills/model-everything-datamodel/references/data-model-guide.md +84 -0
- package/skills/model-everything-datamodel/references/data-model-schema.md +128 -0
- package/skills/model-everything-design/SKILL.md +115 -0
- package/skills/model-everything-interleaving/SKILL.md +63 -0
- package/skills/model-everything-interleaving/SKILL.zh-CN.md +60 -0
- package/skills/model-everything-interleaving/references/concurrency-risk-guide.md +63 -0
- package/skills/model-everything-report-reading/SKILL.md +137 -0
- package/skills/model-everything-report-reading/references/reading-a-report.md +166 -0
- package/skills/model-everything-report-reading/references/reading-a-report.mmd +59 -0
- package/skills/model-everything-structure/SKILL.md +96 -0
- package/skills/model-everything-structure/references/structure-review-guide.md +201 -0
- package/skills/model-everything-uml/SKILL.md +60 -0
- package/skills/model-everything-uml/references/uml-modeling-guide.md +551 -0
- package/src/baseline.ts +288 -0
- package/src/compose-tool.ts +78 -0
- package/src/concurrency-tool.ts +44 -0
- package/src/concurrency.ts +254 -0
- package/src/data-engine.ts +1208 -0
- package/src/data-tool.ts +83 -0
- package/src/design-engine.ts +1263 -0
- package/src/design-tool.ts +60 -0
- package/src/engine.ts +4564 -0
- package/src/export-tool.ts +81 -0
- package/src/exporters.ts +399 -0
- package/src/gate.ts +330 -0
- package/src/granularity.ts +312 -0
- package/src/index.ts +289 -0
- package/src/json-value.ts +20 -0
- package/src/option-shape.ts +64 -0
- package/src/report-diff-tool.ts +67 -0
- package/src/report-view.ts +451 -0
- package/src/structure-tool.ts +93 -0
- package/src/structure.ts +786 -0
- package/src/tool.ts +94 -0
- package/src/uml-communication.ts +428 -0
- package/src/uml-composite.ts +520 -0
- package/src/uml-interaction-overview.ts +321 -0
- package/src/uml-profile.ts +439 -0
- package/src/uml-structure.ts +317 -0
- package/src/uml-syntax.ts +764 -0
- package/src/uml-timing.ts +1106 -0
- package/src/uml-tool.ts +230 -0
- package/src/uml-usecase.ts +566 -0
- package/src/uml.ts +2139 -0
package/lib/data-tool.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { defineTool } from '@deepseek-ai/dsh-tools';
|
|
2
|
+
import { runDataVerification, DATA_ENGINE_SCHEMA_VERSION } from './data-engine.js';
|
|
3
|
+
import { optionRefusal, requireArrayOption, requireObjectOption } from './option-shape.js';
|
|
4
|
+
import { renderReportText } from './report-view.js';
|
|
5
|
+
export const DATAMODEL_VERIFY_TOOL_NAME = 'model_datamodel_verify';
|
|
6
|
+
/**
|
|
7
|
+
* Model-visible DSH tool wrapping the bundled data-model verification engine.
|
|
8
|
+
* The model passes a DataModelV1 object; the engine validates it and returns
|
|
9
|
+
* DS/DA/DD checks. Optional beforeModel/fieldMapping/copyPairs/migrationMappings
|
|
10
|
+
* enable before/after data-model regression and migration coverage checks.
|
|
11
|
+
*/
|
|
12
|
+
export const modelDataModelVerifyTool = defineTool({
|
|
13
|
+
name: DATAMODEL_VERIFY_TOOL_NAME,
|
|
14
|
+
description: 'Verify a data model and its migrations: keys, domains, referential integrity, migration completeness and the before/after regression. Takes a DataModelV1 object with schemaVersion=1, entities ({name, fields, primaryKey?, uniqueKeys?, indexes?}), relationships?, invariants?, boundaryChecks?. Optional beforeModel/fieldMapping/copyPairs/migrationMappings/backupPairs enable migration coverage, copy consistency, rollback symmetry, and before/after data regression. Returns a report of finding codes with `verdict` and `verdictReason`. For a state machine or protocol use `model_verify`; for module or package dependencies use `uml_structure_verify`. See skills/model-everything-datamodel/references/data-model-schema.md.',
|
|
15
|
+
parameters: {
|
|
16
|
+
model: {
|
|
17
|
+
type: 'json',
|
|
18
|
+
required: true,
|
|
19
|
+
description: 'DataModelV1 data model to verify.',
|
|
20
|
+
},
|
|
21
|
+
beforeModel: {
|
|
22
|
+
type: 'json',
|
|
23
|
+
description: 'Optional BEFORE DataModelV1 data model for regression comparison.',
|
|
24
|
+
},
|
|
25
|
+
fieldMapping: {
|
|
26
|
+
type: 'json',
|
|
27
|
+
description: 'Optional object mapping BEFORE "Entity.field" paths to AFTER "Entity.field" paths.',
|
|
28
|
+
},
|
|
29
|
+
copyPairs: {
|
|
30
|
+
type: 'json',
|
|
31
|
+
description: 'Optional copy pairs: { id, sourceEntity, targetEntity, mapping: {sourceField: targetField} }.',
|
|
32
|
+
},
|
|
33
|
+
migrationMappings: {
|
|
34
|
+
type: 'json',
|
|
35
|
+
description: 'Optional migration mappings: { from: "Entity.field", to: "Entity.field", transform?, note? }.',
|
|
36
|
+
},
|
|
37
|
+
backupPairs: {
|
|
38
|
+
type: 'json',
|
|
39
|
+
description: 'Optional backup/restore pairs for DA7 rollback symmetry.',
|
|
40
|
+
},
|
|
41
|
+
reportView: {
|
|
42
|
+
type: 'string',
|
|
43
|
+
enum: ['digest', 'full'],
|
|
44
|
+
description: 'digest (default) prints the readable body; full prints the structured report, which report_diff needs.',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
output: {
|
|
48
|
+
schema: {
|
|
49
|
+
type: 'json',
|
|
50
|
+
description: 'model-everything-datamodel verification report with summary and per-check findings.',
|
|
51
|
+
},
|
|
52
|
+
render(args, value) {
|
|
53
|
+
return [{ type: 'text', text: renderReportText(value, { full: args.reportView === 'full' }) }];
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
timeoutMs: 10_000,
|
|
57
|
+
isConcurrencySafe: () => true,
|
|
58
|
+
async execute(args) {
|
|
59
|
+
try {
|
|
60
|
+
// The options are declared `json`, so the shape has to be checked here: the engine reads each one as
|
|
61
|
+
// the list or map it needs, and a string arrived as a raw TypeError with no code and no option name.
|
|
62
|
+
requireObjectOption(args.fieldMapping, 'fieldMapping', 'DATA_OPTION_INVALID');
|
|
63
|
+
requireArrayOption(args.copyPairs, 'copyPairs', 'DATA_OPTION_INVALID');
|
|
64
|
+
requireArrayOption(args.migrationMappings, 'migrationMappings', 'DATA_OPTION_INVALID');
|
|
65
|
+
requireArrayOption(args.backupPairs, 'backupPairs', 'DATA_OPTION_INVALID');
|
|
66
|
+
return runDataVerification(args.model, {
|
|
67
|
+
beforeModel: args.beforeModel,
|
|
68
|
+
fieldMapping: args.fieldMapping,
|
|
69
|
+
copyPairs: args.copyPairs,
|
|
70
|
+
migrationMappings: args.migrationMappings,
|
|
71
|
+
backupPairs: args.backupPairs,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
return optionRefusal(error, 'DATA_OPTION_INVALID');
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
export { DATA_ENGINE_SCHEMA_VERSION };
|