agent-rulebook 0.1.7 → 0.2.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 +54 -143
- package/dist/commands/index.js +11 -10
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/init.js +3 -6
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/output.d.ts +0 -5
- package/dist/commands/output.js +0 -47
- package/dist/commands/output.js.map +1 -1
- package/dist/commands/project.d.ts +2 -0
- package/dist/commands/project.js +33 -0
- package/dist/commands/project.js.map +1 -0
- package/dist/commands/resolution.d.ts +2 -0
- package/dist/commands/resolution.js +32 -0
- package/dist/commands/resolution.js.map +1 -0
- package/dist/commands/sync.d.ts +6 -3
- package/dist/commands/sync.js +130 -177
- package/dist/commands/sync.js.map +1 -1
- package/dist/core/attempt-outcome.d.ts +21 -0
- package/dist/core/attempt-outcome.js +61 -0
- package/dist/core/attempt-outcome.js.map +1 -0
- package/dist/core/change-policy.d.ts +7 -0
- package/dist/core/change-policy.js +14 -0
- package/dist/core/change-policy.js.map +1 -0
- package/dist/core/index.d.ts +34 -33
- package/dist/core/index.js +18 -14
- package/dist/core/index.js.map +1 -1
- package/dist/core/outcome-schema.d.ts +55 -0
- package/dist/core/outcome-schema.js +44 -0
- package/dist/core/outcome-schema.js.map +1 -0
- package/dist/core/problem-fingerprint.d.ts +4 -0
- package/dist/core/problem-fingerprint.js +37 -0
- package/dist/core/problem-fingerprint.js.map +1 -0
- package/dist/core/problem-schema.d.ts +34 -0
- package/dist/core/problem-schema.js +37 -0
- package/dist/core/problem-schema.js.map +1 -0
- package/dist/core/project-environment-detector.d.ts +2 -2
- package/dist/core/project-environment-detector.js +8 -52
- package/dist/core/project-environment-detector.js.map +1 -1
- package/dist/core/project-file-scan.d.ts +17 -0
- package/dist/core/project-file-scan.js +73 -0
- package/dist/core/project-file-scan.js.map +1 -0
- package/dist/core/project-registry.d.ts +8 -0
- package/dist/core/project-registry.js +38 -0
- package/dist/core/project-registry.js.map +1 -0
- package/dist/core/repository-identity.d.ts +7 -0
- package/dist/core/repository-identity.js +27 -0
- package/dist/core/repository-identity.js.map +1 -0
- package/dist/core/resolution-applicability.d.ts +20 -0
- package/dist/core/resolution-applicability.js +38 -0
- package/dist/core/resolution-applicability.js.map +1 -0
- package/dist/core/resolution-parser.d.ts +20 -0
- package/dist/core/resolution-parser.js +47 -0
- package/dist/core/resolution-parser.js.map +1 -0
- package/dist/core/resolution-ranker.d.ts +34 -0
- package/dist/core/resolution-ranker.js +40 -0
- package/dist/core/resolution-ranker.js.map +1 -0
- package/dist/core/resolution-relation.d.ts +14 -0
- package/dist/core/resolution-relation.js +29 -0
- package/dist/core/resolution-relation.js.map +1 -0
- package/dist/core/resolution-schema.d.ts +109 -0
- package/dist/core/resolution-schema.js +29 -0
- package/dist/core/resolution-schema.js.map +1 -0
- package/dist/core/resolution-search-types.d.ts +37 -0
- package/dist/core/resolution-search-types.js +2 -0
- package/dist/core/resolution-search-types.js.map +1 -0
- package/dist/core/resolution-semantic-checksum.d.ts +12 -0
- package/dist/core/resolution-semantic-checksum.js +24 -0
- package/dist/core/resolution-semantic-checksum.js.map +1 -0
- package/dist/core/resolution-writer.d.ts +7 -0
- package/dist/core/resolution-writer.js +33 -0
- package/dist/core/resolution-writer.js.map +1 -0
- package/dist/core/solution-schema.d.ts +42 -0
- package/dist/core/solution-schema.js +28 -0
- package/dist/core/solution-schema.js.map +1 -0
- package/dist/core/source-evidence-schema.d.ts +26 -0
- package/dist/core/source-evidence-schema.js +29 -0
- package/dist/core/source-evidence-schema.js.map +1 -0
- package/dist/core/source-evidence.d.ts +14 -0
- package/dist/core/source-evidence.js +69 -0
- package/dist/core/source-evidence.js.map +1 -0
- package/dist/core/stack-detector.d.ts +2 -2
- package/dist/core/stack-detector.js +11 -63
- package/dist/core/stack-detector.js.map +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.d.ts +3 -3
- package/dist/mcp/index.js +2 -2
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/resolution-change.d.ts +19 -0
- package/dist/mcp/resolution-change.js +136 -0
- package/dist/mcp/resolution-change.js.map +1 -0
- package/dist/mcp/resolutions-commit-change-tool.d.ts +5 -0
- package/dist/mcp/resolutions-commit-change-tool.js +21 -0
- package/dist/mcp/resolutions-commit-change-tool.js.map +1 -0
- package/dist/mcp/resolutions-find-tool.d.ts +5 -0
- package/dist/mcp/resolutions-find-tool.js +75 -0
- package/dist/mcp/resolutions-find-tool.js.map +1 -0
- package/dist/mcp/resolutions-get-source-tool.d.ts +5 -0
- package/dist/mcp/resolutions-get-source-tool.js +30 -0
- package/dist/mcp/resolutions-get-source-tool.js.map +1 -0
- package/dist/mcp/resolutions-get-tool.d.ts +5 -0
- package/dist/mcp/resolutions-get-tool.js +27 -0
- package/dist/mcp/resolutions-get-tool.js.map +1 -0
- package/dist/mcp/resolutions-list-facets-tool.d.ts +4 -0
- package/dist/mcp/resolutions-list-facets-tool.js +18 -0
- package/dist/mcp/resolutions-list-facets-tool.js.map +1 -0
- package/dist/mcp/resolutions-prepare-change-tool.d.ts +5 -0
- package/dist/mcp/resolutions-prepare-change-tool.js +7 -0
- package/dist/mcp/resolutions-prepare-change-tool.js.map +1 -0
- package/dist/mcp/resolutions-report-attempt-tool.d.ts +5 -0
- package/dist/mcp/resolutions-report-attempt-tool.js +87 -0
- package/dist/mcp/resolutions-report-attempt-tool.js.map +1 -0
- package/dist/mcp/schemas.d.ts +265 -197
- package/dist/mcp/schemas.js +28 -93
- package/dist/mcp/schemas.js.map +1 -1
- package/dist/mcp/tool-output.d.ts +0 -34
- package/dist/mcp/tool-output.js +2 -71
- package/dist/mcp/tool-output.js.map +1 -1
- package/dist/mcp/tools.d.ts +973 -204
- package/dist/mcp/tools.js +47 -101
- package/dist/mcp/tools.js.map +1 -1
- package/dist/program.js +5 -9
- package/dist/program.js.map +1 -1
- package/dist/storage/index.d.ts +10 -15
- package/dist/storage/index.js +8 -8
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/project-code-index-source.d.ts +2 -0
- package/dist/storage/project-code-index-source.js +23 -0
- package/dist/storage/project-code-index-source.js.map +1 -0
- package/dist/storage/resolution-candidate-service.d.ts +6 -0
- package/dist/storage/resolution-candidate-service.js +94 -0
- package/dist/storage/resolution-candidate-service.js.map +1 -0
- package/dist/storage/resolution-change-transaction.d.ts +11 -0
- package/dist/storage/resolution-change-transaction.js +56 -0
- package/dist/storage/resolution-change-transaction.js.map +1 -0
- package/dist/storage/resolution-home.d.ts +20 -0
- package/dist/storage/resolution-home.js +59 -0
- package/dist/storage/resolution-home.js.map +1 -0
- package/dist/storage/resolution-index-check.d.ts +28 -0
- package/dist/storage/resolution-index-check.js +30 -0
- package/dist/storage/resolution-index-check.js.map +1 -0
- package/dist/storage/resolution-indexer.d.ts +19 -0
- package/dist/storage/resolution-indexer.js +158 -0
- package/dist/storage/resolution-indexer.js.map +1 -0
- package/dist/storage/resolution-migrations.d.ts +3 -0
- package/dist/storage/resolution-migrations.js +39 -0
- package/dist/storage/resolution-migrations.js.map +1 -0
- package/package.json +5 -3
- package/dist/commands/add.d.ts +0 -2
- package/dist/commands/add.js +0 -134
- package/dist/commands/add.js.map +0 -1
- package/dist/commands/migrate.d.ts +0 -2
- package/dist/commands/migrate.js +0 -73
- package/dist/commands/migrate.js.map +0 -1
- package/dist/commands/rule.d.ts +0 -23
- package/dist/commands/rule.js +0 -158
- package/dist/commands/rule.js.map +0 -1
- package/dist/commands/search.d.ts +0 -2
- package/dist/commands/search.js +0 -57
- package/dist/commands/search.js.map +0 -1
- package/dist/core/capture-policy.d.ts +0 -6
- package/dist/core/capture-policy.js +0 -5
- package/dist/core/capture-policy.js.map +0 -1
- package/dist/core/compatibility-matcher.d.ts +0 -17
- package/dist/core/compatibility-matcher.js +0 -146
- package/dist/core/compatibility-matcher.js.map +0 -1
- package/dist/core/dedup.d.ts +0 -22
- package/dist/core/dedup.js +0 -54
- package/dist/core/dedup.js.map +0 -1
- package/dist/core/error-signature.d.ts +0 -15
- package/dist/core/error-signature.js +0 -59
- package/dist/core/error-signature.js.map +0 -1
- package/dist/core/facets.d.ts +0 -9
- package/dist/core/facets.js +0 -46
- package/dist/core/facets.js.map +0 -1
- package/dist/core/lesson-importer.d.ts +0 -22
- package/dist/core/lesson-importer.js +0 -94
- package/dist/core/lesson-importer.js.map +0 -1
- package/dist/core/ranker.d.ts +0 -3
- package/dist/core/ranker.js +0 -83
- package/dist/core/ranker.js.map +0 -1
- package/dist/core/rule-compatibility.d.ts +0 -66
- package/dist/core/rule-compatibility.js +0 -53
- package/dist/core/rule-compatibility.js.map +0 -1
- package/dist/core/rule-parser.d.ts +0 -25
- package/dist/core/rule-parser.js +0 -81
- package/dist/core/rule-parser.js.map +0 -1
- package/dist/core/rule-schema.d.ts +0 -283
- package/dist/core/rule-schema.js +0 -213
- package/dist/core/rule-schema.js.map +0 -1
- package/dist/core/rule-writer.d.ts +0 -35
- package/dist/core/rule-writer.js +0 -63
- package/dist/core/rule-writer.js.map +0 -1
- package/dist/core/search-types.d.ts +0 -57
- package/dist/core/search-types.js +0 -2
- package/dist/core/search-types.js.map +0 -1
- package/dist/core/semantic-checksum.d.ts +0 -6
- package/dist/core/semantic-checksum.js +0 -34
- package/dist/core/semantic-checksum.js.map +0 -1
- package/dist/core/slug.d.ts +0 -13
- package/dist/core/slug.js +0 -42
- package/dist/core/slug.js.map +0 -1
- package/dist/mcp/lesson-capture.d.ts +0 -30
- package/dist/mcp/lesson-capture.js +0 -148
- package/dist/mcp/lesson-capture.js.map +0 -1
- package/dist/mcp/rules-add-lesson-tool.d.ts +0 -4
- package/dist/mcp/rules-add-lesson-tool.js +0 -73
- package/dist/mcp/rules-add-lesson-tool.js.map +0 -1
- package/dist/mcp/rules-dedup-lesson-tool.d.ts +0 -4
- package/dist/mcp/rules-dedup-lesson-tool.js +0 -69
- package/dist/mcp/rules-dedup-lesson-tool.js.map +0 -1
- package/dist/mcp/rules-list-facets-tool.d.ts +0 -3
- package/dist/mcp/rules-list-facets-tool.js +0 -31
- package/dist/mcp/rules-list-facets-tool.js.map +0 -1
- package/dist/mcp/rules-prepare-lesson-tool.d.ts +0 -4
- package/dist/mcp/rules-prepare-lesson-tool.js +0 -7
- package/dist/mcp/rules-prepare-lesson-tool.js.map +0 -1
- package/dist/mcp/rules-search-error-tool.d.ts +0 -4
- package/dist/mcp/rules-search-error-tool.js +0 -103
- package/dist/mcp/rules-search-error-tool.js.map +0 -1
- package/dist/mcp/rules-search-for-project-tool.d.ts +0 -4
- package/dist/mcp/rules-search-for-project-tool.js +0 -105
- package/dist/mcp/rules-search-for-project-tool.js.map +0 -1
- package/dist/mcp/rules-search-tool.d.ts +0 -7
- package/dist/mcp/rules-search-tool.js +0 -65
- package/dist/mcp/rules-search-tool.js.map +0 -1
- package/dist/migration/adapters/fenced-lessons.d.ts +0 -2
- package/dist/migration/adapters/fenced-lessons.js +0 -55
- package/dist/migration/adapters/fenced-lessons.js.map +0 -1
- package/dist/migration/adapters/global-rules.d.ts +0 -2
- package/dist/migration/adapters/global-rules.js +0 -72
- package/dist/migration/adapters/global-rules.js.map +0 -1
- package/dist/migration/adapters/index.d.ts +0 -2
- package/dist/migration/adapters/index.js +0 -13
- package/dist/migration/adapters/index.js.map +0 -1
- package/dist/migration/adapters/markdown-lessons.d.ts +0 -2
- package/dist/migration/adapters/markdown-lessons.js +0 -36
- package/dist/migration/adapters/markdown-lessons.js.map +0 -1
- package/dist/migration/adapters/structured-lessons.d.ts +0 -2
- package/dist/migration/adapters/structured-lessons.js +0 -8
- package/dist/migration/adapters/structured-lessons.js.map +0 -1
- package/dist/migration/adapters/structured-shared.d.ts +0 -3
- package/dist/migration/adapters/structured-shared.js +0 -97
- package/dist/migration/adapters/structured-shared.js.map +0 -1
- package/dist/migration/applier.d.ts +0 -32
- package/dist/migration/applier.js +0 -559
- package/dist/migration/applier.js.map +0 -1
- package/dist/migration/index.d.ts +0 -11
- package/dist/migration/index.js +0 -7
- package/dist/migration/index.js.map +0 -1
- package/dist/migration/manifest.d.ts +0 -263
- package/dist/migration/manifest.js +0 -91
- package/dist/migration/manifest.js.map +0 -1
- package/dist/migration/migration-report.d.ts +0 -151
- package/dist/migration/migration-report.js +0 -85
- package/dist/migration/migration-report.js.map +0 -1
- package/dist/migration/scanner.d.ts +0 -2
- package/dist/migration/scanner.js +0 -312
- package/dist/migration/scanner.js.map +0 -1
- package/dist/migration/source-adapter.d.ts +0 -37
- package/dist/migration/source-adapter.js +0 -2
- package/dist/migration/source-adapter.js.map +0 -1
- package/dist/migration/verifier.d.ts +0 -5
- package/dist/migration/verifier.js +0 -218
- package/dist/migration/verifier.js.map +0 -1
- package/dist/storage/index-check.d.ts +0 -21
- package/dist/storage/index-check.js +0 -136
- package/dist/storage/index-check.js.map +0 -1
- package/dist/storage/indexer.d.ts +0 -19
- package/dist/storage/indexer.js +0 -367
- package/dist/storage/indexer.js.map +0 -1
- package/dist/storage/migrations.d.ts +0 -3
- package/dist/storage/migrations.js +0 -126
- package/dist/storage/migrations.js.map +0 -1
- package/dist/storage/rule-discovery.d.ts +0 -4
- package/dist/storage/rule-discovery.js +0 -34
- package/dist/storage/rule-discovery.js.map +0 -1
- package/dist/storage/rule-store.d.ts +0 -10
- package/dist/storage/rule-store.js +0 -12
- package/dist/storage/rule-store.js.map +0 -1
- package/dist/storage/rulebook-home.d.ts +0 -21
- package/dist/storage/rulebook-home.js +0 -78
- package/dist/storage/rulebook-home.js.map +0 -1
- package/dist/storage/search-service.d.ts +0 -17
- package/dist/storage/search-service.js +0 -275
- package/dist/storage/search-service.js.map +0 -1
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const RuleStatusSchema: z.ZodEnum<{
|
|
3
|
-
draft: "draft";
|
|
4
|
-
active: "active";
|
|
5
|
-
deprecated: "deprecated";
|
|
6
|
-
superseded: "superseded";
|
|
7
|
-
}>;
|
|
8
|
-
export declare const RuleConfidenceSchema: z.ZodEnum<{
|
|
9
|
-
low: "low";
|
|
10
|
-
high: "high";
|
|
11
|
-
medium: "medium";
|
|
12
|
-
}>;
|
|
13
|
-
export declare const RuleLanguageSchema: z.ZodPreprocess<z.ZodEnum<{
|
|
14
|
-
typescript: "typescript";
|
|
15
|
-
swift: "swift";
|
|
16
|
-
kotlin: "kotlin";
|
|
17
|
-
javascript: "javascript";
|
|
18
|
-
python: "python";
|
|
19
|
-
mcp: "mcp";
|
|
20
|
-
other: "other";
|
|
21
|
-
}>>;
|
|
22
|
-
export declare const RuleScopeSchema: z.ZodEnum<{
|
|
23
|
-
shared: "shared";
|
|
24
|
-
project: "project";
|
|
25
|
-
}>;
|
|
26
|
-
export declare const ImportedProvenanceSourceSchema: z.ZodObject<{
|
|
27
|
-
source_kind: z.ZodEnum<{
|
|
28
|
-
project_markdown: "project_markdown";
|
|
29
|
-
skill_lessons: "skill_lessons";
|
|
30
|
-
codex_rules: "codex_rules";
|
|
31
|
-
legacy_yaml: "legacy_yaml";
|
|
32
|
-
}>;
|
|
33
|
-
source_project: z.ZodOptional<z.ZodString>;
|
|
34
|
-
source_ref: z.ZodString;
|
|
35
|
-
source_checksum: z.ZodString;
|
|
36
|
-
}, z.core.$strip>;
|
|
37
|
-
export declare const RuleProvenanceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
38
|
-
additional_sources: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
39
|
-
source_kind: z.ZodEnum<{
|
|
40
|
-
project_markdown: "project_markdown";
|
|
41
|
-
skill_lessons: "skill_lessons";
|
|
42
|
-
codex_rules: "codex_rules";
|
|
43
|
-
legacy_yaml: "legacy_yaml";
|
|
44
|
-
}>;
|
|
45
|
-
source_project: z.ZodOptional<z.ZodString>;
|
|
46
|
-
source_ref: z.ZodString;
|
|
47
|
-
source_checksum: z.ZodString;
|
|
48
|
-
}, z.core.$strip>>>;
|
|
49
|
-
source_kind: z.ZodEnum<{
|
|
50
|
-
project_markdown: "project_markdown";
|
|
51
|
-
skill_lessons: "skill_lessons";
|
|
52
|
-
codex_rules: "codex_rules";
|
|
53
|
-
legacy_yaml: "legacy_yaml";
|
|
54
|
-
}>;
|
|
55
|
-
source_project: z.ZodOptional<z.ZodString>;
|
|
56
|
-
source_ref: z.ZodString;
|
|
57
|
-
source_checksum: z.ZodString;
|
|
58
|
-
imported: z.ZodLiteral<true>;
|
|
59
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
60
|
-
imported: z.ZodLiteral<false>;
|
|
61
|
-
}, z.core.$strip>], "imported">;
|
|
62
|
-
export declare const RuleActivationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
63
|
-
basis: z.ZodLiteral<"legacy_curated">;
|
|
64
|
-
capture_mode: z.ZodLiteral<"migration">;
|
|
65
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
66
|
-
basis: z.ZodLiteral<"tdd_verified">;
|
|
67
|
-
capture_mode: z.ZodLiteral<"tdd_auto">;
|
|
68
|
-
criteria: z.ZodObject<{
|
|
69
|
-
debugging_cost: z.ZodEnum<{
|
|
70
|
-
low: "low";
|
|
71
|
-
high: "high";
|
|
72
|
-
}>;
|
|
73
|
-
token_cost: z.ZodEnum<{
|
|
74
|
-
low: "low";
|
|
75
|
-
high: "high";
|
|
76
|
-
}>;
|
|
77
|
-
recurrence_risk: z.ZodEnum<{
|
|
78
|
-
low: "low";
|
|
79
|
-
high: "high";
|
|
80
|
-
}>;
|
|
81
|
-
}, z.core.$strip>;
|
|
82
|
-
dedup_result: z.ZodLiteral<"new">;
|
|
83
|
-
verification: z.ZodObject<{
|
|
84
|
-
kind: z.ZodEnum<{
|
|
85
|
-
focused_test: "focused_test";
|
|
86
|
-
integration_test: "integration_test";
|
|
87
|
-
manual_verification: "manual_verification";
|
|
88
|
-
}>;
|
|
89
|
-
evidence: z.ZodString;
|
|
90
|
-
}, z.core.$strip>;
|
|
91
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
92
|
-
basis: z.ZodLiteral<"manual_review">;
|
|
93
|
-
capture_mode: z.ZodLiteral<"manual">;
|
|
94
|
-
}, z.core.$strip>], "basis">;
|
|
95
|
-
export declare const LegacyRuleSchema: z.ZodObject<{
|
|
96
|
-
id: z.ZodString;
|
|
97
|
-
title: z.ZodString;
|
|
98
|
-
summary: z.ZodString;
|
|
99
|
-
mistake: z.ZodString;
|
|
100
|
-
fix: z.ZodString;
|
|
101
|
-
confidence: z.ZodEnum<{
|
|
102
|
-
low: "low";
|
|
103
|
-
high: "high";
|
|
104
|
-
medium: "medium";
|
|
105
|
-
}>;
|
|
106
|
-
status: z.ZodEnum<{
|
|
107
|
-
draft: "draft";
|
|
108
|
-
active: "active";
|
|
109
|
-
deprecated: "deprecated";
|
|
110
|
-
superseded: "superseded";
|
|
111
|
-
}>;
|
|
112
|
-
created_at: z.ZodString;
|
|
113
|
-
language: z.ZodOptional<z.ZodPreprocess<z.ZodEnum<{
|
|
114
|
-
typescript: "typescript";
|
|
115
|
-
swift: "swift";
|
|
116
|
-
kotlin: "kotlin";
|
|
117
|
-
javascript: "javascript";
|
|
118
|
-
python: "python";
|
|
119
|
-
mcp: "mcp";
|
|
120
|
-
other: "other";
|
|
121
|
-
}>>>;
|
|
122
|
-
platforms: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>>>;
|
|
123
|
-
tools: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>>>;
|
|
124
|
-
categories: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>>>;
|
|
125
|
-
trigger: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
126
|
-
anti_conditions: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
127
|
-
error_signature: z.ZodOptional<z.ZodString>;
|
|
128
|
-
source_project: z.ZodOptional<z.ZodString>;
|
|
129
|
-
verified_at: z.ZodOptional<z.ZodString>;
|
|
130
|
-
updated_at: z.ZodOptional<z.ZodString>;
|
|
131
|
-
superseded_by: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
132
|
-
schema_version: z.ZodOptional<z.ZodLiteral<1>>;
|
|
133
|
-
}, z.core.$strip>;
|
|
134
|
-
export declare const RuleSchema: z.ZodObject<{
|
|
135
|
-
id: z.ZodString;
|
|
136
|
-
title: z.ZodString;
|
|
137
|
-
summary: z.ZodString;
|
|
138
|
-
mistake: z.ZodString;
|
|
139
|
-
fix: z.ZodString;
|
|
140
|
-
confidence: z.ZodEnum<{
|
|
141
|
-
low: "low";
|
|
142
|
-
high: "high";
|
|
143
|
-
medium: "medium";
|
|
144
|
-
}>;
|
|
145
|
-
status: z.ZodEnum<{
|
|
146
|
-
draft: "draft";
|
|
147
|
-
active: "active";
|
|
148
|
-
deprecated: "deprecated";
|
|
149
|
-
superseded: "superseded";
|
|
150
|
-
}>;
|
|
151
|
-
created_at: z.ZodString;
|
|
152
|
-
language: z.ZodOptional<z.ZodPreprocess<z.ZodEnum<{
|
|
153
|
-
typescript: "typescript";
|
|
154
|
-
swift: "swift";
|
|
155
|
-
kotlin: "kotlin";
|
|
156
|
-
javascript: "javascript";
|
|
157
|
-
python: "python";
|
|
158
|
-
mcp: "mcp";
|
|
159
|
-
other: "other";
|
|
160
|
-
}>>>;
|
|
161
|
-
platforms: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>>>;
|
|
162
|
-
tools: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>>>;
|
|
163
|
-
categories: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>>>;
|
|
164
|
-
trigger: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
165
|
-
anti_conditions: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
166
|
-
error_signature: z.ZodOptional<z.ZodString>;
|
|
167
|
-
source_project: z.ZodOptional<z.ZodString>;
|
|
168
|
-
verified_at: z.ZodOptional<z.ZodString>;
|
|
169
|
-
updated_at: z.ZodOptional<z.ZodString>;
|
|
170
|
-
superseded_by: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
171
|
-
schema_version: z.ZodLiteral<2>;
|
|
172
|
-
rule_scope: z.ZodEnum<{
|
|
173
|
-
shared: "shared";
|
|
174
|
-
project: "project";
|
|
175
|
-
}>;
|
|
176
|
-
project_key: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>;
|
|
177
|
-
compatibility: z.ZodObject<{
|
|
178
|
-
scope: z.ZodEnum<{
|
|
179
|
-
unknown: "unknown";
|
|
180
|
-
version_agnostic: "version_agnostic";
|
|
181
|
-
constrained: "constrained";
|
|
182
|
-
}>;
|
|
183
|
-
constraints: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
184
|
-
kind: z.ZodEnum<{
|
|
185
|
-
language: "language";
|
|
186
|
-
sdk: "sdk";
|
|
187
|
-
toolchain: "toolchain";
|
|
188
|
-
framework: "framework";
|
|
189
|
-
runtime: "runtime";
|
|
190
|
-
build_tool: "build_tool";
|
|
191
|
-
platform: "platform";
|
|
192
|
-
}>;
|
|
193
|
-
component: z.ZodPreprocess<z.ZodString>;
|
|
194
|
-
range: z.ZodString;
|
|
195
|
-
}, z.core.$strip>>>;
|
|
196
|
-
verified_with: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
197
|
-
component: z.ZodPreprocess<z.ZodString>;
|
|
198
|
-
version: z.ZodString;
|
|
199
|
-
}, z.core.$strip>>>;
|
|
200
|
-
}, z.core.$strip>;
|
|
201
|
-
provenance: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
202
|
-
additional_sources: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
203
|
-
source_kind: z.ZodEnum<{
|
|
204
|
-
project_markdown: "project_markdown";
|
|
205
|
-
skill_lessons: "skill_lessons";
|
|
206
|
-
codex_rules: "codex_rules";
|
|
207
|
-
legacy_yaml: "legacy_yaml";
|
|
208
|
-
}>;
|
|
209
|
-
source_project: z.ZodOptional<z.ZodString>;
|
|
210
|
-
source_ref: z.ZodString;
|
|
211
|
-
source_checksum: z.ZodString;
|
|
212
|
-
}, z.core.$strip>>>;
|
|
213
|
-
source_kind: z.ZodEnum<{
|
|
214
|
-
project_markdown: "project_markdown";
|
|
215
|
-
skill_lessons: "skill_lessons";
|
|
216
|
-
codex_rules: "codex_rules";
|
|
217
|
-
legacy_yaml: "legacy_yaml";
|
|
218
|
-
}>;
|
|
219
|
-
source_project: z.ZodOptional<z.ZodString>;
|
|
220
|
-
source_ref: z.ZodString;
|
|
221
|
-
source_checksum: z.ZodString;
|
|
222
|
-
imported: z.ZodLiteral<true>;
|
|
223
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
224
|
-
imported: z.ZodLiteral<false>;
|
|
225
|
-
}, z.core.$strip>], "imported">;
|
|
226
|
-
activation: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
227
|
-
basis: z.ZodLiteral<"legacy_curated">;
|
|
228
|
-
capture_mode: z.ZodLiteral<"migration">;
|
|
229
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
230
|
-
basis: z.ZodLiteral<"tdd_verified">;
|
|
231
|
-
capture_mode: z.ZodLiteral<"tdd_auto">;
|
|
232
|
-
criteria: z.ZodObject<{
|
|
233
|
-
debugging_cost: z.ZodEnum<{
|
|
234
|
-
low: "low";
|
|
235
|
-
high: "high";
|
|
236
|
-
}>;
|
|
237
|
-
token_cost: z.ZodEnum<{
|
|
238
|
-
low: "low";
|
|
239
|
-
high: "high";
|
|
240
|
-
}>;
|
|
241
|
-
recurrence_risk: z.ZodEnum<{
|
|
242
|
-
low: "low";
|
|
243
|
-
high: "high";
|
|
244
|
-
}>;
|
|
245
|
-
}, z.core.$strip>;
|
|
246
|
-
dedup_result: z.ZodLiteral<"new">;
|
|
247
|
-
verification: z.ZodObject<{
|
|
248
|
-
kind: z.ZodEnum<{
|
|
249
|
-
focused_test: "focused_test";
|
|
250
|
-
integration_test: "integration_test";
|
|
251
|
-
manual_verification: "manual_verification";
|
|
252
|
-
}>;
|
|
253
|
-
evidence: z.ZodString;
|
|
254
|
-
}, z.core.$strip>;
|
|
255
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
256
|
-
basis: z.ZodLiteral<"manual_review">;
|
|
257
|
-
capture_mode: z.ZodLiteral<"manual">;
|
|
258
|
-
}, z.core.$strip>], "basis">;
|
|
259
|
-
}, z.core.$strip>;
|
|
260
|
-
export declare const LegacyRuleMarkerSchema: z.ZodObject<{
|
|
261
|
-
source_schema_version: z.ZodLiteral<1>;
|
|
262
|
-
}, z.core.$strip>;
|
|
263
|
-
export type RuleStatus = z.infer<typeof RuleStatusSchema>;
|
|
264
|
-
export type RuleConfidence = z.infer<typeof RuleConfidenceSchema>;
|
|
265
|
-
export type RuleLanguage = z.infer<typeof RuleLanguageSchema>;
|
|
266
|
-
export type RuleScope = z.infer<typeof RuleScopeSchema>;
|
|
267
|
-
export type ImportedProvenanceSource = z.infer<typeof ImportedProvenanceSourceSchema>;
|
|
268
|
-
export type RuleProvenance = z.infer<typeof RuleProvenanceSchema>;
|
|
269
|
-
export type RuleActivation = z.infer<typeof RuleActivationSchema>;
|
|
270
|
-
export type RuleV2 = z.infer<typeof RuleSchema>;
|
|
271
|
-
export type LegacyRuleDocument = z.infer<typeof LegacyRuleSchema>;
|
|
272
|
-
export type LoadedRule = RuleV2 & {
|
|
273
|
-
legacy?: z.infer<typeof LegacyRuleMarkerSchema>;
|
|
274
|
-
};
|
|
275
|
-
export type Rule = LegacyRuleDocument | LoadedRule;
|
|
276
|
-
export declare function toLegacyRuleCandidate(input: LegacyRuleDocument): LoadedRule;
|
|
277
|
-
export type RuleFacetWarning = {
|
|
278
|
-
kind: 'unknown_facet';
|
|
279
|
-
facet: 'platforms' | 'tools' | 'categories';
|
|
280
|
-
value: string;
|
|
281
|
-
};
|
|
282
|
-
export declare function collectUnknownFacetWarnings(rule: LoadedRule): RuleFacetWarning[];
|
|
283
|
-
export { isKnownFacetValue } from './facets.js';
|
package/dist/core/rule-schema.js
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { isCaptureCriteriaEligible } from './capture-policy.js';
|
|
3
|
-
import { isKnownFacetValue, normalizeFacetValue } from './facets.js';
|
|
4
|
-
import { LegacyCompatibility, RuleCompatibilitySchema } from './rule-compatibility.js';
|
|
5
|
-
const isoDateStringSchema = z.string().regex(/^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z?)?$/, 'Expected an ISO date string');
|
|
6
|
-
const facetValueSchema = z.string().transform(normalizeFacetValue).pipe(z.string().min(1));
|
|
7
|
-
const optionalFacetArraySchema = z.preprocess((value) => {
|
|
8
|
-
if (value === undefined || value === null) {
|
|
9
|
-
return [];
|
|
10
|
-
}
|
|
11
|
-
if (typeof value === 'string') {
|
|
12
|
-
return [value];
|
|
13
|
-
}
|
|
14
|
-
return value;
|
|
15
|
-
}, z.array(facetValueSchema).default([]));
|
|
16
|
-
export const RuleStatusSchema = z.enum(['draft', 'active', 'deprecated', 'superseded']);
|
|
17
|
-
export const RuleConfidenceSchema = z.enum(['low', 'medium', 'high']);
|
|
18
|
-
export const RuleLanguageSchema = z.preprocess((value) => (typeof value === 'string' ? normalizeFacetValue(value) : value), z.enum(['swift', 'kotlin', 'typescript', 'javascript', 'python', 'mcp', 'other']));
|
|
19
|
-
export const RuleScopeSchema = z.enum(['shared', 'project']);
|
|
20
|
-
const provenanceSourceRefSchema = z
|
|
21
|
-
.string()
|
|
22
|
-
.trim()
|
|
23
|
-
.min(1)
|
|
24
|
-
.refine((value) => !value.startsWith('/') && !value.startsWith('~') && !/^[A-Za-z]:[\\/]/.test(value), 'Source reference must not contain a local absolute path');
|
|
25
|
-
export const ImportedProvenanceSourceSchema = z.object({
|
|
26
|
-
source_kind: z.enum([
|
|
27
|
-
'project_markdown',
|
|
28
|
-
'skill_lessons',
|
|
29
|
-
'codex_rules',
|
|
30
|
-
'legacy_yaml',
|
|
31
|
-
]),
|
|
32
|
-
source_project: z.string().trim().min(1).optional(),
|
|
33
|
-
source_ref: provenanceSourceRefSchema,
|
|
34
|
-
source_checksum: z
|
|
35
|
-
.string()
|
|
36
|
-
.regex(/^sha256:[a-f0-9]{64}$/i, 'Expected a sha256-prefixed checksum'),
|
|
37
|
-
});
|
|
38
|
-
const ImportedProvenanceSchema = z
|
|
39
|
-
.object({
|
|
40
|
-
imported: z.literal(true),
|
|
41
|
-
...ImportedProvenanceSourceSchema.shape,
|
|
42
|
-
additional_sources: z.array(ImportedProvenanceSourceSchema).default([]),
|
|
43
|
-
})
|
|
44
|
-
.superRefine((provenance, context) => {
|
|
45
|
-
const sourceChecksums = new Set([provenance.source_checksum]);
|
|
46
|
-
provenance.additional_sources.forEach((source, index) => {
|
|
47
|
-
if (sourceChecksums.has(source.source_checksum)) {
|
|
48
|
-
context.addIssue({
|
|
49
|
-
code: 'custom',
|
|
50
|
-
path: ['additional_sources', index, 'source_checksum'],
|
|
51
|
-
message: 'Imported provenance source checksums must be unique',
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
sourceChecksums.add(source.source_checksum);
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
const DirectProvenanceSchema = z.object({
|
|
58
|
-
imported: z.literal(false),
|
|
59
|
-
});
|
|
60
|
-
export const RuleProvenanceSchema = z.discriminatedUnion('imported', [
|
|
61
|
-
ImportedProvenanceSchema,
|
|
62
|
-
DirectProvenanceSchema,
|
|
63
|
-
]);
|
|
64
|
-
const LegacyActivationSchema = z.object({
|
|
65
|
-
basis: z.literal('legacy_curated'),
|
|
66
|
-
capture_mode: z.literal('migration'),
|
|
67
|
-
});
|
|
68
|
-
const TddCaptureCriteriaSchema = z
|
|
69
|
-
.object({
|
|
70
|
-
debugging_cost: z.enum(['low', 'high']),
|
|
71
|
-
token_cost: z.enum(['low', 'high']),
|
|
72
|
-
recurrence_risk: z.enum(['low', 'high']),
|
|
73
|
-
})
|
|
74
|
-
.superRefine((criteria, context) => {
|
|
75
|
-
if (!isCaptureCriteriaEligible(criteria)) {
|
|
76
|
-
context.addIssue({
|
|
77
|
-
code: 'custom',
|
|
78
|
-
message: 'Recurrence risk must be high and at least one capture cost must be high',
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
const TddVerifiedActivationSchema = z.object({
|
|
83
|
-
basis: z.literal('tdd_verified'),
|
|
84
|
-
capture_mode: z.literal('tdd_auto'),
|
|
85
|
-
criteria: TddCaptureCriteriaSchema,
|
|
86
|
-
dedup_result: z.literal('new'),
|
|
87
|
-
verification: z.object({
|
|
88
|
-
kind: z.enum(['focused_test', 'integration_test', 'manual_verification']),
|
|
89
|
-
evidence: z.string().trim().min(1),
|
|
90
|
-
}),
|
|
91
|
-
});
|
|
92
|
-
const ManualActivationSchema = z.object({
|
|
93
|
-
basis: z.literal('manual_review'),
|
|
94
|
-
capture_mode: z.literal('manual'),
|
|
95
|
-
});
|
|
96
|
-
export const RuleActivationSchema = z.discriminatedUnion('basis', [
|
|
97
|
-
LegacyActivationSchema,
|
|
98
|
-
TddVerifiedActivationSchema,
|
|
99
|
-
ManualActivationSchema,
|
|
100
|
-
]);
|
|
101
|
-
const ruleFields = {
|
|
102
|
-
id: z.string().trim().min(1),
|
|
103
|
-
title: z.string().trim().min(1),
|
|
104
|
-
summary: z.string().trim().min(1),
|
|
105
|
-
mistake: z.string().trim().min(1),
|
|
106
|
-
fix: z.string().trim().min(1),
|
|
107
|
-
confidence: RuleConfidenceSchema,
|
|
108
|
-
status: RuleStatusSchema,
|
|
109
|
-
created_at: isoDateStringSchema,
|
|
110
|
-
language: RuleLanguageSchema.optional(),
|
|
111
|
-
platforms: optionalFacetArraySchema,
|
|
112
|
-
tools: optionalFacetArraySchema,
|
|
113
|
-
categories: optionalFacetArraySchema,
|
|
114
|
-
trigger: z.preprocess((value) => value ?? [], z.array(z.string()).default([])),
|
|
115
|
-
anti_conditions: z.preprocess((value) => value ?? [], z.array(z.string()).default([])),
|
|
116
|
-
error_signature: z.string().min(1).optional(),
|
|
117
|
-
source_project: z.string().min(1).optional(),
|
|
118
|
-
verified_at: isoDateStringSchema.optional(),
|
|
119
|
-
updated_at: isoDateStringSchema.optional(),
|
|
120
|
-
superseded_by: z.string().trim().min(1).nullable().optional(),
|
|
121
|
-
};
|
|
122
|
-
export const LegacyRuleSchema = z.object({
|
|
123
|
-
schema_version: z.literal(1).optional(),
|
|
124
|
-
...ruleFields,
|
|
125
|
-
});
|
|
126
|
-
export const RuleSchema = z
|
|
127
|
-
.object({
|
|
128
|
-
schema_version: z.literal(2),
|
|
129
|
-
rule_scope: RuleScopeSchema,
|
|
130
|
-
project_key: facetValueSchema
|
|
131
|
-
.refine((value) => /^[a-z0-9][a-z0-9._-]*$/.test(value), 'Expected a stable project key')
|
|
132
|
-
.optional(),
|
|
133
|
-
compatibility: RuleCompatibilitySchema,
|
|
134
|
-
provenance: RuleProvenanceSchema,
|
|
135
|
-
activation: RuleActivationSchema,
|
|
136
|
-
...ruleFields,
|
|
137
|
-
})
|
|
138
|
-
.superRefine((rule, context) => {
|
|
139
|
-
if (rule.rule_scope === 'project' && rule.project_key === undefined) {
|
|
140
|
-
context.addIssue({
|
|
141
|
-
code: 'custom',
|
|
142
|
-
path: ['project_key'],
|
|
143
|
-
message: 'Project scoped rules require a stable project_key',
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
if (rule.rule_scope === 'shared' && rule.project_key !== undefined) {
|
|
147
|
-
context.addIssue({
|
|
148
|
-
code: 'custom',
|
|
149
|
-
path: ['project_key'],
|
|
150
|
-
message: 'Shared rules cannot include a project_key',
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
if (rule.status === 'superseded' && rule.superseded_by == null) {
|
|
154
|
-
context.addIssue({
|
|
155
|
-
code: 'custom',
|
|
156
|
-
path: ['superseded_by'],
|
|
157
|
-
message: 'Superseded rules require superseded_by',
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
if (rule.superseded_by === rule.id) {
|
|
161
|
-
context.addIssue({
|
|
162
|
-
code: 'custom',
|
|
163
|
-
path: ['superseded_by'],
|
|
164
|
-
message: 'A rule cannot supersede itself',
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
if (rule.status !== 'superseded' && rule.superseded_by != null) {
|
|
168
|
-
context.addIssue({
|
|
169
|
-
code: 'custom',
|
|
170
|
-
path: ['superseded_by'],
|
|
171
|
-
message: 'Only superseded rules can name a replacement',
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
if (rule.activation.basis === 'tdd_verified' && rule.status !== 'active') {
|
|
175
|
-
context.addIssue({
|
|
176
|
-
code: 'custom',
|
|
177
|
-
path: ['status'],
|
|
178
|
-
message: 'TDD verified activation requires active status',
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
export const LegacyRuleMarkerSchema = z.object({
|
|
183
|
-
source_schema_version: z.literal(1),
|
|
184
|
-
});
|
|
185
|
-
export function toLegacyRuleCandidate(input) {
|
|
186
|
-
const { schema_version: _schemaVersion, ...fields } = input;
|
|
187
|
-
return {
|
|
188
|
-
...fields,
|
|
189
|
-
schema_version: 2,
|
|
190
|
-
rule_scope: 'shared',
|
|
191
|
-
compatibility: {
|
|
192
|
-
scope: LegacyCompatibility.scope,
|
|
193
|
-
constraints: [],
|
|
194
|
-
verified_with: [],
|
|
195
|
-
},
|
|
196
|
-
provenance: { imported: false },
|
|
197
|
-
activation: { basis: 'legacy_curated', capture_mode: 'migration' },
|
|
198
|
-
legacy: { source_schema_version: 1 },
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
export function collectUnknownFacetWarnings(rule) {
|
|
202
|
-
const warnings = [];
|
|
203
|
-
for (const facet of ['platforms', 'tools', 'categories']) {
|
|
204
|
-
for (const value of rule[facet]) {
|
|
205
|
-
if (!isKnownFacetValue(facet, value)) {
|
|
206
|
-
warnings.push({ kind: 'unknown_facet', facet, value });
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
return warnings;
|
|
211
|
-
}
|
|
212
|
-
export { isKnownFacetValue } from './facets.js';
|
|
213
|
-
//# sourceMappingURL=rule-schema.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rule-schema.js","sourceRoot":"","sources":["../../src/core/rule-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAEvF,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAC1C,0DAA0D,EAC1D,6BAA6B,CAC9B,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAE3F,MAAM,wBAAwB,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,EAAE;IACtD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,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U,EAAE,CAAC;QAClE,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAChC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC;gBACrC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;YACzD,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { type RedactionScanOptions, type RedactionScanResult } from './redaction.js';
|
|
2
|
-
import type { RuleConfidence, RuleLanguage, RuleStatus } from './rule-schema.js';
|
|
3
|
-
export type RuleDraftInput = {
|
|
4
|
-
title: string;
|
|
5
|
-
summary?: string;
|
|
6
|
-
mistake: string;
|
|
7
|
-
fix: string;
|
|
8
|
-
confidence?: RuleConfidence;
|
|
9
|
-
status?: RuleStatus;
|
|
10
|
-
language?: RuleLanguage;
|
|
11
|
-
platforms?: string[];
|
|
12
|
-
tools?: string[];
|
|
13
|
-
categories?: string[];
|
|
14
|
-
trigger?: string[];
|
|
15
|
-
anti_conditions?: string[];
|
|
16
|
-
error_signature?: string;
|
|
17
|
-
source_project?: string;
|
|
18
|
-
verified_at?: string;
|
|
19
|
-
updated_at?: string;
|
|
20
|
-
superseded_by?: string;
|
|
21
|
-
};
|
|
22
|
-
export type BuildRulePreviewOptions = RedactionScanOptions & {
|
|
23
|
-
rulebookHome: string;
|
|
24
|
-
now?: Date;
|
|
25
|
-
};
|
|
26
|
-
export type RulePreview = {
|
|
27
|
-
id: string;
|
|
28
|
-
relativePath: string;
|
|
29
|
-
yaml: string;
|
|
30
|
-
requires_confirmation: boolean;
|
|
31
|
-
can_save: boolean;
|
|
32
|
-
warnings: RedactionScanResult['warnings'];
|
|
33
|
-
suggested_redactions: RedactionScanResult['suggested_redactions'];
|
|
34
|
-
};
|
|
35
|
-
export declare function buildRulePreview(input: RuleDraftInput, options: BuildRulePreviewOptions): Promise<RulePreview>;
|
package/dist/core/rule-writer.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { stringify } from 'yaml';
|
|
2
|
-
import { scanRuleDraftForRedactions, } from './redaction.js';
|
|
3
|
-
import { generateRuleIdentity } from './slug.js';
|
|
4
|
-
const DEFAULT_CONFIDENCE = 'medium';
|
|
5
|
-
const DEFAULT_STATUS = 'draft';
|
|
6
|
-
export async function buildRulePreview(input, options) {
|
|
7
|
-
const identity = await generateRuleIdentity({
|
|
8
|
-
rulebookHome: options.rulebookHome,
|
|
9
|
-
title: input.title,
|
|
10
|
-
language: input.language,
|
|
11
|
-
});
|
|
12
|
-
const redaction = scanRuleDraftForRedactions(input, { homeDir: options.homeDir });
|
|
13
|
-
const rule = buildRule(input, identity.id, options.now ?? new Date());
|
|
14
|
-
return {
|
|
15
|
-
id: identity.id,
|
|
16
|
-
relativePath: identity.relativePath,
|
|
17
|
-
yaml: stringify(rule),
|
|
18
|
-
requires_confirmation: true,
|
|
19
|
-
can_save: redaction.can_save,
|
|
20
|
-
warnings: redaction.warnings,
|
|
21
|
-
suggested_redactions: redaction.suggested_redactions,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
function buildRule(input, id, now) {
|
|
25
|
-
const rule = {
|
|
26
|
-
id,
|
|
27
|
-
title: input.title,
|
|
28
|
-
summary: input.summary ?? input.title,
|
|
29
|
-
platforms: input.platforms ?? [],
|
|
30
|
-
tools: input.tools ?? [],
|
|
31
|
-
categories: input.categories ?? [],
|
|
32
|
-
trigger: input.trigger ?? [],
|
|
33
|
-
mistake: input.mistake,
|
|
34
|
-
fix: input.fix,
|
|
35
|
-
anti_conditions: input.anti_conditions ?? [],
|
|
36
|
-
created_at: toDateOnly(now),
|
|
37
|
-
confidence: input.confidence ?? DEFAULT_CONFIDENCE,
|
|
38
|
-
status: input.status ?? DEFAULT_STATUS,
|
|
39
|
-
};
|
|
40
|
-
if (input.language !== undefined) {
|
|
41
|
-
rule.language = input.language;
|
|
42
|
-
}
|
|
43
|
-
if (input.error_signature !== undefined) {
|
|
44
|
-
rule.error_signature = input.error_signature;
|
|
45
|
-
}
|
|
46
|
-
if (input.source_project !== undefined) {
|
|
47
|
-
rule.source_project = input.source_project;
|
|
48
|
-
}
|
|
49
|
-
if (input.verified_at !== undefined) {
|
|
50
|
-
rule.verified_at = input.verified_at;
|
|
51
|
-
}
|
|
52
|
-
if (input.updated_at !== undefined) {
|
|
53
|
-
rule.updated_at = input.updated_at;
|
|
54
|
-
}
|
|
55
|
-
if (input.superseded_by !== undefined) {
|
|
56
|
-
rule.superseded_by = input.superseded_by;
|
|
57
|
-
}
|
|
58
|
-
return rule;
|
|
59
|
-
}
|
|
60
|
-
function toDateOnly(date) {
|
|
61
|
-
return date.toISOString().slice(0, 10);
|
|
62
|
-
}
|
|
63
|
-
//# sourceMappingURL=rule-writer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rule-writer.js","sourceRoot":"","sources":["../../src/core/rule-writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EACL,0BAA0B,GAG3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAsCjD,MAAM,kBAAkB,GAAmB,QAAQ,CAAC;AACpD,MAAM,cAAc,GAAe,OAAO,CAAC;AAE3C,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,KAAqB,EACrB,OAAgC;IAEhC,MAAM,QAAQ,GAAG,MAAM,oBAAoB,CAAC;QAC1C,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC,CAAC;IACH,MAAM,SAAS,G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I,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;IACjC,CAAC;IACD,IAAI,KAAK,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;QACxC,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;IAC/C,CAAC;IACD,IAAI,KAAK,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;QACvC,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC;IAC7C,CAAC;IACD,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QACpC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;IACvC,CAAC;IACD,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QACnC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;IACrC,CAAC;IACD,IAAI,KAAK,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;QACtC,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;IAC3C,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,UAAU,CAAC,IAAU;IAC5B,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { RuleConfidence, RuleLanguage, RuleStatus } from './rule-schema.js';
|
|
2
|
-
import type { CompatibilityEnvironmentComponent, CompatibilityWarning } from './compatibility-matcher.js';
|
|
3
|
-
export type SearchFilters = {
|
|
4
|
-
language?: RuleLanguage;
|
|
5
|
-
tools?: string[];
|
|
6
|
-
categories?: string[];
|
|
7
|
-
platforms?: string[];
|
|
8
|
-
status?: RuleStatus[];
|
|
9
|
-
};
|
|
10
|
-
export type SearchQuery = {
|
|
11
|
-
text: string;
|
|
12
|
-
filters?: SearchFilters;
|
|
13
|
-
environment?: CompatibilityEnvironmentComponent[];
|
|
14
|
-
projectKey?: string;
|
|
15
|
-
limit?: number;
|
|
16
|
-
};
|
|
17
|
-
export type SearchLimitPolicy = {
|
|
18
|
-
defaultLimit: number;
|
|
19
|
-
maxLimit: number;
|
|
20
|
-
};
|
|
21
|
-
export type SearchResult = {
|
|
22
|
-
id: string;
|
|
23
|
-
title: string;
|
|
24
|
-
summary: string;
|
|
25
|
-
fix: string;
|
|
26
|
-
path: string;
|
|
27
|
-
confidence: RuleConfidence;
|
|
28
|
-
status: RuleStatus;
|
|
29
|
-
applicability: 'version_agnostic' | 'compatible' | 'unknown';
|
|
30
|
-
applicabilityReason: string;
|
|
31
|
-
compatibilityEvidence: string[];
|
|
32
|
-
ruleScope: 'shared' | 'project';
|
|
33
|
-
projectRelation: 'shared' | 'current_project' | 'foreign_project';
|
|
34
|
-
usage: 'direct' | 'reference';
|
|
35
|
-
projectKey?: string;
|
|
36
|
-
sourceProject?: string;
|
|
37
|
-
warnings: CompatibilityWarning[];
|
|
38
|
-
score: number;
|
|
39
|
-
};
|
|
40
|
-
export type SearchDiagnostic = {
|
|
41
|
-
code: 'unknown_facet' | 'unknown_environment' | 'incompatible_environment' | 'project_scope_mismatch' | 'invalid_rule_source';
|
|
42
|
-
message: string;
|
|
43
|
-
};
|
|
44
|
-
export type SearchResponse = {
|
|
45
|
-
results: SearchResult[];
|
|
46
|
-
hint?: string;
|
|
47
|
-
diagnostics: SearchDiagnostic[];
|
|
48
|
-
applied: {
|
|
49
|
-
filters: SearchFilters;
|
|
50
|
-
environment: string[];
|
|
51
|
-
projectKey?: string;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
export type RankableSearchCandidate = Omit<SearchResult, 'score'> & {
|
|
55
|
-
matchScore: number;
|
|
56
|
-
lifecycleDate?: string;
|
|
57
|
-
};
|