cto-ai-cli 5.2.0 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +169 -316
- package/dist/cli/index.js +6306 -5691
- package/dist/engine/index.d.ts +690 -730
- package/dist/engine/index.js +2415 -4721
- package/dist/mcp/index.js +3313 -15036
- package/package.json +9 -43
- package/DOCS.md +0 -902
- package/dist/action/index.js +0 -26395
- package/dist/api/dashboard.js +0 -2276
- package/dist/api/dashboard.js.map +0 -1
- package/dist/api/server.js +0 -3663
- package/dist/api/server.js.map +0 -1
- package/dist/cli/gateway.js +0 -3054
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/score.js +0 -6352
- package/dist/cli/v2/index.d.ts +0 -2
- package/dist/cli/v2/index.js +0 -3695
- package/dist/cli/v2/index.js.map +0 -1
- package/dist/engine/index.js.map +0 -1
- package/dist/fsevents-X6WP4TKM.node +0 -0
- package/dist/gateway/index.d.ts +0 -281
- package/dist/gateway/index.js +0 -2932
- package/dist/gateway/index.js.map +0 -1
- package/dist/govern/index.d.ts +0 -325
- package/dist/govern/index.js +0 -1101
- package/dist/govern/index.js.map +0 -1
- package/dist/interact/index.d.ts +0 -234
- package/dist/interact/index.js +0 -1542
- package/dist/interact/index.js.map +0 -1
- package/dist/mcp/index.d.ts +0 -2
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/v2.d.ts +0 -2
- package/dist/mcp/v2.js +0 -18492
- package/dist/mcp/v2.js.map +0 -1
package/dist/govern/index.d.ts
DELETED
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
interface AuditEntry {
|
|
2
|
-
id: string;
|
|
3
|
-
timestamp: Date;
|
|
4
|
-
action: AuditAction;
|
|
5
|
-
user: string;
|
|
6
|
-
projectPath: string;
|
|
7
|
-
contextHash?: string;
|
|
8
|
-
filesIncluded?: number;
|
|
9
|
-
filesExcluded?: number;
|
|
10
|
-
tokensUsed?: number;
|
|
11
|
-
coverageScore?: number;
|
|
12
|
-
riskScore?: number;
|
|
13
|
-
model?: string;
|
|
14
|
-
estimatedCost?: number;
|
|
15
|
-
integrityHash: string;
|
|
16
|
-
details: Record<string, unknown>;
|
|
17
|
-
}
|
|
18
|
-
type AuditAction = 'init' | 'analyze' | 'interact' | 'snapshot-create' | 'snapshot-verify' | 'policy-change' | 'secret-detected' | 'integrity-check';
|
|
19
|
-
interface PolicySet {
|
|
20
|
-
version: string;
|
|
21
|
-
name: string;
|
|
22
|
-
rules: PolicyRule[];
|
|
23
|
-
}
|
|
24
|
-
interface PolicyRule {
|
|
25
|
-
id: string;
|
|
26
|
-
type: PolicyRuleType;
|
|
27
|
-
pattern?: string;
|
|
28
|
-
threshold?: number;
|
|
29
|
-
category?: string;
|
|
30
|
-
reason: string;
|
|
31
|
-
enabled: boolean;
|
|
32
|
-
}
|
|
33
|
-
type PolicyRuleType = 'include-always' | 'exclude-always' | 'budget-limit' | 'coverage-minimum' | 'risk-maximum' | 'secret-block';
|
|
34
|
-
interface PolicyValidation {
|
|
35
|
-
passed: boolean;
|
|
36
|
-
violations: PolicyViolation[];
|
|
37
|
-
warnings: PolicyWarning[];
|
|
38
|
-
}
|
|
39
|
-
interface PolicyViolation {
|
|
40
|
-
rule: PolicyRule;
|
|
41
|
-
message: string;
|
|
42
|
-
severity: 'error' | 'warning';
|
|
43
|
-
}
|
|
44
|
-
interface PolicyWarning {
|
|
45
|
-
rule: PolicyRule;
|
|
46
|
-
message: string;
|
|
47
|
-
currentValue: number;
|
|
48
|
-
threshold: number;
|
|
49
|
-
}
|
|
50
|
-
interface ContextSnapshot {
|
|
51
|
-
id: string;
|
|
52
|
-
name: string;
|
|
53
|
-
createdAt: Date;
|
|
54
|
-
hash: string;
|
|
55
|
-
projectHash: string;
|
|
56
|
-
analysisHash: string;
|
|
57
|
-
selectionHash: string;
|
|
58
|
-
files: SnapshotFile[];
|
|
59
|
-
totalTokens: number;
|
|
60
|
-
coverageScore: number;
|
|
61
|
-
riskScore: number;
|
|
62
|
-
metadata: Record<string, unknown>;
|
|
63
|
-
}
|
|
64
|
-
interface SnapshotFile {
|
|
65
|
-
relativePath: string;
|
|
66
|
-
hash: string;
|
|
67
|
-
tokens: number;
|
|
68
|
-
pruneLevel: string;
|
|
69
|
-
}
|
|
70
|
-
interface SnapshotVerification {
|
|
71
|
-
valid: boolean;
|
|
72
|
-
snapshotId: string;
|
|
73
|
-
filesChecked: number;
|
|
74
|
-
filesMatched: number;
|
|
75
|
-
filesMissing: string[];
|
|
76
|
-
filesChanged: string[];
|
|
77
|
-
integrityOk: boolean;
|
|
78
|
-
}
|
|
79
|
-
interface SecretFinding {
|
|
80
|
-
type: SecretType;
|
|
81
|
-
file: string;
|
|
82
|
-
line: number;
|
|
83
|
-
match: string;
|
|
84
|
-
redacted: string;
|
|
85
|
-
severity: 'critical' | 'high' | 'medium' | 'low';
|
|
86
|
-
}
|
|
87
|
-
type SecretType = 'api-key' | 'aws-key' | 'private-key' | 'password' | 'token' | 'connection-string' | 'env-variable' | 'pii' | 'high-entropy' | 'custom';
|
|
88
|
-
interface IntegrityManifest {
|
|
89
|
-
version: string;
|
|
90
|
-
createdAt: Date;
|
|
91
|
-
entries: IntegrityEntry[];
|
|
92
|
-
}
|
|
93
|
-
interface IntegrityEntry {
|
|
94
|
-
filePath: string;
|
|
95
|
-
hash: string;
|
|
96
|
-
size: number;
|
|
97
|
-
createdAt: Date;
|
|
98
|
-
type: 'snapshot' | 'audit' | 'config' | 'policy';
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
declare function logAudit(action: AuditAction, projectPath: string, details?: Record<string, unknown>): Promise<AuditEntry>;
|
|
102
|
-
declare function getAuditEntries(options?: {
|
|
103
|
-
projectPath?: string;
|
|
104
|
-
action?: AuditAction;
|
|
105
|
-
since?: Date;
|
|
106
|
-
limit?: number;
|
|
107
|
-
}): Promise<AuditEntry[]>;
|
|
108
|
-
declare function verifyAuditEntry(entry: AuditEntry): boolean;
|
|
109
|
-
declare function verifyAuditIntegrity(): Promise<{
|
|
110
|
-
totalEntries: number;
|
|
111
|
-
validEntries: number;
|
|
112
|
-
invalidEntries: AuditEntry[];
|
|
113
|
-
}>;
|
|
114
|
-
declare function purgeOldAuditEntries(retentionDays: number): Promise<number>;
|
|
115
|
-
|
|
116
|
-
declare function scanContentForSecrets(content: string, filePath: string, customPatterns?: string[], extraPiiSafeDomains?: Set<string>): SecretFinding[];
|
|
117
|
-
declare function scanFileForSecrets(filePath: string, projectPath: string, customPatterns?: string[]): Promise<SecretFinding[]>;
|
|
118
|
-
declare function scanProjectForSecrets(projectPath: string, filePaths: string[], customPatterns?: string[]): Promise<SecretFinding[]>;
|
|
119
|
-
declare function sanitizeContent(content: string, customPatterns?: string[]): string;
|
|
120
|
-
interface AllowlistEntry {
|
|
121
|
-
fingerprint: string;
|
|
122
|
-
file: string;
|
|
123
|
-
type: string;
|
|
124
|
-
redacted: string;
|
|
125
|
-
reason: string;
|
|
126
|
-
reviewedBy: string;
|
|
127
|
-
reviewedAt: string;
|
|
128
|
-
}
|
|
129
|
-
declare function loadAllowlist(projectPath: string): AllowlistEntry[];
|
|
130
|
-
declare function saveAllowlist(projectPath: string, entries: AllowlistEntry[]): void;
|
|
131
|
-
declare function addToAllowlist(projectPath: string, finding: SecretFinding, reason: string, reviewedBy?: string): AllowlistEntry;
|
|
132
|
-
declare function filterByAllowlist(findings: SecretFinding[], projectPath: string): {
|
|
133
|
-
filtered: SecretFinding[];
|
|
134
|
-
allowed: SecretFinding[];
|
|
135
|
-
};
|
|
136
|
-
interface FileHashMap {
|
|
137
|
-
[relativePath: string]: string;
|
|
138
|
-
}
|
|
139
|
-
declare function getChangedFiles(projectPath: string, filePaths: string[]): {
|
|
140
|
-
changed: string[];
|
|
141
|
-
unchanged: string[];
|
|
142
|
-
cache: FileHashMap;
|
|
143
|
-
};
|
|
144
|
-
interface AuditConfig {
|
|
145
|
-
severityOverrides: Partial<Record<SecretType, SecretFinding['severity']>>;
|
|
146
|
-
piiSafeDomains: string[];
|
|
147
|
-
customPatterns: string[];
|
|
148
|
-
entropyThreshold: number;
|
|
149
|
-
includePII: boolean;
|
|
150
|
-
incrementalScan: boolean;
|
|
151
|
-
}
|
|
152
|
-
declare const DEFAULT_AUDIT_CONFIG: AuditConfig;
|
|
153
|
-
declare function loadAuditConfig(projectPath: string): AuditConfig;
|
|
154
|
-
declare function saveAuditConfig(projectPath: string, config: AuditConfig): void;
|
|
155
|
-
declare function generatePreCommitHook(projectPath: string, hookType?: 'husky' | 'githooks'): string;
|
|
156
|
-
declare function scanContentForHighEntropy(content: string, filePath: string, threshold?: number): SecretFinding[];
|
|
157
|
-
interface AuditResult {
|
|
158
|
-
findings: SecretFinding[];
|
|
159
|
-
summary: {
|
|
160
|
-
totalFiles: number;
|
|
161
|
-
filesScanned: number;
|
|
162
|
-
filesWithSecrets: number;
|
|
163
|
-
totalFindings: number;
|
|
164
|
-
bySeverity: {
|
|
165
|
-
critical: number;
|
|
166
|
-
high: number;
|
|
167
|
-
medium: number;
|
|
168
|
-
low: number;
|
|
169
|
-
};
|
|
170
|
-
byType: Record<string, number>;
|
|
171
|
-
};
|
|
172
|
-
recommendations: string[];
|
|
173
|
-
}
|
|
174
|
-
interface AuditOptions {
|
|
175
|
-
customPatterns?: string[];
|
|
176
|
-
entropyThreshold?: number;
|
|
177
|
-
includePII?: boolean;
|
|
178
|
-
useAllowlist?: boolean;
|
|
179
|
-
incrementalScan?: boolean;
|
|
180
|
-
severityOverrides?: Partial<Record<SecretType, SecretFinding['severity']>>;
|
|
181
|
-
piiSafeDomains?: string[];
|
|
182
|
-
}
|
|
183
|
-
declare function auditProject(projectPath: string, filePaths: string[], options?: AuditOptions): Promise<AuditResult>;
|
|
184
|
-
|
|
185
|
-
interface AnalyzedFile {
|
|
186
|
-
path: string;
|
|
187
|
-
relativePath: string;
|
|
188
|
-
extension: string;
|
|
189
|
-
size: number;
|
|
190
|
-
tokens: number;
|
|
191
|
-
lines: number;
|
|
192
|
-
lastModified: Date;
|
|
193
|
-
kind: FileKind;
|
|
194
|
-
imports: string[];
|
|
195
|
-
importedBy: string[];
|
|
196
|
-
isHub: boolean;
|
|
197
|
-
complexity: number;
|
|
198
|
-
riskScore: number;
|
|
199
|
-
riskFactors: RiskFactor[];
|
|
200
|
-
exclusionImpact: ExclusionImpact;
|
|
201
|
-
}
|
|
202
|
-
type FileKind = 'source' | 'type' | 'test' | 'config' | 'entry' | 'asset';
|
|
203
|
-
type ExclusionImpact = 'critical' | 'high' | 'medium' | 'low' | 'none';
|
|
204
|
-
interface ProjectAnalysis {
|
|
205
|
-
projectPath: string;
|
|
206
|
-
projectName: string;
|
|
207
|
-
analyzedAt: Date;
|
|
208
|
-
hash: string;
|
|
209
|
-
files: AnalyzedFile[];
|
|
210
|
-
totalFiles: number;
|
|
211
|
-
totalTokens: number;
|
|
212
|
-
graph: ProjectGraph;
|
|
213
|
-
riskProfile: RiskProfile;
|
|
214
|
-
stack: string[];
|
|
215
|
-
tokenMethod: 'chars4' | 'tiktoken';
|
|
216
|
-
}
|
|
217
|
-
interface ProjectGraph {
|
|
218
|
-
nodes: string[];
|
|
219
|
-
edges: GraphEdge[];
|
|
220
|
-
hubs: HubNode[];
|
|
221
|
-
leaves: string[];
|
|
222
|
-
orphans: string[];
|
|
223
|
-
clusters: FileCluster[];
|
|
224
|
-
}
|
|
225
|
-
interface GraphEdge {
|
|
226
|
-
from: string;
|
|
227
|
-
to: string;
|
|
228
|
-
type: 'import' | 'export' | 're-export';
|
|
229
|
-
}
|
|
230
|
-
interface HubNode {
|
|
231
|
-
relativePath: string;
|
|
232
|
-
dependents: number;
|
|
233
|
-
dependencies: number;
|
|
234
|
-
score: number;
|
|
235
|
-
}
|
|
236
|
-
interface FileCluster {
|
|
237
|
-
id: string;
|
|
238
|
-
name: string;
|
|
239
|
-
files: string[];
|
|
240
|
-
totalTokens: number;
|
|
241
|
-
internalEdges: number;
|
|
242
|
-
externalEdges: number;
|
|
243
|
-
cohesion: number;
|
|
244
|
-
}
|
|
245
|
-
interface RiskProfile {
|
|
246
|
-
distribution: {
|
|
247
|
-
critical: number;
|
|
248
|
-
high: number;
|
|
249
|
-
medium: number;
|
|
250
|
-
low: number;
|
|
251
|
-
};
|
|
252
|
-
topRiskFiles: AnalyzedFile[];
|
|
253
|
-
overallComplexity: number;
|
|
254
|
-
}
|
|
255
|
-
interface RiskFactor {
|
|
256
|
-
type: RiskFactorType;
|
|
257
|
-
score: number;
|
|
258
|
-
weight: number;
|
|
259
|
-
detail: string;
|
|
260
|
-
}
|
|
261
|
-
type RiskFactorType = 'hub' | 'type-provider' | 'complexity' | 'recency' | 'config' | 'churn';
|
|
262
|
-
interface CoverageResult {
|
|
263
|
-
score: number;
|
|
264
|
-
relevantFiles: string[];
|
|
265
|
-
includedRelevant: string[];
|
|
266
|
-
missingRelevant: string[];
|
|
267
|
-
missingCritical: string[];
|
|
268
|
-
explanation: string;
|
|
269
|
-
}
|
|
270
|
-
interface ContextSelection {
|
|
271
|
-
files: SelectedFile[];
|
|
272
|
-
totalTokens: number;
|
|
273
|
-
budget: number;
|
|
274
|
-
usedPercent: number;
|
|
275
|
-
coverage: CoverageResult;
|
|
276
|
-
riskScore: number;
|
|
277
|
-
deterministic: boolean;
|
|
278
|
-
hash: string;
|
|
279
|
-
decisions: SelectionDecision[];
|
|
280
|
-
}
|
|
281
|
-
interface SelectedFile {
|
|
282
|
-
relativePath: string;
|
|
283
|
-
tokens: number;
|
|
284
|
-
originalTokens: number;
|
|
285
|
-
pruneLevel: PruneLevel;
|
|
286
|
-
riskScore: number;
|
|
287
|
-
reason: string;
|
|
288
|
-
}
|
|
289
|
-
type PruneLevel = 'full' | 'signatures' | 'skeleton' | 'excluded';
|
|
290
|
-
interface SelectionDecision {
|
|
291
|
-
file: string;
|
|
292
|
-
action: 'include-full' | 'include-signatures' | 'include-skeleton' | 'exclude';
|
|
293
|
-
reason: string;
|
|
294
|
-
alternatives?: string;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
declare const DEFAULT_POLICY: PolicySet;
|
|
298
|
-
declare function validateSelection(selection: ContextSelection, policies: PolicySet, allFiles?: AnalyzedFile[]): PolicyValidation;
|
|
299
|
-
declare function addRule(policies: PolicySet, rule: PolicyRule): PolicySet;
|
|
300
|
-
declare function removeRule(policies: PolicySet, ruleId: string): PolicySet;
|
|
301
|
-
declare function toggleRule(policies: PolicySet, ruleId: string, enabled: boolean): PolicySet;
|
|
302
|
-
|
|
303
|
-
declare function createSnapshot(name: string, analysis: ProjectAnalysis, selection: ContextSelection, metadata?: Record<string, unknown>): ContextSnapshot;
|
|
304
|
-
declare function verifySnapshot(snapshot: ContextSnapshot, currentAnalysis: ProjectAnalysis, currentSelection: ContextSelection): Promise<SnapshotVerification>;
|
|
305
|
-
declare function compareSnapshots(older: ContextSnapshot, newer: ContextSnapshot): {
|
|
306
|
-
added: string[];
|
|
307
|
-
removed: string[];
|
|
308
|
-
changed: string[];
|
|
309
|
-
tokenDelta: number;
|
|
310
|
-
coverageDelta: number;
|
|
311
|
-
riskDelta: number;
|
|
312
|
-
};
|
|
313
|
-
|
|
314
|
-
declare function hashContent(content: Buffer | string): string;
|
|
315
|
-
declare function hashFile(filePath: string): Promise<string | null>;
|
|
316
|
-
declare function buildManifest(projectDir: string): Promise<IntegrityManifest>;
|
|
317
|
-
declare function verifyManifest(manifest: IntegrityManifest): Promise<{
|
|
318
|
-
totalFiles: number;
|
|
319
|
-
validFiles: number;
|
|
320
|
-
invalidFiles: string[];
|
|
321
|
-
missingFiles: string[];
|
|
322
|
-
}>;
|
|
323
|
-
declare function securePermissions(dirPath: string): Promise<number>;
|
|
324
|
-
|
|
325
|
-
export { type AllowlistEntry, type AuditConfig, type AuditOptions, type AuditResult, DEFAULT_AUDIT_CONFIG, DEFAULT_POLICY, addRule, addToAllowlist, auditProject, buildManifest, compareSnapshots, createSnapshot, filterByAllowlist, generatePreCommitHook, getAuditEntries, getChangedFiles, hashContent, hashFile, loadAllowlist, loadAuditConfig, logAudit, purgeOldAuditEntries, removeRule, sanitizeContent, saveAllowlist, saveAuditConfig, scanContentForHighEntropy, scanContentForSecrets, scanFileForSecrets, scanProjectForSecrets, securePermissions, toggleRule, validateSelection, verifyAuditEntry, verifyAuditIntegrity, verifyManifest, verifySnapshot };
|