@paths.design/caws-cli 4.0.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/archive.js +353 -0
- package/dist/commands/iterate.js +12 -13
- package/dist/commands/mode.js +259 -0
- package/dist/commands/plan.js +448 -0
- package/dist/commands/quality-gates.js +490 -0
- package/dist/commands/specs.js +735 -0
- package/dist/commands/status.js +552 -22
- package/dist/commands/tutorial.js +481 -0
- package/dist/commands/validate.js +137 -54
- package/dist/commands/waivers.js +101 -26
- package/dist/config/modes.js +321 -0
- package/dist/constants/spec-types.js +42 -0
- package/dist/index.js +225 -10
- package/dist/scaffold/git-hooks.js +32 -44
- package/dist/scaffold/index.js +19 -0
- package/dist/utils/quality-gates-errors.js +520 -0
- package/dist/utils/quality-gates.js +361 -0
- package/dist/utils/spec-resolver.js +602 -0
- package/dist/waivers-manager.js +49 -4
- package/package.json +6 -5
- package/templates/.cursor/hooks/caws-scope-guard.sh +64 -8
- package/templates/.cursor/hooks/validate-spec.sh +22 -12
- package/templates/.cursor/rules/{01-claims-verification.mdc → 00-claims-verification.mdc} +1 -1
- package/templates/.cursor/rules/01-working-style.mdc +50 -0
- package/templates/.cursor/rules/{02-testing-standards.mdc → 02-quality-gates.mdc} +84 -29
- package/templates/.cursor/rules/03-naming-and-refactor.mdc +33 -0
- package/templates/.cursor/rules/04-logging-language-style.mdc +23 -0
- package/templates/.cursor/rules/05-safe-defaults-guards.mdc +23 -0
- package/templates/.cursor/rules/06-typescript-conventions.mdc +36 -0
- package/templates/.cursor/rules/07-process-ops.mdc +20 -0
- package/templates/.cursor/rules/08-solid-and-architecture.mdc +16 -0
- package/templates/.cursor/rules/09-docstrings.mdc +89 -0
- package/templates/.cursor/rules/10-authorship-and-attribution.mdc +15 -0
- package/templates/.cursor/rules/11-documentation-quality-standards.mdc +390 -0
- package/templates/.cursor/rules/12-scope-management-waivers.mdc +385 -0
- package/templates/.cursor/rules/13-implementation-completeness.mdc +516 -0
- package/templates/.cursor/rules/14-language-agnostic-standards.mdc +588 -0
- package/templates/.cursor/rules/15-sophisticated-todo-detection.mdc +425 -0
- package/templates/.cursor/rules/README.md +93 -7
- package/templates/scripts/quality-gates/check-god-objects.js +146 -0
- package/templates/scripts/quality-gates/run-quality-gates.js +50 -0
- package/templates/scripts/v3/analysis/todo_analyzer.py +1950 -0
- package/dist/budget-derivation.d.ts +0 -74
- package/dist/budget-derivation.d.ts.map +0 -1
- package/dist/cicd-optimizer.d.ts +0 -142
- package/dist/cicd-optimizer.d.ts.map +0 -1
- package/dist/commands/burnup.d.ts +0 -6
- package/dist/commands/burnup.d.ts.map +0 -1
- package/dist/commands/diagnose.d.ts +0 -52
- package/dist/commands/diagnose.d.ts.map +0 -1
- package/dist/commands/evaluate.d.ts +0 -8
- package/dist/commands/evaluate.d.ts.map +0 -1
- package/dist/commands/init.d.ts +0 -5
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/iterate.d.ts +0 -8
- package/dist/commands/iterate.d.ts.map +0 -1
- package/dist/commands/provenance.d.ts +0 -32
- package/dist/commands/provenance.d.ts.map +0 -1
- package/dist/commands/quality-monitor.d.ts +0 -17
- package/dist/commands/quality-monitor.d.ts.map +0 -1
- package/dist/commands/status.d.ts +0 -43
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/templates.d.ts +0 -74
- package/dist/commands/templates.d.ts.map +0 -1
- package/dist/commands/tool.d.ts +0 -13
- package/dist/commands/tool.d.ts.map +0 -1
- package/dist/commands/troubleshoot.d.ts +0 -8
- package/dist/commands/troubleshoot.d.ts.map +0 -1
- package/dist/commands/validate.d.ts +0 -8
- package/dist/commands/validate.d.ts.map +0 -1
- package/dist/commands/waivers.d.ts +0 -8
- package/dist/commands/waivers.d.ts.map +0 -1
- package/dist/commands/workflow.d.ts +0 -85
- package/dist/commands/workflow.d.ts.map +0 -1
- package/dist/config/index.d.ts +0 -29
- package/dist/config/index.d.ts.map +0 -1
- package/dist/error-handler.d.ts +0 -164
- package/dist/error-handler.d.ts.map +0 -1
- package/dist/generators/jest-config.d.ts +0 -32
- package/dist/generators/jest-config.d.ts.map +0 -1
- package/dist/generators/working-spec.d.ts +0 -13
- package/dist/generators/working-spec.d.ts.map +0 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.d.ts.map +0 -1
- package/dist/minimal-cli.d.ts +0 -3
- package/dist/minimal-cli.d.ts.map +0 -1
- package/dist/policy/PolicyManager.d.ts +0 -104
- package/dist/policy/PolicyManager.d.ts.map +0 -1
- package/dist/scaffold/cursor-hooks.d.ts +0 -7
- package/dist/scaffold/cursor-hooks.d.ts.map +0 -1
- package/dist/scaffold/git-hooks.d.ts +0 -20
- package/dist/scaffold/git-hooks.d.ts.map +0 -1
- package/dist/scaffold/index.d.ts +0 -20
- package/dist/scaffold/index.d.ts.map +0 -1
- package/dist/spec/SpecFileManager.d.ts +0 -146
- package/dist/spec/SpecFileManager.d.ts.map +0 -1
- package/dist/test-analysis.d.ts +0 -182
- package/dist/test-analysis.d.ts.map +0 -1
- package/dist/tool-interface.d.ts +0 -236
- package/dist/tool-interface.d.ts.map +0 -1
- package/dist/tool-loader.d.ts +0 -77
- package/dist/tool-loader.d.ts.map +0 -1
- package/dist/tool-validator.d.ts +0 -72
- package/dist/tool-validator.d.ts.map +0 -1
- package/dist/utils/detection.d.ts +0 -7
- package/dist/utils/detection.d.ts.map +0 -1
- package/dist/utils/finalization.d.ts +0 -17
- package/dist/utils/finalization.d.ts.map +0 -1
- package/dist/utils/project-analysis.d.ts +0 -14
- package/dist/utils/project-analysis.d.ts.map +0 -1
- package/dist/utils/typescript-detector.d.ts +0 -63
- package/dist/utils/typescript-detector.d.ts.map +0 -1
- package/dist/validation/spec-validation.d.ts +0 -43
- package/dist/validation/spec-validation.d.ts.map +0 -1
- package/dist/waivers-manager.d.ts +0 -167
- package/dist/waivers-manager.d.ts.map +0 -1
- package/templates/.cursor/rules/03-infrastructure-standards.mdc +0 -251
- package/templates/.cursor/rules/04-documentation-integrity.mdc +0 -291
- package/templates/.cursor/rules/05-production-readiness-checklist.mdc +0 -214
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Detect if project is using TypeScript
|
|
3
|
-
* @param {string} projectDir - Project directory path
|
|
4
|
-
* @returns {Object} TypeScript detection result
|
|
5
|
-
*/
|
|
6
|
-
export function detectTypeScript(projectDir?: string): any;
|
|
7
|
-
/**
|
|
8
|
-
* Detect testing framework in use
|
|
9
|
-
* @param {string} projectDir - Project directory path
|
|
10
|
-
* @param {Object} packageJson - Parsed package.json (optional)
|
|
11
|
-
* @returns {Object} Testing framework detection result
|
|
12
|
-
*/
|
|
13
|
-
export function detectTestFramework(projectDir?: string, packageJson?: any): any;
|
|
14
|
-
export function getWorkspaceDirectories(projectDir?: string): string[];
|
|
15
|
-
/**
|
|
16
|
-
* Get workspace directories from package.json
|
|
17
|
-
* @param {string} projectDir - Project directory path
|
|
18
|
-
* @returns {string[]} Array of workspace directories
|
|
19
|
-
*/
|
|
20
|
-
/**
|
|
21
|
-
* Get workspace directories from npm/yarn package.json workspaces
|
|
22
|
-
* @param {string} projectDir - Project directory path
|
|
23
|
-
* @returns {string[]} Array of workspace directories
|
|
24
|
-
*/
|
|
25
|
-
export function getNpmWorkspaces(projectDir: string): string[];
|
|
26
|
-
/**
|
|
27
|
-
* Get workspace directories from pnpm-workspace.yaml
|
|
28
|
-
* @param {string} projectDir - Project directory path
|
|
29
|
-
* @returns {string[]} Array of workspace directories
|
|
30
|
-
*/
|
|
31
|
-
export function getPnpmWorkspaces(projectDir: string): string[];
|
|
32
|
-
/**
|
|
33
|
-
* Get workspace directories from lerna.json
|
|
34
|
-
* @param {string} projectDir - Project directory path
|
|
35
|
-
* @returns {string[]} Array of workspace directories
|
|
36
|
-
*/
|
|
37
|
-
export function getLernaWorkspaces(projectDir: string): string[];
|
|
38
|
-
/**
|
|
39
|
-
* Check if a dependency exists in hoisted node_modules
|
|
40
|
-
* @param {string} depName - Dependency name to check
|
|
41
|
-
* @param {string} projectDir - Project directory path
|
|
42
|
-
* @returns {boolean} True if dependency found in hoisted node_modules
|
|
43
|
-
*/
|
|
44
|
-
export function checkHoistedDependency(depName: string, projectDir: string): boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Check if TypeScript project needs test configuration
|
|
47
|
-
* @param {string} projectDir - Project directory path
|
|
48
|
-
* @returns {Object} Configuration status
|
|
49
|
-
*/
|
|
50
|
-
export function checkTypeScriptTestConfig(projectDir?: string): any;
|
|
51
|
-
/**
|
|
52
|
-
* Generate configuration recommendations
|
|
53
|
-
* @param {Object} tsDetection - TypeScript detection result
|
|
54
|
-
* @param {Object} testDetection - Test framework detection result
|
|
55
|
-
* @returns {string[]} Array of recommendations
|
|
56
|
-
*/
|
|
57
|
-
export function generateRecommendations(tsDetection: any, testDetection: any): string[];
|
|
58
|
-
/**
|
|
59
|
-
* Display TypeScript detection results
|
|
60
|
-
* @param {Object} detection - Detection result from checkTypeScriptTestConfig
|
|
61
|
-
*/
|
|
62
|
-
export function displayTypeScriptDetection(detection: any): void;
|
|
63
|
-
//# sourceMappingURL=typescript-detector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-detector.d.ts","sourceRoot":"","sources":["../../src/utils/typescript-detector.js"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,8CAHW,MAAM,OAkChB;AAED;;;;;GAKG;AACH,iDAJW,MAAM,0BAkDhB;AAuKD,uEASC;AA9KD;;;;GAIG;AACH;;;;GAIG;AACH,6CAHW,MAAM,GACJ,MAAM,EAAE,CA6CpB;AAED;;;;GAIG;AACH,8CAHW,MAAM,GACJ,MAAM,EAAE,CA6CpB;AAED;;;;GAIG;AACH,+CAHW,MAAM,GACJ,MAAM,EAAE,CA4CpB;AAED;;;;;GAKG;AACH,gDAJW,MAAM,cACN,MAAM,GACJ,OAAO,CAKnB;AAaD;;;;GAIG;AACH,uDAHW,MAAM,OA0EhB;AAED;;;;;GAKG;AACH,+EAFa,MAAM,EAAE,CAuBpB;AAED;;;GAGG;AACH,iEAoBC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Basic validation of working spec
|
|
3
|
-
* @param {Object} spec - Working spec object
|
|
4
|
-
* @param {Object} options - Validation options
|
|
5
|
-
* @returns {Object} Validation result
|
|
6
|
-
*/
|
|
7
|
-
export function validateWorkingSpec(spec: any, _options?: {}): any;
|
|
8
|
-
/**
|
|
9
|
-
* Enhanced validation with suggestions and auto-fix
|
|
10
|
-
* @param {Object} spec - Working spec object
|
|
11
|
-
* @param {Object} options - Validation options
|
|
12
|
-
* @returns {Object} Enhanced validation result
|
|
13
|
-
*/
|
|
14
|
-
export function validateWorkingSpecWithSuggestions(spec: any, options?: any): any;
|
|
15
|
-
/**
|
|
16
|
-
* Get suggestion for a missing field
|
|
17
|
-
* @param {string} field - Field name
|
|
18
|
-
* @param {Object} _spec - Spec object (for context)
|
|
19
|
-
* @returns {string} Suggestion text
|
|
20
|
-
*/
|
|
21
|
-
export function getFieldSuggestion(field: string, _spec: any): string;
|
|
22
|
-
/**
|
|
23
|
-
* Check if a field can be auto-fixed
|
|
24
|
-
* @param {string} field - Field name
|
|
25
|
-
* @param {Object} _spec - Spec object (for context)
|
|
26
|
-
* @returns {boolean} Whether field can be auto-fixed
|
|
27
|
-
*/
|
|
28
|
-
export function canAutoFixField(field: string, _spec: any): boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Calculate compliance score based on errors and warnings
|
|
31
|
-
* Score ranges from 0 (many issues) to 1 (perfect)
|
|
32
|
-
* @param {Array} errors - Validation errors
|
|
33
|
-
* @param {Array} warnings - Validation warnings
|
|
34
|
-
* @returns {number} Compliance score (0-1)
|
|
35
|
-
*/
|
|
36
|
-
export function calculateComplianceScore(errors: any[], warnings: any[]): number;
|
|
37
|
-
/**
|
|
38
|
-
* Get compliance grade from score
|
|
39
|
-
* @param {number} score - Compliance score (0-1)
|
|
40
|
-
* @returns {string} Grade (A, B, C, D, F)
|
|
41
|
-
*/
|
|
42
|
-
export function getComplianceGrade(score: number): string;
|
|
43
|
-
//# sourceMappingURL=spec-validation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spec-validation.d.ts","sourceRoot":"","sources":["../../src/validation/spec-validation.js"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,mEA8HC;AAED;;;;;GAKG;AACH,kFAyWC;AAoCD;;;;;GAKG;AACH,0CAJW,MAAM,eAEJ,MAAM,CAkBlB;AAED;;;;;GAKG;AACH,uCAJW,MAAM,eAEJ,OAAO,CAKnB;AAnED;;;;;;GAMG;AACH,0EAFa,MAAM,CAclB;AAED;;;;GAIG;AACH,0CAHW,MAAM,GACJ,MAAM,CAQlB"}
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
export = WaiversManager;
|
|
2
|
-
/**
|
|
3
|
-
* Waiver Manager Class
|
|
4
|
-
* Handles waiver creation, validation, expiration, and audit logging
|
|
5
|
-
*/
|
|
6
|
-
declare class WaiversManager {
|
|
7
|
-
constructor(options?: {});
|
|
8
|
-
projectRoot: any;
|
|
9
|
-
waiversDir: string;
|
|
10
|
-
waiversFile: string;
|
|
11
|
-
auditLogFile: string;
|
|
12
|
-
/**
|
|
13
|
-
* Waiver Schema Definition
|
|
14
|
-
*/
|
|
15
|
-
getWaiverSchema(): {
|
|
16
|
-
type: string;
|
|
17
|
-
required: string[];
|
|
18
|
-
properties: {
|
|
19
|
-
id: {
|
|
20
|
-
type: string;
|
|
21
|
-
pattern: string;
|
|
22
|
-
description: string;
|
|
23
|
-
};
|
|
24
|
-
title: {
|
|
25
|
-
type: string;
|
|
26
|
-
minLength: number;
|
|
27
|
-
maxLength: number;
|
|
28
|
-
description: string;
|
|
29
|
-
};
|
|
30
|
-
reason: {
|
|
31
|
-
type: string;
|
|
32
|
-
enum: string[];
|
|
33
|
-
description: string;
|
|
34
|
-
};
|
|
35
|
-
description: {
|
|
36
|
-
type: string;
|
|
37
|
-
minLength: number;
|
|
38
|
-
maxLength: number;
|
|
39
|
-
description: string;
|
|
40
|
-
};
|
|
41
|
-
gates: {
|
|
42
|
-
type: string;
|
|
43
|
-
items: {
|
|
44
|
-
type: string;
|
|
45
|
-
enum: string[];
|
|
46
|
-
};
|
|
47
|
-
minItems: number;
|
|
48
|
-
description: string;
|
|
49
|
-
};
|
|
50
|
-
risk_assessment: {
|
|
51
|
-
type: string;
|
|
52
|
-
properties: {
|
|
53
|
-
impact_level: {
|
|
54
|
-
type: string;
|
|
55
|
-
enum: string[];
|
|
56
|
-
};
|
|
57
|
-
mitigation_plan: {
|
|
58
|
-
type: string;
|
|
59
|
-
minLength: number;
|
|
60
|
-
};
|
|
61
|
-
review_required: {
|
|
62
|
-
type: string;
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
required: string[];
|
|
66
|
-
};
|
|
67
|
-
expires_at: {
|
|
68
|
-
type: string;
|
|
69
|
-
format: string;
|
|
70
|
-
description: string;
|
|
71
|
-
};
|
|
72
|
-
approved_by: {
|
|
73
|
-
type: string;
|
|
74
|
-
description: string;
|
|
75
|
-
};
|
|
76
|
-
created_at: {
|
|
77
|
-
type: string;
|
|
78
|
-
format: string;
|
|
79
|
-
description: string;
|
|
80
|
-
};
|
|
81
|
-
metadata: {
|
|
82
|
-
type: string;
|
|
83
|
-
properties: {
|
|
84
|
-
related_pr: {
|
|
85
|
-
type: string;
|
|
86
|
-
};
|
|
87
|
-
related_issue: {
|
|
88
|
-
type: string;
|
|
89
|
-
};
|
|
90
|
-
environment: {
|
|
91
|
-
type: string;
|
|
92
|
-
enum: string[];
|
|
93
|
-
};
|
|
94
|
-
urgency: {
|
|
95
|
-
type: string;
|
|
96
|
-
enum: string[];
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
/**
|
|
103
|
-
* Create a new waiver
|
|
104
|
-
*/
|
|
105
|
-
createWaiver(waiverData: any): Promise<{
|
|
106
|
-
id: string;
|
|
107
|
-
title: any;
|
|
108
|
-
reason: any;
|
|
109
|
-
description: any;
|
|
110
|
-
gates: any;
|
|
111
|
-
risk_assessment: any;
|
|
112
|
-
expires_at: any;
|
|
113
|
-
approved_by: any;
|
|
114
|
-
created_at: string;
|
|
115
|
-
metadata: any;
|
|
116
|
-
}>;
|
|
117
|
-
/**
|
|
118
|
-
* Check if waiver applies to specific gates
|
|
119
|
-
*/
|
|
120
|
-
checkWaiverCoverage(gatesToCheck: any, context?: {}): Promise<{
|
|
121
|
-
coveredGates: any[];
|
|
122
|
-
waiverDetails: {
|
|
123
|
-
gate: any;
|
|
124
|
-
waiver_id: any;
|
|
125
|
-
reason: any;
|
|
126
|
-
expires_at: any;
|
|
127
|
-
approved_by: any;
|
|
128
|
-
}[];
|
|
129
|
-
allCovered: boolean;
|
|
130
|
-
}>;
|
|
131
|
-
/**
|
|
132
|
-
* Get all active waivers
|
|
133
|
-
*/
|
|
134
|
-
getActiveWaivers(): Promise<any>;
|
|
135
|
-
/**
|
|
136
|
-
* Revoke a waiver
|
|
137
|
-
*/
|
|
138
|
-
revokeWaiver(waiverId: any, reason?: string): Promise<any>;
|
|
139
|
-
/**
|
|
140
|
-
* Extend waiver expiration
|
|
141
|
-
*/
|
|
142
|
-
extendWaiver(waiverId: any, newExpiryDate: any, approvedBy: any): Promise<any>;
|
|
143
|
-
/**
|
|
144
|
-
* Get waiver statistics and health metrics
|
|
145
|
-
*/
|
|
146
|
-
getWaiverStats(): Promise<{
|
|
147
|
-
total_active: any;
|
|
148
|
-
by_reason: {};
|
|
149
|
-
by_risk_level: {};
|
|
150
|
-
expiring_soon: any[];
|
|
151
|
-
high_risk: any[];
|
|
152
|
-
total_gates_waived: number;
|
|
153
|
-
average_lifespan_days: number;
|
|
154
|
-
}>;
|
|
155
|
-
generateWaiverId(): Promise<string>;
|
|
156
|
-
validateWaiver(waiver: any): {
|
|
157
|
-
valid: boolean;
|
|
158
|
-
errors: string[];
|
|
159
|
-
};
|
|
160
|
-
checkWaiverConflicts(newWaiver: any): Promise<string[]>;
|
|
161
|
-
waiverAppliesToContext(waiver: any, context: any): boolean;
|
|
162
|
-
loadActiveWaivers(): Promise<unknown>;
|
|
163
|
-
saveActiveWaivers(waivers: any): Promise<void>;
|
|
164
|
-
auditLog(action: any, waiverId: any, details: any): Promise<void>;
|
|
165
|
-
flagForReview(waiver: any): Promise<void>;
|
|
166
|
-
}
|
|
167
|
-
//# sourceMappingURL=waivers-manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"waivers-manager.d.ts","sourceRoot":"","sources":["../src/waivers-manager.js"],"names":[],"mappings":";AAaA;;;GAGG;AACH;IACE,0BAUC;IATC,iBAAuD;IACvD,mBAAiE;IACjE,oBAAoE;IACpE,qBAAkE;IAQpE;;OAEG;IACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAiGC;IAED;;OAEG;IACH;;;;;;;;;;;OA4DC;IAED;;OAEG;IACH;;;;;;;;;;OA+BC;IAED;;OAEG;IACH,iCAgBC;IAED;;OAEG;IACH,2DAeC;IAED;;OAEG;IACH,+EAuBC;IAED;;OAEG;IACH;;;;;;;;OA2DC;IAID,oCAUC;IAED;;;MAkDC;IAED,wDAkBC;IAED,2DAUC;IAED,sCAYC;IAED,+CAOC;IAED,kEAaC;IAED,0CA2CC;CACF"}
|
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Infrastructure, deployment, and operational standards
|
|
3
|
-
globs:
|
|
4
|
-
alwaysApply: true
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Infrastructure & Deployment Standards
|
|
8
|
-
|
|
9
|
-
## Database Standards
|
|
10
|
-
|
|
11
|
-
### Connection Management
|
|
12
|
-
|
|
13
|
-
- **Connection Pooling**: Always use connection pools, never single connections
|
|
14
|
-
- **Pool Configuration**: Set appropriate min/max connections based on load
|
|
15
|
-
- **Timeout Handling**: Configure connection, query, and idle timeouts
|
|
16
|
-
- **Health Checks**: Implement connection health validation
|
|
17
|
-
- **Graceful Shutdown**: Properly close connections on application shutdown
|
|
18
|
-
|
|
19
|
-
### Schema Management
|
|
20
|
-
|
|
21
|
-
- **Migration Scripts**: Version-controlled, transactional migrations
|
|
22
|
-
- **Downgrade Scripts**: Provide rollback migrations for all changes
|
|
23
|
-
- **Idempotent Operations**: Migrations safe to run multiple times
|
|
24
|
-
- **Testing**: All migrations tested against production-like data
|
|
25
|
-
- **Documentation**: Migration purpose and impact clearly documented
|
|
26
|
-
|
|
27
|
-
### Data Integrity
|
|
28
|
-
|
|
29
|
-
- **Constraints**: Foreign keys, unique constraints, check constraints
|
|
30
|
-
- **Transactions**: All multi-table operations in transactions
|
|
31
|
-
- **Atomicity**: Either all changes succeed or all fail
|
|
32
|
-
- **Consistency**: Database always in valid state
|
|
33
|
-
- **Isolation**: Concurrent operations don't interfere
|
|
34
|
-
|
|
35
|
-
## API Standards
|
|
36
|
-
|
|
37
|
-
### RESTful Design
|
|
38
|
-
|
|
39
|
-
- **Resource Naming**: Plural nouns, consistent casing
|
|
40
|
-
- **HTTP Methods**: GET (read), POST (create), PUT/PATCH (update), DELETE
|
|
41
|
-
- **Status Codes**: Proper HTTP status codes (200, 201, 400, 404, 500, etc.)
|
|
42
|
-
- **Content Types**: JSON for data, appropriate content-type headers
|
|
43
|
-
- **Versioning**: API versioning strategy (URL, headers, or content negotiation)
|
|
44
|
-
|
|
45
|
-
### Error Handling
|
|
46
|
-
|
|
47
|
-
- **Structured Errors**: Consistent error response format
|
|
48
|
-
- **Error Codes**: Machine-readable error codes with human-readable messages
|
|
49
|
-
- **Logging**: All errors logged with appropriate severity
|
|
50
|
-
- **Client Guidance**: Error responses include actionable information
|
|
51
|
-
- **No Information Leakage**: Sensitive information not exposed in errors
|
|
52
|
-
|
|
53
|
-
## Security Standards
|
|
54
|
-
|
|
55
|
-
### Authentication & Authorization
|
|
56
|
-
|
|
57
|
-
- **Token Management**: Secure token storage and validation
|
|
58
|
-
- **Session Handling**: Proper session lifecycle management
|
|
59
|
-
- **Role-Based Access**: Clear role definitions and enforcement
|
|
60
|
-
- **Permission Checking**: Every operation validates permissions
|
|
61
|
-
- **Audit Logging**: All security events logged
|
|
62
|
-
|
|
63
|
-
### Input Validation
|
|
64
|
-
|
|
65
|
-
- **Schema Validation**: All inputs validated against schemas
|
|
66
|
-
- **Sanitization**: User input sanitized before processing
|
|
67
|
-
- **Type Safety**: Runtime type checking for external inputs
|
|
68
|
-
- **Length Limits**: Reasonable limits on input sizes
|
|
69
|
-
- **Content Filtering**: Malicious content detection and blocking
|
|
70
|
-
|
|
71
|
-
## Monitoring & Observability
|
|
72
|
-
|
|
73
|
-
### Logging Standards
|
|
74
|
-
|
|
75
|
-
- **Structured Logging**: JSON format with consistent field names
|
|
76
|
-
- **Log Levels**: ERROR, WARN, INFO, DEBUG appropriately used
|
|
77
|
-
- **Context Information**: Request IDs, user context, operation details
|
|
78
|
-
- **Performance Logging**: Response times, resource usage
|
|
79
|
-
- **Error Correlation**: Related events linked together
|
|
80
|
-
|
|
81
|
-
### Metrics Collection
|
|
82
|
-
|
|
83
|
-
- **Business Metrics**: User registrations, API calls, conversion rates
|
|
84
|
-
- **Performance Metrics**: Response times, throughput, error rates
|
|
85
|
-
- **Resource Metrics**: CPU, memory, disk, network usage
|
|
86
|
-
- **Custom Metrics**: Application-specific KPIs
|
|
87
|
-
- **Alert Thresholds**: Defined thresholds for automated alerts
|
|
88
|
-
|
|
89
|
-
### Health Checks
|
|
90
|
-
|
|
91
|
-
- **Application Health**: Service availability and responsiveness
|
|
92
|
-
- **Dependency Health**: Database, external APIs, message queues
|
|
93
|
-
- **Resource Health**: Disk space, memory, connection pools
|
|
94
|
-
- **Business Health**: Core business operations functional
|
|
95
|
-
- **Automated Recovery**: Self-healing capabilities
|
|
96
|
-
|
|
97
|
-
## Deployment Standards
|
|
98
|
-
|
|
99
|
-
### Environment Configuration
|
|
100
|
-
|
|
101
|
-
- **Environment Variables**: No hardcoded configuration values
|
|
102
|
-
- **Configuration Files**: Version-controlled, environment-specific configs
|
|
103
|
-
- **Secrets Management**: Secure storage and access for secrets
|
|
104
|
-
- **Validation**: Configuration validated at startup
|
|
105
|
-
- **Documentation**: All configuration options documented
|
|
106
|
-
|
|
107
|
-
### Container Standards
|
|
108
|
-
|
|
109
|
-
- **Base Images**: Minimal, secure base images
|
|
110
|
-
- **Layer Optimization**: Efficient layer caching and ordering
|
|
111
|
-
- **Security Scanning**: Container images scanned for vulnerabilities
|
|
112
|
-
- **Resource Limits**: CPU and memory limits set appropriately
|
|
113
|
-
- **Health Checks**: Container health checks implemented
|
|
114
|
-
|
|
115
|
-
### CI/CD Pipeline
|
|
116
|
-
|
|
117
|
-
- **Automated Testing**: Full test suite runs on every commit
|
|
118
|
-
- **Security Scanning**: Automated security scans in pipeline
|
|
119
|
-
- **Performance Testing**: Automated performance regression tests
|
|
120
|
-
- **Deployment Automation**: Zero-touch deployment processes
|
|
121
|
-
- **Rollback Capability**: Automated rollback procedures
|
|
122
|
-
|
|
123
|
-
## Reliability Standards
|
|
124
|
-
|
|
125
|
-
### Circuit Breaker Pattern
|
|
126
|
-
|
|
127
|
-
- **Failure Threshold**: Configurable failure count before opening
|
|
128
|
-
- **Recovery Timeout**: Time before attempting recovery
|
|
129
|
-
- **Success Threshold**: Successes needed to close circuit
|
|
130
|
-
- **Fallback Behavior**: Graceful degradation when circuit open
|
|
131
|
-
- **Monitoring**: Circuit state and failure rates monitored
|
|
132
|
-
|
|
133
|
-
### Retry Logic
|
|
134
|
-
|
|
135
|
-
- **Exponential Backoff**: Increasing delay between retries
|
|
136
|
-
- **Jitter**: Randomization to prevent thundering herd
|
|
137
|
-
- **Maximum Retries**: Configurable retry limits
|
|
138
|
-
- **Retry Conditions**: Only retry appropriate error types
|
|
139
|
-
- **Circuit Integration**: Retry logic respects circuit breaker state
|
|
140
|
-
|
|
141
|
-
### Graceful Degradation
|
|
142
|
-
|
|
143
|
-
- **Feature Flags**: Ability to disable features under load
|
|
144
|
-
- **Fallback Content**: Cached or simplified content when services fail
|
|
145
|
-
- **Progressive Enhancement**: Core functionality works without extras
|
|
146
|
-
- **User Communication**: Clear messaging about degraded functionality
|
|
147
|
-
- **Automatic Recovery**: Services automatically recover when possible
|
|
148
|
-
|
|
149
|
-
## Performance Standards
|
|
150
|
-
|
|
151
|
-
### Response Time SLAs
|
|
152
|
-
|
|
153
|
-
- **API Endpoints**: P95 response times defined and monitored
|
|
154
|
-
- **Page Load Times**: Frontend performance budgets
|
|
155
|
-
- **Database Queries**: Query performance thresholds
|
|
156
|
-
- **Background Jobs**: Job completion time limits
|
|
157
|
-
- **Real-time Operations**: Sub-second response requirements
|
|
158
|
-
|
|
159
|
-
### Resource Management
|
|
160
|
-
|
|
161
|
-
- **Memory Usage**: Monitor and limit memory consumption
|
|
162
|
-
- **CPU Utilization**: Efficient CPU usage patterns
|
|
163
|
-
- **Disk I/O**: Optimize file system operations
|
|
164
|
-
- **Network Usage**: Efficient network communication
|
|
165
|
-
- **Connection Pools**: Proper sizing of database and external connections
|
|
166
|
-
|
|
167
|
-
### Caching Strategy
|
|
168
|
-
|
|
169
|
-
- **Cache Invalidation**: Proper cache invalidation strategies
|
|
170
|
-
- **Cache Penetration**: Protection against cache penetration attacks
|
|
171
|
-
- **Cache Warming**: Proactive cache population for hot data
|
|
172
|
-
- **Distributed Caching**: Scalable caching across multiple instances
|
|
173
|
-
- **Cache Monitoring**: Cache hit rates and performance monitoring
|
|
174
|
-
|
|
175
|
-
## Scalability Standards
|
|
176
|
-
|
|
177
|
-
### Horizontal Scaling
|
|
178
|
-
|
|
179
|
-
- **Stateless Design**: Applications designed for horizontal scaling
|
|
180
|
-
- **Shared Nothing**: Instances don't share local state
|
|
181
|
-
- **Load Balancing**: Proper load distribution across instances
|
|
182
|
-
- **Session Management**: Distributed session storage
|
|
183
|
-
- **Configuration**: Centralized configuration management
|
|
184
|
-
|
|
185
|
-
### Database Scaling
|
|
186
|
-
|
|
187
|
-
- **Read Replicas**: Read operations distributed across replicas
|
|
188
|
-
- **Sharding Strategy**: Data partitioning strategy defined
|
|
189
|
-
- **Connection Pooling**: Efficient connection management
|
|
190
|
-
- **Query Optimization**: Efficient query patterns
|
|
191
|
-
- **Indexing Strategy**: Appropriate indexes for query patterns
|
|
192
|
-
|
|
193
|
-
### Asynchronous Processing
|
|
194
|
-
|
|
195
|
-
- **Message Queues**: Asynchronous task processing
|
|
196
|
-
- **Background Jobs**: Long-running tasks processed asynchronously
|
|
197
|
-
- **Event-Driven Architecture**: Loose coupling through events
|
|
198
|
-
- **Dead Letter Queues**: Handling of failed message processing
|
|
199
|
-
- **Monitoring**: Queue depth and processing rate monitoring
|
|
200
|
-
|
|
201
|
-
## Backup & Recovery
|
|
202
|
-
|
|
203
|
-
### Data Backup
|
|
204
|
-
|
|
205
|
-
- **Regular Backups**: Automated backup schedules
|
|
206
|
-
- **Backup Verification**: Backup integrity validation
|
|
207
|
-
- **Retention Policies**: Backup retention periods defined
|
|
208
|
-
- **Encryption**: Backup data encrypted at rest and in transit
|
|
209
|
-
- **Testing**: Backup restoration regularly tested
|
|
210
|
-
|
|
211
|
-
### Disaster Recovery
|
|
212
|
-
|
|
213
|
-
- **Recovery Time Objective (RTO)**: Maximum acceptable downtime
|
|
214
|
-
- **Recovery Point Objective (RPO)**: Maximum data loss acceptable
|
|
215
|
-
- **Multi-Region Deployment**: Geographic redundancy
|
|
216
|
-
- **Failover Procedures**: Automated and manual failover processes
|
|
217
|
-
- **Recovery Testing**: Regular disaster recovery drills
|
|
218
|
-
|
|
219
|
-
### Business Continuity
|
|
220
|
-
|
|
221
|
-
- **Service Level Agreements**: Defined uptime and performance guarantees
|
|
222
|
-
- **Incident Response**: Defined incident response procedures
|
|
223
|
-
- **Communication Plans**: Stakeholder communication during incidents
|
|
224
|
-
- **Post-Mortem Process**: Incident analysis and improvement process
|
|
225
|
-
- **Continuous Improvement**: Regular review and improvement of processes
|
|
226
|
-
|
|
227
|
-
## Compliance & Governance
|
|
228
|
-
|
|
229
|
-
### Security Compliance
|
|
230
|
-
|
|
231
|
-
- **Data Encryption**: Data encrypted at rest and in transit
|
|
232
|
-
- **Access Controls**: Principle of least privilege enforced
|
|
233
|
-
- **Audit Trails**: Comprehensive audit logging
|
|
234
|
-
- **Vulnerability Management**: Regular security assessments
|
|
235
|
-
- **Incident Response**: Security incident response procedures
|
|
236
|
-
|
|
237
|
-
### Data Privacy
|
|
238
|
-
|
|
239
|
-
- **Data Classification**: Sensitive data properly classified
|
|
240
|
-
- **Retention Policies**: Data retention periods defined
|
|
241
|
-
- **Consent Management**: User consent properly managed
|
|
242
|
-
- **Data Deletion**: Right to deletion implemented
|
|
243
|
-
- **Privacy Impact Assessments**: Privacy risks assessed
|
|
244
|
-
|
|
245
|
-
### Regulatory Compliance
|
|
246
|
-
|
|
247
|
-
- **GDPR Compliance**: EU data protection regulations
|
|
248
|
-
- **CCPA Compliance**: California consumer privacy regulations
|
|
249
|
-
- **Industry Standards**: Relevant industry compliance requirements
|
|
250
|
-
- **Audit Readiness**: Systems designed for regulatory audits
|
|
251
|
-
- **Documentation**: Compliance evidence properly documented
|