@paths.design/caws-cli 3.1.0 → 3.1.1
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 +295 -150
- package/dist/budget-derivation.d.ts +35 -0
- package/dist/budget-derivation.d.ts.map +1 -0
- package/dist/budget-derivation.js +204 -0
- package/dist/cicd-optimizer.d.ts +142 -0
- package/dist/cicd-optimizer.d.ts.map +1 -0
- package/dist/cicd-optimizer.js +504 -0
- package/dist/commands/burnup.d.ts +6 -0
- package/dist/commands/burnup.d.ts.map +1 -0
- package/dist/commands/burnup.js +90 -0
- package/dist/commands/init.d.ts +5 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +514 -0
- package/dist/commands/provenance.d.ts +22 -0
- package/dist/commands/provenance.d.ts.map +1 -0
- package/dist/commands/provenance.js +594 -0
- package/dist/commands/tool.d.ts +13 -0
- package/dist/commands/tool.d.ts.map +1 -0
- package/dist/commands/tool.js +138 -0
- package/dist/commands/validate.d.ts +7 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +80 -0
- package/dist/config/index.d.ts +29 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +132 -0
- package/dist/error-handler.d.ts +50 -0
- package/dist/error-handler.d.ts.map +1 -0
- package/dist/error-handler.js +253 -0
- package/dist/generators/working-spec.d.ts +13 -0
- package/dist/generators/working-spec.d.ts.map +1 -0
- package/dist/generators/working-spec.js +204 -0
- package/dist/index-new.d.ts +5 -0
- package/dist/index-new.d.ts.map +1 -0
- package/dist/index-new.js +317 -0
- package/dist/index.d.ts +3 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +94 -2990
- package/dist/index.js.backup +4711 -0
- package/dist/scaffold/cursor-hooks.d.ts +7 -0
- package/dist/scaffold/cursor-hooks.d.ts.map +1 -0
- package/dist/scaffold/cursor-hooks.js +152 -0
- package/dist/scaffold/index.d.ts +20 -0
- package/dist/scaffold/index.d.ts.map +1 -0
- package/dist/scaffold/index.js +486 -0
- package/dist/test-analysis.d.ts +182 -0
- package/dist/test-analysis.d.ts.map +1 -0
- package/dist/test-analysis.js +580 -0
- package/dist/tool-interface.d.ts +236 -0
- package/dist/tool-interface.d.ts.map +1 -0
- package/dist/tool-interface.js +314 -0
- package/dist/tool-loader.d.ts +77 -0
- package/dist/tool-loader.d.ts.map +1 -0
- package/dist/tool-loader.js +298 -0
- package/dist/tool-validator.d.ts +72 -0
- package/dist/tool-validator.d.ts.map +1 -0
- package/dist/tool-validator.js +387 -0
- package/dist/utils/detection.d.ts +7 -0
- package/dist/utils/detection.d.ts.map +1 -0
- package/dist/utils/detection.js +174 -0
- package/dist/utils/finalization.d.ts +17 -0
- package/dist/utils/finalization.d.ts.map +1 -0
- package/dist/utils/finalization.js +229 -0
- package/dist/utils/project-analysis.d.ts +14 -0
- package/dist/utils/project-analysis.d.ts.map +1 -0
- package/dist/utils/project-analysis.js +105 -0
- package/dist/validation/spec-validation.d.ts +29 -0
- package/dist/validation/spec-validation.d.ts.map +1 -0
- package/dist/validation/spec-validation.js +376 -0
- package/dist/waivers-manager.d.ts +167 -0
- package/dist/waivers-manager.d.ts.map +1 -0
- package/dist/waivers-manager.js +549 -0
- package/package.json +10 -12
- package/templates/.cursor/README.md +311 -0
- package/templates/.cursor/hooks/audit.sh +55 -0
- package/templates/.cursor/hooks/block-dangerous.sh +77 -0
- package/templates/.cursor/hooks/caws-quality-check.sh +52 -0
- package/templates/.cursor/hooks/caws-scope-guard.sh +74 -0
- package/templates/.cursor/hooks/caws-tool-validation.sh +121 -0
- package/templates/.cursor/hooks/format.sh +38 -0
- package/templates/.cursor/hooks/naming-check.sh +64 -0
- package/templates/.cursor/hooks/scan-secrets.sh +46 -0
- package/templates/.cursor/hooks/scope-guard.sh +52 -0
- package/templates/.cursor/hooks/validate-spec.sh +38 -0
- package/templates/.cursor/hooks.json +59 -0
- package/templates/.github/copilot/instructions.md +311 -0
- package/templates/.idea/runConfigurations/CAWS_Evaluate.xml +5 -0
- package/templates/.idea/runConfigurations/CAWS_Validate.xml +5 -0
- package/templates/.vscode/launch.json +56 -0
- package/templates/.vscode/settings.json +93 -0
- package/templates/.windsurf/workflows/caws-guided-development.md +92 -0
- package/templates/apps/tools/caws/README.md +1 -1
- package/templates/apps/tools/caws/schemas/working-spec.schema.json +21 -3
- package/templates/codemod/test.js +93 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
{
|
|
2
|
+
// CAWS VS Code Extension Settings
|
|
3
|
+
"caws.cli.path": "caws",
|
|
4
|
+
"caws.autoValidate": true,
|
|
5
|
+
"caws.showQualityStatus": true,
|
|
6
|
+
"caws.experimentalMode": false,
|
|
7
|
+
|
|
8
|
+
// General IDE settings that work well with CAWS
|
|
9
|
+
"editor.formatOnSave": true,
|
|
10
|
+
"editor.codeActionsOnSave": {
|
|
11
|
+
"source.fixAll.eslint": "explicit",
|
|
12
|
+
"source.organizeImports": "explicit"
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
// File associations for CAWS files
|
|
16
|
+
"files.associations": {
|
|
17
|
+
".caws/working-spec.yaml": "yaml",
|
|
18
|
+
".caws/waivers/*.yaml": "yaml",
|
|
19
|
+
"apps/tools/caws/*.js": "javascript"
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
// Exclude CAWS-generated files from search and navigation
|
|
23
|
+
"files.exclude": {
|
|
24
|
+
".caws/cache/": true,
|
|
25
|
+
".caws/waivers/review-*.md": true
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
// Search excludes for CAWS artifacts
|
|
29
|
+
"search.exclude": {
|
|
30
|
+
".caws/cache/**": true,
|
|
31
|
+
"packages/*/dist/**": true,
|
|
32
|
+
"packages/*/node_modules/**": true
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
// CAWS-aware task definitions
|
|
36
|
+
"tasks": {
|
|
37
|
+
"version": "2.0.0",
|
|
38
|
+
"tasks": [
|
|
39
|
+
{
|
|
40
|
+
"label": "CAWS: Validate",
|
|
41
|
+
"type": "shell",
|
|
42
|
+
"command": "caws",
|
|
43
|
+
"args": ["validate"],
|
|
44
|
+
"group": {
|
|
45
|
+
"kind": "build",
|
|
46
|
+
"isDefault": true
|
|
47
|
+
},
|
|
48
|
+
"presentation": {
|
|
49
|
+
"echo": true,
|
|
50
|
+
"reveal": "always",
|
|
51
|
+
"focus": false,
|
|
52
|
+
"panel": "shared"
|
|
53
|
+
},
|
|
54
|
+
"problemMatcher": []
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"label": "CAWS: Evaluate Quality",
|
|
58
|
+
"type": "shell",
|
|
59
|
+
"command": "caws",
|
|
60
|
+
"args": ["agent", "evaluate", ".caws/working-spec.yaml"],
|
|
61
|
+
"group": "test",
|
|
62
|
+
"presentation": {
|
|
63
|
+
"echo": true,
|
|
64
|
+
"reveal": "always",
|
|
65
|
+
"focus": false,
|
|
66
|
+
"panel": "shared"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"label": "CAWS: Create Waiver",
|
|
71
|
+
"type": "shell",
|
|
72
|
+
"command": "caws",
|
|
73
|
+
"args": ["waivers", "create"],
|
|
74
|
+
"group": "build"
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
// Recommended extensions for CAWS development
|
|
80
|
+
"recommendations": [
|
|
81
|
+
"ms-vscode.vscode-json",
|
|
82
|
+
"redhat.vscode-yaml",
|
|
83
|
+
"ms-vscode.vscode-typescript-next",
|
|
84
|
+
"esbenp.prettier-vscode",
|
|
85
|
+
"dbaeumer.vscode-eslint"
|
|
86
|
+
],
|
|
87
|
+
|
|
88
|
+
// Workspace-specific settings
|
|
89
|
+
"yaml.schemas": {
|
|
90
|
+
"./.caws/schema/working-spec.schema.json": ".caws/working-spec.yaml",
|
|
91
|
+
"./.caws/schema/waiver.schema.json": ".caws/waivers/*.yaml"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# /caws-guided-development
|
|
2
|
+
|
|
3
|
+
## CAWS-Guided Feature Development Workflow
|
|
4
|
+
|
|
5
|
+
**Purpose**: Guide agents through feature development with CAWS quality assurance
|
|
6
|
+
|
|
7
|
+
**Tags**: development, quality, caws, feature
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
### 1. Initialize CAWS Working Spec
|
|
12
|
+
```
|
|
13
|
+
# Create comprehensive working specification
|
|
14
|
+
caws init feature-name --interactive
|
|
15
|
+
|
|
16
|
+
# Define acceptance criteria, scope, and risk assessment
|
|
17
|
+
# Working spec: .caws/working-spec.yaml
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### 2. Plan Implementation Strategy
|
|
21
|
+
```
|
|
22
|
+
# Get CAWS guidance for implementation approach
|
|
23
|
+
caws agent iterate --current-state "Planning phase complete, need implementation strategy"
|
|
24
|
+
|
|
25
|
+
# CAWS will suggest:
|
|
26
|
+
# - Implementation steps
|
|
27
|
+
# - Quality gates to consider
|
|
28
|
+
# - Risk mitigation strategies
|
|
29
|
+
# - Testing approach
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 3. Implement Core Functionality
|
|
33
|
+
```
|
|
34
|
+
# Start coding with CAWS quality monitoring
|
|
35
|
+
# Real-time feedback via CAWS tools
|
|
36
|
+
|
|
37
|
+
# Regular quality checks
|
|
38
|
+
caws agent evaluate --quiet
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 4. Quality Assurance Integration
|
|
42
|
+
```
|
|
43
|
+
# Run comprehensive quality gates
|
|
44
|
+
caws validate
|
|
45
|
+
|
|
46
|
+
# Address any failing gates
|
|
47
|
+
# Create waivers if justified
|
|
48
|
+
caws waivers create --reason emergency_hotfix --gates coverage_threshold
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 5. Testing & Validation
|
|
52
|
+
```
|
|
53
|
+
# Unit tests
|
|
54
|
+
npm run test:unit
|
|
55
|
+
|
|
56
|
+
# Integration tests
|
|
57
|
+
npm run test:integration
|
|
58
|
+
|
|
59
|
+
# Contract tests
|
|
60
|
+
npm run test:contract
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 6. Final Quality Review
|
|
64
|
+
```
|
|
65
|
+
# Complete CAWS evaluation
|
|
66
|
+
caws agent evaluate
|
|
67
|
+
|
|
68
|
+
# Generate provenance report
|
|
69
|
+
caws provenance generate
|
|
70
|
+
|
|
71
|
+
# Ready for integration
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
**Quality Gates**:
|
|
77
|
+
- ✅ Working spec validation
|
|
78
|
+
- ✅ Code quality standards
|
|
79
|
+
- ✅ Test coverage requirements
|
|
80
|
+
- ✅ Security scanning
|
|
81
|
+
- ✅ Performance budgets
|
|
82
|
+
|
|
83
|
+
**Success Criteria**:
|
|
84
|
+
- All CAWS quality gates pass
|
|
85
|
+
- Acceptance criteria met
|
|
86
|
+
- No critical security issues
|
|
87
|
+
- Performance requirements satisfied
|
|
88
|
+
|
|
89
|
+
**Call Other Workflows**:
|
|
90
|
+
- `/caws-testing-workflow` - Comprehensive testing
|
|
91
|
+
- `/caws-security-review` - Security validation
|
|
92
|
+
- `/caws-deployment-checklist` - Deployment preparation
|
|
@@ -427,7 +427,7 @@ jobs:
|
|
|
427
427
|
|
|
428
428
|
## 📚 Documentation
|
|
429
429
|
|
|
430
|
-
- [
|
|
430
|
+
- [Hooks & Agent Workflows Guide](../../docs/guides/hooks-and-agent-workflows.md)
|
|
431
431
|
- [Hook Strategy](../../docs/HOOK_STRATEGY.md)
|
|
432
432
|
- [Developer Guide](../../docs/caws-developer-guide.md)
|
|
433
433
|
- [API Documentation](../../docs/api/)
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
"id",
|
|
7
7
|
"title",
|
|
8
8
|
"risk_tier",
|
|
9
|
+
"mode",
|
|
10
|
+
"blast_radius",
|
|
11
|
+
"operational_rollback_slo",
|
|
9
12
|
"scope",
|
|
10
13
|
"invariants",
|
|
11
14
|
"acceptance",
|
|
@@ -13,9 +16,24 @@
|
|
|
13
16
|
"contracts"
|
|
14
17
|
],
|
|
15
18
|
"properties": {
|
|
16
|
-
"id": { "type": "string", "pattern": "^
|
|
17
|
-
"title": { "type": "string", "minLength":
|
|
18
|
-
"risk_tier": { "type": "integer", "enum": [1, 2, 3] },
|
|
19
|
+
"id": { "type": "string", "pattern": "^(PROJ|FEAT|FIX|ARCH)-\\d{4}$" },
|
|
20
|
+
"title": { "type": "string", "minLength": 10, "maxLength": 200 },
|
|
21
|
+
"risk_tier": { "type": ["integer", "string"], "enum": [1, 2, 3, "1", "2", "3"] },
|
|
22
|
+
"mode": { "type": "string", "enum": ["feature", "refactor", "fix", "doc", "chore"] },
|
|
23
|
+
"waiver_ids": {
|
|
24
|
+
"type": "array",
|
|
25
|
+
"items": { "type": "string", "pattern": "^WV-\\d{4}$" },
|
|
26
|
+
"description": "IDs of active waivers applying to this spec"
|
|
27
|
+
},
|
|
28
|
+
"blast_radius": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"required": ["modules"],
|
|
31
|
+
"properties": {
|
|
32
|
+
"modules": { "type": "array", "items": { "type": "string" } },
|
|
33
|
+
"data_migration": { "type": "boolean" }
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"operational_rollback_slo": { "type": "string" },
|
|
19
37
|
"scope": {
|
|
20
38
|
"type": "object",
|
|
21
39
|
"required": ["in", "out"],
|
|
@@ -1 +1,93 @@
|
|
|
1
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Template Codemod for CAWS Framework
|
|
5
|
+
* Automated code transformations for refactoring
|
|
6
|
+
* @author CAWS Framework
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const tsMorph = require('ts-morph');
|
|
10
|
+
|
|
11
|
+
function applyCodemod(dryRun = true) {
|
|
12
|
+
console.log('🔧 Applying codemod transformations...');
|
|
13
|
+
|
|
14
|
+
const project = new tsMorph.Project();
|
|
15
|
+
|
|
16
|
+
// Load all TypeScript source files
|
|
17
|
+
const sourceFiles = project.addSourceFilesAtPaths('src/**/*.ts');
|
|
18
|
+
|
|
19
|
+
if (sourceFiles.length === 0) {
|
|
20
|
+
console.log('⚠️ No TypeScript source files found in src/ directory');
|
|
21
|
+
return { filesProcessed: 0, changesApplied: 0 };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
console.log(`📁 Processing ${sourceFiles.length} source files`);
|
|
25
|
+
let totalChanges = 0;
|
|
26
|
+
|
|
27
|
+
for (const sourceFile of sourceFiles) {
|
|
28
|
+
const filePath = sourceFile.getFilePath();
|
|
29
|
+
console.log(`Processing: ${filePath}`);
|
|
30
|
+
|
|
31
|
+
let fileChanges = 0;
|
|
32
|
+
|
|
33
|
+
// Example transformations - customize these for your specific needs:
|
|
34
|
+
|
|
35
|
+
// 1. Add JSDoc to exported functions without documentation
|
|
36
|
+
const exportedFunctions = sourceFile
|
|
37
|
+
.getFunctions()
|
|
38
|
+
.filter((func) => func.isExported && !func.getJsDocs().length);
|
|
39
|
+
|
|
40
|
+
for (const func of exportedFunctions) {
|
|
41
|
+
func.addJsDoc({
|
|
42
|
+
description: `Handles ${func.getName()} operations`,
|
|
43
|
+
tags: [
|
|
44
|
+
{ tagName: 'param', text: 'options - Configuration options' },
|
|
45
|
+
{ tagName: 'returns', text: 'Result of the operation' },
|
|
46
|
+
],
|
|
47
|
+
});
|
|
48
|
+
fileChanges++;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// 2. Add type annotations to untyped parameters (example)
|
|
52
|
+
// const untypedParams = sourceFile.getDescendantsOfKind(tsMorph.SyntaxKind.Parameter)
|
|
53
|
+
// .filter(param => !param.getTypeNode());
|
|
54
|
+
// Add your transformation logic here...
|
|
55
|
+
|
|
56
|
+
if (fileChanges > 0) {
|
|
57
|
+
console.log(` ✅ Applied ${fileChanges} transformations`);
|
|
58
|
+
totalChanges += fileChanges;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
console.log(`📊 Codemod complete: ${totalChanges} total transformations`);
|
|
63
|
+
|
|
64
|
+
if (!dryRun) {
|
|
65
|
+
console.log('💾 Saving changes...');
|
|
66
|
+
project.saveSync();
|
|
67
|
+
console.log('✅ All changes saved successfully');
|
|
68
|
+
} else {
|
|
69
|
+
console.log('🔍 Dry run - no files were modified');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
filesProcessed: sourceFiles.length,
|
|
74
|
+
changesApplied: totalChanges,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// CLI interface
|
|
79
|
+
if (require.main === module) {
|
|
80
|
+
const args = process.argv.slice(2);
|
|
81
|
+
const dryRun = !args.includes('--apply');
|
|
82
|
+
|
|
83
|
+
try {
|
|
84
|
+
const result = applyCodemod(dryRun);
|
|
85
|
+
console.log('✅ Codemod execution completed');
|
|
86
|
+
process.exit(0);
|
|
87
|
+
} catch (error) {
|
|
88
|
+
console.error('❌ Codemod execution failed:', error.message);
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
module.exports = { applyCodemod };
|