kcode-pi 0.1.0 → 0.1.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/package.json +2 -1
- package/src/cli/kcode.ts +197 -0
- package/src/cli/main.ts +10 -0
- package/src/harness/artifacts.ts +94 -0
- package/src/harness/format.ts +30 -0
- package/src/harness/gates.ts +136 -0
- package/src/harness/paths.ts +23 -0
- package/src/harness/state.ts +117 -0
- package/src/harness/types.ts +42 -0
- package/src/knowledge/format.ts +48 -0
- package/src/knowledge/loader.ts +147 -0
- package/src/knowledge/search.ts +118 -0
- package/src/knowledge/types.ts +64 -0
- package/src/official/kingdee-skills.ts +230 -0
- package/src/product/profile.ts +115 -0
- package/src/rules/checker.ts +612 -0
- package/src/tools/build-debug.ts +214 -0
|
@@ -0,0 +1,115 @@
|
|
|
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";
|
|
6
|
+
|
|
7
|
+
export interface ProductProfile {
|
|
8
|
+
product: KdProduct;
|
|
9
|
+
displayName: string;
|
|
10
|
+
platform: KdPlatform;
|
|
11
|
+
techStack: KdTechStack;
|
|
12
|
+
language: KdLanguage;
|
|
13
|
+
knowledgeScope: KnowledgeScope;
|
|
14
|
+
requiresMetadataVerification: boolean;
|
|
15
|
+
notes: string[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const PROFILES: Record<KdProduct, ProductProfile> = {
|
|
19
|
+
unknown: {
|
|
20
|
+
product: "unknown",
|
|
21
|
+
displayName: "unknown",
|
|
22
|
+
platform: "unknown",
|
|
23
|
+
techStack: "unknown",
|
|
24
|
+
language: "unknown",
|
|
25
|
+
knowledgeScope: "common",
|
|
26
|
+
requiresMetadataVerification: true,
|
|
27
|
+
notes: ["Product is not selected; do not assume Java, C#, BOS, Cosmic, or KSQL rules."],
|
|
28
|
+
},
|
|
29
|
+
flagship: {
|
|
30
|
+
product: "flagship",
|
|
31
|
+
displayName: "Kingdee Xingkong Flagship",
|
|
32
|
+
platform: "cosmic",
|
|
33
|
+
techStack: "java-cosmic",
|
|
34
|
+
language: "java",
|
|
35
|
+
knowledgeScope: "flagship",
|
|
36
|
+
requiresMetadataVerification: true,
|
|
37
|
+
notes: ["Xingkong Flagship is Cosmic-family. Use Cosmic metadata, plugin lifecycle, SDK, and post-check constraints."],
|
|
38
|
+
},
|
|
39
|
+
cosmic: {
|
|
40
|
+
product: "cosmic",
|
|
41
|
+
displayName: "Kingdee Cosmic Platform",
|
|
42
|
+
platform: "cosmic",
|
|
43
|
+
techStack: "java-cosmic",
|
|
44
|
+
language: "java",
|
|
45
|
+
knowledgeScope: "cosmic",
|
|
46
|
+
requiresMetadataVerification: true,
|
|
47
|
+
notes: ["Cosmic is the shared platform base for Cangqiong, Xinghan, and Xingkong Flagship."],
|
|
48
|
+
},
|
|
49
|
+
xinghan: {
|
|
50
|
+
product: "xinghan",
|
|
51
|
+
displayName: "Kingdee Xinghan",
|
|
52
|
+
platform: "cosmic",
|
|
53
|
+
techStack: "java-cosmic",
|
|
54
|
+
language: "java",
|
|
55
|
+
knowledgeScope: "xinghan",
|
|
56
|
+
requiresMetadataVerification: true,
|
|
57
|
+
notes: ["Treat as Cosmic-family Java unless a Xinghan-specific rule overrides it."],
|
|
58
|
+
},
|
|
59
|
+
cangqiong: {
|
|
60
|
+
product: "cangqiong",
|
|
61
|
+
displayName: "Kingdee Cangqiong",
|
|
62
|
+
platform: "cosmic",
|
|
63
|
+
techStack: "java-cosmic",
|
|
64
|
+
language: "java",
|
|
65
|
+
knowledgeScope: "cangqiong",
|
|
66
|
+
requiresMetadataVerification: true,
|
|
67
|
+
notes: ["Use Cangqiong/Cosmic plugin, SDK, metadata, KSQL, and lifecycle rules."],
|
|
68
|
+
},
|
|
69
|
+
enterprise: {
|
|
70
|
+
product: "enterprise",
|
|
71
|
+
displayName: "Kingdee Enterprise",
|
|
72
|
+
platform: "enterprise-csharp",
|
|
73
|
+
techStack: "csharp-bos",
|
|
74
|
+
language: "csharp",
|
|
75
|
+
knowledgeScope: "enterprise",
|
|
76
|
+
requiresMetadataVerification: true,
|
|
77
|
+
notes: ["Use enterprise C# stack. Java plugin rules and Cosmic APIs are not applicable."],
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const PRODUCT_ALIASES: Array<[RegExp, KdProduct]> = [
|
|
82
|
+
[/企业版|enterprise|csharp|c#|\.net/i, "enterprise"],
|
|
83
|
+
[/星瀚|xinghan/i, "xinghan"],
|
|
84
|
+
[/苍穹|cangqiong/i, "cangqiong"],
|
|
85
|
+
[/cosmic|云苍穹/i, "cosmic"],
|
|
86
|
+
[/星空旗舰版|星空旗舰|旗舰版|旗舰|flagship/i, "flagship"],
|
|
87
|
+
];
|
|
88
|
+
|
|
89
|
+
export function profileForProduct(product: KdProduct | undefined): ProductProfile {
|
|
90
|
+
return PROFILES[product ?? "unknown"] ?? PROFILES.unknown;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function resolveProductProfile(input: string | undefined): ProductProfile {
|
|
94
|
+
const text = input?.trim();
|
|
95
|
+
if (!text) return profileForProduct("unknown");
|
|
96
|
+
|
|
97
|
+
for (const [pattern, product] of PRODUCT_ALIASES) {
|
|
98
|
+
if (pattern.test(text)) return profileForProduct(product);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return profileForProduct("unknown");
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function normalizeProduct(value: string | undefined): KdProduct {
|
|
105
|
+
return resolveProductProfile(value).product;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function isKnownProduct(product: KdProduct | undefined): boolean {
|
|
109
|
+
return Boolean(product && product !== "unknown");
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function formatProductProfile(profile: ProductProfile | undefined): string {
|
|
113
|
+
const resolved = profile ?? profileForProduct("unknown");
|
|
114
|
+
return `${resolved.product}/${resolved.platform}/${resolved.techStack}/${resolved.language}`;
|
|
115
|
+
}
|