create-done-coding 0.11.24-alpha.0 → 0.11.24-alpha.2
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/es/cli.mjs +1 -1
- package/es/index.mjs +35 -33
- package/es/{main-91cd02df.js → main-07f91bb3.js} +23 -21
- package/package.json +2 -2
- package/types/index.d.ts +1 -1
package/es/cli.mjs
CHANGED
package/es/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { i as
|
|
3
|
-
import { G as j, S as
|
|
4
|
-
import {
|
|
2
|
+
import { i as s, F as n, g as m } from "./main-07f91bb3.js";
|
|
3
|
+
import { G as j, S as w, e as G, a as M, b as I, h as O, d as H } from "./main-07f91bb3.js";
|
|
4
|
+
import { outputConsole as i, hijackChildProcess as p, params2cliParams as l, updateEnvConfig as u } from "@done-coding/cli-utils";
|
|
5
5
|
import { createServer as d } from "@done-coding/mcp-utils";
|
|
6
6
|
import { fileURLToPath as g } from "node:url";
|
|
7
7
|
import a from "node:path";
|
|
@@ -10,39 +10,40 @@ import "@done-coding/cli-template";
|
|
|
10
10
|
import "@done-coding/cli-git";
|
|
11
11
|
import "node:child_process";
|
|
12
12
|
const f = g(import.meta.url), C = a.dirname(f), E = [
|
|
13
|
-
(
|
|
14
|
-
|
|
13
|
+
(r, o) => r.registerTool(
|
|
14
|
+
s.cliConfig.moduleName,
|
|
15
15
|
{
|
|
16
|
-
title: `创建项目工具 - ${
|
|
16
|
+
title: `创建项目工具 - ${s.name}`,
|
|
17
17
|
description: "根据用户提供的项目名称、模板地址和分支创建新项目",
|
|
18
18
|
inputSchema: o.object({
|
|
19
|
-
[
|
|
20
|
-
[
|
|
21
|
-
[
|
|
19
|
+
[n.PROJECT_NAME]: o.string().min(1, "项目名称不能为空").describe("项目名称"),
|
|
20
|
+
[n.TEMPLATE_GIT_PATH]: o.string().min(1, "模板仓库地址不能为空").describe("模板仓库地址"),
|
|
21
|
+
[n.TEMPLATE_GIT_BRANCH]: o.string().optional().describe("对应的 Git 分支名称")
|
|
22
22
|
})
|
|
23
23
|
},
|
|
24
24
|
async (t) => {
|
|
25
|
+
i.info(`当前运行目录: ${process.cwd()}`);
|
|
25
26
|
try {
|
|
26
27
|
const e = {
|
|
27
28
|
...t,
|
|
28
29
|
skipTemplateCompile: !0,
|
|
29
30
|
openGitDetailOptimize: !1
|
|
30
|
-
},
|
|
31
|
+
}, c = a.resolve(C, "./cli.mjs");
|
|
31
32
|
return await p({
|
|
32
33
|
command: "node",
|
|
33
|
-
args: [
|
|
34
|
+
args: [c, ...l(e)],
|
|
34
35
|
cwd: process.cwd(),
|
|
35
36
|
env: process.env
|
|
36
|
-
}),
|
|
37
|
+
}), i.success("项目创建成功"), {
|
|
37
38
|
content: [
|
|
38
39
|
{
|
|
39
40
|
type: "text",
|
|
40
|
-
text: `✅ 项目 [${t[
|
|
41
|
+
text: `✅ 项目 [${t[n.PROJECT_NAME]}] 创建成功!`
|
|
41
42
|
}
|
|
42
43
|
]
|
|
43
44
|
};
|
|
44
45
|
} catch (e) {
|
|
45
|
-
return
|
|
46
|
+
return i.error("项目创建失败", (e == null ? void 0 : e.message) || e), {
|
|
46
47
|
isError: !0,
|
|
47
48
|
content: [
|
|
48
49
|
{ type: "text", text: `❌ 创建失败: ${(e == null ? void 0 : e.message) || e}` }
|
|
@@ -52,17 +53,18 @@ const f = g(import.meta.url), C = a.dirname(f), E = [
|
|
|
52
53
|
}
|
|
53
54
|
)
|
|
54
55
|
], T = [
|
|
55
|
-
(
|
|
56
|
-
`${
|
|
57
|
-
`resource:///${
|
|
56
|
+
(r) => r.registerResource(
|
|
57
|
+
`${s.cliConfig.moduleName}/templates`,
|
|
58
|
+
`resource:///${s.cliConfig.moduleName}/templates`,
|
|
58
59
|
{
|
|
59
60
|
title: "可用项目模板列表",
|
|
60
61
|
description: "包含所有可用的项目模板信息、仓库地址及可选分支"
|
|
61
62
|
},
|
|
62
63
|
async (o) => {
|
|
63
64
|
try {
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
i.stage("获取可用项目模板列表");
|
|
66
|
+
const t = await m();
|
|
67
|
+
return i.success("获取可用项目模板列表成功"), {
|
|
66
68
|
contents: [
|
|
67
69
|
{
|
|
68
70
|
uri: o.href,
|
|
@@ -86,8 +88,8 @@ const f = g(import.meta.url), C = a.dirname(f), E = [
|
|
|
86
88
|
}
|
|
87
89
|
)
|
|
88
90
|
], h = [
|
|
89
|
-
(
|
|
90
|
-
`${
|
|
91
|
+
(r) => r.registerPrompt(
|
|
92
|
+
`${s.cliConfig.moduleName}/create-project-assistant`,
|
|
91
93
|
{
|
|
92
94
|
title: "创建项目助手",
|
|
93
95
|
description: "基于自然语言诉求创建项目"
|
|
@@ -98,34 +100,34 @@ const f = g(import.meta.url), C = a.dirname(f), E = [
|
|
|
98
100
|
role: "user",
|
|
99
101
|
content: {
|
|
100
102
|
type: "text",
|
|
101
|
-
text: `你是一个专业的项目初始化助手, 根据用户的自然语言诉求,从可用项目模板列表中挑选最匹配的选项来调用${
|
|
103
|
+
text: `你是一个专业的项目初始化助手, 根据用户的自然语言诉求,从可用项目模板列表中挑选最匹配的选项来调用${s.cliConfig.moduleName}工具创建项目`
|
|
102
104
|
}
|
|
103
105
|
}
|
|
104
106
|
]
|
|
105
107
|
})
|
|
106
108
|
)
|
|
107
|
-
],
|
|
109
|
+
], b = async () => {
|
|
108
110
|
u({
|
|
109
111
|
consoleLog: !1
|
|
110
112
|
}), await d({
|
|
111
113
|
toolRegisterList: E,
|
|
112
114
|
resourceRegisterList: T,
|
|
113
115
|
promptRegisterList: h,
|
|
114
|
-
name:
|
|
115
|
-
version:
|
|
116
|
-
}).catch((
|
|
117
|
-
|
|
116
|
+
name: s.name,
|
|
117
|
+
version: s.version
|
|
118
|
+
}).catch((r) => {
|
|
119
|
+
i.error("MCP 服务启动失败:", r), process.exit(1);
|
|
118
120
|
});
|
|
119
121
|
};
|
|
120
122
|
export {
|
|
121
|
-
|
|
123
|
+
n as FormNameEnum,
|
|
122
124
|
j as GitRemoteRepoAliasNameEnum,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
125
|
+
w as SubcommandEnum,
|
|
126
|
+
G as commandCliInfo,
|
|
127
|
+
M as crateAsSubcommand,
|
|
126
128
|
I as createCommandCliInfo,
|
|
127
129
|
O as createHandler,
|
|
128
130
|
H as handler,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
+
s as injectInfo,
|
|
132
|
+
b as setupMcpServer
|
|
131
133
|
};
|
|
@@ -7,7 +7,7 @@ import { getTargetRepoUrl as Qo } from "@done-coding/cli-git";
|
|
|
7
7
|
import { execSync as F } from "node:child_process";
|
|
8
8
|
const ie = {
|
|
9
9
|
name: "create-done-coding",
|
|
10
|
-
version: "0.11.24-alpha.
|
|
10
|
+
version: "0.11.24-alpha.2",
|
|
11
11
|
description: "项目创建命令行工具",
|
|
12
12
|
bin: {
|
|
13
13
|
"create-done-coding": "es/cli.mjs",
|
|
@@ -4138,6 +4138,11 @@ const Wp = async (e) => {
|
|
|
4138
4138
|
projectName: e
|
|
4139
4139
|
});
|
|
4140
4140
|
}, zp = () => ({
|
|
4141
|
+
[O.PROJECT_NAME]: {
|
|
4142
|
+
alias: "n",
|
|
4143
|
+
type: "string",
|
|
4144
|
+
describe: "项目名称"
|
|
4145
|
+
},
|
|
4141
4146
|
justCloneFromDoneCoding: {
|
|
4142
4147
|
alias: "clone",
|
|
4143
4148
|
type: "boolean",
|
|
@@ -4146,10 +4151,12 @@ const Wp = async (e) => {
|
|
|
4146
4151
|
hidden: !0
|
|
4147
4152
|
},
|
|
4148
4153
|
[O.TEMPLATE_GIT_PATH]: {
|
|
4154
|
+
alias: "p",
|
|
4149
4155
|
type: "string",
|
|
4150
4156
|
describe: "模板仓库地址"
|
|
4151
4157
|
},
|
|
4152
4158
|
[O.TEMPLATE_GIT_BRANCH]: {
|
|
4159
|
+
alias: "b",
|
|
4153
4160
|
type: "string",
|
|
4154
4161
|
describe: "模板仓库分支"
|
|
4155
4162
|
},
|
|
@@ -4187,11 +4194,6 @@ const Wp = async (e) => {
|
|
|
4187
4194
|
type: "string",
|
|
4188
4195
|
describe: "git细节优化:git提交信息"
|
|
4189
4196
|
}
|
|
4190
|
-
}), Vp = () => ({
|
|
4191
|
-
[O.PROJECT_NAME]: {
|
|
4192
|
-
describe: "项目名称",
|
|
4193
|
-
type: "string"
|
|
4194
|
-
}
|
|
4195
4197
|
}), Co = async (e) => {
|
|
4196
4198
|
_.info(`版本: ${ie.version}`);
|
|
4197
4199
|
const {
|
|
@@ -4340,33 +4342,33 @@ const Wp = async (e) => {
|
|
|
4340
4342
|
2. pnpm install
|
|
4341
4343
|
3. pnpm run dev
|
|
4342
4344
|
`);
|
|
4343
|
-
},
|
|
4345
|
+
}, Vp = {
|
|
4344
4346
|
command: "$0",
|
|
4345
4347
|
describe: ie.description,
|
|
4346
4348
|
options: zp(),
|
|
4347
|
-
positionals:
|
|
4349
|
+
// positionals: getPositionals(),
|
|
4348
4350
|
handler: Co
|
|
4349
|
-
},
|
|
4351
|
+
}, sh = async (e, t) => {
|
|
4350
4352
|
switch (e) {
|
|
4351
4353
|
case Qn.CREATE:
|
|
4352
4354
|
default:
|
|
4353
4355
|
return Co(t);
|
|
4354
4356
|
}
|
|
4355
|
-
}, { version:
|
|
4356
|
-
describe:
|
|
4357
|
-
version:
|
|
4358
|
-
subcommands: [
|
|
4357
|
+
}, { version: Xp, description: Qp } = ie, Ao = {
|
|
4358
|
+
describe: Qp,
|
|
4359
|
+
version: Xp,
|
|
4360
|
+
subcommands: [Vp].map(At),
|
|
4359
4361
|
demandCommandCount: 1,
|
|
4360
4362
|
rootScriptName: Wn({ packageJson: ie })
|
|
4361
4363
|
}, {
|
|
4362
|
-
cliConfig: { moduleName:
|
|
4364
|
+
cliConfig: { moduleName: Yp }
|
|
4363
4365
|
} = ie, No = (e = !1) => {
|
|
4364
|
-
const t = `${e ? `${
|
|
4366
|
+
const t = `${e ? `${Yp} ` : ""}[projectName]`, n = `$0 ${t.trim()}`;
|
|
4365
4367
|
return { command: t, usage: n };
|
|
4366
|
-
},
|
|
4368
|
+
}, ih = async () => Jo({
|
|
4367
4369
|
...Ao,
|
|
4368
4370
|
...No()
|
|
4369
|
-
}),
|
|
4371
|
+
}), ah = () => At({
|
|
4370
4372
|
...Ao,
|
|
4371
4373
|
...No(!0)
|
|
4372
4374
|
});
|
|
@@ -4374,10 +4376,10 @@ export {
|
|
|
4374
4376
|
O as F,
|
|
4375
4377
|
Ie as G,
|
|
4376
4378
|
Qn as S,
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4379
|
+
ah as a,
|
|
4380
|
+
Vp as b,
|
|
4381
|
+
ih as c,
|
|
4382
|
+
sh as d,
|
|
4381
4383
|
Ao as e,
|
|
4382
4384
|
Yo as g,
|
|
4383
4385
|
Co as h,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-done-coding",
|
|
3
|
-
"version": "0.11.24-alpha.
|
|
3
|
+
"version": "0.11.24-alpha.2",
|
|
4
4
|
"description": "项目创建命令行工具",
|
|
5
5
|
"module": "es/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"engines": {
|
|
55
55
|
"node": ">=18.0.0"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "5d5902512768d2608ea54c88e9773a57765b07e8"
|
|
58
58
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -120,7 +120,7 @@ export declare const handler: (command: SubcommandEnum, argv: CliHandlerArgv<any
|
|
|
120
120
|
|
|
121
121
|
export declare const injectInfo: {
|
|
122
122
|
"name": "create-done-coding",
|
|
123
|
-
"version": "0.11.24-alpha.
|
|
123
|
+
"version": "0.11.24-alpha.2",
|
|
124
124
|
"description": "项目创建命令行工具",
|
|
125
125
|
"bin": {
|
|
126
126
|
"create-done-coding": "es/cli.mjs",
|