skillex 0.2.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.
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Global user configuration for the Skillex CLI.
3
+ *
4
+ * Reads and writes `~/.askillrc.json`. CLI flags and environment variables
5
+ * always take precedence over values stored here.
6
+ */
7
+ import * as fs from "node:fs/promises";
8
+ import * as os from "node:os";
9
+ import * as path from "node:path";
10
+ /** Valid keys that may be set via `skillex config set`. */
11
+ export const VALID_CONFIG_KEYS = [
12
+ "defaultRepo",
13
+ "defaultAdapter",
14
+ "githubToken",
15
+ "disableAutoSync",
16
+ ];
17
+ /**
18
+ * Resolves the path to the global config file.
19
+ *
20
+ * Respects `XDG_CONFIG_HOME` when set; otherwise uses `~/.askillrc.json`.
21
+ */
22
+ export function getUserConfigPath() {
23
+ const xdg = process.env.XDG_CONFIG_HOME;
24
+ if (xdg) {
25
+ return path.join(xdg, "skillex", "config.json");
26
+ }
27
+ return path.join(os.homedir(), ".askillrc.json");
28
+ }
29
+ /**
30
+ * Reads the global user configuration file.
31
+ *
32
+ * Returns an empty object when the file does not exist or is invalid JSON.
33
+ */
34
+ export async function readUserConfig() {
35
+ try {
36
+ const content = await fs.readFile(getUserConfigPath(), "utf-8");
37
+ return JSON.parse(content);
38
+ }
39
+ catch {
40
+ return {};
41
+ }
42
+ }
43
+ /**
44
+ * Writes the global user configuration file, merging with any existing values.
45
+ *
46
+ * @param updates - Key/value pairs to write.
47
+ */
48
+ export async function writeUserConfig(updates) {
49
+ const configPath = getUserConfigPath();
50
+ const existing = await readUserConfig();
51
+ const merged = { ...existing, ...updates };
52
+ await fs.mkdir(path.dirname(configPath), { recursive: true });
53
+ await fs.writeFile(configPath, JSON.stringify(merged, null, 2) + "\n", "utf-8");
54
+ }
package/package.json ADDED
@@ -0,0 +1,93 @@
1
+ {
2
+ "name": "skillex",
3
+ "version": "0.2.0",
4
+ "description": "CLI to list, install, and synchronize AI agent skills from GitHub-hosted catalogs.",
5
+ "type": "module",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/lgili/skillex.git"
9
+ },
10
+ "homepage": "https://github.com/lgili/skillex#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/lgili/skillex/issues"
13
+ },
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "files": [
18
+ "bin",
19
+ "dist",
20
+ "README.md",
21
+ "CHANGELOG.md"
22
+ ],
23
+ "exports": {
24
+ "./package.json": "./package.json",
25
+ "./adapters": {
26
+ "types": "./dist/adapters.d.ts",
27
+ "import": "./dist/adapters.js"
28
+ },
29
+ "./catalog": {
30
+ "types": "./dist/catalog.d.ts",
31
+ "import": "./dist/catalog.js"
32
+ },
33
+ "./cli": {
34
+ "types": "./dist/cli.d.ts",
35
+ "import": "./dist/cli.js"
36
+ },
37
+ "./config": {
38
+ "types": "./dist/config.d.ts",
39
+ "import": "./dist/config.js"
40
+ },
41
+ "./fs": {
42
+ "types": "./dist/fs.d.ts",
43
+ "import": "./dist/fs.js"
44
+ },
45
+ "./http": {
46
+ "types": "./dist/http.d.ts",
47
+ "import": "./dist/http.js"
48
+ },
49
+ "./install": {
50
+ "types": "./dist/install.d.ts",
51
+ "import": "./dist/install.js"
52
+ },
53
+ "./sync": {
54
+ "types": "./dist/sync.d.ts",
55
+ "import": "./dist/sync.js"
56
+ },
57
+ "./types": {
58
+ "types": "./dist/types.d.ts",
59
+ "import": "./dist/types.js"
60
+ }
61
+ },
62
+ "bin": {
63
+ "skillex": "bin/skillex.js"
64
+ },
65
+ "scripts": {
66
+ "build": "tsc -p tsconfig.json",
67
+ "build:test": "tsc -p tsconfig.test.json",
68
+ "typecheck": "tsc --noEmit -p tsconfig.json",
69
+ "start": "npm run build && node ./bin/skillex.js",
70
+ "test": "npm run build:test && node --test .test-dist/test/*.test.js",
71
+ "prepublishOnly": "npm run build && npm test"
72
+ },
73
+ "engines": {
74
+ "node": ">=20.0.0"
75
+ },
76
+ "keywords": [
77
+ "agent-skills",
78
+ "cli",
79
+ "github",
80
+ "skillex",
81
+ "codex",
82
+ "copilot",
83
+ "cursor"
84
+ ],
85
+ "dependencies": {
86
+ "@inquirer/prompts": "^7.9.0"
87
+ },
88
+ "devDependencies": {
89
+ "@types/node": "^24.6.0",
90
+ "typescript": "^5.9.3"
91
+ },
92
+ "license": "MIT"
93
+ }