skilluse 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 (68) hide show
  1. package/README.md +100 -0
  2. package/dist/app.d.ts +6 -0
  3. package/dist/app.js +6 -0
  4. package/dist/cli.d.ts +3 -0
  5. package/dist/cli.js +167 -0
  6. package/dist/commands/demo.d.ts +14 -0
  7. package/dist/commands/demo.js +46 -0
  8. package/dist/commands/index.d.ts +8 -0
  9. package/dist/commands/index.js +77 -0
  10. package/dist/commands/list.d.ts +14 -0
  11. package/dist/commands/list.js +54 -0
  12. package/dist/commands/login.d.ts +14 -0
  13. package/dist/commands/login.js +153 -0
  14. package/dist/commands/logout.d.ts +8 -0
  15. package/dist/commands/logout.js +47 -0
  16. package/dist/commands/repo/add.d.ts +22 -0
  17. package/dist/commands/repo/add.js +139 -0
  18. package/dist/commands/repo/edit.d.ts +19 -0
  19. package/dist/commands/repo/edit.js +117 -0
  20. package/dist/commands/repo/index.d.ts +8 -0
  21. package/dist/commands/repo/index.js +47 -0
  22. package/dist/commands/repo/list.d.ts +8 -0
  23. package/dist/commands/repo/list.js +47 -0
  24. package/dist/commands/repo/remove.d.ts +16 -0
  25. package/dist/commands/repo/remove.js +83 -0
  26. package/dist/commands/repo/sync.d.ts +10 -0
  27. package/dist/commands/repo/sync.js +78 -0
  28. package/dist/commands/repo/use.d.ts +10 -0
  29. package/dist/commands/repo/use.js +56 -0
  30. package/dist/commands/repos.d.ts +11 -0
  31. package/dist/commands/repos.js +50 -0
  32. package/dist/commands/search.d.ts +16 -0
  33. package/dist/commands/search.js +199 -0
  34. package/dist/commands/skills.d.ts +11 -0
  35. package/dist/commands/skills.js +43 -0
  36. package/dist/commands/whoami.d.ts +8 -0
  37. package/dist/commands/whoami.js +69 -0
  38. package/dist/components/CLIError.d.ts +27 -0
  39. package/dist/components/CLIError.js +24 -0
  40. package/dist/components/ProgressBar.d.ts +7 -0
  41. package/dist/components/ProgressBar.js +9 -0
  42. package/dist/components/Select.d.ts +11 -0
  43. package/dist/components/Select.js +6 -0
  44. package/dist/components/Spinner.d.ts +6 -0
  45. package/dist/components/Spinner.js +7 -0
  46. package/dist/components/StatusMessage.d.ts +9 -0
  47. package/dist/components/StatusMessage.js +13 -0
  48. package/dist/components/Table.d.ts +9 -0
  49. package/dist/components/Table.js +27 -0
  50. package/dist/components/TextInput.d.ts +9 -0
  51. package/dist/components/TextInput.js +6 -0
  52. package/dist/components/index.d.ts +8 -0
  53. package/dist/components/index.js +8 -0
  54. package/dist/index.d.ts +3 -0
  55. package/dist/index.js +43815 -0
  56. package/dist/services/credentials.d.ts +69 -0
  57. package/dist/services/credentials.js +216 -0
  58. package/dist/services/index.d.ts +6 -0
  59. package/dist/services/index.js +10 -0
  60. package/dist/services/oauth.d.ts +106 -0
  61. package/dist/services/oauth.js +208 -0
  62. package/dist/services/paths.d.ts +19 -0
  63. package/dist/services/paths.js +21 -0
  64. package/dist/services/store.d.ts +64 -0
  65. package/dist/services/store.js +107 -0
  66. package/dist/services/update.d.ts +20 -0
  67. package/dist/services/update.js +93 -0
  68. package/package.json +70 -0
@@ -0,0 +1,64 @@
1
+ export interface RepoConfig {
2
+ repo: string;
3
+ branch: string;
4
+ paths: string[];
5
+ }
6
+ export interface InstalledSkill {
7
+ name: string;
8
+ repo: string;
9
+ repoPath: string;
10
+ commitSha: string;
11
+ version: string;
12
+ type: string;
13
+ installedPath: string;
14
+ scope: "local" | "global";
15
+ }
16
+ /**
17
+ * Stored installation info (metadata, not secret)
18
+ * Simplified version of the OAuth Installation type
19
+ */
20
+ export interface StoredInstallation {
21
+ id: number;
22
+ account: string;
23
+ accountType: "User" | "Organization";
24
+ repositorySelection: "all" | "selected";
25
+ }
26
+ export interface Config {
27
+ defaultRepo: string | null;
28
+ repos: RepoConfig[];
29
+ installed: InstalledSkill[];
30
+ installations: StoredInstallation[];
31
+ defaultInstallationId: number | null;
32
+ }
33
+ export declare function getConfig(): Config;
34
+ export declare function addRepo(repo: RepoConfig): void;
35
+ export declare function removeRepo(repoName: string): void;
36
+ export declare function setDefaultRepo(repoName: string): void;
37
+ export declare function addInstalledSkill(skill: InstalledSkill): void;
38
+ export declare function removeInstalledSkill(name: string): void;
39
+ /**
40
+ * Store the list of GitHub App installations the user has access to.
41
+ */
42
+ export declare function setInstallations(installations: StoredInstallation[]): void;
43
+ /**
44
+ * Get the list of stored GitHub App installations.
45
+ */
46
+ export declare function getInstallations(): StoredInstallation[];
47
+ /**
48
+ * Set the default installation ID for operations.
49
+ */
50
+ export declare function setDefaultInstallation(installationId: number): void;
51
+ /**
52
+ * Get the default installation ID.
53
+ */
54
+ export declare function getDefaultInstallation(): number | null;
55
+ /**
56
+ * Clear all installation-related data.
57
+ */
58
+ export declare function clearInstallations(): void;
59
+ /**
60
+ * Check if this is a first run (no repos configured).
61
+ * Used to show onboarding flow for new users.
62
+ */
63
+ export declare function isFirstRun(): boolean;
64
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1,107 @@
1
+ import Conf from "conf";
2
+ import { configPath } from "./paths.js";
3
+ const defaultConfig = {
4
+ defaultRepo: null,
5
+ repos: [],
6
+ installed: [],
7
+ installations: [],
8
+ defaultInstallationId: null,
9
+ };
10
+ const store = new Conf({
11
+ projectName: "skilluse",
12
+ cwd: configPath,
13
+ defaults: defaultConfig,
14
+ });
15
+ export function getConfig() {
16
+ return {
17
+ defaultRepo: store.get("defaultRepo"),
18
+ repos: store.get("repos"),
19
+ installed: store.get("installed"),
20
+ installations: store.get("installations"),
21
+ defaultInstallationId: store.get("defaultInstallationId"),
22
+ };
23
+ }
24
+ export function addRepo(repo) {
25
+ const repos = store.get("repos");
26
+ const existingIndex = repos.findIndex((r) => r.repo === repo.repo);
27
+ if (existingIndex >= 0) {
28
+ repos[existingIndex] = repo;
29
+ }
30
+ else {
31
+ repos.push(repo);
32
+ }
33
+ store.set("repos", repos);
34
+ }
35
+ export function removeRepo(repoName) {
36
+ const repos = store.get("repos");
37
+ const filtered = repos.filter((r) => r.repo !== repoName);
38
+ store.set("repos", filtered);
39
+ if (store.get("defaultRepo") === repoName) {
40
+ store.set("defaultRepo", null);
41
+ }
42
+ }
43
+ export function setDefaultRepo(repoName) {
44
+ store.set("defaultRepo", repoName);
45
+ }
46
+ export function addInstalledSkill(skill) {
47
+ const installed = store.get("installed");
48
+ const existingIndex = installed.findIndex((s) => s.name === skill.name);
49
+ if (existingIndex >= 0) {
50
+ installed[existingIndex] = skill;
51
+ }
52
+ else {
53
+ installed.push(skill);
54
+ }
55
+ store.set("installed", installed);
56
+ }
57
+ export function removeInstalledSkill(name) {
58
+ const installed = store.get("installed");
59
+ const filtered = installed.filter((s) => s.name !== name);
60
+ store.set("installed", filtered);
61
+ }
62
+ // ============================================================================
63
+ // GitHub App Installation Management
64
+ // ============================================================================
65
+ /**
66
+ * Store the list of GitHub App installations the user has access to.
67
+ */
68
+ export function setInstallations(installations) {
69
+ store.set("installations", installations);
70
+ }
71
+ /**
72
+ * Get the list of stored GitHub App installations.
73
+ */
74
+ export function getInstallations() {
75
+ return store.get("installations");
76
+ }
77
+ /**
78
+ * Set the default installation ID for operations.
79
+ */
80
+ export function setDefaultInstallation(installationId) {
81
+ store.set("defaultInstallationId", installationId);
82
+ }
83
+ /**
84
+ * Get the default installation ID.
85
+ */
86
+ export function getDefaultInstallation() {
87
+ return store.get("defaultInstallationId");
88
+ }
89
+ /**
90
+ * Clear all installation-related data.
91
+ */
92
+ export function clearInstallations() {
93
+ store.set("installations", []);
94
+ store.set("defaultInstallationId", null);
95
+ }
96
+ // ============================================================================
97
+ // First-Run Detection
98
+ // ============================================================================
99
+ /**
100
+ * Check if this is a first run (no repos configured).
101
+ * Used to show onboarding flow for new users.
102
+ */
103
+ export function isFirstRun() {
104
+ const repos = store.get("repos");
105
+ return repos.length === 0;
106
+ }
107
+ //# sourceMappingURL=store.js.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Update notification service.
3
+ * Checks npm registry for newer versions with daily caching.
4
+ */
5
+ export interface UpdateInfo {
6
+ currentVersion: string;
7
+ latestVersion: string;
8
+ hasUpdate: boolean;
9
+ }
10
+ /**
11
+ * Check if a newer version is available.
12
+ * Uses cached result if checked within the last 24 hours.
13
+ * Returns null if check fails or is cached.
14
+ */
15
+ export declare function checkForUpdate(): Promise<UpdateInfo | null>;
16
+ /**
17
+ * Get the current CLI version.
18
+ */
19
+ export declare function getCurrentVersion(): string;
20
+ //# sourceMappingURL=update.d.ts.map
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Update notification service.
3
+ * Checks npm registry for newer versions with daily caching.
4
+ */
5
+ import Conf from "conf";
6
+ import { configPath } from "./paths.js";
7
+ import pkg from "../../package.json" with { type: "json" };
8
+ // Current version from package.json
9
+ const CURRENT_VERSION = pkg.version;
10
+ // Cache check for 24 hours (in milliseconds)
11
+ const CACHE_DURATION = 24 * 60 * 60 * 1000;
12
+ const cache = new Conf({
13
+ projectName: "skilluse-update",
14
+ cwd: configPath,
15
+ defaults: {
16
+ lastCheck: 0,
17
+ latestVersion: null,
18
+ },
19
+ });
20
+ /**
21
+ * Check if a newer version is available.
22
+ * Uses cached result if checked within the last 24 hours.
23
+ * Returns null if check fails or is cached.
24
+ */
25
+ export async function checkForUpdate() {
26
+ const lastCheck = cache.get("lastCheck");
27
+ const cachedVersion = cache.get("latestVersion");
28
+ const now = Date.now();
29
+ // Return cached result if still valid
30
+ if (lastCheck && now - lastCheck < CACHE_DURATION && cachedVersion) {
31
+ return {
32
+ currentVersion: CURRENT_VERSION,
33
+ latestVersion: cachedVersion,
34
+ hasUpdate: compareVersions(cachedVersion, CURRENT_VERSION) > 0,
35
+ };
36
+ }
37
+ // Fetch latest version from npm (non-blocking)
38
+ try {
39
+ const controller = new AbortController();
40
+ const timeout = setTimeout(() => controller.abort(), 3000); // 3 second timeout
41
+ const response = await fetch("https://registry.npmjs.org/skilluse/latest", {
42
+ signal: controller.signal,
43
+ headers: {
44
+ Accept: "application/json",
45
+ },
46
+ });
47
+ clearTimeout(timeout);
48
+ if (!response.ok) {
49
+ // Package might not be published yet - cache null result
50
+ cache.set("lastCheck", now);
51
+ cache.set("latestVersion", null);
52
+ return null;
53
+ }
54
+ const data = (await response.json());
55
+ const latestVersion = data.version;
56
+ // Cache the result
57
+ cache.set("lastCheck", now);
58
+ cache.set("latestVersion", latestVersion);
59
+ return {
60
+ currentVersion: CURRENT_VERSION,
61
+ latestVersion,
62
+ hasUpdate: compareVersions(latestVersion, CURRENT_VERSION) > 0,
63
+ };
64
+ }
65
+ catch {
66
+ // Network error or timeout - don't cache, try again next time
67
+ return null;
68
+ }
69
+ }
70
+ /**
71
+ * Compare two semver versions.
72
+ * Returns: 1 if a > b, -1 if a < b, 0 if equal
73
+ */
74
+ function compareVersions(a, b) {
75
+ const partsA = a.split(".").map(Number);
76
+ const partsB = b.split(".").map(Number);
77
+ for (let i = 0; i < 3; i++) {
78
+ const numA = partsA[i] || 0;
79
+ const numB = partsB[i] || 0;
80
+ if (numA > numB)
81
+ return 1;
82
+ if (numA < numB)
83
+ return -1;
84
+ }
85
+ return 0;
86
+ }
87
+ /**
88
+ * Get the current CLI version.
89
+ */
90
+ export function getCurrentVersion() {
91
+ return CURRENT_VERSION;
92
+ }
93
+ //# sourceMappingURL=update.js.map
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "skilluse",
3
+ "version": "0.1.0",
4
+ "description": "CLI tool for managing and installing AI Coding Agent Skills",
5
+ "main": "dist/index.js",
6
+ "bin": {
7
+ "skilluse": "./dist/index.js"
8
+ },
9
+ "files": [
10
+ "dist/**/*.js",
11
+ "dist/**/*.d.ts",
12
+ "README.md"
13
+ ],
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/jiweiyuan/skilluse.git",
17
+ "directory": "packages/cli"
18
+ },
19
+ "homepage": "https://github.com/jiweiyuan/skilluse",
20
+ "bugs": {
21
+ "url": "https://github.com/jiweiyuan/skilluse/issues"
22
+ },
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "scripts": {
27
+ "dev": "bun --watch src/index.tsx",
28
+ "build": "bun build src/index.tsx --outdir dist --target node --external react-devtools-core",
29
+ "build:bin": "bun build src/cli.tsx --compile --minify --sourcemap --define 'process.env.DEV=\"false\"' --outfile dist/skilluse",
30
+ "build:all": "bun run scripts/build-all.ts",
31
+ "typecheck": "tsc --noEmit",
32
+ "format": "biome format --write .",
33
+ "lint": "biome lint .",
34
+ "check": "biome check .",
35
+ "start": "bun dist/index.js",
36
+ "prepublishOnly": "bun run build"
37
+ },
38
+ "keywords": [
39
+ "cli",
40
+ "skills",
41
+ "claude-code",
42
+ "codex",
43
+ "ai-agent"
44
+ ],
45
+ "author": "",
46
+ "license": "MIT",
47
+ "dependencies": {
48
+ "conf": "^15.0.2",
49
+ "env-paths": "^3.0.0",
50
+ "figures": "^6.1.0",
51
+ "ink": "^5.2.1",
52
+ "ink-select-input": "^6.2.0",
53
+ "ink-spinner": "^5.0.0",
54
+ "ink-text-input": "^6.0.0",
55
+ "pastel": "^2.0.0",
56
+ "react": "^18.2.0",
57
+ "zod": "^3.22.4"
58
+ },
59
+ "devDependencies": {
60
+ "@biomejs/biome": "^2.3.10",
61
+ "@types/node": "^22.10.2",
62
+ "@types/react": "^18.2.45",
63
+ "react-devtools-core": "^7.0.1",
64
+ "typescript": "^5.7.2"
65
+ },
66
+ "engines": {
67
+ "node": ">=18.0.0"
68
+ },
69
+ "type": "module"
70
+ }