@dommaker/harness 0.6.0 → 0.6.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/README.md +92 -24
- package/bin/harness.js +17 -6
- package/dist/core/project-config-loader.d.ts +4 -0
- package/dist/core/project-config-loader.d.ts.map +1 -1
- package/dist/core/project-config-loader.js +62 -9
- package/dist/core/project-config-loader.js.map +1 -1
- package/dist/types/project-config.d.ts +11 -9
- package/dist/types/project-config.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,13 +10,15 @@
|
|
|
10
10
|
|
|
11
11
|
| 功能 | 说明 |
|
|
12
12
|
|------|------|
|
|
13
|
-
| **铁律系统** |
|
|
13
|
+
| **铁律系统** | 16 条内置约束(4 Iron Laws + 10 Guidelines + 2 Tips) |
|
|
14
14
|
| **检查点验证** | 验证工作流步骤的结果是否符合预期 |
|
|
15
15
|
| **测试门控** | 禁止自评通过,必须通过真实测试 |
|
|
16
16
|
| **Session 管理** | 启动检查点 + 结束状态管理 |
|
|
17
17
|
| **预设系统** | 提供 strict/standard/relaxed 三种预设 |
|
|
18
18
|
| **Execution Trace** | 轻量记录约束检查,异常检测,诊断系统(v0.3+) |
|
|
19
19
|
| **项目级自定义约束** | 扩展/覆盖内置约束,无需 fork(v0.4+) |
|
|
20
|
+
| **智能提示** | check 后根据条件提示下一步操作(v0.6+) |
|
|
21
|
+
| **一键流程** | harness flow 一键执行诊断+提案(v0.6+) |
|
|
20
22
|
| **CLI 工具** | 命令行工具执行检查 |
|
|
21
23
|
|
|
22
24
|
## 安装
|
|
@@ -46,12 +48,27 @@ npx harness init --preset standard
|
|
|
46
48
|
# 初始化项目配置
|
|
47
49
|
harness init --preset standard
|
|
48
50
|
|
|
51
|
+
# 输出配置代码片段(不创建文件)
|
|
52
|
+
harness init --print-snippets
|
|
53
|
+
|
|
49
54
|
# 检查铁律
|
|
50
55
|
harness check
|
|
51
56
|
|
|
52
57
|
# 列出所有铁律
|
|
53
58
|
harness check --list
|
|
54
59
|
|
|
60
|
+
# 查看状态(统计、异常、建议)
|
|
61
|
+
harness status
|
|
62
|
+
|
|
63
|
+
# 查看详细状态
|
|
64
|
+
harness status --detail
|
|
65
|
+
|
|
66
|
+
# 只显示异常
|
|
67
|
+
harness status --anomalies
|
|
68
|
+
|
|
69
|
+
# 一键执行诊断+提案流程
|
|
70
|
+
harness flow
|
|
71
|
+
|
|
55
72
|
# 验证检查点
|
|
56
73
|
harness validate
|
|
57
74
|
|
|
@@ -61,12 +78,10 @@ harness passes-gate
|
|
|
61
78
|
# 生成报告
|
|
62
79
|
harness report
|
|
63
80
|
|
|
64
|
-
#
|
|
65
|
-
harness traces stats
|
|
66
|
-
harness traces summary
|
|
67
|
-
harness traces anomalies
|
|
68
|
-
harness traces report # 生成完整报告
|
|
69
|
-
harness traces clean # 清理旧 trace 文件
|
|
81
|
+
# [已弃用] 请使用 harness status
|
|
82
|
+
harness traces stats
|
|
83
|
+
harness traces summary
|
|
84
|
+
harness traces anomalies
|
|
70
85
|
```
|
|
71
86
|
|
|
72
87
|
### 3. 在 CI 中使用
|
|
@@ -115,23 +130,26 @@ const cleaner = new CleanStateManager();
|
|
|
115
130
|
const cleanResult = await cleaner.onSessionEnd(workDir, sessionInfo);
|
|
116
131
|
```
|
|
117
132
|
|
|
118
|
-
##
|
|
119
|
-
|
|
120
|
-
| ID | 规则 | 严重性 |
|
|
121
|
-
|
|
122
|
-
| `
|
|
123
|
-
| `
|
|
124
|
-
| `no_completion_without_verification` | 完成必须有验证证据 | 🔴 error |
|
|
125
|
-
| `
|
|
126
|
-
| `
|
|
127
|
-
| `
|
|
128
|
-
| `
|
|
129
|
-
| `
|
|
130
|
-
| `
|
|
131
|
-
| `
|
|
132
|
-
| `
|
|
133
|
-
| `
|
|
134
|
-
| `
|
|
133
|
+
## 内置约束(16 条)
|
|
134
|
+
|
|
135
|
+
| ID | 规则 | 层级 | 严重性 |
|
|
136
|
+
|---|------|------|:------:|
|
|
137
|
+
| `no_bypass_checkpoint` | 禁止跳过检查点 | iron_law | 🔴 error |
|
|
138
|
+
| `no_self_approval` | 禁止自评通过 | iron_law | 🔴 error |
|
|
139
|
+
| `no_completion_without_verification` | 完成必须有验证证据 | iron_law | 🔴 error |
|
|
140
|
+
| `no_test_simplification` | 禁止擅自简化测试 | iron_law | 🔴 error |
|
|
141
|
+
| `no_fix_without_root_cause` | 修复前必须找到根因 | guideline | 🔴 error |
|
|
142
|
+
| `no_code_without_test` | 写代码前必须有测试 | guideline | 🔴 error |
|
|
143
|
+
| `no_any_type` | 禁止使用 any 类型 | guideline | 🟡 warning |
|
|
144
|
+
| `simplest_solution_first` | 优先选择最简方案 | guideline | 🟡 warning |
|
|
145
|
+
| `no_creation_without_reuse_check` | 创建前必须检查可复用 | guideline | 🟡 warning |
|
|
146
|
+
| `capability_sync` | 代码变更必须更新 CAPABILITIES.md | guideline | 🟡 warning |
|
|
147
|
+
| `no_simplification_without_approval` | 不能擅自简化逻辑 | guideline | 🟡 warning |
|
|
148
|
+
| `no_skill_without_test` | 创建技能前必须有测试 | guideline | 🟡 warning |
|
|
149
|
+
| `test_coverage_required` | 测试覆盖率必须达标 | guideline | 🟡 warning |
|
|
150
|
+
| `design_decision_requires_discussion` | 设计决策必须先讨论 | guideline | 🟡 warning |
|
|
151
|
+
| `readme_required` | 新模块必须有 README | tip | 🔵 info |
|
|
152
|
+
| `doc_required_for_public_api` | 公共 API 必须有文档 | tip | 🔵 info |
|
|
135
153
|
|
|
136
154
|
## 预设系统
|
|
137
155
|
|
|
@@ -141,6 +159,56 @@ const cleanResult = await cleaner.onSessionEnd(workDir, sessionInfo);
|
|
|
141
159
|
| `standard` | 标准模式,推荐使用 |
|
|
142
160
|
| `relaxed` | 宽松模式,警告不阻止 |
|
|
143
161
|
|
|
162
|
+
## 自定义约束(v0.4+)
|
|
163
|
+
|
|
164
|
+
### 扩展例外(v0.6+)
|
|
165
|
+
|
|
166
|
+
使用 `extend_exceptions` 追加例外,保留内置例外:
|
|
167
|
+
|
|
168
|
+
```yaml
|
|
169
|
+
# .harness/custom-constraints.yml
|
|
170
|
+
custom_constraints:
|
|
171
|
+
no_fix_without_root_cause:
|
|
172
|
+
extend_exceptions:
|
|
173
|
+
- my_special_case_1
|
|
174
|
+
- my_special_case_2
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
结果:内置例外 + 新增例外
|
|
178
|
+
|
|
179
|
+
### 完全覆盖
|
|
180
|
+
|
|
181
|
+
使用 `exceptions` 完全覆盖内置例外:
|
|
182
|
+
|
|
183
|
+
```yaml
|
|
184
|
+
# .harness/custom-constraints.yml
|
|
185
|
+
custom_constraints:
|
|
186
|
+
no_fix_without_root_cause:
|
|
187
|
+
level: guideline
|
|
188
|
+
rule: Do not fix without root cause
|
|
189
|
+
message: 禁止没有根因分析就修复
|
|
190
|
+
trigger: bug_fix
|
|
191
|
+
exceptions:
|
|
192
|
+
- my_only_exception
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
结果:只使用自定义例外
|
|
196
|
+
|
|
197
|
+
### 混合模式
|
|
198
|
+
|
|
199
|
+
同时使用 `exceptions` 和 `extend_exceptions`:
|
|
200
|
+
|
|
201
|
+
```yaml
|
|
202
|
+
custom_constraints:
|
|
203
|
+
no_fix_without_root_cause:
|
|
204
|
+
exceptions:
|
|
205
|
+
- my_new_exception
|
|
206
|
+
extend_exceptions:
|
|
207
|
+
- another_exception
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
结果:内置例外 + my_new_exception + another_exception
|
|
211
|
+
|
|
144
212
|
## 项目模板
|
|
145
213
|
|
|
146
214
|
提供多种项目模板:
|
package/bin/harness.js
CHANGED
|
@@ -114,16 +114,21 @@ program
|
|
|
114
114
|
});
|
|
115
115
|
|
|
116
116
|
// ========================================
|
|
117
|
-
// harness traces
|
|
117
|
+
// harness traces [DEPRECATED]
|
|
118
118
|
// ========================================
|
|
119
119
|
program
|
|
120
120
|
.command('traces [subcommand]')
|
|
121
|
-
.description('
|
|
121
|
+
.description('[已弃用] 请使用 harness status')
|
|
122
122
|
.option('--hours <n>', '分析最近 N 小时', '1')
|
|
123
123
|
.option('--constraint <id>', '过滤约束 ID')
|
|
124
124
|
.option('--format <format>', '输出格式 (json/text)', 'text')
|
|
125
125
|
.option('--max-age-days <n>', '清理超过 N 天的文件', '30')
|
|
126
126
|
.action(async (subcommand, options, command) => {
|
|
127
|
+
console.log('⚠️ harness traces 已弃用,请使用 harness status');
|
|
128
|
+
console.log(' harness status # 查看统计');
|
|
129
|
+
console.log(' harness status --detail # 查看详情');
|
|
130
|
+
console.log(' harness status --anomalies # 查看异常');
|
|
131
|
+
console.log();
|
|
127
132
|
const sub = subcommand || 'stats';
|
|
128
133
|
await tracesCommand(sub, {
|
|
129
134
|
hours: parseInt(options.hours, 10),
|
|
@@ -134,17 +139,20 @@ program
|
|
|
134
139
|
});
|
|
135
140
|
|
|
136
141
|
// ========================================
|
|
137
|
-
// harness diagnose
|
|
142
|
+
// harness diagnose [DEPRECATED]
|
|
138
143
|
// ========================================
|
|
139
144
|
program
|
|
140
145
|
.command('diagnose [subcommand]')
|
|
141
|
-
.description('
|
|
146
|
+
.description('[已弃用] 请使用 harness flow')
|
|
142
147
|
.option('--hours <n>', '分析最近 N 小时', '24')
|
|
143
148
|
.option('--constraint <id>', '过滤约束 ID')
|
|
144
149
|
.option('--anomaly <id>', '特定异常 ID')
|
|
145
150
|
.option('--format <format>', '输出格式 (json/text)', 'text')
|
|
146
151
|
.option('--save', '保存诊断结果', false)
|
|
147
152
|
.action(async (subcommand, options, command) => {
|
|
153
|
+
console.log('⚠️ harness diagnose 已弃用,请使用 harness flow');
|
|
154
|
+
console.log(' harness flow # 一键执行诊断 + 提案流程');
|
|
155
|
+
console.log();
|
|
148
156
|
const sub = subcommand || 'list';
|
|
149
157
|
await diagnoseCommand(sub, {
|
|
150
158
|
hours: parseInt(options.hours, 10),
|
|
@@ -156,11 +164,11 @@ program
|
|
|
156
164
|
});
|
|
157
165
|
|
|
158
166
|
// ========================================
|
|
159
|
-
// harness propose
|
|
167
|
+
// harness propose [DEPRECATED]
|
|
160
168
|
// ========================================
|
|
161
169
|
program
|
|
162
170
|
.command('propose [subcommand]')
|
|
163
|
-
.description('
|
|
171
|
+
.description('[已弃用] 请使用 harness flow')
|
|
164
172
|
.option('--diagnosis <id>', '诊断 ID')
|
|
165
173
|
.option('--status <status>', '过滤状态')
|
|
166
174
|
.option('--format <format>', '输出格式 (json/text)', 'text')
|
|
@@ -169,6 +177,9 @@ program
|
|
|
169
177
|
.option('--reject', '拒绝提案', false)
|
|
170
178
|
.option('--comment <text>', '审核意见')
|
|
171
179
|
.action(async (subcommand, options, command) => {
|
|
180
|
+
console.log('⚠️ harness propose 已弃用,请使用 harness flow');
|
|
181
|
+
console.log(' harness flow # 一键执行诊断 + 提案流程');
|
|
182
|
+
console.log();
|
|
172
183
|
const sub = subcommand || 'list';
|
|
173
184
|
await proposeCommand(sub, {
|
|
174
185
|
diagnosisId: options.diagnosis,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-config-loader.d.ts","sourceRoot":"","sources":["../../src/core/project-config-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EACV,aAAa,EACb,0BAA0B,EAC1B,uBAAuB,EACxB,MAAM,yBAAyB,CAAC;AAWjC;;GAEG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,iBAAiB,CAA6C;gBAE1D,WAAW,CAAC,EAAE,MAAM;IAMhC;;OAEG;IACH,IAAI,IAAI,aAAa;IAerB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAyB7B;;OAEG;IACH,gBAAgB,IAAI,uBAAuB;
|
|
1
|
+
{"version":3,"file":"project-config-loader.d.ts","sourceRoot":"","sources":["../../src/core/project-config-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EACV,aAAa,EACb,0BAA0B,EAC1B,uBAAuB,EACxB,MAAM,yBAAyB,CAAC;AAWjC;;GAEG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,iBAAiB,CAA6C;gBAE1D,WAAW,CAAC,EAAE,MAAM;IAMhC;;OAEG;IACH,IAAI,IAAI,aAAa;IAerB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAyB7B;;OAEG;IACH,gBAAgB,IAAI,uBAAuB;IA2F3C;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAO7B;;OAEG;IACH,OAAO,CAAC,YAAY;IAcpB;;OAEG;IACH,SAAS,IAAI,aAAa;IAI1B;;OAEG;IACH,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC;IAIlE;;OAEG;IACH,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;IAclD;;OAEG;IACH,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU;IAU7E;;OAEG;IACH,eAAe,IAAI,OAAO;CAM3B;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAEnF"}
|
|
@@ -122,12 +122,59 @@ class ProjectConfigLoader {
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
|
|
125
|
+
/**
|
|
126
|
+
* 添加自定义约束
|
|
127
|
+
*/
|
|
126
128
|
for (const [id, customDef] of Object.entries(this.customConstraints)) {
|
|
127
|
-
|
|
129
|
+
// 检查是否是纯扩展模式(只有 extend_exceptions,没有其他覆盖字段)
|
|
130
|
+
const isExtendOnly = customDef.extend_exceptions &&
|
|
131
|
+
customDef.extend_exceptions.length > 0 &&
|
|
132
|
+
!customDef.rule &&
|
|
133
|
+
!customDef.exceptions; // 没有 rule 和 exceptions 表示只是扩展例外
|
|
134
|
+
if (isExtendOnly) {
|
|
135
|
+
// 纯扩展模式:只追加例外,保留内置约束其他属性
|
|
136
|
+
const builtIn = this.findBuiltInConstraint(id, result);
|
|
137
|
+
if (builtIn) {
|
|
138
|
+
// 复制内置约束
|
|
139
|
+
const constraint = { ...builtIn };
|
|
140
|
+
// 合并例外
|
|
141
|
+
constraint.exceptions = [
|
|
142
|
+
...(builtIn.exceptions || []),
|
|
143
|
+
...customDef.extend_exceptions,
|
|
144
|
+
];
|
|
145
|
+
// 更新到对应层级
|
|
146
|
+
if (result.ironLaws[id])
|
|
147
|
+
result.ironLaws[id] = constraint;
|
|
148
|
+
if (result.guidelines[id])
|
|
149
|
+
result.guidelines[id] = constraint;
|
|
150
|
+
if (result.tips[id])
|
|
151
|
+
result.tips[id] = constraint;
|
|
152
|
+
continue; // 跳过后续处理
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
// 完整定义模式:创建新约束
|
|
156
|
+
const constraint = this.toConstraint(customDef, id);
|
|
157
|
+
// 处理 extend_exceptions + 其他字段的情况
|
|
158
|
+
if (customDef.extend_exceptions && customDef.extend_exceptions.length > 0) {
|
|
159
|
+
const builtIn = this.findBuiltInConstraint(id, result);
|
|
160
|
+
if (builtIn) {
|
|
161
|
+
constraint.exceptions = [
|
|
162
|
+
...(builtIn.exceptions || []),
|
|
163
|
+
...(customDef.exceptions || []),
|
|
164
|
+
...customDef.extend_exceptions,
|
|
165
|
+
];
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
constraint.exceptions = [
|
|
169
|
+
...(customDef.exceptions || []),
|
|
170
|
+
...customDef.extend_exceptions,
|
|
171
|
+
];
|
|
172
|
+
}
|
|
173
|
+
}
|
|
128
174
|
result.custom.push(id);
|
|
129
175
|
// 根据层级添加到对应集合
|
|
130
|
-
|
|
176
|
+
const level = customDef.level || 'guideline';
|
|
177
|
+
switch (level) {
|
|
131
178
|
case 'iron_law':
|
|
132
179
|
result.ironLaws[id] = constraint;
|
|
133
180
|
break;
|
|
@@ -141,16 +188,22 @@ class ProjectConfigLoader {
|
|
|
141
188
|
}
|
|
142
189
|
return result;
|
|
143
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* 在合并结果中查找内置约束
|
|
193
|
+
*/
|
|
194
|
+
findBuiltInConstraint(id, merged) {
|
|
195
|
+
return merged.ironLaws[id] || merged.guidelines[id] || merged.tips[id];
|
|
196
|
+
}
|
|
144
197
|
/**
|
|
145
198
|
* 将自定义约束定义转换为 Constraint
|
|
146
199
|
*/
|
|
147
|
-
toConstraint(def) {
|
|
200
|
+
toConstraint(def, defaultId) {
|
|
148
201
|
return {
|
|
149
|
-
id: def.id,
|
|
150
|
-
level: def.level,
|
|
151
|
-
rule: def.rule,
|
|
152
|
-
message: def.message,
|
|
153
|
-
trigger: def.trigger,
|
|
202
|
+
id: def.id || defaultId,
|
|
203
|
+
level: def.level || 'guideline',
|
|
204
|
+
rule: def.rule || '',
|
|
205
|
+
message: def.message || '',
|
|
206
|
+
trigger: (def.trigger || 'manual'),
|
|
154
207
|
exceptions: def.exceptions,
|
|
155
208
|
description: def.description,
|
|
156
209
|
enabled: def.enabled !== false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-config-loader.js","sourceRoot":"","sources":["../../src/core/project-config-loader.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"project-config-loader.js","sourceRoot":"","sources":["../../src/core/project-config-loader.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoQH,8DAEC;AApQD,uCAAyB;AACzB,2CAA6B;AAC7B,8CAAgC;AAOhC,2DAAwE;AAExE;;GAEG;AACH,MAAM,cAAc,GAAkB;IACpC,MAAM,EAAE,UAAU;IAClB,uBAAuB,EAAE,wBAAwB;CAClD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E,CAAC;YACzC,OAAO,QAAQ,CAAC;QAClB,CAAC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,eAAe;QACb,OAAO,CACL,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,MAAM,GAAG,CAAC;YAC9C,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAC3F,CAAC;IACJ,CAAC;CACF;AAvOD,kDAuOC;AAED;;GAEG;AACH,SAAgB,yBAAyB,CAAC,WAAoB;IAC5D,OAAO,IAAI,mBAAmB,CAAC,WAAW,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -10,16 +10,18 @@ import type { Constraint, ConstraintLevel } from './constraint';
|
|
|
10
10
|
export interface CustomConstraintDefinition {
|
|
11
11
|
/** 约束 ID */
|
|
12
12
|
id: string;
|
|
13
|
-
/**
|
|
14
|
-
level
|
|
15
|
-
/**
|
|
16
|
-
rule
|
|
17
|
-
/**
|
|
18
|
-
message
|
|
19
|
-
/**
|
|
20
|
-
trigger
|
|
21
|
-
/**
|
|
13
|
+
/** 约束层级(扩展例外时可省略,自动使用内置约束层级) */
|
|
14
|
+
level?: ConstraintLevel;
|
|
15
|
+
/** 约束规则(扩展例外时可省略) */
|
|
16
|
+
rule?: string;
|
|
17
|
+
/** 约束消息(扩展例外时可省略) */
|
|
18
|
+
message?: string;
|
|
19
|
+
/** 触发条件(扩展例外时可省略) */
|
|
20
|
+
trigger?: string | string[];
|
|
21
|
+
/** 例外条件(可选,完全覆盖内置例外) */
|
|
22
22
|
exceptions?: string[];
|
|
23
|
+
/** 扩展例外(可选,追加到内置例外) */
|
|
24
|
+
extend_exceptions?: string[];
|
|
23
25
|
/** 描述(可选) */
|
|
24
26
|
description?: string;
|
|
25
27
|
/** 是否启用(可选,默认 true) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-config.d.ts","sourceRoot":"","sources":["../../src/types/project-config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,YAAY;IACZ,EAAE,EAAE,MAAM,CAAC;IAEX,
|
|
1
|
+
{"version":3,"file":"project-config.d.ts","sourceRoot":"","sources":["../../src/types/project-config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,YAAY;IACZ,EAAE,EAAE,MAAM,CAAC;IAEX,gCAAgC;IAChC,KAAK,CAAC,EAAE,eAAe,CAAC;IAExB,qBAAqB;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,qBAAqB;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,qBAAqB;IACrB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE5B,wBAAwB;IACxB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB,uBAAuB;IACvB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE7B,aAAa;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,uBAAuB;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,iBAAiB;IACjB,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IAEF,WAAW;IACX,MAAM,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;IAE3C,kBAAkB;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,OAAO,C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