geo-ai-search-optimization 1.3.3 → 1.3.4

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,13 @@ 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
+
861
868
  ## New in 1.2.20
862
869
 
863
870
  - 新增 `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.4",
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
+ };
package/src/cli.js CHANGED
@@ -6,31 +6,17 @@ import {
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 { getFlagValue, hasFlag, parsePositiveInteger } from "./cli-shared.js";
18
14
  import { installSkill } from "./install-skill.js";
19
15
  import { getBundledSkillPath, getInstalledSkillPath, getSkillName, getSkillsDir } from "./paths.js";
20
16
  import { renderScanMarkdown, scanProject, writeScanOutput } from "./scan.js";
21
17
  import { renderDoctorMarkdown, runDoctor } from "./doctor.js";
22
18
  import { createLlmsTxt } from "./llms-txt.js";
23
19
  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
20
  import {
35
21
  renderInteractiveOnboardingMarkdown,
36
22
  runInteractiveOnboarding,
@@ -38,7 +24,6 @@ import {
38
24
  } from "./interactive-onboarding.js";
39
25
  import { createQuickStartPlan, renderQuickStartMarkdown, writeQuickStartOutput } from "./quick-start.js";
40
26
  import { createSchemaTemplate } from "./schema.js";
41
- import { createSharePack, renderSharePackMarkdown, writeSharePackOutput } from "./share-pack.js";
42
27
  import { listBundledSkills, renderBundledSkillsMarkdown } from "./skills.js";
43
28
  import { analyzeWebsiteUrl, renderWebsiteOnboardingMarkdown, writeWebsiteOnboardingOutput } from "./url-onboarding.js";
44
29
 
@@ -65,6 +50,7 @@ function printHelp() {
65
50
  " geo-ai-search-optimization install [--target <dir>] [--json]",
66
51
  ...FLOW_HELP_LINES,
67
52
  ...AGENT_EXECUTION_HELP_LINES,
53
+ ...PLANNING_DELIVERY_HELP_LINES,
68
54
  " geo-ai-search-optimization skills [--json]",
69
55
  " geo-ai-search-optimization where",
70
56
  " geo-ai-search-optimization doctor [--json]",
@@ -74,21 +60,6 @@ function printHelp() {
74
60
  " geo-ai-search-optimization init-llms [target-dir] [--site-name <name>] [--site-url <url>] [--overwrite] [--json]",
75
61
  " geo-ai-search-optimization init-schema <type> [target-dir] [--site-url <url>] [--overwrite] [--json]",
76
62
  " 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
63
  " geo-ai-search-optimization scan <project-path> [--json] [--out <file>] [--max-file-size <bytes>] [--max-examples <count>]",
93
64
  " geo-ai-search-optimization version",
94
65
  " geo-ai-search-optimization help",
@@ -304,340 +275,11 @@ async function handleAudit(args) {
304
275
  process.stdout.write(renderedOutput);
305
276
  }
306
277
 
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
278
  export async function runCli(args = []) {
638
279
  const [command = "install", ...rest] = args;
639
280
  const flowHandler = FLOW_COMMAND_HANDLERS[command];
640
281
  const agentExecutionHandler = AGENT_EXECUTION_COMMAND_HANDLERS[command];
282
+ const planningDeliveryHandler = PLANNING_DELIVERY_COMMAND_HANDLERS[command];
641
283
 
642
284
  if (command === "help" || command === "--help" || command === "-h") {
643
285
  printHelp();
@@ -664,48 +306,8 @@ export async function runCli(args = []) {
664
306
  return;
665
307
  }
666
308
 
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);
679
- return;
680
- }
681
-
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);
309
+ if (planningDeliveryHandler) {
310
+ await planningDeliveryHandler(rest);
709
311
  return;
710
312
  }
711
313
 
@@ -754,81 +356,6 @@ export async function runCli(args = []) {
754
356
  return;
755
357
  }
756
358
 
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
359
  if (command === "scan") {
833
360
  await handleScan(rest);
834
361
  return;