Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
One-time setup that gathers your project's design context and saves it to CLAUDE.md for future sessions.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
scripts/lib/target-args.mjs
1class TargetArgError extends Error {2constructor(message, code) {3super(message);4this.name = 'TargetArgError';5this.code = code;6}7}89export function parseTargetPath(args = [], { strict = false } = {}) {10let targetPath = null;11for (let i = 0; i < args.length; i++) {12const arg = String(args[i]);13if (arg === '--target' || arg === '-t') {14const next = args[i + 1];15if (next && !String(next).startsWith('-')) {16targetPath = String(next);17i++;18continue;19}20if (strict) {21throw new TargetArgError('--target requires a path value.', 'TARGET_VALUE_MISSING');22}23continue;24}25if (arg.startsWith('--target=')) {26const value = arg.slice('--target='.length);27if (value) {28targetPath = value;29continue;30}31if (strict) {32throw new TargetArgError('--target requires a path value.', 'TARGET_VALUE_MISSING');33}34}35}36return targetPath;37}3839export function parseTargetOptions(args = [], options = {}) {40const targetPath = parseTargetPath(args, options);41return targetPath ? { targetPath } : {};42}43