doc-smith-publish

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

DocSmith 文档发布

DocSmith Documentation Publishing

将本地生成的 HTML 文档一键发布到 DocSmith Cloud,返回在线预览 URL。
One-click publish locally generated HTML documentation to DocSmith Cloud and get an online preview URL.

用法

Usage

bash
/doc-smith-publish
/doc-smith-publish --dir .aigne/doc-smith/dist
/doc-smith-publish --hub https://custom.hub.io
bash
/doc-smith-publish
/doc-smith-publish --dir .aigne/doc-smith/dist
/doc-smith-publish --hub https://custom.hub.io

选项

Options

OptionAliasDescription
--dir <path>
-d
指定发布目录(默认自动检测)
--hub <url>
-h
DocSmith Hub URL(默认
https://docsmith.aigne.io
OptionAliasDescription
--dir <path>
-d
Specify the publishing directory (auto-detected by default)
--hub <url>
-h
DocSmith Hub URL (default
https://docsmith.aigne.io
)

工作流

Workflow

步骤 1:检查依赖

Step 1: Check Dependencies

bash
test -d {skill_path}/scripts/node_modules || (cd {skill_path}/scripts && npm install)
其中
{skill_path}
是本 Skill 的目录路径(
skills/doc-smith-publish
)。
bash
test -d {skill_path}/scripts/node_modules || (cd {skill_path}/scripts && npm install)
Where
{skill_path}
is the directory path of this Skill (
skills/doc-smith-publish
).

步骤 2:检测发布目标

Step 2: Detect Publishing Target

按以下优先级确定发布目录:
  1. 用户指定
    --dir
    参数 → 使用指定目录
  2. 未指定 → 检查
    .aigne/doc-smith/dist
    目录是否存在
  3. 以上都不存在 → 检查当前目录是否包含
    assets/nav.js
    (doc-smith 输出标志)
  4. 都找不到 → 报错,提示用户先运行
    /doc-smith-create
    生成文档
Determine the publishing directory in the following priority order:
  1. User specifies the
    --dir
    parameter → Use the specified directory
  2. Not specified → Check if the
    .aigne/doc-smith/dist
    directory exists
  3. Neither exists → Check if the current directory contains
    assets/nav.js
    (doc-smith output marker)
  4. None found → Throw an error, prompting the user to run
    /doc-smith-create
    first to generate documentation

步骤 3:读取 Metadata

Step 3: Read Metadata

.aigne/doc-smith/config.yaml
读取:
  • projectName
    → 发布标题(title)
  • projectDesc
    → 发布描述(description)
如果 config.yaml 不存在或字段缺失,使用目录名作为标题。
Read from
.aigne/doc-smith/config.yaml
:
  • projectName
    → Publishing title (title)
  • projectDesc
    → Publishing description (description)
If config.yaml does not exist or fields are missing, use the directory name as the title.

步骤 4:执行发布

Step 4: Execute Publishing

构造配置 JSON 并调用发布脚本:
bash
node {skill_path}/scripts/publish.mjs --config-stdin <<'EOF'
{
  "source": { "type": "dir", "path": "{dist_path}" },
  "hub": "{hub_url}",
  "workspace": ".aigne/doc-smith",
  "metadata": {
    "title": "{title}",
    "description": "{description}",
    "visibility": "public"
  }
}
EOF
变量说明
  • {skill_path}
    :本 Skill 目录路径
  • {dist_path}
    :步骤 2 确定的发布目录
  • {hub_url}
    :DocSmith Hub URL(默认
    https://docsmith.aigne.io
    --hub
    可覆盖)
  • {title}
    :步骤 3 获取的标题
  • {description}
    :步骤 3 获取的描述
Construct the configuration JSON and call the publishing script:
bash
node {skill_path}/scripts/publish.mjs --config-stdin <<'EOF'
{
  "source": { "type": "dir", "path": "{dist_path}" },
  "hub": "{hub_url}",
  "workspace": ".aigne/doc-smith",
  "metadata": {
    "title": "{title}",
    "description": "{description}",
    "visibility": "public"
  }
}
EOF
Variable Explanation:
  • {skill_path}
    : Directory path of this Skill
  • {dist_path}
    : Publishing directory determined in Step 2
  • {hub_url}
    : DocSmith Hub URL (default
    https://docsmith.aigne.io
    , can be overridden by
    --hub
    )
  • {title}
    : Title obtained in Step 3
  • {description}
    : Description obtained in Step 3

步骤 5:展示结果

Step 5: Display Results

发布成功后,脚本会输出预览 URL。向用户展示:
文档已发布成功!预览地址:{vibeUrl}
发布脚本会自动将 vibeUrl 写入
.aigne/doc-smith/config.yaml
appUrl
字段。
After successful publishing, the script will output the preview URL. Display to the user:
Documentation published successfully! Preview URL: {vibeUrl}
The publishing script will automatically write the vibeUrl to the
appUrl
field in
.aigne/doc-smith/config.yaml
.

错误处理

Error Handling

错误处理
dist 目录不存在提示用户先运行
/doc-smith-create
生成文档
config.yaml 不存在提示当前目录非有效 doc-smith workspace
依赖未安装自动执行
npm install
(步骤 1)
401/403 授权错误脚本自动清除 token,提示用户重新运行
/doc-smith-publish
网络错误提示用户检查网络后重试
publish action 失败提示用户重新运行
/doc-smith-publish
Private mode 错误提示改为 public 或升级账户
ErrorHandling
dist directory does not existPrompt user to run
/doc-smith-create
first to generate documentation
config.yaml does not existPrompt that the current directory is not a valid doc-smith workspace
Dependencies not installedAutomatically execute
npm install
(Step 1)
401/403 authorization errorScript automatically clears token, prompts user to re-run
/doc-smith-publish
Network errorPrompt user to check network and retry
Publish action failedPrompt user to re-run
/doc-smith-publish
Private mode errorPrompt to switch to public mode or upgrade account