geo-ai-search-optimization 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -189,6 +189,42 @@ geo-ai-search-optimization completion-report https://example.com
189
189
  - 建议复测命令
190
190
  - 可直接复用的完成回报模板
191
191
 
192
+ ## Handoff Bundle 命令
193
+
194
+ 如果你希望把 `agent-handoff`、`apply-plan`、`completion-report` 一次打成一个完整交接包,现在可以用 `handoff-bundle`:
195
+
196
+ ```bash
197
+ geo-ai-search-optimization handoff-bundle ./your-site
198
+ geo-ai-search-optimization handoff-bundle ./your-site --task fix-01 --format json --out ./reports/handoff-bundle.json
199
+ geo-ai-search-optimization handoff-bundle https://example.com
200
+ ```
201
+
202
+ `handoff-bundle` 会输出:
203
+
204
+ - 单一 bundle summary
205
+ - handoff 摘要
206
+ - apply plan 摘要
207
+ - completion report 摘要
208
+ - 下一步该先做哪一个任务
209
+
210
+ ## Share Pack 命令
211
+
212
+ 如果你希望把同一份 GEO 结果直接分享给 PM、工程、管理层和下一位 agent,现在可以用 `share-pack`:
213
+
214
+ ```bash
215
+ geo-ai-search-optimization share-pack ./your-site
216
+ geo-ai-search-optimization share-pack ./your-site --task fix-01 --format json --out ./reports/share-pack.json
217
+ geo-ai-search-optimization share-pack https://example.com
218
+ ```
219
+
220
+ `share-pack` 会输出:
221
+
222
+ - 给 PM 的摘要
223
+ - 给工程 / 执行团队的任务视图
224
+ - 给管理层的高层摘要
225
+ - 给下一位 agent 的交接入口
226
+ - 建议分享顺序
227
+
192
228
  ## Fix Plan 命令
193
229
 
194
230
  如果你已经跑过 `audit`、`report` 或 `onboard-url`,下一步就可以直接把结果转成 PM 待办清单:
@@ -342,6 +378,8 @@ geo-ai-search-optimization audit ./my-site
342
378
  geo-ai-search-optimization agent-handoff ./my-site
343
379
  geo-ai-search-optimization apply-plan ./my-site
344
380
  geo-ai-search-optimization completion-report ./my-site
381
+ geo-ai-search-optimization handoff-bundle ./my-site
382
+ geo-ai-search-optimization share-pack ./my-site
345
383
  geo-ai-search-optimization exec-summary ./my-site
346
384
  geo-ai-search-optimization fix-plan ./my-site
347
385
  geo-ai-search-optimization owner-board ./my-site
@@ -357,6 +395,20 @@ geo-ai-search-optimization version
357
395
  geo-ai-search-optimization help
358
396
  ```
359
397
 
398
+ ## New in 1.2.2
399
+
400
+ - 新增 `share-pack`
401
+ - 让同一份 GEO 结果按 PM、工程、管理层、Agent 四种视图分享
402
+ - 更适合直接转发,而不是人工重新整理内容
403
+ - 新增 `geo-ai-search-optimization-share-pack` skill,帮助消费分享包
404
+
405
+ ## New in 1.2.1
406
+
407
+ - 新增 `handoff-bundle`
408
+ - 把 `agent-handoff + apply-plan + completion-report` 打成一个完整交接包
409
+ - 更适合 agent 或团队直接接力,而不用自己拼多个工件
410
+ - 新增 `geo-ai-search-optimization-handoff-bundle` skill,帮助消费 bundle
411
+
360
412
  ## New in 1.2.0
361
413
 
362
414
  - 新增 `completion-report`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geo-ai-search-optimization",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
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": {
@@ -45,6 +45,8 @@ geo-ai-search-optimization fix-plan ./your-site --format json --out ./reports/fi
45
45
  geo-ai-search-optimization agent-handoff ./your-site --out ./reports/agent-handoff.md
46
46
  geo-ai-search-optimization apply-plan ./your-site --out ./reports/apply-plan.md
47
47
  geo-ai-search-optimization completion-report ./your-site --out ./reports/completion-report.md
48
+ geo-ai-search-optimization handoff-bundle ./your-site --out ./reports/handoff-bundle.md
49
+ geo-ai-search-optimization share-pack ./your-site --out ./reports/share-pack.md
48
50
  geo-ai-search-optimization owner-board ./your-site --out ./reports/owner-board.md
49
51
  geo-ai-search-optimization meeting-pack ./your-site --out ./reports/meeting-pack.md
50
52
  geo-ai-search-optimization pm-brief ./your-site --out ./reports/pm-brief.md
@@ -61,7 +63,9 @@ geo-ai-search-optimization roadmap ./your-site --out ./reports/roadmap.md
61
63
  4. 需要交接给 agent 时,生成 agent-handoff 工件
62
64
  5. 需要 agent 直接开始做时,生成 apply-plan
63
65
  6. 完成一轮后生成 completion-report
64
- 7. 重跑 scan / audit / report 验证是否改善
66
+ 7. 需要完整交接包时生成 handoff-bundle
67
+ 8. 需要发给不同角色时生成 share-pack
68
+ 9. 重跑 scan / audit / report 验证是否改善
65
69
 
66
70
  ## 推荐节奏
67
71
 
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: geo-ai-search-optimization-handoff-bundle
3
+ description: Consume a bundled GEO handoff package that contains agent-handoff, apply-plan, and completion-report together. Use when an agent or PM needs one consolidated artifact to continue GEO execution without jumping across multiple files.
4
+ ---
5
+
6
+ # GEO Handoff Bundle
7
+
8
+ Use this skill when the user gives you a combined GEO execution package and expects you to continue from it directly.
9
+
10
+ `GEO = Generative Engine Optimization`
11
+
12
+ ## What a handoff bundle means
13
+
14
+ A handoff bundle is the single-file version of the GEO execution loop:
15
+
16
+ 1. `agent-handoff`: what the next agent should take over
17
+ 2. `apply-plan`: how to execute
18
+ 3. `completion-report`: how to close out the round
19
+
20
+ ## How to use it
21
+
22
+ - read the bundle summary first
23
+ - inspect `applyPlan.packets[0]` or the explicitly requested task first
24
+ - use `completionReport` to understand residual risks and next-round work
25
+ - if you need the exact prompts, use the nested `handoff` and `applyPlan` fields
26
+
27
+ ## Response order
28
+
29
+ Always tell the user:
30
+
31
+ 1. what task you will start with
32
+ 2. what mode you are in
33
+ 3. what you will do next
34
+ 4. how you will report completion
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: geo-ai-search-optimization-share-pack
3
+ description: Use when a GEO result needs to be shared to different audiences. It combines PM, execution, executive, and agent-facing views into one package so teams can distribute the right output without manually repackaging artifacts.
4
+ ---
5
+
6
+ # GEO Share Pack
7
+
8
+ Use this skill when the user wants a shareable GEO package for multiple audiences.
9
+
10
+ `GEO = Generative Engine Optimization`
11
+
12
+ ## What it contains
13
+
14
+ A share pack combines:
15
+
16
+ - PM-facing summary
17
+ - execution-team task view
18
+ - executive summary
19
+ - agent handoff bundle
20
+
21
+ ## How to use it
22
+
23
+ - read the audience order first
24
+ - send the PM section to prioritization owners
25
+ - send the owner board section to execution teams
26
+ - send the executive section to management
27
+ - send the handoff bundle section to the next agent
@@ -13,7 +13,7 @@ Treat this tool as a PM-friendly GEO workflow for websites.
13
13
 
14
14
  `GEO = Generative Engine Optimization`
15
15
 
16
- The package is best explained as eight layers:
16
+ The package is best explained as ten layers:
17
17
 
18
18
  1. `onboard-url` / `onboard`: first look
19
19
  2. `scan`: raw signal check
@@ -22,7 +22,9 @@ The package is best explained as eight layers:
22
22
  5. `agent-handoff`: agent takeover package
23
23
  6. `apply-plan`: execution loop
24
24
  7. `completion-report`: closeout
25
- 8. `pm-brief` / `roadmap`: stakeholder alignment
25
+ 8. `handoff-bundle`: all-in-one package
26
+ 9. `share-pack`: audience-ready delivery
27
+ 10. `pm-brief` / `roadmap`: stakeholder alignment
26
28
 
27
29
  ## Recommended command order
28
30
 
@@ -43,6 +45,8 @@ npx geo-ai-search-optimization fix-plan ./your-site
43
45
  npx geo-ai-search-optimization agent-handoff ./your-site
44
46
  npx geo-ai-search-optimization apply-plan ./your-site
45
47
  npx geo-ai-search-optimization completion-report ./your-site
48
+ npx geo-ai-search-optimization handoff-bundle ./your-site
49
+ npx geo-ai-search-optimization share-pack ./your-site
46
50
  npx geo-ai-search-optimization owner-board ./your-site
47
51
  npx geo-ai-search-optimization roadmap ./your-site
48
52
  ```
@@ -58,6 +62,8 @@ npx geo-ai-search-optimization roadmap ./your-site
58
62
  - `agent-handoff`: turn GEO findings into an artifact an agent can directly continue from
59
63
  - `apply-plan`: turn handoff into execution packets with validation commands and completion template
60
64
  - `completion-report`: summarize what the agent finished, residual risks, and next-round work
65
+ - `handoff-bundle`: combine handoff, execution, and closeout into one artifact
66
+ - `share-pack`: prepare role-specific shareable outputs for PM, engineering, management, and agents
61
67
  - `owner-board`: group tasks by PM / engineering / SEO / content
62
68
  - `pm-brief`: prepare a PM summary for meetings and prioritization
63
69
  - `roadmap`: turn tasks into a 2-week / 4-week execution sequence
@@ -72,6 +78,8 @@ When explaining the tool to a user:
72
78
  - if the user wants another agent to take over, move them to `agent-handoff`
73
79
  - if the user wants the next agent to start executing, move them to `apply-plan`
74
80
  - if the user wants a closeout summary after one round, move them to `completion-report`
81
+ - if the user wants one consolidated artifact, move them to `handoff-bundle`
82
+ - if the user wants something ready to forward to multiple audiences, move them to `share-pack`
75
83
  - if the user already has a report, move them to `fix-plan`, `owner-board`, or `roadmap`
76
84
 
77
85
  Read [references/usage-patterns.md](references/usage-patterns.md) when you need response patterns and command selection examples.
@@ -87,6 +87,22 @@ If they only have a URL:
87
87
  npx geo-ai-search-optimization completion-report https://example.com
88
88
  ```
89
89
 
90
+ ## If the user says "我想要一个完整交接包"
91
+
92
+ Recommend:
93
+
94
+ ```bash
95
+ npx geo-ai-search-optimization handoff-bundle ./your-site
96
+ ```
97
+
98
+ ## If the user says "我想直接分享给不同角色"
99
+
100
+ Recommend:
101
+
102
+ ```bash
103
+ npx geo-ai-search-optimization share-pack ./your-site
104
+ ```
105
+
90
106
  ## If the user says "我要开会同步"
91
107
 
92
108
  Recommend:
package/src/cli.js CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  renderCompletionReportMarkdown,
9
9
  writeCompletionReportOutput
10
10
  } from "./completion-report.js";
11
+ import { createHandoffBundle, renderHandoffBundleMarkdown, writeHandoffBundleOutput } from "./handoff-bundle.js";
11
12
  import { installSkill } from "./install-skill.js";
12
13
  import { getBundledSkillPath, getInstalledSkillPath, getSkillName, getSkillsDir } from "./paths.js";
13
14
  import { renderScanMarkdown, scanProject, writeScanOutput } from "./scan.js";
@@ -28,6 +29,7 @@ import {
28
29
  } from "./interactive-onboarding.js";
29
30
  import { createQuickStartPlan, renderQuickStartMarkdown, writeQuickStartOutput } from "./quick-start.js";
30
31
  import { createSchemaTemplate } from "./schema.js";
32
+ import { createSharePack, renderSharePackMarkdown, writeSharePackOutput } from "./share-pack.js";
31
33
  import { analyzeWebsiteUrl, renderWebsiteOnboardingMarkdown, writeWebsiteOnboardingOutput } from "./url-onboarding.js";
32
34
 
33
35
  let cachedVersion;
@@ -62,6 +64,8 @@ function printHelp() {
62
64
  " geo-ai-search-optimization agent-handoff <input> [--format <markdown|json>] [--out <file>]",
63
65
  " geo-ai-search-optimization apply-plan <input> [--task <id>] [--format <markdown|json>] [--out <file>]",
64
66
  " geo-ai-search-optimization completion-report <input> [--format <markdown|json>] [--out <file>]",
67
+ " geo-ai-search-optimization handoff-bundle <input> [--task <id>] [--format <markdown|json>] [--out <file>]",
68
+ " geo-ai-search-optimization share-pack <input> [--task <id>] [--format <markdown|json>] [--out <file>]",
65
69
  " geo-ai-search-optimization exec-summary <input> [--format <markdown|json>] [--out <file>]",
66
70
  " geo-ai-search-optimization fix-plan <input> [--format <markdown|json>] [--out <file>]",
67
71
  " geo-ai-search-optimization owner-board <input> [--format <markdown|json>] [--out <file>]",
@@ -417,6 +421,58 @@ async function handleCompletionReport(args) {
417
421
  process.stdout.write(renderedOutput);
418
422
  }
419
423
 
424
+ async function handleHandoffBundle(args) {
425
+ const input = args.find((value) => !value.startsWith("-"));
426
+ if (!input) {
427
+ throw new Error("handoff-bundle 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 工件");
428
+ }
429
+
430
+ const format = getFlagValue(args, "--format");
431
+ const bundle = await createHandoffBundle(input, {
432
+ format,
433
+ taskId: getFlagValue(args, "--task")
434
+ });
435
+ const outputJson = format === "json";
436
+ const renderedOutput = outputJson
437
+ ? `${JSON.stringify(bundle, null, 2)}\n`
438
+ : renderHandoffBundleMarkdown(bundle);
439
+
440
+ const outputPath = getFlagValue(args, "--out");
441
+ if (outputPath) {
442
+ const resolvedOutputPath = await writeHandoffBundleOutput(outputPath, renderedOutput);
443
+ process.stdout.write(`已保存 handoff bundle:${resolvedOutputPath}\n`);
444
+ return;
445
+ }
446
+
447
+ process.stdout.write(renderedOutput);
448
+ }
449
+
450
+ async function handleSharePack(args) {
451
+ const input = args.find((value) => !value.startsWith("-"));
452
+ if (!input) {
453
+ throw new Error("share-pack 需要一个输入值,可以是项目路径、网站网址或已导出的 JSON 工件");
454
+ }
455
+
456
+ const format = getFlagValue(args, "--format");
457
+ const pack = await createSharePack(input, {
458
+ format,
459
+ taskId: getFlagValue(args, "--task")
460
+ });
461
+ const outputJson = format === "json";
462
+ const renderedOutput = outputJson
463
+ ? `${JSON.stringify(pack, null, 2)}\n`
464
+ : renderSharePackMarkdown(pack);
465
+
466
+ const outputPath = getFlagValue(args, "--out");
467
+ if (outputPath) {
468
+ const resolvedOutputPath = await writeSharePackOutput(outputPath, renderedOutput);
469
+ process.stdout.write(`已保存 share pack:${resolvedOutputPath}\n`);
470
+ return;
471
+ }
472
+
473
+ process.stdout.write(renderedOutput);
474
+ }
475
+
420
476
  async function handleExecSummary(args) {
421
477
  const input = args.find((value) => !value.startsWith("-"));
422
478
  if (!input) {
@@ -605,6 +661,16 @@ export async function runCli(args = []) {
605
661
  return;
606
662
  }
607
663
 
664
+ if (command === "handoff-bundle") {
665
+ await handleHandoffBundle(rest);
666
+ return;
667
+ }
668
+
669
+ if (command === "share-pack") {
670
+ await handleSharePack(rest);
671
+ return;
672
+ }
673
+
608
674
  if (command === "exec-summary") {
609
675
  await handleExecSummary(rest);
610
676
  return;
@@ -0,0 +1,118 @@
1
+ import { createAgentHandoff, writeAgentHandoffOutput } from "./agent-handoff.js";
2
+ import { createApplyPlan } from "./apply-plan.js";
3
+ import { createCompletionReport } from "./completion-report.js";
4
+
5
+ const VALID_FORMATS = new Set(["markdown", "json"]);
6
+
7
+ function normalizeFormat(format) {
8
+ const resolved = (format || "markdown").toLowerCase();
9
+ if (!VALID_FORMATS.has(resolved)) {
10
+ throw new Error(`不支持的 handoff-bundle 格式:${format}。可选值:${Array.from(VALID_FORMATS).join(", ")}`);
11
+ }
12
+ return resolved;
13
+ }
14
+
15
+ function buildBundleSummary(handoff, applyPlan, completionReport) {
16
+ return {
17
+ executionMode: handoff.executionMode,
18
+ executionType: applyPlan.executionType,
19
+ progressStatus: completionReport.progressStatus,
20
+ managementSummary: completionReport.managementSummary
21
+ };
22
+ }
23
+
24
+ function buildUsageAdvice(source, executionMode) {
25
+ if (executionMode === "implementation-ready") {
26
+ return [
27
+ `先看 geo-ai-search-optimization handoff-bundle ${source} 的总览,再从 apply-plan 的第一包开始执行。`,
28
+ "每完成一个任务后,更新 completion-report 作为本轮 closeout。"
29
+ ];
30
+ }
31
+ if (executionMode === "advice-only") {
32
+ return [
33
+ "先把 bundle 给 agent 或 PM,看清楚哪些建议已经足够、哪些还缺仓库上下文。",
34
+ "拿到仓库或 CMS 权限后,重新运行 handoff-bundle 进入 implementation-ready 模式。"
35
+ ];
36
+ }
37
+ return [
38
+ "先用 bundle 对齐顺序、风险和下一步。",
39
+ "补齐仓库或页面上下文后,再重跑 bundle,切到可执行模式。"
40
+ ];
41
+ }
42
+
43
+ export async function createHandoffBundle(input, options = {}) {
44
+ const format = normalizeFormat(options.format);
45
+ const [handoff, applyPlan, completionReport] = await Promise.all([
46
+ createAgentHandoff(input, { format: "json" }),
47
+ createApplyPlan(input, { format: "json", taskId: options.taskId }),
48
+ createCompletionReport(input, { format: "json" })
49
+ ]);
50
+
51
+ return {
52
+ kind: "geo-handoff-bundle",
53
+ source: handoff.source,
54
+ sourceType: handoff.sourceType,
55
+ format,
56
+ summary: buildBundleSummary(handoff, applyPlan, completionReport),
57
+ usageAdvice: buildUsageAdvice(handoff.source, handoff.executionMode),
58
+ handoff,
59
+ applyPlan,
60
+ completionReport
61
+ };
62
+ }
63
+
64
+ export function renderHandoffBundleMarkdown(bundle) {
65
+ const lines = [
66
+ "# GEO Handoff Bundle",
67
+ "",
68
+ `- 输入来源:\`${bundle.source}\``,
69
+ `- 来源类型:\`${bundle.sourceType}\``,
70
+ `- 执行模式:\`${bundle.summary.executionMode}\``,
71
+ `- 执行类型:\`${bundle.summary.executionType}\``,
72
+ `- 当前进度:${bundle.summary.progressStatus}`,
73
+ `- 管理层摘要:${bundle.summary.managementSummary}`,
74
+ "",
75
+ "## 使用建议",
76
+ ""
77
+ ];
78
+
79
+ for (const item of bundle.usageAdvice) {
80
+ lines.push(`- ${item}`);
81
+ }
82
+
83
+ lines.push(
84
+ "",
85
+ "## Agent Handoff 摘要",
86
+ "",
87
+ `- 当前总结:${bundle.handoff.summary}`,
88
+ `- 本轮目标:${bundle.handoff.primaryObjective}`,
89
+ `- 推荐命令数:${bundle.handoff.recommendedCommands.length}`,
90
+ "",
91
+ "## Apply Plan 摘要",
92
+ "",
93
+ `- 任务包数量:${bundle.applyPlan.selectedTaskCount}`,
94
+ `- 执行类型:${bundle.applyPlan.executionType}`,
95
+ `- 第一包:${bundle.applyPlan.packets[0]?.title ?? "无"}`,
96
+ "",
97
+ "## Completion Report 摘要",
98
+ "",
99
+ `- 本轮已完成项:${bundle.completionReport.completedThisRound.length}`,
100
+ `- 剩余风险:${bundle.completionReport.residualRisks.length}`,
101
+ `- 下一轮任务:${bundle.completionReport.nextRoundTasks.length}`,
102
+ "",
103
+ "## 建议下一步",
104
+ ""
105
+ );
106
+
107
+ if (bundle.applyPlan.packets.length > 0) {
108
+ lines.push(`- 先从 \`${bundle.applyPlan.packets[0].id}\` 开始。`);
109
+ }
110
+ lines.push("- 执行后更新 completion-report。");
111
+ lines.push("- 需要完整细节时,直接读取 bundle 里的 handoff / applyPlan / completionReport 字段。");
112
+
113
+ return `${lines.join("\n")}\n`;
114
+ }
115
+
116
+ export async function writeHandoffBundleOutput(outputPath, content) {
117
+ return writeAgentHandoffOutput(outputPath, content);
118
+ }
package/src/index.js CHANGED
@@ -9,6 +9,7 @@ export { createApplyPlan, renderApplyPlanMarkdown, writeApplyPlanOutput } from "
9
9
  export { createAgentHandoff, renderAgentHandoffMarkdown, writeAgentHandoffOutput } from "./agent-handoff.js";
10
10
  export { createCompletionReport, renderCompletionReportMarkdown, writeCompletionReportOutput } from "./completion-report.js";
11
11
  export { createFixPlan, renderFixPlanMarkdown, writeFixPlanOutput } from "./fix-plan.js";
12
+ export { createHandoffBundle, renderHandoffBundleMarkdown, writeHandoffBundleOutput } from "./handoff-bundle.js";
12
13
  export { installSkill } from "./install-skill.js";
13
14
  export { runCli } from "./cli.js";
14
15
  export { runDoctor, renderDoctorMarkdown } from "./doctor.js";
@@ -22,4 +23,5 @@ export { generateReport, writeReportOutput } from "./report.js";
22
23
  export { createRoadmap, renderRoadmapMarkdown, writeRoadmapOutput } from "./roadmap.js";
23
24
  export { createSchemaTemplate } from "./schema.js";
24
25
  export { scanProject, renderScanMarkdown, writeScanOutput } from "./scan.js";
26
+ export { createSharePack, renderSharePackMarkdown, writeSharePackOutput } from "./share-pack.js";
25
27
  export { analyzeWebsiteUrl, renderWebsiteOnboardingMarkdown, writeWebsiteOnboardingOutput } from "./url-onboarding.js";
@@ -60,7 +60,9 @@ function buildSteps() {
60
60
  "geo-ai-search-optimization fix-plan ./your-site --out ./reports/fix-plan.md",
61
61
  "geo-ai-search-optimization agent-handoff ./your-site --out ./reports/agent-handoff.md",
62
62
  "geo-ai-search-optimization apply-plan ./your-site --out ./reports/apply-plan.md",
63
- "geo-ai-search-optimization completion-report ./your-site --out ./reports/completion-report.md"
63
+ "geo-ai-search-optimization completion-report ./your-site --out ./reports/completion-report.md",
64
+ "geo-ai-search-optimization handoff-bundle ./your-site --out ./reports/handoff-bundle.md",
65
+ "geo-ai-search-optimization share-pack ./your-site --out ./reports/share-pack.md"
64
66
  ]
65
67
  },
66
68
  {
@@ -0,0 +1,131 @@
1
+ import { createExecSummary, writeExecSummaryOutput } from "./exec-summary.js";
2
+ import { createHandoffBundle } from "./handoff-bundle.js";
3
+ import { createOwnerBoard } from "./owner-board.js";
4
+ import { createPmBrief } from "./pm-brief.js";
5
+
6
+ const VALID_FORMATS = new Set(["markdown", "json"]);
7
+
8
+ function normalizeFormat(format) {
9
+ const resolved = (format || "markdown").toLowerCase();
10
+ if (!VALID_FORMATS.has(resolved)) {
11
+ throw new Error(`不支持的 share-pack 格式:${format}。可选值:${Array.from(VALID_FORMATS).join(", ")}`);
12
+ }
13
+ return resolved;
14
+ }
15
+
16
+ function buildRecommendedAudienceOrder(pack) {
17
+ const order = ["PM", "工程", "管理层", "Agent"];
18
+ if (pack.execSummary.thisWeek.length === 0) {
19
+ return ["PM", "管理层", "工程", "Agent"];
20
+ }
21
+ return order;
22
+ }
23
+
24
+ function buildShareGuidance(pack) {
25
+ const guidance = [];
26
+
27
+ guidance.push("先把 PM brief 发给负责排优先级和推进的人。");
28
+ guidance.push("把 owner board 发给执行团队,用来分工。");
29
+ guidance.push("把 exec summary 发给管理层,只保留为什么现在要做与本周重点。");
30
+ guidance.push("把 handoff bundle 发给下一位 agent,让它直接接手。");
31
+
32
+ if (pack.handoffBundle.summary.executionMode === "advice-only") {
33
+ guidance.push("当前还是建议模式,分享时要明确:还缺仓库或 CMS 上下文。");
34
+ }
35
+
36
+ return guidance;
37
+ }
38
+
39
+ export async function createSharePack(input, options = {}) {
40
+ const format = normalizeFormat(options.format);
41
+ const [pmBrief, ownerBoard, execSummary, handoffBundle] = await Promise.all([
42
+ createPmBrief(input, { format: "json" }),
43
+ createOwnerBoard(input, { format: "json" }),
44
+ createExecSummary(input, { format: "json" }),
45
+ createHandoffBundle(input, { format: "json", taskId: options.taskId })
46
+ ]);
47
+
48
+ return {
49
+ kind: "geo-share-pack",
50
+ source: pmBrief.source,
51
+ sourceType: pmBrief.sourceType,
52
+ format,
53
+ audienceOrder: buildRecommendedAudienceOrder({
54
+ pmBrief,
55
+ ownerBoard,
56
+ execSummary,
57
+ handoffBundle
58
+ }),
59
+ guidance: buildShareGuidance({
60
+ pmBrief,
61
+ ownerBoard,
62
+ execSummary,
63
+ handoffBundle
64
+ }),
65
+ pmBrief,
66
+ ownerBoard,
67
+ execSummary,
68
+ handoffBundle
69
+ };
70
+ }
71
+
72
+ export function renderSharePackMarkdown(pack) {
73
+ const lines = [
74
+ "# GEO Share Pack",
75
+ "",
76
+ `- 输入来源:\`${pack.source}\``,
77
+ `- 来源类型:\`${pack.sourceType}\``,
78
+ `- 建议分享顺序:${pack.audienceOrder.join(" -> ")}`,
79
+ "",
80
+ "## 分享建议",
81
+ ""
82
+ ];
83
+
84
+ for (const item of pack.guidance) {
85
+ lines.push(`- ${item}`);
86
+ }
87
+
88
+ lines.push(
89
+ "",
90
+ "## 给 PM",
91
+ "",
92
+ `- 一句话总结:${pack.pmBrief.oneLiner}`,
93
+ `- 当前状态:${pack.pmBrief.status}`,
94
+ `- 本周先做:${pack.pmBrief.thisWeek[0]?.action ?? "暂无"}`,
95
+ "",
96
+ "## 给工程 / 执行团队",
97
+ ""
98
+ );
99
+
100
+ for (const column of pack.ownerBoard.columns.filter((column) => column.count > 0)) {
101
+ lines.push(`- ${column.name}:${column.count} 项`);
102
+ }
103
+
104
+ lines.push(
105
+ "",
106
+ "## 给管理层",
107
+ "",
108
+ `- Headline:${pack.execSummary.headline}`,
109
+ `- Why Now:${pack.execSummary.whyNow}`,
110
+ `- Business Impact:${pack.execSummary.businessImpact}`,
111
+ "",
112
+ "## 给下一个 Agent",
113
+ "",
114
+ `- 执行模式:${pack.handoffBundle.summary.executionMode}`,
115
+ `- 执行类型:${pack.handoffBundle.summary.executionType}`,
116
+ `- 第一包:${pack.handoffBundle.applyPlan.packets[0]?.title ?? "无"}`,
117
+ "",
118
+ "## 下一步",
119
+ ""
120
+ );
121
+
122
+ lines.push("- PM 先确认本周优先级。");
123
+ lines.push("- 工程按 owner board 分工。");
124
+ lines.push("- Agent 直接从 handoff bundle 的第一包开始。");
125
+
126
+ return `${lines.join("\n")}\n`;
127
+ }
128
+
129
+ export async function writeSharePackOutput(outputPath, content) {
130
+ return writeExecSummaryOutput(outputPath, content);
131
+ }