@ai-content-space/loopx 0.1.2 → 0.1.3
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 +343 -56
- package/README.zh-CN.md +392 -0
- package/package.json +4 -1
- package/plugins/loopx/.codex-plugin/plugin.json +1 -1
- package/plugins/loopx/scripts/plugin-install.test.mjs +1 -0
- package/plugins/loopx/skills/archive/SKILL.md +39 -0
- package/plugins/loopx/skills/build/SKILL.md +111 -9
- package/plugins/loopx/skills/clarify/SKILL.md +121 -1
- package/plugins/loopx/skills/debug/SKILL.md +296 -0
- package/plugins/loopx/skills/debug/condition-based-waiting.md +115 -0
- package/plugins/loopx/skills/debug/defense-in-depth.md +122 -0
- package/plugins/loopx/skills/debug/find-polluter.sh +63 -0
- package/plugins/loopx/skills/debug/root-cause-tracing.md +169 -0
- package/plugins/loopx/skills/go-style/SKILL.md +71 -0
- package/plugins/loopx/skills/kratos/SKILL.md +74 -0
- package/plugins/loopx/skills/kratos/references/advanced-features.md +314 -0
- package/plugins/loopx/skills/kratos/references/architecture.md +488 -0
- package/plugins/loopx/skills/kratos/references/configuration.md +399 -0
- package/plugins/loopx/skills/kratos/references/http-customization.md +512 -0
- package/plugins/loopx/skills/kratos/references/middleware-logging.md +400 -0
- package/plugins/loopx/skills/kratos/references/proto-api-design.md +432 -0
- package/plugins/loopx/skills/kratos/references/security-auth.md +411 -0
- package/plugins/loopx/skills/kratos/references/troubleshooting.md +385 -0
- package/plugins/loopx/skills/plan/SKILL.md +22 -2
- package/plugins/loopx/skills/review/SKILL.md +98 -1
- package/plugins/loopx/skills/tdd/SKILL.md +371 -0
- package/plugins/loopx/skills/tdd/testing-anti-patterns.md +299 -0
- package/plugins/loopx/skills/verify/SKILL.md +139 -0
- package/scripts/codex-stop-hook.mjs +71 -0
- package/scripts/codex-workflow-hook.mjs +153 -0
- package/skills/archive/SKILL.md +39 -0
- package/skills/build/SKILL.md +111 -9
- package/skills/clarify/SKILL.md +121 -1
- package/skills/debug/SKILL.md +296 -0
- package/skills/debug/condition-based-waiting.md +115 -0
- package/skills/debug/defense-in-depth.md +122 -0
- package/skills/debug/find-polluter.sh +63 -0
- package/skills/debug/root-cause-tracing.md +169 -0
- package/skills/go-style/SKILL.md +71 -0
- package/skills/kratos/SKILL.md +74 -0
- package/skills/kratos/references/advanced-features.md +314 -0
- package/skills/kratos/references/architecture.md +488 -0
- package/skills/kratos/references/configuration.md +399 -0
- package/skills/kratos/references/http-customization.md +512 -0
- package/skills/kratos/references/middleware-logging.md +400 -0
- package/skills/kratos/references/proto-api-design.md +432 -0
- package/skills/kratos/references/security-auth.md +411 -0
- package/skills/kratos/references/troubleshooting.md +385 -0
- package/skills/plan/SKILL.md +18 -2
- package/skills/review/SKILL.md +98 -1
- package/skills/tdd/SKILL.md +371 -0
- package/skills/tdd/testing-anti-patterns.md +299 -0
- package/skills/verify/SKILL.md +139 -0
- package/src/build-runtime.mjs +303 -26
- package/src/build-stop-gate.mjs +94 -0
- package/src/cli.mjs +47 -5
- package/src/codex-exec-runtime.mjs +105 -5
- package/src/context-manifest.mjs +172 -0
- package/src/install-discovery.mjs +352 -5
- package/src/next-skill.mjs +57 -5
- package/src/plan-runtime.mjs +79 -122
- package/src/review-runtime.mjs +378 -0
- package/src/runtime-maintenance.mjs +428 -14
- package/src/template-governance.mjs +223 -0
- package/src/workflow.mjs +1941 -117
- package/src/workspace-context.mjs +166 -0
- package/src/workspace-memory.mjs +69 -0
package/src/plan-runtime.mjs
CHANGED
|
@@ -33,36 +33,32 @@ function paragraphFromSection(section, fallback) {
|
|
|
33
33
|
|
|
34
34
|
function buildSourceSummary(sourceText) {
|
|
35
35
|
return {
|
|
36
|
-
intent: paragraphFromSection(extractSection(sourceText, 'Intent'), '
|
|
37
|
-
outcome: paragraphFromSection(extractSection(sourceText, 'Desired Outcome'), '
|
|
36
|
+
intent: paragraphFromSection(extractSection(sourceText, 'Intent'), '将已批准的需求整理成可进入 build 的计划包。'),
|
|
37
|
+
outcome: paragraphFromSection(extractSection(sourceText, 'Desired Outcome'), '产出已批准的计划工件,并在执行前停止。'),
|
|
38
38
|
inScope: bulletsFromSection(extractSection(sourceText, 'In Scope'), [
|
|
39
|
-
'
|
|
40
|
-
'
|
|
41
|
-
'
|
|
39
|
+
'生成已批准的规划工件。',
|
|
40
|
+
'保持 runtime 状态机可检查。',
|
|
41
|
+
'保留显式的执行审批边界。',
|
|
42
42
|
]),
|
|
43
43
|
nonGoals: bulletsFromSection(extractSection(sourceText, 'Out of Scope / Non-goals'), [
|
|
44
|
-
'
|
|
45
|
-
'
|
|
44
|
+
'不要从 plan 直接启动执行。',
|
|
45
|
+
'不要把任务扩展到已批准范围之外。',
|
|
46
46
|
]),
|
|
47
47
|
acceptance: bulletsFromSection(extractSection(sourceText, 'Testable Acceptance Criteria'), [
|
|
48
|
-
'
|
|
49
|
-
'
|
|
48
|
+
'规划输出完整且可审阅。',
|
|
49
|
+
'验证步骤明确可执行。',
|
|
50
50
|
]),
|
|
51
51
|
constraints: bulletsFromSection(extractSection(sourceText, 'Constraints'), [
|
|
52
|
-
'
|
|
53
|
-
'
|
|
52
|
+
'保留既有 workflow 顺序。',
|
|
53
|
+
'保持规划输出稳定且可审阅。',
|
|
54
54
|
]),
|
|
55
55
|
decisions: bulletsFromSection(extractSection(sourceText, 'Decision Boundaries'), [
|
|
56
|
-
'
|
|
57
|
-
'
|
|
56
|
+
'plan 在生成已批准规划工件后停止。',
|
|
57
|
+
'执行需要显式下游批准。',
|
|
58
58
|
]),
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
function chineseBulletList(items) {
|
|
63
|
-
return items.map((item) => `- ${item}`).join('\n');
|
|
64
|
-
}
|
|
65
|
-
|
|
66
62
|
function plannerDraftFromSource({ slug, sourceText, deliberateMode }) {
|
|
67
63
|
const summary = buildSourceSummary(sourceText);
|
|
68
64
|
const executionInputs = bulletsFromSection(extractSection(sourceText, 'Execution Inputs'), []);
|
|
@@ -90,159 +86,115 @@ function plannerDraftFromSource({ slug, sourceText, deliberateMode }) {
|
|
|
90
86
|
],
|
|
91
87
|
options: [
|
|
92
88
|
{
|
|
93
|
-
name: '
|
|
94
|
-
pros: ['runtime
|
|
95
|
-
cons: ['
|
|
89
|
+
name: '在 plan runtime 内嵌编排',
|
|
90
|
+
pros: ['runtime 真相与产品契约保持一致', '由同一个状态机管理 gate 与工件'],
|
|
91
|
+
cons: ['需要额外的 adapter 边界来支撑确定性测试'],
|
|
96
92
|
},
|
|
97
93
|
{
|
|
98
|
-
name: '
|
|
99
|
-
pros: ['
|
|
100
|
-
cons: ['
|
|
94
|
+
name: '在轻量 plan 外包一层共识流程',
|
|
95
|
+
pros: ['短期 diff 更小'],
|
|
96
|
+
cons: ['wrapper 与 runtime 的事实仍然分裂', 'status 与调试信息继续碎片化'],
|
|
101
97
|
},
|
|
102
98
|
],
|
|
103
99
|
planText: [
|
|
104
|
-
`# loopx
|
|
100
|
+
`# loopx 计划: ${slug}`,
|
|
105
101
|
'',
|
|
106
|
-
'##
|
|
102
|
+
'## 需求摘要',
|
|
107
103
|
'',
|
|
108
104
|
`- ${summary.intent}`,
|
|
109
105
|
`- ${summary.outcome}`,
|
|
110
106
|
'',
|
|
111
|
-
'##
|
|
107
|
+
'## 交付物',
|
|
112
108
|
'',
|
|
113
109
|
...summary.acceptance.map((item, index) => `${index + 1}. ${item}`),
|
|
114
110
|
'',
|
|
115
|
-
'##
|
|
111
|
+
'## 实施步骤',
|
|
116
112
|
'',
|
|
117
|
-
'1.
|
|
118
|
-
'2.
|
|
119
|
-
'3.
|
|
120
|
-
'4.
|
|
121
|
-
'5.
|
|
113
|
+
'1. 为 planner、architect、critic 增加 plan orchestration adapter。',
|
|
114
|
+
'2. 在 workflow state 中记录 plan iteration、review verdict 和 execution-input blockers。',
|
|
115
|
+
'3. 从已批准的 planning source 生成中文主规划工件与 canonical plan artifacts。',
|
|
116
|
+
'4. 在 CLI status 中暴露 plan 阶段进度。',
|
|
117
|
+
'5. 为 happy path、iterate path 和 execution input 未收口路径补 deterministic regression coverage。',
|
|
122
118
|
'',
|
|
123
|
-
'##
|
|
119
|
+
'## 执行输入',
|
|
124
120
|
'',
|
|
125
121
|
...(executionInputs.length > 0 ? executionInputs.map((item) => `- ${item}`) : ['- TBD: execution inputs not yet mapped to concrete sources.']),
|
|
126
122
|
'',
|
|
127
|
-
'##
|
|
123
|
+
'## 风险',
|
|
128
124
|
'',
|
|
129
125
|
...summary.constraints.map((item) => `- ${item}`),
|
|
130
126
|
'',
|
|
131
|
-
'##
|
|
127
|
+
'## 验证',
|
|
132
128
|
'',
|
|
133
|
-
'-
|
|
134
|
-
'-
|
|
135
|
-
'-
|
|
129
|
+
'- 运行 workflow tests',
|
|
130
|
+
'- 运行 CLI status checks',
|
|
131
|
+
'- 证明 execution input blockers 与 iterate path 生效',
|
|
136
132
|
].join('\n'),
|
|
137
133
|
architectureText: [
|
|
138
|
-
`#
|
|
134
|
+
`# 架构文档: ${slug}`,
|
|
139
135
|
'',
|
|
140
|
-
'##
|
|
136
|
+
'## 目标',
|
|
141
137
|
'',
|
|
142
138
|
`- ${summary.intent}`,
|
|
143
139
|
'',
|
|
144
|
-
'##
|
|
140
|
+
'## 边界',
|
|
145
141
|
'',
|
|
146
142
|
...summary.decisions.map((item) => `- ${item}`),
|
|
147
143
|
'',
|
|
148
|
-
'##
|
|
144
|
+
'## 选定方案',
|
|
149
145
|
'',
|
|
150
|
-
'- plan runtime
|
|
151
|
-
'-
|
|
152
|
-
'- canonical plan artifacts
|
|
153
|
-
'-
|
|
146
|
+
'- plan runtime 负责 planner -> architect -> critic 闭环',
|
|
147
|
+
'- 通过专用 adapter 隔离生产编排与确定性测试',
|
|
148
|
+
'- canonical plan artifacts 保持写入 `.loopx/plans/`',
|
|
149
|
+
'- `.loopx/workflows/<slug>/` 下的主规划工件直接作为中文产物',
|
|
154
150
|
'',
|
|
155
|
-
'##
|
|
151
|
+
'## 备选方案',
|
|
156
152
|
'',
|
|
157
|
-
'-
|
|
158
|
-
'-
|
|
153
|
+
'- 保持 plan 轻量并在外层包一层流程',
|
|
154
|
+
'- 推迟 runtime 对齐,仅把 skill contract 当目标状态',
|
|
159
155
|
].join('\n'),
|
|
160
156
|
developmentPlanText: [
|
|
161
|
-
`#
|
|
157
|
+
`# 开发计划: ${slug}`,
|
|
162
158
|
'',
|
|
163
|
-
'##
|
|
159
|
+
'## 执行拆解',
|
|
164
160
|
'',
|
|
165
|
-
'1.
|
|
166
|
-
'2.
|
|
167
|
-
'3.
|
|
168
|
-
'4.
|
|
161
|
+
'1. 扩展 plan state schema 与 status 输出。',
|
|
162
|
+
'2. 实现带有有界迭代的 planner/architect/critic 编排。',
|
|
163
|
+
'3. 直接输出中文主规划工件与 canonical plan artifacts。',
|
|
164
|
+
'4. 增加 deterministic test seams 与 regression coverage。',
|
|
169
165
|
'',
|
|
170
|
-
'##
|
|
166
|
+
'## 责任分工',
|
|
171
167
|
'',
|
|
172
168
|
'- owner: plan runtime',
|
|
173
169
|
'- reviewer: architect and critic',
|
|
174
|
-
'- downstream execution:
|
|
170
|
+
'- downstream execution: 仅在后续显式批准后进入',
|
|
175
171
|
'',
|
|
176
|
-
'##
|
|
172
|
+
'## 时序要求',
|
|
177
173
|
'',
|
|
178
|
-
'-
|
|
179
|
-
'-
|
|
180
|
-
'-
|
|
174
|
+
'- architect 未完成前不得运行 critic',
|
|
175
|
+
'- plan blockers 清除前不得批准 build',
|
|
176
|
+
'- plan 阶段不得自动启动执行',
|
|
181
177
|
].join('\n'),
|
|
182
178
|
testPlanText: [
|
|
183
|
-
`#
|
|
179
|
+
`# 测试计划: ${slug}`,
|
|
184
180
|
'',
|
|
185
|
-
'##
|
|
181
|
+
'## 单元测试',
|
|
186
182
|
'',
|
|
187
|
-
'-
|
|
188
|
-
'-
|
|
189
|
-
'- planner/architect/critic review artifact
|
|
183
|
+
'- plan consensus mode 的 state 初始化',
|
|
184
|
+
'- 中文主规划工件的 blocking checks',
|
|
185
|
+
'- planner/architect/critic review artifact 记录',
|
|
190
186
|
'',
|
|
191
|
-
'##
|
|
187
|
+
'## 集成测试',
|
|
192
188
|
'',
|
|
193
189
|
'- clarify -> plan happy path',
|
|
194
|
-
'- critic iterate
|
|
195
|
-
'-
|
|
196
|
-
'- execution inputs
|
|
190
|
+
'- critic iterate 再 approve 的路径',
|
|
191
|
+
'- 主规划工件缺失或非中文时的 blocking 路径',
|
|
192
|
+
'- execution inputs 缺失或标记 TBD 的 blocking 路径',
|
|
197
193
|
'',
|
|
198
|
-
'##
|
|
194
|
+
'## 可观测性',
|
|
199
195
|
'',
|
|
200
|
-
'- status
|
|
196
|
+
'- status 输出 iteration、architect review status、critic verdict 与 execution input blockers',
|
|
201
197
|
].join('\n'),
|
|
202
|
-
docs: {
|
|
203
|
-
architecture: [
|
|
204
|
-
'# 架构文档',
|
|
205
|
-
'',
|
|
206
|
-
'## 目标',
|
|
207
|
-
'',
|
|
208
|
-
'- 将 plan 运行时升级为真实的 Planner / Architect / Critic 规划闭环。',
|
|
209
|
-
'- 在 approved plan 产出后停止,不进入执行阶段。',
|
|
210
|
-
'',
|
|
211
|
-
'## 关键边界',
|
|
212
|
-
'',
|
|
213
|
-
...summary.decisions.map((item) => `- ${item}`),
|
|
214
|
-
'',
|
|
215
|
-
'## 关键约束',
|
|
216
|
-
'',
|
|
217
|
-
...summary.constraints.map((item) => `- ${item}`),
|
|
218
|
-
].join('\n'),
|
|
219
|
-
design: [
|
|
220
|
-
'# 设计文档',
|
|
221
|
-
'',
|
|
222
|
-
'## 设计要点',
|
|
223
|
-
'',
|
|
224
|
-
'- 引入 plan orchestration adapter,隔离真实编排与测试替身。',
|
|
225
|
-
'- 在 workflow state 中记录 iteration、architect review、critic verdict 和 docs blockers。',
|
|
226
|
-
'- 以 `.loopx/plans/` 为 canonical,以 `docs/<slug>/` 为中文规划文档输出。',
|
|
227
|
-
'',
|
|
228
|
-
'## 非目标',
|
|
229
|
-
'',
|
|
230
|
-
...summary.nonGoals.map((item) => `- ${item}`),
|
|
231
|
-
].join('\n'),
|
|
232
|
-
testPlan: [
|
|
233
|
-
'# 测试计划',
|
|
234
|
-
'',
|
|
235
|
-
'## 验证范围',
|
|
236
|
-
'',
|
|
237
|
-
...summary.acceptance.map((item) => `- ${item}`),
|
|
238
|
-
'',
|
|
239
|
-
'## 核心回归',
|
|
240
|
-
'',
|
|
241
|
-
'- happy path: 一轮 approve 完成',
|
|
242
|
-
'- iterate path: Critic 先 iterate 后 approve',
|
|
243
|
-
'- docs blocker: 缺文件或英文占位内容都不能完成',
|
|
244
|
-
].join('\n'),
|
|
245
|
-
},
|
|
246
198
|
preMortem,
|
|
247
199
|
principlesResolved: true,
|
|
248
200
|
optionsReviewed: true,
|
|
@@ -265,7 +217,7 @@ function reviewArtifact(kind, iteration, verdict, findings, extras = {}) {
|
|
|
265
217
|
function defaultArchitectReview({ plannerDraft, iteration }) {
|
|
266
218
|
const findings = [
|
|
267
219
|
'Real planning orchestration needs an adapter seam so production runtime and deterministic tests can share one state machine.',
|
|
268
|
-
'Plan completion should depend on blocking
|
|
220
|
+
'Plan completion should depend on blocking workflow planning artifacts, not only canonical plan artifacts.',
|
|
269
221
|
];
|
|
270
222
|
return reviewArtifact('architect', iteration, 'approve', findings, {
|
|
271
223
|
status: 'complete',
|
|
@@ -275,7 +227,13 @@ function defaultArchitectReview({ plannerDraft, iteration }) {
|
|
|
275
227
|
}
|
|
276
228
|
|
|
277
229
|
function containsChinese(text) {
|
|
278
|
-
|
|
230
|
+
const chineseChars = text.match(/[\u3400-\u9fff]/g) || [];
|
|
231
|
+
const latinChars = text.match(/[A-Za-z]/g) || [];
|
|
232
|
+
const signalChars = chineseChars.length + latinChars.length;
|
|
233
|
+
if (signalChars === 0) {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
return chineseChars.length >= 40 || (chineseChars.length >= 8 && chineseChars.length / signalChars >= 0.2);
|
|
279
237
|
}
|
|
280
238
|
|
|
281
239
|
function defaultCriticReview({ plannerDraft, iteration }) {
|
|
@@ -295,8 +253,8 @@ function defaultCriticReview({ plannerDraft, iteration }) {
|
|
|
295
253
|
if (!plannerDraft.executionInputsResolved) {
|
|
296
254
|
findings.push('Execution inputs are not fully mapped to concrete sources.');
|
|
297
255
|
}
|
|
298
|
-
if (!containsChinese(plannerDraft.
|
|
299
|
-
findings.push('Required
|
|
256
|
+
if (!containsChinese(plannerDraft.planText) || !containsChinese(plannerDraft.architectureText) || !containsChinese(plannerDraft.developmentPlanText) || !containsChinese(plannerDraft.testPlanText)) {
|
|
257
|
+
findings.push('Required workflow planning artifacts are not Chinese.');
|
|
300
258
|
}
|
|
301
259
|
return reviewArtifact('critic', iteration, findings.length > 0 ? 'iterate' : 'approve', findings, {
|
|
302
260
|
acceptanceCriteriaTestable: plannerDraft.acceptanceCriteriaTestable,
|
|
@@ -378,7 +336,6 @@ export function createRealPlanAdapter({ model } = {}) {
|
|
|
378
336
|
' "architectureText": string,',
|
|
379
337
|
' "developmentPlanText": string,',
|
|
380
338
|
' "testPlanText": string,',
|
|
381
|
-
' "docs": {"architecture": string, "design": string, "testPlan": string},',
|
|
382
339
|
' "principlesResolved": boolean,',
|
|
383
340
|
' "optionsReviewed": boolean,',
|
|
384
341
|
' "acceptanceCriteriaTestable": boolean,',
|
|
@@ -387,7 +344,7 @@ export function createRealPlanAdapter({ model } = {}) {
|
|
|
387
344
|
'}',
|
|
388
345
|
`Deliberate mode: ${Boolean(context.deliberateMode)}`,
|
|
389
346
|
'',
|
|
390
|
-
'Use Chinese for
|
|
347
|
+
'Use Chinese for planText / architectureText / developmentPlanText / testPlanText.',
|
|
391
348
|
'Do not ask questions. Do not wrap JSON in markdown.',
|
|
392
349
|
'',
|
|
393
350
|
'Source requirements:',
|