geo-ai-search-optimization 1.3.8 → 1.3.9

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
@@ -894,6 +894,14 @@ geo-ai-search-optimization help
894
894
  - `src/cli-site-ops-commands.js` 现在统一通过组合器编排 `doctor / quick-start / onboard / onboard-url / audit / scan`
895
895
  - CLI 架构进一步收敛到“命令族 adapter + shared composition primitives”的模式
896
896
 
897
+ ## New in 1.3.9
898
+
899
+ - 继续把“直接执行型命令”也纳入共享组合模式
900
+ - `src/cli-shared.js` 新增 `createActionCommandHandler`
901
+ - `src/cli-shell-commands.js` 里的 `install` 已改成声明式 action 组合
902
+ - `src/cli-site-ops-commands.js` 里的 `init-llms / init-schema` 已改成声明式 action 组合
903
+ - CLI 现在同时覆盖 artifact、structured-output、action 三类共享 composition primitives
904
+
897
905
  ## New in 1.2.20
898
906
 
899
907
  - 新增 `agent-continue`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geo-ai-search-optimization",
3
- "version": "1.3.8",
3
+ "version": "1.3.9",
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": {
package/src/cli-shared.js CHANGED
@@ -113,3 +113,23 @@ export function createStructuredOutputCommandHandler({
113
113
  process.stdout.write(renderedOutput);
114
114
  };
115
115
  }
116
+
117
+ export function createActionCommandHandler({
118
+ execute,
119
+ getOutputJson,
120
+ renderText
121
+ }) {
122
+ return async function actionCommandHandler(args) {
123
+ const result = await execute(args);
124
+ const outputJson = getOutputJson ? getOutputJson(args, result) : hasFlag(args, "--json");
125
+
126
+ if (outputJson) {
127
+ process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
128
+ return;
129
+ }
130
+
131
+ if (renderText) {
132
+ process.stdout.write(renderText(result, args));
133
+ }
134
+ };
135
+ }
@@ -1,4 +1,4 @@
1
- import { getFlagValue, hasFlag } from "./cli-shared.js";
1
+ import { createActionCommandHandler, getFlagValue, hasFlag } from "./cli-shared.js";
2
2
  import { installSkill } from "./install-skill.js";
3
3
  import { getBundledSkillPath, getInstalledSkillPath, getSkillName, getSkillsDir } from "./paths.js";
4
4
  import { listBundledSkills, renderBundledSkillsMarkdown } from "./skills.js";
@@ -9,15 +9,16 @@ export const SHELL_HELP_LINES = [
9
9
  " geo-ai-search-optimization where"
10
10
  ];
11
11
 
12
- async function handleInstall(args) {
13
- const targetDir = getFlagValue(args, "--target");
14
- const outputJson = hasFlag(args, "--json");
15
- const result = await installSkill({ targetDir, silent: outputJson });
16
-
17
- if (outputJson) {
18
- process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
19
- }
20
- }
12
+ const handleInstall = createActionCommandHandler({
13
+ execute: async (args) => {
14
+ const outputJson = hasFlag(args, "--json");
15
+ return installSkill({
16
+ targetDir: getFlagValue(args, "--target"),
17
+ silent: outputJson
18
+ });
19
+ },
20
+ getOutputJson: (args) => hasFlag(args, "--json")
21
+ });
21
22
 
22
23
  async function handleSkills(args) {
23
24
  const bundle = await listBundledSkills();
@@ -1,5 +1,6 @@
1
1
  import { auditProject, renderAuditMarkdown, writeAuditOutput } from "./audit.js";
2
2
  import {
3
+ createActionCommandHandler,
3
4
  createStructuredOutputCommandHandler,
4
5
  getFlagValue,
5
6
  hasFlag,
@@ -74,46 +75,35 @@ const handleOnboardUrl = createStructuredOutputCommandHandler({
74
75
  getOutputJson: (args) => hasFlag(args, "--json")
75
76
  });
76
77
 
77
- async function handleInitLlms(args) {
78
- const targetDir = args.find((value) => !value.startsWith("-")) || ".";
79
- const outputJson = hasFlag(args, "--json");
80
- const result = await createLlmsTxt({
81
- targetDir,
82
- siteName: getFlagValue(args, "--site-name"),
83
- siteUrl: getFlagValue(args, "--site-url"),
84
- overwrite: hasFlag(args, "--overwrite")
85
- });
86
-
87
- if (outputJson) {
88
- process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
89
- return;
90
- }
91
-
92
- process.stdout.write(`Created llms.txt at ${result.outputPath}\n`);
93
- }
94
-
95
- async function handleInitSchema(args) {
96
- const [schemaType, ...rest] = args;
97
- if (!schemaType || schemaType.startsWith("-")) {
98
- throw new Error("init-schema requires a schema type");
99
- }
100
-
101
- const targetDir = rest.find((value) => !value.startsWith("-")) || ".";
102
- const outputJson = hasFlag(rest, "--json");
103
- const result = await createSchemaTemplate({
104
- schemaType,
105
- targetDir,
106
- siteUrl: getFlagValue(rest, "--site-url"),
107
- overwrite: hasFlag(rest, "--overwrite")
108
- });
109
-
110
- if (outputJson) {
111
- process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
112
- return;
113
- }
114
-
115
- process.stdout.write(`Created ${result.schemaType} schema template at ${result.outputPath}\n`);
116
- }
78
+ const handleInitLlms = createActionCommandHandler({
79
+ execute: async (args) =>
80
+ createLlmsTxt({
81
+ targetDir: args.find((value) => !value.startsWith("-")) || ".",
82
+ siteName: getFlagValue(args, "--site-name"),
83
+ siteUrl: getFlagValue(args, "--site-url"),
84
+ overwrite: hasFlag(args, "--overwrite")
85
+ }),
86
+ getOutputJson: (args) => hasFlag(args, "--json"),
87
+ renderText: (result) => `Created llms.txt at ${result.outputPath}\n`
88
+ });
89
+
90
+ const handleInitSchema = createActionCommandHandler({
91
+ execute: async (args) => {
92
+ const [schemaType, ...rest] = args;
93
+ if (!schemaType || schemaType.startsWith("-")) {
94
+ throw new Error("init-schema requires a schema type");
95
+ }
96
+
97
+ return createSchemaTemplate({
98
+ schemaType,
99
+ targetDir: rest.find((value) => !value.startsWith("-")) || ".",
100
+ siteUrl: getFlagValue(rest, "--site-url"),
101
+ overwrite: hasFlag(rest, "--overwrite")
102
+ });
103
+ },
104
+ getOutputJson: (args) => hasFlag(args, "--json"),
105
+ renderText: (result) => `Created ${result.schemaType} schema template at ${result.outputPath}\n`
106
+ });
117
107
 
118
108
  const handleAudit = createStructuredOutputCommandHandler({
119
109
  commandLabel: "审计",