Files
antigravity-skills-reference/scripts/copy-file.js
Ares 4a5f1234bb fix: harden registry tooling, make tests hermetic, and restore metadata consistency (#168)
* chore: upgrade maintenance scripts to robust PyYAML parsing

- Replaces fragile regex frontmatter parsing with PyYAML/yaml library
- Ensures multi-line descriptions and complex characters are handled safely
- Normalizes quoting and field ordering across all maintenance scripts
- Updates validator to strictly enforce description quality

* fix: restore and refine truncated skill descriptions

- Recovered 223+ truncated descriptions from git history (6.5.0 regression)
- Refined long descriptions into concise, complete sentences (<200 chars)
- Added missing descriptions for brainstorming and orchestration skills
- Manually fixed imagen skill description
- Resolved dangling links in competitor-alternatives skill

* chore: sync generated registry files and document fixes

- Regenerated skills index with normalized forward-slash paths
- Updated README and CATALOG to reflect restored descriptions
- Documented restoration and script improvements in CHANGELOG.md

* fix: restore missing skill and align metadata for full 955 count

- Renamed SKILL.MD to SKILL.md in andruia-skill-smith to ensure indexing
- Fixed risk level and missing section in andruia-skill-smith
- Synchronized all registry files for final 955 skill count

* chore(scripts): add cross-platform runners and hermetic test orchestration

* fix(scripts): harden utf-8 output and clone target writeability

* fix(skills): add missing date metadata for strict validation

* chore(index): sync generated metadata dates

* fix(catalog): normalize skill paths to prevent CI drift

* chore: sync generated registry files

* fix: enforce LF line endings for generated registry files
2026-03-01 09:38:25 +01:00

72 lines
1.9 KiB
JavaScript

#!/usr/bin/env node
'use strict';
const fs = require('node:fs');
const path = require('node:path');
const args = process.argv.slice(2);
if (args.length !== 2) {
console.error('Usage: node scripts/copy-file.js <source> <destination>');
process.exit(1);
}
const [sourceInput, destinationInput] = args;
const projectRoot = path.resolve(__dirname, '..');
const sourcePath = path.resolve(projectRoot, sourceInput);
const destinationPath = path.resolve(projectRoot, destinationInput);
const destinationDir = path.dirname(destinationPath);
function fail(message) {
console.error(message);
process.exit(1);
}
function isInsideProjectRoot(targetPath) {
const relativePath = path.relative(projectRoot, targetPath);
return relativePath === '' || (!relativePath.startsWith('..') && !path.isAbsolute(relativePath));
}
if (!isInsideProjectRoot(sourcePath) || !isInsideProjectRoot(destinationPath)) {
fail('Source and destination must resolve inside the project root.');
}
if (sourcePath === destinationPath) {
fail('Source and destination must be different files.');
}
if (!fs.existsSync(sourcePath)) {
fail(`Source file not found: ${sourceInput}`);
}
let sourceStats;
try {
sourceStats = fs.statSync(sourcePath);
} catch (error) {
fail(`Unable to read source file "${sourceInput}": ${error.message}`);
}
if (!sourceStats.isFile()) {
fail(`Source is not a file: ${sourceInput}`);
}
let destinationDirStats;
try {
destinationDirStats = fs.statSync(destinationDir);
} catch {
fail(`Destination directory not found: ${path.relative(projectRoot, destinationDir)}`);
}
if (!destinationDirStats.isDirectory()) {
fail(`Destination parent is not a directory: ${path.relative(projectRoot, destinationDir)}`);
}
try {
fs.copyFileSync(sourcePath, destinationPath);
} catch (error) {
fail(`Copy failed (${sourceInput} -> ${destinationInput}): ${error.message}`);
}
console.log(`Copied ${sourceInput} -> ${destinationInput}`);