kcode-pi 0.1.17 → 0.1.18

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 CHANGED
@@ -405,6 +405,9 @@ ship 汇总变更、验证证据、风险和后续事项
405
405
  - 进入 `verify` 前,`EXECUTION.md` 必须逐个完成 `PLAN.md` 中的所有 `STEP-###`,并为每个步骤记录真实存在的 `evidence/...` 文件;同时必须已有 `evidence/tdd-red.md` 和 `evidence/tdd-green.md`。
406
406
  - `evidence/tdd-green.md` 必须包含真实成功输出和 `Exit: 0` 或 `退出码:0`;不能写“需在开发环境验证”“待验证”“未执行”等不确定结论。
407
407
  - 如果门禁提示 evidence 内容无效,不要反复改文案或补关键词;必须重新运行 `PLAN.md` 中声明的真实验证命令,并记录命令、Exit、STDOUT/STDERR 或工具输出。
408
+ - Java / 苍穹 / 星空旗舰版的语法和编译验证优先使用当前项目 Gradle 命令,例如 `.\gradlew.bat build`、`./gradlew build` 或 `.\gradlew.bat :模块:build`。
409
+ - C# / 企业版的语法和编译验证使用 `dotnet build`、`dotnet build <.sln>` 或 `dotnet build <.csproj>`。
410
+ - 不要写“Kingdee IDE 中编译”作为验证方式;如果构建命令无法运行,记录真实阻塞原因和残余风险,不能把它当作绿灯证据。
408
411
  - 旗舰版项目必须先检查当前项目结构。若存在 `code/`,跟随 `code/` 下的实际组织;若不存在,必须在 `PLAN.md` 记录实际源码根或目标文件。
409
412
  - 不允许凭空写 demo、sample、scaffold,或在不了解项目结构时新建猜测目录。
410
413
 
@@ -518,7 +521,7 @@ kd_cosmic_metadata 查询官方 Cosmic 表单/单据元数据
518
521
  kd_cosmic_api 查询随包 Cosmic API 知识线索
519
522
  kd_sdk_signature 从当前项目实际 SDK jar/dll 中读取类和方法签名
520
523
  kd_ksql_lint 运行官方 ok-ksql SQL/KSQL lint
521
- kd_build 按产品画像执行或 dry-run 构建
524
+ kd_build 按产品画像执行或 dry-run 构建;Java 使用 Gradle,C# 使用 dotnet build
522
525
  kd_debug 分析金蝶日志和堆栈
523
526
  ```
524
527
 
@@ -129,6 +129,8 @@ function workflowPromptForRun(cwd: string, run: NonNullable<ReturnType<typeof re
129
129
  "路径规则:在 Windows 工作区内,优先使用项目相对路径;如需绝对路径必须使用 `D:\\...` 这类 Windows 路径,禁止把路径改写成 `/mnt/d/...`、`/d/...` 等 WSL/MSYS 风格路径。",
130
130
  "execute 阶段只能写 PLAN.md 明确列出的源码文件;如果目标文件不在计划内,必须先回到 plan 更新 PLAN.md。",
131
131
  "写生产源码前必须先有红灯证据 evidence/tdd-red.md;Java/C# 还必须有 SDK 签名证据 evidence/sdk-signature.md。红绿证据可以是 kd_sdk_signature 本地 SDK 签名、API/基类/方法签名、元数据、编译、既有测试框架或外部接口最小验证,不要为了测试引入额外 jar。",
132
+ "语法/编译验证必须使用真实项目构建命令:Java/Cosmic/苍穹/星空旗舰版使用当前项目 Gradle 命令,例如 `./gradlew build`、`.\\gradlew.bat build` 或 `:模块:build`;C#/企业版使用 `dotnet build` 或 `dotnet build <.sln/.csproj>`。",
133
+ "不要写“Kingdee IDE 中编译”作为验证方式或绿灯证据;命令无法运行时,记录真实阻塞原因和残余风险,不能标记为通过。",
132
134
  "如果门禁提示 evidence 内容无效,不要通过改写结论、补关键词或反复读取文件来过关;必须重新运行 PLAN.md 中声明的真实验证命令,并记录命令、Exit、STDOUT/STDERR 或工具输出。",
133
135
  ].join("\n");
134
136
  }
@@ -365,7 +365,7 @@ const kdBuildTool = defineTool({
365
365
  description: "按产品画像运行或预览金蝶构建命令,支持 Cosmic Java 和企业版 C# 项目。",
366
366
  parameters: Type.Object({
367
367
  product: Type.String({ description: "金蝶产品:cangqiong、xinghan、flagship、cosmic 或 enterprise。" }),
368
- target: Type.Optional(Type.String({ description: "Java 可提供 Gradle/Maven task;C# 可提供 .sln/.csproj 路径。" })),
368
+ target: Type.Optional(Type.String({ description: "Java 可提供 Gradle task;C# 可提供 .sln/.csproj 路径。" })),
369
369
  dryRun: Type.Optional(Type.Boolean({ description: "只返回构建命令,不实际执行。" })),
370
370
  }),
371
371
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kcode-pi",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "面向金蝶开发的 Pi Coding Agent 启动器、工具包和 Harness 工作流",
5
5
  "type": "module",
6
6
  "private": false,
@@ -6,6 +6,8 @@ description: 在 Harness 门禁约束下执行当前金蝶实施计划。
6
6
 
7
7
  编辑代码前,先使用 `kd_plan_status` 检查当前 run。如果缺少 `PLAN.md`、`evidence/sdk-signature.md` 或门禁被阻塞,必须停止并说明缺少的文档或证据。通过后只实现 `PLAN.md` 批准的内容,并更新 `EXECUTION.md`。禁止凭记忆、模型知识或随包知识库猜 SDK 方法签名。
8
8
 
9
+ 实现后要按计划运行真实构建检查语法问题:Java 使用当前项目 Gradle 命令,例如 `.\gradlew.bat build` 或 `.\gradlew.bat :模块:build`;C# 使用 `dotnet build` 或 `dotnet build <.sln/.csproj>`。不能写“Kingdee IDE 中编译”作为验证结果;命令未运行就不能记录为绿灯证据。
10
+
9
11
  用户补充说明:
10
12
 
11
13
  {{args}}
@@ -6,6 +6,12 @@ description: 为当前金蝶 Harness run 编写实施计划。
6
6
 
7
7
  读取 `CONTEXT.md` 和 `SPEC.md`,编写或更新 `PLAN.md`。必须包含已检查的项目结构、需要查看的文件、预计修改的真实路径、必须查证的金蝶 API/元数据、SDK 签名证据、验证命令和回滚说明。Java/C# SDK 方法签名必须来自 `kd_sdk_signature` 当前项目 jar/dll、项目构建输出或官方元数据,不能凭记忆猜。
8
8
 
9
+ 验证命令必须贴近真实项目:
10
+
11
+ - Java / Cosmic / 苍穹 / 星空旗舰版:优先使用当前项目 Gradle 构建做语法和编译检查,例如 `./gradlew build`、`./gradlew :模块:build` 或 Windows 下的 `.\gradlew.bat build`。
12
+ - C# / 企业版:使用 `dotnet build` 或 `dotnet build <.sln/.csproj>` 做语法和编译检查。
13
+ - 不要写“Kingdee IDE 中编译”。如果当前机器缺少依赖导致命令无法运行,要记录真实阻塞原因,不能把未执行的编译当作绿灯证据。
14
+
9
15
  用户补充说明:
10
16
 
11
17
  {{args}}
@@ -6,6 +6,12 @@ description: 验证当前金蝶实现并收集证据。
6
6
 
7
7
  执行计划中的验证命令,收集证据,运行可用检查,并更新 `VERIFY.md`。如果某项验证无法运行,记录具体阻塞原因和残余风险。
8
8
 
9
+ 验证优先使用真实构建命令检查语法和编译:
10
+
11
+ - Java / Cosmic / 苍穹 / 星空旗舰版:运行当前项目 Gradle 命令,例如 `.\gradlew.bat build`、`.\gradlew.bat :模块:build` 或同等 Gradle task。
12
+ - C# / 企业版:运行 `dotnet build`、`dotnet build <.sln>` 或 `dotnet build <.csproj>`。
13
+ - 绿灯证据必须包含实际命令、`Exit: 0` 和输出摘要。不能用“Kingdee IDE 中编译”“需在开发环境验证”替代真实证据。
14
+
9
15
  用户补充说明:
10
16
 
11
17
  {{args}}
@@ -58,7 +58,7 @@ description: 金蝶 Cosmic 体系 Java 插件开发技能,适用于苍穹、
58
58
 
59
59
  5. 验证结果。
60
60
  - 对修改的 Java 代码运行 `kd_check`。
61
- - 条件允许时运行 `kd_build` 或计划中的 Gradle/Maven 命令。
61
+ - 条件允许时运行 `kd_build` 或计划中的 Gradle 命令,优先用 `.\gradlew.bat build`、`./gradlew build` 或最窄可行的 `:模块:build` 检查语法和编译。
62
62
  - 把验证证据写进 `EXECUTION.md`,最终验收交给 `kd-verify`。
63
63
 
64
64
  ## 硬性规则
@@ -79,7 +79,7 @@ POJO 或简单枚举场景可以简要说明后直接实现。
79
79
  写完测试后:
80
80
 
81
81
  - 使用 `kd_build` 或计划中的命令运行最窄可行 Gradle test 任务。
82
- - 如果本机缺少业务 jar 或本地配置导致 Gradle 不能运行,明确说明原因,并给出用户应在 IDE 中运行的准确任务。
82
+ - 如果本机缺少业务 jar 或本地配置导致 Gradle 不能运行,明确说明真实阻塞原因,并给出应该运行的 Gradle task;不要写“在 IDE 中运行”作为验证结论。
83
83
  - 存在 harness run 时,把测试文件和验证结果写入 `.pi/kd/runs/<run-id>/EXECUTION.md`。
84
84
 
85
85
  ## 输出要求
@@ -22,5 +22,7 @@ Rules:
22
22
  - Do not skip planned steps. Every `STEP-###` in `PLAN.md` must be marked complete in `EXECUTION.md` with a real `evidence/...` file before entering verify.
23
23
  - Before writing production source files, run the planned red check and record failing output in `evidence/tdd-red.md`. This can be `kd_sdk_signature` local SDK signature, metadata, compile/build, existing project test, or minimal external-interface evidence.
24
24
  - Before entering verify, rerun the same check and record passing output in `evidence/tdd-green.md`.
25
+ - After implementation, run the planned real build command for syntax/compile validation when available: Java uses the project Gradle command such as `.\gradlew.bat build` or `.\gradlew.bat :module:build`; C# uses `dotnet build` or `dotnet build <.sln/.csproj>`.
25
26
  - Do not add JUnit, Mockito, NUnit, xUnit, or any extra test jar/framework only to satisfy the gate. Use existing approved project test infrastructure if it already exists.
27
+ - Do not record "compile in Kingdee IDE" or "needs local development environment verification" as green evidence. If the command cannot run, record the blocker instead of marking verification passed.
26
28
  - If implementation needs a plan change, update `PLAN.md` first.
@@ -14,6 +14,8 @@ Goal:
14
14
  - List the inspected project layout and the exact target source root or file path before editing.
15
15
  - List expected files to modify.
16
16
  - List required `kd_sdk_signature`, `kd_search`, `kd_table`, metadata, and build/compile checks.
17
+ - For Java/Cosmic/Cangqiong/Flagship projects, plan a Gradle build check for syntax/compile validation, using the current project command such as `.\gradlew.bat build`, `./gradlew build`, or `.\gradlew.bat :module:build`.
18
+ - For C#/Enterprise projects, plan `dotnet build` or `dotnet build <.sln/.csproj>` for syntax/compile validation.
17
19
  - List `## Execution Steps` using `- [ ] STEP-001: ...` style IDs.
18
20
  - List `## TDD / Red-Green Checks` with red evidence, green evidence, and the command/tool or product-specific check.
19
21
  - Do not plan to add third-party test jars or frameworks only for red/green checks. For Kingdee plugin work, prefer `kd_sdk_signature` against current project jars/dlls, metadata checks, compile/build checks, existing project tests, or minimal external-interface tests.
@@ -25,6 +27,7 @@ Gate:
25
27
  - Execution must not start without `PLAN.md`.
26
28
  - A plan for 星空旗舰版 is incomplete unless it records the existing project layout and exact target path to edit. If `code/` exists, follow its actual structure; if it does not, record the discovered source root or existing target file.
27
29
  - A plan without validation commands is incomplete.
30
+ - A Java/C# plan that uses vague wording such as "compile in Kingdee IDE" instead of a real Gradle or dotnet command is incomplete.
28
31
  - A plan without structured `STEP-001` execution steps is incomplete.
29
32
  - A plan without TDD red/green checks is incomplete.
30
33
  - A plan that relies on unverified Kingdee API names is incomplete; bundled knowledge alone is not enough when local SDK jars/dlls or compile evidence are available.
@@ -10,6 +10,8 @@ Use this skill after implementation.
10
10
  Goal:
11
11
 
12
12
  - Run planned validation commands.
13
+ - For Java/Cosmic/Cangqiong/Flagship projects, run the planned Gradle command to catch syntax/compile errors, for example `.\gradlew.bat build`, `./gradlew build`, or a narrow `:module:build` task.
14
+ - For C#/Enterprise projects, run `dotnet build` or `dotnet build <.sln/.csproj>` to catch syntax/compile errors.
13
15
  - Run `kd_check` when code is available.
14
16
  - Collect evidence into `.pi/kd/runs/<run-id>/VERIFY.md`.
15
17
  - Record failures, fixes, skipped checks, and residual risk.
@@ -18,5 +20,5 @@ Rules:
18
20
 
19
21
  - Passing unit tests is not enough if acceptance criteria require workflow behavior.
20
22
  - If validation cannot run, state the exact blocker.
23
+ - Do not use "Kingdee IDE" as a verification target. Evidence must show the real command, `Exit: 0`, and useful output summary.
21
24
  - Do not ship while verification evidence is missing.
22
-
@@ -100,8 +100,11 @@ export function defaultArtifactContent(phase: KdPhase, goal?: string, profile?:
100
100
  "- 红灯证据:evidence/tdd-red.md",
101
101
  "- 绿灯证据:evidence/tdd-green.md",
102
102
  "- 红绿检查命令或工具:未知",
103
- "- 允许的检查:本地 SDK 签名查证、官方 API/基类/方法查证、元数据查证、kd_check、构建/编译输出、项目已有测试框架、外部接口最小验证。",
103
+ "- Java 语法/编译检查:优先使用当前项目 Gradle 命令,例如 `./gradlew build`、`.\\gradlew.bat build` 或 `./gradlew :模块:build`。",
104
+ "- C# 语法/编译检查:使用 `dotnet build`、`dotnet build <.sln>` 或 `dotnet build <.csproj>`。",
105
+ "- 允许的检查:本地 SDK 签名查证、官方 API/基类/方法查证、元数据查证、kd_check、Gradle/dotnet 构建输出、项目已有测试框架、外部接口最小验证。",
104
106
  "- 不要为了满足门禁引入第三方测试 jar 或框架。",
107
+ "- 不要写“Kingdee IDE 中编译”作为验证方式;命令无法运行时记录真实阻塞原因,不能作为绿灯证据。",
105
108
  "- 如果无法自动化测试,记录一个产品相关、实现前应失败且实现后应通过的检查。",
106
109
  "- 禁止凭记忆或随包知识库猜 SDK 方法签名;签名事实必须来自当前项目 jar/dll、构建输出或官方元数据。",
107
110
  "",
@@ -148,8 +148,6 @@ function planJavaBuild(cwd: string, profile: ProductProfile, target?: string): B
148
148
  const task = target ?? "build";
149
149
  const gradlewBat = join(cwd, "gradlew.bat");
150
150
  const gradlew = join(cwd, "gradlew");
151
- const mvnwBat = join(cwd, "mvnw.cmd");
152
- const mvnw = join(cwd, "mvnw");
153
151
 
154
152
  if (existsSync(gradlewBat)) {
155
153
  return buildPlan(profile, gradlewBat, [task], cwd, "检测到 Cosmic 家族 Java 项目的 Gradle wrapper。");
@@ -157,20 +155,11 @@ function planJavaBuild(cwd: string, profile: ProductProfile, target?: string): B
157
155
  if (existsSync(gradlew)) {
158
156
  return buildPlan(profile, gradlew, [task], cwd, "检测到 Cosmic 家族 Java 项目的 Gradle wrapper。");
159
157
  }
160
- if (existsSync(mvnwBat)) {
161
- return buildPlan(profile, mvnwBat, [target ?? "test"], cwd, "检测到 Cosmic 家族 Java 项目的 Maven wrapper。");
162
- }
163
- if (existsSync(mvnw)) {
164
- return buildPlan(profile, mvnw, [target ?? "test"], cwd, "检测到 Cosmic 家族 Java 项目的 Maven wrapper。");
165
- }
166
158
  if (existsSync(join(cwd, "build.gradle")) || existsSync(join(cwd, "build.gradle.kts"))) {
167
159
  return buildPlan(profile, "gradle", [task], cwd, "检测到 Gradle 构建文件,但未找到 wrapper。");
168
160
  }
169
- if (existsSync(join(cwd, "pom.xml"))) {
170
- return buildPlan(profile, "mvn", [target ?? "test"], cwd, "检测到 Maven pom.xml,但未找到 wrapper。");
171
- }
172
161
 
173
- throw new Error("未找到 Java 构建入口。期望在工作区根目录看到 gradlew、build.gradle、mvnwpom.xml。");
162
+ throw new Error("未找到 Java Gradle 构建入口。期望在工作区根目录看到 gradlew、gradlew.bat、build.gradle 或 build.gradle.kts。");
174
163
  }
175
164
 
176
165
  function planCsharpBuild(cwd: string, profile: ProductProfile, target?: string): BuildPlan {