feat(download): show saved file path in web read and weixin download output#1042
feat(download): show saved file path in web read and weixin download output#1042Benjamin-eecs wants to merge 1 commit intojackwener:mainfrom
Conversation
There was a problem hiding this comment.
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
ArticleDownloadResultwith asavedfield and populated it for success/failure paths indownloadArticle. - Added a
savedoutput column toopencli web readandopencli 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.
| columns: ['title', 'author', 'publish_time', 'status', 'size', 'saved'], | ||
| func: async (page, kwargs) => { | ||
| const rawUrl = kwargs.url; |
There was a problem hiding this comment.
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.
|
|
||
| ```bash | ||
| opencli web read --url "https://..." # 抓取任意网页并导出为 Markdown | ||
| opencli web read --url "https://..." # 抓取任意网页并导出为 Markdown(保存到 ./web-articles/) |
There was a problem hiding this comment.
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.
| opencli web read --url "https://..." # 抓取任意网页并导出为 Markdown(保存到 ./web-articles/) | |
| opencli web read --url "https://..." # 抓取任意网页并导出为 Markdown(默认保存到 ./web-articles/,可用 --output 修改) |
|
|
||
| ```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/) |
There was a problem hiding this comment.
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.
| 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 覆盖) |
fdd43fd to
beae2f7
Compare
beae2f7 to
9e76f70
Compare
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
| saved: string; | |
| saved?: string; |
Summary
Closes #1038. @Astro-Han
opencli web readandopencli weixin downloadsave 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
savedfield to the output that shows the local file path on success (or-on failure).Changes
savedfield toArticleDownloadResultinterface and all return paths inarticle-download.tssavedcolumn to bothweb/readandweixin/downloadcommand definitionsTest plan
npx tsc --noEmitpassessavedfield (success, error, and adapter-level error)