Skip to content

feat(download): show saved file path in web read and weixin download output#1042

Open
Benjamin-eecs wants to merge 1 commit intojackwener:mainfrom
Benjamin-eecs:feat/show-saved-path
Open

feat(download): show saved file path in web read and weixin download output#1042
Benjamin-eecs wants to merge 1 commit intojackwener:mainfrom
Benjamin-eecs:feat/show-saved-path

Conversation

@Benjamin-eecs
Copy link
Copy Markdown
Contributor

@Benjamin-eecs Benjamin-eecs commented Apr 15, 2026

Summary

Closes #1038. @Astro-Han

opencli web read and opencli weixin download save content to local files but the output only shows metadata (title, status, size) with no indication of where the file was saved. This causes AI agents to assume the command failed and retry unnecessarily.

Added a saved field to the output that shows the local file path on success (or - on failure).

Changes

  • Added saved field to ArticleDownloadResult interface and all return paths in article-download.ts
  • Added saved column to both web/read and weixin/download command definitions
  • Updated skill docs (SKILL.md, commands.md) to note that content is saved to local files

Test plan

  • npx tsc --noEmit passes
  • All download tests pass (6/6)
  • Verified all return paths include the saved field (success, error, and adapter-level error)

Copilot AI review requested due to automatic review settings April 15, 2026 06:38
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an explicit “where was it saved?” indicator to download-style commands so agents/users don’t assume the command failed when content is written to disk.

Changes:

  • Extended ArticleDownloadResult with a saved field and populated it for success/failure paths in downloadArticle.
  • Added a saved output column to opencli web read and opencli weixin download.
  • Updated usage docs to clarify that these commands save to local files.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/download/article-download.ts Adds saved to the shared download result and returns the saved markdown file path on success (- on early failures).
clis/web/read.js Adds saved to displayed output columns for web read.
clis/weixin/download.js Adds saved to displayed output columns and one error return path (but one early return still misses it).
skills/opencli-usage/commands.md Updates examples to mention saved location (should be phrased as default/overrideable).
skills/opencli-usage/SKILL.md Updates skill docs to indicate output is saved to local files (not stdout) and mentions saved for web scraping.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread clis/weixin/download.js
Comment on lines +182 to 184
columns: ['title', 'author', 'publish_time', 'status', 'size', 'saved'],
func: async (page, kwargs) => {
const rawUrl = kwargs.url;
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

columns adds the new saved field, but not all return paths in this command include it. In particular, the invalid-URL early return a few lines below returns an object without saved, which makes output schema inconsistent. Update that return object to include saved: '-' as well.

Copilot uses AI. Check for mistakes.
Comment thread skills/opencli-usage/commands.md Outdated

```bash
opencli web read --url "https://..." # 抓取任意网页并导出为 Markdown
opencli web read --url "https://..." # 抓取任意网页并导出为 Markdown(保存到 ./web-articles/)
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This note says the command saves to ./web-articles/, but the output directory is user-configurable via --output. To avoid misleading docs, consider wording like “默认保存到 ./web-articles/(可用 --output 修改)” or referencing the saved field instead of a fixed path.

Suggested change
opencli web read --url "https://..." # 抓取任意网页并导出为 Markdown(保存到 ./web-articles/)
opencli web read --url "https://..." # 抓取任意网页并导出为 Markdown(默认保存到 ./web-articles/,可用 --output 修改

Copilot uses AI. Check for mistakes.
Comment thread skills/opencli-usage/commands.md Outdated

```bash
opencli weixin download --url "https://mp.weixin.qq.com/s/xxx" # 下载公众号文章为 Markdown
opencli weixin download --url "https://mp.weixin.qq.com/s/xxx" # 下载公众号文章为 Markdown(保存到 ./weixin-articles/)
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This note hard-codes the save location as ./weixin-articles/, but users can override it via --output. Consider clarifying it's the default location (or pointing readers to the saved field) so the example remains accurate when --output is used.

Suggested change
opencli weixin download --url "https://mp.weixin.qq.com/s/xxx" # 下载公众号文章为 Markdown(保存到 ./weixin-articles/)
opencli weixin download --url "https://mp.weixin.qq.com/s/xxx" # 下载公众号文章为 Markdown(默认保存到 ./weixin-articles/;可用 --output 覆盖

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

publish_time: string;
status: string;
size: string;
saved: string;
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ArticleDownloadResult is exported from a shared module; adding a new required field (saved) is a TypeScript-breaking change for any downstream code that references this interface (even though runtime is backward-compatible). Consider making saved optional (saved?: string) to preserve type compatibility, while still populating it in all return paths for CLI output.

Suggested change
saved: string;
saved?: string;

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: web read / weixin download 执行后明确显示文件保存路径,并完善 skill 文档说明

2 participants