@canonical/webarchitect 0.10.0 → 0.11.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.md +1 -0
- package/package.json +17 -15
- package/rulesets/library.ruleset.json +19 -0
- package/rulesets/package.ruleset.json +1 -5
- package/rulesets/tool-ts.ruleset.json +107 -0
- package/rulesets/tool.ruleset.json +19 -0
- package/src/cli.ts +322 -0
- package/src/constants.ts +8 -0
- package/{dist/esm/index.js → src/index.ts} +0 -1
- package/{dist/esm/lib/ajv.js → src/lib/ajv.ts} +47 -24
- package/src/lib/describeSchema.ts +59 -0
- package/src/lib/discoverAllRulesets.ts +18 -0
- package/src/lib/discoverRulesetsInDir.ts +41 -0
- package/src/lib/executeValidationRules.ts +54 -0
- package/{dist/esm/lib/index.js → src/lib/index.ts} +1 -1
- package/{dist/esm/lib/listDirectory.js → src/lib/listDirectory.ts} +12 -10
- package/{dist/esm/lib/loadFullSchema.js → src/lib/loadFullSchema.ts} +16 -12
- package/src/lib/resolveSchema.ts +128 -0
- package/src/lib/validateDirectoryRule.ts +158 -0
- package/src/lib/validateFileRule.ts +105 -0
- package/{dist/esm/lib/validateRule.js → src/lib/validateRule.ts} +18 -11
- package/src/schema.json +61 -0
- package/src/schemas/draft-2020-12.json +58 -0
- package/src/schemas/meta/applicator.json +45 -0
- package/src/schemas/meta/content.json +14 -0
- package/src/schemas/meta/core.json +48 -0
- package/src/schemas/meta/format-annotation.json +11 -0
- package/src/schemas/meta/meta-data.json +34 -0
- package/src/schemas/meta/unevaluated.json +12 -0
- package/src/schemas/meta/validation.json +95 -0
- package/src/types.ts +49 -0
- package/{dist/esm/validate.js → src/validate.ts} +8 -4
- package/dist/esm/cli.js +0 -277
- package/dist/esm/cli.js.map +0 -1
- package/dist/esm/constants.js +0 -3
- package/dist/esm/constants.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/lib/ajv.js.map +0 -1
- package/dist/esm/lib/describeSchema.js +0 -53
- package/dist/esm/lib/describeSchema.js.map +0 -1
- package/dist/esm/lib/discoverAllRulesets.js +0 -13
- package/dist/esm/lib/discoverAllRulesets.js.map +0 -1
- package/dist/esm/lib/discoverRulesetsInDir.js +0 -35
- package/dist/esm/lib/discoverRulesetsInDir.js.map +0 -1
- package/dist/esm/lib/executeValidationRules.js +0 -41
- package/dist/esm/lib/executeValidationRules.js.map +0 -1
- package/dist/esm/lib/index.js.map +0 -1
- package/dist/esm/lib/listDirectory.js.map +0 -1
- package/dist/esm/lib/loadFullSchema.js.map +0 -1
- package/dist/esm/lib/resolveSchema.js +0 -113
- package/dist/esm/lib/resolveSchema.js.map +0 -1
- package/dist/esm/lib/validateDirectoryRule.js +0 -138
- package/dist/esm/lib/validateDirectoryRule.js.map +0 -1
- package/dist/esm/lib/validateFileRule.js +0 -92
- package/dist/esm/lib/validateFileRule.js.map +0 -1
- package/dist/esm/lib/validateRule.js.map +0 -1
- package/dist/esm/schema.json +0 -61
- package/dist/esm/schemas/draft-2020-12.json +0 -57
- package/dist/esm/schemas/meta/applicator.json +0 -44
- package/dist/esm/schemas/meta/content.json +0 -12
- package/dist/esm/schemas/meta/core.json +0 -47
- package/dist/esm/schemas/meta/format-annotation.json +0 -10
- package/dist/esm/schemas/meta/meta-data.json +0 -32
- package/dist/esm/schemas/meta/unevaluated.json +0 -11
- package/dist/esm/schemas/meta/validation.json +0 -94
- package/dist/esm/types.js +0 -2
- package/dist/esm/types.js.map +0 -1
- package/dist/esm/validate.js.map +0 -1
- package/dist/types/cli.d.ts +0 -3
- package/dist/types/cli.d.ts.map +0 -1
- package/dist/types/constants.d.ts +0 -2
- package/dist/types/constants.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -2
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/lib/ajv.d.ts +0 -4
- package/dist/types/lib/ajv.d.ts.map +0 -1
- package/dist/types/lib/describeSchema.d.ts +0 -22
- package/dist/types/lib/describeSchema.d.ts.map +0 -1
- package/dist/types/lib/discoverAllRulesets.d.ts +0 -9
- package/dist/types/lib/discoverAllRulesets.d.ts.map +0 -1
- package/dist/types/lib/discoverRulesetsInDir.d.ts +0 -6
- package/dist/types/lib/discoverRulesetsInDir.d.ts.map +0 -1
- package/dist/types/lib/executeValidationRules.d.ts +0 -22
- package/dist/types/lib/executeValidationRules.d.ts.map +0 -1
- package/dist/types/lib/index.d.ts +0 -15
- package/dist/types/lib/index.d.ts.map +0 -1
- package/dist/types/lib/listDirectory.d.ts +0 -20
- package/dist/types/lib/listDirectory.d.ts.map +0 -1
- package/dist/types/lib/loadFullSchema.d.ts +0 -20
- package/dist/types/lib/loadFullSchema.d.ts.map +0 -1
- package/dist/types/lib/resolveSchema.d.ts +0 -29
- package/dist/types/lib/resolveSchema.d.ts.map +0 -1
- package/dist/types/lib/validateDirectoryRule.d.ts +0 -26
- package/dist/types/lib/validateDirectoryRule.d.ts.map +0 -1
- package/dist/types/lib/validateFileRule.d.ts +0 -29
- package/dist/types/lib/validateFileRule.d.ts.map +0 -1
- package/dist/types/lib/validateRule.d.ts +0 -21
- package/dist/types/lib/validateRule.d.ts.map +0 -1
- package/dist/types/types.d.ts +0 -42
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/validate.d.ts +0 -23
- package/dist/types/validate.d.ts.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/types/lib/ajv.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ajv.d.ts","sourceRoot":"","sources":["../../../src/lib/ajv.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,KAAK,CAAC;AAqB7B,QAAA,MAAM,GAAG,gBAIP,CAAC;AAwDH,eAAe,GAAG,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { JSONSchema7 } from "json-schema";
|
|
2
|
-
/**
|
|
3
|
-
* Generates a human-readable description of what a JSON schema validates.
|
|
4
|
-
* Summarizes key constraints like type, required properties, patterns, etc.
|
|
5
|
-
* Used to provide clear feedback about what validation rules are being applied.
|
|
6
|
-
*
|
|
7
|
-
* @param schema - JSON Schema to describe
|
|
8
|
-
* @returns Human-readable description of the schema's validation rules
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* const schema = {
|
|
13
|
-
* type: "object",
|
|
14
|
-
* required: ["name", "version"],
|
|
15
|
-
* properties: { name: {}, version: {} }
|
|
16
|
-
* };
|
|
17
|
-
* const desc = describeSchema(schema);
|
|
18
|
-
* // Returns: "must be object, must have properties: name, version, expected properties: name, version"
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export default function describeSchema(schema: JSONSchema7): string;
|
|
22
|
-
//# sourceMappingURL=describeSchema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"describeSchema.d.ts","sourceRoot":"","sources":["../../../src/lib/describeSchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAqClE"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { RulesetLocation } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Discovers all available rulesets (bundled and local)
|
|
4
|
-
*/
|
|
5
|
-
export default function discoverAllRulesets(): Promise<{
|
|
6
|
-
bundled: RulesetLocation[];
|
|
7
|
-
local: RulesetLocation[];
|
|
8
|
-
}>;
|
|
9
|
-
//# sourceMappingURL=discoverAllRulesets.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discoverAllRulesets.d.ts","sourceRoot":"","sources":["../../../src/lib/discoverAllRulesets.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGnD;;GAEG;AACH,wBAA8B,mBAAmB,IAAI,OAAO,CAAC;IAC3D,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,KAAK,EAAE,eAAe,EAAE,CAAC;CAC1B,CAAC,CAOD"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { RulesetLocation } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Discovers .ruleset.json files in a directory
|
|
4
|
-
*/
|
|
5
|
-
export default function discoverRulesetsInDir(dir: string, type: "bundled" | "local"): Promise<RulesetLocation[]>;
|
|
6
|
-
//# sourceMappingURL=discoverRulesetsInDir.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discoverRulesetsInDir.d.ts","sourceRoot":"","sources":["../../../src/lib/discoverRulesetsInDir.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;GAEG;AACH,wBAA8B,qBAAqB,CACjD,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,SAAS,GAAG,OAAO,GACxB,OAAO,CAAC,eAAe,EAAE,CAAC,CA8B5B"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Schema, ValidationResult } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Executes all validation rules defined in a schema against a project.
|
|
4
|
-
* Iterates through each rule in the schema and delegates to validateRule.
|
|
5
|
-
*
|
|
6
|
-
* @param projectPath - Absolute or relative path to the project directory to validate
|
|
7
|
-
* @param schema - Schema object containing validation rules to execute
|
|
8
|
-
* @returns Promise that resolves to an array of validation results
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* const schema = {
|
|
13
|
-
* name: "my-schema",
|
|
14
|
-
* "package-config": {
|
|
15
|
-
* file: { name: "package.json", contains: {...} }
|
|
16
|
-
* }
|
|
17
|
-
* };
|
|
18
|
-
* const results = await executeValidationRules("/path/to/project", schema);
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export default function executeValidationRules(projectPath: string, schema: Schema): Promise<ValidationResult[]>;
|
|
22
|
-
//# sourceMappingURL=executeValidationRules.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"executeValidationRules.d.ts","sourceRoot":"","sources":["../../../src/lib/executeValidationRules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,MAAM,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGlE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAA8B,sBAAsB,CAClD,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,gBAAgB,EAAE,CAAC,CA4B7B"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal library modules - re-exported as named exports
|
|
3
|
-
*/
|
|
4
|
-
export { default as ajv } from "./ajv.js";
|
|
5
|
-
export { default as describeSchema } from "./describeSchema.js";
|
|
6
|
-
export { default as discoverAllRulesets } from "./discoverAllRulesets.js";
|
|
7
|
-
export { default as discoverRulesetsInDir } from "./discoverRulesetsInDir.js";
|
|
8
|
-
export { default as executeValidationRules } from "./executeValidationRules.js";
|
|
9
|
-
export { default as listDirectory } from "./listDirectory.js";
|
|
10
|
-
export { default as loadFullSchema } from "./loadFullSchema.js";
|
|
11
|
-
export { default as resolveSchema } from "./resolveSchema.js";
|
|
12
|
-
export { default as validateDirectoryRule } from "./validateDirectoryRule.js";
|
|
13
|
-
export { default as validateFileRule } from "./validateFileRule.js";
|
|
14
|
-
export { default as validateRule } from "./validateRule.js";
|
|
15
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Lists the contents of a directory, separating files and subdirectories.
|
|
3
|
-
* Used for strict mode validation to detect unexpected files or directories.
|
|
4
|
-
*
|
|
5
|
-
* @param path - Path to the directory to list
|
|
6
|
-
* @returns Promise that resolves to an object containing arrays of file and directory names
|
|
7
|
-
* @throws Will throw an error if the directory cannot be read
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* const contents = await listDirectory("/path/to/project");
|
|
12
|
-
* console.log(contents.files); // ["package.json", "README.md"]
|
|
13
|
-
* console.log(contents.directories); // ["src", "dist", "node_modules"]
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export default function listDirectory(path: string): Promise<{
|
|
17
|
-
files: string[];
|
|
18
|
-
directories: string[];
|
|
19
|
-
}>;
|
|
20
|
-
//# sourceMappingURL=listDirectory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"listDirectory.d.ts","sourceRoot":"","sources":["../../../src/lib/listDirectory.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,wBAA8B,aAAa,CACzC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CASrD"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { Schema } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Loads a schema and recursively resolves all extended schemas.
|
|
4
|
-
* Merges rules from parent schemas with child schemas, where child
|
|
5
|
-
* rules override parent rules with the same name. Special properties
|
|
6
|
-
* like $schema and name are preserved from the child schema.
|
|
7
|
-
*
|
|
8
|
-
* @param schemaArg - Schema identifier (built-in name, file path, or URL)
|
|
9
|
-
* @returns Promise that resolves to the fully merged schema with all extensions resolved
|
|
10
|
-
* @throws Will throw an error if any schema in the inheritance chain cannot be loaded
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* // Load a schema that extends other schemas
|
|
15
|
-
* const schema = await loadFullSchema("package-react");
|
|
16
|
-
* // Returns merged schema with rules from base, base-package, and package-react
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export default function loadFullSchema(schemaArg: string): Promise<Schema>;
|
|
20
|
-
//# sourceMappingURL=loadFullSchema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loadFullSchema.d.ts","sourceRoot":"","sources":["../../../src/lib/loadFullSchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C;;;;;;;;;;;;;;;;GAgBG;AACH,wBAA8B,cAAc,CAC1C,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,CAYjB"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { Schema } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Resolves a schema identifier to a loaded and validated schema object.
|
|
4
|
-
* Supports three resolution methods:
|
|
5
|
-
* 1. Remote URLs (http:// or https://) - fetches schema from the web
|
|
6
|
-
* 2. Local files - looks for .json files in current directory
|
|
7
|
-
* 3. Built-in rulesets - checks bundled rulesets directory
|
|
8
|
-
*
|
|
9
|
-
* The loaded schema is validated against the mother schema to ensure
|
|
10
|
-
* it conforms to the expected structure.
|
|
11
|
-
*
|
|
12
|
-
* @param schemaArg - Schema identifier: URL, file path, or built-in name
|
|
13
|
-
* @returns Promise that resolves to the validated schema object
|
|
14
|
-
* @throws Will throw an error if schema cannot be found or is invalid
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* // Load built-in ruleset
|
|
19
|
-
* const schema1 = await resolveSchema("base-package");
|
|
20
|
-
*
|
|
21
|
-
* // Load from local file
|
|
22
|
-
* const schema2 = await resolveSchema("./my-rules.json");
|
|
23
|
-
*
|
|
24
|
-
* // Load from URL
|
|
25
|
-
* const schema3 = await resolveSchema("https://example.com/schema.json");
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export default function resolveSchema(schemaArg: string): Promise<Schema>;
|
|
29
|
-
//# sourceMappingURL=resolveSchema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveSchema.d.ts","sourceRoot":"","sources":["../../../src/lib/resolveSchema.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAkD1C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAA8B,aAAa,CACzC,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,CA4CjB"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { DirectoryRule, ValidationResult } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Validates a directory against a directory rule specification.
|
|
4
|
-
* Checks that the directory exists and validates its contents recursively.
|
|
5
|
-
* In strict mode, also ensures no unexpected files or directories are present.
|
|
6
|
-
*
|
|
7
|
-
* @param projectPath - Base path where the directory should exist
|
|
8
|
-
* @param dirRule - Directory rule specification including name and expected contents
|
|
9
|
-
* @param ruleName - Name of the rule for error reporting (e.g., "src-structure")
|
|
10
|
-
* @returns Promise that resolves to an array of validation results
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* const rule = {
|
|
15
|
-
* name: "src",
|
|
16
|
-
* contains: {
|
|
17
|
-
* files: [{ name: "index.ts", contains: {...} }],
|
|
18
|
-
* directories: [{ name: "components", contains: {...} }]
|
|
19
|
-
* },
|
|
20
|
-
* strict: true
|
|
21
|
-
* };
|
|
22
|
-
* const results = await validateDirectoryRule("/project", rule, "source-structure");
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export default function validateDirectoryRule(projectPath: string, dirRule: DirectoryRule, ruleName: string): Promise<ValidationResult[]>;
|
|
26
|
-
//# sourceMappingURL=validateDirectoryRule.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validateDirectoryRule.d.ts","sourceRoot":"","sources":["../../../src/lib/validateDirectoryRule.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAInE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAA8B,qBAAqB,CACjD,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,gBAAgB,EAAE,CAAC,CA4H7B"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { FileRule, ValidationResult } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Validates a file against a file rule specification.
|
|
4
|
-
* Reads the file, parses it as JSON, and validates against the provided schema.
|
|
5
|
-
* Provides detailed error messages for missing files, invalid JSON, or schema violations.
|
|
6
|
-
*
|
|
7
|
-
* @param projectPath - Base path where the file should exist
|
|
8
|
-
* @param fileRule - File rule specification including name and JSON schema
|
|
9
|
-
* @param ruleName - Name of the rule for error reporting (e.g., "package-config")
|
|
10
|
-
* @returns Promise that resolves to an array with a single validation result
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* const rule = {
|
|
15
|
-
* name: "package.json",
|
|
16
|
-
* contains: {
|
|
17
|
-
* type: "object",
|
|
18
|
-
* properties: {
|
|
19
|
-
* name: { type: "string" },
|
|
20
|
-
* version: { type: "string" }
|
|
21
|
-
* },
|
|
22
|
-
* required: ["name", "version"]
|
|
23
|
-
* }
|
|
24
|
-
* };
|
|
25
|
-
* const results = await validateFileRule("/project", rule, "package-config");
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export default function validateFileRule(projectPath: string, fileRule: FileRule, ruleName: string): Promise<ValidationResult[]>;
|
|
29
|
-
//# sourceMappingURL=validateFileRule.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validateFileRule.d.ts","sourceRoot":"","sources":["../../../src/lib/validateFileRule.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAI9D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAA8B,gBAAgB,CAC5C,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAoE7B"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Rule, ValidationResult } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Validates a rule against a project path.
|
|
4
|
-
* Determines whether the rule is a file or directory rule and delegates
|
|
5
|
-
* to the appropriate validation logic.
|
|
6
|
-
*
|
|
7
|
-
* @param projectPath - Absolute or relative path to the project directory to validate
|
|
8
|
-
* @param rule - Rule object containing either file or directory validation specification
|
|
9
|
-
* @param ruleName - Name of the rule for error reporting
|
|
10
|
-
* @returns Promise that resolves to an array of validation results
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* const rule = {
|
|
15
|
-
* file: { name: "package.json", contains: {...} }
|
|
16
|
-
* };
|
|
17
|
-
* const results = await validateRule("/path/to/project", rule, "package-config");
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export default function validateRule(projectPath: string, rule: Rule, ruleName: string): Promise<ValidationResult[]>;
|
|
21
|
-
//# sourceMappingURL=validateRule.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validateRule.d.ts","sourceRoot":"","sources":["../../../src/lib/validateRule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAI1D;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAA8B,YAAY,CACxC,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAY7B"}
|
package/dist/types/types.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { JSONSchema7 } from "json-schema";
|
|
2
|
-
export interface FileRule {
|
|
3
|
-
name: string;
|
|
4
|
-
contains: JSONSchema7;
|
|
5
|
-
}
|
|
6
|
-
export interface DirectoryRule {
|
|
7
|
-
name: string;
|
|
8
|
-
contains?: {
|
|
9
|
-
files?: FileRule[];
|
|
10
|
-
directories?: DirectoryRule[];
|
|
11
|
-
};
|
|
12
|
-
strict?: boolean;
|
|
13
|
-
}
|
|
14
|
-
export type Rule = {
|
|
15
|
-
file: FileRule;
|
|
16
|
-
} | {
|
|
17
|
-
directory: DirectoryRule;
|
|
18
|
-
};
|
|
19
|
-
export interface Schema {
|
|
20
|
-
$schema?: string;
|
|
21
|
-
name: string;
|
|
22
|
-
extends?: string[];
|
|
23
|
-
[ruleName: string]: Rule | string | string[] | undefined;
|
|
24
|
-
}
|
|
25
|
-
export interface ValidationResult {
|
|
26
|
-
rule: string;
|
|
27
|
-
passed: boolean;
|
|
28
|
-
message?: string;
|
|
29
|
-
context?: {
|
|
30
|
-
type: "file" | "directory";
|
|
31
|
-
target: string;
|
|
32
|
-
description?: string;
|
|
33
|
-
schema?: unknown;
|
|
34
|
-
value?: unknown;
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
export interface RulesetLocation {
|
|
38
|
-
type: "bundled" | "local";
|
|
39
|
-
path: string;
|
|
40
|
-
name: string;
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,WAAW,CAAC;CACvB;AAGD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE;QAET,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;QACnB,WAAW,CAAC,EAAE,aAAa,EAAE,CAAC;KAC/B,CAAC;IACF,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAGD,MAAM,MAAM,IAAI,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG;IAAE,SAAS,EAAE,aAAa,CAAA;CAAE,CAAC;AAGrE,MAAM,WAAW,MAAM;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;CAC1D;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,OAAO,CAAC,EAAE;QACR,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;QAC3B,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd"}
|
package/dist/types/validate.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { ValidationResult } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Main validation function that validates a project against a specified ruleset.
|
|
4
|
-
* This is the primary API entry point for the webarchitect validation system.
|
|
5
|
-
* Handles schema loading, inheritance resolution, and rule execution.
|
|
6
|
-
*
|
|
7
|
-
* @param projectPath - Path to the project directory to validate
|
|
8
|
-
* @param schemaArg - Schema identifier: built-in name, file path, or URL
|
|
9
|
-
* @returns Promise that resolves to an array of validation results
|
|
10
|
-
* @throws Will throw an error if schema cannot be loaded or is invalid
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* // Validate current directory with built-in ruleset
|
|
15
|
-
* const results = await validate(process.cwd(), "base-package");
|
|
16
|
-
*
|
|
17
|
-
* // Check if validation passed
|
|
18
|
-
* const passed = results.every(r => r.passed);
|
|
19
|
-
* console.log(passed ? "All checks passed!" : "Some checks failed");
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export default function validate(projectPath: string, schemaArg: string): Promise<ValidationResult[]>;
|
|
23
|
-
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/validate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAA8B,QAAQ,CACpC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAG7B"}
|