kcode-pi 0.1.2 → 0.1.5
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 +378 -171
- package/dist/cli/kcode.d.ts +1 -0
- package/dist/cli/kcode.js +15 -1
- package/dist/context/project-context.d.ts +9 -0
- package/dist/context/project-context.js +193 -0
- package/docs/DEVELOPMENT.md +162 -0
- package/docs/KCODE_DISTRIBUTION.md +1 -1
- package/extensions/kingdee-harness.ts +122 -0
- package/extensions/kingdee-tools.ts +9 -5
- package/knowledge/enterprise-python/python-plugin.md +134 -0
- package/package.json +2 -2
- package/skills/kd-cosmic-dev/SKILL.md +2 -0
- package/skills/kd-cosmic-unittest/SKILL.md +1 -0
- package/skills/kd-enterprise-python-plugin/SKILL.md +43 -0
- package/skills/kd-execute/SKILL.md +6 -2
- package/skills/kd-gen/SKILL.md +1 -0
- package/skills/kd-plan/SKILL.md +7 -1
- package/src/cli/kcode.ts +16 -1
- package/src/context/project-context.ts +215 -0
- package/src/harness/artifacts.ts +35 -1
- package/src/harness/gates.ts +29 -0
- package/src/harness/path-policy.ts +83 -0
- package/src/harness/plan-steps.ts +79 -0
- package/src/harness/tdd-policy.ts +62 -0
- package/src/knowledge/types.ts +1 -1
- package/src/official/kingdee-skills.ts +549 -38
- package/src/platform/path.ts +38 -0
- package/src/product/profile.ts +29 -5
- package/src/rules/checker.ts +1 -1
- package/src/tools/build-debug.ts +7 -1
package/src/product/profile.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export type KdProduct = "unknown" | "flagship" | "cosmic" | "xinghan" | "cangqiong" | "enterprise";
|
|
2
|
-
export type KdPlatform = "unknown" | "cosmic" | "enterprise-csharp";
|
|
3
|
-
export type KdTechStack = "unknown" | "java-bos" | "java-cosmic" | "csharp-bos" | "ksql";
|
|
4
|
-
export type KdLanguage = "unknown" | "java" | "csharp" | "sql";
|
|
5
|
-
export type KnowledgeScope = "common" | "flagship" | "enterprise" | "cosmic" | "xinghan" | "cangqiong";
|
|
2
|
+
export type KdPlatform = "unknown" | "cosmic" | "enterprise-csharp" | "enterprise-python";
|
|
3
|
+
export type KdTechStack = "unknown" | "java-bos" | "java-cosmic" | "csharp-bos" | "python-bos" | "ksql";
|
|
4
|
+
export type KdLanguage = "unknown" | "java" | "csharp" | "python" | "sql";
|
|
5
|
+
export type KnowledgeScope = "common" | "flagship" | "enterprise" | "enterprise-python" | "cosmic" | "xinghan" | "cangqiong";
|
|
6
6
|
|
|
7
7
|
export interface ProductProfile {
|
|
8
8
|
product: KdProduct;
|
|
@@ -34,7 +34,11 @@ const PROFILES: Record<KdProduct, ProductProfile> = {
|
|
|
34
34
|
language: "java",
|
|
35
35
|
knowledgeScope: "flagship",
|
|
36
36
|
requiresMetadataVerification: true,
|
|
37
|
-
notes: [
|
|
37
|
+
notes: [
|
|
38
|
+
"Xingkong Flagship is Cosmic-family. Use Cosmic metadata, plugin lifecycle, SDK, and post-check constraints.",
|
|
39
|
+
"Place product code under the workspace code/ directory when that directory exists.",
|
|
40
|
+
"Before creating or editing code, inspect the existing project structure under code/ and follow its actual layout, whether it is organized by cloud, app, or no module split.",
|
|
41
|
+
],
|
|
38
42
|
},
|
|
39
43
|
cosmic: {
|
|
40
44
|
product: "cosmic",
|
|
@@ -86,6 +90,24 @@ const PRODUCT_ALIASES: Array<[RegExp, KdProduct]> = [
|
|
|
86
90
|
[/星空旗舰版|星空旗舰|旗舰版|旗舰|flagship/i, "flagship"],
|
|
87
91
|
];
|
|
88
92
|
|
|
93
|
+
const ENTERPRISE_PYTHON_PATTERN =
|
|
94
|
+
/(?:python|py)\s*(?:插件|plugin)|(?:python|py).*?(?:插件|plugin)|ironpython|(?:企业版|enterprise|星空|金蝶云星空|BOS).*?python\s*脚本|python\s*脚本.*?(?:企业版|enterprise|星空|金蝶云星空|BOS)/i;
|
|
95
|
+
|
|
96
|
+
function enterprisePythonProfile(): ProductProfile {
|
|
97
|
+
return {
|
|
98
|
+
...PROFILES.enterprise,
|
|
99
|
+
platform: "enterprise-python",
|
|
100
|
+
techStack: "python-bos",
|
|
101
|
+
language: "python",
|
|
102
|
+
knowledgeScope: "enterprise-python",
|
|
103
|
+
notes: [
|
|
104
|
+
"Use Kingdee Cloud Enterprise / BOS IronPython plugin patterns only when the user explicitly asks for Python plugin or IronPython script.",
|
|
105
|
+
"Default Enterprise plugin work remains C# unless Python plugin is explicitly requested.",
|
|
106
|
+
"Python plugins run in BOS through IronPython and call Kingdee.BOS .NET assemblies; verify plugin type, event, FormId, field keys, and registration steps before coding.",
|
|
107
|
+
],
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
89
111
|
export function profileForProduct(product: KdProduct | undefined): ProductProfile {
|
|
90
112
|
return PROFILES[product ?? "unknown"] ?? PROFILES.unknown;
|
|
91
113
|
}
|
|
@@ -94,6 +116,8 @@ export function resolveProductProfile(input: string | undefined): ProductProfile
|
|
|
94
116
|
const text = input?.trim();
|
|
95
117
|
if (!text) return profileForProduct("unknown");
|
|
96
118
|
|
|
119
|
+
if (ENTERPRISE_PYTHON_PATTERN.test(text)) return enterprisePythonProfile();
|
|
120
|
+
|
|
97
121
|
for (const [pattern, product] of PRODUCT_ALIASES) {
|
|
98
122
|
if (pattern.test(text)) return profileForProduct(product);
|
|
99
123
|
}
|
package/src/rules/checker.ts
CHANGED
package/src/tools/build-debug.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
2
2
|
import { extname, join } from "node:path";
|
|
3
3
|
import type { ProductProfile } from "../product/profile.ts";
|
|
4
|
-
import { type CommandSpec, formatCommandResult,
|
|
4
|
+
import { type CommandSpec, formatCommandResult, runCommand } from "../official/kingdee-skills.ts";
|
|
5
|
+
import { resolveWorkspacePath } from "../platform/path.ts";
|
|
5
6
|
|
|
6
7
|
export interface BuildPlan {
|
|
7
8
|
profile: string;
|
|
@@ -24,6 +25,11 @@ export function planBuild(cwd: string, profile: ProductProfile, target?: string)
|
|
|
24
25
|
|
|
25
26
|
if (profile.platform === "cosmic") return planJavaBuild(cwd, profile, target);
|
|
26
27
|
if (profile.platform === "enterprise-csharp") return planCsharpBuild(cwd, profile, target);
|
|
28
|
+
if (profile.platform === "enterprise-python") {
|
|
29
|
+
throw new Error(
|
|
30
|
+
"Enterprise Python plugins usually have no local build step. Verify by BOS registration and functional testing; record the script path, plugin type, FormId, field/entity keys, and test data in VERIFY.md.",
|
|
31
|
+
);
|
|
32
|
+
}
|
|
27
33
|
throw new Error(`No build strategy for ${profile.product}/${profile.platform}/${profile.techStack}.`);
|
|
28
34
|
}
|
|
29
35
|
|