geo-ai-search-optimization 1.3.3 → 1.3.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 CHANGED
@@ -858,6 +858,20 @@ geo-ai-search-optimization help
858
858
  - 主 `cli.js` 进一步收敛成更薄的 command router
859
859
  - 现在 flow family 和 execution family 都有独立 adapter 模块,后续继续拆 planning / delivery 会更顺
860
860
 
861
+ ## New in 1.3.4
862
+
863
+ - 继续做 CLI 架构迭代,把 planning / reporting / delivery family 也从主 `cli.js` 拆出
864
+ - 新增 `src/cli-planning-delivery-commands.js`,接管 `agent-handoff / apply-plan / completion-report / handoff-bundle / share-pack / export-pack / html-pack / publish-pack / exec-summary / fix-plan / owner-board / meeting-pack / pm-brief / roadmap / report`
865
+ - 主 `cli.js` 现在更接近纯路由层
866
+ - CLI 已经形成 `flow / execution / planning-delivery / shared` 四层 command adapter 结构
867
+
868
+ ## New in 1.3.5
869
+
870
+ - 继续做 CLI 架构迭代,把 onboarding / audit / scan / doctor / init family 也从主 `cli.js` 拆出
871
+ - 新增 `src/cli-site-ops-commands.js`,接管 `doctor / quick-start / onboard / onboard-url / init-llms / init-schema / audit / scan`
872
+ - 主 `cli.js` 现在只保留 install / skills / where / version / help 与 command routing
873
+ - CLI 已经形成 `flow / execution / planning-delivery / site-ops / shared` 五层 command adapter 结构
874
+
861
875
  ## New in 1.2.20
862
876
 
863
877
  - 新增 `agent-continue`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geo-ai-search-optimization",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "description": "Install and run a Generative Engine Optimization (GEO)-first, SEO-supported Codex skill for website optimization.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,268 @@
1
+ import { createApplyPlan, renderApplyPlanMarkdown, writeApplyPlanOutput } from "./apply-plan.js";
2
+ import { createAgentHandoff, renderAgentHandoffMarkdown, writeAgentHandoffOutput } from "./agent-handoff.js";
3
+ import {
4
+ createCompletionReport,
5
+ renderCompletionReportMarkdown,
6
+ writeCompletionReportOutput
7
+ } from "./completion-report.js";
8
+ import { createHandoffBundle, renderHandoffBundleMarkdown, writeHandoffBundleOutput } from "./handoff-bundle.js";
9
+ import { renderHtmlPackMarkdown, writeHtmlPack } from "./html-pack.js";
10
+ import { createExecSummary, renderExecSummaryMarkdown, writeExecSummaryOutput } from "./exec-summary.js";
11
+ import { renderExportPackMarkdown, writeExportPack } from "./export-pack.js";
12
+ import { createFixPlan, renderFixPlanMarkdown, writeFixPlanOutput } from "./fix-plan.js";
13
+ import { createMeetingPack, renderMeetingPackMarkdown, writeMeetingPackOutput } from "./meeting-pack.js";
14
+ import { createOwnerBoard, renderOwnerBoardMarkdown, writeOwnerBoardOutput } from "./owner-board.js";
15
+ import { createPmBrief, renderPmBriefMarkdown, writePmBriefOutput } from "./pm-brief.js";
16
+ import { renderPublishPackMarkdown, writePublishPack } from "./publish-pack.js";
17
+ import { generateReport, writeReportOutput } from "./report.js";
18
+ import { createRoadmap, renderRoadmapMarkdown, writeRoadmapOutput } from "./roadmap.js";
19
+ import { createSharePack, renderSharePackMarkdown, writeSharePackOutput } from "./share-pack.js";
20
+ import { getFlagValue, getRequiredInput, parsePositiveInteger, writeOrPrintArtifact } from "./cli-shared.js";
21
+
22
+ export const PLANNING_DELIVERY_HELP_LINES = [
23
+ " geo-ai-search-optimization agent-handoff <input> [--format <markdown|json>] [--out <file>]",
24
+ " geo-ai-search-optimization apply-plan <input> [--task <id>] [--format <markdown|json>] [--out <file>]",
25
+ " geo-ai-search-optimization completion-report <input> [--format <markdown|json>] [--out <file>]",
26
+ " geo-ai-search-optimization handoff-bundle <input> [--task <id>] [--format <markdown|json>] [--out <file>]",
27
+ " geo-ai-search-optimization share-pack <input> [--task <id>] [--format <markdown|json>] [--out <file>]",
28
+ " geo-ai-search-optimization export-pack <input> [--task <id>] [--format <markdown|json>] [--out-dir <dir>]",
29
+ " geo-ai-search-optimization html-pack <input> [--task <id>] [--out-dir <dir>]",
30
+ " geo-ai-search-optimization publish-pack <input> [--task <id>] [--out-dir <dir>]",
31
+ " geo-ai-search-optimization exec-summary <input> [--format <markdown|json>] [--out <file>]",
32
+ " geo-ai-search-optimization fix-plan <input> [--format <markdown|json>] [--out <file>]",
33
+ " geo-ai-search-optimization owner-board <input> [--format <markdown|json>] [--out <file>]",
34
+ " geo-ai-search-optimization meeting-pack <input> [--format <markdown|json>] [--out <file>]",
35
+ " geo-ai-search-optimization pm-brief <input> [--format <markdown|json>] [--out <file>]",
36
+ " geo-ai-search-optimization roadmap <input> [--format <markdown|json>] [--out <file>]",
37
+ " geo-ai-search-optimization report <input> [--mode <auto|audit|onboarding|scan>] [--format <markdown|html|json>] [--out <file>]"
38
+ ];
39
+
40
+ async function handleAgentHandoff(args) {
41
+ const input = getRequiredInput(args, "agent-handoff");
42
+ const format = getFlagValue(args, "--format");
43
+ const artifact = await createAgentHandoff(input, { format });
44
+ return writeOrPrintArtifact({
45
+ args,
46
+ commandName: "agent handoff",
47
+ artifact,
48
+ renderMarkdown: renderAgentHandoffMarkdown,
49
+ writeOutput: writeAgentHandoffOutput,
50
+ outputJson: format === "json"
51
+ });
52
+ }
53
+
54
+ async function handleApplyPlan(args) {
55
+ const input = getRequiredInput(args, "apply-plan");
56
+ const format = getFlagValue(args, "--format");
57
+ const artifact = await createApplyPlan(input, {
58
+ format,
59
+ taskId: getFlagValue(args, "--task")
60
+ });
61
+ return writeOrPrintArtifact({
62
+ args,
63
+ commandName: "apply plan",
64
+ artifact,
65
+ renderMarkdown: renderApplyPlanMarkdown,
66
+ writeOutput: writeApplyPlanOutput,
67
+ outputJson: format === "json"
68
+ });
69
+ }
70
+
71
+ async function handleCompletionReport(args) {
72
+ const input = getRequiredInput(args, "completion-report");
73
+ const format = getFlagValue(args, "--format");
74
+ const artifact = await createCompletionReport(input, { format });
75
+ return writeOrPrintArtifact({
76
+ args,
77
+ commandName: "completion report",
78
+ artifact,
79
+ renderMarkdown: renderCompletionReportMarkdown,
80
+ writeOutput: writeCompletionReportOutput,
81
+ outputJson: format === "json"
82
+ });
83
+ }
84
+
85
+ async function handleHandoffBundle(args) {
86
+ const input = getRequiredInput(args, "handoff-bundle");
87
+ const format = getFlagValue(args, "--format");
88
+ const artifact = await createHandoffBundle(input, {
89
+ format,
90
+ taskId: getFlagValue(args, "--task")
91
+ });
92
+ return writeOrPrintArtifact({
93
+ args,
94
+ commandName: "handoff bundle",
95
+ artifact,
96
+ renderMarkdown: renderHandoffBundleMarkdown,
97
+ writeOutput: writeHandoffBundleOutput,
98
+ outputJson: format === "json"
99
+ });
100
+ }
101
+
102
+ async function handleSharePack(args) {
103
+ const input = getRequiredInput(args, "share-pack");
104
+ const format = getFlagValue(args, "--format");
105
+ const artifact = await createSharePack(input, {
106
+ format,
107
+ taskId: getFlagValue(args, "--task")
108
+ });
109
+ return writeOrPrintArtifact({
110
+ args,
111
+ commandName: "share pack",
112
+ artifact,
113
+ renderMarkdown: renderSharePackMarkdown,
114
+ writeOutput: writeSharePackOutput,
115
+ outputJson: format === "json"
116
+ });
117
+ }
118
+
119
+ async function handleExportPack(args) {
120
+ const input = getRequiredInput(args, "export-pack");
121
+ const pack = await writeExportPack(input, {
122
+ format: getFlagValue(args, "--format"),
123
+ taskId: getFlagValue(args, "--task"),
124
+ outputDir: getFlagValue(args, "--out-dir")
125
+ });
126
+ process.stdout.write(renderExportPackMarkdown(pack));
127
+ }
128
+
129
+ async function handleHtmlPack(args) {
130
+ const input = getRequiredInput(args, "html-pack");
131
+ const pack = await writeHtmlPack(input, {
132
+ taskId: getFlagValue(args, "--task"),
133
+ outputDir: getFlagValue(args, "--out-dir")
134
+ });
135
+ process.stdout.write(renderHtmlPackMarkdown(pack));
136
+ }
137
+
138
+ async function handlePublishPack(args) {
139
+ const input = getRequiredInput(args, "publish-pack");
140
+ const pack = await writePublishPack(input, {
141
+ taskId: getFlagValue(args, "--task"),
142
+ outputDir: getFlagValue(args, "--out-dir")
143
+ });
144
+ process.stdout.write(renderPublishPackMarkdown(pack));
145
+ }
146
+
147
+ async function handleExecSummary(args) {
148
+ const input = getRequiredInput(args, "exec-summary");
149
+ const format = getFlagValue(args, "--format");
150
+ const artifact = await createExecSummary(input, { format });
151
+ return writeOrPrintArtifact({
152
+ args,
153
+ commandName: "exec summary",
154
+ artifact,
155
+ renderMarkdown: renderExecSummaryMarkdown,
156
+ writeOutput: writeExecSummaryOutput,
157
+ outputJson: format === "json"
158
+ });
159
+ }
160
+
161
+ async function handleFixPlan(args) {
162
+ const input = getRequiredInput(args, "fix-plan");
163
+ const format = getFlagValue(args, "--format");
164
+ const artifact = await createFixPlan(input, { format });
165
+ return writeOrPrintArtifact({
166
+ args,
167
+ commandName: "fix plan",
168
+ artifact,
169
+ renderMarkdown: renderFixPlanMarkdown,
170
+ writeOutput: writeFixPlanOutput,
171
+ outputJson: format === "json"
172
+ });
173
+ }
174
+
175
+ async function handleOwnerBoard(args) {
176
+ const input = getRequiredInput(args, "owner-board");
177
+ const format = getFlagValue(args, "--format");
178
+ const artifact = await createOwnerBoard(input, { format });
179
+ return writeOrPrintArtifact({
180
+ args,
181
+ commandName: "owner board",
182
+ artifact,
183
+ renderMarkdown: renderOwnerBoardMarkdown,
184
+ writeOutput: writeOwnerBoardOutput,
185
+ outputJson: format === "json"
186
+ });
187
+ }
188
+
189
+ async function handleMeetingPack(args) {
190
+ const input = getRequiredInput(args, "meeting-pack");
191
+ const format = getFlagValue(args, "--format");
192
+ const artifact = await createMeetingPack(input, { format });
193
+ return writeOrPrintArtifact({
194
+ args,
195
+ commandName: "meeting pack",
196
+ artifact,
197
+ renderMarkdown: renderMeetingPackMarkdown,
198
+ writeOutput: writeMeetingPackOutput,
199
+ outputJson: format === "json"
200
+ });
201
+ }
202
+
203
+ async function handlePmBrief(args) {
204
+ const input = getRequiredInput(args, "pm-brief");
205
+ const format = getFlagValue(args, "--format");
206
+ const artifact = await createPmBrief(input, { format });
207
+ return writeOrPrintArtifact({
208
+ args,
209
+ commandName: "PM brief",
210
+ artifact,
211
+ renderMarkdown: renderPmBriefMarkdown,
212
+ writeOutput: writePmBriefOutput,
213
+ outputJson: format === "json"
214
+ });
215
+ }
216
+
217
+ async function handleRoadmap(args) {
218
+ const input = getRequiredInput(args, "roadmap");
219
+ const format = getFlagValue(args, "--format");
220
+ const artifact = await createRoadmap(input, { format });
221
+ return writeOrPrintArtifact({
222
+ args,
223
+ commandName: "roadmap",
224
+ artifact,
225
+ renderMarkdown: renderRoadmapMarkdown,
226
+ writeOutput: writeRoadmapOutput,
227
+ outputJson: format === "json"
228
+ });
229
+ }
230
+
231
+ async function handleReport(args) {
232
+ const input = getRequiredInput(args, "report");
233
+ const maxFileSizeValue = getFlagValue(args, "--max-file-size");
234
+ const maxExamplesValue = getFlagValue(args, "--max-examples");
235
+ const report = await generateReport(input, {
236
+ mode: getFlagValue(args, "--mode"),
237
+ format: getFlagValue(args, "--format"),
238
+ maxFileSize: maxFileSizeValue ? parsePositiveInteger(maxFileSizeValue, "--max-file-size") : undefined,
239
+ maxExamples: maxExamplesValue ? parsePositiveInteger(maxExamplesValue, "--max-examples") : undefined
240
+ });
241
+
242
+ const outputPath = getFlagValue(args, "--out");
243
+ if (outputPath) {
244
+ const resolvedOutputPath = await writeReportOutput(outputPath, report.content);
245
+ process.stdout.write(`已保存报告:${resolvedOutputPath}\n`);
246
+ return;
247
+ }
248
+
249
+ process.stdout.write(report.content);
250
+ }
251
+
252
+ export const PLANNING_DELIVERY_COMMAND_HANDLERS = {
253
+ "agent-handoff": handleAgentHandoff,
254
+ "apply-plan": handleApplyPlan,
255
+ "completion-report": handleCompletionReport,
256
+ "handoff-bundle": handleHandoffBundle,
257
+ "share-pack": handleSharePack,
258
+ "export-pack": handleExportPack,
259
+ "html-pack": handleHtmlPack,
260
+ "publish-pack": handlePublishPack,
261
+ "exec-summary": handleExecSummary,
262
+ "fix-plan": handleFixPlan,
263
+ "owner-board": handleOwnerBoard,
264
+ "meeting-pack": handleMeetingPack,
265
+ "pm-brief": handlePmBrief,
266
+ roadmap: handleRoadmap,
267
+ report: handleReport
268
+ };
@@ -0,0 +1,201 @@
1
+ import { auditProject, renderAuditMarkdown, writeAuditOutput } from "./audit.js";
2
+ import { getFlagValue, hasFlag, parsePositiveInteger } from "./cli-shared.js";
3
+ import { renderDoctorMarkdown, runDoctor } from "./doctor.js";
4
+ import {
5
+ renderInteractiveOnboardingMarkdown,
6
+ runInteractiveOnboarding,
7
+ writeInteractiveOnboardingOutput
8
+ } from "./interactive-onboarding.js";
9
+ import { createLlmsTxt } from "./llms-txt.js";
10
+ import { createQuickStartPlan, renderQuickStartMarkdown, writeQuickStartOutput } from "./quick-start.js";
11
+ import { renderScanMarkdown, scanProject, writeScanOutput } from "./scan.js";
12
+ import { createSchemaTemplate } from "./schema.js";
13
+ import { analyzeWebsiteUrl, renderWebsiteOnboardingMarkdown, writeWebsiteOnboardingOutput } from "./url-onboarding.js";
14
+
15
+ export const SITE_OPS_HELP_LINES = [
16
+ " geo-ai-search-optimization doctor [--json]",
17
+ " geo-ai-search-optimization quick-start [--json] [--out <file>]",
18
+ " geo-ai-search-optimization onboard [--url <website-url>] [--goal <goal>] [--existing-assets <list>] [--json] [--out <file>]",
19
+ " geo-ai-search-optimization onboard-url <website-url> [--json] [--out <file>]",
20
+ " geo-ai-search-optimization init-llms [target-dir] [--site-name <name>] [--site-url <url>] [--overwrite] [--json]",
21
+ " geo-ai-search-optimization init-schema <type> [target-dir] [--site-url <url>] [--overwrite] [--json]",
22
+ " geo-ai-search-optimization audit <project-path> [--json] [--out <file>] [--max-file-size <bytes>] [--max-examples <count>]",
23
+ " geo-ai-search-optimization scan <project-path> [--json] [--out <file>] [--max-file-size <bytes>] [--max-examples <count>]"
24
+ ];
25
+
26
+ async function handleDoctor(args) {
27
+ const report = await runDoctor();
28
+ if (hasFlag(args, "--json")) {
29
+ process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
30
+ return;
31
+ }
32
+
33
+ process.stdout.write(renderDoctorMarkdown(report));
34
+ }
35
+
36
+ async function handleQuickStart(args) {
37
+ const outputJson = hasFlag(args, "--json");
38
+ const plan = createQuickStartPlan({});
39
+ const renderedOutput = outputJson ? `${JSON.stringify(plan, null, 2)}\n` : renderQuickStartMarkdown(plan);
40
+ const outputPath = getFlagValue(args, "--out");
41
+
42
+ if (outputPath) {
43
+ const resolvedOutputPath = await writeQuickStartOutput(outputPath, renderedOutput);
44
+ process.stdout.write(`已保存 quick start 输出:${resolvedOutputPath}\n`);
45
+ return;
46
+ }
47
+
48
+ process.stdout.write(renderedOutput);
49
+ }
50
+
51
+ async function handleInteractiveOnboard(args) {
52
+ const report = await runInteractiveOnboarding({
53
+ url: getFlagValue(args, "--url"),
54
+ goal: getFlagValue(args, "--goal"),
55
+ existingAssets: getFlagValue(args, "--existing-assets")
56
+ });
57
+
58
+ const outputJson = hasFlag(args, "--json");
59
+ const renderedOutput = outputJson
60
+ ? `${JSON.stringify(report, null, 2)}\n`
61
+ : renderInteractiveOnboardingMarkdown(report);
62
+ const outputPath = getFlagValue(args, "--out");
63
+
64
+ if (outputPath) {
65
+ const resolvedOutputPath = await writeInteractiveOnboardingOutput(outputPath, renderedOutput);
66
+ process.stdout.write(`已保存交互式 onboarding 结果:${resolvedOutputPath}\n`);
67
+ return;
68
+ }
69
+
70
+ process.stdout.write(renderedOutput);
71
+ }
72
+
73
+ async function handleOnboardUrl(args) {
74
+ const inputUrl = args.find((value) => !value.startsWith("-"));
75
+ if (!inputUrl) {
76
+ throw new Error("onboard-url requires a website URL");
77
+ }
78
+
79
+ const report = await analyzeWebsiteUrl(inputUrl, {});
80
+ const outputJson = hasFlag(args, "--json");
81
+ const renderedOutput = outputJson
82
+ ? `${JSON.stringify(report, null, 2)}\n`
83
+ : `${renderWebsiteOnboardingMarkdown(report)}\n`;
84
+ const outputPath = getFlagValue(args, "--out");
85
+
86
+ if (outputPath) {
87
+ const resolvedOutputPath = await writeWebsiteOnboardingOutput(outputPath, renderedOutput);
88
+ process.stdout.write(`已保存 onboarding 结果:${resolvedOutputPath}\n`);
89
+ return;
90
+ }
91
+
92
+ process.stdout.write(renderedOutput);
93
+ }
94
+
95
+ async function handleInitLlms(args) {
96
+ const targetDir = args.find((value) => !value.startsWith("-")) || ".";
97
+ const outputJson = hasFlag(args, "--json");
98
+ const result = await createLlmsTxt({
99
+ targetDir,
100
+ siteName: getFlagValue(args, "--site-name"),
101
+ siteUrl: getFlagValue(args, "--site-url"),
102
+ overwrite: hasFlag(args, "--overwrite")
103
+ });
104
+
105
+ if (outputJson) {
106
+ process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
107
+ return;
108
+ }
109
+
110
+ process.stdout.write(`Created llms.txt at ${result.outputPath}\n`);
111
+ }
112
+
113
+ async function handleInitSchema(args) {
114
+ const [schemaType, ...rest] = args;
115
+ if (!schemaType || schemaType.startsWith("-")) {
116
+ throw new Error("init-schema requires a schema type");
117
+ }
118
+
119
+ const targetDir = rest.find((value) => !value.startsWith("-")) || ".";
120
+ const outputJson = hasFlag(rest, "--json");
121
+ const result = await createSchemaTemplate({
122
+ schemaType,
123
+ targetDir,
124
+ siteUrl: getFlagValue(rest, "--site-url"),
125
+ overwrite: hasFlag(rest, "--overwrite")
126
+ });
127
+
128
+ if (outputJson) {
129
+ process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
130
+ return;
131
+ }
132
+
133
+ process.stdout.write(`Created ${result.schemaType} schema template at ${result.outputPath}\n`);
134
+ }
135
+
136
+ async function handleAudit(args) {
137
+ const projectPath = args.find((value) => !value.startsWith("-"));
138
+ if (!projectPath) {
139
+ throw new Error("audit requires a project path");
140
+ }
141
+
142
+ const report = await auditProject(projectPath, {
143
+ maxFileSize: getFlagValue(args, "--max-file-size")
144
+ ? parsePositiveInteger(getFlagValue(args, "--max-file-size"), "--max-file-size")
145
+ : undefined,
146
+ maxExamples: getFlagValue(args, "--max-examples")
147
+ ? parsePositiveInteger(getFlagValue(args, "--max-examples"), "--max-examples")
148
+ : undefined
149
+ });
150
+
151
+ const outputJson = hasFlag(args, "--json");
152
+ const renderedOutput = outputJson
153
+ ? `${JSON.stringify(report, null, 2)}\n`
154
+ : `${renderAuditMarkdown(report)}\n`;
155
+ const outputPath = getFlagValue(args, "--out");
156
+
157
+ if (outputPath) {
158
+ const resolvedOutputPath = await writeAuditOutput(outputPath, renderedOutput);
159
+ process.stdout.write(`已保存审计结果:${resolvedOutputPath}\n`);
160
+ return;
161
+ }
162
+
163
+ process.stdout.write(renderedOutput);
164
+ }
165
+
166
+ async function handleScan(args) {
167
+ const projectPath = args.find((value) => !value.startsWith("-"));
168
+ if (!projectPath) {
169
+ throw new Error("scan requires a project path");
170
+ }
171
+
172
+ const maxFileSizeValue = getFlagValue(args, "--max-file-size");
173
+ const maxExamplesValue = getFlagValue(args, "--max-examples");
174
+ const summary = await scanProject(projectPath, {
175
+ maxFileSize: maxFileSizeValue ? parsePositiveInteger(maxFileSizeValue, "--max-file-size") : undefined,
176
+ maxExamples: maxExamplesValue ? parsePositiveInteger(maxExamplesValue, "--max-examples") : undefined
177
+ });
178
+
179
+ const outputJson = hasFlag(args, "--json");
180
+ const renderedOutput = outputJson ? `${JSON.stringify(summary, null, 2)}\n` : renderScanMarkdown(summary);
181
+ const outputPath = getFlagValue(args, "--out");
182
+
183
+ if (outputPath) {
184
+ const resolvedOutputPath = await writeScanOutput(outputPath, renderedOutput);
185
+ process.stdout.write(`已保存扫描结果:${resolvedOutputPath}\n`);
186
+ return;
187
+ }
188
+
189
+ process.stdout.write(renderedOutput);
190
+ }
191
+
192
+ export const SITE_OPS_COMMAND_HANDLERS = {
193
+ doctor: handleDoctor,
194
+ "quick-start": handleQuickStart,
195
+ onboard: handleInteractiveOnboard,
196
+ "onboard-url": handleOnboardUrl,
197
+ "init-llms": handleInitLlms,
198
+ "init-schema": handleInitSchema,
199
+ audit: handleAudit,
200
+ scan: handleScan
201
+ };
package/src/cli.js CHANGED
@@ -1,46 +1,20 @@
1
- import { fileURLToPath } from "node:url";
2
1
  import { readFile } from "node:fs/promises";
3
2
  import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
4
  import {
5
5
  AGENT_EXECUTION_COMMAND_HANDLERS,
6
6
  AGENT_EXECUTION_HELP_LINES
7
7
  } from "./cli-agent-execution-commands.js";
8
8
  import { FLOW_COMMAND_HANDLERS, FLOW_HELP_LINES } from "./cli-flow-commands.js";
9
- import { getFlagValue, hasFlag, parsePositiveInteger } from "./cli-shared.js";
10
- import { createApplyPlan, renderApplyPlanMarkdown, writeApplyPlanOutput } from "./apply-plan.js";
11
- import { createAgentHandoff, renderAgentHandoffMarkdown, writeAgentHandoffOutput } from "./agent-handoff.js";
12
9
  import {
13
- createCompletionReport,
14
- renderCompletionReportMarkdown,
15
- writeCompletionReportOutput
16
- } from "./completion-report.js";
17
- import { createHandoffBundle, renderHandoffBundleMarkdown, writeHandoffBundleOutput } from "./handoff-bundle.js";
10
+ PLANNING_DELIVERY_COMMAND_HANDLERS,
11
+ PLANNING_DELIVERY_HELP_LINES
12
+ } from "./cli-planning-delivery-commands.js";
13
+ import { SITE_OPS_COMMAND_HANDLERS, SITE_OPS_HELP_LINES } from "./cli-site-ops-commands.js";
14
+ import { getFlagValue, hasFlag } from "./cli-shared.js";
18
15
  import { installSkill } from "./install-skill.js";
19
16
  import { getBundledSkillPath, getInstalledSkillPath, getSkillName, getSkillsDir } from "./paths.js";
20
- import { renderScanMarkdown, scanProject, writeScanOutput } from "./scan.js";
21
- import { renderDoctorMarkdown, runDoctor } from "./doctor.js";
22
- import { createLlmsTxt } from "./llms-txt.js";
23
- import { auditProject, renderAuditMarkdown, writeAuditOutput } from "./audit.js";
24
- import { createFixPlan, renderFixPlanMarkdown, writeFixPlanOutput } from "./fix-plan.js";
25
- import { createExecSummary, renderExecSummaryMarkdown, writeExecSummaryOutput } from "./exec-summary.js";
26
- import { renderExportPackMarkdown, writeExportPack } from "./export-pack.js";
27
- import { renderHtmlPackMarkdown, writeHtmlPack } from "./html-pack.js";
28
- import { createOwnerBoard, renderOwnerBoardMarkdown, writeOwnerBoardOutput } from "./owner-board.js";
29
- import { createMeetingPack, renderMeetingPackMarkdown, writeMeetingPackOutput } from "./meeting-pack.js";
30
- import { createPmBrief, renderPmBriefMarkdown, writePmBriefOutput } from "./pm-brief.js";
31
- import { renderPublishPackMarkdown, writePublishPack } from "./publish-pack.js";
32
- import { generateReport, writeReportOutput } from "./report.js";
33
- import { createRoadmap, renderRoadmapMarkdown, writeRoadmapOutput } from "./roadmap.js";
34
- import {
35
- renderInteractiveOnboardingMarkdown,
36
- runInteractiveOnboarding,
37
- writeInteractiveOnboardingOutput
38
- } from "./interactive-onboarding.js";
39
- import { createQuickStartPlan, renderQuickStartMarkdown, writeQuickStartOutput } from "./quick-start.js";
40
- import { createSchemaTemplate } from "./schema.js";
41
- import { createSharePack, renderSharePackMarkdown, writeSharePackOutput } from "./share-pack.js";
42
17
  import { listBundledSkills, renderBundledSkillsMarkdown } from "./skills.js";
43
- import { analyzeWebsiteUrl, renderWebsiteOnboardingMarkdown, writeWebsiteOnboardingOutput } from "./url-onboarding.js";
44
18
 
45
19
  let cachedVersion;
46
20
 
@@ -65,31 +39,10 @@ function printHelp() {
65
39
  " geo-ai-search-optimization install [--target <dir>] [--json]",
66
40
  ...FLOW_HELP_LINES,
67
41
  ...AGENT_EXECUTION_HELP_LINES,
42
+ ...PLANNING_DELIVERY_HELP_LINES,
43
+ ...SITE_OPS_HELP_LINES,
68
44
  " geo-ai-search-optimization skills [--json]",
69
45
  " geo-ai-search-optimization where",
70
- " geo-ai-search-optimization doctor [--json]",
71
- " geo-ai-search-optimization quick-start [--json] [--out <file>]",
72
- " geo-ai-search-optimization onboard [--url <website-url>] [--goal <goal>] [--existing-assets <list>] [--json] [--out <file>]",
73
- " geo-ai-search-optimization onboard-url <website-url> [--json] [--out <file>]",
74
- " geo-ai-search-optimization init-llms [target-dir] [--site-name <name>] [--site-url <url>] [--overwrite] [--json]",
75
- " geo-ai-search-optimization init-schema <type> [target-dir] [--site-url <url>] [--overwrite] [--json]",
76
- " geo-ai-search-optimization audit <project-path> [--json] [--out <file>] [--max-file-size <bytes>] [--max-examples <count>]",
77
- " geo-ai-search-optimization agent-handoff <input> [--format <markdown|json>] [--out <file>]",
78
- " geo-ai-search-optimization apply-plan <input> [--task <id>] [--format <markdown|json>] [--out <file>]",
79
- " geo-ai-search-optimization completion-report <input> [--format <markdown|json>] [--out <file>]",
80
- " geo-ai-search-optimization handoff-bundle <input> [--task <id>] [--format <markdown|json>] [--out <file>]",
81
- " geo-ai-search-optimization share-pack <input> [--task <id>] [--format <markdown|json>] [--out <file>]",
82
- " geo-ai-search-optimization export-pack <input> [--task <id>] [--format <markdown|json>] [--out-dir <dir>]",
83
- " geo-ai-search-optimization html-pack <input> [--task <id>] [--out-dir <dir>]",
84
- " geo-ai-search-optimization publish-pack <input> [--task <id>] [--out-dir <dir>]",
85
- " geo-ai-search-optimization exec-summary <input> [--format <markdown|json>] [--out <file>]",
86
- " geo-ai-search-optimization fix-plan <input> [--format <markdown|json>] [--out <file>]",
87
- " geo-ai-search-optimization owner-board <input> [--format <markdown|json>] [--out <file>]",
88
- " geo-ai-search-optimization meeting-pack <input> [--format <markdown|json>] [--out <file>]",
89
- " geo-ai-search-optimization pm-brief <input> [--format <markdown|json>] [--out <file>]",
90
- " geo-ai-search-optimization roadmap <input> [--format <markdown|json>] [--out <file>]",
91
- " geo-ai-search-optimization report <input> [--mode <auto|audit|onboarding|scan>] [--format <markdown|html|json>] [--out <file>]",
92
- " geo-ai-search-optimization scan <project-path> [--json] [--out <file>] [--max-file-size <bytes>] [--max-examples <count>]",
93
46
  " geo-ai-search-optimization version",
94
47
  " geo-ai-search-optimization help",
95
48
  "",
@@ -133,511 +86,12 @@ async function handleSkills(args) {
133
86
  process.stdout.write(renderBundledSkillsMarkdown(bundle));
134
87
  }
135
88
 
136
- async function handleDoctor(args) {
137
- const report = await runDoctor();
138
- if (hasFlag(args, "--json")) {
139
- process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
140
- return;
141
- }
142
- process.stdout.write(renderDoctorMarkdown(report));
143
- }
144
-
145
- async function handleScan(args) {
146
- const projectPath = args.find((value) => !value.startsWith("-"));
147
- if (!projectPath) {
148
- throw new Error("scan requires a project path");
149
- }
150
-
151
- const maxFileSizeValue = getFlagValue(args, "--max-file-size");
152
- const maxExamplesValue = getFlagValue(args, "--max-examples");
153
- const summary = await scanProject(projectPath, {
154
- maxFileSize: maxFileSizeValue ? parsePositiveInteger(maxFileSizeValue, "--max-file-size") : undefined,
155
- maxExamples: maxExamplesValue ? parsePositiveInteger(maxExamplesValue, "--max-examples") : undefined
156
- });
157
-
158
- const outputJson = hasFlag(args, "--json");
159
- const renderedOutput = outputJson
160
- ? `${JSON.stringify(summary, null, 2)}\n`
161
- : renderScanMarkdown(summary);
162
-
163
- const outputPath = getFlagValue(args, "--out");
164
- if (outputPath) {
165
- const resolvedOutputPath = await writeScanOutput(outputPath, renderedOutput);
166
- process.stdout.write(`已保存扫描结果:${resolvedOutputPath}\n`);
167
- return;
168
- }
169
-
170
- process.stdout.write(renderedOutput);
171
- }
172
-
173
- async function handleInitLlms(args) {
174
- const targetDir = args.find((value) => !value.startsWith("-")) || ".";
175
- const outputJson = hasFlag(args, "--json");
176
- const result = await createLlmsTxt({
177
- targetDir,
178
- siteName: getFlagValue(args, "--site-name"),
179
- siteUrl: getFlagValue(args, "--site-url"),
180
- overwrite: hasFlag(args, "--overwrite")
181
- });
182
-
183
- if (outputJson) {
184
- process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
185
- return;
186
- }
187
-
188
- process.stdout.write(`Created llms.txt at ${result.outputPath}\n`);
189
- }
190
-
191
- async function handleQuickStart(args) {
192
- const outputJson = hasFlag(args, "--json");
193
- const plan = createQuickStartPlan({});
194
- const renderedOutput = outputJson
195
- ? `${JSON.stringify(plan, null, 2)}\n`
196
- : renderQuickStartMarkdown(plan);
197
-
198
- const outputPath = getFlagValue(args, "--out");
199
- if (outputPath) {
200
- const resolvedOutputPath = await writeQuickStartOutput(outputPath, renderedOutput);
201
- process.stdout.write(`已保存 quick start 输出:${resolvedOutputPath}\n`);
202
- return;
203
- }
204
-
205
- process.stdout.write(renderedOutput);
206
- }
207
-
208
- async function handleInitSchema(args) {
209
- const [schemaType, ...rest] = args;
210
- if (!schemaType || schemaType.startsWith("-")) {
211
- throw new Error("init-schema requires a schema type");
212
- }
213
-
214
- const targetDir = rest.find((value) => !value.startsWith("-")) || ".";
215
- const outputJson = hasFlag(rest, "--json");
216
- const result = await createSchemaTemplate({
217
- schemaType,
218
- targetDir,
219
- siteUrl: getFlagValue(rest, "--site-url"),
220
- overwrite: hasFlag(rest, "--overwrite")
221
- });
222
-
223
- if (outputJson) {
224
- process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
225
- return;
226
- }
227
-
228
- process.stdout.write(`Created ${result.schemaType} schema template at ${result.outputPath}\n`);
229
- }
230
-
231
- async function handleOnboardUrl(args) {
232
- const inputUrl = args.find((value) => !value.startsWith("-"));
233
- if (!inputUrl) {
234
- throw new Error("onboard-url requires a website URL");
235
- }
236
-
237
- const report = await analyzeWebsiteUrl(inputUrl, {
238
- });
239
-
240
- const outputJson = hasFlag(args, "--json");
241
- const renderedOutput = outputJson
242
- ? `${JSON.stringify(report, null, 2)}\n`
243
- : `${renderWebsiteOnboardingMarkdown(report)}\n`;
244
-
245
- const outputPath = getFlagValue(args, "--out");
246
- if (outputPath) {
247
- const resolvedOutputPath = await writeWebsiteOnboardingOutput(outputPath, renderedOutput);
248
- process.stdout.write(`已保存 onboarding 结果:${resolvedOutputPath}\n`);
249
- return;
250
- }
251
-
252
- process.stdout.write(renderedOutput);
253
- }
254
-
255
- async function handleInteractiveOnboard(args) {
256
- const report = await runInteractiveOnboarding({
257
- url: getFlagValue(args, "--url"),
258
- goal: getFlagValue(args, "--goal"),
259
- existingAssets: getFlagValue(args, "--existing-assets")
260
- });
261
-
262
- const outputJson = hasFlag(args, "--json");
263
- const renderedOutput = outputJson
264
- ? `${JSON.stringify(report, null, 2)}\n`
265
- : renderInteractiveOnboardingMarkdown(report);
266
-
267
- const outputPath = getFlagValue(args, "--out");
268
- if (outputPath) {
269
- const resolvedOutputPath = await writeInteractiveOnboardingOutput(outputPath, renderedOutput);
270
- process.stdout.write(`已保存交互式 onboarding 结果:${resolvedOutputPath}\n`);
271
- return;
272
- }
273
-
274
- process.stdout.write(renderedOutput);
275
- }
276
-
277
- async function handleAudit(args) {
278
- const projectPath = args.find((value) => !value.startsWith("-"));
279
- if (!projectPath) {
280
- throw new Error("audit requires a project path");
281
- }
282
-
283
- const report = await auditProject(projectPath, {
284
- maxFileSize: getFlagValue(args, "--max-file-size")
285
- ? parsePositiveInteger(getFlagValue(args, "--max-file-size"), "--max-file-size")
286
- : undefined,
287
- maxExamples: getFlagValue(args, "--max-examples")
288
- ? parsePositiveInteger(getFlagValue(args, "--max-examples"), "--max-examples")
289
- : undefined
290
- });
291
-
292
- const outputJson = hasFlag(args, "--json");
293
- const renderedOutput = outputJson
294
- ? `${JSON.stringify(report, null, 2)}\n`
295
- : `${renderAuditMarkdown(report)}\n`;
296
-
297
- const outputPath = getFlagValue(args, "--out");
298
- if (outputPath) {
299
- const resolvedOutputPath = await writeAuditOutput(outputPath, renderedOutput);
300
- process.stdout.write(`已保存审计结果:${resolvedOutputPath}\n`);
301
- return;
302
- }
303
-
304
- process.stdout.write(renderedOutput);
305
- }
306
-
307
- async function handleReport(args) {
308
- const input = args.find((value) => !value.startsWith("-"));
309
- if (!input) {
310
- throw new Error("report 需要一个输入值,可以是本地项目路径或网站网址");
311
- }
312
-
313
- const maxFileSizeValue = getFlagValue(args, "--max-file-size");
314
- const maxExamplesValue = getFlagValue(args, "--max-examples");
315
- const report = await generateReport(input, {
316
- mode: getFlagValue(args, "--mode"),
317
- format: getFlagValue(args, "--format"),
318
- maxFileSize: maxFileSizeValue ? parsePositiveInteger(maxFileSizeValue, "--max-file-size") : undefined,
319
- maxExamples: maxExamplesValue ? parsePositiveInteger(maxExamplesValue, "--max-examples") : undefined
320
- });
321
-
322
- const outputPath = getFlagValue(args, "--out");
323
- if (outputPath) {
324
- const resolvedOutputPath = await writeReportOutput(outputPath, report.content);
325
- process.stdout.write(`已保存报告:${resolvedOutputPath}\n`);
326
- return;
327
- }
328
-
329
- process.stdout.write(report.content);
330
- }
331
-
332
- async function handleFixPlan(args) {
333
- const input = args.find((value) => !value.startsWith("-"));
334
- if (!input) {
335
- throw new Error("fix-plan 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 报告");
336
- }
337
-
338
- const format = getFlagValue(args, "--format");
339
- const plan = await createFixPlan(input, { format });
340
- const outputJson = format === "json";
341
- const renderedOutput = outputJson
342
- ? `${JSON.stringify(plan, null, 2)}\n`
343
- : renderFixPlanMarkdown(plan);
344
-
345
- const outputPath = getFlagValue(args, "--out");
346
- if (outputPath) {
347
- const resolvedOutputPath = await writeFixPlanOutput(outputPath, renderedOutput);
348
- process.stdout.write(`已保存 fix plan:${resolvedOutputPath}\n`);
349
- return;
350
- }
351
-
352
- process.stdout.write(renderedOutput);
353
- }
354
-
355
- async function handleAgentHandoff(args) {
356
- const input = args.find((value) => !value.startsWith("-"));
357
- if (!input) {
358
- throw new Error("agent-handoff 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 报告");
359
- }
360
-
361
- const format = getFlagValue(args, "--format");
362
- const handoff = await createAgentHandoff(input, { format });
363
- const outputJson = format === "json";
364
- const renderedOutput = outputJson
365
- ? `${JSON.stringify(handoff, null, 2)}\n`
366
- : renderAgentHandoffMarkdown(handoff);
367
-
368
- const outputPath = getFlagValue(args, "--out");
369
- if (outputPath) {
370
- const resolvedOutputPath = await writeAgentHandoffOutput(outputPath, renderedOutput);
371
- process.stdout.write(`已保存 agent handoff:${resolvedOutputPath}\n`);
372
- return;
373
- }
374
-
375
- process.stdout.write(renderedOutput);
376
- }
377
-
378
- async function handleApplyPlan(args) {
379
- const input = args.find((value) => !value.startsWith("-"));
380
- if (!input) {
381
- throw new Error("apply-plan 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 报告");
382
- }
383
-
384
- const format = getFlagValue(args, "--format");
385
- const plan = await createApplyPlan(input, {
386
- format,
387
- taskId: getFlagValue(args, "--task")
388
- });
389
- const outputJson = format === "json";
390
- const renderedOutput = outputJson
391
- ? `${JSON.stringify(plan, null, 2)}\n`
392
- : renderApplyPlanMarkdown(plan);
393
-
394
- const outputPath = getFlagValue(args, "--out");
395
- if (outputPath) {
396
- const resolvedOutputPath = await writeApplyPlanOutput(outputPath, renderedOutput);
397
- process.stdout.write(`已保存 apply plan:${resolvedOutputPath}\n`);
398
- return;
399
- }
400
-
401
- process.stdout.write(renderedOutput);
402
- }
403
-
404
- async function handleCompletionReport(args) {
405
- const input = args.find((value) => !value.startsWith("-"));
406
- if (!input) {
407
- throw new Error("completion-report 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 工件");
408
- }
409
-
410
- const format = getFlagValue(args, "--format");
411
- const report = await createCompletionReport(input, { format });
412
- const outputJson = format === "json";
413
- const renderedOutput = outputJson
414
- ? `${JSON.stringify(report, null, 2)}\n`
415
- : renderCompletionReportMarkdown(report);
416
-
417
- const outputPath = getFlagValue(args, "--out");
418
- if (outputPath) {
419
- const resolvedOutputPath = await writeCompletionReportOutput(outputPath, renderedOutput);
420
- process.stdout.write(`已保存 completion report:${resolvedOutputPath}\n`);
421
- return;
422
- }
423
-
424
- process.stdout.write(renderedOutput);
425
- }
426
-
427
- async function handleHandoffBundle(args) {
428
- const input = args.find((value) => !value.startsWith("-"));
429
- if (!input) {
430
- throw new Error("handoff-bundle 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 工件");
431
- }
432
-
433
- const format = getFlagValue(args, "--format");
434
- const bundle = await createHandoffBundle(input, {
435
- format,
436
- taskId: getFlagValue(args, "--task")
437
- });
438
- const outputJson = format === "json";
439
- const renderedOutput = outputJson
440
- ? `${JSON.stringify(bundle, null, 2)}\n`
441
- : renderHandoffBundleMarkdown(bundle);
442
-
443
- const outputPath = getFlagValue(args, "--out");
444
- if (outputPath) {
445
- const resolvedOutputPath = await writeHandoffBundleOutput(outputPath, renderedOutput);
446
- process.stdout.write(`已保存 handoff bundle:${resolvedOutputPath}\n`);
447
- return;
448
- }
449
-
450
- process.stdout.write(renderedOutput);
451
- }
452
-
453
- async function handleSharePack(args) {
454
- const input = args.find((value) => !value.startsWith("-"));
455
- if (!input) {
456
- throw new Error("share-pack 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 工件");
457
- }
458
-
459
- const format = getFlagValue(args, "--format");
460
- const pack = await createSharePack(input, {
461
- format,
462
- taskId: getFlagValue(args, "--task")
463
- });
464
- const outputJson = format === "json";
465
- const renderedOutput = outputJson
466
- ? `${JSON.stringify(pack, null, 2)}\n`
467
- : renderSharePackMarkdown(pack);
468
-
469
- const outputPath = getFlagValue(args, "--out");
470
- if (outputPath) {
471
- const resolvedOutputPath = await writeSharePackOutput(outputPath, renderedOutput);
472
- process.stdout.write(`已保存 share pack:${resolvedOutputPath}\n`);
473
- return;
474
- }
475
-
476
- process.stdout.write(renderedOutput);
477
- }
478
-
479
- async function handleExportPack(args) {
480
- const input = args.find((value) => !value.startsWith("-"));
481
- if (!input) {
482
- throw new Error("export-pack 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 工件");
483
- }
484
-
485
- const pack = await writeExportPack(input, {
486
- format: getFlagValue(args, "--format"),
487
- taskId: getFlagValue(args, "--task"),
488
- outputDir: getFlagValue(args, "--out-dir")
489
- });
490
-
491
- process.stdout.write(renderExportPackMarkdown(pack));
492
- }
493
-
494
- async function handleHtmlPack(args) {
495
- const input = args.find((value) => !value.startsWith("-"));
496
- if (!input) {
497
- throw new Error("html-pack 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 工件");
498
- }
499
-
500
- const pack = await writeHtmlPack(input, {
501
- taskId: getFlagValue(args, "--task"),
502
- outputDir: getFlagValue(args, "--out-dir")
503
- });
504
-
505
- process.stdout.write(renderHtmlPackMarkdown(pack));
506
- }
507
-
508
- async function handlePublishPack(args) {
509
- const input = args.find((value) => !value.startsWith("-"));
510
- if (!input) {
511
- throw new Error("publish-pack 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 工件");
512
- }
513
-
514
- const pack = await writePublishPack(input, {
515
- taskId: getFlagValue(args, "--task"),
516
- outputDir: getFlagValue(args, "--out-dir")
517
- });
518
-
519
- process.stdout.write(renderPublishPackMarkdown(pack));
520
- }
521
-
522
- async function handleExecSummary(args) {
523
- const input = args.find((value) => !value.startsWith("-"));
524
- if (!input) {
525
- throw new Error("exec-summary 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 报告");
526
- }
527
-
528
- const format = getFlagValue(args, "--format");
529
- const summary = await createExecSummary(input, { format });
530
- const outputJson = format === "json";
531
- const renderedOutput = outputJson
532
- ? `${JSON.stringify(summary, null, 2)}\n`
533
- : renderExecSummaryMarkdown(summary);
534
-
535
- const outputPath = getFlagValue(args, "--out");
536
- if (outputPath) {
537
- const resolvedOutputPath = await writeExecSummaryOutput(outputPath, renderedOutput);
538
- process.stdout.write(`已保存 exec summary:${resolvedOutputPath}\n`);
539
- return;
540
- }
541
-
542
- process.stdout.write(renderedOutput);
543
- }
544
-
545
- async function handleOwnerBoard(args) {
546
- const input = args.find((value) => !value.startsWith("-"));
547
- if (!input) {
548
- throw new Error("owner-board 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 报告");
549
- }
550
-
551
- const format = getFlagValue(args, "--format");
552
- const board = await createOwnerBoard(input, { format });
553
- const outputJson = format === "json";
554
- const renderedOutput = outputJson
555
- ? `${JSON.stringify(board, null, 2)}\n`
556
- : renderOwnerBoardMarkdown(board);
557
-
558
- const outputPath = getFlagValue(args, "--out");
559
- if (outputPath) {
560
- const resolvedOutputPath = await writeOwnerBoardOutput(outputPath, renderedOutput);
561
- process.stdout.write(`已保存 owner board:${resolvedOutputPath}\n`);
562
- return;
563
- }
564
-
565
- process.stdout.write(renderedOutput);
566
- }
567
-
568
- async function handleMeetingPack(args) {
569
- const input = args.find((value) => !value.startsWith("-"));
570
- if (!input) {
571
- throw new Error("meeting-pack 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 报告");
572
- }
573
-
574
- const format = getFlagValue(args, "--format");
575
- const pack = await createMeetingPack(input, { format });
576
- const outputJson = format === "json";
577
- const renderedOutput = outputJson
578
- ? `${JSON.stringify(pack, null, 2)}\n`
579
- : renderMeetingPackMarkdown(pack);
580
-
581
- const outputPath = getFlagValue(args, "--out");
582
- if (outputPath) {
583
- const resolvedOutputPath = await writeMeetingPackOutput(outputPath, renderedOutput);
584
- process.stdout.write(`已保存 meeting pack:${resolvedOutputPath}\n`);
585
- return;
586
- }
587
-
588
- process.stdout.write(renderedOutput);
589
- }
590
-
591
- async function handlePmBrief(args) {
592
- const input = args.find((value) => !value.startsWith("-"));
593
- if (!input) {
594
- throw new Error("pm-brief 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 报告");
595
- }
596
-
597
- const format = getFlagValue(args, "--format");
598
- const brief = await createPmBrief(input, { format });
599
- const outputJson = format === "json";
600
- const renderedOutput = outputJson
601
- ? `${JSON.stringify(brief, null, 2)}\n`
602
- : renderPmBriefMarkdown(brief);
603
-
604
- const outputPath = getFlagValue(args, "--out");
605
- if (outputPath) {
606
- const resolvedOutputPath = await writePmBriefOutput(outputPath, renderedOutput);
607
- process.stdout.write(`已保存 PM brief:${resolvedOutputPath}\n`);
608
- return;
609
- }
610
-
611
- process.stdout.write(renderedOutput);
612
- }
613
-
614
- async function handleRoadmap(args) {
615
- const input = args.find((value) => !value.startsWith("-"));
616
- if (!input) {
617
- throw new Error("roadmap 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 报告");
618
- }
619
-
620
- const format = getFlagValue(args, "--format");
621
- const roadmap = await createRoadmap(input, { format });
622
- const outputJson = format === "json";
623
- const renderedOutput = outputJson
624
- ? `${JSON.stringify(roadmap, null, 2)}\n`
625
- : renderRoadmapMarkdown(roadmap);
626
-
627
- const outputPath = getFlagValue(args, "--out");
628
- if (outputPath) {
629
- const resolvedOutputPath = await writeRoadmapOutput(outputPath, renderedOutput);
630
- process.stdout.write(`已保存 roadmap:${resolvedOutputPath}\n`);
631
- return;
632
- }
633
-
634
- process.stdout.write(renderedOutput);
635
- }
636
-
637
89
  export async function runCli(args = []) {
638
90
  const [command = "install", ...rest] = args;
639
91
  const flowHandler = FLOW_COMMAND_HANDLERS[command];
640
92
  const agentExecutionHandler = AGENT_EXECUTION_COMMAND_HANDLERS[command];
93
+ const planningDeliveryHandler = PLANNING_DELIVERY_COMMAND_HANDLERS[command];
94
+ const siteOpsHandler = SITE_OPS_COMMAND_HANDLERS[command];
641
95
 
642
96
  if (command === "help" || command === "--help" || command === "-h") {
643
97
  printHelp();
@@ -664,48 +118,13 @@ export async function runCli(args = []) {
664
118
  return;
665
119
  }
666
120
 
667
- if (command === "agent-runbook") {
668
- await handleAgentRunbook(rest);
669
- return;
670
- }
671
-
672
- if (command === "agent-executor") {
673
- await handleAgentExecutor(rest);
674
- return;
675
- }
676
-
677
- if (command === "agent-batch-executor") {
678
- await handleAgentBatchExecutor(rest);
121
+ if (planningDeliveryHandler) {
122
+ await planningDeliveryHandler(rest);
679
123
  return;
680
124
  }
681
125
 
682
- if (command === "agent-progress-tracker") {
683
- await handleAgentProgressTracker(rest);
684
- return;
685
- }
686
-
687
- if (command === "agent-status-board") {
688
- await handleAgentStatusBoard(rest);
689
- return;
690
- }
691
-
692
- if (command === "agent-checkpoint") {
693
- await handleAgentCheckpoint(rest);
694
- return;
695
- }
696
-
697
- if (command === "agent-decision-log") {
698
- await handleAgentDecisionLog(rest);
699
- return;
700
- }
701
-
702
- if (command === "agent-retrospective") {
703
- await handleAgentRetrospective(rest);
704
- return;
705
- }
706
-
707
- if (command === "agent-playbook-pack") {
708
- await handleAgentPlaybookPack(rest);
126
+ if (siteOpsHandler) {
127
+ await siteOpsHandler(rest);
709
128
  return;
710
129
  }
711
130
 
@@ -719,121 +138,6 @@ export async function runCli(args = []) {
719
138
  return;
720
139
  }
721
140
 
722
- if (command === "doctor") {
723
- await handleDoctor(rest);
724
- return;
725
- }
726
-
727
- if (command === "quick-start") {
728
- await handleQuickStart(rest);
729
- return;
730
- }
731
-
732
- if (command === "onboard") {
733
- await handleInteractiveOnboard(rest);
734
- return;
735
- }
736
-
737
- if (command === "onboard-url") {
738
- await handleOnboardUrl(rest);
739
- return;
740
- }
741
-
742
- if (command === "init-llms") {
743
- await handleInitLlms(rest);
744
- return;
745
- }
746
-
747
- if (command === "init-schema") {
748
- await handleInitSchema(rest);
749
- return;
750
- }
751
-
752
- if (command === "audit") {
753
- await handleAudit(rest);
754
- return;
755
- }
756
-
757
- if (command === "agent-handoff") {
758
- await handleAgentHandoff(rest);
759
- return;
760
- }
761
-
762
- if (command === "apply-plan") {
763
- await handleApplyPlan(rest);
764
- return;
765
- }
766
-
767
- if (command === "completion-report") {
768
- await handleCompletionReport(rest);
769
- return;
770
- }
771
-
772
- if (command === "handoff-bundle") {
773
- await handleHandoffBundle(rest);
774
- return;
775
- }
776
-
777
- if (command === "share-pack") {
778
- await handleSharePack(rest);
779
- return;
780
- }
781
-
782
- if (command === "export-pack") {
783
- await handleExportPack(rest);
784
- return;
785
- }
786
-
787
- if (command === "html-pack") {
788
- await handleHtmlPack(rest);
789
- return;
790
- }
791
-
792
- if (command === "publish-pack") {
793
- await handlePublishPack(rest);
794
- return;
795
- }
796
-
797
- if (command === "exec-summary") {
798
- await handleExecSummary(rest);
799
- return;
800
- }
801
-
802
- if (command === "fix-plan") {
803
- await handleFixPlan(rest);
804
- return;
805
- }
806
-
807
- if (command === "owner-board") {
808
- await handleOwnerBoard(rest);
809
- return;
810
- }
811
-
812
- if (command === "meeting-pack") {
813
- await handleMeetingPack(rest);
814
- return;
815
- }
816
-
817
- if (command === "pm-brief") {
818
- await handlePmBrief(rest);
819
- return;
820
- }
821
-
822
- if (command === "roadmap") {
823
- await handleRoadmap(rest);
824
- return;
825
- }
826
-
827
- if (command === "report") {
828
- await handleReport(rest);
829
- return;
830
- }
831
-
832
- if (command === "scan") {
833
- await handleScan(rest);
834
- return;
835
- }
836
-
837
141
  throw new Error(`Unknown command: ${command}`);
838
142
  }
839
143