@paths.design/caws-cli 6.0.0 ā 7.0.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/dist/budget-derivation.d.ts +74 -0
- package/dist/budget-derivation.d.ts.map +1 -0
- package/dist/cicd-optimizer.d.ts +142 -0
- package/dist/cicd-optimizer.d.ts.map +1 -0
- package/dist/commands/archive.d.ts +50 -0
- package/dist/commands/archive.d.ts.map +1 -0
- package/dist/commands/burnup.d.ts +6 -0
- package/dist/commands/burnup.d.ts.map +1 -0
- package/dist/commands/diagnose.d.ts +52 -0
- package/dist/commands/diagnose.d.ts.map +1 -0
- package/dist/commands/evaluate.d.ts +8 -0
- package/dist/commands/evaluate.d.ts.map +1 -0
- package/dist/commands/init.d.ts +5 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/iterate.d.ts +8 -0
- package/dist/commands/iterate.d.ts.map +1 -0
- package/dist/commands/mode.d.ts +24 -0
- package/dist/commands/mode.d.ts.map +1 -0
- package/dist/commands/plan.d.ts +49 -0
- package/dist/commands/plan.d.ts.map +1 -0
- package/dist/commands/provenance.d.ts +32 -0
- package/dist/commands/provenance.d.ts.map +1 -0
- package/dist/commands/quality-gates.d.ts +52 -0
- package/dist/commands/quality-gates.d.ts.map +1 -0
- package/dist/commands/quality-gates.js +4 -2
- package/dist/commands/quality-monitor.d.ts +17 -0
- package/dist/commands/quality-monitor.d.ts.map +1 -0
- package/dist/commands/specs.d.ts +71 -0
- package/dist/commands/specs.d.ts.map +1 -0
- package/dist/commands/status.d.ts +44 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/templates.d.ts +74 -0
- package/dist/commands/templates.d.ts.map +1 -0
- package/dist/commands/tool.d.ts +13 -0
- package/dist/commands/tool.d.ts.map +1 -0
- package/dist/commands/troubleshoot.d.ts +8 -0
- package/dist/commands/troubleshoot.d.ts.map +1 -0
- package/dist/commands/tutorial.d.ts +55 -0
- package/dist/commands/tutorial.d.ts.map +1 -0
- package/dist/commands/validate.d.ts +15 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/waivers.d.ts +8 -0
- package/dist/commands/waivers.d.ts.map +1 -0
- package/dist/commands/workflow.d.ts +85 -0
- package/dist/commands/workflow.d.ts.map +1 -0
- package/dist/config/index.d.ts +29 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/modes.d.ts +225 -0
- package/dist/config/modes.d.ts.map +1 -0
- package/dist/constants/spec-types.d.ts +41 -0
- package/dist/constants/spec-types.d.ts.map +1 -0
- package/dist/error-handler.d.ts +164 -0
- package/dist/error-handler.d.ts.map +1 -0
- package/dist/generators/jest-config.d.ts +32 -0
- package/dist/generators/jest-config.d.ts.map +1 -0
- package/dist/generators/working-spec.d.ts +13 -0
- package/dist/generators/working-spec.d.ts.map +1 -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 +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js.backup +4711 -0
- package/dist/minimal-cli.d.ts +3 -0
- package/dist/minimal-cli.d.ts.map +1 -0
- package/dist/policy/PolicyManager.d.ts +104 -0
- package/dist/policy/PolicyManager.d.ts.map +1 -0
- package/dist/scaffold/cursor-hooks.d.ts +7 -0
- package/dist/scaffold/cursor-hooks.d.ts.map +1 -0
- package/dist/scaffold/git-hooks.d.ts +20 -0
- package/dist/scaffold/git-hooks.d.ts.map +1 -0
- package/dist/scaffold/git-hooks.js +65 -7
- package/dist/scaffold/index.d.ts +20 -0
- package/dist/scaffold/index.d.ts.map +1 -0
- package/dist/scaffold/index.js +179 -41
- package/dist/spec/SpecFileManager.d.ts +146 -0
- package/dist/spec/SpecFileManager.d.ts.map +1 -0
- package/dist/test-analysis.d.ts +182 -0
- package/dist/test-analysis.d.ts.map +1 -0
- package/dist/tool-interface.d.ts +236 -0
- package/dist/tool-interface.d.ts.map +1 -0
- package/dist/tool-loader.d.ts +77 -0
- package/dist/tool-loader.d.ts.map +1 -0
- package/dist/tool-validator.d.ts +72 -0
- package/dist/tool-validator.d.ts.map +1 -0
- package/dist/utils/detection.d.ts +7 -0
- package/dist/utils/detection.d.ts.map +1 -0
- package/dist/utils/finalization.d.ts +17 -0
- package/dist/utils/finalization.d.ts.map +1 -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 +103 -0
- package/dist/utils/quality-gates.d.ts +49 -0
- package/dist/utils/quality-gates.d.ts.map +1 -0
- package/dist/utils/spec-resolver.d.ts +88 -0
- package/dist/utils/spec-resolver.d.ts.map +1 -0
- package/dist/utils/typescript-detector.d.ts +63 -0
- package/dist/utils/typescript-detector.d.ts.map +1 -0
- package/dist/validation/spec-validation.d.ts +43 -0
- package/dist/validation/spec-validation.d.ts.map +1 -0
- package/dist/waivers-manager.d.ts +167 -0
- package/dist/waivers-manager.d.ts.map +1 -0
- package/package.json +1 -1
- package/templates/COMMIT_CONVENTIONS.md +86 -0
- package/templates/apps/tools/caws/prompt-lint.js.backup +274 -0
- package/templates/apps/tools/caws/provenance.js.backup +73 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Commit Message Conventions
|
|
2
|
+
|
|
3
|
+
This repository uses [Conventional Commits](https://conventionalcommits.org/) for automated versioning and changelog generation.
|
|
4
|
+
|
|
5
|
+
## Format
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
<type>[optional scope]: <description>
|
|
9
|
+
|
|
10
|
+
[optional body]
|
|
11
|
+
|
|
12
|
+
[optional footer(s)]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Types
|
|
16
|
+
|
|
17
|
+
- **feat**: A new feature
|
|
18
|
+
- **fix**: A bug fix
|
|
19
|
+
- **docs**: Documentation only changes
|
|
20
|
+
- **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
|
|
21
|
+
- **refactor**: A code change that neither fixes a bug nor adds a feature
|
|
22
|
+
- **perf**: A code change that improves performance
|
|
23
|
+
- **test**: Adding missing tests or correcting existing tests
|
|
24
|
+
- **build**: Changes that affect the build system or external dependencies
|
|
25
|
+
- **ci**: Changes to our CI configuration files and scripts
|
|
26
|
+
- **chore**: Other changes that don't modify src or test files
|
|
27
|
+
|
|
28
|
+
## Examples
|
|
29
|
+
|
|
30
|
+
### Feature
|
|
31
|
+
```
|
|
32
|
+
feat: add user authentication system
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Bug Fix
|
|
36
|
+
```
|
|
37
|
+
fix: resolve memory leak in data processing
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Documentation
|
|
41
|
+
```
|
|
42
|
+
docs: update API documentation for new endpoints
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Refactoring
|
|
46
|
+
```
|
|
47
|
+
refactor: extract user validation logic into separate module
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Breaking Change
|
|
51
|
+
```
|
|
52
|
+
feat!: change API response format for user data
|
|
53
|
+
|
|
54
|
+
BREAKING CHANGE: The user object now returns additional fields and the format has changed
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Scope
|
|
58
|
+
|
|
59
|
+
The scope should be the name of the package or module affected by the change:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
feat(auth): add OAuth2 authentication
|
|
63
|
+
fix(api): resolve endpoint timeout issue
|
|
64
|
+
docs(cli): update installation instructions
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Automated Publishing
|
|
68
|
+
|
|
69
|
+
Commits following these conventions will automatically:
|
|
70
|
+
|
|
71
|
+
1. **Trigger releases** when pushed to `main`
|
|
72
|
+
2. **Generate changelogs** based on commit messages
|
|
73
|
+
3. **Bump versions** according to semantic versioning:
|
|
74
|
+
- `fix:` ā patch release (1.0.0 ā 1.0.1)
|
|
75
|
+
- `feat:` ā minor release (1.0.0 ā 1.1.0)
|
|
76
|
+
- `feat!:` ā major release (1.0.0 ā 2.0.0)
|
|
77
|
+
|
|
78
|
+
## CI/CD Integration
|
|
79
|
+
|
|
80
|
+
The automated release process includes:
|
|
81
|
+
- ā
Linting and testing
|
|
82
|
+
- ā
Package building
|
|
83
|
+
- ā
NPM publishing with OIDC authentication
|
|
84
|
+
- ā
Changelog generation
|
|
85
|
+
- ā
Git tag creation
|
|
86
|
+
- ā
Release notes generation
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview CAWS Prompt Linter
|
|
5
|
+
* Validates prompts for secrets and ensures tool allowlist compliance
|
|
6
|
+
* @author @darianrosebrook
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const fs = require("fs");
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Common secret patterns to detect
|
|
13
|
+
*/
|
|
14
|
+
const SECRET_PATTERNS = [
|
|
15
|
+
// API Keys
|
|
16
|
+
/api[_-]?key[_-]?token\s*[=:]\s*['"]?([a-zA-Z0-9_-]{20,})['"]?/gi,
|
|
17
|
+
/x-api-key\s*[=:]\s*['"]?([a-zA-Z0-9_-]{20,})['"]?/gi,
|
|
18
|
+
/authorization\s*[=:]\s*['"]?(Bearer\s+)?([a-zA-Z0-9_-]{20,})['"]?/gi,
|
|
19
|
+
|
|
20
|
+
// Tokens
|
|
21
|
+
/token\s*[=:]\s*['"]?([a-zA-Z0-9_-]{20,})['"]?/gi,
|
|
22
|
+
/access[_-]?token\s*[=:]\s*['"]?([a-zA-Z0-9_-]{20,})['"]?/gi,
|
|
23
|
+
/refresh[_-]?token\s*[=:]\s*['"]?([a-zA-Z0-9_-]{20,})['"]?/gi,
|
|
24
|
+
/auth[_-]?token\s*[=:]\s*['"]?([a-zA-Z0-9_-]{20,})['"]?/gi,
|
|
25
|
+
|
|
26
|
+
// Passwords
|
|
27
|
+
/password\s*[=:]\s*['"]?([a-zA-Z0-9_-]{8,})['"]?/gi,
|
|
28
|
+
/passwd\s*[=:]\s*['"]?([a-zA-Z0-9_-]{8,})['"]?/gi,
|
|
29
|
+
/pwd\s*[=:]\s*['"]?([a-zA-Z0-9_-]{8,})['"]?/gi,
|
|
30
|
+
|
|
31
|
+
// Secrets
|
|
32
|
+
/secret\s*[=:]\s*['"]?([a-zA-Z0-9_-]{16,})['"]?/gi,
|
|
33
|
+
/private[_-]?key\s*[=:]\s*['"]?([a-zA-Z0-9_-]{20,})['"]?/gi,
|
|
34
|
+
|
|
35
|
+
// Environment variables that might contain secrets
|
|
36
|
+
/process\.env\.[A-Z_]+_KEY/gi,
|
|
37
|
+
/process\.env\.[A-Z_]+_TOKEN/gi,
|
|
38
|
+
/process\.env\.[A-Z_]+_SECRET/gi,
|
|
39
|
+
/process\.env\.[A-Z_]+_PASSWORD/gi,
|
|
40
|
+
|
|
41
|
+
// URLs with potential secrets
|
|
42
|
+
/https?:\/\/[^/]*@[^/]+/gi,
|
|
43
|
+
|
|
44
|
+
// Base64 encoded strings that might be secrets
|
|
45
|
+
/[A-Za-z0-9+/=]{40,}/g,
|
|
46
|
+
|
|
47
|
+
// AWS keys
|
|
48
|
+
/AKIA[A-Z0-9]{16}/gi,
|
|
49
|
+
|
|
50
|
+
// GitHub tokens
|
|
51
|
+
/ghp_[A-Za-z0-9]{36}/gi,
|
|
52
|
+
/github_pat_[A-Za-z0-9]{22}/gi,
|
|
53
|
+
|
|
54
|
+
// Slack tokens
|
|
55
|
+
/xoxb-[0-9]+-[0-9]+-[0-9]+-[a-zA-Z0-9]+/gi,
|
|
56
|
+
|
|
57
|
+
// Database connection strings
|
|
58
|
+
/mongodb(\+srv)?:\/\/[^:]+:[^@]+@[^/]+/gi,
|
|
59
|
+
/postgres:\/\/[^:]+:[^@]+@[^/]+/gi,
|
|
60
|
+
/mysql:\/\/[^:]+:[^@]+@[^/]+/gi,
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Scan file for potential secrets
|
|
65
|
+
* @param {string} filePath - Path to file to scan
|
|
66
|
+
* @returns {Array} Array of potential secret matches
|
|
67
|
+
*/
|
|
68
|
+
function scanForSecrets(filePath) {
|
|
69
|
+
try {
|
|
70
|
+
const content = fs.readFileSync(filePath, "utf8");
|
|
71
|
+
const matches = [];
|
|
72
|
+
|
|
73
|
+
for (const pattern of SECRET_PATTERNS) {
|
|
74
|
+
const patternMatches = [...content.matchAll(pattern)];
|
|
75
|
+
for (const match of patternMatches) {
|
|
76
|
+
matches.push({
|
|
77
|
+
file: filePath,
|
|
78
|
+
line: content.substring(0, match.index).split("\n").length,
|
|
79
|
+
pattern: pattern.toString(),
|
|
80
|
+
match: match[0],
|
|
81
|
+
severity: "high",
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return matches;
|
|
87
|
+
} catch (error) {
|
|
88
|
+
console.error(`ā Error scanning ${filePath}:`, error.message);
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Validate tools against allowlist
|
|
95
|
+
* @param {Array} tools - Tools used in prompts
|
|
96
|
+
* @param {Array} allowlist - Allowed tools
|
|
97
|
+
* @returns {Array} Array of violations
|
|
98
|
+
*/
|
|
99
|
+
function validateToolAllowlist(tools, allowlist) {
|
|
100
|
+
const violations = [];
|
|
101
|
+
|
|
102
|
+
for (const tool of tools) {
|
|
103
|
+
if (!allowlist.includes(tool)) {
|
|
104
|
+
violations.push({
|
|
105
|
+
tool,
|
|
106
|
+
severity: "high",
|
|
107
|
+
message: `Tool "${tool}" not in allowlist`,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return violations;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Extract tools from prompt content
|
|
117
|
+
* @param {string} content - Prompt content
|
|
118
|
+
* @returns {Array} Array of tools mentioned
|
|
119
|
+
*/
|
|
120
|
+
function extractTools(content) {
|
|
121
|
+
const tools = [];
|
|
122
|
+
|
|
123
|
+
// Common tool patterns
|
|
124
|
+
const toolPatterns = [
|
|
125
|
+
/using\s+(node|npm|yarn|pnpm|git|docker|kubectl|aws|azure|gcloud)/gi,
|
|
126
|
+
/(node|npm|yarn|pnpm|git|docker|kubectl|aws|azure|gcloud)\s+command/gi,
|
|
127
|
+
/execute\s+(node|npm|yarn|pnpm|git|docker|kubectl|aws|azure|gcloud)/gi,
|
|
128
|
+
/run\s+(node|npm|yarn|pnpm|git|docker|kubectl|aws|azure|gcloud)/gi,
|
|
129
|
+
];
|
|
130
|
+
|
|
131
|
+
for (const pattern of toolPatterns) {
|
|
132
|
+
const matches = [...content.matchAll(pattern)];
|
|
133
|
+
for (const match of matches) {
|
|
134
|
+
const tool = match[1] || match[0];
|
|
135
|
+
if (!tools.includes(tool)) {
|
|
136
|
+
tools.push(tool);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return tools;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Lint prompts for security and compliance
|
|
146
|
+
* @param {Array} promptFiles - Array of prompt file paths
|
|
147
|
+
* @param {Array} allowlist - Allowed tools
|
|
148
|
+
* @returns {Object} Lint results
|
|
149
|
+
*/
|
|
150
|
+
function lintPrompts(promptFiles, allowlist) {
|
|
151
|
+
const results = {
|
|
152
|
+
secrets: [],
|
|
153
|
+
violations: [],
|
|
154
|
+
cleanFiles: 0,
|
|
155
|
+
totalFiles: promptFiles.length,
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
for (const file of promptFiles) {
|
|
159
|
+
if (!fs.existsSync(file)) {
|
|
160
|
+
console.warn(`ā ļø Prompt file not found: ${file}`);
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Scan for secrets
|
|
165
|
+
const secretMatches = scanForSecrets(file);
|
|
166
|
+
results.secrets.push(...secretMatches);
|
|
167
|
+
|
|
168
|
+
// Extract and validate tools
|
|
169
|
+
const content = fs.readFileSync(file, "utf8");
|
|
170
|
+
const tools = extractTools(content);
|
|
171
|
+
const toolViolations = validateToolAllowlist(tools, allowlist);
|
|
172
|
+
results.violations.push(...toolViolations.map((v) => ({ ...v, file })));
|
|
173
|
+
|
|
174
|
+
// Check if file is clean
|
|
175
|
+
if (secretMatches.length === 0 && toolViolations.length === 0) {
|
|
176
|
+
results.cleanFiles++;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return results;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Load tool allowlist from file
|
|
185
|
+
* @param {string} allowlistPath - Path to allowlist file
|
|
186
|
+
* @returns {Array} Array of allowed tools
|
|
187
|
+
*/
|
|
188
|
+
function loadAllowlist(allowlistPath) {
|
|
189
|
+
try {
|
|
190
|
+
if (!fs.existsSync(allowlistPath)) {
|
|
191
|
+
console.warn(`ā ļø Allowlist file not found: ${allowlistPath}`);
|
|
192
|
+
return [];
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const content = fs.readFileSync(allowlistPath, "utf8");
|
|
196
|
+
return JSON.parse(content);
|
|
197
|
+
} catch (error) {
|
|
198
|
+
console.error(`ā Error loading allowlist:`, error.message);
|
|
199
|
+
return [];
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// CLI interface
|
|
204
|
+
if (require.main === module) {
|
|
205
|
+
const promptFiles = process.argv.slice(2);
|
|
206
|
+
const allowlistArg = process.argv
|
|
207
|
+
.find((arg) => arg.startsWith("--allowlist="))
|
|
208
|
+
?.split("=")[1];
|
|
209
|
+
const allowlistPath = allowlistArg || ".agent/tools-allow.json";
|
|
210
|
+
|
|
211
|
+
if (promptFiles.length === 0) {
|
|
212
|
+
console.log("CAWS Prompt Linter");
|
|
213
|
+
console.log(
|
|
214
|
+
"Usage: node prompt-lint.js <prompt-file1> [prompt-file2] ... [options]"
|
|
215
|
+
);
|
|
216
|
+
console.log("Options:");
|
|
217
|
+
console.log(
|
|
218
|
+
" --allowlist=<path> Path to tools allowlist file (default: .agent/tools-allow.json)"
|
|
219
|
+
);
|
|
220
|
+
process.exit(1);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// Load allowlist
|
|
224
|
+
const allowlist = loadAllowlist(allowlistPath);
|
|
225
|
+
|
|
226
|
+
console.log("š Linting prompts for security and compliance...");
|
|
227
|
+
console.log(`š Allowlist loaded: ${allowlist.length} tools`);
|
|
228
|
+
console.log(`š Scanning ${promptFiles.length} files...`);
|
|
229
|
+
|
|
230
|
+
// Lint prompts
|
|
231
|
+
const results = lintPrompts(promptFiles, allowlist);
|
|
232
|
+
|
|
233
|
+
// Report results
|
|
234
|
+
if (results.secrets.length > 0) {
|
|
235
|
+
console.log("\nšØ POTENTIAL SECRETS DETECTED:");
|
|
236
|
+
results.secrets.forEach((secret, index) => {
|
|
237
|
+
console.log(
|
|
238
|
+
` ${index + 1}. ${secret.file}:${
|
|
239
|
+
secret.line
|
|
240
|
+
} - ${secret.match.substring(0, 50)}...`
|
|
241
|
+
);
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (results.violations.length > 0) {
|
|
246
|
+
console.log("\nā ļø TOOL VIOLATIONS:");
|
|
247
|
+
results.violations.forEach((violation, index) => {
|
|
248
|
+
console.log(` ${index + 1}. ${violation.file} - ${violation.message}`);
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
console.log("\nš SUMMARY:");
|
|
253
|
+
console.log(` - Files scanned: ${results.totalFiles}`);
|
|
254
|
+
console.log(` - Clean files: ${results.cleanFiles}`);
|
|
255
|
+
console.log(` - Secrets found: ${results.secrets.length}`);
|
|
256
|
+
console.log(` - Violations: ${results.violations.length}`);
|
|
257
|
+
|
|
258
|
+
// Exit with error if issues found
|
|
259
|
+
if (results.secrets.length > 0 || results.violations.length > 0) {
|
|
260
|
+
console.log("\nā Linting failed - security issues detected");
|
|
261
|
+
process.exit(1);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
console.log("ā
All prompts passed security checks");
|
|
265
|
+
process.exit(0);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
module.exports = {
|
|
269
|
+
scanForSecrets,
|
|
270
|
+
validateToolAllowlist,
|
|
271
|
+
extractTools,
|
|
272
|
+
lintPrompts,
|
|
273
|
+
loadAllowlist,
|
|
274
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview CAWS Provenance Tracker - Real Implementation
|
|
5
|
+
* @author @darianrosebrook
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const crypto = require('crypto');
|
|
11
|
+
const { execSync } = require('child_process');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Generate comprehensive provenance data for CAWS operations
|
|
15
|
+
* @param {Object} options - Configuration options
|
|
16
|
+
* @returns {Object} Complete provenance record
|
|
17
|
+
*/
|
|
18
|
+
function generateProvenance(options = {}) {
|
|
19
|
+
const projectRoot = options.projectRoot || process.cwd();
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
// Agent and model information
|
|
23
|
+
agent: options.agent || 'caws-cli',
|
|
24
|
+
model: options.model || 'cli-interactive',
|
|
25
|
+
model_hash: options.modelHash || generateModelHash(),
|
|
26
|
+
|
|
27
|
+
// Tool and security information
|
|
28
|
+
tool_allowlist: options.toolAllowlist || generateToolAllowlist(projectRoot),
|
|
29
|
+
prompts: options.prompts || [],
|
|
30
|
+
|
|
31
|
+
// Git and version control information
|
|
32
|
+
commit: getCurrentCommit(projectRoot),
|
|
33
|
+
branch: getCurrentBranch(projectRoot),
|
|
34
|
+
repository: getRepositoryInfo(projectRoot),
|
|
35
|
+
|
|
36
|
+
// File and artifact information
|
|
37
|
+
artifacts: generateArtifactList(projectRoot),
|
|
38
|
+
dependencies: generateDependencyInfo(projectRoot),
|
|
39
|
+
|
|
40
|
+
// Execution results and metadata
|
|
41
|
+
results: options.results || {},
|
|
42
|
+
approvals: options.approvals || [],
|
|
43
|
+
execution_context: generateExecutionContext(),
|
|
44
|
+
|
|
45
|
+
// Security and integrity
|
|
46
|
+
integrity: generateIntegrityInfo(),
|
|
47
|
+
|
|
48
|
+
// Timestamps and versioning
|
|
49
|
+
timestamp: new Date().toISOString(),
|
|
50
|
+
version: require(path.join(projectRoot, 'package.json')).version || '1.0.0',
|
|
51
|
+
provenance_hash: generateProvenanceHash(),
|
|
52
|
+
|
|
53
|
+
// Build and deployment information
|
|
54
|
+
build_info: generateBuildInfo(projectRoot),
|
|
55
|
+
|
|
56
|
+
// Change tracking
|
|
57
|
+
change_summary: generateChangeSummary(projectRoot),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Mock provenance saving
|
|
62
|
+
function saveProvenance(provenance, filepath) {
|
|
63
|
+
const dir = path.dirname(filepath);
|
|
64
|
+
if (!fs.existsSync(dir)) {
|
|
65
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
66
|
+
}
|
|
67
|
+
fs.writeFileSync(filepath, JSON.stringify(provenance, null, 2));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
module.exports = {
|
|
71
|
+
generateProvenance,
|
|
72
|
+
saveProvenance,
|
|
73
|
+
};
|