add-skill-kit 3.2.6 → 3.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,55 +1,55 @@
1
- /**
2
- * @fileoverview Update command
3
- */
4
-
5
- import fs from "fs";
6
- import path from "path";
7
-
8
- import { resolveScope, createBackup } from "../helpers.js";
9
- import { step, stepLine, S, c, fatal, spinner } from "../ui.js";
10
- import { DRY } from "../config.js";
11
-
12
- /**
13
- * Update a skill
14
- * @param {string} skillName
15
- */
16
- export async function run(skillName) {
17
- if (!skillName) fatal("Missing skill name");
18
-
19
- const scope = resolveScope();
20
- const targetDir = path.join(scope, skillName);
21
-
22
- if (!fs.existsSync(targetDir)) fatal(`Skill not found: ${skillName}`);
23
-
24
- const metaFile = path.join(targetDir, ".skill-source.json");
25
- if (!fs.existsSync(metaFile)) fatal("Skill metadata not found");
26
-
27
- const meta = JSON.parse(fs.readFileSync(metaFile, "utf-8"));
28
- if (!meta.repo || meta.repo === "local") fatal("Cannot update local skill");
29
-
30
- stepLine();
31
-
32
- const s = spinner();
33
- s.start(`Updating ${skillName}`);
34
-
35
- try {
36
- if (!DRY) {
37
- createBackup(targetDir, skillName);
38
- fs.rmSync(targetDir, { recursive: true, force: true });
39
- }
40
-
41
- const spec = `${meta.repo}#${meta.skill}${meta.ref ? "@" + meta.ref : ""}`;
42
-
43
- if (DRY) {
44
- s.stop("Dry run analysis complete");
45
- step(`Would update: ${skillName}`);
46
- } else {
47
- s.stop("Preparing update...");
48
- // Dynamically import install command
49
- const { run: install } = await import("./install.js");
50
- await install(spec);
51
- }
52
- } catch (err) {
53
- s.fail(`Failed: ${err.message}`);
54
- }
55
- }
1
+ /**
2
+ * @fileoverview Update command
3
+ */
4
+
5
+ import fs from "fs";
6
+ import path from "path";
7
+
8
+ import { resolveScope, createBackup } from "../helpers.js";
9
+ import { step, stepLine, S, c, fatal, spinner } from "../ui.js";
10
+ import { DRY } from "../config.js";
11
+
12
+ /**
13
+ * Update a skill
14
+ * @param {string} skillName
15
+ */
16
+ export async function run(skillName) {
17
+ if (!skillName) fatal("Missing skill name");
18
+
19
+ const scope = resolveScope();
20
+ const targetDir = path.join(scope, skillName);
21
+
22
+ if (!fs.existsSync(targetDir)) fatal(`Skill not found: ${skillName}`);
23
+
24
+ const metaFile = path.join(targetDir, ".skill-source.json");
25
+ if (!fs.existsSync(metaFile)) fatal("Skill metadata not found");
26
+
27
+ const meta = JSON.parse(fs.readFileSync(metaFile, "utf-8"));
28
+ if (!meta.repo || meta.repo === "local") fatal("Cannot update local skill");
29
+
30
+ stepLine();
31
+
32
+ const s = spinner();
33
+ s.start(`Updating ${skillName}`);
34
+
35
+ try {
36
+ if (!DRY) {
37
+ createBackup(targetDir, skillName);
38
+ fs.rmSync(targetDir, { recursive: true, force: true });
39
+ }
40
+
41
+ const spec = `${meta.repo}#${meta.skill}${meta.ref ? "@" + meta.ref : ""}`;
42
+
43
+ if (DRY) {
44
+ s.stop("Dry run analysis complete");
45
+ step(`Would update: ${skillName}`);
46
+ } else {
47
+ s.stop("Preparing update...");
48
+ // Dynamically import install command
49
+ const { run: install } = await import("./install.js");
50
+ await install(spec);
51
+ }
52
+ } catch (err) {
53
+ s.fail(`Failed: ${err.message}`);
54
+ }
55
+ }
@@ -1,69 +1,69 @@
1
- /**
2
- * @fileoverview Validate command - Antigravity spec validation
3
- */
4
-
5
- import fs from "fs";
6
- import path from "path";
7
- import { getInstalledSkills, parseSkillMdFrontmatter } from "../skills.js";
8
- import { resolveScope } from "../helpers.js";
9
- import { step, stepLine, S, c, fatal } from "../ui.js";
10
- import { VERBOSE, STRICT } from "../config.js";
11
-
12
- /**
13
- * Validate skills against Antigravity spec
14
- * @param {string} [skillName] - Optional specific skill
15
- */
16
- export async function run(skillName) {
17
- const scope = resolveScope();
18
- let skillsToValidate = [];
19
-
20
- if (skillName) {
21
- const sd = path.join(scope, skillName);
22
- if (!fs.existsSync(sd)) fatal(`Skill not found: ${skillName}`);
23
- skillsToValidate = [{ name: skillName, path: sd }];
24
- } else {
25
- skillsToValidate = getInstalledSkills();
26
- }
27
-
28
- if (skillsToValidate.length === 0) {
29
- stepLine();
30
- step("No skills to validate", S.diamond);
31
- return;
32
- }
33
-
34
- stepLine();
35
- step(c.bold("Antigravity Validation"), S.diamondFilled, "cyan");
36
- stepLine();
37
-
38
- let totalErrors = 0, totalWarnings = 0;
39
-
40
- for (const skill of skillsToValidate) {
41
- const errors = [], warnings = [];
42
- const smp = path.join(skill.path, "SKILL.md");
43
-
44
- if (!fs.existsSync(smp)) {
45
- errors.push("Missing SKILL.md");
46
- } else {
47
- const m = parseSkillMdFrontmatter(smp);
48
- if (!m.description) errors.push("Missing description");
49
- else if (m.description.length < 50) warnings.push("Description too short");
50
- }
51
-
52
- const status = errors.length > 0 ? c.red("FAIL") : warnings.length > 0 ? c.yellow("WARN") : c.green("PASS");
53
- console.log(`${c.gray(S.branch)} ${status} ${c.bold(skill.name)}`);
54
-
55
- if (VERBOSE || errors.length || warnings.length) {
56
- errors.forEach(e => console.log(`${c.gray(S.branch)} ${c.red("ERROR: " + e)}`));
57
- warnings.forEach(w => console.log(`${c.gray(S.branch)} ${c.yellow("WARN: " + w)}`));
58
- }
59
-
60
- totalErrors += errors.length;
61
- totalWarnings += warnings.length;
62
- }
63
-
64
- stepLine();
65
- console.log(`${c.gray(S.branch)} Total: ${skillsToValidate.length}, Errors: ${totalErrors}, Warnings: ${totalWarnings}`);
66
- stepLine();
67
-
68
- if (STRICT && totalErrors > 0) process.exit(1);
69
- }
1
+ /**
2
+ * @fileoverview Validate command - Antigravity spec validation
3
+ */
4
+
5
+ import fs from "fs";
6
+ import path from "path";
7
+ import { getInstalledSkills, parseSkillMdFrontmatter } from "../skills.js";
8
+ import { resolveScope } from "../helpers.js";
9
+ import { step, stepLine, S, c, fatal } from "../ui.js";
10
+ import { VERBOSE, STRICT } from "../config.js";
11
+
12
+ /**
13
+ * Validate skills against Antigravity spec
14
+ * @param {string} [skillName] - Optional specific skill
15
+ */
16
+ export async function run(skillName) {
17
+ const scope = resolveScope();
18
+ let skillsToValidate = [];
19
+
20
+ if (skillName) {
21
+ const sd = path.join(scope, skillName);
22
+ if (!fs.existsSync(sd)) fatal(`Skill not found: ${skillName}`);
23
+ skillsToValidate = [{ name: skillName, path: sd }];
24
+ } else {
25
+ skillsToValidate = getInstalledSkills();
26
+ }
27
+
28
+ if (skillsToValidate.length === 0) {
29
+ stepLine();
30
+ step("No skills to validate", S.diamond);
31
+ return;
32
+ }
33
+
34
+ stepLine();
35
+ step(c.bold("Antigravity Validation"), S.diamondFilled, "cyan");
36
+ stepLine();
37
+
38
+ let totalErrors = 0, totalWarnings = 0;
39
+
40
+ for (const skill of skillsToValidate) {
41
+ const errors = [], warnings = [];
42
+ const smp = path.join(skill.path, "SKILL.md");
43
+
44
+ if (!fs.existsSync(smp)) {
45
+ errors.push("Missing SKILL.md");
46
+ } else {
47
+ const m = parseSkillMdFrontmatter(smp);
48
+ if (!m.description) errors.push("Missing description");
49
+ else if (m.description.length < 50) warnings.push("Description too short");
50
+ }
51
+
52
+ const status = errors.length > 0 ? c.red("FAIL") : warnings.length > 0 ? c.yellow("WARN") : c.green("PASS");
53
+ console.log(`${c.gray(S.branch)} ${status} ${c.bold(skill.name)}`);
54
+
55
+ if (VERBOSE || errors.length || warnings.length) {
56
+ errors.forEach(e => console.log(`${c.gray(S.branch)} ${c.red("ERROR: " + e)}`));
57
+ warnings.forEach(w => console.log(`${c.gray(S.branch)} ${c.yellow("WARN: " + w)}`));
58
+ }
59
+
60
+ totalErrors += errors.length;
61
+ totalWarnings += warnings.length;
62
+ }
63
+
64
+ stepLine();
65
+ console.log(`${c.gray(S.branch)} Total: ${skillsToValidate.length}, Errors: ${totalErrors}, Warnings: ${totalWarnings}`);
66
+ stepLine();
67
+
68
+ if (STRICT && totalErrors > 0) process.exit(1);
69
+ }
@@ -1,56 +1,56 @@
1
- /**
2
- * @fileoverview Verify command - Checksum verification
3
- */
4
-
5
- import fs from "fs";
6
- import path from "path";
7
- import { resolveScope, merkleHash } from "../helpers.js";
8
- import { step, stepLine, S, c } from "../ui.js";
9
- import { STRICT } from "../config.js";
10
-
11
- /**
12
- * Verify skill checksums
13
- */
14
- export async function run() {
15
- const scope = resolveScope();
16
-
17
- if (!fs.existsSync(scope)) {
18
- stepLine();
19
- step("No skills directory found", S.diamond);
20
- return;
21
- }
22
-
23
- stepLine();
24
- step(c.bold("Verifying Skills"), S.diamondFilled, "cyan");
25
- stepLine();
26
-
27
- let issues = 0;
28
-
29
- for (const name of fs.readdirSync(scope)) {
30
- const dir = path.join(scope, name);
31
- if (!fs.statSync(dir).isDirectory()) continue;
32
-
33
- const mf = path.join(dir, ".skill-source.json");
34
- if (!fs.existsSync(mf)) {
35
- step(`${name}: ${c.red("missing metadata")}`, S.cross, "red");
36
- issues++;
37
- continue;
38
- }
39
-
40
- const m = JSON.parse(fs.readFileSync(mf, "utf-8"));
41
- const actual = merkleHash(dir);
42
-
43
- if (actual !== m.checksum) {
44
- step(`${name}: ${c.red("checksum mismatch")}`, S.cross, "red");
45
- issues++;
46
- } else {
47
- step(`${name}: ${c.green("OK")}`, S.check, "green");
48
- }
49
- }
50
-
51
- stepLine();
52
- console.log(`${c.gray(S.branch)} ${issues ? c.red(issues + " issue(s)") : c.green("All verified")}`);
53
- stepLine();
54
-
55
- if (issues && STRICT) process.exit(1);
56
- }
1
+ /**
2
+ * @fileoverview Verify command - Checksum verification
3
+ */
4
+
5
+ import fs from "fs";
6
+ import path from "path";
7
+ import { resolveScope, merkleHash } from "../helpers.js";
8
+ import { step, stepLine, S, c } from "../ui.js";
9
+ import { STRICT } from "../config.js";
10
+
11
+ /**
12
+ * Verify skill checksums
13
+ */
14
+ export async function run() {
15
+ const scope = resolveScope();
16
+
17
+ if (!fs.existsSync(scope)) {
18
+ stepLine();
19
+ step("No skills directory found", S.diamond);
20
+ return;
21
+ }
22
+
23
+ stepLine();
24
+ step(c.bold("Verifying Skills"), S.diamondFilled, "cyan");
25
+ stepLine();
26
+
27
+ let issues = 0;
28
+
29
+ for (const name of fs.readdirSync(scope)) {
30
+ const dir = path.join(scope, name);
31
+ if (!fs.statSync(dir).isDirectory()) continue;
32
+
33
+ const mf = path.join(dir, ".skill-source.json");
34
+ if (!fs.existsSync(mf)) {
35
+ step(`${name}: ${c.red("missing metadata")}`, S.cross, "red");
36
+ issues++;
37
+ continue;
38
+ }
39
+
40
+ const m = JSON.parse(fs.readFileSync(mf, "utf-8"));
41
+ const actual = merkleHash(dir);
42
+
43
+ if (actual !== m.checksum) {
44
+ step(`${name}: ${c.red("checksum mismatch")}`, S.cross, "red");
45
+ issues++;
46
+ } else {
47
+ step(`${name}: ${c.green("OK")}`, S.check, "green");
48
+ }
49
+ }
50
+
51
+ stepLine();
52
+ console.log(`${c.gray(S.branch)} ${issues ? c.red(issues + " issue(s)") : c.green("All verified")}`);
53
+ stepLine();
54
+
55
+ if (issues && STRICT) process.exit(1);
56
+ }
package/bin/lib/config.js CHANGED
@@ -1,81 +1,81 @@
1
- /**
2
- * @fileoverview Configuration and argument parsing
3
- */
4
-
5
- import path from "path";
6
- import os from "os";
7
-
8
- /** Current working directory */
9
- export const cwd = process.cwd();
10
-
11
- /** Local workspace skills directory (configurable via ADD_SKILL_WORKSPACE) */
12
- export const WORKSPACE = process.env.ADD_SKILL_WORKSPACE || path.join(cwd, ".agent", "skills");
13
-
14
- /** Global skills directory (configurable via ADD_SKILL_GLOBAL_DIR) */
15
- export const GLOBAL_DIR = process.env.ADD_SKILL_GLOBAL_DIR || path.join(os.homedir(), ".gemini", "antigravity", "skills");
16
-
17
- /** Cache root directory */
18
- export const CACHE_ROOT = process.env.ADD_SKILL_CACHE_DIR || path.join(os.homedir(), ".cache", "agentskillskit");
19
-
20
- /** Registry cache directory */
21
- export const REGISTRY_CACHE = path.join(CACHE_ROOT, "registries");
22
-
23
- /** Registries file path */
24
- export const REGISTRIES_FILE = path.join(CACHE_ROOT, "registries.json");
25
-
26
- /** Backup directory */
27
- export const BACKUP_DIR = path.join(CACHE_ROOT, "backups");
28
-
29
- // --- Argument Parsing ---
30
-
31
- const args = process.argv.slice(2);
32
-
33
- /** Command name (first non-flag argument) */
34
- export const command = args[0] || "help";
35
-
36
- /** All flags (starting with --) */
37
- export const flags = new Set(args.filter((a) => a.startsWith("--")));
38
-
39
- /** Command parameters (non-flag arguments after command) */
40
- export const params = args.filter((a) => !a.startsWith("--")).slice(1);
41
-
42
- // --- Flag Shortcuts ---
43
-
44
- /** @type {boolean} Use global scope */
45
- export const GLOBAL = flags.has("--global") || flags.has("-g");
46
-
47
- /** @type {boolean} Verbose output */
48
- export const VERBOSE = flags.has("--verbose") || flags.has("-v");
49
-
50
- /** @type {boolean} JSON output mode */
51
- export const JSON_OUTPUT = flags.has("--json");
52
-
53
- /** @type {boolean} Force operation */
54
- export const FORCE = flags.has("--force") || flags.has("-f");
55
-
56
- /** @type {boolean} Dry run mode */
57
- export const DRY = flags.has("--dry-run");
58
-
59
- /** @type {boolean} Auto-fix mode */
60
- export const FIX = flags.has("--fix");
61
-
62
- /** @type {boolean} Strict mode */
63
- export const STRICT = flags.has("--strict");
64
-
65
- /** @type {boolean} Locked mode (install from lockfile) */
66
- export const LOCKED = flags.has("--locked");
67
-
68
- /** @type {boolean} Offline mode (skip network operations) */
69
- export const OFFLINE = flags.has("--offline");
70
-
71
- // --- Package Info ---
72
-
73
- import { createRequire } from "module";
74
- const require = createRequire(import.meta.url);
75
-
76
- /** @type {string} Package version */
77
- export const VERSION = (() => {
78
- try { return require("../../package.json").version; }
79
- catch { return "1.2.0"; }
80
- })();
81
-
1
+ /**
2
+ * @fileoverview Configuration and argument parsing
3
+ */
4
+
5
+ import path from "path";
6
+ import os from "os";
7
+
8
+ /** Current working directory */
9
+ export const cwd = process.cwd();
10
+
11
+ /** Local workspace skills directory (configurable via ADD_SKILL_WORKSPACE) */
12
+ export const WORKSPACE = process.env.ADD_SKILL_WORKSPACE || path.join(cwd, ".agent", "skills");
13
+
14
+ /** Global skills directory (configurable via ADD_SKILL_GLOBAL_DIR) */
15
+ export const GLOBAL_DIR = process.env.ADD_SKILL_GLOBAL_DIR || path.join(os.homedir(), ".gemini", "antigravity", "skills");
16
+
17
+ /** Cache root directory */
18
+ export const CACHE_ROOT = process.env.ADD_SKILL_CACHE_DIR || path.join(os.homedir(), ".cache", "agentskillskit");
19
+
20
+ /** Registry cache directory */
21
+ export const REGISTRY_CACHE = path.join(CACHE_ROOT, "registries");
22
+
23
+ /** Registries file path */
24
+ export const REGISTRIES_FILE = path.join(CACHE_ROOT, "registries.json");
25
+
26
+ /** Backup directory */
27
+ export const BACKUP_DIR = path.join(CACHE_ROOT, "backups");
28
+
29
+ // --- Argument Parsing ---
30
+
31
+ const args = process.argv.slice(2);
32
+
33
+ /** Command name (first non-flag argument) */
34
+ export const command = args[0] || "help";
35
+
36
+ /** All flags (starting with --) */
37
+ export const flags = new Set(args.filter((a) => a.startsWith("--")));
38
+
39
+ /** Command parameters (non-flag arguments after command) */
40
+ export const params = args.filter((a) => !a.startsWith("--")).slice(1);
41
+
42
+ // --- Flag Shortcuts ---
43
+
44
+ /** @type {boolean} Use global scope */
45
+ export const GLOBAL = flags.has("--global") || flags.has("-g");
46
+
47
+ /** @type {boolean} Verbose output */
48
+ export const VERBOSE = flags.has("--verbose") || flags.has("-v");
49
+
50
+ /** @type {boolean} JSON output mode */
51
+ export const JSON_OUTPUT = flags.has("--json");
52
+
53
+ /** @type {boolean} Force operation */
54
+ export const FORCE = flags.has("--force") || flags.has("-f");
55
+
56
+ /** @type {boolean} Dry run mode */
57
+ export const DRY = flags.has("--dry-run");
58
+
59
+ /** @type {boolean} Auto-fix mode */
60
+ export const FIX = flags.has("--fix");
61
+
62
+ /** @type {boolean} Strict mode */
63
+ export const STRICT = flags.has("--strict");
64
+
65
+ /** @type {boolean} Locked mode (install from lockfile) */
66
+ export const LOCKED = flags.has("--locked");
67
+
68
+ /** @type {boolean} Offline mode (skip network operations) */
69
+ export const OFFLINE = flags.has("--offline");
70
+
71
+ // --- Package Info ---
72
+
73
+ import { createRequire } from "module";
74
+ const require = createRequire(import.meta.url);
75
+
76
+ /** @type {string} Package version */
77
+ export const VERSION = (() => {
78
+ try { return require("../../package.json").version; }
79
+ catch { return "1.2.0"; }
80
+ })();
81
+