@jay-framework/plugin-validator 0.25.5 → 0.26.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/dist/index.js +59 -3
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1456,7 +1456,7 @@ async function validateSchema(context, result) {
|
|
|
1456
1456
|
}
|
|
1457
1457
|
}
|
|
1458
1458
|
const hasCapability = Boolean(
|
|
1459
|
-
manifest.contracts || manifest.dynamic_contracts || manifest.actions || manifest.validators || manifest.routes || manifest.services || manifest.contexts || manifest.init || manifest.setup || manifest.agentkit || manifest.commands
|
|
1459
|
+
manifest.contracts || manifest.dynamic_contracts || manifest.actions || manifest.validators || manifest.projectValidators || manifest.routes || manifest.services || manifest.contexts || manifest.init || manifest.setup || manifest.agentkit || manifest.commands
|
|
1460
1460
|
);
|
|
1461
1461
|
if (!hasCapability) {
|
|
1462
1462
|
if (manifest.global === true) {
|
|
@@ -1472,7 +1472,7 @@ async function validateSchema(context, result) {
|
|
|
1472
1472
|
} else {
|
|
1473
1473
|
result.warnings.push({
|
|
1474
1474
|
type: "schema",
|
|
1475
|
-
message: "Plugin declares no capabilities (contracts, dynamic_contracts, actions, validators, routes, services, contexts, init, setup, agentkit, commands)",
|
|
1475
|
+
message: "Plugin declares no capabilities (contracts, dynamic_contracts, actions, validators, projectValidators, routes, services, contexts, init, setup, agentkit, commands)",
|
|
1476
1476
|
location: "plugin.yaml",
|
|
1477
1477
|
suggestion: "Declare at least one capability. See agent-kit/plugin/plugin-structure.md"
|
|
1478
1478
|
});
|
|
@@ -1662,6 +1662,43 @@ async function validateSchema(context, result) {
|
|
|
1662
1662
|
});
|
|
1663
1663
|
}
|
|
1664
1664
|
}
|
|
1665
|
+
if (manifest.projectValidators) {
|
|
1666
|
+
if (!Array.isArray(manifest.projectValidators)) {
|
|
1667
|
+
result.errors.push({
|
|
1668
|
+
type: "schema",
|
|
1669
|
+
message: 'Field "projectValidators" must be an array',
|
|
1670
|
+
location: "plugin.yaml"
|
|
1671
|
+
});
|
|
1672
|
+
} else {
|
|
1673
|
+
manifest.projectValidators.forEach((validator, index) => {
|
|
1674
|
+
if (!validator.name) {
|
|
1675
|
+
result.errors.push({
|
|
1676
|
+
type: "schema",
|
|
1677
|
+
message: `Project validator at index ${index} is missing "name" field`,
|
|
1678
|
+
location: "plugin.yaml"
|
|
1679
|
+
});
|
|
1680
|
+
}
|
|
1681
|
+
if (!validator.handler) {
|
|
1682
|
+
result.errors.push({
|
|
1683
|
+
type: "schema",
|
|
1684
|
+
message: `Project validator "${validator.name || index}" is missing "handler" field`,
|
|
1685
|
+
location: "plugin.yaml",
|
|
1686
|
+
suggestion: "Specify the relative path to the project validator handler module"
|
|
1687
|
+
});
|
|
1688
|
+
}
|
|
1689
|
+
if (validator.handler) {
|
|
1690
|
+
validateHandlerRef(
|
|
1691
|
+
validator.handler,
|
|
1692
|
+
`Project validator "${validator.name}" handler`,
|
|
1693
|
+
"plugin.yaml projectValidators",
|
|
1694
|
+
context,
|
|
1695
|
+
result,
|
|
1696
|
+
"./tools"
|
|
1697
|
+
);
|
|
1698
|
+
}
|
|
1699
|
+
});
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1665
1702
|
if (manifest.setup) {
|
|
1666
1703
|
if (typeof manifest.setup !== "string") {
|
|
1667
1704
|
result.errors.push({
|
|
@@ -1743,7 +1780,7 @@ function hasComponentCapability(context) {
|
|
|
1743
1780
|
return Boolean(m.contracts || m.dynamic_contracts || m.routes);
|
|
1744
1781
|
}
|
|
1745
1782
|
function needsToolsEntry(manifest) {
|
|
1746
|
-
if (manifest.validators || manifest.commands || manifest.agentkit || manifest.setup) {
|
|
1783
|
+
if (manifest.validators || manifest.projectValidators || manifest.commands || manifest.agentkit || manifest.setup) {
|
|
1747
1784
|
return true;
|
|
1748
1785
|
}
|
|
1749
1786
|
if (manifest.actions) {
|
|
@@ -1845,6 +1882,25 @@ function resolveContractFile(contractSpec, context) {
|
|
|
1845
1882
|
}
|
|
1846
1883
|
async function validateContract(contract, index, context, generateTypes, result) {
|
|
1847
1884
|
result.contractsChecked = (result.contractsChecked || 0) + 1;
|
|
1885
|
+
const hasEditingGuide = typeof contract.editingGuide === "string" && contract.editingGuide.length > 0;
|
|
1886
|
+
const isReadonly = contract.readonly === true;
|
|
1887
|
+
if (!hasEditingGuide && !isReadonly) {
|
|
1888
|
+
result.warnings.push({
|
|
1889
|
+
type: "source-editing-coverage",
|
|
1890
|
+
message: `Contract "${contract.name}" declares no source-editing story. Add "editingGuide: <path.md>" (how to edit its bound data) or "readonly: true" (not editable in place).`,
|
|
1891
|
+
location: `plugin.yaml contracts[${index}]`,
|
|
1892
|
+
suggestion: "See the plugin source-editing guide (DL#219)."
|
|
1893
|
+
});
|
|
1894
|
+
} else if (hasEditingGuide) {
|
|
1895
|
+
const guideFullPath = path.resolve(context.pluginPath, contract.editingGuide);
|
|
1896
|
+
if (!fs.existsSync(guideFullPath)) {
|
|
1897
|
+
result.warnings.push({
|
|
1898
|
+
type: "source-editing-coverage",
|
|
1899
|
+
message: `Contract "${contract.name}" editingGuide file not found: ${contract.editingGuide}`,
|
|
1900
|
+
location: `plugin.yaml contracts[${index}]`
|
|
1901
|
+
});
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1848
1904
|
const contractPath = resolveContractFile(contract.contract, context);
|
|
1849
1905
|
if (!contractPath) {
|
|
1850
1906
|
result.errors.push({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jay-framework/plugin-validator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"description": "Validation tool for Jay Stack plugins",
|
|
@@ -25,19 +25,19 @@
|
|
|
25
25
|
"test:watch": "vitest"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@jay-framework/compiler-jay-html": "^0.
|
|
29
|
-
"@jay-framework/compiler-shared": "^0.
|
|
30
|
-
"@jay-framework/typescript-bridge": "^0.
|
|
28
|
+
"@jay-framework/compiler-jay-html": "^0.26.0",
|
|
29
|
+
"@jay-framework/compiler-shared": "^0.26.0",
|
|
30
|
+
"@jay-framework/typescript-bridge": "^0.26.0",
|
|
31
31
|
"chalk": "^4.1.2",
|
|
32
32
|
"yaml": "^2.3.4"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@jay-framework/dev-environment": "^0.
|
|
35
|
+
"@jay-framework/dev-environment": "^0.26.0",
|
|
36
36
|
"@types/node": "^22.15.21",
|
|
37
37
|
"rimraf": "^5.0.5",
|
|
38
38
|
"tsup": "^8.0.1",
|
|
39
39
|
"typescript": "^5.3.3",
|
|
40
|
-
"vite": "^
|
|
41
|
-
"vitest": "^1.
|
|
40
|
+
"vite": "^6.4.4",
|
|
41
|
+
"vitest": "^4.1.11"
|
|
42
42
|
}
|
|
43
43
|
}
|