kimi-code/apps/vscode/scripts/publish-args.mjs
qer d1ca65e1de
feat(vscode): migrate extension to Node SDK (#1769)
* feat(vscode): migrate extension to Node SDK

* fix(vscode): address CI failures

* fix(vis): handle token count records

* fix(vscode): keep chat toolbar and header readable at narrow widths

* fix(vscode): map yolo to core yolo permission and honor the global yolo setting

* docs(vscode): record Node SDK migration design

* docs(vscode): split breaking changes out of the 0.6.0 changelog

* fix(vscode): keep a resumed session's thinking effort instead of reapplying the default

* fix(vscode): announce session status when a view attaches so the display matches it

* fix(vscode): align webview thinking effort handling with the TUI
2026-07-16 17:27:21 +08:00

54 lines
1.6 KiB
JavaScript

import { join, resolve } from 'node:path';
import {
defaultVsixOutputDir,
normalizeVsixTargets,
vsixFileName,
} from './vsix-targets.mjs';
export function parsePublishArguments(argv) {
const targets = [];
let outputDir = defaultVsixOutputDir;
let help = false;
for (let index = 0; index < argv.length; index += 1) {
const argument = argv[index];
if (argument === '--') {
continue;
} else if (argument === '--help' || argument === '-h') {
help = true;
} else if (argument === '--out-dir') {
outputDir = requireOptionValue(argv, ++index, '--out-dir');
} else if (argument === '--target') {
targets.push(requireOptionValue(argv, ++index, '--target'));
} else if (argument.startsWith('-')) {
throw new Error(`Unknown option: ${argument}`);
} else {
targets.push(argument);
}
}
const normalizedTargets = normalizeVsixTargets(targets);
const resolvedOutputDir = resolve(outputDir);
return {
help,
targets: normalizedTargets,
outputDir: resolvedOutputDir,
files: normalizedTargets.map((target) => join(resolvedOutputDir, vsixFileName(target))),
};
}
function requireOptionValue(argv, index, option) {
const value = argv[index];
if (value !== undefined && !value.startsWith('-')) return value;
throw new Error(`${option} requires a value.`);
}
export function publishUsage(marketplace) {
return [
`Usage: node scripts/${marketplace === 'Open VSX' ? 'ovsx' : 'vsix'}-publish.mjs [targets...] [--out-dir <directory>]`,
'',
`Publishes already-built, re-verified VSIX files to ${marketplace}.`,
'This command never builds or downloads a CLI.',
].join('\n');
}