Files
zCode-CLI-X/~/.npm-cache/execa@9.6.1@@@1/lib/methods/parameters.js
admin 875c7f9b91 feat: Complete zCode CLI X with Telegram bot integration
- Add full Telegram bot functionality with Z.AI API integration
- Implement 4 tools: Bash, FileEdit, WebSearch, Git
- Add 3 agents: Code Reviewer, Architect, DevOps Engineer
- Add 6 skills for common coding tasks
- Add systemd service file for 24/7 operation
- Add nginx configuration for HTTPS webhook
- Add comprehensive documentation
- Implement WebSocket server for real-time updates
- Add logging system with Winston
- Add environment validation

🤖 zCode CLI X - Agentic coder with Z.AI + Telegram integration
2026-05-05 09:01:26 +00:00

32 lines
1.3 KiB
JavaScript

import isPlainObject from 'is-plain-obj';
import {safeNormalizeFileUrl} from '../arguments/file-url.js';
// The command `arguments` and `options` are both optional.
// This also does basic validation on them and on the command file.
export const normalizeParameters = (rawFile, rawArguments = [], rawOptions = {}) => {
const filePath = safeNormalizeFileUrl(rawFile, 'First argument');
const [commandArguments, options] = isPlainObject(rawArguments)
? [[], rawArguments]
: [rawArguments, rawOptions];
if (!Array.isArray(commandArguments)) {
throw new TypeError(`Second argument must be either an array of arguments or an options object: ${commandArguments}`);
}
if (commandArguments.some(commandArgument => typeof commandArgument === 'object' && commandArgument !== null)) {
throw new TypeError(`Second argument must be an array of strings: ${commandArguments}`);
}
const normalizedArguments = commandArguments.map(String);
const nullByteArgument = normalizedArguments.find(normalizedArgument => normalizedArgument.includes('\0'));
if (nullByteArgument !== undefined) {
throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${nullByteArgument}`);
}
if (!isPlainObject(options)) {
throw new TypeError(`Last argument must be an options object: ${options}`);
}
return [filePath, normalizedArguments, options];
};