geo-ai-search-optimization 1.2.6 → 1.2.7
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 +27 -0
- package/package.json +1 -1
- package/resources/geo-ai-search-optimization/references/skill-bundle-map.md +13 -0
- package/resources/geo-ai-search-optimization-auto-flow/SKILL.md +23 -0
- package/resources/geo-ai-search-optimization-auto-flow/agents/openai.yaml +4 -0
- package/resources/geo-ai-search-optimization-usage/SKILL.md +20 -15
- package/src/auto-flow.js +563 -0
- package/src/cli.js +29 -0
- package/src/index.js +1 -0
- package/src/skills.js +4 -0
package/README.md
CHANGED
|
@@ -42,6 +42,25 @@ geo-ai-search-optimization skills --json
|
|
|
42
42
|
- agent 执行闭环相关 skills
|
|
43
43
|
- 分享 / 导出 / 最终交付相关 skills
|
|
44
44
|
|
|
45
|
+
## Auto Flow 命令
|
|
46
|
+
|
|
47
|
+
如果你希望 agent 不用自己判断现在该用哪个 skill、该跑哪个命令,可以直接用 `auto-flow`:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
geo-ai-search-optimization auto-flow "我想把这份 GEO 结果交给下一个 agent 继续修"
|
|
51
|
+
geo-ai-search-optimization auto-flow https://example.com
|
|
52
|
+
geo-ai-search-optimization auto-flow ./your-site
|
|
53
|
+
geo-ai-search-optimization auto-flow ./reports/apply-plan.json --json
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
它会自动输出:
|
|
57
|
+
|
|
58
|
+
- 当前输入属于哪一类
|
|
59
|
+
- 现在更像诊断、执行、复盘还是交付阶段
|
|
60
|
+
- 最适合的下一个 skill
|
|
61
|
+
- 建议命令顺序
|
|
62
|
+
- 可直接复制给 agent 的 prompt
|
|
63
|
+
|
|
45
64
|
## Quick Start
|
|
46
65
|
|
|
47
66
|
如果你要从 0 到 1 启动一个 GEO 项目,建议照这个顺序做。
|
|
@@ -435,6 +454,7 @@ geo-ai-search-optimization onboard --url https://example.com --json --out ./repo
|
|
|
435
454
|
geo-ai-search-optimization
|
|
436
455
|
geo-ai-search-optimization install
|
|
437
456
|
geo-ai-search-optimization install --target ./tmp/custom-skills --json
|
|
457
|
+
geo-ai-search-optimization auto-flow "audit this site and tell me the next skill"
|
|
438
458
|
geo-ai-search-optimization skills
|
|
439
459
|
geo-ai-search-optimization where
|
|
440
460
|
geo-ai-search-optimization doctor
|
|
@@ -477,6 +497,13 @@ geo-ai-search-optimization help
|
|
|
477
497
|
- 为缺失的 skill 补齐 `agents/openai.yaml`
|
|
478
498
|
- 主 skill 新增 `skill-bundle-map` 参考,usage skill 也同步纳入 `publish-pack` 和 `skills`
|
|
479
499
|
|
|
500
|
+
## New in 1.2.7
|
|
501
|
+
|
|
502
|
+
- 新增 `auto-flow` 命令,自动选择下一步该用哪个 GEO skill
|
|
503
|
+
- 支持任务描述、网站网址、本地项目目录和 JSON 工件作为输入
|
|
504
|
+
- 输出推荐 skill、命令顺序与可直接复制给 agent 的 prompt
|
|
505
|
+
- 新增 `geo-ai-search-optimization-auto-flow` skill,作为 agent 的自动路由入口
|
|
506
|
+
|
|
480
507
|
## New in 1.2.5
|
|
481
508
|
|
|
482
509
|
- 新增 `publish-pack`
|
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
## Table of Contents
|
|
4
4
|
|
|
5
5
|
- Core skill
|
|
6
|
+
- Auto entry
|
|
6
7
|
- Usage guide
|
|
7
8
|
- Agent execution loop
|
|
8
9
|
- Delivery chain
|
|
@@ -19,6 +20,18 @@ Best for:
|
|
|
19
20
|
- improving answerability, structure, and citation readiness
|
|
20
21
|
- deciding what the highest-impact GEO fixes are
|
|
21
22
|
|
|
23
|
+
## Auto entry
|
|
24
|
+
|
|
25
|
+
### `geo-ai-search-optimization-auto-flow`
|
|
26
|
+
|
|
27
|
+
Use this when the next agent needs a routing entrypoint and should not have to decide manually which skill to use.
|
|
28
|
+
|
|
29
|
+
Best for:
|
|
30
|
+
|
|
31
|
+
- selecting the next skill from a URL, directory, or artifact
|
|
32
|
+
- turning one-line task briefs into a concrete command sequence
|
|
33
|
+
- deciding whether the work should move into diagnosis, execution, closeout, or delivery
|
|
34
|
+
|
|
22
35
|
## Usage guide
|
|
23
36
|
|
|
24
37
|
### `geo-ai-search-optimization-usage`
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: geo-ai-search-optimization-auto-flow
|
|
3
|
+
description: Automatically choose the next GEO skill and command chain from a task description, website URL, local project directory, or existing GEO artifact. Use when an agent needs a routing entrypoint to decide which GEO skill to invoke next and what commands should follow.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# GEO Auto Flow
|
|
7
|
+
|
|
8
|
+
Use this skill when the next agent should not have to guess which GEO skill to use.
|
|
9
|
+
|
|
10
|
+
`GEO = Generative Engine Optimization`
|
|
11
|
+
|
|
12
|
+
## What it does
|
|
13
|
+
|
|
14
|
+
- identify whether the input is a task brief, URL, project directory, or GEO artifact
|
|
15
|
+
- route to the most suitable next GEO skill
|
|
16
|
+
- recommend the next commands
|
|
17
|
+
- generate a copyable agent prompt
|
|
18
|
+
|
|
19
|
+
## Best use
|
|
20
|
+
|
|
21
|
+
- start a new agent session from one line of user input
|
|
22
|
+
- continue from an existing GEO artifact without re-reading the whole system
|
|
23
|
+
- decide whether the next move is diagnosis, execution, closeout, or delivery
|
|
@@ -13,27 +13,29 @@ 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
|
|
17
|
-
|
|
18
|
-
1. `
|
|
19
|
-
2. `
|
|
20
|
-
3. `
|
|
21
|
-
4. `
|
|
22
|
-
5. `
|
|
23
|
-
6. `
|
|
24
|
-
7. `
|
|
25
|
-
8. `
|
|
26
|
-
9. `
|
|
27
|
-
10. `
|
|
28
|
-
11. `
|
|
29
|
-
12. `
|
|
30
|
-
13. `
|
|
16
|
+
The package is best explained as fourteen layers:
|
|
17
|
+
|
|
18
|
+
1. `auto-flow`: auto-select the next skill and command chain
|
|
19
|
+
2. `skills`: inspect the bundled skill package
|
|
20
|
+
3. `onboard-url` / `onboard`: first look
|
|
21
|
+
4. `scan`: raw signal check
|
|
22
|
+
5. `audit` / `report`: diagnosis
|
|
23
|
+
6. `fix-plan` / `owner-board`: execution planning
|
|
24
|
+
7. `agent-handoff`: agent takeover package
|
|
25
|
+
8. `apply-plan`: execution loop
|
|
26
|
+
9. `completion-report`: closeout
|
|
27
|
+
10. `handoff-bundle`: all-in-one package
|
|
28
|
+
11. `share-pack`: audience-ready delivery
|
|
29
|
+
12. `export-pack`: folder export
|
|
30
|
+
13. `html-pack` / `publish-pack`: browsable and final delivery output
|
|
31
|
+
14. `pm-brief` / `roadmap`: stakeholder alignment
|
|
31
32
|
|
|
32
33
|
## Recommended command order
|
|
33
34
|
|
|
34
35
|
If the user only has a website URL:
|
|
35
36
|
|
|
36
37
|
```bash
|
|
38
|
+
npx geo-ai-search-optimization auto-flow https://example.com
|
|
37
39
|
npx geo-ai-search-optimization onboard-url https://example.com
|
|
38
40
|
npx geo-ai-search-optimization pm-brief https://example.com
|
|
39
41
|
npx geo-ai-search-optimization roadmap https://example.com
|
|
@@ -42,6 +44,7 @@ npx geo-ai-search-optimization roadmap https://example.com
|
|
|
42
44
|
If the user has the website codebase:
|
|
43
45
|
|
|
44
46
|
```bash
|
|
47
|
+
npx geo-ai-search-optimization auto-flow ./your-site
|
|
45
48
|
npx geo-ai-search-optimization scan ./your-site
|
|
46
49
|
npx geo-ai-search-optimization audit ./your-site
|
|
47
50
|
npx geo-ai-search-optimization fix-plan ./your-site
|
|
@@ -59,6 +62,7 @@ npx geo-ai-search-optimization roadmap ./your-site
|
|
|
59
62
|
|
|
60
63
|
## When to recommend each command
|
|
61
64
|
|
|
65
|
+
- `auto-flow`: auto-select the next skill and command order from a task brief, URL, project path, or GEO artifact
|
|
62
66
|
- `onboard-url`: first-time website check from a live URL
|
|
63
67
|
- `onboard`: interactive first-time onboarding
|
|
64
68
|
- `skills`: list the bundled skills and decide which skill or command chain fits the task
|
|
@@ -83,6 +87,7 @@ npx geo-ai-search-optimization roadmap ./your-site
|
|
|
83
87
|
When explaining the tool to a user:
|
|
84
88
|
|
|
85
89
|
- prefer telling them which command to run next, not listing every command
|
|
90
|
+
- if the user or the next agent is unsure where to start, move them to `auto-flow` first
|
|
86
91
|
- explain the result in PM language, not implementation jargon
|
|
87
92
|
- if the user sounds new, start with `onboard-url` or `quick-start`
|
|
88
93
|
- if the user wants another agent to take over, move them to `agent-handoff`
|
package/src/auto-flow.js
ADDED
|
@@ -0,0 +1,563 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { writeScanOutput } from "./scan.js";
|
|
4
|
+
import { listBundledSkills } from "./skills.js";
|
|
5
|
+
|
|
6
|
+
const VALID_INTENTS = new Set(["auto", "diagnose", "guide", "execute", "share", "closeout"]);
|
|
7
|
+
|
|
8
|
+
function isUrlInput(input) {
|
|
9
|
+
return /^https?:\/\//i.test(input);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function normalizeIntent(intent) {
|
|
13
|
+
const resolved = (intent || "auto").toLowerCase();
|
|
14
|
+
if (!VALID_INTENTS.has(resolved)) {
|
|
15
|
+
throw new Error(`不支持的 auto-flow intent:${intent}。可选值:${Array.from(VALID_INTENTS).join(", ")}`);
|
|
16
|
+
}
|
|
17
|
+
return resolved;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async function pathExists(targetPath) {
|
|
21
|
+
try {
|
|
22
|
+
await fs.access(targetPath);
|
|
23
|
+
return true;
|
|
24
|
+
} catch {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function detectArtifactKindFromParsedJson(parsed) {
|
|
30
|
+
if (!parsed || typeof parsed !== "object") {
|
|
31
|
+
return "unknown-json";
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (parsed.kind === "geo-report") {
|
|
35
|
+
return `geo-report:${parsed.mode || "unknown"}`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return parsed.kind || "unknown-json";
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function inferTaskTextMode(text) {
|
|
42
|
+
const normalized = String(text).toLowerCase();
|
|
43
|
+
|
|
44
|
+
if (/(share-pack|export-pack|html-pack|publish-pack|分享|导出|交付|外发|报告包)/i.test(normalized)) {
|
|
45
|
+
return "share";
|
|
46
|
+
}
|
|
47
|
+
if (/(apply-plan|handoff|接手|交给.*agent|继续修|继续做|修复|执行|修改|落地|repair|implement|fix)/i.test(normalized)) {
|
|
48
|
+
return "execute";
|
|
49
|
+
}
|
|
50
|
+
if (/(completion-report|closeout|复盘|收尾|总结|剩余风险)/i.test(normalized)) {
|
|
51
|
+
return "closeout";
|
|
52
|
+
}
|
|
53
|
+
if (/(how to use|怎么用|如何用|命令|skill|技能|流程|next step|下一步)/i.test(normalized)) {
|
|
54
|
+
return "guide";
|
|
55
|
+
}
|
|
56
|
+
return "diagnose";
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async function detectInput(input) {
|
|
60
|
+
if (!input) {
|
|
61
|
+
throw new Error("auto-flow 需要一个输入值,可以是任务描述、项目路径、网站网址或已导出的工件。");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (isUrlInput(input)) {
|
|
65
|
+
return {
|
|
66
|
+
source: input,
|
|
67
|
+
sourceType: "url",
|
|
68
|
+
artifactKind: "website-url",
|
|
69
|
+
summary: "公开网站网址"
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const resolvedPath = path.resolve(input);
|
|
74
|
+
if (!(await pathExists(resolvedPath))) {
|
|
75
|
+
return {
|
|
76
|
+
source: input,
|
|
77
|
+
sourceType: "task-text",
|
|
78
|
+
artifactKind: "task-brief",
|
|
79
|
+
summary: "自然语言任务描述",
|
|
80
|
+
inferredTextIntent: inferTaskTextMode(input)
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const stat = await fs.stat(resolvedPath);
|
|
85
|
+
if (stat.isDirectory()) {
|
|
86
|
+
return {
|
|
87
|
+
source: resolvedPath,
|
|
88
|
+
sourceType: "directory",
|
|
89
|
+
artifactKind: "project-directory",
|
|
90
|
+
summary: "本地网站项目目录"
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const extension = path.extname(resolvedPath).toLowerCase();
|
|
95
|
+
if (extension === ".json") {
|
|
96
|
+
const raw = await fs.readFile(resolvedPath, "utf8");
|
|
97
|
+
const parsed = JSON.parse(raw);
|
|
98
|
+
return {
|
|
99
|
+
source: resolvedPath,
|
|
100
|
+
sourceType: "json",
|
|
101
|
+
artifactKind: detectArtifactKindFromParsedJson(parsed),
|
|
102
|
+
summary: "GEO JSON 工件",
|
|
103
|
+
parsed
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const fileName = path.basename(resolvedPath);
|
|
108
|
+
let artifactKind = "generic-file";
|
|
109
|
+
if (fileName === "START-HERE.md" || fileName === "AGENT-START.md" || fileName === "manifest.json") {
|
|
110
|
+
artifactKind = "geo-publish-pack-entry";
|
|
111
|
+
} else if (/share-pack/i.test(fileName)) {
|
|
112
|
+
artifactKind = "geo-share-pack-file";
|
|
113
|
+
} else if (/owner-board/i.test(fileName)) {
|
|
114
|
+
artifactKind = "geo-owner-board-file";
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
source: resolvedPath,
|
|
119
|
+
sourceType: "file",
|
|
120
|
+
artifactKind,
|
|
121
|
+
summary: "本地文件工件"
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function resolveEffectiveIntent(intent, detected) {
|
|
126
|
+
if (intent !== "auto") {
|
|
127
|
+
return intent;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (detected.sourceType === "task-text") {
|
|
131
|
+
return detected.inferredTextIntent || "diagnose";
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (detected.artifactKind === "geo-completion-report") {
|
|
135
|
+
return "closeout";
|
|
136
|
+
}
|
|
137
|
+
if (
|
|
138
|
+
[
|
|
139
|
+
"geo-share-pack",
|
|
140
|
+
"geo-export-pack",
|
|
141
|
+
"geo-html-pack",
|
|
142
|
+
"geo-publish-pack",
|
|
143
|
+
"geo-publish-pack-entry",
|
|
144
|
+
"geo-share-pack-file"
|
|
145
|
+
].includes(detected.artifactKind)
|
|
146
|
+
) {
|
|
147
|
+
return "share";
|
|
148
|
+
}
|
|
149
|
+
if (
|
|
150
|
+
["geo-agent-handoff", "geo-apply-plan", "geo-handoff-bundle", "geo-fix-plan"].includes(detected.artifactKind)
|
|
151
|
+
) {
|
|
152
|
+
return "execute";
|
|
153
|
+
}
|
|
154
|
+
if (detected.artifactKind === "task-brief") {
|
|
155
|
+
return detected.inferredTextIntent || "diagnose";
|
|
156
|
+
}
|
|
157
|
+
return "diagnose";
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function buildCommandChain(detected, intent) {
|
|
161
|
+
const source = detected.source;
|
|
162
|
+
|
|
163
|
+
if (detected.sourceType === "task-text") {
|
|
164
|
+
return [`geo-ai-search-optimization skills`, `geo-ai-search-optimization quick-start`];
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (intent === "guide") {
|
|
168
|
+
return [`geo-ai-search-optimization skills`, `geo-ai-search-optimization quick-start`, `geo-ai-search-optimization auto-flow ${source}`];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (intent === "share") {
|
|
172
|
+
if (detected.artifactKind === "geo-completion-report") {
|
|
173
|
+
return [
|
|
174
|
+
`geo-ai-search-optimization share-pack ${source}`,
|
|
175
|
+
`geo-ai-search-optimization export-pack ${source}`,
|
|
176
|
+
`geo-ai-search-optimization publish-pack ${source}`
|
|
177
|
+
];
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return [
|
|
181
|
+
`geo-ai-search-optimization share-pack ${source}`,
|
|
182
|
+
`geo-ai-search-optimization html-pack ${source}`,
|
|
183
|
+
`geo-ai-search-optimization publish-pack ${source}`
|
|
184
|
+
];
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (intent === "closeout") {
|
|
188
|
+
return [
|
|
189
|
+
`geo-ai-search-optimization completion-report ${source}`,
|
|
190
|
+
`geo-ai-search-optimization meeting-pack ${source}`,
|
|
191
|
+
`geo-ai-search-optimization publish-pack ${source}`
|
|
192
|
+
];
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (detected.sourceType === "url") {
|
|
196
|
+
if (intent === "execute") {
|
|
197
|
+
return [
|
|
198
|
+
`geo-ai-search-optimization onboard-url ${source}`,
|
|
199
|
+
`geo-ai-search-optimization fix-plan ${source}`,
|
|
200
|
+
`geo-ai-search-optimization agent-handoff ${source}`
|
|
201
|
+
];
|
|
202
|
+
}
|
|
203
|
+
return [
|
|
204
|
+
`geo-ai-search-optimization onboard-url ${source}`,
|
|
205
|
+
`geo-ai-search-optimization pm-brief ${source}`,
|
|
206
|
+
`geo-ai-search-optimization report ${source} --mode onboarding --format markdown`
|
|
207
|
+
];
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (detected.sourceType === "directory") {
|
|
211
|
+
if (intent === "execute") {
|
|
212
|
+
return [
|
|
213
|
+
`geo-ai-search-optimization audit ${source}`,
|
|
214
|
+
`geo-ai-search-optimization fix-plan ${source}`,
|
|
215
|
+
`geo-ai-search-optimization agent-handoff ${source}`,
|
|
216
|
+
`geo-ai-search-optimization apply-plan ${source}`
|
|
217
|
+
];
|
|
218
|
+
}
|
|
219
|
+
return [
|
|
220
|
+
`geo-ai-search-optimization scan ${source}`,
|
|
221
|
+
`geo-ai-search-optimization audit ${source}`,
|
|
222
|
+
`geo-ai-search-optimization fix-plan ${source}`
|
|
223
|
+
];
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
switch (detected.artifactKind) {
|
|
227
|
+
case "geo-report:audit":
|
|
228
|
+
case "geo-audit":
|
|
229
|
+
return intent === "execute"
|
|
230
|
+
? [
|
|
231
|
+
`geo-ai-search-optimization fix-plan ${source}`,
|
|
232
|
+
`geo-ai-search-optimization agent-handoff ${source}`,
|
|
233
|
+
`geo-ai-search-optimization apply-plan ${source}`
|
|
234
|
+
]
|
|
235
|
+
: [`geo-ai-search-optimization fix-plan ${source}`, `geo-ai-search-optimization owner-board ${source}`];
|
|
236
|
+
case "geo-url-onboarding":
|
|
237
|
+
case "geo-report:onboarding":
|
|
238
|
+
return [
|
|
239
|
+
`geo-ai-search-optimization pm-brief ${source}`,
|
|
240
|
+
`geo-ai-search-optimization fix-plan ${source}`,
|
|
241
|
+
`geo-ai-search-optimization roadmap ${source}`
|
|
242
|
+
];
|
|
243
|
+
case "geo-fix-plan":
|
|
244
|
+
return [
|
|
245
|
+
`geo-ai-search-optimization agent-handoff ${source}`,
|
|
246
|
+
`geo-ai-search-optimization apply-plan ${source}`
|
|
247
|
+
];
|
|
248
|
+
case "geo-agent-handoff":
|
|
249
|
+
return [
|
|
250
|
+
`geo-ai-search-optimization apply-plan ${source}`,
|
|
251
|
+
`geo-ai-search-optimization completion-report ${source}`
|
|
252
|
+
];
|
|
253
|
+
case "geo-apply-plan":
|
|
254
|
+
return [
|
|
255
|
+
`geo-ai-search-optimization apply-plan ${source}`,
|
|
256
|
+
`geo-ai-search-optimization completion-report ${source}`,
|
|
257
|
+
`geo-ai-search-optimization handoff-bundle ${source}`
|
|
258
|
+
];
|
|
259
|
+
case "geo-completion-report":
|
|
260
|
+
return [
|
|
261
|
+
`geo-ai-search-optimization meeting-pack ${source}`,
|
|
262
|
+
`geo-ai-search-optimization share-pack ${source}`,
|
|
263
|
+
`geo-ai-search-optimization publish-pack ${source}`
|
|
264
|
+
];
|
|
265
|
+
case "geo-handoff-bundle":
|
|
266
|
+
return [
|
|
267
|
+
`geo-ai-search-optimization apply-plan ${source}`,
|
|
268
|
+
`geo-ai-search-optimization completion-report ${source}`,
|
|
269
|
+
`geo-ai-search-optimization publish-pack ${source}`
|
|
270
|
+
];
|
|
271
|
+
case "geo-share-pack":
|
|
272
|
+
case "geo-share-pack-file":
|
|
273
|
+
return [
|
|
274
|
+
`geo-ai-search-optimization export-pack ${source}`,
|
|
275
|
+
`geo-ai-search-optimization html-pack ${source}`,
|
|
276
|
+
`geo-ai-search-optimization publish-pack ${source}`
|
|
277
|
+
];
|
|
278
|
+
case "geo-export-pack":
|
|
279
|
+
return [`geo-ai-search-optimization html-pack ${source}`, `geo-ai-search-optimization publish-pack ${source}`];
|
|
280
|
+
case "geo-html-pack":
|
|
281
|
+
return [`geo-ai-search-optimization publish-pack ${source}`];
|
|
282
|
+
case "geo-publish-pack":
|
|
283
|
+
case "geo-publish-pack-entry":
|
|
284
|
+
return [`geo-ai-search-optimization auto-flow ${source} --intent guide`, `geo-ai-search-optimization skills`];
|
|
285
|
+
default:
|
|
286
|
+
return [`geo-ai-search-optimization skills`, `geo-ai-search-optimization quick-start`];
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function pickSkillName(detected, intent) {
|
|
291
|
+
if (intent === "guide") {
|
|
292
|
+
return "geo-ai-search-optimization-usage";
|
|
293
|
+
}
|
|
294
|
+
if (intent === "share") {
|
|
295
|
+
return "geo-ai-search-optimization-publish-pack";
|
|
296
|
+
}
|
|
297
|
+
if (intent === "closeout") {
|
|
298
|
+
return "geo-ai-search-optimization-completion-report";
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
switch (detected.artifactKind) {
|
|
302
|
+
case "task-brief":
|
|
303
|
+
return detected.inferredTextIntent === "share"
|
|
304
|
+
? "geo-ai-search-optimization-publish-pack"
|
|
305
|
+
: detected.inferredTextIntent === "execute"
|
|
306
|
+
? "geo-ai-search-optimization-agent-handoff"
|
|
307
|
+
: "geo-ai-search-optimization-usage";
|
|
308
|
+
case "website-url":
|
|
309
|
+
case "project-directory":
|
|
310
|
+
case "geo-audit":
|
|
311
|
+
case "geo-report:audit":
|
|
312
|
+
case "geo-url-onboarding":
|
|
313
|
+
case "geo-report:onboarding":
|
|
314
|
+
return intent === "execute" ? "geo-ai-search-optimization-agent-handoff" : "geo-ai-search-optimization";
|
|
315
|
+
case "geo-fix-plan":
|
|
316
|
+
case "geo-agent-handoff":
|
|
317
|
+
return "geo-ai-search-optimization-agent-handoff";
|
|
318
|
+
case "geo-apply-plan":
|
|
319
|
+
return "geo-ai-search-optimization-repair-loop";
|
|
320
|
+
case "geo-completion-report":
|
|
321
|
+
return "geo-ai-search-optimization-completion-report";
|
|
322
|
+
case "geo-handoff-bundle":
|
|
323
|
+
return "geo-ai-search-optimization-handoff-bundle";
|
|
324
|
+
case "geo-share-pack":
|
|
325
|
+
case "geo-share-pack-file":
|
|
326
|
+
return "geo-ai-search-optimization-share-pack";
|
|
327
|
+
case "geo-export-pack":
|
|
328
|
+
return "geo-ai-search-optimization-export-pack";
|
|
329
|
+
case "geo-html-pack":
|
|
330
|
+
return "geo-ai-search-optimization-html-pack";
|
|
331
|
+
case "geo-publish-pack":
|
|
332
|
+
case "geo-publish-pack-entry":
|
|
333
|
+
return "geo-ai-search-optimization-publish-pack";
|
|
334
|
+
default:
|
|
335
|
+
return "geo-ai-search-optimization-usage";
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
function buildSecondarySkillNames(primarySkill, intent, detected) {
|
|
340
|
+
const names = new Set(["geo-ai-search-optimization-usage"]);
|
|
341
|
+
|
|
342
|
+
if (primarySkill !== "geo-ai-search-optimization") {
|
|
343
|
+
names.add("geo-ai-search-optimization");
|
|
344
|
+
}
|
|
345
|
+
if (intent === "share") {
|
|
346
|
+
names.add("geo-ai-search-optimization-share-pack");
|
|
347
|
+
names.add("geo-ai-search-optimization-publish-pack");
|
|
348
|
+
}
|
|
349
|
+
if (intent === "execute" || ["geo-fix-plan", "geo-agent-handoff", "geo-apply-plan"].includes(detected.artifactKind)) {
|
|
350
|
+
names.add("geo-ai-search-optimization-agent-handoff");
|
|
351
|
+
names.add("geo-ai-search-optimization-repair-loop");
|
|
352
|
+
}
|
|
353
|
+
if (intent === "closeout") {
|
|
354
|
+
names.add("geo-ai-search-optimization-completion-report");
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
names.delete(primarySkill);
|
|
358
|
+
return Array.from(names);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
function buildStage(intent, detected) {
|
|
362
|
+
if (intent === "guide") {
|
|
363
|
+
return "使用引导";
|
|
364
|
+
}
|
|
365
|
+
if (intent === "share") {
|
|
366
|
+
return "交付分享";
|
|
367
|
+
}
|
|
368
|
+
if (intent === "closeout") {
|
|
369
|
+
return "执行复盘";
|
|
370
|
+
}
|
|
371
|
+
if (intent === "execute") {
|
|
372
|
+
return ["geo-fix-plan", "geo-agent-handoff", "geo-apply-plan", "geo-handoff-bundle"].includes(detected.artifactKind)
|
|
373
|
+
? "Agent 执行"
|
|
374
|
+
: "执行准备";
|
|
375
|
+
}
|
|
376
|
+
if (["geo-fix-plan", "geo-agent-handoff", "geo-apply-plan", "geo-handoff-bundle"].includes(detected.artifactKind)) {
|
|
377
|
+
return "Agent 执行";
|
|
378
|
+
}
|
|
379
|
+
return "诊断规划";
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
function buildWhy(detected, intent, primarySkillLabel) {
|
|
383
|
+
if (detected.sourceType === "task-text") {
|
|
384
|
+
return `当前输入是一段任务描述,还不是具体工件,所以先用 ${primarySkillLabel} 来判断阶段,并明确下一步还缺什么上下文。`;
|
|
385
|
+
}
|
|
386
|
+
if (detected.sourceType === "url") {
|
|
387
|
+
return `当前只有公开网址,没有仓库上下文,最适合先走网址级 GEO 流程,再决定是否进入 agent 执行。`;
|
|
388
|
+
}
|
|
389
|
+
if (detected.sourceType === "directory") {
|
|
390
|
+
return intent === "execute"
|
|
391
|
+
? "当前已经有本地项目目录,可以直接进入 GEO 诊断到 agent 接手的执行链。"
|
|
392
|
+
: "当前已有本地项目目录,先跑诊断和优先级判断最稳妥。";
|
|
393
|
+
}
|
|
394
|
+
if (detected.sourceType === "json") {
|
|
395
|
+
return `当前输入已经是 GEO 工件(${detected.artifactKind}),所以可以跳过前置步骤,直接进入对应阶段。`;
|
|
396
|
+
}
|
|
397
|
+
return "当前输入更像中间结果或说明文本,先根据上下文自动选择最接近的 skill。";
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
function buildContextNeeded(detected, intent) {
|
|
401
|
+
if (detected.sourceType === "task-text") {
|
|
402
|
+
const items = ["至少补一个公开网址、本地项目路径,或已有 GEO JSON 工件。"];
|
|
403
|
+
if (intent === "execute") {
|
|
404
|
+
items.push("如果希望 agent 直接修复,最好提供代码仓库或本地项目目录。");
|
|
405
|
+
}
|
|
406
|
+
if (intent === "share") {
|
|
407
|
+
items.push("如果希望直接交付,最好提供已生成的 audit / handoff / completion 等工件。");
|
|
408
|
+
}
|
|
409
|
+
return items;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
if (detected.sourceType === "url" && intent === "execute") {
|
|
413
|
+
return ["当前只有公开网址,能先做建议型执行。若要直接修复,后续仍需提供本地项目目录或仓库上下文。"];
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
return [];
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
function buildAgentPrompt(skill, detected, intent, commands) {
|
|
420
|
+
const lines = [
|
|
421
|
+
skill.defaultPrompt || `Use $${skill.name} to continue this GEO task.`,
|
|
422
|
+
`输入:${detected.source}`,
|
|
423
|
+
`意图:${intent}`,
|
|
424
|
+
"请先说明你为什么选择这个 skill,然后按建议命令顺序继续。"
|
|
425
|
+
];
|
|
426
|
+
|
|
427
|
+
if (commands.length > 0) {
|
|
428
|
+
lines.push("建议命令顺序:");
|
|
429
|
+
for (const command of commands) {
|
|
430
|
+
lines.push(`- ${command}`);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
return lines.join("\n");
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
function buildNextAction(detected, intent, commands) {
|
|
438
|
+
if (detected.sourceType === "task-text") {
|
|
439
|
+
if (intent === "execute") {
|
|
440
|
+
return "先补一个公开网址、本地项目目录或 GEO JSON 工件;有了具体输入后再重跑 auto-flow,才能真正进入 agent 执行链。";
|
|
441
|
+
}
|
|
442
|
+
if (intent === "share") {
|
|
443
|
+
return "先补一个 GEO 工件或项目输入,再生成可分享的交付包。";
|
|
444
|
+
}
|
|
445
|
+
if (intent === "closeout") {
|
|
446
|
+
return "先补 completion-report、apply-plan 或 handoff-bundle 这类执行工件,再进入复盘。";
|
|
447
|
+
}
|
|
448
|
+
return "先补一个公开网址、本地项目目录或 GEO 工件,让系统能自动定位到正确阶段。";
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
if (commands.length === 0) {
|
|
452
|
+
return "先运行 skills 查看整套技能包。";
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
if (intent === "share") {
|
|
456
|
+
return `先运行 \`${commands[0]}\` 生成适合外发或交接的结果。`;
|
|
457
|
+
}
|
|
458
|
+
if (intent === "execute") {
|
|
459
|
+
return `先运行 \`${commands[0]}\`,把当前输入推进到 agent 可执行状态。`;
|
|
460
|
+
}
|
|
461
|
+
if (intent === "closeout") {
|
|
462
|
+
return `先运行 \`${commands[0]}\`,整理本轮完成情况和剩余风险。`;
|
|
463
|
+
}
|
|
464
|
+
if (intent === "guide") {
|
|
465
|
+
return `先运行 \`${commands[0]}\`,确认技能包与命令顺序。`;
|
|
466
|
+
}
|
|
467
|
+
return `先运行 \`${commands[0]}\`,建立当前阶段的 GEO 基线。`;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
export async function createAutoFlow(input, options = {}) {
|
|
471
|
+
const bundle = await listBundledSkills();
|
|
472
|
+
const detected = await detectInput(input);
|
|
473
|
+
const intent = resolveEffectiveIntent(normalizeIntent(options.intent), detected);
|
|
474
|
+
const primarySkillName = pickSkillName(detected, intent);
|
|
475
|
+
const primarySkill = bundle.skills.find((skill) => skill.name === primarySkillName);
|
|
476
|
+
|
|
477
|
+
if (!primarySkill) {
|
|
478
|
+
throw new Error(`找不到技能:${primarySkillName}`);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
const secondarySkillNames = buildSecondarySkillNames(primarySkillName, intent, detected);
|
|
482
|
+
const secondarySkills = bundle.skills.filter((skill) => secondarySkillNames.includes(skill.name));
|
|
483
|
+
const commandChain = buildCommandChain(detected, intent);
|
|
484
|
+
|
|
485
|
+
return {
|
|
486
|
+
kind: "geo-auto-flow",
|
|
487
|
+
input,
|
|
488
|
+
source: detected.source,
|
|
489
|
+
sourceType: detected.sourceType,
|
|
490
|
+
artifactKind: detected.artifactKind,
|
|
491
|
+
summary: detected.summary,
|
|
492
|
+
intent,
|
|
493
|
+
stage: buildStage(intent, detected),
|
|
494
|
+
selectedSkill: {
|
|
495
|
+
name: primarySkill.name,
|
|
496
|
+
displayName: primarySkill.displayName,
|
|
497
|
+
shortDescription: primarySkill.shortDescription,
|
|
498
|
+
defaultPrompt: primarySkill.defaultPrompt,
|
|
499
|
+
skillPath: primarySkill.skillPath
|
|
500
|
+
},
|
|
501
|
+
secondarySkills: secondarySkills.map((skill) => ({
|
|
502
|
+
name: skill.name,
|
|
503
|
+
displayName: skill.displayName,
|
|
504
|
+
shortDescription: skill.shortDescription,
|
|
505
|
+
skillPath: skill.skillPath
|
|
506
|
+
})),
|
|
507
|
+
whyThisSkill: buildWhy(detected, intent, primarySkill.displayName),
|
|
508
|
+
contextNeeded: buildContextNeeded(detected, intent),
|
|
509
|
+
nextAction: buildNextAction(detected, intent, commandChain),
|
|
510
|
+
commandChain,
|
|
511
|
+
agentPrompt: buildAgentPrompt(primarySkill, detected, intent, commandChain)
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
export function renderAutoFlowMarkdown(flow) {
|
|
516
|
+
const lines = [
|
|
517
|
+
"# GEO Auto Flow",
|
|
518
|
+
"",
|
|
519
|
+
`- 输入:\`${flow.source}\``,
|
|
520
|
+
`- 输入类型:\`${flow.sourceType}\``,
|
|
521
|
+
`- 工件类型:\`${flow.artifactKind}\``,
|
|
522
|
+
`- 当前阶段:${flow.stage}`,
|
|
523
|
+
`- 当前意图:${flow.intent}`,
|
|
524
|
+
`- 自动选择的 skill:\`${flow.selectedSkill.name}\``,
|
|
525
|
+
`- 显示名:${flow.selectedSkill.displayName}`,
|
|
526
|
+
`- 说明:${flow.selectedSkill.shortDescription}`,
|
|
527
|
+
"",
|
|
528
|
+
"## 为什么是这个 skill",
|
|
529
|
+
"",
|
|
530
|
+
`- ${flow.whyThisSkill}`,
|
|
531
|
+
"",
|
|
532
|
+
"## 下一步",
|
|
533
|
+
"",
|
|
534
|
+
`- ${flow.nextAction}`,
|
|
535
|
+
"",
|
|
536
|
+
"## 建议命令顺序",
|
|
537
|
+
""
|
|
538
|
+
];
|
|
539
|
+
|
|
540
|
+
for (const command of flow.commandChain) {
|
|
541
|
+
lines.push(`- \`${command}\``);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
if (flow.contextNeeded.length > 0) {
|
|
545
|
+
lines.push("", "## 还需要补什么", "");
|
|
546
|
+
for (const item of flow.contextNeeded) {
|
|
547
|
+
lines.push(`- ${item}`);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
lines.push("", "## 可一起参考的 skill", "");
|
|
552
|
+
for (const skill of flow.secondarySkills) {
|
|
553
|
+
lines.push(`- ${skill.name}|${skill.displayName}|${skill.shortDescription}`);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
lines.push("", "## 可直接复制给 Agent 的 Prompt", "", "```text", flow.agentPrompt, "```");
|
|
557
|
+
|
|
558
|
+
return `${lines.join("\n")}\n`;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
export async function writeAutoFlowOutput(outputPath, content) {
|
|
562
|
+
return writeScanOutput(outputPath, content);
|
|
563
|
+
}
|
package/src/cli.js
CHANGED
|
@@ -3,6 +3,7 @@ import { readFile } from "node:fs/promises";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { createApplyPlan, renderApplyPlanMarkdown, writeApplyPlanOutput } from "./apply-plan.js";
|
|
5
5
|
import { createAgentHandoff, renderAgentHandoffMarkdown, writeAgentHandoffOutput } from "./agent-handoff.js";
|
|
6
|
+
import { createAutoFlow, renderAutoFlowMarkdown, writeAutoFlowOutput } from "./auto-flow.js";
|
|
6
7
|
import {
|
|
7
8
|
createCompletionReport,
|
|
8
9
|
renderCompletionReportMarkdown,
|
|
@@ -57,6 +58,7 @@ function printHelp() {
|
|
|
57
58
|
"Usage:",
|
|
58
59
|
" geo-ai-search-optimization",
|
|
59
60
|
" geo-ai-search-optimization install [--target <dir>] [--json]",
|
|
61
|
+
" geo-ai-search-optimization auto-flow <input> [--intent <auto|diagnose|guide|execute|share|closeout>] [--json] [--out <file>]",
|
|
60
62
|
" geo-ai-search-optimization skills [--json]",
|
|
61
63
|
" geo-ai-search-optimization where",
|
|
62
64
|
" geo-ai-search-optimization doctor [--json]",
|
|
@@ -127,6 +129,28 @@ async function handleInstall(args) {
|
|
|
127
129
|
}
|
|
128
130
|
}
|
|
129
131
|
|
|
132
|
+
async function handleAutoFlow(args) {
|
|
133
|
+
const input = args.find((value) => !value.startsWith("-"));
|
|
134
|
+
if (!input) {
|
|
135
|
+
throw new Error("auto-flow 需要一个输入值,可以是任务描述、项目路径、网站网址或已导出的工件");
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const flow = await createAutoFlow(input, {
|
|
139
|
+
intent: getFlagValue(args, "--intent")
|
|
140
|
+
});
|
|
141
|
+
const outputJson = hasFlag(args, "--json");
|
|
142
|
+
const renderedOutput = outputJson ? `${JSON.stringify(flow, null, 2)}\n` : renderAutoFlowMarkdown(flow);
|
|
143
|
+
|
|
144
|
+
const outputPath = getFlagValue(args, "--out");
|
|
145
|
+
if (outputPath) {
|
|
146
|
+
const resolvedOutputPath = await writeAutoFlowOutput(outputPath, renderedOutput);
|
|
147
|
+
process.stdout.write(`已保存 auto-flow 结果:${resolvedOutputPath}\n`);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
process.stdout.write(renderedOutput);
|
|
152
|
+
}
|
|
153
|
+
|
|
130
154
|
function handleWhere() {
|
|
131
155
|
process.stdout.write(
|
|
132
156
|
[
|
|
@@ -667,6 +691,11 @@ export async function runCli(args = []) {
|
|
|
667
691
|
return;
|
|
668
692
|
}
|
|
669
693
|
|
|
694
|
+
if (command === "auto-flow") {
|
|
695
|
+
await handleAutoFlow(rest);
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
698
|
+
|
|
670
699
|
if (command === "skills") {
|
|
671
700
|
await handleSkills(rest);
|
|
672
701
|
return;
|
package/src/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export {
|
|
|
5
5
|
runInteractiveOnboarding,
|
|
6
6
|
writeInteractiveOnboardingOutput
|
|
7
7
|
} from "./interactive-onboarding.js";
|
|
8
|
+
export { createAutoFlow, renderAutoFlowMarkdown, writeAutoFlowOutput } from "./auto-flow.js";
|
|
8
9
|
export { createApplyPlan, renderApplyPlanMarkdown, writeApplyPlanOutput } from "./apply-plan.js";
|
|
9
10
|
export { createAgentHandoff, renderAgentHandoffMarkdown, writeAgentHandoffOutput } from "./agent-handoff.js";
|
|
10
11
|
export { createCompletionReport, renderCompletionReportMarkdown, writeCompletionReportOutput } from "./completion-report.js";
|
package/src/skills.js
CHANGED
|
@@ -4,6 +4,7 @@ import { getPackageRoot } from "./paths.js";
|
|
|
4
4
|
|
|
5
5
|
const SKILL_ORDER = [
|
|
6
6
|
"geo-ai-search-optimization",
|
|
7
|
+
"geo-ai-search-optimization-auto-flow",
|
|
7
8
|
"geo-ai-search-optimization-usage",
|
|
8
9
|
"geo-ai-search-optimization-agent-handoff",
|
|
9
10
|
"geo-ai-search-optimization-repair-loop",
|
|
@@ -17,6 +18,7 @@ const SKILL_ORDER = [
|
|
|
17
18
|
|
|
18
19
|
const SKILL_CATEGORY = {
|
|
19
20
|
"geo-ai-search-optimization": "core",
|
|
21
|
+
"geo-ai-search-optimization-auto-flow": "routing",
|
|
20
22
|
"geo-ai-search-optimization-usage": "guidance",
|
|
21
23
|
"geo-ai-search-optimization-agent-handoff": "execution",
|
|
22
24
|
"geo-ai-search-optimization-repair-loop": "execution",
|
|
@@ -30,6 +32,7 @@ const SKILL_CATEGORY = {
|
|
|
30
32
|
|
|
31
33
|
const CATEGORY_LABELS = {
|
|
32
34
|
core: "核心 GEO 能力",
|
|
35
|
+
routing: "自动入口",
|
|
33
36
|
guidance: "使用引导",
|
|
34
37
|
execution: "Agent 执行闭环",
|
|
35
38
|
delivery: "交付与分享"
|
|
@@ -148,6 +151,7 @@ export function renderBundledSkillsMarkdown(bundle) {
|
|
|
148
151
|
"## 推荐理解顺序",
|
|
149
152
|
"",
|
|
150
153
|
"- 先看核心 GEO skill。",
|
|
154
|
+
"- 如果 agent 需要自动选 skill,先跑 auto-flow。",
|
|
151
155
|
"- 再看 usage skill,知道什么时候该跑哪个命令。",
|
|
152
156
|
"- 如果要交给 agent 执行,再进入 handoff / apply / completion 这一条执行链。",
|
|
153
157
|
"- 如果要产出给团队分发,再进入 share / export / html / publish 这一条交付链。",
|