@harness-engineering/cli 1.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/LICENSE +21 -0
- package/README.md +115 -0
- package/dist/bin/harness.d.ts +1 -0
- package/dist/bin/harness.js +18 -0
- package/dist/chunk-4RCIE5YB.js +526 -0
- package/dist/chunk-5JDJNUEO.js +2639 -0
- package/dist/chunk-6I25KNGR.js +1209 -0
- package/dist/chunk-77B7VOJM.js +1304 -0
- package/dist/chunk-ATN2MXAI.js +2798 -0
- package/dist/chunk-CJ2ZAYCV.js +2639 -0
- package/dist/chunk-EFZOLZFB.js +265 -0
- package/dist/chunk-EQKDZSPA.js +226 -0
- package/dist/chunk-FQB2ZTRA.js +1209 -0
- package/dist/chunk-G2SHRCBP.js +935 -0
- package/dist/chunk-GPYYJN6Z.js +2634 -0
- package/dist/chunk-H2LQ7ELQ.js +2795 -0
- package/dist/chunk-L64MEJOI.js +2512 -0
- package/dist/chunk-LFA7JNFB.js +2633 -0
- package/dist/chunk-NDZWBEZS.js +317 -0
- package/dist/chunk-RZHIR5XA.js +640 -0
- package/dist/chunk-SJJ37KLV.js +317 -0
- package/dist/chunk-SPR56MPD.js +2798 -0
- package/dist/chunk-TLZO4QIN.js +2850 -0
- package/dist/chunk-TUMCTRNV.js +2637 -0
- package/dist/chunk-Z7MYWXIH.js +2852 -0
- package/dist/chunk-ZOOWDP6S.js +2857 -0
- package/dist/create-skill-4GKJZB5R.js +8 -0
- package/dist/index.d.ts +543 -0
- package/dist/index.js +42 -0
- package/dist/validate-cross-check-N75UV2CO.js +69 -0
- package/dist/validate-cross-check-ZB2OZDOK.js +69 -0
- package/package.json +59 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,543 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { Result } from '@harness-engineering/core';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
interface Phase {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
required: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface PreambleOptions {
|
|
11
|
+
complexity?: 'light' | 'full';
|
|
12
|
+
phases?: Phase[];
|
|
13
|
+
principles?: string;
|
|
14
|
+
phase?: string;
|
|
15
|
+
priorState?: string;
|
|
16
|
+
stateWarning?: string;
|
|
17
|
+
party?: boolean;
|
|
18
|
+
}
|
|
19
|
+
declare function buildPreamble(options: PreambleOptions): string;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* CLI Exit Codes
|
|
23
|
+
*/
|
|
24
|
+
declare const ExitCode: {
|
|
25
|
+
readonly SUCCESS: 0;
|
|
26
|
+
readonly VALIDATION_FAILED: 1;
|
|
27
|
+
readonly ERROR: 2;
|
|
28
|
+
};
|
|
29
|
+
type ExitCodeType = (typeof ExitCode)[keyof typeof ExitCode];
|
|
30
|
+
/**
|
|
31
|
+
* CLI-specific error with exit code
|
|
32
|
+
*/
|
|
33
|
+
declare class CLIError extends Error {
|
|
34
|
+
readonly exitCode: ExitCodeType;
|
|
35
|
+
constructor(message: string, exitCode?: ExitCodeType);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Handle error and exit process
|
|
39
|
+
*/
|
|
40
|
+
declare function handleError(error: unknown): never;
|
|
41
|
+
|
|
42
|
+
declare const OutputMode: {
|
|
43
|
+
readonly JSON: "json";
|
|
44
|
+
readonly TEXT: "text";
|
|
45
|
+
readonly QUIET: "quiet";
|
|
46
|
+
readonly VERBOSE: "verbose";
|
|
47
|
+
};
|
|
48
|
+
type OutputModeType = (typeof OutputMode)[keyof typeof OutputMode];
|
|
49
|
+
interface ValidationIssue {
|
|
50
|
+
file?: string;
|
|
51
|
+
message: string;
|
|
52
|
+
line?: number;
|
|
53
|
+
suggestion?: string;
|
|
54
|
+
}
|
|
55
|
+
interface ValidationResult {
|
|
56
|
+
valid: boolean;
|
|
57
|
+
issues: ValidationIssue[];
|
|
58
|
+
}
|
|
59
|
+
declare class OutputFormatter {
|
|
60
|
+
private mode;
|
|
61
|
+
constructor(mode?: OutputModeType);
|
|
62
|
+
/**
|
|
63
|
+
* Format raw data (for JSON mode)
|
|
64
|
+
*/
|
|
65
|
+
format(data: unknown): string;
|
|
66
|
+
/**
|
|
67
|
+
* Format validation result
|
|
68
|
+
*/
|
|
69
|
+
formatValidation(result: ValidationResult): string;
|
|
70
|
+
/**
|
|
71
|
+
* Format a summary line
|
|
72
|
+
*/
|
|
73
|
+
formatSummary(label: string, value: string | number, success: boolean): string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
declare const logger: {
|
|
77
|
+
info: (message: string) => void;
|
|
78
|
+
success: (message: string) => void;
|
|
79
|
+
warn: (message: string) => void;
|
|
80
|
+
error: (message: string) => void;
|
|
81
|
+
dim: (message: string) => void;
|
|
82
|
+
raw: (data: unknown) => void;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
declare const HarnessConfigSchema: z.ZodObject<{
|
|
86
|
+
version: z.ZodLiteral<1>;
|
|
87
|
+
name: z.ZodOptional<z.ZodString>;
|
|
88
|
+
rootDir: z.ZodDefault<z.ZodString>;
|
|
89
|
+
layers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
90
|
+
name: z.ZodString;
|
|
91
|
+
pattern: z.ZodString;
|
|
92
|
+
allowedDependencies: z.ZodArray<z.ZodString, "many">;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
name: string;
|
|
95
|
+
pattern: string;
|
|
96
|
+
allowedDependencies: string[];
|
|
97
|
+
}, {
|
|
98
|
+
name: string;
|
|
99
|
+
pattern: string;
|
|
100
|
+
allowedDependencies: string[];
|
|
101
|
+
}>, "many">>;
|
|
102
|
+
forbiddenImports: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
103
|
+
from: z.ZodString;
|
|
104
|
+
disallow: z.ZodArray<z.ZodString, "many">;
|
|
105
|
+
message: z.ZodOptional<z.ZodString>;
|
|
106
|
+
}, "strip", z.ZodTypeAny, {
|
|
107
|
+
from: string;
|
|
108
|
+
disallow: string[];
|
|
109
|
+
message?: string | undefined;
|
|
110
|
+
}, {
|
|
111
|
+
from: string;
|
|
112
|
+
disallow: string[];
|
|
113
|
+
message?: string | undefined;
|
|
114
|
+
}>, "many">>;
|
|
115
|
+
boundaries: z.ZodOptional<z.ZodObject<{
|
|
116
|
+
requireSchema: z.ZodArray<z.ZodString, "many">;
|
|
117
|
+
}, "strip", z.ZodTypeAny, {
|
|
118
|
+
requireSchema: string[];
|
|
119
|
+
}, {
|
|
120
|
+
requireSchema: string[];
|
|
121
|
+
}>>;
|
|
122
|
+
agentsMapPath: z.ZodDefault<z.ZodString>;
|
|
123
|
+
docsDir: z.ZodDefault<z.ZodString>;
|
|
124
|
+
agent: z.ZodOptional<z.ZodObject<{
|
|
125
|
+
executor: z.ZodDefault<z.ZodEnum<["subprocess", "cloud", "noop"]>>;
|
|
126
|
+
timeout: z.ZodDefault<z.ZodNumber>;
|
|
127
|
+
skills: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
128
|
+
}, "strip", z.ZodTypeAny, {
|
|
129
|
+
executor: "subprocess" | "cloud" | "noop";
|
|
130
|
+
timeout: number;
|
|
131
|
+
skills?: string[] | undefined;
|
|
132
|
+
}, {
|
|
133
|
+
executor?: "subprocess" | "cloud" | "noop" | undefined;
|
|
134
|
+
timeout?: number | undefined;
|
|
135
|
+
skills?: string[] | undefined;
|
|
136
|
+
}>>;
|
|
137
|
+
entropy: z.ZodOptional<z.ZodObject<{
|
|
138
|
+
excludePatterns: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
139
|
+
autoFix: z.ZodDefault<z.ZodBoolean>;
|
|
140
|
+
}, "strip", z.ZodTypeAny, {
|
|
141
|
+
excludePatterns: string[];
|
|
142
|
+
autoFix: boolean;
|
|
143
|
+
}, {
|
|
144
|
+
excludePatterns?: string[] | undefined;
|
|
145
|
+
autoFix?: boolean | undefined;
|
|
146
|
+
}>>;
|
|
147
|
+
template: z.ZodOptional<z.ZodObject<{
|
|
148
|
+
level: z.ZodEnum<["basic", "intermediate", "advanced"]>;
|
|
149
|
+
framework: z.ZodOptional<z.ZodString>;
|
|
150
|
+
version: z.ZodNumber;
|
|
151
|
+
}, "strip", z.ZodTypeAny, {
|
|
152
|
+
version: number;
|
|
153
|
+
level: "basic" | "intermediate" | "advanced";
|
|
154
|
+
framework?: string | undefined;
|
|
155
|
+
}, {
|
|
156
|
+
version: number;
|
|
157
|
+
level: "basic" | "intermediate" | "advanced";
|
|
158
|
+
framework?: string | undefined;
|
|
159
|
+
}>>;
|
|
160
|
+
phaseGates: z.ZodOptional<z.ZodObject<{
|
|
161
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
162
|
+
severity: z.ZodDefault<z.ZodEnum<["error", "warning"]>>;
|
|
163
|
+
mappings: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
164
|
+
implPattern: z.ZodString;
|
|
165
|
+
specPattern: z.ZodString;
|
|
166
|
+
}, "strip", z.ZodTypeAny, {
|
|
167
|
+
implPattern: string;
|
|
168
|
+
specPattern: string;
|
|
169
|
+
}, {
|
|
170
|
+
implPattern: string;
|
|
171
|
+
specPattern: string;
|
|
172
|
+
}>, "many">>;
|
|
173
|
+
}, "strip", z.ZodTypeAny, {
|
|
174
|
+
enabled: boolean;
|
|
175
|
+
severity: "error" | "warning";
|
|
176
|
+
mappings: {
|
|
177
|
+
implPattern: string;
|
|
178
|
+
specPattern: string;
|
|
179
|
+
}[];
|
|
180
|
+
}, {
|
|
181
|
+
enabled?: boolean | undefined;
|
|
182
|
+
severity?: "error" | "warning" | undefined;
|
|
183
|
+
mappings?: {
|
|
184
|
+
implPattern: string;
|
|
185
|
+
specPattern: string;
|
|
186
|
+
}[] | undefined;
|
|
187
|
+
}>>;
|
|
188
|
+
}, "strip", z.ZodTypeAny, {
|
|
189
|
+
version: 1;
|
|
190
|
+
rootDir: string;
|
|
191
|
+
agentsMapPath: string;
|
|
192
|
+
docsDir: string;
|
|
193
|
+
name?: string | undefined;
|
|
194
|
+
layers?: {
|
|
195
|
+
name: string;
|
|
196
|
+
pattern: string;
|
|
197
|
+
allowedDependencies: string[];
|
|
198
|
+
}[] | undefined;
|
|
199
|
+
forbiddenImports?: {
|
|
200
|
+
from: string;
|
|
201
|
+
disallow: string[];
|
|
202
|
+
message?: string | undefined;
|
|
203
|
+
}[] | undefined;
|
|
204
|
+
boundaries?: {
|
|
205
|
+
requireSchema: string[];
|
|
206
|
+
} | undefined;
|
|
207
|
+
agent?: {
|
|
208
|
+
executor: "subprocess" | "cloud" | "noop";
|
|
209
|
+
timeout: number;
|
|
210
|
+
skills?: string[] | undefined;
|
|
211
|
+
} | undefined;
|
|
212
|
+
entropy?: {
|
|
213
|
+
excludePatterns: string[];
|
|
214
|
+
autoFix: boolean;
|
|
215
|
+
} | undefined;
|
|
216
|
+
template?: {
|
|
217
|
+
version: number;
|
|
218
|
+
level: "basic" | "intermediate" | "advanced";
|
|
219
|
+
framework?: string | undefined;
|
|
220
|
+
} | undefined;
|
|
221
|
+
phaseGates?: {
|
|
222
|
+
enabled: boolean;
|
|
223
|
+
severity: "error" | "warning";
|
|
224
|
+
mappings: {
|
|
225
|
+
implPattern: string;
|
|
226
|
+
specPattern: string;
|
|
227
|
+
}[];
|
|
228
|
+
} | undefined;
|
|
229
|
+
}, {
|
|
230
|
+
version: 1;
|
|
231
|
+
name?: string | undefined;
|
|
232
|
+
rootDir?: string | undefined;
|
|
233
|
+
layers?: {
|
|
234
|
+
name: string;
|
|
235
|
+
pattern: string;
|
|
236
|
+
allowedDependencies: string[];
|
|
237
|
+
}[] | undefined;
|
|
238
|
+
forbiddenImports?: {
|
|
239
|
+
from: string;
|
|
240
|
+
disallow: string[];
|
|
241
|
+
message?: string | undefined;
|
|
242
|
+
}[] | undefined;
|
|
243
|
+
boundaries?: {
|
|
244
|
+
requireSchema: string[];
|
|
245
|
+
} | undefined;
|
|
246
|
+
agentsMapPath?: string | undefined;
|
|
247
|
+
docsDir?: string | undefined;
|
|
248
|
+
agent?: {
|
|
249
|
+
executor?: "subprocess" | "cloud" | "noop" | undefined;
|
|
250
|
+
timeout?: number | undefined;
|
|
251
|
+
skills?: string[] | undefined;
|
|
252
|
+
} | undefined;
|
|
253
|
+
entropy?: {
|
|
254
|
+
excludePatterns?: string[] | undefined;
|
|
255
|
+
autoFix?: boolean | undefined;
|
|
256
|
+
} | undefined;
|
|
257
|
+
template?: {
|
|
258
|
+
version: number;
|
|
259
|
+
level: "basic" | "intermediate" | "advanced";
|
|
260
|
+
framework?: string | undefined;
|
|
261
|
+
} | undefined;
|
|
262
|
+
phaseGates?: {
|
|
263
|
+
enabled?: boolean | undefined;
|
|
264
|
+
severity?: "error" | "warning" | undefined;
|
|
265
|
+
mappings?: {
|
|
266
|
+
implPattern: string;
|
|
267
|
+
specPattern: string;
|
|
268
|
+
}[] | undefined;
|
|
269
|
+
} | undefined;
|
|
270
|
+
}>;
|
|
271
|
+
type HarnessConfig = z.infer<typeof HarnessConfigSchema>;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Find config file starting from given directory
|
|
275
|
+
*/
|
|
276
|
+
declare function findConfigFile(startDir?: string): Result<string, CLIError>;
|
|
277
|
+
/**
|
|
278
|
+
* Load and validate config from file
|
|
279
|
+
*/
|
|
280
|
+
declare function loadConfig(configPath: string): Result<HarnessConfig, CLIError>;
|
|
281
|
+
/**
|
|
282
|
+
* Load config from default location or specified path
|
|
283
|
+
*/
|
|
284
|
+
declare function resolveConfig(configPath?: string): Result<HarnessConfig, CLIError>;
|
|
285
|
+
|
|
286
|
+
declare const TemplateMetadataSchema: z.ZodObject<{
|
|
287
|
+
name: z.ZodString;
|
|
288
|
+
description: z.ZodString;
|
|
289
|
+
level: z.ZodOptional<z.ZodEnum<["basic", "intermediate", "advanced"]>>;
|
|
290
|
+
framework: z.ZodOptional<z.ZodString>;
|
|
291
|
+
extends: z.ZodOptional<z.ZodString>;
|
|
292
|
+
mergeStrategy: z.ZodDefault<z.ZodObject<{
|
|
293
|
+
json: z.ZodDefault<z.ZodEnum<["deep-merge", "overlay-wins"]>>;
|
|
294
|
+
files: z.ZodDefault<z.ZodLiteral<"overlay-wins">>;
|
|
295
|
+
}, "strip", z.ZodTypeAny, {
|
|
296
|
+
json: "deep-merge" | "overlay-wins";
|
|
297
|
+
files: "overlay-wins";
|
|
298
|
+
}, {
|
|
299
|
+
json?: "deep-merge" | "overlay-wins" | undefined;
|
|
300
|
+
files?: "overlay-wins" | undefined;
|
|
301
|
+
}>>;
|
|
302
|
+
version: z.ZodLiteral<1>;
|
|
303
|
+
}, "strip", z.ZodTypeAny, {
|
|
304
|
+
name: string;
|
|
305
|
+
version: 1;
|
|
306
|
+
description: string;
|
|
307
|
+
mergeStrategy: {
|
|
308
|
+
json: "deep-merge" | "overlay-wins";
|
|
309
|
+
files: "overlay-wins";
|
|
310
|
+
};
|
|
311
|
+
level?: "basic" | "intermediate" | "advanced" | undefined;
|
|
312
|
+
framework?: string | undefined;
|
|
313
|
+
extends?: string | undefined;
|
|
314
|
+
}, {
|
|
315
|
+
name: string;
|
|
316
|
+
version: 1;
|
|
317
|
+
description: string;
|
|
318
|
+
level?: "basic" | "intermediate" | "advanced" | undefined;
|
|
319
|
+
framework?: string | undefined;
|
|
320
|
+
extends?: string | undefined;
|
|
321
|
+
mergeStrategy?: {
|
|
322
|
+
json?: "deep-merge" | "overlay-wins" | undefined;
|
|
323
|
+
files?: "overlay-wins" | undefined;
|
|
324
|
+
} | undefined;
|
|
325
|
+
}>;
|
|
326
|
+
type TemplateMetadata = z.infer<typeof TemplateMetadataSchema>;
|
|
327
|
+
|
|
328
|
+
interface TemplateContext {
|
|
329
|
+
projectName: string;
|
|
330
|
+
level: string;
|
|
331
|
+
framework?: string;
|
|
332
|
+
}
|
|
333
|
+
interface TemplateFile {
|
|
334
|
+
relativePath: string;
|
|
335
|
+
absolutePath: string;
|
|
336
|
+
isHandlebars: boolean;
|
|
337
|
+
sourceTemplate: string;
|
|
338
|
+
}
|
|
339
|
+
interface ResolvedTemplate {
|
|
340
|
+
metadata: TemplateMetadata;
|
|
341
|
+
files: TemplateFile[];
|
|
342
|
+
overlayMetadata?: TemplateMetadata;
|
|
343
|
+
}
|
|
344
|
+
interface RenderedFile {
|
|
345
|
+
relativePath: string;
|
|
346
|
+
content: string;
|
|
347
|
+
}
|
|
348
|
+
interface RenderedFiles {
|
|
349
|
+
files: RenderedFile[];
|
|
350
|
+
}
|
|
351
|
+
interface WriteOptions {
|
|
352
|
+
overwrite: boolean;
|
|
353
|
+
}
|
|
354
|
+
declare class TemplateEngine {
|
|
355
|
+
private templatesDir;
|
|
356
|
+
constructor(templatesDir: string);
|
|
357
|
+
listTemplates(): Result<TemplateMetadata[], Error>;
|
|
358
|
+
resolveTemplate(level: string, framework?: string): Result<ResolvedTemplate, Error>;
|
|
359
|
+
render(template: ResolvedTemplate, context: TemplateContext): Result<RenderedFiles, Error>;
|
|
360
|
+
write(files: RenderedFiles, targetDir: string, options: WriteOptions): Result<string[], Error>;
|
|
361
|
+
private findTemplateDir;
|
|
362
|
+
private collectFiles;
|
|
363
|
+
private mergeFileLists;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
declare const PersonaSchema: z.ZodObject<{
|
|
367
|
+
version: z.ZodLiteral<1>;
|
|
368
|
+
name: z.ZodString;
|
|
369
|
+
description: z.ZodString;
|
|
370
|
+
role: z.ZodString;
|
|
371
|
+
skills: z.ZodArray<z.ZodString, "many">;
|
|
372
|
+
commands: z.ZodArray<z.ZodString, "many">;
|
|
373
|
+
triggers: z.ZodArray<z.ZodDiscriminatedUnion<"event", [z.ZodObject<{
|
|
374
|
+
event: z.ZodLiteral<"on_pr">;
|
|
375
|
+
conditions: z.ZodOptional<z.ZodObject<{
|
|
376
|
+
paths: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
377
|
+
}, "strip", z.ZodTypeAny, {
|
|
378
|
+
paths?: string[] | undefined;
|
|
379
|
+
}, {
|
|
380
|
+
paths?: string[] | undefined;
|
|
381
|
+
}>>;
|
|
382
|
+
}, "strip", z.ZodTypeAny, {
|
|
383
|
+
event: "on_pr";
|
|
384
|
+
conditions?: {
|
|
385
|
+
paths?: string[] | undefined;
|
|
386
|
+
} | undefined;
|
|
387
|
+
}, {
|
|
388
|
+
event: "on_pr";
|
|
389
|
+
conditions?: {
|
|
390
|
+
paths?: string[] | undefined;
|
|
391
|
+
} | undefined;
|
|
392
|
+
}>, z.ZodObject<{
|
|
393
|
+
event: z.ZodLiteral<"on_commit">;
|
|
394
|
+
conditions: z.ZodOptional<z.ZodObject<{
|
|
395
|
+
branches: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
396
|
+
}, "strip", z.ZodTypeAny, {
|
|
397
|
+
branches?: string[] | undefined;
|
|
398
|
+
}, {
|
|
399
|
+
branches?: string[] | undefined;
|
|
400
|
+
}>>;
|
|
401
|
+
}, "strip", z.ZodTypeAny, {
|
|
402
|
+
event: "on_commit";
|
|
403
|
+
conditions?: {
|
|
404
|
+
branches?: string[] | undefined;
|
|
405
|
+
} | undefined;
|
|
406
|
+
}, {
|
|
407
|
+
event: "on_commit";
|
|
408
|
+
conditions?: {
|
|
409
|
+
branches?: string[] | undefined;
|
|
410
|
+
} | undefined;
|
|
411
|
+
}>, z.ZodObject<{
|
|
412
|
+
event: z.ZodLiteral<"scheduled">;
|
|
413
|
+
cron: z.ZodString;
|
|
414
|
+
}, "strip", z.ZodTypeAny, {
|
|
415
|
+
event: "scheduled";
|
|
416
|
+
cron: string;
|
|
417
|
+
}, {
|
|
418
|
+
event: "scheduled";
|
|
419
|
+
cron: string;
|
|
420
|
+
}>]>, "many">;
|
|
421
|
+
config: z.ZodDefault<z.ZodObject<{
|
|
422
|
+
severity: z.ZodDefault<z.ZodEnum<["error", "warning"]>>;
|
|
423
|
+
autoFix: z.ZodDefault<z.ZodBoolean>;
|
|
424
|
+
timeout: z.ZodDefault<z.ZodNumber>;
|
|
425
|
+
}, "strip", z.ZodTypeAny, {
|
|
426
|
+
timeout: number;
|
|
427
|
+
autoFix: boolean;
|
|
428
|
+
severity: "error" | "warning";
|
|
429
|
+
}, {
|
|
430
|
+
timeout?: number | undefined;
|
|
431
|
+
autoFix?: boolean | undefined;
|
|
432
|
+
severity?: "error" | "warning" | undefined;
|
|
433
|
+
}>>;
|
|
434
|
+
outputs: z.ZodDefault<z.ZodObject<{
|
|
435
|
+
'agents-md': z.ZodDefault<z.ZodBoolean>;
|
|
436
|
+
'ci-workflow': z.ZodDefault<z.ZodBoolean>;
|
|
437
|
+
'runtime-config': z.ZodDefault<z.ZodBoolean>;
|
|
438
|
+
}, "strip", z.ZodTypeAny, {
|
|
439
|
+
'agents-md': boolean;
|
|
440
|
+
'ci-workflow': boolean;
|
|
441
|
+
'runtime-config': boolean;
|
|
442
|
+
}, {
|
|
443
|
+
'agents-md'?: boolean | undefined;
|
|
444
|
+
'ci-workflow'?: boolean | undefined;
|
|
445
|
+
'runtime-config'?: boolean | undefined;
|
|
446
|
+
}>>;
|
|
447
|
+
}, "strip", z.ZodTypeAny, {
|
|
448
|
+
name: string;
|
|
449
|
+
skills: string[];
|
|
450
|
+
version: 1;
|
|
451
|
+
description: string;
|
|
452
|
+
role: string;
|
|
453
|
+
commands: string[];
|
|
454
|
+
triggers: ({
|
|
455
|
+
event: "on_pr";
|
|
456
|
+
conditions?: {
|
|
457
|
+
paths?: string[] | undefined;
|
|
458
|
+
} | undefined;
|
|
459
|
+
} | {
|
|
460
|
+
event: "on_commit";
|
|
461
|
+
conditions?: {
|
|
462
|
+
branches?: string[] | undefined;
|
|
463
|
+
} | undefined;
|
|
464
|
+
} | {
|
|
465
|
+
event: "scheduled";
|
|
466
|
+
cron: string;
|
|
467
|
+
})[];
|
|
468
|
+
config: {
|
|
469
|
+
timeout: number;
|
|
470
|
+
autoFix: boolean;
|
|
471
|
+
severity: "error" | "warning";
|
|
472
|
+
};
|
|
473
|
+
outputs: {
|
|
474
|
+
'agents-md': boolean;
|
|
475
|
+
'ci-workflow': boolean;
|
|
476
|
+
'runtime-config': boolean;
|
|
477
|
+
};
|
|
478
|
+
}, {
|
|
479
|
+
name: string;
|
|
480
|
+
skills: string[];
|
|
481
|
+
version: 1;
|
|
482
|
+
description: string;
|
|
483
|
+
role: string;
|
|
484
|
+
commands: string[];
|
|
485
|
+
triggers: ({
|
|
486
|
+
event: "on_pr";
|
|
487
|
+
conditions?: {
|
|
488
|
+
paths?: string[] | undefined;
|
|
489
|
+
} | undefined;
|
|
490
|
+
} | {
|
|
491
|
+
event: "on_commit";
|
|
492
|
+
conditions?: {
|
|
493
|
+
branches?: string[] | undefined;
|
|
494
|
+
} | undefined;
|
|
495
|
+
} | {
|
|
496
|
+
event: "scheduled";
|
|
497
|
+
cron: string;
|
|
498
|
+
})[];
|
|
499
|
+
config?: {
|
|
500
|
+
timeout?: number | undefined;
|
|
501
|
+
autoFix?: boolean | undefined;
|
|
502
|
+
severity?: "error" | "warning" | undefined;
|
|
503
|
+
} | undefined;
|
|
504
|
+
outputs?: {
|
|
505
|
+
'agents-md'?: boolean | undefined;
|
|
506
|
+
'ci-workflow'?: boolean | undefined;
|
|
507
|
+
'runtime-config'?: boolean | undefined;
|
|
508
|
+
} | undefined;
|
|
509
|
+
}>;
|
|
510
|
+
type Persona = z.infer<typeof PersonaSchema>;
|
|
511
|
+
|
|
512
|
+
interface PersonaMetadata {
|
|
513
|
+
name: string;
|
|
514
|
+
description: string;
|
|
515
|
+
filePath: string;
|
|
516
|
+
}
|
|
517
|
+
declare function loadPersona(filePath: string): Result<Persona, Error>;
|
|
518
|
+
declare function listPersonas(dir: string): Result<PersonaMetadata[], Error>;
|
|
519
|
+
|
|
520
|
+
declare function generateRuntime(persona: Persona): Result<string, Error>;
|
|
521
|
+
|
|
522
|
+
declare function generateAgentsMd(persona: Persona): Result<string, Error>;
|
|
523
|
+
|
|
524
|
+
declare function generateCIWorkflow(persona: Persona, platform: 'github' | 'gitlab'): Result<string, Error>;
|
|
525
|
+
|
|
526
|
+
interface PersonaRunReport {
|
|
527
|
+
persona: string;
|
|
528
|
+
status: 'pass' | 'fail' | 'partial';
|
|
529
|
+
commands: Array<{
|
|
530
|
+
name: string;
|
|
531
|
+
status: 'pass' | 'fail' | 'skipped';
|
|
532
|
+
result?: unknown;
|
|
533
|
+
error?: string;
|
|
534
|
+
durationMs: number;
|
|
535
|
+
}>;
|
|
536
|
+
totalDurationMs: number;
|
|
537
|
+
}
|
|
538
|
+
type CommandExecutor = (command: string) => Promise<Result<unknown, Error>>;
|
|
539
|
+
declare function runPersona(persona: Persona, executor: CommandExecutor): Promise<PersonaRunReport>;
|
|
540
|
+
|
|
541
|
+
declare function createProgram(): Command;
|
|
542
|
+
|
|
543
|
+
export { CLIError, type CommandExecutor, ExitCode, type HarnessConfig, OutputFormatter, OutputMode, type Persona, type PersonaMetadata, type PersonaRunReport, type RenderedFiles, type TemplateContext, TemplateEngine, buildPreamble, createProgram, findConfigFile, generateAgentsMd, generateCIWorkflow, generateRuntime, handleError, listPersonas, loadConfig, loadPersona, logger, resolveConfig, runPersona };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OutputFormatter,
|
|
3
|
+
OutputMode,
|
|
4
|
+
TemplateEngine,
|
|
5
|
+
buildPreamble,
|
|
6
|
+
createProgram,
|
|
7
|
+
findConfigFile,
|
|
8
|
+
generateAgentsMd,
|
|
9
|
+
generateCIWorkflow,
|
|
10
|
+
generateRuntime,
|
|
11
|
+
listPersonas,
|
|
12
|
+
loadConfig,
|
|
13
|
+
loadPersona,
|
|
14
|
+
resolveConfig,
|
|
15
|
+
runPersona
|
|
16
|
+
} from "./chunk-5JDJNUEO.js";
|
|
17
|
+
import {
|
|
18
|
+
CLIError,
|
|
19
|
+
ExitCode,
|
|
20
|
+
handleError,
|
|
21
|
+
logger
|
|
22
|
+
} from "./chunk-EFZOLZFB.js";
|
|
23
|
+
export {
|
|
24
|
+
CLIError,
|
|
25
|
+
ExitCode,
|
|
26
|
+
OutputFormatter,
|
|
27
|
+
OutputMode,
|
|
28
|
+
TemplateEngine,
|
|
29
|
+
buildPreamble,
|
|
30
|
+
createProgram,
|
|
31
|
+
findConfigFile,
|
|
32
|
+
generateAgentsMd,
|
|
33
|
+
generateCIWorkflow,
|
|
34
|
+
generateRuntime,
|
|
35
|
+
handleError,
|
|
36
|
+
listPersonas,
|
|
37
|
+
loadConfig,
|
|
38
|
+
loadPersona,
|
|
39
|
+
logger,
|
|
40
|
+
resolveConfig,
|
|
41
|
+
runPersona
|
|
42
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// src/commands/validate-cross-check.ts
|
|
2
|
+
import * as fs from "fs";
|
|
3
|
+
import * as path from "path";
|
|
4
|
+
import { execSync } from "child_process";
|
|
5
|
+
import { Ok } from "@harness-engineering/core";
|
|
6
|
+
function findFiles(dir, ext) {
|
|
7
|
+
if (!fs.existsSync(dir)) return [];
|
|
8
|
+
return fs.readdirSync(dir).filter((f) => f.endsWith(ext)).map((f) => path.join(dir, f));
|
|
9
|
+
}
|
|
10
|
+
function extractPlannedFiles(planContent) {
|
|
11
|
+
const files = [];
|
|
12
|
+
const regex = /- (?:Create|Modify):\s*`([^`]+)`/g;
|
|
13
|
+
let match;
|
|
14
|
+
while ((match = regex.exec(planContent)) !== null) {
|
|
15
|
+
if (match[1]) files.push(match[1]);
|
|
16
|
+
}
|
|
17
|
+
return files;
|
|
18
|
+
}
|
|
19
|
+
function getFileModTime(filePath, projectPath) {
|
|
20
|
+
try {
|
|
21
|
+
const output = execSync(`git log -1 --format=%aI -- "${filePath}"`, {
|
|
22
|
+
cwd: projectPath,
|
|
23
|
+
encoding: "utf-8",
|
|
24
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
25
|
+
}).trim();
|
|
26
|
+
return output ? new Date(output) : null;
|
|
27
|
+
} catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async function runCrossCheck(options) {
|
|
32
|
+
const result = {
|
|
33
|
+
specToPlan: [],
|
|
34
|
+
planToImpl: [],
|
|
35
|
+
staleness: [],
|
|
36
|
+
warnings: 0
|
|
37
|
+
};
|
|
38
|
+
const planFiles = findFiles(options.plansDir, ".md");
|
|
39
|
+
for (const planFile of planFiles) {
|
|
40
|
+
const content = fs.readFileSync(planFile, "utf-8");
|
|
41
|
+
const plannedFiles = extractPlannedFiles(content);
|
|
42
|
+
const planName = path.basename(planFile);
|
|
43
|
+
for (const file of plannedFiles) {
|
|
44
|
+
const fullPath = path.join(options.projectPath, file);
|
|
45
|
+
if (!fs.existsSync(fullPath)) {
|
|
46
|
+
result.planToImpl.push(`${planName}: planned file not found: ${file}`);
|
|
47
|
+
result.warnings++;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const planModTime = getFileModTime(planFile, options.projectPath);
|
|
51
|
+
if (planModTime) {
|
|
52
|
+
for (const file of plannedFiles) {
|
|
53
|
+
const fullPath = path.join(options.projectPath, file);
|
|
54
|
+
if (fs.existsSync(fullPath)) {
|
|
55
|
+
const implModTime = getFileModTime(fullPath, options.projectPath);
|
|
56
|
+
if (implModTime && implModTime > planModTime) {
|
|
57
|
+
result.staleness.push(`${planName}: implementation newer than plan (${file})`);
|
|
58
|
+
result.warnings++;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return Ok(result);
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
runCrossCheck
|
|
69
|
+
};
|