clavix 4.11.2 → 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/README.md +72 -60
- package/dist/cli/commands/update.js +9 -10
- package/dist/templates/agents/agents.md +14 -8
- package/dist/templates/agents/copilot-instructions.md +1 -1
- package/dist/templates/instructions/core/verification.md +2 -2
- package/dist/templates/slash-commands/_canonical/archive.md +83 -121
- package/dist/templates/slash-commands/_canonical/execute.md +32 -42
- package/dist/templates/slash-commands/_canonical/implement.md +32 -44
- package/dist/templates/slash-commands/_canonical/improve.md +14 -53
- package/dist/templates/slash-commands/_canonical/start.md +1 -1
- package/dist/templates/slash-commands/_canonical/summarize.md +8 -8
- package/dist/templates/slash-commands/_components/agent-protocols/cli-reference.md +84 -180
- package/dist/templates/slash-commands/_components/agent-protocols/error-handling.md +2 -2
- package/dist/templates/slash-commands/_components/agent-protocols/file-formats.md +41 -59
- package/dist/templates/slash-commands/_components/agent-protocols/state-assertion.md +1 -1
- package/dist/templates/slash-commands/_components/references/intent-types.md +1 -1
- package/dist/templates/slash-commands/_components/sections/file-saving-protocol.md +20 -27
- package/dist/templates/slash-commands/_components/sections/pattern-visibility.md +29 -46
- package/dist/templates/slash-commands/_components/troubleshooting/file-not-saved.md +4 -5
- package/dist/types/config.d.ts +57 -0
- package/dist/utils/legacy-command-cleanup.js +31 -4
- package/package.json +5 -4
- package/dist/cli/commands/analyze.d.ts +0 -17
- package/dist/cli/commands/analyze.js +0 -133
- package/dist/cli/commands/archive.d.ts +0 -36
- package/dist/cli/commands/archive.js +0 -266
- package/dist/cli/commands/deep.d.ts +0 -17
- package/dist/cli/commands/deep.js +0 -170
- package/dist/cli/commands/execute.d.ts +0 -15
- package/dist/cli/commands/execute.js +0 -168
- package/dist/cli/commands/fast.d.ts +0 -18
- package/dist/cli/commands/fast.js +0 -219
- package/dist/cli/commands/implement.d.ts +0 -24
- package/dist/cli/commands/implement.js +0 -289
- package/dist/cli/commands/improve.d.ts +0 -32
- package/dist/cli/commands/improve.js +0 -250
- package/dist/cli/commands/list.d.ts +0 -17
- package/dist/cli/commands/list.js +0 -217
- package/dist/cli/commands/plan.d.ts +0 -21
- package/dist/cli/commands/plan.js +0 -297
- package/dist/cli/commands/prd.d.ts +0 -24
- package/dist/cli/commands/prd.js +0 -321
- package/dist/cli/commands/prompts/clear.d.ts +0 -16
- package/dist/cli/commands/prompts/clear.js +0 -222
- package/dist/cli/commands/prompts/list.d.ts +0 -8
- package/dist/cli/commands/prompts/list.js +0 -88
- package/dist/cli/commands/show.d.ts +0 -21
- package/dist/cli/commands/show.js +0 -191
- package/dist/cli/commands/start.d.ts +0 -40
- package/dist/cli/commands/start.js +0 -210
- package/dist/cli/commands/summarize.d.ts +0 -17
- package/dist/cli/commands/summarize.js +0 -196
- package/dist/cli/commands/task-complete.d.ts +0 -27
- package/dist/cli/commands/task-complete.js +0 -269
- package/dist/cli/commands/verify.d.ts +0 -28
- package/dist/cli/commands/verify.js +0 -349
- package/dist/core/archive-manager.d.ts +0 -100
- package/dist/core/archive-manager.js +0 -302
- package/dist/core/basic-checklist-generator.d.ts +0 -35
- package/dist/core/basic-checklist-generator.js +0 -344
- package/dist/core/checklist-parser.d.ts +0 -48
- package/dist/core/checklist-parser.js +0 -238
- package/dist/core/config-manager.d.ts +0 -149
- package/dist/core/config-manager.js +0 -230
- package/dist/core/conversation-analyzer.d.ts +0 -86
- package/dist/core/conversation-analyzer.js +0 -387
- package/dist/core/conversation-quality-tracker.d.ts +0 -81
- package/dist/core/conversation-quality-tracker.js +0 -195
- package/dist/core/git-manager.d.ts +0 -126
- package/dist/core/git-manager.js +0 -282
- package/dist/core/intelligence/confidence-calculator.d.ts +0 -93
- package/dist/core/intelligence/confidence-calculator.js +0 -124
- package/dist/core/intelligence/index.d.ts +0 -11
- package/dist/core/intelligence/index.js +0 -15
- package/dist/core/intelligence/intent-detector.d.ts +0 -54
- package/dist/core/intelligence/intent-detector.js +0 -723
- package/dist/core/intelligence/pattern-library.d.ts +0 -104
- package/dist/core/intelligence/pattern-library.js +0 -339
- package/dist/core/intelligence/patterns/actionability-enhancer.d.ts +0 -27
- package/dist/core/intelligence/patterns/actionability-enhancer.js +0 -192
- package/dist/core/intelligence/patterns/alternative-phrasing-generator.d.ts +0 -29
- package/dist/core/intelligence/patterns/alternative-phrasing-generator.js +0 -239
- package/dist/core/intelligence/patterns/ambiguity-detector.d.ts +0 -22
- package/dist/core/intelligence/patterns/ambiguity-detector.js +0 -196
- package/dist/core/intelligence/patterns/assumption-explicitizer.d.ts +0 -30
- package/dist/core/intelligence/patterns/assumption-explicitizer.js +0 -296
- package/dist/core/intelligence/patterns/base-pattern.d.ts +0 -192
- package/dist/core/intelligence/patterns/base-pattern.js +0 -103
- package/dist/core/intelligence/patterns/completeness-validator.d.ts +0 -27
- package/dist/core/intelligence/patterns/completeness-validator.js +0 -221
- package/dist/core/intelligence/patterns/conciseness-filter.d.ts +0 -20
- package/dist/core/intelligence/patterns/conciseness-filter.js +0 -92
- package/dist/core/intelligence/patterns/context-precision.d.ts +0 -32
- package/dist/core/intelligence/patterns/context-precision.js +0 -389
- package/dist/core/intelligence/patterns/conversation-summarizer.d.ts +0 -30
- package/dist/core/intelligence/patterns/conversation-summarizer.js +0 -277
- package/dist/core/intelligence/patterns/dependency-identifier.d.ts +0 -23
- package/dist/core/intelligence/patterns/dependency-identifier.js +0 -166
- package/dist/core/intelligence/patterns/domain-context-enricher.d.ts +0 -21
- package/dist/core/intelligence/patterns/domain-context-enricher.js +0 -198
- package/dist/core/intelligence/patterns/edge-case-identifier.d.ts +0 -30
- package/dist/core/intelligence/patterns/edge-case-identifier.js +0 -269
- package/dist/core/intelligence/patterns/error-tolerance-enhancer.d.ts +0 -22
- package/dist/core/intelligence/patterns/error-tolerance-enhancer.js +0 -179
- package/dist/core/intelligence/patterns/implicit-requirement-extractor.d.ts +0 -24
- package/dist/core/intelligence/patterns/implicit-requirement-extractor.js +0 -259
- package/dist/core/intelligence/patterns/objective-clarifier.d.ts +0 -22
- package/dist/core/intelligence/patterns/objective-clarifier.js +0 -126
- package/dist/core/intelligence/patterns/output-format-enforcer.d.ts +0 -22
- package/dist/core/intelligence/patterns/output-format-enforcer.js +0 -151
- package/dist/core/intelligence/patterns/prd-structure-enforcer.d.ts +0 -23
- package/dist/core/intelligence/patterns/prd-structure-enforcer.js +0 -183
- package/dist/core/intelligence/patterns/prerequisite-identifier.d.ts +0 -23
- package/dist/core/intelligence/patterns/prerequisite-identifier.js +0 -221
- package/dist/core/intelligence/patterns/requirement-prioritizer.d.ts +0 -24
- package/dist/core/intelligence/patterns/requirement-prioritizer.js +0 -134
- package/dist/core/intelligence/patterns/scope-definer.d.ts +0 -26
- package/dist/core/intelligence/patterns/scope-definer.js +0 -236
- package/dist/core/intelligence/patterns/step-decomposer.d.ts +0 -31
- package/dist/core/intelligence/patterns/step-decomposer.js +0 -242
- package/dist/core/intelligence/patterns/structure-organizer.d.ts +0 -31
- package/dist/core/intelligence/patterns/structure-organizer.js +0 -218
- package/dist/core/intelligence/patterns/success-criteria-enforcer.d.ts +0 -22
- package/dist/core/intelligence/patterns/success-criteria-enforcer.js +0 -165
- package/dist/core/intelligence/patterns/success-metrics-enforcer.d.ts +0 -24
- package/dist/core/intelligence/patterns/success-metrics-enforcer.js +0 -165
- package/dist/core/intelligence/patterns/technical-context-enricher.d.ts +0 -25
- package/dist/core/intelligence/patterns/technical-context-enricher.js +0 -165
- package/dist/core/intelligence/patterns/topic-coherence-analyzer.d.ts +0 -26
- package/dist/core/intelligence/patterns/topic-coherence-analyzer.js +0 -300
- package/dist/core/intelligence/patterns/user-persona-enricher.d.ts +0 -24
- package/dist/core/intelligence/patterns/user-persona-enricher.js +0 -141
- package/dist/core/intelligence/patterns/validation-checklist-creator.d.ts +0 -31
- package/dist/core/intelligence/patterns/validation-checklist-creator.js +0 -242
- package/dist/core/intelligence/quality-assessor.d.ts +0 -51
- package/dist/core/intelligence/quality-assessor.js +0 -505
- package/dist/core/intelligence/types.d.ts +0 -111
- package/dist/core/intelligence/types.js +0 -3
- package/dist/core/intelligence/universal-optimizer.d.ts +0 -84
- package/dist/core/intelligence/universal-optimizer.js +0 -371
- package/dist/core/prd-generator.d.ts +0 -76
- package/dist/core/prd-generator.js +0 -173
- package/dist/core/prompt-manager.d.ts +0 -110
- package/dist/core/prompt-manager.js +0 -274
- package/dist/core/prompt-optimizer.d.ts +0 -268
- package/dist/core/prompt-optimizer.js +0 -959
- package/dist/core/question-engine.d.ts +0 -167
- package/dist/core/question-engine.js +0 -356
- package/dist/core/session-manager.d.ts +0 -139
- package/dist/core/session-manager.js +0 -365
- package/dist/core/task-manager.d.ts +0 -211
- package/dist/core/task-manager.js +0 -981
- package/dist/core/verification-hooks.d.ts +0 -67
- package/dist/core/verification-hooks.js +0 -309
- package/dist/core/verification-manager.d.ts +0 -107
- package/dist/core/verification-manager.js +0 -415
- package/dist/index 2.js +0 -13
- package/dist/index.d 2.ts +0 -4
- package/dist/types/session.d.ts +0 -78
- package/dist/types/session.js +0 -8
- package/dist/types/verification.d.ts +0 -205
- package/dist/types/verification.js +0 -9
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Clavix v4.8: Verification Hooks
|
|
3
|
-
*
|
|
4
|
-
* Detects and executes CLI hooks for automated verification of checklist items.
|
|
5
|
-
* Supports npm, yarn, and pnpm package managers.
|
|
6
|
-
*/
|
|
7
|
-
import { VerificationHook, HookResult, HookType, DetectedHooks } from '../types/verification.js';
|
|
8
|
-
/**
|
|
9
|
-
* Verification Hooks Manager
|
|
10
|
-
*/
|
|
11
|
-
export declare class VerificationHooks {
|
|
12
|
-
private readonly cwd;
|
|
13
|
-
private detectedHooks;
|
|
14
|
-
constructor(cwd?: string);
|
|
15
|
-
/**
|
|
16
|
-
* Detect available hooks in the project
|
|
17
|
-
*/
|
|
18
|
-
detectHooks(): Promise<DetectedHooks>;
|
|
19
|
-
/**
|
|
20
|
-
* Detect package manager used in the project
|
|
21
|
-
*/
|
|
22
|
-
private detectPackageManager;
|
|
23
|
-
/**
|
|
24
|
-
* Create a hook definition
|
|
25
|
-
*/
|
|
26
|
-
private createHook;
|
|
27
|
-
/**
|
|
28
|
-
* Run a specific hook
|
|
29
|
-
*/
|
|
30
|
-
runHook(hook: VerificationHook): Promise<HookResult>;
|
|
31
|
-
/**
|
|
32
|
-
* Run all detected hooks
|
|
33
|
-
*/
|
|
34
|
-
runAllHooks(): Promise<HookResult[]>;
|
|
35
|
-
/**
|
|
36
|
-
* Run a hook by type
|
|
37
|
-
*/
|
|
38
|
-
runHookByType(type: HookType): Promise<HookResult | null>;
|
|
39
|
-
/**
|
|
40
|
-
* Execute a command and capture output
|
|
41
|
-
*/
|
|
42
|
-
private executeCommand;
|
|
43
|
-
/**
|
|
44
|
-
* Determine if the hook succeeded
|
|
45
|
-
*/
|
|
46
|
-
private determineSuccess;
|
|
47
|
-
/**
|
|
48
|
-
* Determine confidence level in the result
|
|
49
|
-
*/
|
|
50
|
-
private determineConfidence;
|
|
51
|
-
/**
|
|
52
|
-
* Get hook by type
|
|
53
|
-
*/
|
|
54
|
-
getHook(type: HookType): Promise<VerificationHook | null>;
|
|
55
|
-
/**
|
|
56
|
-
* Check if a hook type is available
|
|
57
|
-
*/
|
|
58
|
-
hasHook(type: HookType): Promise<boolean>;
|
|
59
|
-
/**
|
|
60
|
-
* Get summary of available hooks
|
|
61
|
-
*/
|
|
62
|
-
getHookSummary(): Promise<{
|
|
63
|
-
available: HookType[];
|
|
64
|
-
unavailable: HookType[];
|
|
65
|
-
}>;
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=verification-hooks.d.ts.map
|
|
@@ -1,309 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Clavix v4.8: Verification Hooks
|
|
3
|
-
*
|
|
4
|
-
* Detects and executes CLI hooks for automated verification of checklist items.
|
|
5
|
-
* Supports npm, yarn, and pnpm package managers.
|
|
6
|
-
*/
|
|
7
|
-
import { spawn } from 'child_process';
|
|
8
|
-
import fs from 'fs-extra';
|
|
9
|
-
import * as path from 'path';
|
|
10
|
-
/**
|
|
11
|
-
* Default timeout for hooks (60 seconds)
|
|
12
|
-
*/
|
|
13
|
-
const DEFAULT_TIMEOUT = 60000;
|
|
14
|
-
/**
|
|
15
|
-
* Built-in hook definitions
|
|
16
|
-
*/
|
|
17
|
-
const HOOK_DEFINITIONS = {
|
|
18
|
-
test: {
|
|
19
|
-
displayName: 'Tests',
|
|
20
|
-
commands: ['npm test', 'npm run test', 'yarn test', 'pnpm test'],
|
|
21
|
-
successPatterns: [
|
|
22
|
-
/(\d+)\s+(passing|passed)/i,
|
|
23
|
-
/tests?\s+passed/i,
|
|
24
|
-
/all\s+tests?\s+passed/i,
|
|
25
|
-
/0\s+failed/i,
|
|
26
|
-
/test\s+suites?:\s+\d+\s+passed/i,
|
|
27
|
-
],
|
|
28
|
-
failurePatterns: [/(\d+)\s+failed/i, /test\s+failed/i, /FAIL/i, /error/i],
|
|
29
|
-
},
|
|
30
|
-
build: {
|
|
31
|
-
displayName: 'Build',
|
|
32
|
-
commands: ['npm run build', 'yarn build', 'pnpm build', 'tsc'],
|
|
33
|
-
successPatterns: [/successfully/i, /done/i, /built/i, /compiled/i],
|
|
34
|
-
failurePatterns: [/error/i, /failed/i, /TS\d{4}:/],
|
|
35
|
-
},
|
|
36
|
-
lint: {
|
|
37
|
-
displayName: 'Lint',
|
|
38
|
-
commands: ['npm run lint', 'yarn lint', 'pnpm lint', 'eslint .'],
|
|
39
|
-
successPatterns: [/0\s+errors?/i, /no\s+errors?/i, /all\s+files?\s+pass/i],
|
|
40
|
-
failurePatterns: [/(\d+)\s+errors?/i, /error/i],
|
|
41
|
-
},
|
|
42
|
-
typecheck: {
|
|
43
|
-
displayName: 'Type Check',
|
|
44
|
-
commands: ['tsc --noEmit', 'npm run typecheck', 'yarn typecheck'],
|
|
45
|
-
successPatterns: [/^$/], // Empty output means success for tsc
|
|
46
|
-
failurePatterns: [/error\s+TS\d{4}/i, /Type\s+error/i],
|
|
47
|
-
},
|
|
48
|
-
custom: {
|
|
49
|
-
displayName: 'Custom',
|
|
50
|
-
commands: [],
|
|
51
|
-
successPatterns: [],
|
|
52
|
-
failurePatterns: [],
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Verification Hooks Manager
|
|
57
|
-
*/
|
|
58
|
-
export class VerificationHooks {
|
|
59
|
-
cwd;
|
|
60
|
-
detectedHooks = null;
|
|
61
|
-
constructor(cwd) {
|
|
62
|
-
this.cwd = cwd || process.cwd();
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Detect available hooks in the project
|
|
66
|
-
*/
|
|
67
|
-
async detectHooks() {
|
|
68
|
-
if (this.detectedHooks) {
|
|
69
|
-
return this.detectedHooks;
|
|
70
|
-
}
|
|
71
|
-
const packageJsonPath = path.join(this.cwd, 'package.json');
|
|
72
|
-
const hasPackageJson = await fs.pathExists(packageJsonPath);
|
|
73
|
-
const packageManager = await this.detectPackageManager();
|
|
74
|
-
const hooks = [];
|
|
75
|
-
if (hasPackageJson) {
|
|
76
|
-
try {
|
|
77
|
-
const packageJson = await fs.readJson(packageJsonPath);
|
|
78
|
-
const scripts = packageJson.scripts || {};
|
|
79
|
-
// Check for test script
|
|
80
|
-
if (scripts.test) {
|
|
81
|
-
hooks.push(this.createHook('test', `${packageManager} test`, packageManager));
|
|
82
|
-
}
|
|
83
|
-
// Check for build script
|
|
84
|
-
if (scripts.build) {
|
|
85
|
-
hooks.push(this.createHook('build', `${packageManager} run build`, packageManager));
|
|
86
|
-
}
|
|
87
|
-
// Check for lint script
|
|
88
|
-
if (scripts.lint) {
|
|
89
|
-
hooks.push(this.createHook('lint', `${packageManager} run lint`, packageManager));
|
|
90
|
-
}
|
|
91
|
-
// Check for typecheck script
|
|
92
|
-
if (scripts.typecheck || scripts['type-check']) {
|
|
93
|
-
const cmd = scripts.typecheck ? 'typecheck' : 'type-check';
|
|
94
|
-
hooks.push(this.createHook('typecheck', `${packageManager} run ${cmd}`, packageManager));
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
// Check for TypeScript
|
|
98
|
-
const hasTsConfig = await fs.pathExists(path.join(this.cwd, 'tsconfig.json'));
|
|
99
|
-
if (hasTsConfig) {
|
|
100
|
-
hooks.push(this.createHook('typecheck', 'npx tsc --noEmit', packageManager));
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
catch {
|
|
105
|
-
// Ignore errors reading package.json
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
this.detectedHooks = {
|
|
109
|
-
hooks,
|
|
110
|
-
packageManager,
|
|
111
|
-
hasPackageJson,
|
|
112
|
-
};
|
|
113
|
-
return this.detectedHooks;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Detect package manager used in the project
|
|
117
|
-
*/
|
|
118
|
-
async detectPackageManager() {
|
|
119
|
-
// Check for lock files
|
|
120
|
-
if (await fs.pathExists(path.join(this.cwd, 'pnpm-lock.yaml'))) {
|
|
121
|
-
return 'pnpm';
|
|
122
|
-
}
|
|
123
|
-
if (await fs.pathExists(path.join(this.cwd, 'yarn.lock'))) {
|
|
124
|
-
return 'yarn';
|
|
125
|
-
}
|
|
126
|
-
if (await fs.pathExists(path.join(this.cwd, 'package-lock.json'))) {
|
|
127
|
-
return 'npm';
|
|
128
|
-
}
|
|
129
|
-
return 'unknown';
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Create a hook definition
|
|
133
|
-
*/
|
|
134
|
-
createHook(type, command, _packageManager) {
|
|
135
|
-
const def = HOOK_DEFINITIONS[type];
|
|
136
|
-
return {
|
|
137
|
-
name: type,
|
|
138
|
-
displayName: def.displayName,
|
|
139
|
-
command,
|
|
140
|
-
successPattern: def.successPatterns[0],
|
|
141
|
-
failurePattern: def.failurePatterns[0],
|
|
142
|
-
timeout: DEFAULT_TIMEOUT,
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Run a specific hook
|
|
147
|
-
*/
|
|
148
|
-
async runHook(hook) {
|
|
149
|
-
const startTime = Date.now();
|
|
150
|
-
try {
|
|
151
|
-
const { exitCode, output } = await this.executeCommand(hook.command, hook.timeout);
|
|
152
|
-
const executionTimeMs = Date.now() - startTime;
|
|
153
|
-
// Determine success based on exit code and patterns
|
|
154
|
-
const success = this.determineSuccess(hook, exitCode, output);
|
|
155
|
-
const confidence = this.determineConfidence(hook, exitCode, output, success);
|
|
156
|
-
return {
|
|
157
|
-
hook,
|
|
158
|
-
success,
|
|
159
|
-
exitCode,
|
|
160
|
-
output,
|
|
161
|
-
confidence,
|
|
162
|
-
executionTimeMs,
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
catch (error) {
|
|
166
|
-
const executionTimeMs = Date.now() - startTime;
|
|
167
|
-
return {
|
|
168
|
-
hook,
|
|
169
|
-
success: false,
|
|
170
|
-
exitCode: -1,
|
|
171
|
-
output: '',
|
|
172
|
-
confidence: 'low',
|
|
173
|
-
executionTimeMs,
|
|
174
|
-
error: error instanceof Error ? error.message : String(error),
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Run all detected hooks
|
|
180
|
-
*/
|
|
181
|
-
async runAllHooks() {
|
|
182
|
-
const detected = await this.detectHooks();
|
|
183
|
-
const results = [];
|
|
184
|
-
for (const hook of detected.hooks) {
|
|
185
|
-
const result = await this.runHook(hook);
|
|
186
|
-
results.push(result);
|
|
187
|
-
}
|
|
188
|
-
return results;
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Run a hook by type
|
|
192
|
-
*/
|
|
193
|
-
async runHookByType(type) {
|
|
194
|
-
const detected = await this.detectHooks();
|
|
195
|
-
const hook = detected.hooks.find((h) => h.name === type);
|
|
196
|
-
if (!hook) {
|
|
197
|
-
return null;
|
|
198
|
-
}
|
|
199
|
-
return this.runHook(hook);
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Execute a command and capture output
|
|
203
|
-
*/
|
|
204
|
-
executeCommand(command, timeout) {
|
|
205
|
-
return new Promise((resolve, reject) => {
|
|
206
|
-
const [cmd, ...args] = command.split(' ');
|
|
207
|
-
let output = '';
|
|
208
|
-
const proc = spawn(cmd, args, {
|
|
209
|
-
cwd: this.cwd,
|
|
210
|
-
shell: true,
|
|
211
|
-
env: { ...process.env, CI: 'true', FORCE_COLOR: '0' },
|
|
212
|
-
});
|
|
213
|
-
const timeoutId = setTimeout(() => {
|
|
214
|
-
proc.kill('SIGTERM');
|
|
215
|
-
reject(new Error(`Command timed out after ${timeout}ms`));
|
|
216
|
-
}, timeout);
|
|
217
|
-
proc.stdout?.on('data', (data) => {
|
|
218
|
-
output += data.toString();
|
|
219
|
-
});
|
|
220
|
-
proc.stderr?.on('data', (data) => {
|
|
221
|
-
output += data.toString();
|
|
222
|
-
});
|
|
223
|
-
proc.on('close', (code) => {
|
|
224
|
-
clearTimeout(timeoutId);
|
|
225
|
-
resolve({
|
|
226
|
-
exitCode: code ?? 0,
|
|
227
|
-
output: output.trim(),
|
|
228
|
-
});
|
|
229
|
-
});
|
|
230
|
-
proc.on('error', (error) => {
|
|
231
|
-
clearTimeout(timeoutId);
|
|
232
|
-
reject(error);
|
|
233
|
-
});
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Determine if the hook succeeded
|
|
238
|
-
*/
|
|
239
|
-
determineSuccess(hook, exitCode, output) {
|
|
240
|
-
// Exit code 0 is primary success indicator
|
|
241
|
-
if (exitCode !== 0) {
|
|
242
|
-
return false;
|
|
243
|
-
}
|
|
244
|
-
// Check for explicit failure patterns
|
|
245
|
-
const def = HOOK_DEFINITIONS[hook.name];
|
|
246
|
-
for (const pattern of def.failurePatterns) {
|
|
247
|
-
if (pattern.test(output)) {
|
|
248
|
-
// Check if it's a "0 errors" type match
|
|
249
|
-
const match = output.match(pattern);
|
|
250
|
-
if (match && match[1] === '0') {
|
|
251
|
-
continue; // "0 errors" is success
|
|
252
|
-
}
|
|
253
|
-
return false;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
return true;
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Determine confidence level in the result
|
|
260
|
-
*/
|
|
261
|
-
determineConfidence(hook, exitCode, output, success) {
|
|
262
|
-
const def = HOOK_DEFINITIONS[hook.name];
|
|
263
|
-
// Clear exit code with matching success patterns = high confidence
|
|
264
|
-
if (exitCode === 0 && success) {
|
|
265
|
-
for (const pattern of def.successPatterns) {
|
|
266
|
-
if (pattern.test(output)) {
|
|
267
|
-
return 'high';
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
// Exit 0 but no explicit success pattern
|
|
271
|
-
return 'medium';
|
|
272
|
-
}
|
|
273
|
-
// Clear failure indicators
|
|
274
|
-
if (exitCode !== 0 || !success) {
|
|
275
|
-
for (const pattern of def.failurePatterns) {
|
|
276
|
-
if (pattern.test(output)) {
|
|
277
|
-
return 'high';
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
return 'medium';
|
|
281
|
-
}
|
|
282
|
-
return 'low';
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* Get hook by type
|
|
286
|
-
*/
|
|
287
|
-
async getHook(type) {
|
|
288
|
-
const detected = await this.detectHooks();
|
|
289
|
-
return detected.hooks.find((h) => h.name === type) || null;
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* Check if a hook type is available
|
|
293
|
-
*/
|
|
294
|
-
async hasHook(type) {
|
|
295
|
-
const detected = await this.detectHooks();
|
|
296
|
-
return detected.hooks.some((h) => h.name === type);
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Get summary of available hooks
|
|
300
|
-
*/
|
|
301
|
-
async getHookSummary() {
|
|
302
|
-
const detected = await this.detectHooks();
|
|
303
|
-
const allTypes = ['test', 'build', 'lint', 'typecheck'];
|
|
304
|
-
const available = detected.hooks.map((h) => h.name);
|
|
305
|
-
const unavailable = allTypes.filter((t) => !available.includes(t));
|
|
306
|
-
return { available, unavailable };
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
//# sourceMappingURL=verification-hooks.js.map
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Clavix v4.11: Verification Manager
|
|
3
|
-
*
|
|
4
|
-
* Manages verification state, execution flow, and persistence.
|
|
5
|
-
* Coordinates between checklist parsing, hook execution, and result storage.
|
|
6
|
-
* v4.11: Updated for unified storage (no fast/deep subdirs)
|
|
7
|
-
*/
|
|
8
|
-
import { VerificationReport, VerificationResult, VerificationSummary, ChecklistItem, ReportStatus, VerificationStatus, VerificationConfidence, VerificationMethod } from '../types/verification.js';
|
|
9
|
-
/**
|
|
10
|
-
* Verification Manager
|
|
11
|
-
*/
|
|
12
|
-
export declare class VerificationManager {
|
|
13
|
-
private readonly promptManager;
|
|
14
|
-
private readonly checklistParser;
|
|
15
|
-
private readonly verificationHooks;
|
|
16
|
-
private readonly outputDir;
|
|
17
|
-
constructor(baseDir?: string);
|
|
18
|
-
/**
|
|
19
|
-
* Initialize verification for a prompt
|
|
20
|
-
*/
|
|
21
|
-
initializeVerification(promptId: string): Promise<VerificationReport>;
|
|
22
|
-
/**
|
|
23
|
-
* v4.11: Get verification report path (unified storage)
|
|
24
|
-
*/
|
|
25
|
-
getReportPath(promptId: string): string;
|
|
26
|
-
/**
|
|
27
|
-
* v4.11: Load verification report
|
|
28
|
-
*/
|
|
29
|
-
loadReport(promptId: string): Promise<VerificationReport | null>;
|
|
30
|
-
/**
|
|
31
|
-
* v4.11: Save verification report
|
|
32
|
-
*/
|
|
33
|
-
saveReport(report: VerificationReport): Promise<void>;
|
|
34
|
-
/**
|
|
35
|
-
* Mark a single item as verified
|
|
36
|
-
*/
|
|
37
|
-
markItemVerified(promptId: string, itemId: string, status: VerificationStatus, options?: {
|
|
38
|
-
evidence?: string;
|
|
39
|
-
reason?: string;
|
|
40
|
-
confidence?: VerificationConfidence;
|
|
41
|
-
method?: VerificationMethod;
|
|
42
|
-
}): Promise<VerificationReport>;
|
|
43
|
-
/**
|
|
44
|
-
* Run automated verification for a prompt
|
|
45
|
-
*/
|
|
46
|
-
runAutomatedVerification(promptId: string): Promise<VerificationReport>;
|
|
47
|
-
/**
|
|
48
|
-
* Match checklist item content to hook type
|
|
49
|
-
*/
|
|
50
|
-
private matchItemToHook;
|
|
51
|
-
/**
|
|
52
|
-
* Truncate output for storage
|
|
53
|
-
*/
|
|
54
|
-
private truncateOutput;
|
|
55
|
-
/**
|
|
56
|
-
* Calculate summary from results
|
|
57
|
-
*/
|
|
58
|
-
calculateSummary(results: VerificationResult[]): VerificationSummary;
|
|
59
|
-
/**
|
|
60
|
-
* Calculate overall report status
|
|
61
|
-
*/
|
|
62
|
-
private calculateReportStatus;
|
|
63
|
-
/**
|
|
64
|
-
* Get pending items from report
|
|
65
|
-
*/
|
|
66
|
-
getPendingItems(report: VerificationReport): ChecklistItem[];
|
|
67
|
-
/**
|
|
68
|
-
* Get failed items from report
|
|
69
|
-
*/
|
|
70
|
-
getFailedItems(report: VerificationReport): Array<{
|
|
71
|
-
item: ChecklistItem;
|
|
72
|
-
result: VerificationResult;
|
|
73
|
-
}>;
|
|
74
|
-
/**
|
|
75
|
-
* Check if verification is complete
|
|
76
|
-
*/
|
|
77
|
-
isComplete(report: VerificationReport): boolean;
|
|
78
|
-
/**
|
|
79
|
-
* Check if verification requires attention (has failures)
|
|
80
|
-
*/
|
|
81
|
-
requiresAttention(report: VerificationReport): boolean;
|
|
82
|
-
/**
|
|
83
|
-
* v4.11: Delete verification report
|
|
84
|
-
*/
|
|
85
|
-
deleteReport(promptId: string): Promise<boolean>;
|
|
86
|
-
/**
|
|
87
|
-
* v4.11: Get all verification reports
|
|
88
|
-
*/
|
|
89
|
-
listReports(): Promise<VerificationReport[]>;
|
|
90
|
-
/**
|
|
91
|
-
* Get verification status for a prompt
|
|
92
|
-
*/
|
|
93
|
-
getVerificationStatus(promptId: string): Promise<{
|
|
94
|
-
hasReport: boolean;
|
|
95
|
-
status: ReportStatus | null;
|
|
96
|
-
summary: VerificationSummary | null;
|
|
97
|
-
}>;
|
|
98
|
-
/**
|
|
99
|
-
* Format verification report for display
|
|
100
|
-
*/
|
|
101
|
-
formatReportForDisplay(report: VerificationReport): string;
|
|
102
|
-
/**
|
|
103
|
-
* Get status icon for display
|
|
104
|
-
*/
|
|
105
|
-
private getStatusIcon;
|
|
106
|
-
}
|
|
107
|
-
//# sourceMappingURL=verification-manager.d.ts.map
|