@valiron/skill 0.1.0

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.
Files changed (2) hide show
  1. package/bin/cli.mjs +91 -0
  2. package/package.json +30 -0
package/bin/cli.mjs ADDED
@@ -0,0 +1,91 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { createInterface } from "node:readline/promises";
4
+ import { get } from "node:https";
5
+ import { writeFileSync, mkdirSync, existsSync } from "node:fs";
6
+ import { dirname, resolve } from "node:path";
7
+
8
+ const SKILL_URL = "https://valiron.co/skill/SKILL.md";
9
+
10
+ // Claude Code uses a directory with SKILL.md (official Claude Skills format).
11
+ // Other platforms get the same file placed at their expected path.
12
+ const PLATFORMS = [
13
+ { key: "1", name: "Claude Code", path: ".claude/skills/valiron/SKILL.md" },
14
+ { key: "2", name: "GitHub Copilot", path: ".github/copilot-instructions.md" },
15
+ { key: "3", name: "Cursor", path: ".cursor/rules/valiron.mdc" },
16
+ { key: "4", name: "Windsurf", path: ".windsurfrules" },
17
+ { key: "5", name: "Generic (AGENTS.md)", path: "AGENTS.md" },
18
+ ];
19
+
20
+ function fetchURL(url) {
21
+ return new Promise((res, rej) => {
22
+ get(url, (resp) => {
23
+ if (resp.statusCode !== 200) {
24
+ rej(new Error(`HTTP ${resp.statusCode} fetching ${url}`));
25
+ return;
26
+ }
27
+ let data = "";
28
+ resp.on("data", (chunk) => (data += chunk));
29
+ resp.on("end", () => res(data));
30
+ }).on("error", rej);
31
+ });
32
+ }
33
+
34
+ function write(dest, content) {
35
+ const dir = dirname(dest);
36
+ if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
37
+ writeFileSync(dest, content, "utf-8");
38
+ }
39
+
40
+ async function main() {
41
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
42
+
43
+ console.log("\n Valiron — Install Agent Skill\n");
44
+ console.log(" Which AI coding assistant are you using?\n");
45
+
46
+ for (const p of PLATFORMS) {
47
+ console.log(` ${p.key}) ${p.name} → ${p.path}`);
48
+ }
49
+
50
+ console.log();
51
+ const answer = await rl.question(" Pick a platform (1-5): ");
52
+ rl.close();
53
+
54
+ const platform = PLATFORMS.find((p) => p.key === answer.trim());
55
+ if (!platform) {
56
+ console.error("\n Invalid selection. Exiting.\n");
57
+ process.exit(1);
58
+ }
59
+
60
+ const dest = resolve(process.cwd(), platform.path);
61
+
62
+ if (existsSync(dest)) {
63
+ const rl2 = createInterface({ input: process.stdin, output: process.stdout });
64
+ const overwrite = await rl2.question(`\n ${platform.path} already exists. Overwrite? (y/N): `);
65
+ rl2.close();
66
+ if (overwrite.trim().toLowerCase() !== "y") {
67
+ console.log("\n Aborted.\n");
68
+ process.exit(0);
69
+ }
70
+ }
71
+
72
+ console.log("\n Fetching skill from valiron.co...");
73
+
74
+ let content = await fetchURL(SKILL_URL);
75
+
76
+ // Strip YAML frontmatter for non-Claude platforms (they don't use it)
77
+ if (platform.key !== "1") {
78
+ content = content.replace(/^---\n[\s\S]*?\n---\n+/, "");
79
+ }
80
+
81
+ write(dest, content);
82
+
83
+ console.log(` ✓ Installed to ${platform.path}`);
84
+ console.log(`\n Your AI coding assistant will now use Valiron context when writing code.`);
85
+ console.log(` Run \`npx @valiron/skill\` again to update or switch platforms.\n`);
86
+ }
87
+
88
+ main().catch((err) => {
89
+ console.error(`\n Error: ${err.message}\n`);
90
+ process.exit(1);
91
+ });
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@valiron/skill",
3
+ "version": "0.1.0",
4
+ "description": "Install Valiron agent skill into your project for any AI coding assistant",
5
+ "bin": {
6
+ "valiron-skill": "./bin/cli.mjs"
7
+ },
8
+ "files": [
9
+ "bin/"
10
+ ],
11
+ "keywords": [
12
+ "valiron",
13
+ "ai-agent",
14
+ "trust",
15
+ "reputation",
16
+ "copilot",
17
+ "cursor",
18
+ "claude",
19
+ "skill"
20
+ ],
21
+ "license": "MIT",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "https://github.com/vatsashah45/Valiron.git",
25
+ "directory": "packages/skill"
26
+ },
27
+ "engines": {
28
+ "node": ">=18"
29
+ }
30
+ }