geo-ai-search-optimization 1.3.2 → 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
@@ -851,6 +851,20 @@ geo-ai-search-optimization help
851
851
  - 新增 `src/cli-shared.js`,集中处理 flag 解析、输入校验和输出写回,降低后续继续加命令时的耦合
852
852
  - 主 `cli.js` 现在更像薄路由层,后续扩充 command family 会更稳
853
853
 
854
+ ## New in 1.3.3
855
+
856
+ - 继续做 CLI 架构迭代,把 agent execution family 也从主 `cli.js` 拆出
857
+ - 新增 `src/cli-agent-execution-commands.js`,接管 `agent-runbook / agent-executor / agent-batch-executor / agent-progress-tracker / agent-status-board / agent-checkpoint / agent-decision-log / agent-retrospective / agent-playbook-pack`
858
+ - 主 `cli.js` 进一步收敛成更薄的 command router
859
+ - 现在 flow family 和 execution family 都有独立 adapter 模块,后续继续拆 planning / delivery 会更顺
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
+
854
868
  ## New in 1.2.20
855
869
 
856
870
  - 新增 `agent-continue`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geo-ai-search-optimization",
3
- "version": "1.3.2",
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,210 @@
1
+ import {
2
+ createAgentBatchExecutor,
3
+ renderAgentBatchExecutorMarkdown,
4
+ writeAgentBatchExecutorOutput
5
+ } from "./agent-batch-executor.js";
6
+ import { createAgentExecutor, renderAgentExecutorMarkdown, writeAgentExecutorOutput } from "./agent-executor.js";
7
+ import {
8
+ createAgentProgressTracker,
9
+ renderAgentProgressTrackerMarkdown,
10
+ writeAgentProgressTrackerOutput
11
+ } from "./agent-progress-tracker.js";
12
+ import { createAgentCheckpoint, renderAgentCheckpointMarkdown, writeAgentCheckpointOutput } from "./agent-checkpoint.js";
13
+ import { createAgentDecisionLog, renderAgentDecisionLogMarkdown, writeAgentDecisionLogOutput } from "./agent-decision-log.js";
14
+ import {
15
+ createAgentPlaybookPack,
16
+ renderAgentPlaybookPackMarkdown,
17
+ writeAgentPlaybookPackOutput
18
+ } from "./agent-playbook-pack.js";
19
+ import { createAgentRetrospective, renderAgentRetrospectiveMarkdown, writeAgentRetrospectiveOutput } from "./agent-retrospective.js";
20
+ import { createAgentStatusBoard, renderAgentStatusBoardMarkdown, writeAgentStatusBoardOutput } from "./agent-status-board.js";
21
+ import { createAgentRunbook, renderAgentRunbookMarkdown, writeAgentRunbookOutput } from "./agent-runbook.js";
22
+ import {
23
+ getFlagValue,
24
+ getJsonCapableFormat,
25
+ getRequiredInput,
26
+ writeOrPrintArtifact
27
+ } from "./cli-shared.js";
28
+
29
+ export const AGENT_EXECUTION_HELP_LINES = [
30
+ " geo-ai-search-optimization agent-runbook <input> [--intent <auto|diagnose|guide|execute|share|closeout>] [--task <id>] [--format <markdown|json>] [--out <file>]",
31
+ " geo-ai-search-optimization agent-executor <input> [--intent <auto|diagnose|guide|execute|share|closeout>] [--task <id>] [--format <markdown|json>] [--out <file>]",
32
+ " geo-ai-search-optimization agent-batch-executor <input> [--intent <auto|diagnose|guide|execute|share|closeout>] [--task <id>] [--count <count>] [--format <markdown|json>] [--out <file>]",
33
+ " geo-ai-search-optimization agent-progress-tracker <input> [--current <id>] [--completed <id,id>] [--blocked <reason,reason>] [--format <markdown|json>] [--out <file>]",
34
+ " geo-ai-search-optimization agent-status-board <input> [--current <id>] [--completed <id,id>] [--blocked <reason,reason>] [--format <markdown|json>] [--out <file>]",
35
+ " geo-ai-search-optimization agent-checkpoint <input> [--current <id>] [--completed <id,id>] [--blocked <reason,reason>] [--format <markdown|json>] [--out <file>]",
36
+ " geo-ai-search-optimization agent-decision-log <input> [--append-from <file>] [--note <text>] [--current <id>] [--completed <id,id>] [--blocked <reason,reason>] [--format <markdown|json>] [--out <file>]",
37
+ " geo-ai-search-optimization agent-retrospective <input> [--format <markdown|json>] [--out <file>]",
38
+ " geo-ai-search-optimization agent-playbook-pack <input> [--task <id>] [--format <markdown|json>] [--out <file>]"
39
+ ];
40
+
41
+ async function handleAgentRunbook(args) {
42
+ const input = getRequiredInput(args, "agent-runbook");
43
+ const format = getFlagValue(args, "--format");
44
+ const artifact = await createAgentRunbook(input, {
45
+ intent: getFlagValue(args, "--intent"),
46
+ format,
47
+ taskId: getFlagValue(args, "--task")
48
+ });
49
+ return writeOrPrintArtifact({
50
+ args,
51
+ commandName: "agent runbook",
52
+ artifact,
53
+ renderMarkdown: renderAgentRunbookMarkdown,
54
+ writeOutput: writeAgentRunbookOutput,
55
+ outputJson: format === "json"
56
+ });
57
+ }
58
+
59
+ async function handleAgentExecutor(args) {
60
+ const input = getRequiredInput(args, "agent-executor");
61
+ const format = getFlagValue(args, "--format");
62
+ const artifact = await createAgentExecutor(input, {
63
+ intent: getFlagValue(args, "--intent"),
64
+ format,
65
+ taskId: getFlagValue(args, "--task")
66
+ });
67
+ return writeOrPrintArtifact({
68
+ args,
69
+ commandName: "agent executor",
70
+ artifact,
71
+ renderMarkdown: renderAgentExecutorMarkdown,
72
+ writeOutput: writeAgentExecutorOutput,
73
+ outputJson: format === "json"
74
+ });
75
+ }
76
+
77
+ async function handleAgentBatchExecutor(args) {
78
+ const input = getRequiredInput(args, "agent-batch-executor");
79
+ const artifact = await createAgentBatchExecutor(input, {
80
+ intent: getFlagValue(args, "--intent"),
81
+ format: getJsonCapableFormat(args),
82
+ taskId: getFlagValue(args, "--task"),
83
+ count: getFlagValue(args, "--count")
84
+ });
85
+ return writeOrPrintArtifact({
86
+ args,
87
+ commandName: "agent batch executor",
88
+ artifact,
89
+ renderMarkdown: renderAgentBatchExecutorMarkdown,
90
+ writeOutput: writeAgentBatchExecutorOutput,
91
+ outputJson: artifact.format === "json"
92
+ });
93
+ }
94
+
95
+ async function handleAgentProgressTracker(args) {
96
+ const input = getRequiredInput(args, "agent-progress-tracker");
97
+ const artifact = await createAgentProgressTracker(input, {
98
+ format: getJsonCapableFormat(args),
99
+ currentTaskId: getFlagValue(args, "--current"),
100
+ completedPacketIds: getFlagValue(args, "--completed"),
101
+ blockedReasons: getFlagValue(args, "--blocked")
102
+ });
103
+ return writeOrPrintArtifact({
104
+ args,
105
+ commandName: "agent progress tracker",
106
+ artifact,
107
+ renderMarkdown: renderAgentProgressTrackerMarkdown,
108
+ writeOutput: writeAgentProgressTrackerOutput,
109
+ outputJson: artifact.format === "json"
110
+ });
111
+ }
112
+
113
+ async function handleAgentStatusBoard(args) {
114
+ const input = getRequiredInput(args, "agent-status-board");
115
+ const artifact = await createAgentStatusBoard(input, {
116
+ format: getJsonCapableFormat(args),
117
+ currentTaskId: getFlagValue(args, "--current"),
118
+ completedPacketIds: getFlagValue(args, "--completed"),
119
+ blockedReasons: getFlagValue(args, "--blocked")
120
+ });
121
+ return writeOrPrintArtifact({
122
+ args,
123
+ commandName: "agent status board",
124
+ artifact,
125
+ renderMarkdown: renderAgentStatusBoardMarkdown,
126
+ writeOutput: writeAgentStatusBoardOutput,
127
+ outputJson: artifact.format === "json"
128
+ });
129
+ }
130
+
131
+ async function handleAgentCheckpoint(args) {
132
+ const input = getRequiredInput(args, "agent-checkpoint");
133
+ const artifact = await createAgentCheckpoint(input, {
134
+ format: getJsonCapableFormat(args),
135
+ currentTaskId: getFlagValue(args, "--current"),
136
+ completedPacketIds: getFlagValue(args, "--completed"),
137
+ blockedReasons: getFlagValue(args, "--blocked")
138
+ });
139
+ return writeOrPrintArtifact({
140
+ args,
141
+ commandName: "agent checkpoint",
142
+ artifact,
143
+ renderMarkdown: renderAgentCheckpointMarkdown,
144
+ writeOutput: writeAgentCheckpointOutput,
145
+ outputJson: artifact.format === "json"
146
+ });
147
+ }
148
+
149
+ async function handleAgentDecisionLog(args) {
150
+ const input = getRequiredInput(args, "agent-decision-log");
151
+ const artifact = await createAgentDecisionLog(input, {
152
+ format: getJsonCapableFormat(args),
153
+ appendFrom: getFlagValue(args, "--append-from"),
154
+ note: getFlagValue(args, "--note"),
155
+ currentTaskId: getFlagValue(args, "--current"),
156
+ completedPacketIds: getFlagValue(args, "--completed"),
157
+ blockedReasons: getFlagValue(args, "--blocked")
158
+ });
159
+ return writeOrPrintArtifact({
160
+ args,
161
+ commandName: "agent decision log",
162
+ artifact,
163
+ renderMarkdown: renderAgentDecisionLogMarkdown,
164
+ writeOutput: writeAgentDecisionLogOutput,
165
+ outputJson: artifact.format === "json"
166
+ });
167
+ }
168
+
169
+ async function handleAgentRetrospective(args) {
170
+ const input = getRequiredInput(args, "agent-retrospective");
171
+ const artifact = await createAgentRetrospective(input, {
172
+ format: getJsonCapableFormat(args)
173
+ });
174
+ return writeOrPrintArtifact({
175
+ args,
176
+ commandName: "agent retrospective",
177
+ artifact,
178
+ renderMarkdown: renderAgentRetrospectiveMarkdown,
179
+ writeOutput: writeAgentRetrospectiveOutput,
180
+ outputJson: artifact.format === "json"
181
+ });
182
+ }
183
+
184
+ async function handleAgentPlaybookPack(args) {
185
+ const input = getRequiredInput(args, "agent-playbook-pack");
186
+ const artifact = await createAgentPlaybookPack(input, {
187
+ format: getJsonCapableFormat(args),
188
+ taskId: getFlagValue(args, "--task")
189
+ });
190
+ return writeOrPrintArtifact({
191
+ args,
192
+ commandName: "agent playbook pack",
193
+ artifact,
194
+ renderMarkdown: renderAgentPlaybookPackMarkdown,
195
+ writeOutput: writeAgentPlaybookPackOutput,
196
+ outputJson: artifact.format === "json"
197
+ });
198
+ }
199
+
200
+ export const AGENT_EXECUTION_COMMAND_HANDLERS = {
201
+ "agent-runbook": handleAgentRunbook,
202
+ "agent-executor": handleAgentExecutor,
203
+ "agent-batch-executor": handleAgentBatchExecutor,
204
+ "agent-progress-tracker": handleAgentProgressTracker,
205
+ "agent-status-board": handleAgentStatusBoard,
206
+ "agent-checkpoint": handleAgentCheckpoint,
207
+ "agent-decision-log": handleAgentDecisionLog,
208
+ "agent-retrospective": handleAgentRetrospective,
209
+ "agent-playbook-pack": handleAgentPlaybookPack
210
+ };
@@ -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
@@ -1,53 +1,22 @@
1
1
  import { fileURLToPath } from "node:url";
2
2
  import { readFile } from "node:fs/promises";
3
3
  import path from "node:path";
4
- import { FLOW_COMMAND_HANDLERS, FLOW_HELP_LINES } from "./cli-flow-commands.js";
5
- import { getFlagValue, hasFlag, parsePositiveInteger } from "./cli-shared.js";
6
- import { createApplyPlan, renderApplyPlanMarkdown, writeApplyPlanOutput } from "./apply-plan.js";
7
- import {
8
- createAgentBatchExecutor,
9
- renderAgentBatchExecutorMarkdown,
10
- writeAgentBatchExecutorOutput
11
- } from "./agent-batch-executor.js";
12
- import { createAgentExecutor, renderAgentExecutorMarkdown, writeAgentExecutorOutput } from "./agent-executor.js";
13
- import { createAgentHandoff, renderAgentHandoffMarkdown, writeAgentHandoffOutput } from "./agent-handoff.js";
14
4
  import {
15
- createAgentProgressTracker,
16
- renderAgentProgressTrackerMarkdown,
17
- writeAgentProgressTrackerOutput
18
- } from "./agent-progress-tracker.js";
19
- import { createAgentCheckpoint, renderAgentCheckpointMarkdown, writeAgentCheckpointOutput } from "./agent-checkpoint.js";
20
- import { createAgentDecisionLog, renderAgentDecisionLogMarkdown, writeAgentDecisionLogOutput } from "./agent-decision-log.js";
21
- import {
22
- createAgentPlaybookPack,
23
- renderAgentPlaybookPackMarkdown,
24
- writeAgentPlaybookPackOutput
25
- } from "./agent-playbook-pack.js";
26
- import { createAgentRetrospective, renderAgentRetrospectiveMarkdown, writeAgentRetrospectiveOutput } from "./agent-retrospective.js";
27
- import { createAgentStatusBoard, renderAgentStatusBoardMarkdown, writeAgentStatusBoardOutput } from "./agent-status-board.js";
28
- import { createAgentRunbook, renderAgentRunbookMarkdown, writeAgentRunbookOutput } from "./agent-runbook.js";
5
+ AGENT_EXECUTION_COMMAND_HANDLERS,
6
+ AGENT_EXECUTION_HELP_LINES
7
+ } from "./cli-agent-execution-commands.js";
8
+ import { FLOW_COMMAND_HANDLERS, FLOW_HELP_LINES } from "./cli-flow-commands.js";
29
9
  import {
30
- createCompletionReport,
31
- renderCompletionReportMarkdown,
32
- writeCompletionReportOutput
33
- } from "./completion-report.js";
34
- 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";
35
14
  import { installSkill } from "./install-skill.js";
36
15
  import { getBundledSkillPath, getInstalledSkillPath, getSkillName, getSkillsDir } from "./paths.js";
37
16
  import { renderScanMarkdown, scanProject, writeScanOutput } from "./scan.js";
38
17
  import { renderDoctorMarkdown, runDoctor } from "./doctor.js";
39
18
  import { createLlmsTxt } from "./llms-txt.js";
40
19
  import { auditProject, renderAuditMarkdown, writeAuditOutput } from "./audit.js";
41
- import { createFixPlan, renderFixPlanMarkdown, writeFixPlanOutput } from "./fix-plan.js";
42
- import { createExecSummary, renderExecSummaryMarkdown, writeExecSummaryOutput } from "./exec-summary.js";
43
- import { renderExportPackMarkdown, writeExportPack } from "./export-pack.js";
44
- import { renderHtmlPackMarkdown, writeHtmlPack } from "./html-pack.js";
45
- import { createOwnerBoard, renderOwnerBoardMarkdown, writeOwnerBoardOutput } from "./owner-board.js";
46
- import { createMeetingPack, renderMeetingPackMarkdown, writeMeetingPackOutput } from "./meeting-pack.js";
47
- import { createPmBrief, renderPmBriefMarkdown, writePmBriefOutput } from "./pm-brief.js";
48
- import { renderPublishPackMarkdown, writePublishPack } from "./publish-pack.js";
49
- import { generateReport, writeReportOutput } from "./report.js";
50
- import { createRoadmap, renderRoadmapMarkdown, writeRoadmapOutput } from "./roadmap.js";
51
20
  import {
52
21
  renderInteractiveOnboardingMarkdown,
53
22
  runInteractiveOnboarding,
@@ -55,7 +24,6 @@ import {
55
24
  } from "./interactive-onboarding.js";
56
25
  import { createQuickStartPlan, renderQuickStartMarkdown, writeQuickStartOutput } from "./quick-start.js";
57
26
  import { createSchemaTemplate } from "./schema.js";
58
- import { createSharePack, renderSharePackMarkdown, writeSharePackOutput } from "./share-pack.js";
59
27
  import { listBundledSkills, renderBundledSkillsMarkdown } from "./skills.js";
60
28
  import { analyzeWebsiteUrl, renderWebsiteOnboardingMarkdown, writeWebsiteOnboardingOutput } from "./url-onboarding.js";
61
29
 
@@ -81,15 +49,8 @@ function printHelp() {
81
49
  " geo-ai-search-optimization",
82
50
  " geo-ai-search-optimization install [--target <dir>] [--json]",
83
51
  ...FLOW_HELP_LINES,
84
- " geo-ai-search-optimization agent-runbook <input> [--intent <auto|diagnose|guide|execute|share|closeout>] [--task <id>] [--format <markdown|json>] [--out <file>]",
85
- " geo-ai-search-optimization agent-executor <input> [--intent <auto|diagnose|guide|execute|share|closeout>] [--task <id>] [--format <markdown|json>] [--out <file>]",
86
- " geo-ai-search-optimization agent-batch-executor <input> [--intent <auto|diagnose|guide|execute|share|closeout>] [--task <id>] [--count <count>] [--format <markdown|json>] [--out <file>]",
87
- " geo-ai-search-optimization agent-progress-tracker <input> [--current <id>] [--completed <id,id>] [--blocked <reason,reason>] [--format <markdown|json>] [--out <file>]",
88
- " geo-ai-search-optimization agent-status-board <input> [--current <id>] [--completed <id,id>] [--blocked <reason,reason>] [--format <markdown|json>] [--out <file>]",
89
- " geo-ai-search-optimization agent-checkpoint <input> [--current <id>] [--completed <id,id>] [--blocked <reason,reason>] [--format <markdown|json>] [--out <file>]",
90
- " geo-ai-search-optimization agent-decision-log <input> [--append-from <file>] [--note <text>] [--current <id>] [--completed <id,id>] [--blocked <reason,reason>] [--format <markdown|json>] [--out <file>]",
91
- " geo-ai-search-optimization agent-retrospective <input> [--format <markdown|json>] [--out <file>]",
92
- " geo-ai-search-optimization agent-playbook-pack <input> [--task <id>] [--format <markdown|json>] [--out <file>]",
52
+ ...AGENT_EXECUTION_HELP_LINES,
53
+ ...PLANNING_DELIVERY_HELP_LINES,
93
54
  " geo-ai-search-optimization skills [--json]",
94
55
  " geo-ai-search-optimization where",
95
56
  " geo-ai-search-optimization doctor [--json]",
@@ -99,21 +60,6 @@ function printHelp() {
99
60
  " geo-ai-search-optimization init-llms [target-dir] [--site-name <name>] [--site-url <url>] [--overwrite] [--json]",
100
61
  " geo-ai-search-optimization init-schema <type> [target-dir] [--site-url <url>] [--overwrite] [--json]",
101
62
  " geo-ai-search-optimization audit <project-path> [--json] [--out <file>] [--max-file-size <bytes>] [--max-examples <count>]",
102
- " geo-ai-search-optimization agent-handoff <input> [--format <markdown|json>] [--out <file>]",
103
- " geo-ai-search-optimization apply-plan <input> [--task <id>] [--format <markdown|json>] [--out <file>]",
104
- " geo-ai-search-optimization completion-report <input> [--format <markdown|json>] [--out <file>]",
105
- " geo-ai-search-optimization handoff-bundle <input> [--task <id>] [--format <markdown|json>] [--out <file>]",
106
- " geo-ai-search-optimization share-pack <input> [--task <id>] [--format <markdown|json>] [--out <file>]",
107
- " geo-ai-search-optimization export-pack <input> [--task <id>] [--format <markdown|json>] [--out-dir <dir>]",
108
- " geo-ai-search-optimization html-pack <input> [--task <id>] [--out-dir <dir>]",
109
- " geo-ai-search-optimization publish-pack <input> [--task <id>] [--out-dir <dir>]",
110
- " geo-ai-search-optimization exec-summary <input> [--format <markdown|json>] [--out <file>]",
111
- " geo-ai-search-optimization fix-plan <input> [--format <markdown|json>] [--out <file>]",
112
- " geo-ai-search-optimization owner-board <input> [--format <markdown|json>] [--out <file>]",
113
- " geo-ai-search-optimization meeting-pack <input> [--format <markdown|json>] [--out <file>]",
114
- " geo-ai-search-optimization pm-brief <input> [--format <markdown|json>] [--out <file>]",
115
- " geo-ai-search-optimization roadmap <input> [--format <markdown|json>] [--out <file>]",
116
- " geo-ai-search-optimization report <input> [--mode <auto|audit|onboarding|scan>] [--format <markdown|html|json>] [--out <file>]",
117
63
  " geo-ai-search-optimization scan <project-path> [--json] [--out <file>] [--max-file-size <bytes>] [--max-examples <count>]",
118
64
  " geo-ai-search-optimization version",
119
65
  " geo-ai-search-optimization help",
@@ -137,253 +83,6 @@ async function handleInstall(args) {
137
83
  }
138
84
  }
139
85
 
140
- async function handleAgentRunbook(args) {
141
- const input = args.find((value) => !value.startsWith("-"));
142
- if (!input) {
143
- throw new Error("agent-runbook 需要一个输入值,可以是任务描述、项目路径、网站网址或已导出的工件");
144
- }
145
-
146
- const format = getFlagValue(args, "--format");
147
- const runbook = await createAgentRunbook(input, {
148
- intent: getFlagValue(args, "--intent"),
149
- format,
150
- taskId: getFlagValue(args, "--task")
151
- });
152
- const outputJson = format === "json";
153
- const renderedOutput = outputJson
154
- ? `${JSON.stringify(runbook, null, 2)}\n`
155
- : renderAgentRunbookMarkdown(runbook);
156
-
157
- const outputPath = getFlagValue(args, "--out");
158
- if (outputPath) {
159
- const resolvedOutputPath = await writeAgentRunbookOutput(outputPath, renderedOutput);
160
- process.stdout.write(`已保存 agent runbook:${resolvedOutputPath}\n`);
161
- return;
162
- }
163
-
164
- process.stdout.write(renderedOutput);
165
- }
166
-
167
- async function handleAgentExecutor(args) {
168
- const input = args.find((value) => !value.startsWith("-"));
169
- if (!input) {
170
- throw new Error("agent-executor 需要一个输入值,可以是任务描述、项目路径、网站网址或已导出的工件");
171
- }
172
-
173
- const format = getFlagValue(args, "--format");
174
- const executor = await createAgentExecutor(input, {
175
- intent: getFlagValue(args, "--intent"),
176
- format,
177
- taskId: getFlagValue(args, "--task")
178
- });
179
- const outputJson = format === "json";
180
- const renderedOutput = outputJson
181
- ? `${JSON.stringify(executor, null, 2)}\n`
182
- : renderAgentExecutorMarkdown(executor);
183
-
184
- const outputPath = getFlagValue(args, "--out");
185
- if (outputPath) {
186
- const resolvedOutputPath = await writeAgentExecutorOutput(outputPath, renderedOutput);
187
- process.stdout.write(`已保存 agent executor:${resolvedOutputPath}\n`);
188
- return;
189
- }
190
-
191
- process.stdout.write(renderedOutput);
192
- }
193
-
194
- async function handleAgentBatchExecutor(args) {
195
- const input = args.find((value) => !value.startsWith("-"));
196
- if (!input) {
197
- throw new Error("agent-batch-executor 需要一个输入值,可以是任务描述、项目路径、网站网址或已导出的工件");
198
- }
199
-
200
- const format = getFlagValue(args, "--format") || (hasFlag(args, "--json") ? "json" : undefined);
201
- const batch = await createAgentBatchExecutor(input, {
202
- intent: getFlagValue(args, "--intent"),
203
- format,
204
- taskId: getFlagValue(args, "--task"),
205
- count: getFlagValue(args, "--count")
206
- });
207
- const outputJson = batch.format === "json";
208
- const renderedOutput = outputJson
209
- ? `${JSON.stringify(batch, null, 2)}\n`
210
- : renderAgentBatchExecutorMarkdown(batch);
211
-
212
- const outputPath = getFlagValue(args, "--out");
213
- if (outputPath) {
214
- const resolvedOutputPath = await writeAgentBatchExecutorOutput(outputPath, renderedOutput);
215
- process.stdout.write(`已保存 agent batch executor:${resolvedOutputPath}\n`);
216
- return;
217
- }
218
-
219
- process.stdout.write(renderedOutput);
220
- }
221
-
222
- async function handleAgentProgressTracker(args) {
223
- const input = args.find((value) => !value.startsWith("-"));
224
- if (!input) {
225
- throw new Error("agent-progress-tracker 需要一个输入值,可以是项目路径、网站网址或已导出的工件");
226
- }
227
-
228
- const format = getFlagValue(args, "--format") || (hasFlag(args, "--json") ? "json" : undefined);
229
- const tracker = await createAgentProgressTracker(input, {
230
- format,
231
- currentTaskId: getFlagValue(args, "--current"),
232
- completedPacketIds: getFlagValue(args, "--completed"),
233
- blockedReasons: getFlagValue(args, "--blocked")
234
- });
235
- const outputJson = tracker.format === "json";
236
- const renderedOutput = outputJson
237
- ? `${JSON.stringify(tracker, null, 2)}\n`
238
- : renderAgentProgressTrackerMarkdown(tracker);
239
-
240
- const outputPath = getFlagValue(args, "--out");
241
- if (outputPath) {
242
- const resolvedOutputPath = await writeAgentProgressTrackerOutput(outputPath, renderedOutput);
243
- process.stdout.write(`已保存 agent progress tracker:${resolvedOutputPath}\n`);
244
- return;
245
- }
246
-
247
- process.stdout.write(renderedOutput);
248
- }
249
-
250
- async function handleAgentStatusBoard(args) {
251
- const input = args.find((value) => !value.startsWith("-"));
252
- if (!input) {
253
- throw new Error("agent-status-board 需要一个输入值,可以是项目路径、网站网址或已导出的工件");
254
- }
255
-
256
- const format = getFlagValue(args, "--format") || (hasFlag(args, "--json") ? "json" : undefined);
257
- const board = await createAgentStatusBoard(input, {
258
- format,
259
- currentTaskId: getFlagValue(args, "--current"),
260
- completedPacketIds: getFlagValue(args, "--completed"),
261
- blockedReasons: getFlagValue(args, "--blocked")
262
- });
263
- const outputJson = board.format === "json";
264
- const renderedOutput = outputJson
265
- ? `${JSON.stringify(board, null, 2)}\n`
266
- : renderAgentStatusBoardMarkdown(board);
267
-
268
- const outputPath = getFlagValue(args, "--out");
269
- if (outputPath) {
270
- const resolvedOutputPath = await writeAgentStatusBoardOutput(outputPath, renderedOutput);
271
- process.stdout.write(`已保存 agent status board:${resolvedOutputPath}\n`);
272
- return;
273
- }
274
-
275
- process.stdout.write(renderedOutput);
276
- }
277
-
278
- async function handleAgentCheckpoint(args) {
279
- const input = args.find((value) => !value.startsWith("-"));
280
- if (!input) {
281
- throw new Error("agent-checkpoint 需要一个输入值,可以是项目路径、网站网址或已导出的工件");
282
- }
283
-
284
- const format = getFlagValue(args, "--format") || (hasFlag(args, "--json") ? "json" : undefined);
285
- const checkpoint = await createAgentCheckpoint(input, {
286
- format,
287
- currentTaskId: getFlagValue(args, "--current"),
288
- completedPacketIds: getFlagValue(args, "--completed"),
289
- blockedReasons: getFlagValue(args, "--blocked")
290
- });
291
- const outputJson = checkpoint.format === "json";
292
- const renderedOutput = outputJson
293
- ? `${JSON.stringify(checkpoint, null, 2)}\n`
294
- : renderAgentCheckpointMarkdown(checkpoint);
295
-
296
- const outputPath = getFlagValue(args, "--out");
297
- if (outputPath) {
298
- const resolvedOutputPath = await writeAgentCheckpointOutput(outputPath, renderedOutput);
299
- process.stdout.write(`已保存 agent checkpoint:${resolvedOutputPath}\n`);
300
- return;
301
- }
302
-
303
- process.stdout.write(renderedOutput);
304
- }
305
-
306
- async function handleAgentDecisionLog(args) {
307
- const input = args.find((value) => !value.startsWith("-"));
308
- if (!input) {
309
- throw new Error("agent-decision-log 需要一个输入值,可以是项目路径、网站网址或已导出的工件");
310
- }
311
-
312
- const format = getFlagValue(args, "--format") || (hasFlag(args, "--json") ? "json" : undefined);
313
- const decisionLog = await createAgentDecisionLog(input, {
314
- format,
315
- appendFrom: getFlagValue(args, "--append-from"),
316
- note: getFlagValue(args, "--note"),
317
- currentTaskId: getFlagValue(args, "--current"),
318
- completedPacketIds: getFlagValue(args, "--completed"),
319
- blockedReasons: getFlagValue(args, "--blocked")
320
- });
321
- const outputJson = decisionLog.format === "json";
322
- const renderedOutput = outputJson
323
- ? `${JSON.stringify(decisionLog, null, 2)}\n`
324
- : renderAgentDecisionLogMarkdown(decisionLog);
325
-
326
- const outputPath = getFlagValue(args, "--out");
327
- if (outputPath) {
328
- const resolvedOutputPath = await writeAgentDecisionLogOutput(outputPath, renderedOutput);
329
- process.stdout.write(`已保存 agent decision log:${resolvedOutputPath}\n`);
330
- return;
331
- }
332
-
333
- process.stdout.write(renderedOutput);
334
- }
335
-
336
- async function handleAgentRetrospective(args) {
337
- const input = args.find((value) => !value.startsWith("-"));
338
- if (!input) {
339
- throw new Error("agent-retrospective 需要一个输入值,可以是项目路径、网站网址或已导出的工件");
340
- }
341
-
342
- const format = getFlagValue(args, "--format") || (hasFlag(args, "--json") ? "json" : undefined);
343
- const retrospective = await createAgentRetrospective(input, {
344
- format
345
- });
346
- const outputJson = retrospective.format === "json";
347
- const renderedOutput = outputJson
348
- ? `${JSON.stringify(retrospective, null, 2)}\n`
349
- : renderAgentRetrospectiveMarkdown(retrospective);
350
-
351
- const outputPath = getFlagValue(args, "--out");
352
- if (outputPath) {
353
- const resolvedOutputPath = await writeAgentRetrospectiveOutput(outputPath, renderedOutput);
354
- process.stdout.write(`已保存 agent retrospective:${resolvedOutputPath}\n`);
355
- return;
356
- }
357
-
358
- process.stdout.write(renderedOutput);
359
- }
360
-
361
- async function handleAgentPlaybookPack(args) {
362
- const input = args.find((value) => !value.startsWith("-"));
363
- if (!input) {
364
- throw new Error("agent-playbook-pack 需要一个输入值,可以是项目路径、网站网址或已导出的工件");
365
- }
366
-
367
- const format = getFlagValue(args, "--format") || (hasFlag(args, "--json") ? "json" : undefined);
368
- const pack = await createAgentPlaybookPack(input, {
369
- format,
370
- taskId: getFlagValue(args, "--task")
371
- });
372
- const outputJson = pack.format === "json";
373
- const renderedOutput = outputJson
374
- ? `${JSON.stringify(pack, null, 2)}\n`
375
- : renderAgentPlaybookPackMarkdown(pack);
376
-
377
- const outputPath = getFlagValue(args, "--out");
378
- if (outputPath) {
379
- const resolvedOutputPath = await writeAgentPlaybookPackOutput(outputPath, renderedOutput);
380
- process.stdout.write(`已保存 agent playbook pack:${resolvedOutputPath}\n`);
381
- return;
382
- }
383
-
384
- process.stdout.write(renderedOutput);
385
- }
386
-
387
86
  function handleWhere() {
388
87
  process.stdout.write(
389
88
  [
@@ -576,339 +275,11 @@ async function handleAudit(args) {
576
275
  process.stdout.write(renderedOutput);
577
276
  }
578
277
 
579
- async function handleReport(args) {
580
- const input = args.find((value) => !value.startsWith("-"));
581
- if (!input) {
582
- throw new Error("report 需要一个输入值,可以是本地项目路径或网站网址");
583
- }
584
-
585
- const maxFileSizeValue = getFlagValue(args, "--max-file-size");
586
- const maxExamplesValue = getFlagValue(args, "--max-examples");
587
- const report = await generateReport(input, {
588
- mode: getFlagValue(args, "--mode"),
589
- format: getFlagValue(args, "--format"),
590
- maxFileSize: maxFileSizeValue ? parsePositiveInteger(maxFileSizeValue, "--max-file-size") : undefined,
591
- maxExamples: maxExamplesValue ? parsePositiveInteger(maxExamplesValue, "--max-examples") : undefined
592
- });
593
-
594
- const outputPath = getFlagValue(args, "--out");
595
- if (outputPath) {
596
- const resolvedOutputPath = await writeReportOutput(outputPath, report.content);
597
- process.stdout.write(`已保存报告:${resolvedOutputPath}\n`);
598
- return;
599
- }
600
-
601
- process.stdout.write(report.content);
602
- }
603
-
604
- async function handleFixPlan(args) {
605
- const input = args.find((value) => !value.startsWith("-"));
606
- if (!input) {
607
- throw new Error("fix-plan 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 报告");
608
- }
609
-
610
- const format = getFlagValue(args, "--format");
611
- const plan = await createFixPlan(input, { format });
612
- const outputJson = format === "json";
613
- const renderedOutput = outputJson
614
- ? `${JSON.stringify(plan, null, 2)}\n`
615
- : renderFixPlanMarkdown(plan);
616
-
617
- const outputPath = getFlagValue(args, "--out");
618
- if (outputPath) {
619
- const resolvedOutputPath = await writeFixPlanOutput(outputPath, renderedOutput);
620
- process.stdout.write(`已保存 fix plan:${resolvedOutputPath}\n`);
621
- return;
622
- }
623
-
624
- process.stdout.write(renderedOutput);
625
- }
626
-
627
- async function handleAgentHandoff(args) {
628
- const input = args.find((value) => !value.startsWith("-"));
629
- if (!input) {
630
- throw new Error("agent-handoff 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 报告");
631
- }
632
-
633
- const format = getFlagValue(args, "--format");
634
- const handoff = await createAgentHandoff(input, { format });
635
- const outputJson = format === "json";
636
- const renderedOutput = outputJson
637
- ? `${JSON.stringify(handoff, null, 2)}\n`
638
- : renderAgentHandoffMarkdown(handoff);
639
-
640
- const outputPath = getFlagValue(args, "--out");
641
- if (outputPath) {
642
- const resolvedOutputPath = await writeAgentHandoffOutput(outputPath, renderedOutput);
643
- process.stdout.write(`已保存 agent handoff:${resolvedOutputPath}\n`);
644
- return;
645
- }
646
-
647
- process.stdout.write(renderedOutput);
648
- }
649
-
650
- async function handleApplyPlan(args) {
651
- const input = args.find((value) => !value.startsWith("-"));
652
- if (!input) {
653
- throw new Error("apply-plan 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 报告");
654
- }
655
-
656
- const format = getFlagValue(args, "--format");
657
- const plan = await createApplyPlan(input, {
658
- format,
659
- taskId: getFlagValue(args, "--task")
660
- });
661
- const outputJson = format === "json";
662
- const renderedOutput = outputJson
663
- ? `${JSON.stringify(plan, null, 2)}\n`
664
- : renderApplyPlanMarkdown(plan);
665
-
666
- const outputPath = getFlagValue(args, "--out");
667
- if (outputPath) {
668
- const resolvedOutputPath = await writeApplyPlanOutput(outputPath, renderedOutput);
669
- process.stdout.write(`已保存 apply plan:${resolvedOutputPath}\n`);
670
- return;
671
- }
672
-
673
- process.stdout.write(renderedOutput);
674
- }
675
-
676
- async function handleCompletionReport(args) {
677
- const input = args.find((value) => !value.startsWith("-"));
678
- if (!input) {
679
- throw new Error("completion-report 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 工件");
680
- }
681
-
682
- const format = getFlagValue(args, "--format");
683
- const report = await createCompletionReport(input, { format });
684
- const outputJson = format === "json";
685
- const renderedOutput = outputJson
686
- ? `${JSON.stringify(report, null, 2)}\n`
687
- : renderCompletionReportMarkdown(report);
688
-
689
- const outputPath = getFlagValue(args, "--out");
690
- if (outputPath) {
691
- const resolvedOutputPath = await writeCompletionReportOutput(outputPath, renderedOutput);
692
- process.stdout.write(`已保存 completion report:${resolvedOutputPath}\n`);
693
- return;
694
- }
695
-
696
- process.stdout.write(renderedOutput);
697
- }
698
-
699
- async function handleHandoffBundle(args) {
700
- const input = args.find((value) => !value.startsWith("-"));
701
- if (!input) {
702
- throw new Error("handoff-bundle 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 工件");
703
- }
704
-
705
- const format = getFlagValue(args, "--format");
706
- const bundle = await createHandoffBundle(input, {
707
- format,
708
- taskId: getFlagValue(args, "--task")
709
- });
710
- const outputJson = format === "json";
711
- const renderedOutput = outputJson
712
- ? `${JSON.stringify(bundle, null, 2)}\n`
713
- : renderHandoffBundleMarkdown(bundle);
714
-
715
- const outputPath = getFlagValue(args, "--out");
716
- if (outputPath) {
717
- const resolvedOutputPath = await writeHandoffBundleOutput(outputPath, renderedOutput);
718
- process.stdout.write(`已保存 handoff bundle:${resolvedOutputPath}\n`);
719
- return;
720
- }
721
-
722
- process.stdout.write(renderedOutput);
723
- }
724
-
725
- async function handleSharePack(args) {
726
- const input = args.find((value) => !value.startsWith("-"));
727
- if (!input) {
728
- throw new Error("share-pack 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 工件");
729
- }
730
-
731
- const format = getFlagValue(args, "--format");
732
- const pack = await createSharePack(input, {
733
- format,
734
- taskId: getFlagValue(args, "--task")
735
- });
736
- const outputJson = format === "json";
737
- const renderedOutput = outputJson
738
- ? `${JSON.stringify(pack, null, 2)}\n`
739
- : renderSharePackMarkdown(pack);
740
-
741
- const outputPath = getFlagValue(args, "--out");
742
- if (outputPath) {
743
- const resolvedOutputPath = await writeSharePackOutput(outputPath, renderedOutput);
744
- process.stdout.write(`已保存 share pack:${resolvedOutputPath}\n`);
745
- return;
746
- }
747
-
748
- process.stdout.write(renderedOutput);
749
- }
750
-
751
- async function handleExportPack(args) {
752
- const input = args.find((value) => !value.startsWith("-"));
753
- if (!input) {
754
- throw new Error("export-pack 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 工件");
755
- }
756
-
757
- const pack = await writeExportPack(input, {
758
- format: getFlagValue(args, "--format"),
759
- taskId: getFlagValue(args, "--task"),
760
- outputDir: getFlagValue(args, "--out-dir")
761
- });
762
-
763
- process.stdout.write(renderExportPackMarkdown(pack));
764
- }
765
-
766
- async function handleHtmlPack(args) {
767
- const input = args.find((value) => !value.startsWith("-"));
768
- if (!input) {
769
- throw new Error("html-pack 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 工件");
770
- }
771
-
772
- const pack = await writeHtmlPack(input, {
773
- taskId: getFlagValue(args, "--task"),
774
- outputDir: getFlagValue(args, "--out-dir")
775
- });
776
-
777
- process.stdout.write(renderHtmlPackMarkdown(pack));
778
- }
779
-
780
- async function handlePublishPack(args) {
781
- const input = args.find((value) => !value.startsWith("-"));
782
- if (!input) {
783
- throw new Error("publish-pack 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 工件");
784
- }
785
-
786
- const pack = await writePublishPack(input, {
787
- taskId: getFlagValue(args, "--task"),
788
- outputDir: getFlagValue(args, "--out-dir")
789
- });
790
-
791
- process.stdout.write(renderPublishPackMarkdown(pack));
792
- }
793
-
794
- async function handleExecSummary(args) {
795
- const input = args.find((value) => !value.startsWith("-"));
796
- if (!input) {
797
- throw new Error("exec-summary 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 报告");
798
- }
799
-
800
- const format = getFlagValue(args, "--format");
801
- const summary = await createExecSummary(input, { format });
802
- const outputJson = format === "json";
803
- const renderedOutput = outputJson
804
- ? `${JSON.stringify(summary, null, 2)}\n`
805
- : renderExecSummaryMarkdown(summary);
806
-
807
- const outputPath = getFlagValue(args, "--out");
808
- if (outputPath) {
809
- const resolvedOutputPath = await writeExecSummaryOutput(outputPath, renderedOutput);
810
- process.stdout.write(`已保存 exec summary:${resolvedOutputPath}\n`);
811
- return;
812
- }
813
-
814
- process.stdout.write(renderedOutput);
815
- }
816
-
817
- async function handleOwnerBoard(args) {
818
- const input = args.find((value) => !value.startsWith("-"));
819
- if (!input) {
820
- throw new Error("owner-board 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 报告");
821
- }
822
-
823
- const format = getFlagValue(args, "--format");
824
- const board = await createOwnerBoard(input, { format });
825
- const outputJson = format === "json";
826
- const renderedOutput = outputJson
827
- ? `${JSON.stringify(board, null, 2)}\n`
828
- : renderOwnerBoardMarkdown(board);
829
-
830
- const outputPath = getFlagValue(args, "--out");
831
- if (outputPath) {
832
- const resolvedOutputPath = await writeOwnerBoardOutput(outputPath, renderedOutput);
833
- process.stdout.write(`已保存 owner board:${resolvedOutputPath}\n`);
834
- return;
835
- }
836
-
837
- process.stdout.write(renderedOutput);
838
- }
839
-
840
- async function handleMeetingPack(args) {
841
- const input = args.find((value) => !value.startsWith("-"));
842
- if (!input) {
843
- throw new Error("meeting-pack 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 报告");
844
- }
845
-
846
- const format = getFlagValue(args, "--format");
847
- const pack = await createMeetingPack(input, { format });
848
- const outputJson = format === "json";
849
- const renderedOutput = outputJson
850
- ? `${JSON.stringify(pack, null, 2)}\n`
851
- : renderMeetingPackMarkdown(pack);
852
-
853
- const outputPath = getFlagValue(args, "--out");
854
- if (outputPath) {
855
- const resolvedOutputPath = await writeMeetingPackOutput(outputPath, renderedOutput);
856
- process.stdout.write(`已保存 meeting pack:${resolvedOutputPath}\n`);
857
- return;
858
- }
859
-
860
- process.stdout.write(renderedOutput);
861
- }
862
-
863
- async function handlePmBrief(args) {
864
- const input = args.find((value) => !value.startsWith("-"));
865
- if (!input) {
866
- throw new Error("pm-brief 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 报告");
867
- }
868
-
869
- const format = getFlagValue(args, "--format");
870
- const brief = await createPmBrief(input, { format });
871
- const outputJson = format === "json";
872
- const renderedOutput = outputJson
873
- ? `${JSON.stringify(brief, null, 2)}\n`
874
- : renderPmBriefMarkdown(brief);
875
-
876
- const outputPath = getFlagValue(args, "--out");
877
- if (outputPath) {
878
- const resolvedOutputPath = await writePmBriefOutput(outputPath, renderedOutput);
879
- process.stdout.write(`已保存 PM brief:${resolvedOutputPath}\n`);
880
- return;
881
- }
882
-
883
- process.stdout.write(renderedOutput);
884
- }
885
-
886
- async function handleRoadmap(args) {
887
- const input = args.find((value) => !value.startsWith("-"));
888
- if (!input) {
889
- throw new Error("roadmap 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 报告");
890
- }
891
-
892
- const format = getFlagValue(args, "--format");
893
- const roadmap = await createRoadmap(input, { format });
894
- const outputJson = format === "json";
895
- const renderedOutput = outputJson
896
- ? `${JSON.stringify(roadmap, null, 2)}\n`
897
- : renderRoadmapMarkdown(roadmap);
898
-
899
- const outputPath = getFlagValue(args, "--out");
900
- if (outputPath) {
901
- const resolvedOutputPath = await writeRoadmapOutput(outputPath, renderedOutput);
902
- process.stdout.write(`已保存 roadmap:${resolvedOutputPath}\n`);
903
- return;
904
- }
905
-
906
- process.stdout.write(renderedOutput);
907
- }
908
-
909
278
  export async function runCli(args = []) {
910
279
  const [command = "install", ...rest] = args;
911
280
  const flowHandler = FLOW_COMMAND_HANDLERS[command];
281
+ const agentExecutionHandler = AGENT_EXECUTION_COMMAND_HANDLERS[command];
282
+ const planningDeliveryHandler = PLANNING_DELIVERY_COMMAND_HANDLERS[command];
912
283
 
913
284
  if (command === "help" || command === "--help" || command === "-h") {
914
285
  printHelp();
@@ -930,48 +301,13 @@ export async function runCli(args = []) {
930
301
  return;
931
302
  }
932
303
 
933
- if (command === "agent-runbook") {
934
- await handleAgentRunbook(rest);
935
- return;
936
- }
937
-
938
- if (command === "agent-executor") {
939
- await handleAgentExecutor(rest);
940
- return;
941
- }
942
-
943
- if (command === "agent-batch-executor") {
944
- await handleAgentBatchExecutor(rest);
945
- return;
946
- }
947
-
948
- if (command === "agent-progress-tracker") {
949
- await handleAgentProgressTracker(rest);
950
- return;
951
- }
952
-
953
- if (command === "agent-status-board") {
954
- await handleAgentStatusBoard(rest);
955
- return;
956
- }
957
-
958
- if (command === "agent-checkpoint") {
959
- await handleAgentCheckpoint(rest);
960
- return;
961
- }
962
-
963
- if (command === "agent-decision-log") {
964
- await handleAgentDecisionLog(rest);
965
- return;
966
- }
967
-
968
- if (command === "agent-retrospective") {
969
- await handleAgentRetrospective(rest);
304
+ if (agentExecutionHandler) {
305
+ await agentExecutionHandler(rest);
970
306
  return;
971
307
  }
972
308
 
973
- if (command === "agent-playbook-pack") {
974
- await handleAgentPlaybookPack(rest);
309
+ if (planningDeliveryHandler) {
310
+ await planningDeliveryHandler(rest);
975
311
  return;
976
312
  }
977
313
 
@@ -1020,81 +356,6 @@ export async function runCli(args = []) {
1020
356
  return;
1021
357
  }
1022
358
 
1023
- if (command === "agent-handoff") {
1024
- await handleAgentHandoff(rest);
1025
- return;
1026
- }
1027
-
1028
- if (command === "apply-plan") {
1029
- await handleApplyPlan(rest);
1030
- return;
1031
- }
1032
-
1033
- if (command === "completion-report") {
1034
- await handleCompletionReport(rest);
1035
- return;
1036
- }
1037
-
1038
- if (command === "handoff-bundle") {
1039
- await handleHandoffBundle(rest);
1040
- return;
1041
- }
1042
-
1043
- if (command === "share-pack") {
1044
- await handleSharePack(rest);
1045
- return;
1046
- }
1047
-
1048
- if (command === "export-pack") {
1049
- await handleExportPack(rest);
1050
- return;
1051
- }
1052
-
1053
- if (command === "html-pack") {
1054
- await handleHtmlPack(rest);
1055
- return;
1056
- }
1057
-
1058
- if (command === "publish-pack") {
1059
- await handlePublishPack(rest);
1060
- return;
1061
- }
1062
-
1063
- if (command === "exec-summary") {
1064
- await handleExecSummary(rest);
1065
- return;
1066
- }
1067
-
1068
- if (command === "fix-plan") {
1069
- await handleFixPlan(rest);
1070
- return;
1071
- }
1072
-
1073
- if (command === "owner-board") {
1074
- await handleOwnerBoard(rest);
1075
- return;
1076
- }
1077
-
1078
- if (command === "meeting-pack") {
1079
- await handleMeetingPack(rest);
1080
- return;
1081
- }
1082
-
1083
- if (command === "pm-brief") {
1084
- await handlePmBrief(rest);
1085
- return;
1086
- }
1087
-
1088
- if (command === "roadmap") {
1089
- await handleRoadmap(rest);
1090
- return;
1091
- }
1092
-
1093
- if (command === "report") {
1094
- await handleReport(rest);
1095
- return;
1096
- }
1097
-
1098
359
  if (command === "scan") {
1099
360
  await handleScan(rest);
1100
361
  return;