Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(browser): pin recipe input handles and defer local exports

Dash561397dbb3a6
diff --git a/apps/desktop/src/main/mcp-integrations/browser-backend/__tests__/rsb-webview-upload-policy.test.ts b/apps/desktop/src/main/mcp-integrations/browser-backend/__tests__/rsb-webview-upload-policy.test.ts
index 82357c419c..8ec562681a 100644
--- a/apps/desktop/src/main/mcp-integrations/browser-backend/__tests__/rsb-webview-upload-policy.test.ts
+++ b/apps/desktop/src/main/mcp-integrations/browser-backend/__tests__/rsb-webview-upload-policy.test.ts
@@ -1,12 +1,12 @@
import fs from 'node:fs/promises';
-import { realpathSync } from 'node:fs';
+import nodeFs, { realpathSync } from 'node:fs';
import os from 'node:os';
import path from 'node:path';
-import { afterEach, beforeEach, describe, expect, it } from 'vitest';
-import { withRecipeHost, recipeDiagnosticPath } from '../../../../../../../packages/opencli-vendor/cindy/host.js';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { withRecipeHost, recipeDiagnosticPath, recipeOutputPath, statRecipeFileSync } from '../../../../../../../packages/opencli-vendor/cindy/host.js';
-import { resolveUploadFiles, resolveRecipeOutputPath } from '../rsb-webview-upload-policy.js';
+import { resolveUploadFiles, openRecipeInputFileSync, readRecipeInputFileSync, createRecipeFileBroker } from '../rsb-webview-upload-policy.js';
let tempRoot = '';
let allowedRoot = '';
@@ -21,10 +21,74 @@ beforeEach(async () => {
});
afterEach(async () => {
+ vi.restoreAllMocks();
await fs.rm(tempRoot, { recursive: true, force: true });
});
describe('resolveUploadFiles', () => {
+ // #6826 output TOCTOU: the real Desktop capability factory must not grant
+ // task-path writes. A valid output name is sufficient to expose the old
+ // path-returning grant; metadata and invocation-owned scratch still work.
+ it('grants metadata and temporary output without granting task-path writes', async () => {
+ const file = path.join(allowedRoot, 'report.txt');
+ await fs.writeFile(file, 'original');
+ await withRecipeHost(undefined, async () => {
+ expect(statRecipeFileSync(file).size).toBe(8);
+ expect(() => recipeOutputPath(file)).toThrow('Local recipe file export');
+ const scratch = recipeDiagnosticPath('scratch.txt');
+ await fs.writeFile(recipeOutputPath(scratch), 'scratch');
+ expect(await fs.readFile(scratch, 'utf8')).toBe('scratch');
+ }, createRecipeFileBroker([allowedRoot], [allowedRoot]));
+ expect(await fs.readFile(file, 'utf8')).toBe('original');
+ });
+ // #6826 input TOCTOU. Real host open/read entries, unit tier; earlier tests
+ // only validated path strings. Minimum interleaving: replace a checked file
+ // or its parent immediately before open; no unapproved bytes may be read.
+ it.each(['file', 'parent'])('rejects a %s replacement before opening input', async kind => {
+ const parent = path.join(allowedRoot, 'media');
+ await fs.mkdir(parent);
+ const file = path.join(parent, 'image.png');
+ await fs.writeFile(file, 'approved');
+ await fs.writeFile(path.join(outsideRoot, 'image.png'), 'private');
+ const actualOpen = nodeFs.openSync;
+ const close = vi.spyOn(nodeFs, 'closeSync');
+ let opened: number | undefined;
+ vi.spyOn(nodeFs, 'openSync').mockImplementation(((candidate: string, flags: number, mode: number) => {
+ if (candidate === realpathSync(file)) {
+ if (kind === 'file') {
+ nodeFs.renameSync(file, `${file}.old`);
+ nodeFs.writeFileSync(file, 'replacement');
+ } else {
+ nodeFs.renameSync(parent, `${parent}.old`);
+ nodeFs.symlinkSync(outsideRoot, parent, 'junction');
+ }
+ }
+ opened = actualOpen(candidate, flags, mode);
+ return opened;
+ }) as typeof nodeFs.openSync);
+ expect(() => readRecipeInputFileSync(file, [allowedRoot])).toThrow();
+ if (opened !== undefined) expect(close).toHaveBeenCalledWith(opened);
+ });
+
+ it('reads the checked descriptor after the pathname is replaced and closes on read failure', async () => {
+ const file = path.join(allowedRoot, 'image.png');
+ await fs.writeFile(file, 'approved');
+ const actualRead = nodeFs.readSync;
+ vi.spyOn(nodeFs, 'readSync').mockImplementation(((...args: Parameters<typeof nodeFs.readSync>) => {
+ nodeFs.renameSync(file, `${file}.old`);
+ nodeFs.writeFileSync(file, 'replacement');
+ return actualRead(...args);
+ }) as typeof nodeFs.readSync);
+ expect(readRecipeInputFileSync(file, [allowedRoot]).toString()).toBe('approved');
+ vi.restoreAllMocks();
+ const descriptor = openRecipeInputFileSync(file, [allowedRoot]);
+ expect(nodeFs.readFileSync(descriptor, 'utf8')).toBe('replacement');
+ nodeFs.closeSync(descriptor);
+ const close = vi.spyOn(nodeFs, 'closeSync');
+ vi.spyOn(nodeFs, 'readSync').mockImplementation(() => { throw new Error('fixture read failure'); });
+ expect(() => readRecipeInputFileSync(file, [allowedRoot])).toThrow('fixture read failure');
+ expect(close).toHaveBeenCalledOnce();
+ });
// #6826: sanitized temporary upload copies must stay within the invoking
// browser task's existing artifact root. Minimum input: one temporary PNG;
// the earlier output tests had no subsequent native-upload policy check.
@@ -39,25 +103,6 @@ describe('resolveUploadFiles', () => {
await expect(fs.access(path.dirname(file))).rejects.toThrow();
});
- // #6826: output paths need not exist yet. Existing upload-only cases cannot
- // detect writes via missing children, symlink parents or absent SSH roots.
- // Real host resolver, unit tier; smallest failure is one outside output path.
- it('resolves missing task outputs and rejects outside, sensitive and remote-only paths', async () => {
- expect(resolveRecipeOutputPath(path.join('new', 'report.txt'), [allowedRoot]))
- .toBe(path.join(realpathSync(allowedRoot), 'new', 'report.txt'));
- for (const candidate of [path.join(outsideRoot, 'new', 'report.txt'), path.join(allowedRoot, '.git', 'config'), path.join(allowedRoot, '.env')]) {
- expect(() => resolveRecipeOutputPath(candidate, [allowedRoot])).toThrow();
- }
- expect(() => resolveRecipeOutputPath('report.txt', [])).toThrow('local session directory');
- const link = path.join(allowedRoot, 'linked-output');
- await fs.symlink(outsideRoot, link, 'junction');
- expect(() => resolveRecipeOutputPath(path.join(link, 'new', 'report.txt'), [allowedRoot]))
- .toThrow('inside the current session directory');
- const broken = path.join(allowedRoot, 'broken-output');
- await fs.symlink(path.join(outsideRoot, 'missing'), broken, 'junction');
- expect(() => resolveRecipeOutputPath(path.join(broken, 'report.txt'), [allowedRoot])).toThrow();
- });
-
it('accepts ordinary files inside an allowed root', async () => {
const file = path.join(allowedRoot, 'report.txt');
await fs.writeFile(file, 'hello');
diff --git a/apps/desktop/src/main/mcp-integrations/browser-backend/rsb-webview-upload-policy.ts b/apps/desktop/src/main/mcp-integrations/browser-backend/rsb-webview-upload-policy.ts
index 1387332f78..bf496b6dcb 100644
--- a/apps/desktop/src/main/mcp-integrations/browser-backend/rsb-webview-upload-policy.ts
+++ b/apps/desktop/src/main/mcp-integrations/browser-backend/rsb-webview-upload-policy.ts
@@ -34,46 +34,6 @@ function isBlockedFile(filePath: string): boolean {
|| sensitiveDirectory;
}
-/** Output files may not exist yet: validate their nearest existing ancestor.
- * Reuse the upload roots and sensitive-file policy, including symlink identity. */
-export function resolveRecipeOutputPath(candidate: string, allowedRoots: string[]): string {
- const roots = allowedRoots.flatMap((root) => {
- if (!path.isAbsolute(root)) return [];
- try {
- const real = fs.realpathSync(root);
- return fs.statSync(real).isDirectory() ? [real] : [];
- } catch { return []; }
- });
- if (!roots.length) throw new Error('recipe output requires a local session directory');
- if (typeof candidate !== 'string' || !candidate || candidate.includes('\0')) {
- throw new Error('recipe output must be a local file path');
- }
- const target = path.resolve(roots[0], candidate);
- if (isBlockedFile(target)) throw new Error('recipe output blocked for sensitive path');
- let ancestor = target;
- const tail: string[] = [];
- while (true) {
- try {
- // lstat distinguishes missing paths from broken links, which grant nothing.
- fs.lstatSync(ancestor);
- } catch (error) {
- if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error;
- const parent = path.dirname(ancestor);
- if (parent === ancestor) throw error;
- tail.unshift(path.basename(ancestor));
- ancestor = parent;
- continue;
- }
- const real = fs.realpathSync(ancestor);
- const resolved = path.join(real, ...tail);
- if (!roots.some((root) => isInside(root, resolved))) {
- throw new Error('recipe output must stay inside the current session directory');
- }
- if (isBlockedFile(resolved)) throw new Error('recipe output blocked for sensitive path');
- return resolved;
- }
-}
-
/**
* Resolves upload candidates to their filesystem identity and confines every
* file to a host-provided root. Realpath checks prevent a workdir symlink or
@@ -86,6 +46,55 @@ export async function resolveUploadFiles(
return resolveUploadFilesSync(candidates, allowedRoots);
}
+/** Recipes consume the descriptor that was checked, never reopen its path.
+ * The second path check also rejects an ancestor replaced during open. */
+export function openRecipeInputFileSync(candidate: string, allowedRoots: string[]): number {
+ const resolved = resolveUploadFilesSync([candidate], allowedRoots)[0];
+ const expected = fs.lstatSync(resolved, { bigint: true });
+ if (!expected.isFile() || expected.ino === 0n) throw new Error('recipe input identity is unavailable');
+ const descriptor = fs.openSync(resolved, fs.constants.O_RDONLY
+ | (fs.constants.O_NOFOLLOW ?? 0) | (fs.constants.O_NONBLOCK ?? 0));
+ try {
+ const opened = fs.fstatSync(descriptor, { bigint: true });
+ const current = resolveUploadFilesSync([candidate], allowedRoots)[0];
+ if (!opened.isFile() || opened.dev !== expected.dev || opened.ino !== expected.ino
+ || current !== resolved || opened.size > BigInt(MAX_FILE_BYTES)) {
+ throw new Error('recipe input changed during open');
+ }
+ return descriptor;
+ } catch (error) {
+ fs.closeSync(descriptor);
+ throw error;
+ }
+}
+
+export function readRecipeInputFileSync(candidate: string, allowedRoots: string[]): Buffer {
+ const descriptor = openRecipeInputFileSync(candidate, allowedRoots);
+ try {
+ // Bound reads to this descriptor's checked size, including short reads.
+ const size = fs.fstatSync(descriptor, { bigint: true }).size;
+ if (size > BigInt(MAX_FILE_BYTES)) throw new Error('recipe input exceeds the byte limit');
+ const bytes = Buffer.alloc(Number(size));
+ let offset = 0;
+ while (offset < bytes.length) {
+ const count = fs.readSync(descriptor, bytes, offset, bytes.length - offset, offset);
+ if (!count) break;
+ offset += count;
+ }
+ return bytes.subarray(0, offset);
+ } finally { fs.closeSync(descriptor); }
+}
+
+/** Desktop grants reads and metadata, but no path-based local export. */
+export function createRecipeFileBroker(inputRoots: string[], sessionRoots: string[], temporaryRoot?: string) {
+ return {
+ read: (file: string) => readRecipeInputFileSync(file, inputRoots),
+ open: (file: string) => openRecipeInputFileSync(file, inputRoots),
+ directory: sessionRoots[0],
+ temporaryRoot,
+ };
+}
+
/** Synchronous adapters share exactly the same file policy as native uploads. */
export function resolveUploadFilesSync(candidates: unknown, allowedRoots: string[]): string[] {
if (!Array.isArray(candidates) || candidates.length === 0) {
diff --git a/apps/desktop/src/main/mcp-integrations/browser.ts b/apps/desktop/src/main/mcp-integrations/browser.ts
index 6289d97ffe..22b9c6a71a 100644
--- a/apps/desktop/src/main/mcp-integrations/browser.ts
+++ b/apps/desktop/src/main/mcp-integrations/browser.ts
@@ -21,7 +21,7 @@ import type { BrowserMcpDeps } from '@cindy/mcps';
import { createLogger } from '../logger.js';
import { genericOAuthSecretIo } from '../secrets/providerSecretStore.js';
-import { resolveUploadFilesSync, resolveRecipeOutputPath } from './browser-backend/rsb-webview-upload-policy.js';
+import { createRecipeFileBroker } from './browser-backend/rsb-webview-upload-policy.js';
import { artifactSessionRoot } from './browser-backend/rsb-webview-artifacts.js';
import { extractBrowserAvailability, type BrowserAvailability } from './browser-availability.js';
import { loadUserBrowserRecipes, type UserRecipesResult } from '../browser-recipes/loader.js';
@@ -481,17 +481,10 @@ export function getBrowserMcpDeps(): {
artifactSessionRoot(nodePath.join(app.getPath('temp'), 'cindy-browser-artifacts'), sessionId),
...sessionRoots,
] : [];
- const resolve = (file: string) => resolveUploadFilesSync([file], roots)[0];
- return {
- read: (file) => fs.readFileSync(resolve(file)),
- open: (file) => fs.openSync(resolve(file), 'r'),
- directory: sessionRoots[0],
- // Each backend consumes invocation copies below its existing upload root.
- // The recipe host owns the same finally cleanup for both backends.
- temporaryRoot: sessionId ? (backendController.kind === 'external'
- ? artifactSessionRoot(browserUploadDirectory, sessionId) : roots[0]) : undefined,
- output: (file: string) => resolveRecipeOutputPath(file, sessionRoots),
- };
+ // Both backends keep invocation copies under their existing upload root.
+ // A checked path grants metadata inspection, never subsequent writes.
+ return createRecipeFileBroker(roots, sessionRoots, sessionId ? (backendController.kind === 'external'
+ ? artifactSessionRoot(browserUploadDirectory, sessionId) : roots[0]) : undefined);
},
recipeSecrets: {
read: (key) => genericOAuthSecretIo.readStrict(browserRecipeSecretId(key)),
diff --git a/docs/dev-rules/credentials-and-local-storage.md b/docs/dev-rules/credentials-and-local-storage.md
index 67627251c9..3f633ebfa3 100644
--- a/docs/dev-rules/credentials-and-local-storage.md
+++ b/docs/dev-rules/credentials-and-local-storage.md
@@ -246,9 +246,11 @@ refresh 与 relay 自救节流。在途 refresh 尚未返回时收到的恢复
或用户动作中发生,便于控制路径、失败语义和清理。
- 临时文件使用唯一目录或文件名,完成、失败和取消路径都应尽力清理;需要跨重启保留的
内容不属于临时文件,应进入明确的 userData 存储与生命周期设计。
-- 浏览器适配器的读取和输出都交给实际调用任务的宿主文件代理;输出只能在任务的本地
- 工作目录内,校验尚未存在文件的最近已存在父目录及软链接,不得使用 Desktop 的 cwd
- 作为相对路径基准。SSH 任务没有本地输出根,不能落到控制端。诊断截图、跟踪、Cookie
+- 浏览器适配器的输入由实际调用任务的宿主文件代理打开,复核普通文件、大小和 bigint
+ dev/ino 后,同一描述符用于读取和元数据检查;复制或外部转换器使用批准字节的调用内副本,
+ 不重开源路径。Desktop 不给适配器授予基于路径字符串的任务文件输出能力:已校验路径
+ 不能保证后续写入不跟随被替换的链接。直接落盘命令暂缓,生成返回链接、网页读取返回正文,
+ 需要保存时使用既有宿主文件工具。SSH 无本地根时拒绝读取,不使用控制端 cwd。诊断截图、跟踪、Cookie
交接与媒体转换复用每次调用的唯一临时目录,调用结束时清理,不作为持久成果。
实现见 `packages/opencli-vendor/cindy/host.ts` 与
`apps/desktop/src/main/mcp-integrations/browser-backend/rsb-webview-upload-policy.ts`;
diff --git a/packages/lizi-mcps/src/browser/opencli-recipes.test.ts b/packages/lizi-mcps/src/browser/opencli-recipes.test.ts
index dd0e7cfb73..bb5243ea1b 100644
--- a/packages/lizi-mcps/src/browser/opencli-recipes.test.ts
+++ b/packages/lizi-mcps/src/browser/opencli-recipes.test.ts
@@ -14,7 +14,7 @@ import { loadRecipes, RecipeSchema, type Recipe } from "./recipe-loader.js";
import { runRecipe } from "./recipe-runner.js";
import { executeAdapter, type IPage } from '@jackwener/opencli/cindy';
import { saveBase64ToFile } from '@jackwener/opencli/utils';
-import { withRecipeHost, recipeDiagnosticPath, recipeOutputPath, readRecipeFileSync, readSecretJSON, writeSecretJSON } from '@jackwener/opencli/cindy/host';
+import { withRecipeHost, recipeDiagnosticPath, recipeOutputPath, recipeCopySource, readRecipeFileSync, readSecretJSON, writeSecretJSON } from '@jackwener/opencli/cindy/host';
import { mkdtemp, mkdir, writeFile, rm, readFile, realpath, access, readdir } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import path from 'node:path';
@@ -51,6 +51,27 @@ afterEach(() => {
});
describe("bundled OpenCLI recipes", () => {
+ // #6826 source-copy TOCTOU, unit tier. The shared copy entry must return an
+ // invocation-owned snapshot, not the original path after approving its bytes.
+ // Earlier converter cases did not exercise this separate copy source entry.
+ it('copies approved bytes instead of reopening a replaced source path', async () => {
+ const dir = await mkdtemp(path.join(tmpdir(), 'cindy-recipe-copy-test-'));
+ const source = path.join(dir, 'source.png');
+ await writeFile(source, 'approved');
+ let copy = '';
+ try {
+ await withRecipeHost(undefined, async () => {
+ copy = recipeCopySource(source);
+ expect(copy).not.toBe(source);
+ expect(await readFile(copy, 'utf8')).toBe('approved');
+ }, { directory: dir, read: file => {
+ const bytes = readFileSync(file); writeFileSync(file, 'replacement'); return bytes;
+ }, open: file => openSync(file, 'r') });
+ await expect(access(copy)).rejects.toThrow();
+ expect(await readFile(source, 'utf8')).toBe('replacement');
+ } finally { await rm(dir, { recursive: true, force: true }); }
+ });
+
// #6826 file boundary: actual media preparation / story entry, unit tier.
// Prior upload tests never exercised converters reopening a checked path.
// Replace the original immediately after broker approval; subprocess fakes
@@ -430,99 +451,60 @@ describe("bundled OpenCLI recipes", () => {
} finally { await rm(root, { recursive: true, force: true }); }
});
- // Unsupported export modes must be input failures before any navigation or
- // click; they used to perform page actions and then fail on waitForDownload.
- it.each(['video-social', 'gif'])('rejects unsupported export %s before browser execution', async (kind) => {
- const call = vi.fn();
- const result = await runRecipe(loadRecipes().get('opencli:midjourney/download')!, {
- job: '11111111-1111-1111-1111-111111111111', kind,
- }, { call });
- expect(result).toMatchObject({ ok: false, failureKind: 'input' });
- expect(call).not.toHaveBeenCalled();
- });
-
- // #6826: argument defaults bypassed the task-relative resolver. Unit tier,
- // real adapter -> shared writer with fake generation/network; previous novel
- // coverage did not pass image/download argument defaults through prepareInputs.
- it.each(['gemini/image', 'qwen/image', 'instagram/download'])('saves %s defaults inside the invoking task', async (id) => {
+ // #6826 output-scope convergence. Real adapter entries, unit tier with
+ // fake browser. Earlier tests granted an output callback that Desktop no
+ // longer provides; defaults must return links without attempting a save.
+ it.each(['gemini/image', 'qwen/image'])('returns %s links without a local export by default', async id => {
const dir = await realpath(await mkdtemp(path.join(tmpdir(), 'cindy-recipe-default-test-')));
const url = 'https://example.test/generated.png';
- const asset = { ok: true, mime: 'image/png', base64: 'aW1hZ2U=' };
vi.spyOn(gemini, 'startNewGeminiChat').mockResolvedValue(undefined);
vi.spyOn(gemini, 'getGeminiVisibleImageUrls').mockResolvedValue([]);
vi.spyOn(gemini, 'sendGeminiMessage').mockResolvedValue(undefined);
vi.spyOn(gemini, 'waitForGeminiImages').mockResolvedValue([url]);
- vi.spyOn(gemini, 'exportGeminiImages').mockResolvedValue([{ mimeType: 'image/png', dataUrl: 'data:image/png;base64,aW1hZ2U=' }]);
+ const exportImages = vi.spyOn(gemini, 'exportGeminiImages');
for (const name of ['ensureOnQianwen', 'dismissLoginModal', 'startNewChat', 'setFeatureToggle'] as const)
vi.spyOn(qwen, name).mockResolvedValue(undefined);
vi.spyOn(qwen, 'sendMessage').mockResolvedValue({ ok: true });
vi.spyOn(qwen, 'hasLoginGate').mockResolvedValue(false);
vi.spyOn(qwen, 'getMessageBubbles').mockResolvedValue([{ role: 'Assistant', id: 'answer' }]);
- vi.spyOn(guardedNetwork, 'fetchWithSsrFGuard').mockImplementation(async () => ({
- response: new Response('image'), finalUrl: url, release: async () => {},
- }));
- const outputs: string[] = [];
- const page = {
- goto: async () => {}, wait: async () => {},
- evaluate: async (js: string) => {
- if (js === 'window.location.href') return 'https://example.test/';
- if (id === 'instagram/download') return { ok: true, shortcode: 'B', items: [{ type: 'image', url }] };
- return js.includes('arrayBuffer()') ? asset : [url];
- },
+ const goto = vi.fn(async () => {});
+ const page = { goto, wait: async () => {}, evaluate: async (js: string) =>
+ js === 'window.location.href' ? 'https://example.test/' : [url],
} as unknown as IPage;
+ const files = { directory: dir, read: readFileSync, open: (file: string) => openSync(file, 'r') };
try {
- await executeAdapter(id, id === 'instagram/download' ? { url: 'https://www.instagram.com/p/B/' } : { prompt: 'fixture' }, page, undefined, undefined, {
- read: () => Buffer.alloc(0), open: () => -1, directory: dir,
- output: file => {
- const relative = path.relative(dir, file);
- if (relative.startsWith('..') || path.isAbsolute(relative)) throw new Error('output outside task');
- outputs.push(file);
- return file;
- },
- });
- const file = outputs.find(file => /\.(png|jpg)$/.test(file));
- expect(file).toBeDefined();
- expect(await readFile(file!, 'utf8')).toBe('image');
+ const result = await executeAdapter(id, { prompt: 'fixture' }, page, undefined, undefined, files);
+ expect(JSON.stringify(result)).toContain('https://example.test/');
+ expect(exportImages).not.toHaveBeenCalled();
+ expect(await readdir(dir)).toEqual([]);
+ goto.mockClear();
+ await expect(executeAdapter(id, { prompt: 'fixture', sd: false }, page, undefined, undefined, files))
+ .rejects.toThrow('Local recipe file export');
+ expect(goto).not.toHaveBeenCalled();
} finally { await rm(dir, { recursive: true, force: true }); }
});
- // #6826 output/diagnostic review. Unit tier; the real adapter and screenshot
- // entries previously covered reads only. Minimal inputs are one local novel
- // output and two overlapping screenshots with the same diagnostic name.
- it('brokers adapter writes and resolves defaults against the invoking task', async () => {
+ // A checked metadata path cannot become a write capability. Real shared
+ // writer/screenshot, unit tier; valid task paths still reject before writing.
+ it('rejects local exports while allowing a content-only web read', async () => {
const dir = await realpath(await mkdtemp(path.join(tmpdir(), 'cindy-recipe-output-test-')));
- const page = { goto: async () => {}, evaluate: async () => ({
- error: false, body: { id: '1', title: 'Fixture', userName: 'Fixture', userId: '2', content: 'local test text', tags: { tags: [] } },
- }) } as unknown as IPage;
- const inputs = { 'novel-id': '1', execute: true };
+ const image = path.join(dir, 'image.png');
+ const files = { directory: dir, read: readFileSync, open: (file: string) => openSync(file, 'r'), inspect: (file: string) => file };
+ const page = { goto: vi.fn(async () => {}), wait: async () => {}, evaluate: async () => ({ title: 'Fixture', contentHtml: '<p>local test text</p>' }) } as unknown as IPage;
+ const screenshot = new OpenCliPage({ targetId: 'fixture', call: async request => ({
+ ok: true, action: request.action, data: { data: 'aW1hZ2U=' },
+ }) });
try {
- const rejected = path.join(dir, 'rejected');
- const output = vi.fn(() => { throw new Error('output denied by host'); });
- await expect(executeAdapter('pixiv/novel-download', { ...inputs, output: rejected }, page, undefined, undefined,
- { read: () => Buffer.alloc(0), open: () => -1, directory: dir, output },
- )).rejects.toThrow(/output denied by host|not a safe directory/);
- expect(output).toHaveBeenCalledWith(rejected);
- await expect(access(rejected)).rejects.toThrow();
- const deniedImage = path.join(dir, 'image.png');
- await expect(withRecipeHost(undefined, () => saveBase64ToFile('aW1hZ2U=', deniedImage),
- { read: () => Buffer.alloc(0), open: () => -1, directory: dir, output },
- )).rejects.toThrow('output denied by host');
- await expect(access(deniedImage)).rejects.toThrow();
- const result = await executeAdapter('pixiv/novel-download', inputs, page, undefined, undefined,
- { read: () => Buffer.alloc(0), open: () => -1, directory: dir, output: file => file },
- ) as Array<{ path: string }>;
- expect(result[0].path).toBe(path.join(dir, 'pixiv-downloads', 'novels', '1.txt'));
- expect(await readFile(result[0].path, 'utf8')).toContain('local test text');
- const screenshot = new OpenCliPage({ targetId: 'fixture', call: async request => ({
- ok: true, action: request.action, data: { data: 'aW1hZ2U=' },
- }) });
- await withRecipeHost(undefined, () => screenshot.screenshot({ path: deniedImage }),
- { read: () => Buffer.alloc(0), open: () => -1, directory: dir, output: file => file });
- expect(await readFile(deniedImage, 'utf8')).toBe('image');
- await expect(executeAdapter('pixiv/novel-download', { ...inputs, output: path.join(dir, 'no-host') }, page))
- .rejects.toThrow(/host output file broker|not a safe directory/);
- await expect(access(path.join(dir, 'no-host'))).rejects.toThrow();
- } finally { await rm(dir, { recursive: true, force: true }); }
+ await expect(withRecipeHost(undefined, () => saveBase64ToFile('aW1hZ2U=', image), files))
+ .rejects.toThrow('Local recipe file export');
+ await expect(withRecipeHost(undefined, () => screenshot.screenshot({ path: image }), files))
+ .rejects.toThrow('Local recipe file export');
+ const result = await executeAdapter('web/read', { url: 'https://example.test' }, page, undefined, undefined, files);
+ expect(JSON.stringify(result)).toContain('local test text');
+ await expect(executeAdapter('web/read', { url: 'https://example.test', stdout: false }, page, undefined, undefined, files))
+ .rejects.toThrow('Local recipe file export');
+ expect(await readdir(dir)).toEqual([]);
+ } finally { await screenshot.dispose(); await rm(dir, { recursive: true, force: true }); }
});
it('isolates overlapping diagnostics and cleans both fulfilled and rejected calls', async () => {
@@ -592,11 +574,11 @@ describe("bundled OpenCLI recipes", () => {
}));
const result = await runRecipe(loadRecipes().get('opencli:yollomi/upload')!, { file }, { call });
expect(result.ok).toBe(false);
- expect(result.message).toContain('file broker');
+ expect(result.message).toContain('File not found');
expect(call.mock.calls.some(([req]) => req.request?.fn?.includes('atob('))).toBe(false);
const read = vi.fn(() => Buffer.from('approved-image'));
const approved = await runRecipe(loadRecipes().get('opencli:yollomi/upload')!, { file }, {
- call, recipeFiles: async () => ({ read, output: file => file, open: () => { throw new Error('unused'); } }),
+ call, recipeFiles: async () => ({ read, open: file => openSync(file, 'r') }),
});
expect(approved.ok).toBe(true);
expect(read).toHaveBeenCalledWith(file);
@@ -865,17 +847,17 @@ describe("bundled OpenCLI recipes", () => {
expect(JSON.stringify(all)).toContain('open-library-search');
expect(JSON.stringify(all)).toContain('steam-reviews');
expect(JSON.stringify(all)).toContain('xiaoyuzhou-podcast');
- const midjourney = await query('midjourney');
- expect(midjourney.recipes.find((recipe: { id: string }) => recipe.id === 'opencli:midjourney/download').parameters.kind.choices)
- .toEqual(['auto', 'image', 'video-raw']);
- // The public guide must describe the same task-relative defaults used by
- // execution; otherwise callers can reintroduce an out-of-task path.
+ for (const id of ['instagram/download', 'midjourney/download', 'pixiv/novel-download']) {
+ expect(JSON.stringify(all)).not.toContain(`opencli:${id}`);
+ await expect(executeAdapter(id, {}, {} as IPage)).rejects.toThrow('Unknown bundled adapter');
+ }
+ // Discovery and execution share the selected content/link-only defaults.
for (const [site, command, arg, expected] of [
- ['gemini', 'image', 'op', './gemini-images'],
- ['qwen', 'image', 'op', './qianwen-images'],
- ['instagram', 'download', 'path', './instagram-downloads'],
- ['midjourney', 'download', 'output', './midjourney-downloads'],
- ]) {
+ ['gemini', 'image', 'sd', true],
+ ['qwen', 'image', 'sd', true],
+ ['midjourney', 'generate', 'skip-download', true],
+ ['web', 'read', 'stdout', true],
+ ] as const) {
const guide = await query(site);
expect(guide.recipes.find((recipe: { id: string }) => recipe.id === `opencli:${site}/${command}`).parameters[arg].default).toBe(expected);
}
diff --git a/packages/opencli-vendor/README.md b/packages/opencli-vendor/README.md
index 5f1d47092e..2ef28c4312 100644
--- a/packages/opencli-vendor/README.md
+++ b/packages/opencli-vendor/README.md
@@ -11,14 +11,15 @@
- 170 个站点/应用,1,223 条命令(916 read、307 write)。
- 1,112 个命令模块,所有生产共享代码、JSON 和其他资源一并引入;不引入上游测试。
- 上游快照完整保留,但默认目录独立选择:排除 Z-Library、Slock、Claude.ai、Spotify、ONES、
- 小宇宙适配器、PaperReview、Quark 和 Kimi 共 121 条,剩余 1,102 条命令、25 个上游别名。原因记录在 [selection.json](cindy/selection.json),
+ 小宇宙适配器、PaperReview、Quark 和 Kimi 共 121 条,另暂缓 17 条直接落盘命令,
+ 剩余 1,085 条命令、25 个上游别名。原因记录在 [selection.json](cindy/selection.json),
同步会沿用此选择,排除条目不进入模块导入表和可执行目录。
- Cindy 原有 56 个 ID:47 个转到新版适配器,7 个保留原流程,两个爬虫练习站移至
`packages/lizi-mcps/src/browser/recipe-examples`,不再出现在默认列表。
逐项记录见 [legacy-coverage.json](cindy/legacy-coverage.json)。
- Cindy 独立增加 App Store 搜索、Google Play 搜索、TapTap 中国站游戏详情、Steam 玩家评价、
Open Library 书目查询和 Crossref 文献/DOI 查询,共 6 个配方,位于
- `packages/lizi-mcps/src/browser/cindy-recipes`。共 1,187 个可发现 ID、168 份指南;这个数包含别名和兼容入口。
+ `packages/lizi-mcps/src/browser/cindy-recipes`。共 1,170 个可发现 ID、168 份指南;这个数包含别名和兼容入口。
- 兼容入口保持输入名,输出改为新版结构化结果;用户本地覆盖层仍优先于内置层。
通过 `browser(action="siteguide")` 查询精简完整目录;传 `site`(域名或上游站点名)
@@ -51,11 +52,15 @@
- 适配器直接读取文件和分片上传也须通过宿主文件代理,复用原有上传目录、敏感文件和
realpath 校验;文件检查复用同一代理的描述符,命名导入与别名导入均按任务解析。
无会话目录或宿主文件代理时拒绝读取。ChatGPT 后端请求只发送自身域的 Cookie。
-- 输入文件检查统一通过宿主描述符,其他文件存在性、目录枚举和输出检查先验证任务根;
+- 输入读取、stat 和存在性检查统一通过宿主核对身份的同一描述符;以 bigint dev/ino、
+ 普通文件及大小复核,读取有字节上限,拒绝和异常都关闭描述符。复制源也只返回批准字节的暂存副本;
生产构建检查这些文件边界。上传在派发前把批准字节暂存到对应后端已有上传根下的调用目录,
成功和失败均沿用调用 finally 清理,源文件保留;外部 Chrome 与内嵌浏览器使用相同的暂存入口。
-- 图片、音频和下载成果的默认路径与目录参数元数据均使用任务内相对路径;
- 诊断截图及跟踪文件按调用隔离,结束后清理,兼容 Windows。
+- Desktop 不授予适配器直接写任务路径的能力,也不返回任务路径用于目录枚举;
+ 路径校验不能保证之后的 mkdir、write、rename 等操作不跟随被替换的链接,因此不为
+ 这些入口新增跨平台写入机制。17 条直接落盘命令暂缓,生成配方沿用已有链接分支,
+ 通用网页读取默认返回正文;发现与执行共用这些默认值,显式关闭上述模式在页面动作前拒绝。
+ 需要保存结果时使用已有宿主文件工具。调用内诊断、上传副本和转换结果继续可用,结束后清理。
- Instagram 图片转换、视频元数据、封面及 story 裁剪只读取批准字节的调用内副本,
不重新打开原始源路径;临时输入及转换结果沿用同一调用目录,在成功或失败后清理。
- 抖音分片上传先批准并打开源文件,再创建远端上传;上传 ID 和进度只存于本次调用,
@@ -84,8 +89,8 @@
包含可达依赖,但不是完整安装包增量,也不包括 Cindy 的 JSON 配方。
站点登录、API 凭据、本机应用和下载工具等条件仍由各适配器要求;需要浏览器桥接特有的
-可选能力仍受 Cindy 后端能力限制。Midjourney 默认目录只提供图片与原始视频下载,
-不暴露社交视频/GIF;显式调用不支持的模式在操作页面前按参数错误拒绝。普通文件/API 下载不依赖该可选能力。不要为测试写命令对真实账号执行发布、
+可选能力仍受 Cindy 后端能力限制。Midjourney 下载命令与其他直接落盘命令暂缓,
+生成仍可返回页面结果;完整来源不代表对应的本地写出能力已向适配器开放。不要为测试写命令对真实账号执行发布、
点赞、删除或付款。
## 下次同步
diff --git a/packages/opencli-vendor/UPSTREAM.json b/packages/opencli-vendor/UPSTREAM.json
index e1f73430d5..a93f5eddf4 100644
--- a/packages/opencli-vendor/UPSTREAM.json
+++ b/packages/opencli-vendor/UPSTREAM.json
@@ -390,7 +390,7 @@
"clis/chatgpt/deep-research-result.js": "43993ccc844f62d93ff7cc2dce1d2adcc847896df07b1c4599b1045678410a51",
"clis/chatgpt/detail.js": "8c43571fdc1f3ccd4d2242f5c7eb8e0a7a6069e9230b49c12ca7bf7a2c8ae3b2",
"clis/chatgpt/history.js": "66d608d3c77d95983f668211c6366c081d9d008aede136062af950aa0fd89785",
- "clis/chatgpt/image.js": "6c554475a85cb6280dbc024c94647aa8d950c105660c63611e0f2b05b4b7c83c",
+ "clis/chatgpt/image.js": "e13f01aaa4c49c217d24f9f661523be4fbf252d9e27684f11d81bbb9a5cbc81e",
"clis/chatgpt/model.js": "2c7e4535f07d3fb6091f359dadb64064168772565b188c3ed58dccee4e0b82ac",
"clis/chatgpt/new.js": "68d2435dc54035ee566e6140e8f9104c368342237474dff5dacd70380e07311d",
"clis/chatgpt/project-file-add.js": "90bd5b4ff547f7ba1db66d8d5b356d1694eb1a02995f5675f33d61a6f0908fdc",
@@ -516,7 +516,7 @@
"clis/douyin/_shared/browser-fetch.js": "50117bc3144a7d4824150a04da173758747b16e77405bbce9f47dbf2d2c6e525",
"clis/douyin/_shared/creation-id.js": "7764baf7e84773233a9ae1881b5dd6f5be49cf24dd4e8d02524beb2d0087973a",
"clis/douyin/_shared/evaluate-result.js": "e83d57918fda3f1b39e7b58b462415dc91451eaea4c325b509bf59f43a3f5c6d",
- "clis/douyin/_shared/imagex-upload.js": "16c678b9a05c08f45621750d7d69e96d6885ff978985a431cbc0726e7119af39",
+ "clis/douyin/_shared/imagex-upload.js": "d5170ce4b0af635213b97d3aed84eb0c3b582402b84d4c7aa170267e26d62404",
"clis/douyin/_shared/public-api.js": "4c8140adb5f4a3c7b8e5946d614241c719d494f6bb5f5546c72125f272fd1606",
"clis/douyin/_shared/sts2.js": "0759c0b4ac5542ad06a7bc03af5370579721f9af249ff29ad6230bdb6a2d7c46",
"clis/douyin/_shared/text-extra.js": "4caa2e8660eba04115476ee212deaa7ac578271e3df18c4513295b9c15fca3dd",
@@ -531,12 +531,12 @@
"clis/douyin/delete.js": "49469d70131c5934b7ae636bcef7d7208dcf2b30a85c18288f1e21a7d9dab978",
"clis/douyin/detail.js": "3262fac62fdb9703c1aac36cfdd54bce76bbb4b5d1f11c0f4f75da6521c16e95",
"clis/douyin/detail.LICENSE": "fd5c0a7fd23782b2835070f7902c1469c63bf1d9fc3eb58523e088dba1672e6b",
- "clis/douyin/draft.js": "ee8d9ae3e7c36531cf4cff61a732d6e0dd37967699dbcc93486afeeb154d47f0",
+ "clis/douyin/draft.js": "f7c9c49b785060f0c1d74c8b4154c3b3ebb535737405073195b308a91b708619",
"clis/douyin/drafts.js": "c0fda6aec116d9b8ba19957fd6d541b34eaffa1959ad86f9ec13ec5c91524ad9",
"clis/douyin/hashtag.js": "7952fb0240669b86d1b5b254fddc0758797677df0830047ca5e7a6ed565f86ad",
"clis/douyin/location.js": "f8637006996174d8830bb299d5ccb18c0fe589964ebf77bf0865cea3d39b8712",
"clis/douyin/profile.js": "4d4c7a090dd84479961f31a17a6761db363f9a313a90569ac647347242cb9f53",
- "clis/douyin/publish.js": "daa37b28f4832a66fb4022d816ee73651080c41c82c4ac374652936575ee0cf5",
+ "clis/douyin/publish.js": "fdf0ff1f56472d193b14103c4b69031819e7a7510d24753b9a81f8b0b7c7098b",
"clis/douyin/search.js": "28c508c4bb80282858e036ba2c3b57c91de8651293d2c12234c3486fe535fbe1",
"clis/douyin/stats.js": "baac5cff947d7848bca84303de8c1cfcd75a24b488e64f1c644fa04eec388aba",
"clis/douyin/update.js": "407f58aea77dfb29a78480fc6dad255fcae9b16af9ba98c041ec5b9eced6c1ec",
@@ -715,7 +715,7 @@
"clis/indeed/utils.js": "432ee24c15fdd18df6d9e9a54fbfcdd75edf86708eae88b64dcd4bec06822118",
"clis/instagram/_shared/navigation.js": "acb71a106f5086de5e2053d8fda4bfd1ecc67ce96fb3c0722b118d1501ca7725",
"clis/instagram/_shared/post-like.js": "e1acb51a3f00823df80f18c89f529f2613e62b75a3525e1a872861049e39dbda",
- "clis/instagram/_shared/private-publish.js": "a7767d1992cdf5ffb945b20a4de84dd14cedd3adde7375d9cedc006eea307b9f",
+ "clis/instagram/_shared/private-publish.js": "5f614179c8dd3dc70684669b8bdb4278388bc9df97ed0ec35fabafa88e50c97a",
"clis/instagram/_shared/protocol-capture.js": "1d6d92e962d76cfe8ddd30b7df914b1a3f8c3a3a76c6433808249aef64a7db20",
"clis/instagram/_shared/read-response.js": "7805d4fc63e6ecb767136a6c7ae5415a000c41768b047f2ee539eb23f76bb513",
"clis/instagram/_shared/runtime-info.js": "40ecefbf47ee65685048d9b8f61ba12dc9666d5e1ba8c048828b9e7eff74592c",
@@ -731,13 +731,13 @@
"clis/instagram/following.js": "f42334a31aca1a727a11874836e814584b8cbac7e51a876c80b8d0d4d38775c9",
"clis/instagram/like.js": "40eca5c72564f704c40cf27b6c4da1bc38ee4d875224415cd88292a74e1b7bb0",
"clis/instagram/note.js": "5c409f7e6d2da0ab2c875729154b1af04c4ec00c6a2d51e4807bc3c3ea50abf8",
- "clis/instagram/post.js": "6bfdf02653c73ab4f0c552afba03fcb74177c7c33043c2dab32999fa6ad35754",
+ "clis/instagram/post.js": "2e03fb73450023fcee74f8aea66595e0dd523b333bb94e62bc73496cea06a373",
"clis/instagram/profile.js": "40f400cdabdcfcc216c5e7fa4bb321f1b70e00a5a5b83bac3c2ee1c276fca312",
- "clis/instagram/reel.js": "6a580a3147ab9bd514c5c7a6b8c38380edc69c3254e4d5568e01a30c40818f29",
+ "clis/instagram/reel.js": "041de023591ed3a3f1d39c7b1fb8cb2f6d0f8f7f75ac7b8f6695ee55adf0f99c",
"clis/instagram/save.js": "fc5105071edad389d6004247a1113473ade4b8da3e174ed6c06ef151d5a468ec",
"clis/instagram/saved.js": "95fbb7d994bd68e502b0b6a7fce70f24c3cf58083d5aefb1af54dfdd288781ec",
"clis/instagram/search.js": "a38879e761271d167bef752359442b0be84611cca727b2b323467772d2d45239",
- "clis/instagram/story.js": "a9068d974cd13e5831dd21198b97511e7b2431641b9e3bcaacce7f4cc4dc0a9d",
+ "clis/instagram/story.js": "32597058744a4b3c55ef117302d93babcc964151fc22675e125e89f364d6cdec",
"clis/instagram/unfollow.js": "80631c5da759fe95e384ed674b791101d7554b6243094cffa2e2d559f329e57c",
"clis/instagram/unlike.js": "3e098fdd270da213aee8c4d108ed3c47e20b89f060a9dba938426286f406492f",
"clis/instagram/unsave.js": "9872bd76c98039689cc7c68fe255f230226efce0fe9b45dd651a540312504c1f",
@@ -896,17 +896,17 @@
"clis/midjourney/quota.js": "51ea3faaadba3866a7ec9095de27fcc17da1dde1a49f63c3f4381f5e5dfa069c",
"clis/midjourney/settings.js": "bcec44f911c62f1621f0a8776199c7ab3918df16c648e9fa2216f11e0bfea6bf",
"clis/midjourney/status.js": "1382504f9b9cbe73864bc05f4d3f398ea38ae3fa18a4379428b7cdfee8ecfc2b",
- "clis/midjourney/utils.js": "f368913a9c03b1c8c6db5e2696a542e6787a49c19bd11dee21b7a152eda4881e",
+ "clis/midjourney/utils.js": "e36223b948a510350395573b72977b74ec629336eb95d81acb8912c3400cca34",
"clis/midjourney/whoami.js": "78424e609c5cc0022ec7c2590cc902371f4431207d2f0b1079a9cdf9fa1beea9",
"clis/minimax/music.js": "a192c07d35827813ca229d4fae2e4136153aaa8e987d2335db33605daaa65837",
- "clis/minimax/utils.js": "07c258f4481a8c3524d66cc686915222a3a8f0b9879626e0a520571226974e51",
+ "clis/minimax/utils.js": "7dd0d625133037e916f84df7e7c79b5872e868afa1245e3e41a72d1b8301aecd",
"clis/mubu/doc.js": "8c0e2cbe4ad8246744ed2ab903d54ad0a4fa4f3a4778ab498c5c14f8c01216c2",
"clis/mubu/docs.js": "1b2b186631e9bfc973140ffbf29d525ee46b66e25488c5b1b13ab908d0c1bfa4",
"clis/mubu/notes.js": "70e91496a033bd3054b152c8047e2bc59d7b4c4f973fda092ccc2cecb8a12bfa",
"clis/mubu/recent.js": "c942df22f5a5471e0603ad4a9145b3f2165b7d7501b8a880fd1294c2d54aecc1",
"clis/mubu/search.js": "27a36be32428b2ee469a2290a73de4ae42c11b2ddac3438c6d60d7f46a7a9b6a",
"clis/mubu/utils.js": "084cda4a7f1b06a2e4702517ed942ab0b29deff640b5097d4c92f6ee81d83b88",
- "clis/notebooklm/add-source.js": "d26e70d233275ea5c960c647a77d2a16bcd64d4764bfe1f54df5ce3ff3c20cb5",
+ "clis/notebooklm/add-source.js": "3749701dc43b3d8ba0d608fc23b515811655cc19f80ce66259370f4754ece71d",
"clis/notebooklm/auth.js": "03eeb11bbf5160b46bb01bd40bb5a06add947e5e0841b28731f6fa79fee9f2db",
"clis/notebooklm/create.js": "8b6e73960db406cf55351b128a217027ae6f8cd6c969f335385d33e83db09f7b",
"clis/notebooklm/current.js": "164f185ab66af82d2b51697b7c2338393314f228717f4b3d09592e57ab5a4085",
@@ -990,7 +990,7 @@
"clis/paperreview/feedback.js": "198fb6ff0c8c151e7d42ea5853781460bf273a96be685bf74fc072977141f5a2",
"clis/paperreview/review.js": "5f9c372061f10e5329d5711523457537aee7c21b10d8a2fb790937492b1d1f74",
"clis/paperreview/submit.js": "a618f96d7f0b1e9c887a3ca44e23f411f471845cd521c72fb41df8fef6b335fb",
- "clis/paperreview/utils.js": "932aa6b62f6691e35e9ee2410c8caa640b82f9b54b203b699d06566d15675c1e",
+ "clis/paperreview/utils.js": "8c608cc2e5aac224fbedc048cabd31074440814d1f2dfd79d7acec0a54e64d13",
"clis/pinterest/board-create.js": "11559ab31594c8ef079e64f0775e1765ddd340f90c818a3d9e2717a881b13550",
"clis/pinterest/board-delete.js": "7ebe57101e3dee3b2a5a09c1253a84fcd327148c4e48d917dce8700c09a7bf60",
"clis/pinterest/board-pins.js": "31dc289e09cb6c547b733464ba96cf40bd05d07000b736c4dc2e53050a1f8bf9",
@@ -1012,14 +1012,14 @@
"clis/pinterest/user.js": "74caf778de5511cab09ebb57d15d48163e5e80b9ccec6bba636d5749e50f58af",
"clis/pinterest/utils.js": "93a4de9d26601cd189e33518a16e59861e35bba71ffdc6deb549c9071f63f0a9",
"clis/pixiv/auth.js": "c310b6eba51848c77db58cb5471944c7bfa77c4566cf128942a49ad0f58a7c8f",
- "clis/pixiv/bookmark-download.js": "bb6c8003b20db1993201b8d7fbfa853776f9c323e43c1c1ee09af3f9ce73f0d6",
+ "clis/pixiv/bookmark-download.js": "5cb5e56c39b59f1b75e7a8052c62f07e59b3f7ad004ec8235ec480f73ef3125e",
"clis/pixiv/bookmark-utils.js": "e2a0553503f1553495a23fe44c351e45da6e11d1fe9825d3339768a02189a6f5",
"clis/pixiv/bookmarks.js": "5ea921bc5d61093b32ef46899e7dac4c81ac6f1e8121692e711a50cd82f6a1dc",
"clis/pixiv/detail.js": "5d3e08bb06597f6f7c9a13f9d87a6743ae8e7613aa1125a8b50c7c59fec3533d",
"clis/pixiv/download.js": "59e937271f1ede5628ade7808d6a529e48ef6c39c094cf9b476222b030f1201c",
"clis/pixiv/illusts.js": "49c1363bb9ddcc55b12ec3eec72f7dfd75b549e70c586052f505d99249fe01fc",
"clis/pixiv/me.js": "eed040f8be1ce1b385a9aad3ac525c0860e3e03b43a6e151b44f7ea7dd17bad7",
- "clis/pixiv/novel-download-utils.js": "e2e6fbc1c3ec8121adf8f8bed44eb6ddce030d503de94637f151f1eea20e7615",
+ "clis/pixiv/novel-download-utils.js": "c5780abcb917996591500a3a01bff84f9eb4fc8a454ffb36a0c85d8100b7a663",
"clis/pixiv/novel-download.js": "95a05617659b8e7790f09d36d1bdcdbda8692245382eccc1ad4251bfc11a44be",
"clis/pixiv/novel.js": "55b7cd8d80cdffd4d44c8f11f35de0f6f748f24795a5acef5ae1af76779fb9bf",
"clis/pixiv/novels.js": "cf63f172140b826cc78b3fd32c182cd3a8cc1aa534d6f331c9fe2712f717d63d",
@@ -1203,7 +1203,7 @@
"clis/suno/generate.js": "4dd38a391fce74c6df9190832d51988ef5d63e17845d171c4fca98ca77b5767c",
"clis/suno/list.js": "f4b6f015a9c87547eda1b84adf6d6960c868b8b60c0e8b75f06a1c3367f6212f",
"clis/suno/status.js": "57559e6773be4f37b65c2ad9bf1590e4b87cbae19db26b59c5601053a3bd5bd7",
- "clis/suno/utils.js": "e0f36f011d8c20b94a86e988777e1f29f5e809403a6abce3bad855fd1f6b7a17",
+ "clis/suno/utils.js": "f32c3c8db4d9312854ceab06e93cdfe73c59c81437fac38a52f0522b37f8b7a3",
"clis/taobao/add-cart.js": "ab8c4410ad47fcce126532980c6bfead586acf62d3ece709d31a48b5d71560f1",
"clis/taobao/auth.js": "771219ed232f85e3fb59984377f9f03e3ce3129c5d158eb92ebeb6ddb2f02ccd",
"clis/taobao/cart-action.js": "48a8c345e49298387c455607fda5bc34fc8e158925e15f3ec10836cb860afae4",
@@ -1259,14 +1259,14 @@
"clis/tvmaze/show.js": "bfd76054316b2309835c9e041af6c3b8c6ff234f9f78eee5f519d9cd3aabb065",
"clis/tvmaze/utils.js": "0eba0730644e1d1eb433dde45ec65d3db36856cb202420f962d032366a65aeb1",
"clis/twitter/accept.js": "ae85da341b400e535538700e78c8958a649425783cc9ca163da11aafd0fbf17d",
- "clis/twitter/archive.js": "f9ebba3e4b1ca600ae35be9f87877bd1e119fde18192fb45854718f2a41bd3cf",
+ "clis/twitter/archive.js": "be505f9983d5ba45cf8e9c02567efa8d787334bbbce27fc62da9595ea4ae1468",
"clis/twitter/article.js": "8a9838423d895f2a81da36c149132ca4d455dbfb121617f473afa04ba745f5d5",
"clis/twitter/auth.js": "4f626b2313472183676837ab20abc237a0cc8dc5246ef547262b311587b3cbed",
"clis/twitter/block.js": "c5ae3dfb44d100be31c54943dc16b4c84a35c915b6fa4d0c9746f71aa9348933",
"clis/twitter/bookmark-folder.js": "8797a227580ec5388c0207a600ac23738e633b8bc9634650944b38c5e5e26a6c",
"clis/twitter/bookmark-folders.js": "5d318c1d623b74ba8fb4fb680b4a93578bd604034a7b6c1bd695c106d86ef60e",
"clis/twitter/bookmark.js": "8f775d736c3638f7e016d4341e994a9d1843ba199032ec17067b20f0344f4fbe",
- "clis/twitter/bookmarks.js": "317225b6ae4bedd178775ebf4724a437ef6c647d44929e6e73cae60362b0b0fd",
+ "clis/twitter/bookmarks.js": "52842c142eb1525e099e79beaf439da2bd5e0a44a9d94904e951e40e388a8999",
"clis/twitter/collection.js": "896d740afd40132d25345cd817f4b9c9cab19a37b6b0e63b0ac44d6aa5540cfe",
"clis/twitter/delete.js": "a705c98df94f952e35b4d85da1b40a1227e6dd71e6fc488043c4364b7cb0857a",
"clis/twitter/device-follow.js": "9034f37c6f71fb7c56a1f6f505e3aeeb02b4fb833c55e4380381ba8f5d113889",
@@ -1277,7 +1277,7 @@
"clis/twitter/following.js": "8837ea224c0e3619594c6109396d6831bc52451c150232ebba12b7989dfc8aa6",
"clis/twitter/hide-reply.js": "c4fa23b98b57ea345c702dd6075ae1dc09961dffaf13e58f4cf88ed312db02b2",
"clis/twitter/like.js": "8d512e0a083baeec4f6760f6d821e5eb9c597b089604a9eec49acce39bd9ae88",
- "clis/twitter/likes.js": "90e454ad1b36dd520f8eb1f1e44678fe8abd8c568e1a30ca1639bcd2597f8264",
+ "clis/twitter/likes.js": "b0800f9d2fbafdd08040ecd674eb8906f3b7641c6a677d32e5d8d88e73a5eb67",
"clis/twitter/list-add-batch.js": "4d10676a75817b2e6155df68b19bac79b3301ac444073a8cb8bd3ecf5bcef446",
"clis/twitter/list-add-core.js": "095baf186a1abc5dd81cd547423f982f7e0a86cb121d0185f851b43b248df1f4",
"clis/twitter/list-add.js": "ea8eb41bd2e369fcf5630fd51e61b825d4de5a92a568427e945d5465fb10d2bb",
@@ -1291,7 +1291,7 @@
"clis/twitter/lists.js": "a8553e7e2acedde80e7f9e8a03e7762fe03e9ba751585feb1cf9892ca137a9ae",
"clis/twitter/mute-word.js": "b1c411c56819dc40566e1fedd3b3809006b06e610dfe1e4216159bbc4343bed7",
"clis/twitter/notifications.js": "ffdc5b84bc00178ef81df61b02646468bba1fbb2031fe984a8126019c446e998",
- "clis/twitter/post.js": "de3511abb1d177de264d25ff4269894b070c85bf1a10559dc6b9c0665bf17098",
+ "clis/twitter/post.js": "31eac965ccd9d201da0638e90eceae00b1961c6f915f136f1464eda62587de57",
"clis/twitter/profile.js": "a92e986946b35c58c8b7bc0b43ab991709eaf668034abc7f98a040d4712f6f49",
"clis/twitter/quote.js": "0d4a034d0a6413b9097df752ca1b4edee1cbc66f4030811ba4a72e5a1da2bdf7",
"clis/twitter/reply-dm.js": "05b84cbb7c32c5ef0abd6011e14ae87f4e555befce37e646a45d101d1fa75302",
@@ -1309,7 +1309,7 @@
"clis/twitter/unlike.js": "183aaf8d883fe57d504e28f41ad46aaaa6e639d7d7c562b87a06f3852fc525c9",
"clis/twitter/unretweet.js": "207a14240eb519b1be6c5e35ded2a9c3002f3cc42d8ad96d9315df88f706bdaf",
"clis/twitter/user-timeline.js": "d80d311ca4090a7c63a7ff8c6b33d612f51d7132a6f289665957bcebda321b00",
- "clis/twitter/utils.js": "f76c2eac8fa259e946262b04103a7f185112ce62cafa7afaae8d840f6d0c95a3",
+ "clis/twitter/utils.js": "18ea1463b29a6dd52d031519b53f6eac25d15782c5e97576ee148e1517e2730a",
"clis/uisdc/news.js": "7450fa65ec39331fbb4e0e911bf6ebb4bf4cd9e43e5f72b59fbba740b723ae32",
"clis/uiverse/_shared.js": "6318c65c3e3630e843278fc77b87e8da00a387909c78bbee69bfe56803fc0638",
"clis/uiverse/code.js": "3efffa78519d4c545b4c8fb2bb9c7ff607322b6a9dad8443cc7a3af4df217cd3",
@@ -1343,12 +1343,12 @@
"clis/weibo/hot.js": "7620f20c15956b9823f5a31968c3e07d47a0cadd62ce29815f943375b53cc1cb",
"clis/weibo/me.js": "99461e63852a18c2a4440c61e85aad6e5f97d9886797fa5ef817da6d8c1d1ba3",
"clis/weibo/post.js": "a47e4144934005a8c15b598e6ba4adbee4cfd9118d2571b75222ea1ed6346c57",
- "clis/weibo/publish.js": "f2a6659d764188b529193b8a294fd9e6ca65f70b3f646b25176382b95cafc377",
+ "clis/weibo/publish.js": "8f0cf2a901358a600b0a6a70d5a6160bedc95a8f8dfaecce4264442c9fa64f3e",
"clis/weibo/search.js": "0156bc86cda823b780e57416b94bba446130777c1c3c921845da5389c5f09f38",
"clis/weibo/user-posts.js": "6e406fd15cf0bcfcd188179445549e793e9ae102209da3bde8d4fe7912bd98e1",
"clis/weibo/user.js": "1707d64c298265817a270b09996ccfbe24f55b001dabafff4fbdd58366b207d2",
"clis/weibo/utils.js": "3b8e7077369b89042924bdeb981af2e133f5b308ca4d26ca80b29f41fbcad69d",
- "clis/weixin/create-draft.js": "83e397355499658c520cde251179005c65575f2de707aafd630ba4e17723451b",
+ "clis/weixin/create-draft.js": "71aefeda18ee39c827703af5a152f4a7a4639f79398179686162deb76d0b7622",
"clis/weixin/download.js": "52234ac2b72888f7e8f836cd4756759c50e5e45c3200c1f1e5a7e451284f4ae5",
"clis/weixin/drafts.js": "23c1ed53b94f3dabd6f416751176c24fec9f018bc86e8f2957a3e392709c7e27",
"clis/weixin/search.js": "2b75a2a7b78af38c86c229a57ec86b420b9eb209a5bab564f0ef65587eca7ea9",
@@ -1390,7 +1390,7 @@
"clis/xianyu/inbox.js": "43e5d6f9109898277333b3acd0fca5d2c9591ed0342f59784871adb7d68a8088",
"clis/xianyu/item.js": "bff303f425ca3591133c46cc76086705dde675e0dbb6e41f50db13f04192bda8",
"clis/xianyu/messages.js": "d1612d6099d388ce260e9f0920a970929511e54c31d0f707e10c674f48a57c27",
- "clis/xianyu/publish.js": "c61ef91e781082e25b9982f22454be4101ce970da35bbf00900034f7ae26d4ac",
+ "clis/xianyu/publish.js": "5d05ec912fede0e56171b209d3c63de61c38ba67ef29d994aa61c05500d8d3f8",
"clis/xianyu/reply.js": "b5a59b16805e66eed19d2ad6a6aaaaa2ace5ed1ee6b78ffef06da9411607d603",
"clis/xianyu/search.js": "0946ee3b745c4afbf45c779e6029cd5d147d8f937b149535bf28224c91584bb4",
"clis/xianyu/utils.js": "9c96e43065c941becbb7f626507be4b29ef807ff418e9a6e6429fd1c04c0800b",
@@ -1426,7 +1426,7 @@
"clis/xiaohongshu/note.js": "09c08e2b8c69ee3a16daafc6fdcebf63fb016b99640adb8a157b80b3287f0833",
"clis/xiaohongshu/notifications.js": "1262c0172fabc45aa21ae65643d19e242856062e73caf0377a95cf94914000a3",
"clis/xiaohongshu/pinia-helpers.js": "c2b7639c4ddc2cd078a01eb62c66c0c37548b7b3fd5aac3c631ac53a36c68686",
- "clis/xiaohongshu/publish.js": "ca1592a4de93dab3b4908f5e841a2f8b4b9528e1be3460434f413f3ce33cc599",
+ "clis/xiaohongshu/publish.js": "04818c92743c675a0e82f038c32b5129da75028fc1fad13c26097b8194246977",
"clis/xiaohongshu/risk-control.js": "6e7c15a8a27de78a45fbe01d206bbbd43fab23bd9aa4cf39c900bf6c838c7242",
"clis/xiaohongshu/saved.js": "c69f484e82b016a07ac699d3622236b8e0d2440826ff497f1ddbabb97137a2c7",
"clis/xiaohongshu/search.js": "333f5db3d62dfb3227bb59f47b5ce8e509901d6438b42e3038ec61624ea0d329",
@@ -1468,9 +1468,9 @@
"clis/yollomi/remove-bg.js": "dcbdb9d48603bdcc528884d87169d67c31e7e3dd0d12bd2ca1a70f997bfc2fc0",
"clis/yollomi/restore.js": "6bd1988650f884bdfcefbbc5add8eb9260534e2bb6d7ff7624171be6383f313b",
"clis/yollomi/try-on.js": "64b0cb281ff66f7f09bc15bc590ccb23245078f69b41027dfd458918947f1bfd",
- "clis/yollomi/upload.js": "65e3f95ecb0e9569c5d15fc202b8cf899f20bab0d68da9f049967b846b95c6b8",
+ "clis/yollomi/upload.js": "03ef841a7c9e9a898f69539d3a57093289edb1155372cae5b72e25dbb2a2bb1d",
"clis/yollomi/upscale.js": "c8af76d01004a75ba7cf5c2120777936d052ba0d1b4b96b558de0af5ba4f6f2e",
- "clis/yollomi/utils.js": "a3a0900856e2083edb300e2a1b942739b61badd138b1b49db7ce081cf0f21079",
+ "clis/yollomi/utils.js": "101c830cac8d3de2c4a2348032c7e11d04b11ff2d63a255eb119db6c4324d283",
"clis/yollomi/video.js": "d9080992f8ecf4dc41627190014f760ccc255cad5b6f97e9d18c263892f50721",
"clis/youdao/note.js": "dd511f473dd50d84b4baade69da710f19f02d2f84d69719f016b022d8efb826d",
"clis/youtube/auth.js": "976f10a7fa03f2d46c5f0b27c113ee6e18faf1bbdaca8592528bae041e252039",
@@ -1599,8 +1599,8 @@
"src/discovery.ts": "797e8d6153ecd0b9df50d45a5bbbd997f0f74c33120c7a040ae457b241cfc98a",
"src/doctor.ts": "a05ee2f2c1413ffe98cffc66a8b35ed9879a6a55d70884c74ecc5986a53525ce",
"src/download/article-download.ts": "45b48e3072990fac88e0aa5d60490d27a3b8504f577b42dd3ceda68c5408a509",
- "src/download/index.ts": "0a3f6f1a8d934b848588a5ed73116282cf67f81e33abdb51c0d37e759f8a6572",
- "src/download/media-download.ts": "3391cf1af9d3b39e0fa3c8768b90128a773b3f4eae9625b610cba886fb8d3fb1",
+ "src/download/index.ts": "6e3d8045b8f37098828724f04a33d5a7de960131b5fdb115240738548af37224",
+ "src/download/media-download.ts": "21c36a221d042c08a637259075275f3b62a7d027f40bf5720d15343b1f702e9b",
"src/download/progress.ts": "98f9ff046388d58f9347ed31fd26a9dc86d29e53d5ec9040ec47e34cae09608f",
"src/errors.ts": "21b26a6bdd9e1e5f44b09212709bdcfc8db5b8c6e8a84e02a3ada733a835afaf",
"src/execution.ts": "20bef8ef3984d326e7e2b207d18525ba70ed41113add904f73d2e6826d1feaaa",
@@ -1626,7 +1626,7 @@
"src/pipeline/index.ts": "c883e03a6f2460f49e61e3530c632ede2ab2afa1b6e9393353b21bdbf7ebeb0a",
"src/pipeline/registry.ts": "dc9d24bc5ccaecfbe919e6475b25f432ff1d8150d27abbbf255141aebfa49dbd",
"src/pipeline/steps/browser.ts": "b60aba9d9c7e5188b6420ed4e099ecfdbe23096a252a55664b7928734eb14944",
- "src/pipeline/steps/download.ts": "4f6642cc5c67366dc8fe0bf0e6ea9e70c85a0f474a2f22f30f936498463701bb",
+ "src/pipeline/steps/download.ts": "620cd905d6604a73a9a8585b69b787d1aafcf4f9db9fbf3b0a8e4c6dd59f0357",
"src/pipeline/steps/fetch.ts": "a9bdfe540cb8e61c2ed19aa13d393e286d07be6157406c8945d3135bba41dd5d",
"src/pipeline/steps/intercept.ts": "c45a26c974489f621fd932b513ea742efea1a7bb3746d4c10d8a110613068aa7",
"src/pipeline/steps/tap.ts": "7e4a5f80656931feb358b3d9a655f32c257ab2aaf749b532f5751e6fba48b964",
diff --git a/packages/opencli-vendor/cindy/catalog.ts b/packages/opencli-vendor/cindy/catalog.ts
index 4f3cd45ae6..e5e2d3c3a7 100644
--- a/packages/opencli-vendor/cindy/catalog.ts
+++ b/packages/opencli-vendor/cindy/catalog.ts
@@ -18,7 +18,16 @@ export interface CatalogEntry {
// Do not propagate the 1,223-entry JSON's inferred union through host types.
export const upstreamCatalog = manifestJson as CatalogEntry[];
export const excludedSites: Readonly<Record<string, string>> = selection.excludedSites;
-export const canonicalCatalog = upstreamCatalog.filter(entry => !(entry.site in excludedSites));
+export const excludedCommands = new Set<string>(selection.excludedCommands);
+// Local exports are outside the selected capability. Generation keeps its
+// existing link-only branch; generic reading returns content in the tool result.
+export const canonicalCatalog = upstreamCatalog.filter(entry => !(entry.site in excludedSites)
+ && !excludedCommands.has(`${entry.site}/${entry.name}`)).map(entry => ({
+ ...entry,
+ args: entry.args.map(arg => ['sd', 'skip-download', 'no-download'].includes(arg.name)
+ || (entry.site === 'web' && entry.name === 'read' && arg.name === 'stdout')
+ ? { ...arg, default: true } : arg),
+ }));
/** Keep upstream aliases executable as well as canonical command names. */
const catalog: CatalogEntry[] = canonicalCatalog.flatMap(entry => [
diff --git a/packages/opencli-vendor/cindy/host.ts b/packages/opencli-vendor/cindy/host.ts
index 1d8e25feb2..29e99cd0b0 100644
--- a/packages/opencli-vendor/cindy/host.ts
+++ b/packages/opencli-vendor/cindy/host.ts
@@ -42,6 +42,8 @@ export interface RecipeFiles {
open(file: string): number;
directory?: string;
temporaryRoot?: string;
+ /** Optional trusted-host capability. Desktop deliberately does not grant
+ * path-based task writes; only invocation-owned temporary output is enabled. */
output?(file: string): string;
}
@@ -83,7 +85,7 @@ export function recipeOutputPath(file: string | number): string | number {
}
if (typeof file !== 'string') throw new Error('Recipe output must be a local path');
if (isTemporaryFile(host, file)) return file;
- if (!host.files?.output) throw new Error('This recipe requires the host output file broker');
+ if (!host.files?.output) throw new Error('Local recipe file export is unavailable; use the browser result or existing file tools');
return host.files.output(file);
}
@@ -104,9 +106,7 @@ export function closeRecipeFileSync(descriptor: number): void {
export function recipeCopySource(file: string): string {
const host = activeHost();
if (isTemporaryFile(host, file)) return file;
- const resolved = resolveRecipePath(file);
- readRecipeFileSync(resolved);
- return resolved;
+ return stageRecipeUploadFiles([resolveRecipePath(file)])[0];
}
export function withRecipeHost<T>(
@@ -148,12 +148,17 @@ export function openRecipeFileSync(file: string): number {
}
/** Inspection uses the same approved file descriptor boundary as reading. */
-export function statRecipeFileSync(file: string): ReturnType<typeof fstatSync> {
+export function statRecipeFileSync(file: string): import('node:fs').Stats {
const descriptor = openRecipeFileSync(file);
try { return fstatSync(descriptor); }
finally { closeRecipeFileSync(descriptor); }
}
+export function recipeFileExistsSync(file: string): boolean {
+ try { statRecipeFileSync(file); return true; }
+ catch { return false; }
+}
+
/** Secrets only come from the host encrypted store. The legacy path argument
* is accepted for pinned adapter compatibility, but is never read or migrated. */
export function readSecretJSON(key: string, _legacyPath?: string): unknown {
diff --git a/packages/opencli-vendor/cindy/index.ts b/packages/opencli-vendor/cindy/index.ts
index d549f81949..56728d28c9 100644
--- a/packages/opencli-vendor/cindy/index.ts
+++ b/packages/opencli-vendor/cindy/index.ts
@@ -100,7 +100,14 @@ export async function executeAdapter(
): Promise<unknown> {
return withRecipeHost(secrets, async () => {
const command = await loadAdapter(id);
- const args = prepareInputs(command.args, inputs);
+ // Discovery and execution use the same selected argument defaults.
+ const args = prepareInputs(entries.get(id)!.args, inputs);
+ if (!files?.output) {
+ const skip = entries.get(id)!.args.find(arg => ['sd', 'skip-download', 'no-download'].includes(arg.name));
+ if ((skip && args[skip.name] !== true) || (id === 'web/read' && args.stdout !== true)) {
+ throw new Error('Local recipe file export is unavailable; keep the link-only or content-only mode');
+ }
+ }
command.validateArgs?.(args);
onExecutionStart?.();
if (
diff --git a/packages/opencli-vendor/cindy/modules.js b/packages/opencli-vendor/cindy/modules.js
index 167a1fdc73..71d0590cb4 100644
--- a/packages/opencli-vendor/cindy/modules.js
+++ b/packages/opencli-vendor/cindy/modules.js
@@ -9,7 +9,6 @@ import "../clis/12306/train.js";
import "../clis/12306/trains.js";
import "../clis/1688/assets.js";
import "../clis/1688/auth.js";
-import "../clis/1688/download.js";
import "../clis/1688/item.js";
import "../clis/1688/search.js";
import "../clis/1688/store.js";
@@ -69,7 +68,6 @@ import "../clis/bilibili/auth.js";
import "../clis/bilibili/comment.js";
import "../clis/bilibili/comments.js";
import "../clis/bilibili/creator-stats.js";
-import "../clis/bilibili/download.js";
import "../clis/bilibili/dynamic.js";
import "../clis/bilibili/favorite.js";
import "../clis/bilibili/feed.js";
@@ -224,7 +222,6 @@ import "../clis/dongchedi/series.js";
import "../clis/dongchedi/specs.js";
import "../clis/douban/auth.js";
import "../clis/douban/book-hot.js";
-import "../clis/douban/download.js";
import "../clis/douban/marks.js";
import "../clis/douban/movie-hot.js";
import "../clis/douban/photos.js";
@@ -353,7 +350,6 @@ import "../clis/grok/detail.js";
import "../clis/grok/export-all.js";
import "../clis/grok/export.js";
import "../clis/grok/history.js";
-import "../clis/grok/image.js";
import "../clis/grok/new.js";
import "../clis/grok/pin.js";
import "../clis/grok/read.js";
@@ -413,7 +409,6 @@ import "../clis/instagram/auth.js";
import "../clis/instagram/collection-create.js";
import "../clis/instagram/collection-delete.js";
import "../clis/instagram/comment.js";
-import "../clis/instagram/download.js";
import "../clis/instagram/explore.js";
import "../clis/instagram/follow.js";
import "../clis/instagram/followers.js";
@@ -549,7 +544,6 @@ import "../clis/mercury/reimbursement-draft.js";
import "../clis/mercury/reimbursement-plan.js";
import "../clis/midjourney/action.js";
import "../clis/midjourney/describe.js";
-import "../clis/midjourney/download.js";
import "../clis/midjourney/generate.js";
import "../clis/midjourney/history.js";
import "../clis/midjourney/login.js";
@@ -627,7 +621,6 @@ import "../clis/pinterest/board-section-create.js";
import "../clis/pinterest/board-section-delete.js";
import "../clis/pinterest/board-sections.js";
import "../clis/pinterest/board-update.js";
-import "../clis/pinterest/download.js";
import "../clis/pinterest/pin-create.js";
import "../clis/pinterest/pin-delete.js";
import "../clis/pinterest/pin-update.js";
@@ -640,13 +633,10 @@ import "../clis/pinterest/user-boards.js";
import "../clis/pinterest/user-pins.js";
import "../clis/pinterest/user.js";
import "../clis/pixiv/auth.js";
-import "../clis/pixiv/bookmark-download.js";
import "../clis/pixiv/bookmarks.js";
import "../clis/pixiv/detail.js";
-import "../clis/pixiv/download.js";
import "../clis/pixiv/illusts.js";
import "../clis/pixiv/me.js";
-import "../clis/pixiv/novel-download.js";
import "../clis/pixiv/novel.js";
import "../clis/pixiv/novels.js";
import "../clis/pixiv/ranking.js";
@@ -704,7 +694,6 @@ import "../clis/reddit/user.js";
import "../clis/reddit/whoami.js";
import "../clis/rednote/auth.js";
import "../clis/rednote/comments.js";
-import "../clis/rednote/download.js";
import "../clis/rednote/feed.js";
import "../clis/rednote/note.js";
import "../clis/rednote/notifications.js";
@@ -746,7 +735,6 @@ import "../clis/substack/feed.js";
import "../clis/substack/publication.js";
import "../clis/substack/search.js";
import "../clis/suno/auth.js";
-import "../clis/suno/download.js";
import "../clis/suno/generate.js";
import "../clis/suno/list.js";
import "../clis/suno/status.js";
@@ -808,7 +796,6 @@ import "../clis/twitter/bookmarks.js";
import "../clis/twitter/collection.js";
import "../clis/twitter/delete.js";
import "../clis/twitter/device-follow.js";
-import "../clis/twitter/download.js";
import "../clis/twitter/follow-batch.js";
import "../clis/twitter/follow.js";
import "../clis/twitter/followers.js";
@@ -844,7 +831,6 @@ import "../clis/twitter/unlike.js";
import "../clis/twitter/unretweet.js";
import "../clis/uisdc/news.js";
import "../clis/uiverse/code.js";
-import "../clis/uiverse/preview.js";
import "../clis/upwork/auth.js";
import "../clis/upwork/detail.js";
import "../clis/upwork/feed.js";
@@ -878,7 +864,6 @@ import "../clis/weibo/search.js";
import "../clis/weibo/user-posts.js";
import "../clis/weibo/user.js";
import "../clis/weixin/create-draft.js";
-import "../clis/weixin/download.js";
import "../clis/weixin/drafts.js";
import "../clis/weixin/search.js";
import "../clis/weread-official/book.js";
@@ -932,7 +917,6 @@ import "../clis/xiaohongshu/creator-notes-summary.js";
import "../clis/xiaohongshu/creator-profile.js";
import "../clis/xiaohongshu/creator-stats.js";
import "../clis/xiaohongshu/delete-note.js";
-import "../clis/xiaohongshu/download.js";
import "../clis/xiaohongshu/draft-clear.js";
import "../clis/xiaohongshu/draft-delete.js";
import "../clis/xiaohongshu/draft-open.js";
@@ -1006,7 +990,6 @@ import "../clis/zhihu/auth.js";
import "../clis/zhihu/collection.js";
import "../clis/zhihu/collections.js";
import "../clis/zhihu/comment.js";
-import "../clis/zhihu/download.js";
import "../clis/zhihu/favorite.js";
import "../clis/zhihu/follow.js";
import "../clis/zhihu/followers.js";
@@ -1037,7 +1020,6 @@ export const modules = {
"12306/trains.js": true,
"1688/assets.js": true,
"1688/auth.js": true,
- "1688/download.js": true,
"1688/item.js": true,
"1688/search.js": true,
"1688/store.js": true,
@@ -1097,7 +1079,6 @@ export const modules = {
"bilibili/comment.js": true,
"bilibili/comments.js": true,
"bilibili/creator-stats.js": true,
- "bilibili/download.js": true,
"bilibili/dynamic.js": true,
"bilibili/favorite.js": true,
"bilibili/feed.js": true,
@@ -1252,7 +1233,6 @@ export const modules = {
"dongchedi/specs.js": true,
"douban/auth.js": true,
"douban/book-hot.js": true,
- "douban/download.js": true,
"douban/marks.js": true,
"douban/movie-hot.js": true,
"douban/photos.js": true,
@@ -1381,7 +1361,6 @@ export const modules = {
"grok/export-all.js": true,
"grok/export.js": true,
"grok/history.js": true,
- "grok/image.js": true,
"grok/new.js": true,
"grok/pin.js": true,
"grok/read.js": true,
@@ -1441,7 +1420,6 @@ export const modules = {
"instagram/collection-create.js": true,
"instagram/collection-delete.js": true,
"instagram/comment.js": true,
- "instagram/download.js": true,
"instagram/explore.js": true,
"instagram/follow.js": true,
"instagram/followers.js": true,
@@ -1577,7 +1555,6 @@ export const modules = {
"mercury/reimbursement-plan.js": true,
"midjourney/action.js": true,
"midjourney/describe.js": true,
- "midjourney/download.js": true,
"midjourney/generate.js": true,
"midjourney/history.js": true,
"midjourney/login.js": true,
@@ -1655,7 +1632,6 @@ export const modules = {
"pinterest/board-section-delete.js": true,
"pinterest/board-sections.js": true,
"pinterest/board-update.js": true,
- "pinterest/download.js": true,
"pinterest/pin-create.js": true,
"pinterest/pin-delete.js": true,
"pinterest/pin-update.js": true,
@@ -1668,13 +1644,10 @@ export const modules = {
"pinterest/user-pins.js": true,
"pinterest/user.js": true,
"pixiv/auth.js": true,
- "pixiv/bookmark-download.js": true,
"pixiv/bookmarks.js": true,
"pixiv/detail.js": true,
- "pixiv/download.js": true,
"pixiv/illusts.js": true,
"pixiv/me.js": true,
- "pixiv/novel-download.js": true,
"pixiv/novel.js": true,
"pixiv/novels.js": true,
"pixiv/ranking.js": true,
@@ -1732,7 +1705,6 @@ export const modules = {
"reddit/whoami.js": true,
"rednote/auth.js": true,
"rednote/comments.js": true,
- "rednote/download.js": true,
"rednote/feed.js": true,
"rednote/note.js": true,
"rednote/notifications.js": true,
@@ -1774,7 +1746,6 @@ export const modules = {
"substack/publication.js": true,
"substack/search.js": true,
"suno/auth.js": true,
- "suno/download.js": true,
"suno/generate.js": true,
"suno/list.js": true,
"suno/status.js": true,
@@ -1836,7 +1807,6 @@ export const modules = {
"twitter/collection.js": true,
"twitter/delete.js": true,
"twitter/device-follow.js": true,
- "twitter/download.js": true,
"twitter/follow-batch.js": true,
"twitter/follow.js": true,
"twitter/followers.js": true,
@@ -1872,7 +1842,6 @@ export const modules = {
"twitter/unretweet.js": true,
"uisdc/news.js": true,
"uiverse/code.js": true,
- "uiverse/preview.js": true,
"upwork/auth.js": true,
"upwork/detail.js": true,
"upwork/feed.js": true,
@@ -1906,7 +1875,6 @@ export const modules = {
"weibo/user-posts.js": true,
"weibo/user.js": true,
"weixin/create-draft.js": true,
- "weixin/download.js": true,
"weixin/drafts.js": true,
"weixin/search.js": true,
"weread-official/book.js": true,
@@ -1960,7 +1928,6 @@ export const modules = {
"xiaohongshu/creator-profile.js": true,
"xiaohongshu/creator-stats.js": true,
"xiaohongshu/delete-note.js": true,
- "xiaohongshu/download.js": true,
"xiaohongshu/draft-clear.js": true,
"xiaohongshu/draft-delete.js": true,
"xiaohongshu/draft-open.js": true,
@@ -2034,7 +2001,6 @@ export const modules = {
"zhihu/collection.js": true,
"zhihu/collections.js": true,
"zhihu/comment.js": true,
- "zhihu/download.js": true,
"zhihu/favorite.js": true,
"zhihu/follow.js": true,
"zhihu/followers.js": true,
diff --git a/packages/opencli-vendor/cindy/patches.json b/packages/opencli-vendor/cindy/patches.json
index 1ea3c26328..f998b8c202 100644
--- a/packages/opencli-vendor/cindy/patches.json
+++ b/packages/opencli-vendor/cindy/patches.json
@@ -3251,5 +3251,415 @@
"file": "clis/instagram/_shared/private-publish.js",
"before": " const trimmedPath = trimVideoForInstagramStory(filePath, INSTAGRAM_MAX_STORY_VIDEO_DURATION_MS);",
"after": " const trimmedPath = trimVideoForInstagramStory(asset.stagedPath, INSTAGRAM_MAX_STORY_VIDEO_DURATION_MS);"
+ },
+ {
+ "file": "clis/pixiv/bookmark-download.js",
+ "before": "fs.existsSync(recipeOutputPath(resolveRecipePath(cursor)))",
+ "after": "recipeFileExistsSync(resolveRecipePath(cursor))",
+ "count": 1
+ },
+ {
+ "file": "clis/pixiv/bookmark-download.js",
+ "before": "fs.lstatSync(recipeOutputPath(resolveRecipePath(destination)))",
+ "after": "statRecipeFileSync(resolveRecipePath(destination))",
+ "count": 1
+ },
+ {
+ "file": "clis/pixiv/bookmark-download.js",
+ "before": "import { recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { recipeFileExistsSync, statRecipeFileSync, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "clis/pixiv/novel-download-utils.js",
+ "before": "fs.lstatSync(recipeOutputPath(resolveRecipePath(ancestor)))",
+ "after": "statRecipeFileSync(resolveRecipePath(ancestor))",
+ "count": 1
+ },
+ {
+ "file": "clis/pixiv/novel-download-utils.js",
+ "before": "fs.statSync(recipeOutputPath(resolveRecipePath(canonicalAncestor)))",
+ "after": "statRecipeFileSync(resolveRecipePath(canonicalAncestor))",
+ "count": 1
+ },
+ {
+ "file": "clis/pixiv/novel-download-utils.js",
+ "before": "fs.lstatSync(recipeOutputPath(resolveRecipePath(target)))",
+ "after": "statRecipeFileSync(resolveRecipePath(target))",
+ "count": 1
+ },
+ {
+ "file": "clis/pixiv/novel-download-utils.js",
+ "before": "fs.existsSync(recipeOutputPath(resolveRecipePath(cursor)))",
+ "after": "recipeFileExistsSync(resolveRecipePath(cursor))",
+ "count": 1
+ },
+ {
+ "file": "clis/pixiv/novel-download-utils.js",
+ "before": "import { closeRecipeFileSync, openRecipeOutputFileSync, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { statRecipeFileSync, recipeFileExistsSync, closeRecipeFileSync, openRecipeOutputFileSync, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "clis/twitter/post.js",
+ "before": "fs.statSync(recipeOutputPath(resolveRecipePath(absPath)), { throwIfNoEntry: false })",
+ "after": "statRecipeFileSync(resolveRecipePath(absPath))",
+ "count": 1
+ },
+ {
+ "file": "clis/twitter/post.js",
+ "before": "import { recipeOutputPath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { statRecipeFileSync, recipeOutputPath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "clis/twitter/likes.js",
+ "before": "fs.existsSync(recipeOutputPath(resolveRecipePath(filePath)))",
+ "after": "recipeFileExistsSync(resolveRecipePath(filePath))",
+ "count": 1
+ },
+ {
+ "file": "clis/twitter/likes.js",
+ "before": "fs.existsSync(recipeOutputPath(resolveRecipePath(outputFile)))",
+ "after": "recipeFileExistsSync(resolveRecipePath(outputFile))",
+ "count": 2
+ },
+ {
+ "file": "clis/twitter/likes.js",
+ "before": "import { recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { recipeFileExistsSync, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "clis/twitter/bookmarks.js",
+ "before": "fs.existsSync(recipeOutputPath(resolveRecipePath(filePath)))",
+ "after": "recipeFileExistsSync(resolveRecipePath(filePath))",
+ "count": 1
+ },
+ {
+ "file": "clis/twitter/bookmarks.js",
+ "before": "fs.existsSync(recipeOutputPath(resolveRecipePath(outputFile)))",
+ "after": "recipeFileExistsSync(resolveRecipePath(outputFile))",
+ "count": 2
+ },
+ {
+ "file": "clis/twitter/bookmarks.js",
+ "before": "import { recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { recipeFileExistsSync, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "clis/twitter/utils.js",
+ "before": "fs.existsSync(recipeOutputPath(resolveRecipePath(absPath)))",
+ "after": "recipeFileExistsSync(resolveRecipePath(absPath))",
+ "count": 1
+ },
+ {
+ "file": "clis/twitter/utils.js",
+ "before": "fs.statSync(recipeOutputPath(resolveRecipePath(absPath)))",
+ "after": "statRecipeFileSync(resolveRecipePath(absPath))",
+ "count": 1
+ },
+ {
+ "file": "clis/twitter/utils.js",
+ "before": "import { recipeOutputPath, recipeTemporaryDirectory, resolveRecipePath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { recipeFileExistsSync, statRecipeFileSync, recipeOutputPath, recipeTemporaryDirectory, resolveRecipePath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "clis/twitter/archive.js",
+ "before": "fs.existsSync(recipeOutputPath(resolveRecipePath(filePath)))",
+ "after": "recipeFileExistsSync(resolveRecipePath(filePath))",
+ "count": 1
+ },
+ {
+ "file": "clis/twitter/archive.js",
+ "before": "import { recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { recipeFileExistsSync, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "clis/yollomi/upload.js",
+ "before": "fs.existsSync(recipeOutputPath(resolveRecipePath(filePath)))",
+ "after": "recipeFileExistsSync(resolveRecipePath(filePath))",
+ "count": 1
+ },
+ {
+ "file": "clis/yollomi/upload.js",
+ "before": "import { recipeOutputPath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { recipeFileExistsSync, recipeOutputPath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "clis/yollomi/utils.js",
+ "before": "fs.existsSync(recipeOutputPath(resolveRecipePath(resolved)))",
+ "after": "recipeFileExistsSync(resolveRecipePath(resolved))",
+ "count": 1
+ },
+ {
+ "file": "clis/yollomi/utils.js",
+ "before": "import { recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { recipeFileExistsSync, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "clis/minimax/utils.js",
+ "before": "fs.statSync(recipeOutputPath(resolveRecipePath(dir)))",
+ "after": "statRecipeFileSync(resolveRecipePath(dir))",
+ "count": 1
+ },
+ {
+ "file": "clis/minimax/utils.js",
+ "before": "fs.existsSync(recipeOutputPath(resolveRecipePath(target)))",
+ "after": "recipeFileExistsSync(resolveRecipePath(target))",
+ "count": 2
+ },
+ {
+ "file": "clis/minimax/utils.js",
+ "before": "import { recipeCopySource, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { statRecipeFileSync, recipeFileExistsSync, recipeCopySource, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "clis/midjourney/utils.js",
+ "before": "fs.stat(recipeOutputPath(resolveRecipePath(filePath)))",
+ "after": "Promise.resolve().then(() => statRecipeFileSync(resolveRecipePath(filePath)))",
+ "count": 1
+ },
+ {
+ "file": "clis/midjourney/utils.js",
+ "before": "fs.stat(recipeOutputPath(resolveRecipePath(sourcePath)))",
+ "after": "Promise.resolve().then(() => statRecipeFileSync(resolveRecipePath(sourcePath)))",
+ "count": 1
+ },
+ {
+ "file": "clis/paperreview/utils.js",
+ "before": "fs.stat(recipeOutputPath(resolveRecipePath(resolvedPath)))",
+ "after": "Promise.resolve().then(() => statRecipeFileSync(resolveRecipePath(resolvedPath)))",
+ "count": 1
+ },
+ {
+ "file": "clis/paperreview/utils.js",
+ "before": "import { recipeOutputPath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { statRecipeFileSync, recipeOutputPath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "clis/notebooklm/add-source.js",
+ "before": "fs.statSync(recipeOutputPath(resolveRecipePath(abs)))",
+ "after": "statRecipeFileSync(resolveRecipePath(abs))",
+ "count": 1
+ },
+ {
+ "file": "clis/notebooklm/add-source.js",
+ "before": "import { recipeOutputPath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { statRecipeFileSync, recipeOutputPath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "clis/weixin/create-draft.js",
+ "before": "fs.statSync(recipeOutputPath(resolveRecipePath(absPath)))",
+ "after": "statRecipeFileSync(resolveRecipePath(absPath))",
+ "count": 1
+ },
+ {
+ "file": "clis/weixin/create-draft.js",
+ "before": "import { recipeOutputPath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { statRecipeFileSync, recipeOutputPath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "clis/weibo/publish.js",
+ "before": "fs.statSync(recipeOutputPath(resolveRecipePath(absPath)), { throwIfNoEntry: false })",
+ "after": "statRecipeFileSync(resolveRecipePath(absPath))",
+ "count": 1
+ },
+ {
+ "file": "clis/weibo/publish.js",
+ "before": "import { recipeOutputPath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { statRecipeFileSync, recipeOutputPath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "clis/xiaohongshu/publish.js",
+ "before": "fs.existsSync(recipeOutputPath(resolveRecipePath(absPath)))",
+ "after": "recipeFileExistsSync(resolveRecipePath(absPath))",
+ "count": 1
+ },
+ {
+ "file": "clis/xiaohongshu/publish.js",
+ "before": "import { recipeOutputPath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { recipeFileExistsSync, recipeOutputPath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "clis/douyin/publish.js",
+ "before": "fs.existsSync(recipeOutputPath(resolveRecipePath(videoPath)))",
+ "after": "recipeFileExistsSync(resolveRecipePath(videoPath))",
+ "count": 1
+ },
+ {
+ "file": "clis/douyin/publish.js",
+ "before": "fs.statSync(recipeOutputPath(resolveRecipePath(videoPath)))",
+ "after": "statRecipeFileSync(resolveRecipePath(videoPath))",
+ "count": 1
+ },
+ {
+ "file": "clis/douyin/publish.js",
+ "before": "fs.existsSync(recipeOutputPath(resolveRecipePath(resolveRecipePath(coverPath))))",
+ "after": "recipeFileExistsSync(resolveRecipePath(resolveRecipePath(coverPath)))",
+ "count": 1
+ },
+ {
+ "file": "clis/douyin/publish.js",
+ "before": "import { recipeOutputPath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { recipeFileExistsSync, statRecipeFileSync, recipeOutputPath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "clis/douyin/draft.js",
+ "before": "fs.existsSync(recipeOutputPath(resolveRecipePath(videoPath)))",
+ "after": "recipeFileExistsSync(resolveRecipePath(videoPath))",
+ "count": 1
+ },
+ {
+ "file": "clis/douyin/draft.js",
+ "before": "fs.existsSync(recipeOutputPath(resolveRecipePath(resolveRecipePath(coverPath))))",
+ "after": "recipeFileExistsSync(resolveRecipePath(resolveRecipePath(coverPath)))",
+ "count": 1
+ },
+ {
+ "file": "clis/douyin/draft.js",
+ "before": "import { recipeOutputPath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { recipeFileExistsSync, recipeOutputPath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "clis/douyin/_shared/imagex-upload.js",
+ "before": "fs.existsSync(recipeOutputPath(resolveRecipePath(imagePath)))",
+ "after": "recipeFileExistsSync(resolveRecipePath(imagePath))",
+ "count": 1
+ },
+ {
+ "file": "clis/douyin/_shared/imagex-upload.js",
+ "before": "import { recipeOutputPath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { recipeFileExistsSync, recipeOutputPath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "clis/chatgpt/image.js",
+ "before": "fs.existsSync(recipeOutputPath(file))",
+ "after": "recipeFileExistsSync(file)",
+ "count": 1
+ },
+ {
+ "file": "clis/chatgpt/image.js",
+ "before": "import { resolveRecipePath, recipeOutputPath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { recipeFileExistsSync, resolveRecipePath, recipeOutputPath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "clis/suno/utils.js",
+ "before": "fs.statSync(recipeOutputPath(resolveRecipePath(filePath)))",
+ "after": "statRecipeFileSync(resolveRecipePath(filePath))",
+ "count": 1
+ },
+ {
+ "file": "clis/suno/utils.js",
+ "before": "import { recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { statRecipeFileSync, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "clis/instagram/reel.js",
+ "before": "fs.existsSync(recipeOutputPath(resolveRecipePath(resolved)))",
+ "after": "recipeFileExistsSync(resolveRecipePath(resolved))",
+ "count": 1
+ },
+ {
+ "file": "clis/instagram/reel.js",
+ "before": "import { recipeCopySource, recipeOutputPath, recipeTemporaryDirectory, resolveRecipePath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { recipeFileExistsSync, recipeCopySource, recipeOutputPath, recipeTemporaryDirectory, resolveRecipePath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "clis/instagram/story.js",
+ "before": "fs.existsSync(recipeOutputPath(resolveRecipePath(resolved)))",
+ "after": "recipeFileExistsSync(resolveRecipePath(resolved))",
+ "count": 1
+ },
+ {
+ "file": "clis/instagram/story.js",
+ "before": "import { recipeOutputPath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { recipeFileExistsSync, recipeOutputPath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "clis/instagram/post.js",
+ "before": "fs.existsSync(recipeOutputPath(resolveRecipePath(resolved)))",
+ "after": "recipeFileExistsSync(resolveRecipePath(resolved))",
+ "count": 1
+ },
+ {
+ "file": "clis/instagram/post.js",
+ "before": "import { recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { recipeFileExistsSync, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "clis/instagram/_shared/private-publish.js",
+ "before": "fs.existsSync(recipeOutputPath(resolveRecipePath(outputPath)))",
+ "after": "recipeFileExistsSync(resolveRecipePath(outputPath))",
+ "count": 2
+ },
+ {
+ "file": "clis/instagram/_shared/private-publish.js",
+ "before": "import { recipeOutputPath, recipeTemporaryDirectory, resolveRecipePath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { recipeFileExistsSync, recipeOutputPath, recipeTemporaryDirectory, resolveRecipePath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "clis/xianyu/publish.js",
+ "before": "fs.statSync(recipeOutputPath(resolveRecipePath(absPath)), { throwIfNoEntry: false })",
+ "after": "statRecipeFileSync(resolveRecipePath(absPath))",
+ "count": 1
+ },
+ {
+ "file": "clis/xianyu/publish.js",
+ "before": "import { recipeOutputPath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { statRecipeFileSync, recipeOutputPath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "src/pipeline/steps/download.ts",
+ "before": "fs.existsSync(recipeOutputPath(destPath))",
+ "after": "recipeFileExistsSync(destPath)",
+ "count": 1
+ },
+ {
+ "file": "src/pipeline/steps/download.ts",
+ "before": "fs.statSync(recipeOutputPath(destPath))",
+ "after": "statRecipeFileSync(destPath)",
+ "count": 1
+ },
+ {
+ "file": "src/pipeline/steps/download.ts",
+ "before": "fs.existsSync(recipeOutputPath(cookiesFile))",
+ "after": "recipeFileExistsSync(cookiesFile)",
+ "count": 1
+ },
+ {
+ "file": "src/pipeline/steps/download.ts",
+ "before": "import { recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { recipeFileExistsSync, statRecipeFileSync, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "src/download/media-download.ts",
+ "before": "fs.existsSync(recipeOutputPath(cookiesFile))",
+ "after": "recipeFileExistsSync(cookiesFile)",
+ "count": 1
+ },
+ {
+ "file": "src/download/media-download.ts",
+ "before": "import { recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { recipeFileExistsSync, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';"
+ },
+ {
+ "file": "src/download/index.ts",
+ "before": "fs.existsSync(recipeOutputPath(destPath))",
+ "after": "recipeFileExistsSync(destPath)",
+ "count": 1
+ },
+ {
+ "file": "src/download/index.ts",
+ "before": "fs.statSync(recipeOutputPath(destPath))",
+ "after": "statRecipeFileSync(destPath)",
+ "count": 1
+ },
+ {
+ "file": "src/download/index.ts",
+ "before": "fs.statSync(recipeOutputPath(actualFile))",
+ "after": "statRecipeFileSync(actualFile)",
+ "count": 1
+ },
+ {
+ "file": "src/download/index.ts",
+ "before": "import { closeRecipeFileSync, openRecipeOutputFileSync, recipeCopySource, recipeOutputPath, recipeTemporaryDirectory, resolveRecipePath } from '@jackwener/opencli/cindy/host';",
+ "after": "import { recipeFileExistsSync, statRecipeFileSync, closeRecipeFileSync, openRecipeOutputFileSync, recipeCopySource, recipeOutputPath, recipeTemporaryDirectory, resolveRecipePath } from '@jackwener/opencli/cindy/host';"
}
]
diff --git a/packages/opencli-vendor/cindy/selection.json b/packages/opencli-vendor/cindy/selection.json
index e432b82f45..a13ae25cf2 100644
--- a/packages/opencli-vendor/cindy/selection.json
+++ b/packages/opencli-vendor/cindy/selection.json
@@ -1,4 +1,12 @@
{
+ "excludedCommands": [
+ "1688/download", "bilibili/download", "douban/download", "grok/image",
+ "instagram/download", "midjourney/download", "pinterest/download",
+ "pixiv/bookmark-download", "pixiv/download", "pixiv/novel-download",
+ "rednote/download", "suno/download", "twitter/download", "uiverse/preview",
+ "weixin/download", "xiaohongshu/download", "zhihu/download"
+ ],
+ "excludedCommandsReason": "Local file exports are deferred: a checked path string is not an atomic write capability. Full sources are retained; use existing host file tools to save browser results.",
"excludedSites": {
"zlibrary": "Not in Cindy's default catalog: copyright enforcement history and unverified mirror ownership (reviewed 2026-10-23).",
"slock": "Deferred: app.slock.ai redirects to app.raft.build; the adapter still assumes the old origin and token storage. Revalidate before inclusion.",
diff --git a/packages/opencli-vendor/clis/chatgpt/image.js b/packages/opencli-vendor/clis/chatgpt/image.js
index 6bcfd8cbac..e7fcfa28e7 100644
--- a/packages/opencli-vendor/clis/chatgpt/image.js
+++ b/packages/opencli-vendor/clis/chatgpt/image.js
@@ -1,4 +1,4 @@
-import { resolveRecipePath, recipeOutputPath } from '@jackwener/opencli/cindy/host';
+import { recipeFileExistsSync, resolveRecipePath, recipeOutputPath } from '@jackwener/opencli/cindy/host';
import * as os from 'node:os';
import * as path from 'node:path';
import * as fs from 'node:fs';
@@ -29,7 +29,7 @@ export function resolveOutputDir(value) {
return resolveRecipePath(raw);
}
-export function nextAvailablePath(dir, baseName, ext, existsSync = (file) => fs.existsSync(recipeOutputPath(file))) {
+export function nextAvailablePath(dir, baseName, ext, existsSync = (file) => recipeFileExistsSync(file)) {
let candidate = path.join(dir, `${baseName}${ext}`);
for (let index = 1; existsSync(candidate); index += 1) {
candidate = path.join(dir, `${baseName}_${index}${ext}`);
diff --git a/packages/opencli-vendor/clis/douyin/_shared/imagex-upload.js b/packages/opencli-vendor/clis/douyin/_shared/imagex-upload.js
index 42ebdb527f..74cc92c03e 100644
--- a/packages/opencli-vendor/clis/douyin/_shared/imagex-upload.js
+++ b/packages/opencli-vendor/clis/douyin/_shared/imagex-upload.js
@@ -1,4 +1,4 @@
-import { recipeOutputPath } from '@jackwener/opencli/cindy/host';
+import { recipeFileExistsSync, recipeOutputPath } from '@jackwener/opencli/cindy/host';
import { resolveRecipePath } from '@jackwener/opencli/cindy/host';
import { readRecipeFileSync } from '@jackwener/opencli/cindy/host';
/**
@@ -35,7 +35,7 @@ function detectContentType(filePath) {
* @returns The store_uri (= image_uri for use in create_v2)
*/
export async function imagexUpload(imagePath, uploadInfo) {
- if (!fs.existsSync(recipeOutputPath(resolveRecipePath(imagePath)))) {
+ if (!recipeFileExistsSync(resolveRecipePath(imagePath))) {
throw new CommandExecutionError(`Cover image file not found: ${imagePath}`, 'Ensure the file path is correct and accessible.');
}
const imageBuffer = readRecipeFileSync(imagePath);
diff --git a/packages/opencli-vendor/clis/douyin/draft.js b/packages/opencli-vendor/clis/douyin/draft.js
index f3aa370dcc..8bc4ffecad 100644
--- a/packages/opencli-vendor/clis/douyin/draft.js
+++ b/packages/opencli-vendor/clis/douyin/draft.js
@@ -5,7 +5,7 @@
* matches creator center's live upload flow. This command now drives the
* official upload page directly so it stays aligned with the site.
*/
-import { recipeOutputPath } from '@jackwener/opencli/cindy/host';
+import { recipeFileExistsSync, recipeOutputPath } from '@jackwener/opencli/cindy/host';
import { resolveRecipePath } from '@jackwener/opencli/cindy/host';
import * as fs from 'node:fs';
import * as path from 'node:path';
@@ -307,7 +307,7 @@ cli({
columns: ['status', 'draft_id'],
func: async (page, kwargs) => {
const videoPath = resolveRecipePath(kwargs.video);
- if (!fs.existsSync(recipeOutputPath(resolveRecipePath(videoPath)))) {
+ if (!recipeFileExistsSync(resolveRecipePath(videoPath))) {
throw new ArgumentError(`视频文件不存在: ${videoPath}`);
}
const ext = path.extname(videoPath).toLowerCase();
@@ -324,7 +324,7 @@ cli({
}
const coverPath = kwargs.cover;
if (coverPath) {
- if (!fs.existsSync(recipeOutputPath(resolveRecipePath(resolveRecipePath(coverPath))))) {
+ if (!recipeFileExistsSync(resolveRecipePath(resolveRecipePath(coverPath)))) {
throw new ArgumentError(`封面文件不存在: ${resolveRecipePath(coverPath)}`);
}
}
diff --git a/packages/opencli-vendor/clis/douyin/publish.js b/packages/opencli-vendor/clis/douyin/publish.js
index b3ee67971d..b937beef58 100644
--- a/packages/opencli-vendor/clis/douyin/publish.js
+++ b/packages/opencli-vendor/clis/douyin/publish.js
@@ -11,7 +11,7 @@
* 7. Content safety check
* 8. create_v2 publish
*/
-import { recipeOutputPath } from '@jackwener/opencli/cindy/host';
+import { recipeFileExistsSync, statRecipeFileSync, recipeOutputPath } from '@jackwener/opencli/cindy/host';
import { resolveRecipePath } from '@jackwener/opencli/cindy/host';
import * as fs from 'node:fs';
import * as path from 'node:path';
@@ -113,14 +113,14 @@ cli({
func: async (page, kwargs) => {
// ── Fail-fast validation ────────────────────────────────────────────
const videoPath = resolveRecipePath(kwargs.video);
- if (!fs.existsSync(recipeOutputPath(resolveRecipePath(videoPath)))) {
+ if (!recipeFileExistsSync(resolveRecipePath(videoPath))) {
throw new ArgumentError(`视频文件不存在: ${videoPath}`);
}
const ext = path.extname(videoPath).toLowerCase();
if (!['.mp4', '.mov', '.avi', '.webm'].includes(ext)) {
throw new ArgumentError(`不支持的视频格式: ${ext}(支持 mp4/mov/avi/webm)`);
}
- const fileSize = fs.statSync(recipeOutputPath(resolveRecipePath(videoPath))).size;
+ const fileSize = statRecipeFileSync(resolveRecipePath(videoPath)).size;
const title = kwargs.title;
if (title.length > 30) {
throw new ArgumentError('标题不能超过 30 字');
@@ -134,7 +134,7 @@ cli({
const visibilityType = VISIBILITY_MAP[kwargs.visibility] ?? 0;
const coverPath = kwargs.cover;
if (coverPath) {
- if (!fs.existsSync(recipeOutputPath(resolveRecipePath(resolveRecipePath(coverPath))))) {
+ if (!recipeFileExistsSync(resolveRecipePath(resolveRecipePath(coverPath)))) {
throw new ArgumentError(`封面文件不存在: ${resolveRecipePath(coverPath)}`);
}
}
diff --git a/packages/opencli-vendor/clis/instagram/_shared/private-publish.js b/packages/opencli-vendor/clis/instagram/_shared/private-publish.js
index 42caf5b21f..8fbfaa17fd 100644
--- a/packages/opencli-vendor/clis/instagram/_shared/private-publish.js
+++ b/packages/opencli-vendor/clis/instagram/_shared/private-publish.js
@@ -1,4 +1,4 @@
-import { recipeOutputPath, recipeTemporaryDirectory, resolveRecipePath } from '@jackwener/opencli/cindy/host';
+import { recipeFileExistsSync, recipeOutputPath, recipeTemporaryDirectory, resolveRecipePath } from '@jackwener/opencli/cindy/host';
import { readRecipeFileSync } from '@jackwener/opencli/cindy/host';
import * as crypto from 'node:crypto';
import * as fs from 'node:fs';
@@ -361,7 +361,7 @@ export function prepareImageAssetForPrivateUpload(filePath) {
], {
encoding: 'utf8',
});
- if (result.error || result.status !== 0 || !fs.existsSync(recipeOutputPath(resolveRecipePath(outputPath)))) {
+ if (result.error || result.status !== 0 || !recipeFileExistsSync(resolveRecipePath(outputPath))) {
const detail = [result.error?.message, result.stderr, result.stdout]
.map((value) => String(value || '').trim())
.filter(Boolean)
@@ -396,7 +396,7 @@ export function prepareImageAssetForPrivateStoryUpload(filePath) {
], {
encoding: 'utf8',
});
- if (result.error || result.status !== 0 || !fs.existsSync(recipeOutputPath(resolveRecipePath(outputPath)))) {
+ if (result.error || result.status !== 0 || !recipeFileExistsSync(resolveRecipePath(outputPath))) {
const detail = [result.error?.message, result.stderr, result.stdout]
.map((value) => String(value || '').trim())
.filter(Boolean)
diff --git a/packages/opencli-vendor/clis/instagram/post.js b/packages/opencli-vendor/clis/instagram/post.js
index 8f0657e060..2363acd339 100644
--- a/packages/opencli-vendor/clis/instagram/post.js
+++ b/packages/opencli-vendor/clis/instagram/post.js
@@ -1,4 +1,4 @@
-import { recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';
+import { recipeFileExistsSync, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';
import { readRecipeFileSync, recipeDiagnosticPath } from '@jackwener/opencli/cindy/host';
import * as fs from 'node:fs';
import * as path from 'node:path';
@@ -98,7 +98,7 @@ function validateMixedMediaItems(inputs) {
if (!resolved) {
throw new ArgumentError('Media path cannot be empty');
}
- if (!fs.existsSync(recipeOutputPath(resolveRecipePath(resolved)))) {
+ if (!recipeFileExistsSync(resolveRecipePath(resolved))) {
throw new ArgumentError(`Media file not found: ${resolved}`);
}
const ext = path.extname(resolved).toLowerCase();
diff --git a/packages/opencli-vendor/clis/instagram/reel.js b/packages/opencli-vendor/clis/instagram/reel.js
index 846b695889..66fbf0d87f 100644
--- a/packages/opencli-vendor/clis/instagram/reel.js
+++ b/packages/opencli-vendor/clis/instagram/reel.js
@@ -1,4 +1,4 @@
-import { recipeCopySource, recipeOutputPath, recipeTemporaryDirectory, resolveRecipePath } from '@jackwener/opencli/cindy/host';
+import { recipeFileExistsSync, recipeCopySource, recipeOutputPath, recipeTemporaryDirectory, resolveRecipePath } from '@jackwener/opencli/cindy/host';
import { recipeDiagnosticPath } from '@jackwener/opencli/cindy/host';
import * as fs from 'node:fs';
import * as os from 'node:os';
@@ -20,7 +20,7 @@ function validateVideoPath(input) {
if (!resolved) {
throw new ArgumentError('Video path cannot be empty');
}
- if (!fs.existsSync(recipeOutputPath(resolveRecipePath(resolved)))) {
+ if (!recipeFileExistsSync(resolveRecipePath(resolved))) {
throw new ArgumentError(`Video file not found: ${resolved}`);
}
const ext = path.extname(resolved).toLowerCase();
diff --git a/packages/opencli-vendor/clis/instagram/story.js b/packages/opencli-vendor/clis/instagram/story.js
index f45848f1bc..69a7ec0b0e 100644
--- a/packages/opencli-vendor/clis/instagram/story.js
+++ b/packages/opencli-vendor/clis/instagram/story.js
@@ -1,4 +1,4 @@
-import { recipeOutputPath } from '@jackwener/opencli/cindy/host';
+import { recipeFileExistsSync, recipeOutputPath } from '@jackwener/opencli/cindy/host';
import { resolveRecipePath } from '@jackwener/opencli/cindy/host';
import * as fs from 'node:fs';
import * as path from 'node:path';
@@ -29,7 +29,7 @@ function normalizeStoryMediaItem(kwargs) {
throw new ArgumentError('Instagram story currently supports a single media item.', 'Provide one image or one video path with --media');
}
const resolved = resolveRecipePath(parts[0]);
- if (!fs.existsSync(recipeOutputPath(resolveRecipePath(resolved)))) {
+ if (!recipeFileExistsSync(resolveRecipePath(resolved))) {
throw new ArgumentError(`Story media file not found: ${resolved}`);
}
const ext = path.extname(resolved).toLowerCase();
diff --git a/packages/opencli-vendor/clis/midjourney/utils.js b/packages/opencli-vendor/clis/midjourney/utils.js
index 29f9e188b1..a1b4888599 100644
--- a/packages/opencli-vendor/clis/midjourney/utils.js
+++ b/packages/opencli-vendor/clis/midjourney/utils.js
@@ -648,7 +648,7 @@ function sniffMediaMime(buffer) {
async function existingMedia(filePath, force, expectedMime) {
if (force) return null;
try {
- const stat = await fs.stat(recipeOutputPath(resolveRecipePath(filePath)));
+ const stat = await Promise.resolve().then(() => statRecipeFileSync(resolveRecipePath(filePath)));
if (!stat.isFile() || stat.size <= 0) return null;
const handle = await fs.open(recipeCopySource(filePath), 'r');
try {
@@ -807,7 +807,7 @@ export async function downloadRenderedVideo(page, jobId, index, kind, outputDir,
throw new CommandExecutionError(`Midjourney ${kind} download did not complete: ${downloaded?.error || downloaded?.state || 'unknown'}`);
}
const sourcePath = resolveRecipePath(String(downloaded.filename));
- const sourceStat = await fs.stat(recipeOutputPath(resolveRecipePath(sourcePath))).catch(() => null);
+ const sourceStat = await Promise.resolve().then(() => statRecipeFileSync(resolveRecipePath(sourcePath))).catch(() => null);
if (!sourceStat?.isFile() || sourceStat.size <= 0) {
throw new CommandExecutionError(`Browser reported a completed download but the file is missing: ${sourcePath}`);
}
diff --git a/packages/opencli-vendor/clis/minimax/utils.js b/packages/opencli-vendor/clis/minimax/utils.js
index dc0e6955a4..256b5d31da 100644
--- a/packages/opencli-vendor/clis/minimax/utils.js
+++ b/packages/opencli-vendor/clis/minimax/utils.js
@@ -1,4 +1,4 @@
-import { recipeCopySource, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';
+import { statRecipeFileSync, recipeFileExistsSync, recipeCopySource, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';
import * as fs from 'node:fs';
import * as os from 'node:os';
import * as path from 'node:path';
@@ -184,11 +184,11 @@ export function reserveAudioFile(dir, model, format, now = new Date()) {
const staging = `${target}.${process.pid}.${randomUUID()}.tmp`;
try {
fs.mkdirSync(recipeOutputPath(dir), { recursive: true });
- if (!fs.statSync(recipeOutputPath(resolveRecipePath(dir))).isDirectory()) throw new Error('not a directory');
+ if (!statRecipeFileSync(resolveRecipePath(dir)).isDirectory()) throw new Error('not a directory');
fs.accessSync(recipeOutputPath(resolveRecipePath(dir)), fs.constants.W_OK);
- if (fs.existsSync(recipeOutputPath(resolveRecipePath(target)))) throw new Error('target already exists');
+ if (recipeFileExistsSync(resolveRecipePath(target))) throw new Error('target already exists');
fs.writeFileSync(recipeOutputPath(lock), String(process.pid), { flag: 'wx', mode: 0o600 });
- if (fs.existsSync(recipeOutputPath(resolveRecipePath(target)))) {
+ if (recipeFileExistsSync(resolveRecipePath(target))) {
fs.rmSync(recipeOutputPath(lock), { force: true });
throw new Error('target appeared during reservation');
}
diff --git a/packages/opencli-vendor/clis/notebooklm/add-source.js b/packages/opencli-vendor/clis/notebooklm/add-source.js
index 9b6a0a3eeb..4a1aa44c9f 100644
--- a/packages/opencli-vendor/clis/notebooklm/add-source.js
+++ b/packages/opencli-vendor/clis/notebooklm/add-source.js
@@ -1,4 +1,4 @@
-import { recipeOutputPath } from '@jackwener/opencli/cindy/host';
+import { statRecipeFileSync, recipeOutputPath } from '@jackwener/opencli/cindy/host';
import { resolveRecipePath } from '@jackwener/opencli/cindy/host';
import { readRecipeFileSync } from '@jackwener/opencli/cindy/host';
import * as fs from 'node:fs';
@@ -43,7 +43,7 @@ export function readFileForUpload(filePath) {
const abs = resolveRecipePath(filePath);
let stat;
try {
- stat = fs.statSync(recipeOutputPath(resolveRecipePath(abs)));
+ stat = statRecipeFileSync(resolveRecipePath(abs));
} catch {
throw new ArgumentError(`--file path does not exist: ${filePath}`);
}
diff --git a/packages/opencli-vendor/clis/paperreview/utils.js b/packages/opencli-vendor/clis/paperreview/utils.js
index 6540d2e6b4..d08e013bb9 100644
--- a/packages/opencli-vendor/clis/paperreview/utils.js
+++ b/packages/opencli-vendor/clis/paperreview/utils.js
@@ -1,4 +1,4 @@
-import { recipeOutputPath } from '@jackwener/opencli/cindy/host';
+import { statRecipeFileSync, recipeOutputPath } from '@jackwener/opencli/cindy/host';
import { resolveRecipePath } from '@jackwener/opencli/cindy/host';
import { readRecipeFileSync } from '@jackwener/opencli/cindy/host';
import fs from 'node:fs/promises';
@@ -61,7 +61,7 @@ export async function readPdfFile(inputPath) {
}
let fileStat;
try {
- fileStat = await fs.stat(recipeOutputPath(resolveRecipePath(resolvedPath)));
+ fileStat = await Promise.resolve().then(() => statRecipeFileSync(resolveRecipePath(resolvedPath)));
}
catch (error) {
if (error?.code === 'ENOENT') {
diff --git a/packages/opencli-vendor/clis/pixiv/bookmark-download.js b/packages/opencli-vendor/clis/pixiv/bookmark-download.js
index 12adc056c2..cf85fa8f5f 100644
--- a/packages/opencli-vendor/clis/pixiv/bookmark-download.js
+++ b/packages/opencli-vendor/clis/pixiv/bookmark-download.js
@@ -1,4 +1,4 @@
-import { recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';
+import { recipeFileExistsSync, statRecipeFileSync, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';
import * as fs from 'node:fs';
import * as path from 'node:path';
import { cli, Strategy } from '@jackwener/opencli/registry';
@@ -73,7 +73,7 @@ async function prepareIllustPlan(page, row, outputRoot) {
throw new CommandExecutionError(`Refusing to overwrite existing Pixiv download: ${finalPath}`);
}
const createdDirs = [];
- for (let cursor = path.dirname(finalPath); !fs.existsSync(recipeOutputPath(resolveRecipePath(cursor))); cursor = path.dirname(cursor)) {
+ for (let cursor = path.dirname(finalPath); !recipeFileExistsSync(resolveRecipePath(cursor)); cursor = path.dirname(cursor)) {
createdDirs.push(cursor);
if (path.dirname(cursor) === cursor) break;
}
@@ -105,7 +105,7 @@ async function commitIllustPlan(plan, cookies) {
includeContentType: true,
});
validateImageDownload(result, file);
- const stat = fs.lstatSync(recipeOutputPath(resolveRecipePath(destination)));
+ const stat = statRecipeFileSync(resolveRecipePath(destination));
if (stat.isSymbolicLink() || !stat.isFile() || stat.size <= 0) {
throw new CommandExecutionError(`Pixiv image download did not create a valid file: ${file.filename}`);
}
diff --git a/packages/opencli-vendor/clis/pixiv/novel-download-utils.js b/packages/opencli-vendor/clis/pixiv/novel-download-utils.js
index b21aa4eabf..595ae4e80e 100644
--- a/packages/opencli-vendor/clis/pixiv/novel-download-utils.js
+++ b/packages/opencli-vendor/clis/pixiv/novel-download-utils.js
@@ -1,4 +1,4 @@
-import { closeRecipeFileSync, openRecipeOutputFileSync, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';
+import { statRecipeFileSync, recipeFileExistsSync, closeRecipeFileSync, openRecipeOutputFileSync, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';
import * as fs from 'node:fs';
import * as path from 'node:path';
import { ArgumentError, CommandExecutionError } from '@jackwener/opencli/errors';
@@ -70,7 +70,7 @@ export function normalizePixivOutputRoot(value, fallback) {
let ancestorStat;
while (!ancestorStat) {
try {
- ancestorStat = fs.lstatSync(recipeOutputPath(resolveRecipePath(ancestor)));
+ ancestorStat = statRecipeFileSync(resolveRecipePath(ancestor));
} catch (error) {
if (error?.code !== 'ENOENT') {
throw new ArgumentError(`output path is not a safe directory: ${ancestor}`);
@@ -92,7 +92,7 @@ export function normalizePixivOutputRoot(value, fallback) {
} catch {
throw new ArgumentError(`output path is not a safe directory: ${ancestor}`);
}
- if (!fs.statSync(recipeOutputPath(resolveRecipePath(canonicalAncestor))).isDirectory()) {
+ if (!statRecipeFileSync(resolveRecipePath(canonicalAncestor)).isDirectory()) {
throw new ArgumentError(`output path is not a safe directory: ${ancestor}`);
}
return path.join(canonicalAncestor, ...missingParts);
@@ -100,7 +100,7 @@ export function normalizePixivOutputRoot(value, fallback) {
export function pixivPathEntryExists(target) {
try {
- fs.lstatSync(recipeOutputPath(resolveRecipePath(target)));
+ statRecipeFileSync(resolveRecipePath(target));
return true;
} catch (error) {
if (error?.code === 'ENOENT') return false;
@@ -161,7 +161,7 @@ export function prepareNovelFile(body, output, format) {
throw new CommandExecutionError(`Refusing to overwrite existing Pixiv download: ${destPath}`);
}
const createdDirs = [];
- for (let cursor = outputDir; !fs.existsSync(recipeOutputPath(resolveRecipePath(cursor))); cursor = path.dirname(cursor)) {
+ for (let cursor = outputDir; !recipeFileExistsSync(resolveRecipePath(cursor)); cursor = path.dirname(cursor)) {
createdDirs.push(cursor);
if (path.dirname(cursor) === cursor) break;
}
diff --git a/packages/opencli-vendor/clis/suno/utils.js b/packages/opencli-vendor/clis/suno/utils.js
index 8a24bf1278..c41fdc4cd0 100644
--- a/packages/opencli-vendor/clis/suno/utils.js
+++ b/packages/opencli-vendor/clis/suno/utils.js
@@ -15,7 +15,7 @@
* - browser-token: {"token":"<base64 of {timestamp: ms}>"} (anti-replay)
* - device-id: <uuid> (persistent per browser, found in `suno_device_id` cookie)
*/
-import { recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';
+import { statRecipeFileSync, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';
import * as fs from 'node:fs';
import * as path from 'node:path';
import { ArgumentError, AuthRequiredError, CommandExecutionError, EmptyResultError, TimeoutError } from '@jackwener/opencli/errors';
@@ -495,7 +495,7 @@ async function writeFromDataUrl(page, url, filePath) {
return { ok: false, reason: 'empty response body' };
}
fs.writeFileSync(recipeOutputPath(filePath), Buffer.from(base64, 'base64'));
- if (!fs.statSync(recipeOutputPath(resolveRecipePath(filePath))).size) {
+ if (!statRecipeFileSync(resolveRecipePath(filePath)).size) {
return { ok: false, reason: 'empty file written' };
}
return { ok: true };
diff --git a/packages/opencli-vendor/clis/twitter/archive.js b/packages/opencli-vendor/clis/twitter/archive.js
index b8b3a0b2ba..6b0adc2f35 100644
--- a/packages/opencli-vendor/clis/twitter/archive.js
+++ b/packages/opencli-vendor/clis/twitter/archive.js
@@ -1,4 +1,4 @@
-import { recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';
+import { recipeFileExistsSync, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';
import { readRecipeFileSync } from '@jackwener/opencli/cindy/host';
import fs from 'node:fs';
import path from 'node:path';
@@ -36,7 +36,7 @@ function removeFile(filePath) {
export function loadJsonlArchiveState(filePath) {
const seen = new Set();
let count = 0;
- if (!filePath || !fs.existsSync(recipeOutputPath(resolveRecipePath(filePath))))
+ if (!filePath || !recipeFileExistsSync(resolveRecipePath(filePath)))
return { seen, count };
const text = readRecipeFileSync(filePath, 'utf8');
for (const [index, line] of text.split('\n').entries()) {
diff --git a/packages/opencli-vendor/clis/twitter/bookmarks.js b/packages/opencli-vendor/clis/twitter/bookmarks.js
index 4dac21cff3..3e1ab68f05 100644
--- a/packages/opencli-vendor/clis/twitter/bookmarks.js
+++ b/packages/opencli-vendor/clis/twitter/bookmarks.js
@@ -1,4 +1,4 @@
-import { recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';
+import { recipeFileExistsSync, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';
import { readRecipeFileSync } from '@jackwener/opencli/cindy/host';
import fs from 'node:fs';
import path from 'node:path';
@@ -109,7 +109,7 @@ export function parseBookmarks(data, seen) {
return { tweets, nextCursor, hasTimelineItems };
}
function readResumeFile(filePath, expected = null) {
- if (!filePath || !fs.existsSync(recipeOutputPath(resolveRecipePath(filePath))))
+ if (!filePath || !recipeFileExistsSync(resolveRecipePath(filePath)))
return null;
let parsed;
try {
@@ -222,10 +222,10 @@ cli({
source: 'bookmarks',
outputFile: useOutputFile ? outputFile : null,
}) : null;
- if (useOutputFile && resumed && resumed.count > 0 && !fs.existsSync(recipeOutputPath(resolveRecipePath(outputFile)))) {
+ if (useOutputFile && resumed && resumed.count > 0 && !recipeFileExistsSync(resolveRecipePath(outputFile))) {
throw new CommandExecutionError(`Twitter bookmarks output file is missing for resume state: ${outputFile}`);
}
- if (useOutputFile && !resumed && fs.existsSync(recipeOutputPath(resolveRecipePath(outputFile)))) {
+ if (useOutputFile && !resumed && recipeFileExistsSync(resolveRecipePath(outputFile))) {
throw new ArgumentError(`Refusing to overwrite existing Twitter bookmarks output file: ${outputFile}`);
}
const allTweets = useOutputFile ? [] : (resumed?.tweets ? [...resumed.tweets] : []);
diff --git a/packages/opencli-vendor/clis/twitter/likes.js b/packages/opencli-vendor/clis/twitter/likes.js
index a109585e8e..1b831aedab 100644
--- a/packages/opencli-vendor/clis/twitter/likes.js
+++ b/packages/opencli-vendor/clis/twitter/likes.js
@@ -1,4 +1,4 @@
-import { recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';
+import { recipeFileExistsSync, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';
import { readRecipeFileSync } from '@jackwener/opencli/cindy/host';
import fs from 'node:fs';
import path from 'node:path';
@@ -124,7 +124,7 @@ function parseLikes(data, seen) {
return { tweets, nextCursor, hasTimelineItems };
}
function readResumeFile(filePath, expected = null) {
- if (!filePath || !fs.existsSync(recipeOutputPath(resolveRecipePath(filePath))))
+ if (!filePath || !recipeFileExistsSync(resolveRecipePath(filePath)))
return null;
let parsed;
try {
@@ -279,10 +279,10 @@ cli({
username,
outputFile: useOutputFile ? outputFile : null,
}) : null;
- if (useOutputFile && resumed && resumed.count > 0 && !fs.existsSync(recipeOutputPath(resolveRecipePath(outputFile)))) {
+ if (useOutputFile && resumed && resumed.count > 0 && !recipeFileExistsSync(resolveRecipePath(outputFile))) {
throw new CommandExecutionError(`Twitter likes output file is missing for resume state: ${outputFile}`);
}
- if (useOutputFile && !resumed && fs.existsSync(recipeOutputPath(resolveRecipePath(outputFile)))) {
+ if (useOutputFile && !resumed && recipeFileExistsSync(resolveRecipePath(outputFile))) {
throw new ArgumentError(`Refusing to overwrite existing Twitter likes output file: ${outputFile}`);
}
const allTweets = useOutputFile ? [] : (resumed?.tweets ? [...resumed.tweets] : []);
diff --git a/packages/opencli-vendor/clis/twitter/post.js b/packages/opencli-vendor/clis/twitter/post.js
index 0c013ab11d..1daf4d89d5 100644
--- a/packages/opencli-vendor/clis/twitter/post.js
+++ b/packages/opencli-vendor/clis/twitter/post.js
@@ -1,4 +1,4 @@
-import { recipeOutputPath } from '@jackwener/opencli/cindy/host';
+import { statRecipeFileSync, recipeOutputPath } from '@jackwener/opencli/cindy/host';
import { resolveRecipePath } from '@jackwener/opencli/cindy/host';
import { readRecipeFileSync } from '@jackwener/opencli/cindy/host';
import * as fs from 'node:fs';
@@ -30,7 +30,7 @@ function validateImagePaths(raw) {
if (!SUPPORTED_EXTENSIONS.has(ext)) {
throw new CommandExecutionError(`Unsupported image format "${ext}". Supported: jpg, png, gif, webp`);
}
- const stat = fs.statSync(recipeOutputPath(resolveRecipePath(absPath)), { throwIfNoEntry: false });
+ const stat = statRecipeFileSync(resolveRecipePath(absPath));
if (!stat || !stat.isFile()) {
throw new CommandExecutionError(`Not a valid file: ${absPath}`);
}
diff --git a/packages/opencli-vendor/clis/twitter/utils.js b/packages/opencli-vendor/clis/twitter/utils.js
index 9c8e28b7c3..66dbf3e3af 100644
--- a/packages/opencli-vendor/clis/twitter/utils.js
+++ b/packages/opencli-vendor/clis/twitter/utils.js
@@ -1,4 +1,4 @@
-import { recipeOutputPath, recipeTemporaryDirectory, resolveRecipePath } from '@jackwener/opencli/cindy/host';
+import { recipeFileExistsSync, statRecipeFileSync, recipeOutputPath, recipeTemporaryDirectory, resolveRecipePath } from '@jackwener/opencli/cindy/host';
import { readRecipeFileSync } from '@jackwener/opencli/cindy/host';
import * as fs from 'node:fs';
import * as os from 'node:os';
@@ -41,14 +41,14 @@ const CONTENT_TYPE_TO_EXTENSION = {
*/
export function resolveImagePath(imagePath) {
const absPath = resolveRecipePath(imagePath);
- if (!fs.existsSync(recipeOutputPath(resolveRecipePath(absPath)))) {
+ if (!recipeFileExistsSync(resolveRecipePath(absPath))) {
throw new ArgumentError(`Image file not found: ${absPath}`);
}
const ext = path.extname(absPath).toLowerCase();
if (!SUPPORTED_IMAGE_EXTENSIONS.has(ext)) {
throw new ArgumentError(`Unsupported image format "${ext}". Supported: jpg, jpeg, png, gif, webp`);
}
- const stat = fs.statSync(recipeOutputPath(resolveRecipePath(absPath)));
+ const stat = statRecipeFileSync(resolveRecipePath(absPath));
if (stat.size > MAX_IMAGE_SIZE_BYTES) {
throw new ArgumentError(`Image too large: ${(stat.size / 1024 / 1024).toFixed(1)} MB (max ${MAX_IMAGE_SIZE_BYTES / 1024 / 1024} MB)`);
}
diff --git a/packages/opencli-vendor/clis/weibo/publish.js b/packages/opencli-vendor/clis/weibo/publish.js
index 5076e615ad..1c206b2286 100644
--- a/packages/opencli-vendor/clis/weibo/publish.js
+++ b/packages/opencli-vendor/clis/weibo/publish.js
@@ -15,7 +15,7 @@
* opencli weibo publish "Hello from OpenCLI! #opencli" # publishes immediately
* opencli weibo publish "Check this out" --images /path/a.jpg,/path/b.jpg
*/
-import { recipeOutputPath } from '@jackwener/opencli/cindy/host';
+import { statRecipeFileSync, recipeOutputPath } from '@jackwener/opencli/cindy/host';
import { resolveRecipePath } from '@jackwener/opencli/cindy/host';
import * as fs from 'node:fs';
import * as path from 'node:path';
@@ -62,7 +62,7 @@ function validateImagePaths(raw) {
if (!SUPPORTED_EXTENSIONS.has(ext)) {
throw new ArgumentError(`Unsupported image format "${ext}". Supported: jpg, png, gif, webp`);
}
- const stat = fs.statSync(recipeOutputPath(resolveRecipePath(absPath)), { throwIfNoEntry: false });
+ const stat = statRecipeFileSync(resolveRecipePath(absPath));
if (!stat || !stat.isFile()) {
throw new ArgumentError(`Not a valid file: ${absPath}`);
}
diff --git a/packages/opencli-vendor/clis/weixin/create-draft.js b/packages/opencli-vendor/clis/weixin/create-draft.js
index 36397e663a..59254e0172 100644
--- a/packages/opencli-vendor/clis/weixin/create-draft.js
+++ b/packages/opencli-vendor/clis/weixin/create-draft.js
@@ -1,4 +1,4 @@
-import { recipeOutputPath } from '@jackwener/opencli/cindy/host';
+import { statRecipeFileSync, recipeOutputPath } from '@jackwener/opencli/cindy/host';
import { resolveRecipePath } from '@jackwener/opencli/cindy/host';
import { readRecipeFileSync } from '@jackwener/opencli/cindy/host';
import fs from 'node:fs';
@@ -39,7 +39,7 @@ function resolveCoverImage(rawPath) {
const absPath = resolveRecipePath(value);
let stat;
try {
- stat = fs.statSync(recipeOutputPath(resolveRecipePath(absPath)));
+ stat = statRecipeFileSync(resolveRecipePath(absPath));
} catch {
throw new ArgumentError(`weixin create-draft cover-image does not exist: ${absPath}`);
}
diff --git a/packages/opencli-vendor/clis/xianyu/publish.js b/packages/opencli-vendor/clis/xianyu/publish.js
index 154286e7b3..bbe6ce8c9a 100644
--- a/packages/opencli-vendor/clis/xianyu/publish.js
+++ b/packages/opencli-vendor/clis/xianyu/publish.js
@@ -1,4 +1,4 @@
-import { recipeOutputPath } from '@jackwener/opencli/cindy/host';
+import { statRecipeFileSync, recipeOutputPath } from '@jackwener/opencli/cindy/host';
import { resolveRecipePath } from '@jackwener/opencli/cindy/host';
import * as fs from 'node:fs';
import * as path from 'node:path';
@@ -69,7 +69,7 @@ function validateImagePaths(raw) {
if (!SUPPORTED_IMAGE_EXTENSIONS.has(ext)) {
throw new ArgumentError(`Unsupported image format "${ext}". Supported: jpg, jpeg, png, webp`);
}
- const stat = fs.statSync(recipeOutputPath(resolveRecipePath(absPath)), { throwIfNoEntry: false });
+ const stat = statRecipeFileSync(resolveRecipePath(absPath));
if (!stat || !stat.isFile()) {
throw new ArgumentError(`Not a valid image file: ${absPath}`);
}
diff --git a/packages/opencli-vendor/clis/xiaohongshu/publish.js b/packages/opencli-vendor/clis/xiaohongshu/publish.js
index e28e466cfb..07f199c82a 100644
--- a/packages/opencli-vendor/clis/xiaohongshu/publish.js
+++ b/packages/opencli-vendor/clis/xiaohongshu/publish.js
@@ -1,4 +1,4 @@
-import { recipeOutputPath } from '@jackwener/opencli/cindy/host';
+import { recipeFileExistsSync, recipeOutputPath } from '@jackwener/opencli/cindy/host';
import { resolveRecipePath } from '@jackwener/opencli/cindy/host';
import { readRecipeFileSync, recipeDiagnosticPath } from '@jackwener/opencli/cindy/host';
/**
@@ -128,7 +128,7 @@ function unwrapBrowserResult(value) {
function validateImagePaths(filePaths) {
return filePaths.map((filePath) => {
const absPath = resolveRecipePath(filePath);
- if (!fs.existsSync(recipeOutputPath(resolveRecipePath(absPath))))
+ if (!recipeFileExistsSync(resolveRecipePath(absPath)))
throw new ArgumentError(`Image file not found: ${absPath}`);
const ext = path.extname(absPath).toLowerCase();
if (!SUPPORTED_EXTENSIONS[ext]) {
diff --git a/packages/opencli-vendor/clis/yollomi/upload.js b/packages/opencli-vendor/clis/yollomi/upload.js
index 64fb60a428..92d5295191 100644
--- a/packages/opencli-vendor/clis/yollomi/upload.js
+++ b/packages/opencli-vendor/clis/yollomi/upload.js
@@ -1,4 +1,4 @@
-import { recipeOutputPath } from '@jackwener/opencli/cindy/host';
+import { recipeFileExistsSync, recipeOutputPath } from '@jackwener/opencli/cindy/host';
import { resolveRecipePath } from '@jackwener/opencli/cindy/host';
import { readRecipeFileSync } from '@jackwener/opencli/cindy/host';
/**
@@ -32,7 +32,7 @@ cli({
columns: ['status', 'file', 'size', 'url'],
func: async (page, kwargs) => {
const filePath = resolveRecipePath(kwargs.file);
- if (!fs.existsSync(recipeOutputPath(resolveRecipePath(filePath))))
+ if (!recipeFileExistsSync(resolveRecipePath(filePath)))
throw new CliError('FILE_NOT_FOUND', `File not found: ${filePath}`, 'Provide a valid file path');
const ext = path.extname(filePath).toLowerCase();
const mime = MIME_MAP[ext];
diff --git a/packages/opencli-vendor/clis/yollomi/utils.js b/packages/opencli-vendor/clis/yollomi/utils.js
index 5582f7ed1c..50c7aa4d2d 100644
--- a/packages/opencli-vendor/clis/yollomi/utils.js
+++ b/packages/opencli-vendor/clis/yollomi/utils.js
@@ -1,4 +1,4 @@
-import { recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';
+import { recipeFileExistsSync, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';
import { readRecipeFileSync } from '@jackwener/opencli/cindy/host';
/**
* Yollomi API utilities — browser cookie strategy.
@@ -79,7 +79,7 @@ export function resolveImageInput(input) {
return input;
}
const resolved = resolveRecipePath(input);
- if (!fs.existsSync(recipeOutputPath(resolveRecipePath(resolved)))) {
+ if (!recipeFileExistsSync(resolveRecipePath(resolved))) {
throw new CliError('FILE_NOT_FOUND', `File not found: ${resolved}`, 'Provide a valid file path or URL');
}
const ext = path.extname(resolved).toLowerCase();
diff --git a/packages/opencli-vendor/src/download/index.ts b/packages/opencli-vendor/src/download/index.ts
index 3c39631878..332c11f9ab 100644
--- a/packages/opencli-vendor/src/download/index.ts
+++ b/packages/opencli-vendor/src/download/index.ts
@@ -2,7 +2,7 @@
* Download utilities: HTTP downloads, yt-dlp wrapper, format conversion.
*/
-import { closeRecipeFileSync, openRecipeOutputFileSync, recipeCopySource, recipeOutputPath, recipeTemporaryDirectory, resolveRecipePath } from '@jackwener/opencli/cindy/host';
+import { recipeFileExistsSync, statRecipeFileSync, closeRecipeFileSync, openRecipeOutputFileSync, recipeCopySource, recipeOutputPath, recipeTemporaryDirectory, resolveRecipePath } from '@jackwener/opencli/cindy/host';
import { execFileSync, spawn } from 'node:child_process';
import * as fs from 'node:fs';
import * as path from 'node:path';
@@ -339,15 +339,15 @@ export async function ytdlpDownload(
});
proc.on('close', (code) => {
- if (code === 0 && fs.existsSync(recipeOutputPath(destPath))) {
- const stats = fs.statSync(recipeOutputPath(destPath));
+ if (code === 0 && recipeFileExistsSync(destPath)) {
+ const stats = statRecipeFileSync(destPath);
resolve({ success: true, size: stats.size });
} else {
// Check for common yt-dlp output patterns
const patterns = fs.readdirSync(recipeOutputPath(dir)).filter(f => f.startsWith(path.basename(destPath, path.extname(destPath))));
if (patterns.length > 0) {
const actualFile = path.join(dir, patterns[0]);
- const stats = fs.statSync(recipeOutputPath(actualFile));
+ const stats = statRecipeFileSync(actualFile);
resolve({ success: true, size: stats.size });
} else {
resolve({ success: false, size: 0, error: errorOutput.slice(0, 200) || `Exit code ${code}` });
diff --git a/packages/opencli-vendor/src/download/media-download.ts b/packages/opencli-vendor/src/download/media-download.ts
index 28e9ff6971..0e0a9a8e6b 100644
--- a/packages/opencli-vendor/src/download/media-download.ts
+++ b/packages/opencli-vendor/src/download/media-download.ts
@@ -7,7 +7,7 @@
* Flow: MediaItem[] → DownloadProgressTracker → httpDownload/ytdlpDownload → results
*/
-import { recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';
+import { recipeFileExistsSync, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';
import * as fs from 'node:fs';
import * as path from 'node:path';
import { getErrorMessage } from '../errors.js';
@@ -173,7 +173,7 @@ export async function downloadMedia(
tracker.finish();
// Auto-cleanup exported cookies file
- if (cookiesFile && fs.existsSync(recipeOutputPath(cookiesFile))) {
+ if (cookiesFile && recipeFileExistsSync(cookiesFile)) {
fs.unlinkSync(recipeOutputPath(cookiesFile));
}
}
diff --git a/packages/opencli-vendor/src/pipeline/steps/download.ts b/packages/opencli-vendor/src/pipeline/steps/download.ts
index 2e5c3cca84..7876a4ce8a 100644
--- a/packages/opencli-vendor/src/pipeline/steps/download.ts
+++ b/packages/opencli-vendor/src/pipeline/steps/download.ts
@@ -8,7 +8,7 @@
* - Filename templating and deduplication
*/
-import { recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';
+import { recipeFileExistsSync, statRecipeFileSync, recipeOutputPath, resolveRecipePath } from '@jackwener/opencli/cindy/host';
import * as fs from 'node:fs';
import * as path from 'node:path';
import type { IPage } from '../../types.js';
@@ -220,14 +220,14 @@ export async function stepDownload(
const destPath = path.join(dir, filename);
// Check if file exists and skip_existing is true
- if (skipExisting && fs.existsSync(recipeOutputPath(destPath))) {
+ if (skipExisting && recipeFileExistsSync(destPath)) {
tracker.onFileComplete(true, true);
return {
...item,
_download: {
status: 'skipped',
path: destPath,
- size: fs.statSync(recipeOutputPath(destPath)).size,
+ size: statRecipeFileSync(destPath).size,
} as DownloadResult,
};
}
@@ -329,7 +329,7 @@ export async function stepDownload(
});
// Cleanup temp cookie file
- if (cookiesFile && fs.existsSync(recipeOutputPath(cookiesFile))) {
+ if (cookiesFile && recipeFileExistsSync(cookiesFile)) {
try {
fs.unlinkSync(recipeOutputPath(cookiesFile));
} catch {
diff --git a/scripts/check-opencli-recipes.mjs b/scripts/check-opencli-recipes.mjs
index cf2cf77af9..5d9a14a835 100644
--- a/scripts/check-opencli-recipes.mjs
+++ b/scripts/check-opencli-recipes.mjs
@@ -29,11 +29,11 @@ try {
"/packages/opencli-vendor/cindy/index.ts",
);
const failures = [];
- const { upstreamCatalog, excludedSites } = await server.ssrLoadModule('/packages/opencli-vendor/cindy/catalog.ts');
+ const { upstreamCatalog, excludedSites, excludedCommands } = await server.ssrLoadModule('/packages/opencli-vendor/cindy/catalog.ts');
// Verify even deliberately excluded sources: full import and product selection
// are separate contracts, and neither may silently lose a command.
for (const entry of upstreamCatalog) {
- if (entry.site in excludedSites)
+ if (entry.site in excludedSites || excludedCommands.has(`${entry.site}/${entry.name}`))
await server.ssrLoadModule(`/packages/opencli-vendor/clis/${entry.modulePath}`);
}
for (const entry of catalog) {
diff --git a/scripts/sync-opencli-recipes.mjs b/scripts/sync-opencli-recipes.mjs
index 643e76a078..6f354d52f0 100644
--- a/scripts/sync-opencli-recipes.mjs
+++ b/scripts/sync-opencli-recipes.mjs
@@ -154,7 +154,8 @@ await writeFile(
const selection = JSON.parse(await readFile(path.join(target, 'cindy/selection.json'), 'utf8'));
// Explicit static imports let Vite bundle selected adapters without relying on
// runtime filesystem paths, npm installs, or importing upstream test helpers.
-const modules = [...new Set(manifest.filter(c => !(c.site in selection.excludedSites)).map((c) => c.modulePath))].sort();
+const modules = [...new Set(manifest.filter(c => !(c.site in selection.excludedSites)
+ && !(selection.excludedCommands ?? []).includes(`${c.site}/${c.name}`)).map((c) => c.modulePath))].sort();
await mkdir(path.join(target, "cindy"), { recursive: true });
await rm(path.join(target, "cindy/modules.ts"), { force: true });
await writeFile(