@standards-kit/conform 0.1.0 → 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/LICENSE +21 -0
- package/README.md +143 -0
- package/dist/{chunk-P7TIZJ4C.js → chunk-DXIYZR62.js} +2 -2
- package/dist/chunk-DXIYZR62.js.map +1 -0
- package/dist/{chunk-RXA4FO7L.js → chunk-NADY2H35.js} +12 -8
- package/dist/chunk-NADY2H35.js.map +1 -0
- package/dist/chunk-O745CMWG.js +29 -0
- package/dist/chunk-O745CMWG.js.map +1 -0
- package/dist/chunk-RHM53NLG.js +49 -0
- package/dist/chunk-RHM53NLG.js.map +1 -0
- package/dist/{chunk-KHO6NIAI.js → chunk-YGDEM6K5.js} +24 -10
- package/dist/chunk-YGDEM6K5.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +49 -38
- package/dist/cli.js.map +1 -1
- package/dist/{cloudwatch-KSZ4A256.js → cloudwatch-3LTDYG6G.js} +6 -10
- package/dist/cloudwatch-3LTDYG6G.js.map +1 -0
- package/dist/code/index.d.ts +11 -0
- package/dist/code/tools/base.d.ts +51 -0
- package/dist/code/tools/comment-utils.d.ts +17 -0
- package/dist/code/tools/coverage-run.d.ts +37 -0
- package/dist/code/tools/disable-comments.d.ts +42 -0
- package/dist/code/tools/eslint.d.ts +99 -0
- package/dist/code/tools/gitleaks.d.ts +42 -0
- package/dist/code/tools/index.d.ts +13 -0
- package/dist/code/tools/knip.d.ts +20 -0
- package/dist/code/tools/naming.d.ts +64 -0
- package/dist/code/tools/pipaudit.d.ts +24 -0
- package/dist/code/tools/pnpmaudit.d.ts +36 -0
- package/dist/code/tools/ruff.d.ts +46 -0
- package/dist/code/tools/tsc.d.ts +57 -0
- package/dist/code/tools/ty.d.ts +34 -0
- package/dist/code/tools/vulture.d.ts +32 -0
- package/dist/constants.d.ts +69 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/core/loader.d.ts +42 -0
- package/dist/core/registry.d.ts +17 -0
- package/dist/core/schema.d.ts +1857 -0
- package/dist/core/types.d.ts +95 -0
- package/dist/{src-KZRTG3EU.js → core-QRFGIQ42.js} +4 -3
- package/dist/dependencies/index.d.ts +13 -0
- package/dist/dependencies/mappings.d.ts +17 -0
- package/dist/dependencies/output.d.ts +12 -0
- package/dist/dependencies/types.d.ts +34 -0
- package/dist/{dynamodb-5KVESCVJ.js → dynamodb-HQH3IMAI.js} +6 -10
- package/dist/dynamodb-HQH3IMAI.js.map +1 -0
- package/dist/{ec2-HKPE6GZV.js → ec2-AEPT735A.js} +6 -10
- package/dist/ec2-AEPT735A.js.map +1 -0
- package/dist/{ecs-OS3NJZTA.js → ecs-UHKCH5A7.js} +6 -10
- package/dist/ecs-UHKCH5A7.js.map +1 -0
- package/dist/{elasticache-7TCRHYYM.js → elasticache-5Y6K7GKJ.js} +6 -10
- package/dist/elasticache-5Y6K7GKJ.js.map +1 -0
- package/dist/{elb-PEDLXW5R.js → elb-CN6ELVM5.js} +6 -10
- package/dist/elb-CN6ELVM5.js.map +1 -0
- package/dist/{iam-7H5HFWVQ.js → iam-YXMHK2MV.js} +6 -2
- package/dist/iam-YXMHK2MV.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +99 -121
- package/dist/index.js.map +1 -1
- package/dist/infra/arn.d.ts +16 -0
- package/dist/infra/checkers/client-factory.d.ts +45 -0
- package/dist/infra/checkers/cloudwatch.d.ts +8 -0
- package/dist/infra/checkers/dynamodb.d.ts +8 -0
- package/dist/infra/checkers/ec2.d.ts +13 -0
- package/dist/infra/checkers/ecs.d.ts +13 -0
- package/dist/infra/checkers/elasticache.d.ts +13 -0
- package/dist/infra/checkers/elb.d.ts +13 -0
- package/dist/infra/checkers/gcp/artifactregistry.d.ts +5 -0
- package/dist/infra/checkers/gcp/cloudrun.d.ts +5 -0
- package/dist/infra/checkers/gcp/iam.d.ts +5 -0
- package/dist/infra/checkers/gcp/index.d.ts +17 -0
- package/dist/infra/checkers/gcp/secretmanager.d.ts +5 -0
- package/dist/infra/checkers/iam.d.ts +8 -0
- package/dist/infra/checkers/index.d.ts +26 -0
- package/dist/infra/checkers/lambda.d.ts +8 -0
- package/dist/infra/checkers/rds.d.ts +13 -0
- package/dist/infra/checkers/s3.d.ts +8 -0
- package/dist/infra/checkers/secretsmanager.d.ts +8 -0
- package/dist/infra/checkers/sns.d.ts +8 -0
- package/dist/infra/checkers/sqs.d.ts +8 -0
- package/dist/infra/checkers/types.d.ts +28 -0
- package/dist/infra/gcp.d.ts +18 -0
- package/dist/infra/generate.d.ts +74 -0
- package/dist/infra/index.d.ts +59 -0
- package/dist/infra/manifest.d.ts +58 -0
- package/dist/infra/output.d.ts +8 -0
- package/dist/infra/scan.d.ts +25 -0
- package/dist/infra/schemas.d.ts +806 -0
- package/dist/infra/types.d.ts +8 -0
- package/dist/{infra-UXM5XQX3.js → infra-TO54IUSC.js} +21 -19
- package/dist/infra-TO54IUSC.js.map +1 -0
- package/dist/{lambda-NFB5UILT.js → lambda-YTJOCYV5.js} +6 -10
- package/dist/lambda-YTJOCYV5.js.map +1 -0
- package/dist/mcp/index.d.ts +7 -0
- package/dist/mcp/server.d.ts +18 -0
- package/dist/mcp/standards/fetcher.d.ts +29 -0
- package/dist/mcp/standards/index.d.ts +4 -0
- package/dist/mcp/standards/matcher.d.ts +22 -0
- package/dist/mcp/standards/parser.d.ts +46 -0
- package/dist/mcp/standards/types.d.ts +32 -0
- package/dist/mcp/tools/get-guideline.d.ts +26 -0
- package/dist/mcp/tools/get-ruleset.d.ts +26 -0
- package/dist/mcp/tools/get-standards.d.ts +27 -0
- package/dist/mcp/tools/index.d.ts +4 -0
- package/dist/mcp/tools/list-guidelines.d.ts +25 -0
- package/dist/{mcp-O5O7XVFG.js → mcp-73FZXT3P.js} +5 -4
- package/dist/mcp-73FZXT3P.js.map +1 -0
- package/dist/output/index.d.ts +14 -0
- package/dist/process/commands/check-branch.d.ts +13 -0
- package/dist/process/commands/check-commit.d.ts +14 -0
- package/dist/process/commands/index.d.ts +2 -0
- package/dist/process/index.d.ts +11 -0
- package/dist/process/scan/index.d.ts +5 -0
- package/dist/process/scan/remote-fetcher.d.ts +18 -0
- package/dist/process/scan/scanner.d.ts +6 -0
- package/dist/process/scan/types.d.ts +57 -0
- package/dist/process/scan/validators.d.ts +37 -0
- package/dist/process/sync/applier.d.ts +10 -0
- package/dist/process/sync/differ.d.ts +7 -0
- package/dist/process/sync/fetcher.d.ts +14 -0
- package/dist/process/sync/index.d.ts +9 -0
- package/dist/process/sync/types.d.ts +131 -0
- package/dist/process/sync/validator.d.ts +22 -0
- package/dist/process/tools/backups.d.ts +32 -0
- package/dist/process/tools/base.d.ts +52 -0
- package/dist/process/tools/branches.d.ts +41 -0
- package/dist/process/tools/changesets.d.ts +53 -0
- package/dist/process/tools/ci.d.ts +57 -0
- package/dist/process/tools/codeowners.d.ts +68 -0
- package/dist/process/tools/commits.d.ts +39 -0
- package/dist/process/tools/coverage.d.ts +57 -0
- package/dist/process/tools/docs-helpers.d.ts +44 -0
- package/dist/process/tools/docs.d.ts +38 -0
- package/dist/process/tools/forbidden-files.d.ts +40 -0
- package/dist/process/tools/hooks.d.ts +39 -0
- package/dist/process/tools/index.d.ts +14 -0
- package/dist/process/tools/pr.d.ts +59 -0
- package/dist/process/tools/repo.d.ts +65 -0
- package/dist/process/tools/tickets.d.ts +42 -0
- package/dist/projects/detector.d.ts +16 -0
- package/dist/projects/index.d.ts +4 -0
- package/dist/projects/templates.d.ts +15 -0
- package/dist/projects/tier-loader.d.ts +21 -0
- package/dist/projects/types.d.ts +76 -0
- package/dist/{rds-KLG5O5SI.js → rds-GZ5RVPIU.js} +6 -10
- package/dist/rds-GZ5RVPIU.js.map +1 -0
- package/dist/{registry-V65CC7IN.js → registry-JRCQAIHR.js} +3 -2
- package/dist/{s3-2DH7PRVR.js → s3-53UELUWT.js} +16 -12
- package/dist/s3-53UELUWT.js.map +1 -0
- package/dist/s3-S4GXNR7H.js +53 -0
- package/dist/s3-S4GXNR7H.js.map +1 -0
- package/dist/{scan-EELS42BP.js → scan-RHQWHASY.js} +5 -4
- package/dist/{scan-EELS42BP.js.map → scan-RHQWHASY.js.map} +1 -1
- package/dist/{secretsmanager-MOOIHLAO.js → secretsmanager-FJKTPIXI.js} +6 -10
- package/dist/secretsmanager-FJKTPIXI.js.map +1 -0
- package/dist/{sns-Y36LVTWA.js → sns-RV64OMK2.js} +6 -10
- package/dist/sns-RV64OMK2.js.map +1 -0
- package/dist/{sqs-RRS3GRHK.js → sqs-MHBW6UFC.js} +6 -10
- package/dist/sqs-MHBW6UFC.js.map +1 -0
- package/dist/{standards-RXK5G4IG.js → standards-XAZKTKYJ.js} +3 -2
- package/dist/{sync-RLYBGYNY.js → sync-P3UZECLW.js} +4 -3
- package/dist/{sync-RLYBGYNY.js.map → sync-P3UZECLW.js.map} +1 -1
- package/dist/validate/guidelines.d.ts +18 -0
- package/dist/validate/index.d.ts +5 -0
- package/dist/validate/tier.d.ts +17 -0
- package/dist/validate/types.d.ts +50 -0
- package/dist/{validate-AABLVQJS.js → validate-J5E336GX.js} +53 -84
- package/dist/validate-J5E336GX.js.map +1 -0
- package/package.json +22 -25
- package/dist/chunk-KHO6NIAI.js.map +0 -1
- package/dist/chunk-P7TIZJ4C.js.map +0 -1
- package/dist/chunk-RXA4FO7L.js.map +0 -1
- package/dist/cloudwatch-KSZ4A256.js.map +0 -1
- package/dist/dynamodb-5KVESCVJ.js.map +0 -1
- package/dist/ec2-HKPE6GZV.js.map +0 -1
- package/dist/ecs-OS3NJZTA.js.map +0 -1
- package/dist/elasticache-7TCRHYYM.js.map +0 -1
- package/dist/elb-PEDLXW5R.js.map +0 -1
- package/dist/iam-7H5HFWVQ.js.map +0 -1
- package/dist/infra-UXM5XQX3.js.map +0 -1
- package/dist/lambda-NFB5UILT.js.map +0 -1
- package/dist/mcp-O5O7XVFG.js.map +0 -1
- package/dist/rds-KLG5O5SI.js.map +0 -1
- package/dist/s3-2DH7PRVR.js.map +0 -1
- package/dist/secretsmanager-MOOIHLAO.js.map +0 -1
- package/dist/sns-Y36LVTWA.js.map +0 -1
- package/dist/sqs-RRS3GRHK.js.map +0 -1
- package/dist/validate-AABLVQJS.js.map +0 -1
- /package/dist/{registry-V65CC7IN.js.map → core-QRFGIQ42.js.map} +0 -0
- /package/dist/{src-KZRTG3EU.js.map → registry-JRCQAIHR.js.map} +0 -0
- /package/dist/{standards-RXK5G4IG.js.map → standards-XAZKTKYJ.js.map} +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Chris Little
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# @standards-kit/conform
|
|
2
|
+
|
|
3
|
+
In-repo standards enforcement CLI. Validates your repository against configured standards for code quality, process compliance, and infrastructure configuration.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -D @standards-kit/conform
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Initialize configuration
|
|
15
|
+
npx conform init
|
|
16
|
+
|
|
17
|
+
# Run all checks
|
|
18
|
+
npx conform check
|
|
19
|
+
|
|
20
|
+
# Run specific domain
|
|
21
|
+
npx conform check --domain code
|
|
22
|
+
npx conform check --domain process
|
|
23
|
+
npx conform check --domain infra
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Configuration
|
|
27
|
+
|
|
28
|
+
Create a `standards.toml` file in your repository root:
|
|
29
|
+
|
|
30
|
+
```toml
|
|
31
|
+
[metadata]
|
|
32
|
+
tier = "standard" # minimal, standard, or strict
|
|
33
|
+
|
|
34
|
+
[code]
|
|
35
|
+
typescript = true
|
|
36
|
+
eslint = true
|
|
37
|
+
prettier = true
|
|
38
|
+
unused_code = true
|
|
39
|
+
security = true
|
|
40
|
+
|
|
41
|
+
[process]
|
|
42
|
+
pre_commit_hooks = true
|
|
43
|
+
branch_protection = true
|
|
44
|
+
semantic_commits = true
|
|
45
|
+
changelog = true
|
|
46
|
+
|
|
47
|
+
[infra]
|
|
48
|
+
manifest = "infra/manifest.toml"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Extending Configurations
|
|
52
|
+
|
|
53
|
+
```toml
|
|
54
|
+
extends = "standards-community:typescript-production"
|
|
55
|
+
|
|
56
|
+
[metadata]
|
|
57
|
+
tier = "strict"
|
|
58
|
+
|
|
59
|
+
# Override specific settings
|
|
60
|
+
[code]
|
|
61
|
+
coverage_threshold = 90
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Domains
|
|
65
|
+
|
|
66
|
+
### Code Domain
|
|
67
|
+
|
|
68
|
+
Validates code quality standards:
|
|
69
|
+
- TypeScript configuration
|
|
70
|
+
- ESLint rules
|
|
71
|
+
- Prettier formatting
|
|
72
|
+
- Unused code detection
|
|
73
|
+
- Security scanning
|
|
74
|
+
- Test coverage
|
|
75
|
+
|
|
76
|
+
### Process Domain
|
|
77
|
+
|
|
78
|
+
Validates development process standards:
|
|
79
|
+
- Pre-commit hooks
|
|
80
|
+
- Branch protection rules
|
|
81
|
+
- Commit message format
|
|
82
|
+
- Changelog requirements
|
|
83
|
+
- PR templates
|
|
84
|
+
- CI/CD configuration
|
|
85
|
+
|
|
86
|
+
### Infra Domain
|
|
87
|
+
|
|
88
|
+
Validates infrastructure configuration:
|
|
89
|
+
- Resource existence checks
|
|
90
|
+
- Configuration validation
|
|
91
|
+
- Manifest compliance
|
|
92
|
+
|
|
93
|
+
## CLI Commands
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# Run all checks
|
|
97
|
+
conform check
|
|
98
|
+
|
|
99
|
+
# Run specific domain
|
|
100
|
+
conform check --domain code
|
|
101
|
+
|
|
102
|
+
# Output as JSON
|
|
103
|
+
conform check --format json
|
|
104
|
+
|
|
105
|
+
# Initialize new config
|
|
106
|
+
conform init
|
|
107
|
+
|
|
108
|
+
# Validate config file
|
|
109
|
+
conform validate
|
|
110
|
+
|
|
111
|
+
# Show version
|
|
112
|
+
conform --version
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## MCP Server
|
|
116
|
+
|
|
117
|
+
Conform includes an MCP (Model Context Protocol) server for integration with AI assistants:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
conform mcp
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Exit Codes
|
|
124
|
+
|
|
125
|
+
| Code | Meaning |
|
|
126
|
+
|------|---------|
|
|
127
|
+
| 0 | All checks passed |
|
|
128
|
+
| 1 | One or more checks failed |
|
|
129
|
+
| 2 | Configuration error |
|
|
130
|
+
| 3 | Runtime error |
|
|
131
|
+
|
|
132
|
+
## Migration from check-my-toolkit
|
|
133
|
+
|
|
134
|
+
See the [Migration Guide](../../docs/migration.md) for details on migrating from `check-my-toolkit`.
|
|
135
|
+
|
|
136
|
+
Key changes:
|
|
137
|
+
- Config file: `check.toml` -> `standards.toml`
|
|
138
|
+
- CLI command: `cm` -> `conform`
|
|
139
|
+
- Package name: `check-my-toolkit` -> `@standards-kit/conform`
|
|
140
|
+
|
|
141
|
+
## License
|
|
142
|
+
|
|
143
|
+
MIT
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// src/core/types.ts
|
|
2
2
|
var ViolationBuilder = {
|
|
3
3
|
create(options) {
|
|
4
4
|
return {
|
|
@@ -82,4 +82,4 @@ export {
|
|
|
82
82
|
DomainResultBuilder,
|
|
83
83
|
ExitCode
|
|
84
84
|
};
|
|
85
|
-
//# sourceMappingURL=chunk-
|
|
85
|
+
//# sourceMappingURL=chunk-DXIYZR62.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/types.ts"],"sourcesContent":["/**\n * Shared types for standards-kit\n */\n\n// =============================================================================\n// Core Types\n// =============================================================================\n\n/** Severity levels for violations */\nexport type Severity = \"error\" | \"warning\";\n\n/** Status for domain results */\nexport type DomainStatus = \"pass\" | \"fail\" | \"skip\";\n\n/** A single violation found by a check */\nexport interface Violation {\n rule: string;\n tool: string;\n file?: string;\n line?: number;\n column?: number;\n message: string;\n code?: string;\n severity: Severity;\n}\n\n/** Result of running a single check */\nexport interface CheckResult {\n name: string;\n rule: string;\n passed: boolean;\n violations: Violation[];\n skipped: boolean;\n skipReason?: string;\n duration?: number;\n}\n\n/** Result of running all checks in a domain */\nexport interface DomainResult {\n domain: string;\n status: DomainStatus;\n checks: CheckResult[];\n violationCount: number;\n}\n\n/** Full result of conform check or conform audit */\nexport interface FullResult {\n version: string;\n configPath: string;\n domains: Record<string, DomainResult>;\n summary: {\n totalViolations: number;\n exitCode: number;\n };\n}\n\n// =============================================================================\n// Tool Interface\n// =============================================================================\n\n/** Interface for tool runners (ESLint, Ruff, tsc, etc.) */\nexport interface IToolRunner {\n /** Display name of the tool */\n readonly name: string;\n /** Rule category (e.g., \"code.linting\") */\n readonly rule: string;\n /** Tool identifier for violations */\n readonly toolId: string;\n /** Config file patterns to look for */\n readonly configFiles: string[];\n\n /** Run the tool and return check results */\n run(projectRoot: string): Promise<CheckResult>;\n\n /** Audit that config exists without running the tool */\n audit(projectRoot: string): Promise<CheckResult>;\n}\n\n// =============================================================================\n// Builders\n// =============================================================================\n\n/** Options for creating a violation */\nexport interface ViolationOptions {\n rule: string;\n tool: string;\n message: string;\n severity: Severity;\n file?: string;\n line?: number;\n column?: number;\n code?: string;\n}\n\n/** Builder for creating Violation objects */\nexport const ViolationBuilder = {\n create(options: ViolationOptions): Violation {\n return {\n rule: options.rule,\n tool: options.tool,\n message: options.message,\n severity: options.severity,\n ...(options.file && { file: options.file }),\n ...(options.line && { line: options.line }),\n ...(options.column && { column: options.column }),\n ...(options.code && { code: options.code }),\n };\n },\n\n error(rule: string, tool: string, message: string, code?: string): Violation {\n return { rule, tool, message, severity: \"error\", code };\n },\n\n warning(rule: string, tool: string, message: string, code?: string): Violation {\n return { rule, tool, message, severity: \"warning\", code };\n },\n};\n\n/** Builder for creating CheckResult objects */\nexport const CheckResultBuilder = {\n pass(name: string, rule: string, duration?: number): CheckResult {\n return {\n name,\n rule,\n passed: true,\n violations: [],\n skipped: false,\n duration,\n };\n },\n\n fail(name: string, rule: string, violations: Violation[], duration?: number): CheckResult {\n return {\n name,\n rule,\n passed: false,\n violations,\n skipped: false,\n duration,\n };\n },\n\n skip(name: string, rule: string, reason: string, duration?: number): CheckResult {\n return {\n name,\n rule,\n passed: true,\n violations: [],\n skipped: true,\n skipReason: reason,\n duration,\n };\n },\n\n fromViolations(\n name: string,\n rule: string,\n violations: Violation[],\n duration?: number\n ): CheckResult {\n return violations.length === 0\n ? CheckResultBuilder.pass(name, rule, duration)\n : CheckResultBuilder.fail(name, rule, violations, duration);\n },\n};\n\n/** Builder for creating DomainResult objects */\nexport const DomainResultBuilder = {\n fromChecks(domain: string, checks: CheckResult[]): DomainResult {\n const violationCount = checks.reduce((sum, check) => sum + check.violations.length, 0);\n const allPassed = checks.every((check) => check.passed || check.skipped);\n const allSkipped = checks.length === 0 || checks.every((check) => check.skipped);\n\n let status: DomainStatus = \"fail\";\n if (allSkipped) {\n status = \"skip\";\n } else if (allPassed) {\n status = \"pass\";\n }\n\n return { domain, status, checks, violationCount };\n },\n};\n\n// =============================================================================\n// Exit Codes\n// =============================================================================\n\nexport const ExitCode = {\n SUCCESS: 0,\n VIOLATIONS_FOUND: 1,\n CONFIG_ERROR: 2,\n RUNTIME_ERROR: 3,\n} as const;\n\nexport type ExitCodeType = (typeof ExitCode)[keyof typeof ExitCode];\n"],"mappings":";AA+FO,IAAM,mBAAmB;AAAA,EAC9B,OAAO,SAAsC;AAC3C,WAAO;AAAA,MACL,MAAM,QAAQ;AAAA,MACd,MAAM,QAAQ;AAAA,MACd,SAAS,QAAQ;AAAA,MACjB,UAAU,QAAQ;AAAA,MAClB,GAAI,QAAQ,QAAQ,EAAE,MAAM,QAAQ,KAAK;AAAA,MACzC,GAAI,QAAQ,QAAQ,EAAE,MAAM,QAAQ,KAAK;AAAA,MACzC,GAAI,QAAQ,UAAU,EAAE,QAAQ,QAAQ,OAAO;AAAA,MAC/C,GAAI,QAAQ,QAAQ,EAAE,MAAM,QAAQ,KAAK;AAAA,IAC3C;AAAA,EACF;AAAA,EAEA,MAAM,MAAc,MAAc,SAAiB,MAA0B;AAC3E,WAAO,EAAE,MAAM,MAAM,SAAS,UAAU,SAAS,KAAK;AAAA,EACxD;AAAA,EAEA,QAAQ,MAAc,MAAc,SAAiB,MAA0B;AAC7E,WAAO,EAAE,MAAM,MAAM,SAAS,UAAU,WAAW,KAAK;A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ACjB;","names":[]}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CACHE,
|
|
3
|
+
STANDARDS_REPO,
|
|
4
|
+
TIMEOUTS
|
|
5
|
+
} from "./chunk-RHM53NLG.js";
|
|
6
|
+
|
|
1
7
|
// src/mcp/standards/fetcher.ts
|
|
2
8
|
import * as fs from "fs";
|
|
3
9
|
import * as os from "os";
|
|
4
10
|
import * as path from "path";
|
|
5
11
|
import { execa } from "execa";
|
|
6
|
-
var
|
|
7
|
-
var DEFAULT_REPO = "standards";
|
|
8
|
-
var CACHE_DIR = path.join(os.tmpdir(), "cm-standards-cache");
|
|
12
|
+
var CACHE_DIR = path.join(os.tmpdir(), CACHE.standardsCacheDir);
|
|
9
13
|
function parseGitHubSource(source) {
|
|
10
14
|
const remainder = source.slice(7);
|
|
11
15
|
const atIndex = remainder.indexOf("@");
|
|
@@ -64,7 +68,7 @@ function buildGitHubUrl(auth, owner, repo) {
|
|
|
64
68
|
}
|
|
65
69
|
async function updateExistingRepo(repoDir) {
|
|
66
70
|
try {
|
|
67
|
-
await execa("git", ["pull", "--ff-only"], { cwd: repoDir, timeout:
|
|
71
|
+
await execa("git", ["pull", "--ff-only"], { cwd: repoDir, timeout: TIMEOUTS.git });
|
|
68
72
|
return true;
|
|
69
73
|
} catch {
|
|
70
74
|
fs.rmSync(repoDir, { recursive: true, force: true });
|
|
@@ -82,12 +86,12 @@ async function cloneRepo(repoDir, owner, repo, ref) {
|
|
|
82
86
|
}
|
|
83
87
|
args.push(url, repoDir);
|
|
84
88
|
await execa("git", args, {
|
|
85
|
-
timeout:
|
|
89
|
+
timeout: TIMEOUTS.git
|
|
86
90
|
});
|
|
87
91
|
} catch (error) {
|
|
88
92
|
const message = error instanceof Error ? error.message : String(error);
|
|
89
93
|
if (message.includes("timed out")) {
|
|
90
|
-
throw new StandardsError(`Standards repo clone timed out after
|
|
94
|
+
throw new StandardsError(`Standards repo clone timed out after ${TIMEOUTS.git / 1e3} seconds`);
|
|
91
95
|
}
|
|
92
96
|
throw new StandardsError(`Failed to clone standards repo: ${message}`);
|
|
93
97
|
}
|
|
@@ -122,7 +126,7 @@ async function fetchStandardsRepoFromSource(source, basePath) {
|
|
|
122
126
|
return fetchGitHubRepo(parsed.owner, parsed.repo, parsed.ref);
|
|
123
127
|
}
|
|
124
128
|
async function fetchStandardsRepo() {
|
|
125
|
-
return fetchGitHubRepo(
|
|
129
|
+
return fetchGitHubRepo(STANDARDS_REPO.owner, STANDARDS_REPO.repo);
|
|
126
130
|
}
|
|
127
131
|
function getGuidelinesDir(repoPath) {
|
|
128
132
|
return path.join(repoPath, "guidelines");
|
|
@@ -276,4 +280,4 @@ export {
|
|
|
276
280
|
matchGuidelines,
|
|
277
281
|
composeGuidelines
|
|
278
282
|
};
|
|
279
|
-
//# sourceMappingURL=chunk-
|
|
283
|
+
//# sourceMappingURL=chunk-NADY2H35.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/mcp/standards/fetcher.ts","../src/mcp/standards/parser.ts","../src/mcp/standards/matcher.ts"],"sourcesContent":["/**\n * Fetches the standards repository from GitHub or local filesystem\n */\nimport * as fs from \"node:fs\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\n\nimport { execa } from \"execa\";\n\nimport { CACHE, STANDARDS_REPO, TIMEOUTS } from \"../../constants.js\";\n\nconst CACHE_DIR = path.join(os.tmpdir(), CACHE.standardsCacheDir);\n\n/** Parsed GitHub source */\ninterface GitHubSource {\n type: \"github\";\n owner: string;\n repo: string;\n ref?: string;\n}\n\n/** Parsed local source */\ninterface LocalSource {\n type: \"local\";\n path: string;\n}\n\n/** Parsed source type */\ntype ParsedSource = GitHubSource | LocalSource;\n\n/** Parse github:owner/repo[@ref] format */\nfunction parseGitHubSource(source: string): GitHubSource {\n const remainder = source.slice(7); // Remove \"github:\"\n const atIndex = remainder.indexOf(\"@\");\n const ownerRepo = atIndex !== -1 ? remainder.slice(0, atIndex) : remainder;\n const ref = atIndex !== -1 ? remainder.slice(atIndex + 1) : undefined;\n const slashIndex = ownerRepo.indexOf(\"/\");\n\n if (slashIndex === -1) {\n throw new StandardsError(`Invalid GitHub source format: ${source}. Expected github:owner/repo`);\n }\n\n const owner = ownerRepo.slice(0, slashIndex);\n const repo = ownerRepo.slice(slashIndex + 1);\n\n if (!owner || !repo) {\n throw new StandardsError(`Invalid GitHub source format: ${source}. Expected github:owner/repo`);\n }\n\n return { type: \"github\", owner, repo, ref };\n}\n\n/**\n * Parse a source string into owner/repo/ref or local path.\n * Formats:\n * - \"github:owner/repo\" - GitHub repository\n * - \"github:owner/repo@ref\" - GitHub with branch/tag\n * - Local filesystem path (absolute or relative)\n */\nfunction parseSource(source: string): ParsedSource {\n if (source.startsWith(\"github:\")) {\n return parseGitHubSource(source);\n }\n return { type: \"local\", path: source };\n}\n\n/** Error class for standards fetching failures */\nexport class StandardsError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"StandardsError\";\n }\n}\n\n/** Authentication method for GitHub */\ntype AuthMethod = \"token\" | \"ssh\" | \"none\";\n\n/**\n * Detect authentication method based on environment variables.\n * Priority: CM_REGISTRY_TOKEN > GITHUB_TOKEN > SSH key detection > none\n */\nfunction detectAuthMethod(): AuthMethod {\n if (process.env.CM_REGISTRY_TOKEN || process.env.GITHUB_TOKEN) {\n return \"token\";\n }\n if (process.env.SSH_AUTH_SOCK) {\n return \"ssh\";\n }\n return \"none\";\n}\n\n/**\n * Get the authentication token from environment variables.\n */\nfunction getAuthToken(): string | undefined {\n return process.env.CM_REGISTRY_TOKEN ?? process.env.GITHUB_TOKEN;\n}\n\n/**\n * Build the git URL for a repository based on auth method.\n */\nfunction buildGitHubUrl(auth: AuthMethod, owner: string, repo: string): string {\n switch (auth) {\n case \"ssh\":\n return `git@github.com:${owner}/${repo}.git`;\n case \"token\": {\n const token = getAuthToken();\n if (token) {\n return `https://x-access-token:${token}@github.com/${owner}/${repo}.git`;\n }\n return `https://github.com/${owner}/${repo}.git`;\n }\n case \"none\":\n default:\n return `https://github.com/${owner}/${repo}.git`;\n }\n}\n\n/**\n * Update an existing cloned repository.\n */\nasync function updateExistingRepo(repoDir: string): Promise<boolean> {\n try {\n await execa(\"git\", [\"pull\", \"--ff-only\"], { cwd: repoDir, timeout: TIMEOUTS.git });\n return true;\n } catch {\n // If update fails, remove the directory so it will be re-cloned\n fs.rmSync(repoDir, { recursive: true, force: true });\n return false;\n }\n}\n\n/**\n * Clone a repository from GitHub.\n */\nasync function cloneRepo(repoDir: string, owner: string, repo: string, ref?: string): Promise<void> {\n fs.mkdirSync(CACHE_DIR, { recursive: true });\n\n const auth = detectAuthMethod();\n const url = buildGitHubUrl(auth, owner, repo);\n\n try {\n const args = [\"clone\", \"--depth\", \"1\"];\n if (ref) {\n args.push(\"--branch\", ref);\n }\n args.push(url, repoDir);\n\n await execa(\"git\", args, {\n timeout: TIMEOUTS.git,\n });\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n if (message.includes(\"timed out\")) {\n throw new StandardsError(`Standards repo clone timed out after ${TIMEOUTS.git / 1000} seconds`);\n }\n throw new StandardsError(`Failed to clone standards repo: ${message}`);\n }\n}\n\n/**\n * Fetch a GitHub repository, caching it locally.\n * Returns the path to the cached repository.\n */\nasync function fetchGitHubRepo(owner: string, repo: string, ref?: string): Promise<string> {\n const cacheKey = ref ? `${owner}-${repo}-${ref}` : `${owner}-${repo}`;\n const repoDir = path.join(CACHE_DIR, cacheKey);\n\n // If repo exists, try to update it\n if (fs.existsSync(repoDir)) {\n await updateExistingRepo(repoDir);\n }\n\n // Clone if it doesn't exist (either first time or after failed update)\n if (!fs.existsSync(repoDir)) {\n await cloneRepo(repoDir, owner, repo, ref);\n }\n\n return repoDir;\n}\n\n/**\n * Resolve a local source path to an absolute path.\n */\nfunction resolveLocalPath(localPath: string, basePath?: string): string {\n if (path.isAbsolute(localPath)) {\n return localPath;\n }\n const base = basePath ?? process.cwd();\n return path.resolve(base, localPath);\n}\n\n/**\n * Fetch the standards repository from a source string.\n * Supports:\n * - \"github:owner/repo\" - GitHub repository\n * - \"github:owner/repo@ref\" - GitHub with branch/tag\n * - Local filesystem path (absolute or relative)\n *\n * @param source - Source string to fetch from\n * @param basePath - Base path for resolving relative local paths (defaults to cwd)\n * @returns Path to the standards repository\n */\nexport async function fetchStandardsRepoFromSource(\n source: string,\n basePath?: string\n): Promise<string> {\n const parsed = parseSource(source);\n\n if (parsed.type === \"local\") {\n const resolvedPath = resolveLocalPath(parsed.path, basePath);\n if (!fs.existsSync(resolvedPath)) {\n throw new StandardsError(`Local standards path does not exist: ${resolvedPath}`);\n }\n return resolvedPath;\n }\n\n return fetchGitHubRepo(parsed.owner, parsed.repo, parsed.ref);\n}\n\n/**\n * Fetch the default standards repository, caching it locally.\n * Returns the path to the cached repository.\n */\nexport async function fetchStandardsRepo(): Promise<string> {\n return fetchGitHubRepo(STANDARDS_REPO.owner, STANDARDS_REPO.repo);\n}\n\n/**\n * Get the path to the guidelines directory.\n */\nexport function getGuidelinesDir(repoPath: string): string {\n return path.join(repoPath, \"guidelines\");\n}\n\n/**\n * Get the path to the rulesets directory.\n */\nexport function getRulesetsDir(repoPath: string): string {\n return path.join(repoPath, \"rulesets\");\n}\n","/**\n * Parser for guideline markdown files with YAML frontmatter\n */\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n\nimport matter from \"gray-matter\";\nimport { z } from \"zod\";\n\nimport { type Guideline, type GuidelineListItem, type Ruleset } from \"./types.js\";\nimport { StandardsError } from \"./fetcher.js\";\n\n/** Zod schema for validating guideline frontmatter */\nexport const frontmatterSchema = z.object({\n id: z.string(),\n title: z.string(),\n category: z.string(),\n priority: z.number(),\n tags: z.array(z.string()),\n});\n\n/**\n * Parse a guideline markdown file content into a Guideline object.\n */\nexport function parseGuideline(fileContent: string, filename: string): Guideline {\n const { data, content } = matter(fileContent);\n\n const result = frontmatterSchema.safeParse(data);\n if (!result.success) {\n const errors = result.error.errors.map((e) => `${e.path.join(\".\")}: ${e.message}`).join(\", \");\n throw new StandardsError(`Invalid frontmatter in ${filename}: ${errors}`);\n }\n\n return {\n ...result.data,\n content: content.trim(),\n };\n}\n\n/**\n * Load all guidelines from a directory.\n */\nexport function loadAllGuidelines(guidelinesDir: string): Guideline[] {\n if (!fs.existsSync(guidelinesDir)) {\n throw new StandardsError(`Guidelines directory not found: ${guidelinesDir}`);\n }\n\n const files = fs.readdirSync(guidelinesDir).filter((f) => f.endsWith(\".md\"));\n const guidelines: Guideline[] = [];\n\n for (const file of files) {\n const filePath = path.join(guidelinesDir, file);\n const content = fs.readFileSync(filePath, \"utf-8\");\n\n try {\n guidelines.push(parseGuideline(content, file));\n } catch (error) {\n // Skip files that fail to parse, log warning\n console.warn(`Warning: Failed to parse guideline ${file}: ${error}`);\n }\n }\n\n return guidelines;\n}\n\n/**\n * Load a single guideline by ID.\n */\nexport function loadGuideline(guidelinesDir: string, id: string): Guideline | null {\n const filePath = path.join(guidelinesDir, `${id}.md`);\n\n if (!fs.existsSync(filePath)) {\n return null;\n }\n\n const content = fs.readFileSync(filePath, \"utf-8\");\n return parseGuideline(content, `${id}.md`);\n}\n\n/**\n * Convert guidelines to list items (summary format).\n */\nexport function toListItems(guidelines: Guideline[]): GuidelineListItem[] {\n return guidelines.map((g) => ({\n id: g.id,\n title: g.title,\n tags: g.tags,\n category: g.category,\n }));\n}\n\n/**\n * Load a ruleset file by ID.\n */\nexport function loadRuleset(rulesetsDir: string, id: string): Ruleset | null {\n const filePath = path.join(rulesetsDir, `${id}.toml`);\n\n if (!fs.existsSync(filePath)) {\n return null;\n }\n\n const content = fs.readFileSync(filePath, \"utf-8\");\n return { id, content };\n}\n\n/**\n * List all available ruleset IDs.\n */\nexport function listRulesets(rulesetsDir: string): string[] {\n if (!fs.existsSync(rulesetsDir)) {\n return [];\n }\n\n return fs\n .readdirSync(rulesetsDir)\n .filter((f) => f.endsWith(\".toml\"))\n .map((f) => f.replace(\".toml\", \"\"));\n}\n","/**\n * Smart keyword matching logic for guidelines\n */\nimport { type Guideline, type MatchedGuideline } from \"./types.js\";\n\n/**\n * Parse a context string into keywords.\n * Extracts words, lowercases them, and removes duplicates.\n */\nexport function parseContext(context: string): string[] {\n const words = context\n .toLowerCase()\n .split(/[\\s,.\\-_/]+/)\n .filter((word) => word.length > 1);\n\n return [...new Set(words)];\n}\n\n/**\n * Score a guideline based on how many keywords match its tags.\n */\nexport function scoreGuideline(guideline: Guideline, keywords: string[]): number {\n const tags = new Set(guideline.tags.map((t) => t.toLowerCase()));\n let score = 0;\n\n for (const keyword of keywords) {\n if (tags.has(keyword)) {\n score++;\n }\n }\n\n // Also check if keyword appears in category or id\n const category = guideline.category.toLowerCase();\n const id = guideline.id.toLowerCase();\n\n for (const keyword of keywords) {\n if (category.includes(keyword) || id.includes(keyword)) {\n score += 0.5; // Partial match bonus\n }\n }\n\n return score;\n}\n\n/**\n * Match guidelines against a context string.\n * Returns guidelines sorted by score (descending) then priority (ascending).\n */\nexport function matchGuidelines(\n guidelines: Guideline[],\n context: string,\n limit?: number\n): MatchedGuideline[] {\n const keywords = parseContext(context);\n\n if (keywords.length === 0) {\n return [];\n }\n\n const scored = guidelines\n .map((guideline) => ({\n guideline,\n score: scoreGuideline(guideline, keywords),\n }))\n .filter((m) => m.score > 0);\n\n // Sort by score descending, then by priority ascending\n scored.sort((a, b) => {\n if (b.score !== a.score) {\n return b.score - a.score;\n }\n return a.guideline.priority - b.guideline.priority;\n });\n\n return limit ? scored.slice(0, limit) : scored;\n}\n\n/**\n * Compose matched guidelines into a single markdown document.\n */\nexport function composeGuidelines(matches: MatchedGuideline[]): string {\n if (matches.length === 0) {\n return \"No matching guidelines found for the given context.\";\n }\n\n const sections = matches.map((m) => {\n const { guideline } = m;\n return `# ${guideline.title}\\n\\n**Category:** ${guideline.category} | **Priority:** ${guideline.priority}\\n**Tags:** ${guideline.tags.join(\", \")}\\n\\n${guideline.content}`;\n });\n\n return sections.join(\"\\n\\n---\\n\\n\");\n}\n"],"mappings":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;AAAA,IACX;AAAA,EACF;AAEA,SAAO;AACT;AAMO,SAAS,gBACd,YACA,SACA,OACoB;AACpB,QAAM,WAAW,aAAa,OAAO;AAErC,MAAI,SAAS,WAAW,GAAG;AACzB,WAAO,CAAC;AAAA,EACV;AAEA,QAAM,SAAS,WACZ,IAAI,CAAC,eAAe;AAAA,IACnB;AAAA,IACA,OAAO,eAAe,WAAW,QAAQ;AAAA,EAC3C,EAAE,EACD,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC;AAG5B,SAAO,KAAK,CAAC,GAAG,MAAM;AACpB,QAAI,EAAE,UAAU,EAAE,OAAO;AACvB,aAAO,EAAE,QAAQ,EAAE;AAAA,IACrB;AACA,WAAO,EAAE,UAAU,WAAW,EAAE,UAAU;AAAA,EAC5C,CAAC;AAED,SAAO,QAAQ,OAAO,MAAM,GAAG,KAAK,IAAI;AAC1C;AAKO,SAAS,kBAAkB,SAAqC;AACrE,MAAI,QAAQ,WAAW,GAAG;AACxB,WAAO;AAAA,EACT;AAEA,QAAM,WAAW,QAAQ,IAAI,CAAC,MAAM;AAClC,UAAM,EAAE,UAAU,IAAI;AACtB,WAAO,KAAK,UAAU,KAAK;AAAA;AAAA,gBAAqB,UAAU,QAAQ,oBAAoB,UAAU,QAAQ;AAAA,YAAe,UAAU,KAAK,KAAK,IAAI,CAAC;AAAA;AAAA,EAAO,UAAU,OAAO;AAAA,EAC1K,CAAC;AAED,SAAO,SAAS,KAAK,aAAa;AACpC;","names":["fs","path"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// src/infra/checkers/client-factory.ts
|
|
2
|
+
function createClientFactory(ClientClass) {
|
|
3
|
+
const cache = /* @__PURE__ */ new Map();
|
|
4
|
+
return (region) => {
|
|
5
|
+
let client = cache.get(region);
|
|
6
|
+
if (!client) {
|
|
7
|
+
client = new ClientClass({ region });
|
|
8
|
+
cache.set(region, client);
|
|
9
|
+
}
|
|
10
|
+
return client;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function createClientFactoryWithConfig(createClient) {
|
|
14
|
+
const cache = /* @__PURE__ */ new Map();
|
|
15
|
+
return (region) => {
|
|
16
|
+
let client = cache.get(region);
|
|
17
|
+
if (!client) {
|
|
18
|
+
client = createClient(region);
|
|
19
|
+
cache.set(region, client);
|
|
20
|
+
}
|
|
21
|
+
return client;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
createClientFactory,
|
|
27
|
+
createClientFactoryWithConfig
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=chunk-O745CMWG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/infra/checkers/client-factory.ts"],"sourcesContent":["/**\n * Shared AWS client factory with caching.\n * Eliminates duplicated client caching pattern across all AWS checker files.\n */\n\n/**\n * Generic client constructor type\n */\ntype ClientConstructor<T> = new (config: { region: string }) => T;\n\n/**\n * Creates a cached client factory for any AWS SDK client.\n * Clients are cached per region to avoid creating multiple instances.\n *\n * @param ClientClass - The AWS SDK client class constructor\n * @returns A function that returns a cached client for the given region\n *\n * @example\n * ```ts\n * import { S3Client } from \"@aws-sdk/client-s3\";\n *\n * const getS3Client = createClientFactory(S3Client);\n * const client = getS3Client(\"us-east-1\");\n * ```\n */\nexport function createClientFactory<T>(\n ClientClass: ClientConstructor<T>\n): (region: string) => T {\n const cache = new Map<string, T>();\n\n return (region: string): T => {\n let client = cache.get(region);\n if (!client) {\n client = new ClientClass({ region });\n cache.set(region, client);\n }\n return client;\n };\n}\n\n/**\n * Creates a cached client factory for AWS SDK clients that need custom config.\n * Useful for clients that need additional options beyond just region.\n *\n * @param createClient - Factory function that creates the client with config\n * @returns A function that returns a cached client for the given region\n *\n * @example\n * ```ts\n * import { S3Client } from \"@aws-sdk/client-s3\";\n *\n * const getS3Client = createClientFactoryWithConfig(\n * (region) => new S3Client({ region, followRegionRedirects: true })\n * );\n * const client = getS3Client(\"us-east-1\");\n * ```\n */\nexport function createClientFactoryWithConfig<T>(\n createClient: (region: string) => T\n): (region: string) => T {\n const cache = new Map<string, T>();\n\n return (region: string): T => {\n let client = cache.get(region);\n if (!client) {\n client = createClient(region);\n cache.set(region, client);\n }\n return client;\n };\n}\n"],"mappings":";AAyBO,SAAS,oBACd,aACuB;AACvB,QAAM,QAAQ,oBAAI,IAAe;AAEjC,SAAO,CAAC,WAAsB;AAC5B,QAAI,SAAS,MAAM,IAAI,MAAM;AAC7B,QAAI,CAAC,QAAQ;AACX,eAAS,IAAI,YAAY,EAAE,OAAO,CAAC;AACnC,YAAM,IAAI,QAAQ,MAAM;AAAA,IAC1B;AACA,WAAO;AAAA,EACT;AACF;AAmBO,SAAS,8BACd,cACuB;AACvB,QAAM,QAAQ,oBAAI,IAAe;AAEjC,SAAO,CAAC,WAAsB;AAC5B,QAAI,SAAS,MAAM,IAAI,MAAM;AAC7B,QAAI,CAAC,QAAQ;AACX,eAAS,aAAa,MAAM;AAC5B,YAAM,IAAI,QAAQ,MAAM;AAAA,IAC1B;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// src/constants.ts
|
|
2
|
+
var TIMEOUTS = {
|
|
3
|
+
/** Git clone/pull operation timeout (30 seconds) */
|
|
4
|
+
git: 3e4,
|
|
5
|
+
/** Standard code tool execution timeout (5 minutes) */
|
|
6
|
+
codeTool: 5 * 60 * 1e3,
|
|
7
|
+
/** Extended timeout for longer operations like coverage runs (10 minutes) */
|
|
8
|
+
codeToolExtended: 10 * 60 * 1e3,
|
|
9
|
+
/** Quick operation timeout for version checks, etc (30 seconds) */
|
|
10
|
+
quick: 3e4,
|
|
11
|
+
/** Gitleaks version check timeout (10 seconds) */
|
|
12
|
+
versionCheck: 1e4
|
|
13
|
+
};
|
|
14
|
+
var AWS_DEFAULTS = {
|
|
15
|
+
/** Default region for global AWS services (IAM, S3 global operations) */
|
|
16
|
+
globalRegion: "us-east-1"
|
|
17
|
+
};
|
|
18
|
+
var GITHUB_API = {
|
|
19
|
+
/** Base URL for GitHub API (can be overridden via GITHUB_API_URL env var for GitHub Enterprise) */
|
|
20
|
+
baseUrl: process.env.GITHUB_API_URL ?? "https://api.github.com",
|
|
21
|
+
/** Number of items per page for pagination */
|
|
22
|
+
perPage: 100
|
|
23
|
+
};
|
|
24
|
+
var STANDARDS_REPO = {
|
|
25
|
+
/** Default owner for standards repository (can be overridden via STANDARDS_REPO_OWNER env var) */
|
|
26
|
+
owner: process.env.STANDARDS_REPO_OWNER ?? "palindrom-ai",
|
|
27
|
+
/** Default repository name (can be overridden via STANDARDS_REPO_NAME env var) */
|
|
28
|
+
repo: process.env.STANDARDS_REPO_NAME ?? "standards"
|
|
29
|
+
};
|
|
30
|
+
var CACHE = {
|
|
31
|
+
/** Base directory name for standards cache (can be overridden via CM_STANDARDS_CACHE_DIR env var) */
|
|
32
|
+
standardsCacheDir: process.env.CM_STANDARDS_CACHE_DIR ?? "cm-standards-cache",
|
|
33
|
+
/** Base directory name for registry cache */
|
|
34
|
+
registryCacheDir: "conform-registry-cache"
|
|
35
|
+
};
|
|
36
|
+
var CONCURRENCY = {
|
|
37
|
+
/** Default concurrency for infrastructure resource checks */
|
|
38
|
+
infraScan: 10
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export {
|
|
42
|
+
TIMEOUTS,
|
|
43
|
+
AWS_DEFAULTS,
|
|
44
|
+
GITHUB_API,
|
|
45
|
+
STANDARDS_REPO,
|
|
46
|
+
CACHE,
|
|
47
|
+
CONCURRENCY
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=chunk-RHM53NLG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/constants.ts"],"sourcesContent":["/**\n * Centralized constants for the conform package.\n * Consolidates all hardcoded values for easier maintenance and configuration.\n */\n\n/**\n * Timeout values in milliseconds\n */\nexport const TIMEOUTS = {\n /** Git clone/pull operation timeout (30 seconds) */\n git: 30_000,\n /** Standard code tool execution timeout (5 minutes) */\n codeTool: 5 * 60 * 1000,\n /** Extended timeout for longer operations like coverage runs (10 minutes) */\n codeToolExtended: 10 * 60 * 1000,\n /** Quick operation timeout for version checks, etc (30 seconds) */\n quick: 30_000,\n /** Gitleaks version check timeout (10 seconds) */\n versionCheck: 10_000,\n} as const;\n\n/**\n * AWS configuration defaults\n */\nexport const AWS_DEFAULTS = {\n /** Default region for global AWS services (IAM, S3 global operations) */\n globalRegion: \"us-east-1\",\n} as const;\n\n/**\n * GitHub API configuration\n */\nexport const GITHUB_API = {\n /** Base URL for GitHub API (can be overridden via GITHUB_API_URL env var for GitHub Enterprise) */\n baseUrl: process.env.GITHUB_API_URL ?? \"https://api.github.com\",\n /** Number of items per page for pagination */\n perPage: 100,\n} as const;\n\n/**\n * Standards repository defaults\n */\nexport const STANDARDS_REPO = {\n /** Default owner for standards repository (can be overridden via STANDARDS_REPO_OWNER env var) */\n owner: process.env.STANDARDS_REPO_OWNER ?? \"palindrom-ai\",\n /** Default repository name (can be overridden via STANDARDS_REPO_NAME env var) */\n repo: process.env.STANDARDS_REPO_NAME ?? \"standards\",\n} as const;\n\n/**\n * Cache directory configuration\n */\nexport const CACHE = {\n /** Base directory name for standards cache (can be overridden via CM_STANDARDS_CACHE_DIR env var) */\n standardsCacheDir: process.env.CM_STANDARDS_CACHE_DIR ?? \"cm-standards-cache\",\n /** Base directory name for registry cache */\n registryCacheDir: \"conform-registry-cache\",\n} as const;\n\n/**\n * Concurrency limits\n */\nexport const CONCURRENCY = {\n /** Default concurrency for infrastructure resource checks */\n infraScan: 10,\n} as const;\n\n/**\n * Default threshold values\n */\nexport const DEFAULTS = {\n /** Default backup max age in hours */\n backupMaxAgeHours: 24,\n /** Default code coverage minimum threshold */\n coverageMinThreshold: 80,\n} as const;\n"],"mappings":";AAQO,IAAM,WAAW;AAAA;AAAA,EAEtB,KAAK;AAAA;AAAA,EAEL,UAAU,IAAI,KAAK;AAAA;AAAA,EAEnB,kBAAkB,KAAK,KAAK;AAAA;AAAA,EAE5B,OAAO;AAAA;AAAA,EAEP,cAAc;AAChB;AAKO,IAAM,eAAe;AAAA;AAAA,EAE1B,cAAc;AAChB;AAKO,IAAM,aAAa;AAAA;AAAA,EAExB,SAAS,QAAQ,IAAI,kBAAkB;AAAA;AAAA,EAEvC,SAAS;AACX;AAKO,IAAM,iBAAiB;AAAA;AAAA,EAE5B,OAAO,QAAQ,IAAI,wBAAwB;AAAA;AAAA,EAE3C,MAAM,QAAQ,IAAI,uBAAuB;AAC3C;AAKO,IAAM,QAAQ;AAAA;AAAA,EAEnB,mBAAmB,QAAQ,IAAI,0BAA0B;AAAA;AAAA,EAEzD,kBAAkB;AACpB;AAKO,IAAM,cAAc;AAAA;AAAA,EAEzB,WAAW;AACb;","names":[]}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
import {
|
|
2
|
+
CACHE,
|
|
3
|
+
TIMEOUTS
|
|
4
|
+
} from "./chunk-RHM53NLG.js";
|
|
5
|
+
|
|
6
|
+
// src/core/registry.ts
|
|
2
7
|
import * as fs2 from "fs";
|
|
3
8
|
import * as os from "os";
|
|
4
9
|
import * as path2 from "path";
|
|
5
10
|
import * as toml from "@iarna/toml";
|
|
6
11
|
import { execa } from "execa";
|
|
7
12
|
|
|
8
|
-
//
|
|
13
|
+
// src/core/loader.ts
|
|
9
14
|
import * as fs from "fs";
|
|
10
15
|
import * as path from "path";
|
|
11
16
|
import TOML from "@iarna/toml";
|
|
12
17
|
|
|
13
|
-
//
|
|
18
|
+
// src/core/schema.ts
|
|
14
19
|
import { minimatch } from "minimatch";
|
|
15
20
|
import { z } from "zod";
|
|
16
21
|
function countUnclosedDelimiters(pattern) {
|
|
@@ -504,6 +509,14 @@ var processSchema = z.object({
|
|
|
504
509
|
docs: docsConfigSchema,
|
|
505
510
|
forbidden_files: forbiddenFilesConfigSchema
|
|
506
511
|
}).strict().optional();
|
|
512
|
+
var tierSchema = z.enum(["production", "internal", "prototype"]);
|
|
513
|
+
var statusSchema = z.enum(["active", "pre-release", "deprecated"]);
|
|
514
|
+
var metadataSchema = z.object({
|
|
515
|
+
tier: tierSchema,
|
|
516
|
+
project: z.string().optional(),
|
|
517
|
+
organisation: z.string().optional(),
|
|
518
|
+
status: statusSchema.optional().default("active")
|
|
519
|
+
}).strict().optional();
|
|
507
520
|
var extendsSchema = z.object({
|
|
508
521
|
registry: z.string(),
|
|
509
522
|
// e.g., "github:myorg/standards" or local path
|
|
@@ -515,6 +528,7 @@ var monorepoSchema = z.object({
|
|
|
515
528
|
// Glob patterns to exclude from project detection
|
|
516
529
|
}).strict().optional();
|
|
517
530
|
var configSchema = z.object({
|
|
531
|
+
metadata: metadataSchema,
|
|
518
532
|
extends: extendsSchema,
|
|
519
533
|
code: codeSchema,
|
|
520
534
|
process: processSchema,
|
|
@@ -621,7 +635,7 @@ var defaultConfig = {
|
|
|
621
635
|
}
|
|
622
636
|
};
|
|
623
637
|
|
|
624
|
-
//
|
|
638
|
+
// src/core/loader.ts
|
|
625
639
|
var CONFIG_FILE_NAME = "standards.toml";
|
|
626
640
|
var ConfigError = class extends Error {
|
|
627
641
|
constructor(message) {
|
|
@@ -910,7 +924,7 @@ function detectCodeownersOverrides(registryConfig, projectConfig) {
|
|
|
910
924
|
return projectRules.map((rule) => checkRuleOverride(rule, registryMap.get(rule.pattern))).filter((o) => o !== null);
|
|
911
925
|
}
|
|
912
926
|
async function loadRegistryConfig(extendsConfig, configDir) {
|
|
913
|
-
const registryModule = await import("./registry-
|
|
927
|
+
const registryModule = await import("./registry-JRCQAIHR.js");
|
|
914
928
|
const loc = registryModule.parseRegistryUrl(extendsConfig.registry, configDir);
|
|
915
929
|
const registryDir = await registryModule.fetchRegistry(loc);
|
|
916
930
|
let config = {};
|
|
@@ -934,7 +948,7 @@ async function loadConfigWithOverrides(configPath) {
|
|
|
934
948
|
return { config, configPath: finalPath, overrides };
|
|
935
949
|
}
|
|
936
950
|
|
|
937
|
-
//
|
|
951
|
+
// src/core/registry.ts
|
|
938
952
|
function detectAuthMethod() {
|
|
939
953
|
if (process.env.CONFORM_REGISTRY_TOKEN || process.env.GITHUB_TOKEN) {
|
|
940
954
|
return "token";
|
|
@@ -1024,11 +1038,11 @@ async function cloneRepo(location, repoDir) {
|
|
|
1024
1038
|
}
|
|
1025
1039
|
cloneArgs.push(location.path, repoDir);
|
|
1026
1040
|
try {
|
|
1027
|
-
await execa("git", cloneArgs, { timeout:
|
|
1041
|
+
await execa("git", cloneArgs, { timeout: TIMEOUTS.git });
|
|
1028
1042
|
} catch (error) {
|
|
1029
1043
|
const message = error instanceof Error ? error.message : String(error);
|
|
1030
1044
|
if (message.includes("timed out")) {
|
|
1031
|
-
throw new ConfigError(`Registry clone timed out after
|
|
1045
|
+
throw new ConfigError(`Registry clone timed out after ${TIMEOUTS.git / 1e3} seconds: ${location.path}`);
|
|
1032
1046
|
}
|
|
1033
1047
|
throw new ConfigError(`Failed to clone registry: ${message}`);
|
|
1034
1048
|
}
|
|
@@ -1040,7 +1054,7 @@ async function fetchRegistry(location) {
|
|
|
1040
1054
|
}
|
|
1041
1055
|
return location.path;
|
|
1042
1056
|
}
|
|
1043
|
-
const cacheDir = path2.join(os.tmpdir(),
|
|
1057
|
+
const cacheDir = path2.join(os.tmpdir(), CACHE.registryCacheDir);
|
|
1044
1058
|
const repoDir = path2.join(cacheDir, `${location.owner}-${location.repo}`);
|
|
1045
1059
|
if (fs2.existsSync(repoDir)) {
|
|
1046
1060
|
await updateExistingRepo(repoDir, location.ref);
|
|
@@ -1364,4 +1378,4 @@ export {
|
|
|
1364
1378
|
getProjectRoot,
|
|
1365
1379
|
loadConfigWithOverrides
|
|
1366
1380
|
};
|
|
1367
|
-
//# sourceMappingURL=chunk-
|
|
1381
|
+
//# sourceMappingURL=chunk-YGDEM6K5.js.map
|