@dommaker/harness 0.3.0 → 0.3.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.
Files changed (2) hide show
  1. package/bin/harness.js +81 -3
  2. package/package.json +1 -1
package/bin/harness.js CHANGED
@@ -7,14 +7,24 @@
7
7
  */
8
8
 
9
9
  const { Command } = require('commander');
10
- const { check, listLaws, validate, runPassesGate, init, report } = require('../dist/cli/commands/index');
10
+ const {
11
+ check,
12
+ listLaws,
13
+ validate,
14
+ runPassesGate,
15
+ init,
16
+ report,
17
+ tracesCommand,
18
+ diagnoseCommand,
19
+ proposeCommand
20
+ } = require('../dist/cli/commands/index');
11
21
 
12
22
  const program = new Command();
13
23
 
14
24
  program
15
25
  .name('harness')
16
- .description('通用工程约束框架 - 铁律系统、检查点验证、测试门控')
17
- .version('0.1.0');
26
+ .description('通用工程约束框架 - 铁律系统、检查点验证、测试门控、执行追踪')
27
+ .version('0.3.0');
18
28
 
19
29
  // ========================================
20
30
  // harness check
@@ -100,5 +110,73 @@ program
100
110
  await report(options);
101
111
  });
102
112
 
113
+ // ========================================
114
+ // harness traces
115
+ // ========================================
116
+ program
117
+ .command('traces [subcommand]')
118
+ .description('Execution Trace 分析')
119
+ .option('--hours <n>', '分析最近 N 小时', '1')
120
+ .option('--constraint <id>', '过滤约束 ID')
121
+ .option('--format <format>', '输出格式 (json/text)', 'text')
122
+ .option('--max-age-days <n>', '清理超过 N 天的文件', '30')
123
+ .action(async (subcommand, options, command) => {
124
+ const sub = subcommand || 'stats';
125
+ await tracesCommand(sub, {
126
+ hours: parseInt(options.hours, 10),
127
+ constraintId: options.constraint,
128
+ format: options.format,
129
+ maxAgeDays: parseInt(options.maxAgeDays, 10),
130
+ });
131
+ });
132
+
133
+ // ========================================
134
+ // harness diagnose
135
+ // ========================================
136
+ program
137
+ .command('diagnose [subcommand]')
138
+ .description('约束诊断')
139
+ .option('--hours <n>', '分析最近 N 小时', '24')
140
+ .option('--constraint <id>', '过滤约束 ID')
141
+ .option('--anomaly <id>', '特定异常 ID')
142
+ .option('--format <format>', '输出格式 (json/text)', 'text')
143
+ .option('--save', '保存诊断结果', false)
144
+ .action(async (subcommand, options, command) => {
145
+ const sub = subcommand || 'list';
146
+ await diagnoseCommand(sub, {
147
+ hours: parseInt(options.hours, 10),
148
+ constraintId: options.constraint,
149
+ anomalyId: options.anomaly,
150
+ format: options.format,
151
+ save: options.save,
152
+ });
153
+ });
154
+
155
+ // ========================================
156
+ // harness propose
157
+ // ========================================
158
+ program
159
+ .command('propose [subcommand]')
160
+ .description('约束提案')
161
+ .option('--diagnosis <id>', '诊断 ID')
162
+ .option('--status <status>', '过滤状态')
163
+ .option('--format <format>', '输出格式 (json/text)', 'text')
164
+ .option('--save', '保存提案', false)
165
+ .option('--accept', '接受提案', false)
166
+ .option('--reject', '拒绝提案', false)
167
+ .option('--comment <text>', '审核意见')
168
+ .action(async (subcommand, options, command) => {
169
+ const sub = subcommand || 'list';
170
+ await proposeCommand(sub, {
171
+ diagnosisId: options.diagnosis,
172
+ status: options.status,
173
+ format: options.format,
174
+ save: options.save,
175
+ accept: options.accept,
176
+ reject: options.reject,
177
+ comment: options.comment,
178
+ });
179
+ });
180
+
103
181
  // 解析命令行参数
104
182
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dommaker/harness",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "通用工程约束框架 - 铁律系统、检查点验证、测试门控",
5
5
  "keywords": [
6
6
  "harness",