skilld 2.3.0 → 3.0.0-beta.2
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.
- package/README.md +142 -353
- package/bin/skilld.mjs +56 -0
- package/loader/resolve-artifact.mjs +37 -0
- package/package.json +28 -55
- package/dist/_chunks/add.mjs +0 -95
- package/dist/_chunks/add.mjs.map +0 -1
- package/dist/_chunks/agent-prompt.mjs +0 -90
- package/dist/_chunks/agent-prompt.mjs.map +0 -1
- package/dist/_chunks/agent.mjs +0 -1817
- package/dist/_chunks/agent.mjs.map +0 -1
- package/dist/_chunks/args.mjs +0 -49
- package/dist/_chunks/args.mjs.map +0 -1
- package/dist/_chunks/assemble.mjs +0 -126
- package/dist/_chunks/assemble.mjs.map +0 -1
- package/dist/_chunks/author.mjs +0 -432
- package/dist/_chunks/author.mjs.map +0 -1
- package/dist/_chunks/cache.mjs +0 -367
- package/dist/_chunks/cache.mjs.map +0 -1
- package/dist/_chunks/cache2.mjs +0 -151
- package/dist/_chunks/cache2.mjs.map +0 -1
- package/dist/_chunks/changes-digest.mjs +0 -49
- package/dist/_chunks/changes-digest.mjs.map +0 -1
- package/dist/_chunks/changes.mjs +0 -23
- package/dist/_chunks/changes.mjs.map +0 -1
- package/dist/_chunks/client.mjs +0 -182
- package/dist/_chunks/client.mjs.map +0 -1
- package/dist/_chunks/core.mjs +0 -13
- package/dist/_chunks/detect.mjs +0 -614
- package/dist/_chunks/detect.mjs.map +0 -1
- package/dist/_chunks/detect2.mjs +0 -2
- package/dist/_chunks/eject.mjs +0 -69
- package/dist/_chunks/eject.mjs.map +0 -1
- package/dist/_chunks/embedding-cache.mjs +0 -2
- package/dist/_chunks/embedding-cache2.mjs +0 -61
- package/dist/_chunks/embedding-cache2.mjs.map +0 -1
- package/dist/_chunks/env.mjs +0 -19
- package/dist/_chunks/env.mjs.map +0 -1
- package/dist/_chunks/index-identity.mjs +0 -365
- package/dist/_chunks/index-identity.mjs.map +0 -1
- package/dist/_chunks/index-identity2.mjs +0 -2
- package/dist/_chunks/install-many.mjs +0 -542
- package/dist/_chunks/install-many.mjs.map +0 -1
- package/dist/_chunks/install.mjs +0 -259
- package/dist/_chunks/install.mjs.map +0 -1
- package/dist/_chunks/intro.mjs +0 -63
- package/dist/_chunks/intro.mjs.map +0 -1
- package/dist/_chunks/list.mjs +0 -102
- package/dist/_chunks/list.mjs.map +0 -1
- package/dist/_chunks/lockfile.mjs +0 -174
- package/dist/_chunks/lockfile.mjs.map +0 -1
- package/dist/_chunks/login.mjs +0 -247
- package/dist/_chunks/login.mjs.map +0 -1
- package/dist/_chunks/logout.mjs +0 -27
- package/dist/_chunks/logout.mjs.map +0 -1
- package/dist/_chunks/map.mjs +0 -11
- package/dist/_chunks/map.mjs.map +0 -1
- package/dist/_chunks/markdown.mjs +0 -101
- package/dist/_chunks/markdown.mjs.map +0 -1
- package/dist/_chunks/menu.mjs +0 -33
- package/dist/_chunks/menu.mjs.map +0 -1
- package/dist/_chunks/model-picker.mjs +0 -61
- package/dist/_chunks/model-picker.mjs.map +0 -1
- package/dist/_chunks/monorepo.mjs +0 -74
- package/dist/_chunks/monorepo.mjs.map +0 -1
- package/dist/_chunks/package-json.mjs +0 -84
- package/dist/_chunks/package-json.mjs.map +0 -1
- package/dist/_chunks/paths.mjs +0 -47
- package/dist/_chunks/paths.mjs.map +0 -1
- package/dist/_chunks/pipeline.mjs +0 -993
- package/dist/_chunks/pipeline.mjs.map +0 -1
- package/dist/_chunks/pool.mjs +0 -2
- package/dist/_chunks/pool2.mjs +0 -121
- package/dist/_chunks/pool2.mjs.map +0 -1
- package/dist/_chunks/portable.mjs +0 -152
- package/dist/_chunks/portable.mjs.map +0 -1
- package/dist/_chunks/prepare-hook.mjs +0 -2
- package/dist/_chunks/prepare-hook2.mjs +0 -61
- package/dist/_chunks/prepare-hook2.mjs.map +0 -1
- package/dist/_chunks/prepare.mjs +0 -113
- package/dist/_chunks/prepare.mjs.map +0 -1
- package/dist/_chunks/prepare2.mjs +0 -80
- package/dist/_chunks/prepare2.mjs.map +0 -1
- package/dist/_chunks/prompts.mjs +0 -1252
- package/dist/_chunks/prompts.mjs.map +0 -1
- package/dist/_chunks/pull.mjs +0 -190
- package/dist/_chunks/pull.mjs.map +0 -1
- package/dist/_chunks/regex.mjs +0 -19
- package/dist/_chunks/regex.mjs.map +0 -1
- package/dist/_chunks/retriv.mjs +0 -2
- package/dist/_chunks/retriv2.mjs +0 -177
- package/dist/_chunks/retriv2.mjs.map +0 -1
- package/dist/_chunks/sanitize.mjs +0 -260
- package/dist/_chunks/sanitize.mjs.map +0 -1
- package/dist/_chunks/search-helpers.mjs +0 -88
- package/dist/_chunks/search-helpers.mjs.map +0 -1
- package/dist/_chunks/search-interactive.mjs +0 -249
- package/dist/_chunks/search-interactive.mjs.map +0 -1
- package/dist/_chunks/search.mjs +0 -247
- package/dist/_chunks/search.mjs.map +0 -1
- package/dist/_chunks/semver.mjs +0 -2831
- package/dist/_chunks/semver.mjs.map +0 -1
- package/dist/_chunks/skill-installer.mjs +0 -2
- package/dist/_chunks/skill-installer2.mjs +0 -163
- package/dist/_chunks/skill-installer2.mjs.map +0 -1
- package/dist/_chunks/skills.mjs +0 -187
- package/dist/_chunks/skills.mjs.map +0 -1
- package/dist/_chunks/store.mjs +0 -107
- package/dist/_chunks/store.mjs.map +0 -1
- package/dist/_chunks/sync.mjs +0 -1009
- package/dist/_chunks/sync.mjs.map +0 -1
- package/dist/_chunks/sync2.mjs +0 -2
- package/dist/_chunks/telemetry.mjs +0 -26
- package/dist/_chunks/telemetry.mjs.map +0 -1
- package/dist/_chunks/uninstall.mjs +0 -214
- package/dist/_chunks/uninstall.mjs.map +0 -1
- package/dist/_chunks/update.mjs +0 -133
- package/dist/_chunks/update.mjs.map +0 -1
- package/dist/_chunks/upload.mjs +0 -155
- package/dist/_chunks/upload.mjs.map +0 -1
- package/dist/_chunks/validate.mjs +0 -60
- package/dist/_chunks/validate.mjs.map +0 -1
- package/dist/_chunks/version.mjs +0 -19
- package/dist/_chunks/version.mjs.map +0 -1
- package/dist/_chunks/watch.mjs +0 -2
- package/dist/_chunks/watch2.mjs +0 -118
- package/dist/_chunks/watch2.mjs.map +0 -1
- package/dist/_chunks/whoami.mjs +0 -21
- package/dist/_chunks/whoami.mjs.map +0 -1
- package/dist/_chunks/wizard.mjs +0 -2
- package/dist/_chunks/wizard2.mjs +0 -200
- package/dist/_chunks/wizard2.mjs.map +0 -1
- package/dist/_chunks/yaml.mjs +0 -33
- package/dist/_chunks/yaml.mjs.map +0 -1
- package/dist/cli-entry.d.mts +0 -1
- package/dist/cli-entry.mjs +0 -5
- package/dist/cli-entry.mjs.map +0 -1
- package/dist/cli.d.mts +0 -1
- package/dist/cli.mjs +0 -1330
- package/dist/cli.mjs.map +0 -1
- package/dist/prepare.d.mts +0 -1
- package/dist/prepare.mjs +0 -84
- package/dist/prepare.mjs.map +0 -1
- package/dist/retriv/worker.d.mts +0 -37
- package/dist/retriv/worker.d.mts.map +0 -1
- package/dist/retriv/worker.mjs +0 -46
- package/dist/retriv/worker.mjs.map +0 -1
package/dist/_chunks/upload.mjs
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import { parseFrontmatter } from "./markdown.mjs";
|
|
2
|
-
import { readLock } from "./lockfile.mjs";
|
|
3
|
-
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
4
|
-
import { multiselect } from "@clack/prompts";
|
|
5
|
-
import { defineCommand } from "citty";
|
|
6
|
-
import { join } from "pathe";
|
|
7
|
-
import { homedir } from "node:os";
|
|
8
|
-
import { ofetch } from "ofetch";
|
|
9
|
-
import { colorize } from "consola/utils";
|
|
10
|
-
const UPLOAD_URL = "https://skilld.dev/api/collections/import";
|
|
11
|
-
function readSkillsFromDir(dir, source, extraLockDirs) {
|
|
12
|
-
if (!existsSync(dir)) return [];
|
|
13
|
-
let lock = readLock(dir);
|
|
14
|
-
if (!lock && extraLockDirs) for (const d of extraLockDirs) {
|
|
15
|
-
lock = readLock(d);
|
|
16
|
-
if (lock) break;
|
|
17
|
-
}
|
|
18
|
-
const entries = readdirSync(dir).filter((f) => {
|
|
19
|
-
if (f.startsWith(".") || f.endsWith(".yaml") || f.endsWith(".yml")) return false;
|
|
20
|
-
const full = join(dir, f);
|
|
21
|
-
return statSync(full).isDirectory();
|
|
22
|
-
});
|
|
23
|
-
const skills = [];
|
|
24
|
-
for (const dirName of entries) {
|
|
25
|
-
const skillMd = join(dir, dirName, "SKILL.md");
|
|
26
|
-
if (!existsSync(skillMd)) continue;
|
|
27
|
-
const content = readFileSync(skillMd, "utf-8");
|
|
28
|
-
const fm = parseFrontmatter(content);
|
|
29
|
-
const lockInfo = lock?.skills[dirName];
|
|
30
|
-
skills.push({
|
|
31
|
-
name: fm.name || dirName,
|
|
32
|
-
description: fm.description,
|
|
33
|
-
version: fm.version || lockInfo?.version,
|
|
34
|
-
repo: lockInfo?.repo,
|
|
35
|
-
generator: lockInfo?.generator,
|
|
36
|
-
source
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
return skills;
|
|
40
|
-
}
|
|
41
|
-
function readPlugins(configDir) {
|
|
42
|
-
const settingsPath = join(configDir, "settings.json");
|
|
43
|
-
if (!existsSync(settingsPath)) return [];
|
|
44
|
-
const enabledPlugins = JSON.parse(readFileSync(settingsPath, "utf-8")).enabledPlugins;
|
|
45
|
-
if (!enabledPlugins) return [];
|
|
46
|
-
const marketplacesPath = join(configDir, "plugins", "known_marketplaces.json");
|
|
47
|
-
const marketplaces = existsSync(marketplacesPath) ? JSON.parse(readFileSync(marketplacesPath, "utf-8")) : {};
|
|
48
|
-
const installedPath = join(configDir, "plugins", "installed_plugins.json");
|
|
49
|
-
const installed = existsSync(installedPath) ? JSON.parse(readFileSync(installedPath, "utf-8")) : { plugins: {} };
|
|
50
|
-
return Object.entries(enabledPlugins).filter(([, enabled]) => enabled).map(([id]) => {
|
|
51
|
-
const marketplace = id.split("@")[1];
|
|
52
|
-
const pluginName = id.split("@")[0];
|
|
53
|
-
const repo = (marketplace ? marketplaces[marketplace] : void 0)?.source?.repo;
|
|
54
|
-
const versions = installed.plugins[id];
|
|
55
|
-
return {
|
|
56
|
-
name: pluginName,
|
|
57
|
-
version: versions?.[0]?.version !== "unknown" ? versions?.[0]?.version : void 0,
|
|
58
|
-
repo: repo ? `${repo}` : void 0,
|
|
59
|
-
source: "plugin"
|
|
60
|
-
};
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
function discoverAllSkills(cwd) {
|
|
64
|
-
const claudeHome = process.env.CLAUDE_CONFIG_DIR || join(homedir(), ".claude");
|
|
65
|
-
const localDir = join(cwd, ".claude", "skills");
|
|
66
|
-
const globalDir = join(claudeHome, "skills");
|
|
67
|
-
const skilldGlobalDir = join(homedir(), ".skilld", "skills");
|
|
68
|
-
const local = readSkillsFromDir(localDir, "local");
|
|
69
|
-
const global = readSkillsFromDir(globalDir, "global", [skilldGlobalDir]);
|
|
70
|
-
const plugins = readPlugins(claudeHome);
|
|
71
|
-
const seenRepos = /* @__PURE__ */ new Set();
|
|
72
|
-
const all = [];
|
|
73
|
-
for (const skill of [
|
|
74
|
-
...local,
|
|
75
|
-
...global,
|
|
76
|
-
...plugins
|
|
77
|
-
]) {
|
|
78
|
-
if (!skill.repo || seenRepos.has(skill.repo)) continue;
|
|
79
|
-
if (skill.generator === "skilld") continue;
|
|
80
|
-
seenRepos.add(skill.repo);
|
|
81
|
-
all.push(skill);
|
|
82
|
-
}
|
|
83
|
-
return all;
|
|
84
|
-
}
|
|
85
|
-
const SOURCE_COLORS = {
|
|
86
|
-
local: "green",
|
|
87
|
-
global: "blue",
|
|
88
|
-
plugin: "magenta"
|
|
89
|
-
};
|
|
90
|
-
async function uploadCommand(options) {
|
|
91
|
-
const skills = discoverAllSkills(process.cwd());
|
|
92
|
-
if (skills.length === 0) {
|
|
93
|
-
process.stdout.write("No skills found.\n");
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
if (options?.dryRun) {
|
|
97
|
-
process.stdout.write(`Found ${colorize("bold", String(skills.length))} skill${skills.length === 1 ? "" : "s"}:\n\n`);
|
|
98
|
-
for (const skill of skills) {
|
|
99
|
-
const version = skill.version ? colorize("dim", ` v${skill.version}`) : "";
|
|
100
|
-
const tag = colorize(SOURCE_COLORS[skill.source] || "dim", skill.source);
|
|
101
|
-
const repo = skill.repo ? colorize("dim", ` github.com/${skill.repo}`) : "";
|
|
102
|
-
process.stdout.write(` ${colorize("cyan", skill.name)}${version} ${tag}${repo}\n`);
|
|
103
|
-
}
|
|
104
|
-
process.stdout.write(`\n${colorize("dim", "Dry run complete. No requests were made.")}\n`);
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
const selected = await multiselect({
|
|
108
|
-
message: `Select skills to upload (${skills.length} found)`,
|
|
109
|
-
options: skills.map((s) => {
|
|
110
|
-
const version = s.version ? ` v${s.version}` : "";
|
|
111
|
-
const repo = s.repo ? ` github.com/${s.repo}` : "";
|
|
112
|
-
return {
|
|
113
|
-
value: s.name,
|
|
114
|
-
label: `${s.name}${version}`,
|
|
115
|
-
hint: `${s.source}${repo}`
|
|
116
|
-
};
|
|
117
|
-
}),
|
|
118
|
-
initialValues: []
|
|
119
|
-
});
|
|
120
|
-
if (typeof selected === "symbol" || selected.length === 0) return;
|
|
121
|
-
const selectedSet = new Set(selected);
|
|
122
|
-
const payload = skills.filter((s) => selectedSet.has(s.name)).map((s) => ({
|
|
123
|
-
name: s.name,
|
|
124
|
-
version: s.version,
|
|
125
|
-
repo: s.repo,
|
|
126
|
-
source: s.source
|
|
127
|
-
}));
|
|
128
|
-
const { token, expires } = await ofetch(UPLOAD_URL, {
|
|
129
|
-
method: "POST",
|
|
130
|
-
body: { skills: payload }
|
|
131
|
-
});
|
|
132
|
-
const expiresDate = new Date(expires);
|
|
133
|
-
const minutesLeft = Math.round((expiresDate.getTime() - Date.now()) / 6e4);
|
|
134
|
-
process.stdout.write(`\nToken: ${colorize("green", token)}\n\n`);
|
|
135
|
-
process.stdout.write(`Paste this token at: ${colorize("cyan", "https://skilld.dev/people/YOUR_HANDLE/edit-skills")}\n`);
|
|
136
|
-
process.stdout.write(colorize("dim", `Token expires in ${minutesLeft} minutes.\n`));
|
|
137
|
-
}
|
|
138
|
-
const uploadCommandDef = defineCommand({
|
|
139
|
-
meta: {
|
|
140
|
-
name: "publish",
|
|
141
|
-
description: "Publish your skill list to skilld.dev"
|
|
142
|
-
},
|
|
143
|
-
args: { dryRun: {
|
|
144
|
-
type: "boolean",
|
|
145
|
-
alias: "d",
|
|
146
|
-
description: "Show what would be uploaded without making any requests",
|
|
147
|
-
default: false
|
|
148
|
-
} },
|
|
149
|
-
run({ args }) {
|
|
150
|
-
return uploadCommand({ dryRun: args.dryRun });
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
export { uploadCommandDef };
|
|
154
|
-
|
|
155
|
-
//# sourceMappingURL=upload.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"upload.mjs","names":[],"sources":["../../src/commands/upload.ts"],"sourcesContent":["import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { multiselect } from '@clack/prompts'\nimport { defineCommand } from 'citty'\nimport { colorize } from 'consola/utils'\nimport { ofetch } from 'ofetch'\nimport { join } from 'pathe'\nimport { readLock } from '../core/lockfile.ts'\nimport { parseFrontmatter } from '../core/markdown.ts'\n\nconst UPLOAD_URL = 'https://skilld.dev/api/collections/import'\n\ninterface DiscoveredSkill {\n name: string\n description?: string\n version?: string\n repo?: string\n generator?: string\n source: 'local' | 'global' | 'plugin'\n}\n\nfunction readSkillsFromDir(dir: string, source: 'local' | 'global', extraLockDirs?: string[]): DiscoveredSkill[] {\n if (!existsSync(dir))\n return []\n\n // Merge lockfiles: primary dir + any extra dirs (e.g. ~/.skilld/skills/ for global)\n let lock = readLock(dir)\n if (!lock && extraLockDirs) {\n for (const d of extraLockDirs) {\n lock = readLock(d)\n if (lock)\n break\n }\n }\n const entries = readdirSync(dir).filter((f) => {\n if (f.startsWith('.') || f.endsWith('.yaml') || f.endsWith('.yml'))\n return false\n const full = join(dir, f)\n return statSync(full).isDirectory()\n })\n\n const skills: DiscoveredSkill[] = []\n for (const dirName of entries) {\n const skillMd = join(dir, dirName, 'SKILL.md')\n if (!existsSync(skillMd))\n continue\n const content = readFileSync(skillMd, 'utf-8')\n const fm = parseFrontmatter(content)\n const lockInfo = lock?.skills[dirName]\n skills.push({\n name: fm.name || dirName,\n description: fm.description,\n version: fm.version || lockInfo?.version,\n repo: lockInfo?.repo,\n generator: lockInfo?.generator,\n source,\n })\n }\n\n return skills\n}\n\ninterface MarketplaceInfo {\n source: { source: string, repo: string }\n}\n\nfunction readPlugins(configDir: string): DiscoveredSkill[] {\n const settingsPath = join(configDir, 'settings.json')\n if (!existsSync(settingsPath))\n return []\n\n const settings = JSON.parse(readFileSync(settingsPath, 'utf-8'))\n const enabledPlugins = settings.enabledPlugins as Record<string, boolean> | undefined\n if (!enabledPlugins)\n return []\n\n // Load marketplace repos for GitHub links\n const marketplacesPath = join(configDir, 'plugins', 'known_marketplaces.json')\n const marketplaces: Record<string, MarketplaceInfo> = existsSync(marketplacesPath)\n ? JSON.parse(readFileSync(marketplacesPath, 'utf-8'))\n : {}\n\n // Load installed plugins for version info\n const installedPath = join(configDir, 'plugins', 'installed_plugins.json')\n const installed: { plugins: Record<string, Array<{ version?: string }>> } = existsSync(installedPath)\n ? JSON.parse(readFileSync(installedPath, 'utf-8'))\n : { plugins: {} }\n\n return Object.entries(enabledPlugins)\n .filter(([, enabled]) => enabled)\n .map(([id]) => {\n const marketplace = id.split('@')[1]\n const pluginName = id.split('@')[0]\n const marketplaceInfo = marketplace ? marketplaces[marketplace] : undefined\n const repo = marketplaceInfo?.source?.repo\n const versions = installed.plugins[id]\n const version = versions?.[0]?.version !== 'unknown' ? versions?.[0]?.version : undefined\n\n return {\n name: pluginName!,\n version,\n repo: repo ? `${repo}` : undefined,\n source: 'plugin' as const,\n }\n })\n}\n\nfunction discoverAllSkills(cwd: string): DiscoveredSkill[] {\n const claudeHome = process.env.CLAUDE_CONFIG_DIR || join(homedir(), '.claude')\n const localDir = join(cwd, '.claude', 'skills')\n const globalDir = join(claudeHome, 'skills')\n\n const skilldGlobalDir = join(homedir(), '.skilld', 'skills')\n const local = readSkillsFromDir(localDir, 'local')\n const global = readSkillsFromDir(globalDir, 'global', [skilldGlobalDir])\n const plugins = readPlugins(claudeHome)\n\n // Filter out skilld-generated skills, deduplicate by repo\n const seenRepos = new Set<string>()\n const all: DiscoveredSkill[] = []\n for (const skill of [...local, ...global, ...plugins]) {\n if (!skill.repo || seenRepos.has(skill.repo))\n continue\n if (skill.generator === 'skilld')\n continue\n seenRepos.add(skill.repo)\n all.push(skill)\n }\n return all\n}\n\nconst SOURCE_COLORS: Record<string, string> = {\n local: 'green',\n global: 'blue',\n plugin: 'magenta',\n}\n\nexport async function uploadCommand(options?: { dryRun?: boolean }): Promise<void> {\n const skills = discoverAllSkills(process.cwd())\n\n if (skills.length === 0) {\n process.stdout.write('No skills found.\\n')\n return\n }\n\n if (options?.dryRun) {\n process.stdout.write(`Found ${colorize('bold', String(skills.length))} skill${skills.length === 1 ? '' : 's'}:\\n\\n`)\n for (const skill of skills) {\n const version = skill.version ? colorize('dim', ` v${skill.version}`) : ''\n const tag = colorize((SOURCE_COLORS[skill.source] || 'dim') as 'dim', skill.source)\n const repo = skill.repo ? colorize('dim', ` github.com/${skill.repo}`) : ''\n process.stdout.write(` ${colorize('cyan', skill.name)}${version} ${tag}${repo}\\n`)\n }\n process.stdout.write(`\\n${colorize('dim', 'Dry run complete. No requests were made.')}\\n`)\n return\n }\n\n const selected = await multiselect({\n message: `Select skills to upload (${skills.length} found)`,\n options: skills.map((s) => {\n const version = s.version ? ` v${s.version}` : ''\n const repo = s.repo ? ` github.com/${s.repo}` : ''\n return {\n value: s.name,\n label: `${s.name}${version}`,\n hint: `${s.source}${repo}`,\n }\n }),\n initialValues: [],\n })\n\n if (typeof selected === 'symbol' || selected.length === 0)\n return\n\n const selectedSet = new Set(selected)\n const payload = skills\n .filter(s => selectedSet.has(s.name))\n .map(s => ({\n name: s.name,\n version: s.version,\n repo: s.repo,\n source: s.source,\n }))\n\n const { token, expires } = await ofetch<{ token: string, expires: string }>(UPLOAD_URL, {\n method: 'POST',\n body: { skills: payload },\n })\n\n const expiresDate = new Date(expires)\n const minutesLeft = Math.round((expiresDate.getTime() - Date.now()) / 60000)\n\n process.stdout.write(`\\nToken: ${colorize('green', token)}\\n\\n`)\n process.stdout.write(`Paste this token at: ${colorize('cyan', 'https://skilld.dev/people/YOUR_HANDLE/edit-skills')}\\n`)\n process.stdout.write(colorize('dim', `Token expires in ${minutesLeft} minutes.\\n`))\n}\n\nexport const uploadCommandDef = defineCommand({\n meta: { name: 'publish', description: 'Publish your skill list to skilld.dev' },\n args: {\n dryRun: {\n type: 'boolean',\n alias: 'd',\n description: 'Show what would be uploaded without making any requests',\n default: false,\n },\n },\n run({ args }) {\n return uploadCommand({ dryRun: args.dryRun })\n },\n})\n"],"mappings":";;;;;;;;;AAUA,MAAM,aAAa;AAWnB,SAAS,kBAAkB,KAAa,QAA4B,eAA6C;CAC/G,IAAI,CAAC,WAAW,GAAG,GACjB,OAAO,CAAC;CAGV,IAAI,OAAO,SAAS,GAAG;CACvB,IAAI,CAAC,QAAQ,eACX,KAAK,MAAM,KAAK,eAAe;EAC7B,OAAO,SAAS,CAAC;EACjB,IAAI,MACF;CACJ;CAEF,MAAM,UAAU,YAAY,GAAG,CAAC,CAAC,QAAQ,MAAM;EAC7C,IAAI,EAAE,WAAW,GAAG,KAAK,EAAE,SAAS,OAAO,KAAK,EAAE,SAAS,MAAM,GAC/D,OAAO;EACT,MAAM,OAAO,KAAK,KAAK,CAAC;EACxB,OAAO,SAAS,IAAI,CAAC,CAAC,YAAY;CACpC,CAAC;CAED,MAAM,SAA4B,CAAC;CACnC,KAAK,MAAM,WAAW,SAAS;EAC7B,M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;AAEA,MAAa,mBAAmB,cAAc;CAC5C,MAAM;EAAE,MAAM;EAAW,aAAa;CAAwC;CAC9E,MAAM,EACJ,QAAQ;EACN,MAAM;EACN,OAAO;EACP,aAAa;EACb,SAAS;CACX,EACF;CACA,IAAI,EAAE,QAAQ;EACZ,OAAO,cAAc,EAAE,QAAQ,KAAK,OAAO,CAAC;CAC9C;AACF,CAAC"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { getSectionValidator } from "./prompts.mjs";
|
|
2
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
-
import { defineCommand } from "citty";
|
|
4
|
-
const SECTION_HEADINGS = {
|
|
5
|
-
"## API Changes": "api-changes",
|
|
6
|
-
"## Best Practices": "best-practices"
|
|
7
|
-
};
|
|
8
|
-
function inferSection(content) {
|
|
9
|
-
for (const [heading, section] of Object.entries(SECTION_HEADINGS)) if (content.includes(heading)) return section;
|
|
10
|
-
return "custom";
|
|
11
|
-
}
|
|
12
|
-
const validateCommandDef = defineCommand({
|
|
13
|
-
meta: {
|
|
14
|
-
name: "validate",
|
|
15
|
-
description: "Validate a generated skill section"
|
|
16
|
-
},
|
|
17
|
-
args: {
|
|
18
|
-
file: {
|
|
19
|
-
type: "positional",
|
|
20
|
-
description: "Path to the section file to validate",
|
|
21
|
-
required: true
|
|
22
|
-
},
|
|
23
|
-
section: {
|
|
24
|
-
type: "string",
|
|
25
|
-
description: "Section type (api-changes, best-practices, custom). Auto-detected from heading if omitted."
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
async run({ args }) {
|
|
29
|
-
const filePath = args.file;
|
|
30
|
-
if (!existsSync(filePath)) {
|
|
31
|
-
console.error(`File not found: ${filePath}`);
|
|
32
|
-
process.exit(1);
|
|
33
|
-
}
|
|
34
|
-
const content = readFileSync(filePath, "utf-8").trim();
|
|
35
|
-
if (!content) {
|
|
36
|
-
console.error("File is empty");
|
|
37
|
-
process.exit(1);
|
|
38
|
-
}
|
|
39
|
-
const section = args.section || inferSection(content);
|
|
40
|
-
if (!section) {
|
|
41
|
-
console.error("Could not infer section type — use --section flag");
|
|
42
|
-
process.exit(1);
|
|
43
|
-
}
|
|
44
|
-
const validator = getSectionValidator(section);
|
|
45
|
-
if (!validator) {
|
|
46
|
-
console.log("OK: No validator for section type:", section);
|
|
47
|
-
process.exit(0);
|
|
48
|
-
}
|
|
49
|
-
const warnings = validator(content);
|
|
50
|
-
if (warnings.length === 0) {
|
|
51
|
-
console.log("OK: No validation warnings");
|
|
52
|
-
process.exit(0);
|
|
53
|
-
}
|
|
54
|
-
for (const w of warnings) console.log(`WARNING: ${w.warning}`);
|
|
55
|
-
process.exit(1);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
export { validateCommandDef };
|
|
59
|
-
|
|
60
|
-
//# sourceMappingURL=validate.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate.mjs","names":[],"sources":["../../src/commands/validate.ts"],"sourcesContent":["/**\n * skilld validate <file> [--section <type>]\n *\n * Validates a generated skill section file against quality heuristics.\n * Exits non-zero on warnings so the LLM agent detects issues via exit code.\n */\n\nimport type { SkillSection } from '../agent/prompts/index.ts'\nimport { existsSync, readFileSync } from 'node:fs'\nimport { defineCommand } from 'citty'\nimport { getSectionValidator } from '../agent/prompts/index.ts'\n\nconst SECTION_HEADINGS: Record<string, SkillSection> = {\n '## API Changes': 'api-changes',\n '## Best Practices': 'best-practices',\n}\n\n/** Infer section type from content headings */\nfunction inferSection(content: string): SkillSection | null {\n for (const [heading, section] of Object.entries(SECTION_HEADINGS)) {\n if (content.includes(heading))\n return section\n }\n // Custom sections don't have a fixed heading — fall back\n return 'custom'\n}\n\nexport const validateCommandDef = defineCommand({\n meta: { name: 'validate', description: 'Validate a generated skill section' },\n args: {\n file: {\n type: 'positional',\n description: 'Path to the section file to validate',\n required: true,\n },\n section: {\n type: 'string',\n description: 'Section type (api-changes, best-practices, custom). Auto-detected from heading if omitted.',\n },\n },\n\n /* eslint-disable no-console */\n async run({ args }) {\n const filePath = args.file as string\n if (!existsSync(filePath)) {\n console.error(`File not found: ${filePath}`)\n process.exit(1)\n }\n\n const content = readFileSync(filePath, 'utf-8').trim()\n if (!content) {\n console.error('File is empty')\n process.exit(1)\n }\n\n const section = (args.section as SkillSection) || inferSection(content)\n if (!section) {\n console.error('Could not infer section type — use --section flag')\n process.exit(1)\n }\n\n const validator = getSectionValidator(section)\n if (!validator) {\n console.log('OK: No validator for section type:', section)\n process.exit(0)\n }\n\n const warnings = validator(content)\n\n if (warnings.length === 0) {\n console.log('OK: No validation warnings')\n process.exit(0)\n }\n\n for (const w of warnings)\n console.log(`WARNING: ${w.warning}`)\n\n process.exit(1)\n },\n})\n"],"mappings":";;;AAYA,MAAM,mBAAiD;CACrD,kBAAkB;CAClB,qBAAqB;AACvB;AAGA,SAAS,aAAa,SAAsC;CAC1D,KAAK,MAAM,CAAC,SAAS,YAAY,OAAO,QAAQ,gBAAgB,GAC9D,IAAI,QAAQ,SAAS,OAAO,GAC1B,OAAO;CAGX,OAAO;AACT;AAEA,MAAa,qBAAqB,cAAc;CAC9C,MAAM;EAAE,MAAM;EAAY,aAAa;CAAqC;CAC5E,MAAM;EACJ,MAAM;GACJ,MAAM;GACN,aAAa;GACb,UAAU;EACZ;EACA,SAAS;GACP,MAAM;GACN,aAAa;EACf;CACF;CAGA,MAAM,IAAI,EAAE,QAAQ;EAClB,MAAM,WAAW,KAAK;EACtB,IAAI,CAAC,WAAW,QAAQ,GAAG;GACzB,QAAQ,MAAM,mBAAmB,UAAU;GAC3C,QAAQ,KAAK,CAAC;EAChB;EAEA,MAAM,UAAU,aAAa,UAAU,OAAO,CAAC,CAAC,KAAK;EACrD,IAAI,CAAC,SAAS;GACZ,QAAQ,MAAM,eAAe;GAC7B,QAAQ,KAAK,CAAC;EAChB;EAEA,MAAM,UAAW,KAAK,WAA4B,aAAa,OAAO;EACtE,IAAI,CAAC,SAAS;GACZ,QAAQ,MAAM,mDAAmD;GACjE,QAAQ,KAAK,CAAC;EAChB;EAEA,MAAM,YAAY,oBAAoB,OAAO;EAC7C,IAAI,CAAC,WAAW;GACd,QAAQ,IAAI,sCAAsC,OAAO;GACzD,QAAQ,KAAK,CAAC;EAChB;EAEA,MAAM,WAAW,UAAU,OAAO;EAElC,IAAI,SAAS,WAAW,GAAG;GACzB,QAAQ,IAAI,4BAA4B;GACxC,QAAQ,KAAK,CAAC;EAChB;EAEA,KAAK,MAAM,KAAK,UACd,QAAQ,IAAI,YAAY,EAAE,SAAS;EAErC,QAAQ,KAAK,CAAC;CAChB;AACF,CAAC"}
|
package/dist/_chunks/version.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
import { dirname, resolve } from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
function findPackageJson() {
|
|
5
|
-
let dir = dirname(fileURLToPath(import.meta.url));
|
|
6
|
-
for (let i = 0; i < 5; i++) {
|
|
7
|
-
const candidate = resolve(dir, "package.json");
|
|
8
|
-
try {
|
|
9
|
-
const content = readFileSync(candidate, "utf8");
|
|
10
|
-
if (content) return content;
|
|
11
|
-
} catch {}
|
|
12
|
-
dir = resolve(dir, "..");
|
|
13
|
-
}
|
|
14
|
-
return "{\"version\":\"0.0.0\"}";
|
|
15
|
-
}
|
|
16
|
-
const version = JSON.parse(findPackageJson()).version;
|
|
17
|
-
export { version };
|
|
18
|
-
|
|
19
|
-
//# sourceMappingURL=version.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.mjs","names":[],"sources":["../../src/version.ts"],"sourcesContent":["import { readFileSync } from 'node:fs'\nimport { dirname, resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\n// Walk up from current file to find package.json (works in both src/ and dist/_chunks/)\nfunction findPackageJson(): string {\n let dir = dirname(fileURLToPath(import.meta.url))\n for (let i = 0; i < 5; i++) {\n const candidate = resolve(dir, 'package.json')\n try {\n const content = readFileSync(candidate, 'utf8')\n if (content)\n return content\n }\n catch {}\n dir = resolve(dir, '..')\n }\n return '{\"version\":\"0.0.0\"}'\n}\n\nexport const version: string = JSON.parse(findPackageJson()).version\n"],"mappings":";;;AAKA,SAAS,kBAA0B;CACjC,IAAI,MAAM,QAAQ,cAAc,YAAY,GAAG,CAAC;CAChD,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KAAK;EAC1B,MAAM,YAAY,QAAQ,KAAK,cAAc;EAC7C,IAAI;GACF,MAAM,UAAU,aAAa,WAAW,MAAM;GAC9C,IAAI,SACF,OAAO;EACX,QACM,CAAC;EACP,MAAM,QAAQ,KAAK,IAAI;CACzB;CACA,OAAO;AACT;AAEA,MAAa,UAAkB,KAAK,MAAM,gBAAgB,CAAC,CAAC,CAAC"}
|
package/dist/_chunks/watch.mjs
DELETED
package/dist/_chunks/watch2.mjs
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { iterateSkills } from "./skills.mjs";
|
|
2
|
-
import { loadSession } from "./store.mjs";
|
|
3
|
-
import { createRegistryClient } from "./client.mjs";
|
|
4
|
-
import * as p from "@clack/prompts";
|
|
5
|
-
import { defineCommand } from "citty";
|
|
6
|
-
const REPOSITORY_RE = /^([\w.-]+)\/([\w.-]+)$/;
|
|
7
|
-
function parseRepositoryInputs(inputs) {
|
|
8
|
-
const repositories = [];
|
|
9
|
-
const invalid = [];
|
|
10
|
-
for (const input of inputs) {
|
|
11
|
-
const match = input.trim().match(REPOSITORY_RE);
|
|
12
|
-
if (!match) {
|
|
13
|
-
invalid.push(input);
|
|
14
|
-
continue;
|
|
15
|
-
}
|
|
16
|
-
const repository = {
|
|
17
|
-
owner: match[1],
|
|
18
|
-
repo: match[2]
|
|
19
|
-
};
|
|
20
|
-
if (!repositories.some((item) => item.owner === repository.owner && item.repo === repository.repo)) repositories.push(repository);
|
|
21
|
-
}
|
|
22
|
-
return invalid.length > 0 ? {
|
|
23
|
-
_tag: "Err",
|
|
24
|
-
invalid
|
|
25
|
-
} : {
|
|
26
|
-
_tag: "Ok",
|
|
27
|
-
repositories
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function installedRepositories(cwd = process.cwd()) {
|
|
31
|
-
return [...iterateSkills({
|
|
32
|
-
scope: "local",
|
|
33
|
-
cwd
|
|
34
|
-
})].flatMap((skill) => skill.info?.repo ? [skill.info.repo] : []).flatMap((value) => {
|
|
35
|
-
const result = parseRepositoryInputs([value]);
|
|
36
|
-
return result._tag === "Ok" ? result.repositories : [];
|
|
37
|
-
}).filter((repository, index, repositories) => repositories.findIndex((candidate) => candidate.owner === repository.owner && candidate.repo === repository.repo) === index);
|
|
38
|
-
}
|
|
39
|
-
async function watchRepositories(repositories) {
|
|
40
|
-
if (!await loadSession()) return { _tag: "AuthRequired" };
|
|
41
|
-
return {
|
|
42
|
-
_tag: "Watched",
|
|
43
|
-
inserted: (await createRegistryClient().my.watch(repositories)).inserted
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
function commandInputs(args) {
|
|
47
|
-
return [args.repository, ...args._ ?? []].filter((value) => typeof value === "string" && value.length > 0);
|
|
48
|
-
}
|
|
49
|
-
const watchCommandDef = defineCommand({
|
|
50
|
-
meta: {
|
|
51
|
-
name: "watch",
|
|
52
|
-
description: "Watch installed repositories for changes"
|
|
53
|
-
},
|
|
54
|
-
args: { repository: {
|
|
55
|
-
type: "positional",
|
|
56
|
-
description: "GitHub repository in owner/repo form",
|
|
57
|
-
required: false
|
|
58
|
-
} },
|
|
59
|
-
async run({ args }) {
|
|
60
|
-
const inputs = commandInputs(args);
|
|
61
|
-
const parsed = inputs.length > 0 ? parseRepositoryInputs(inputs) : {
|
|
62
|
-
_tag: "Ok",
|
|
63
|
-
repositories: installedRepositories()
|
|
64
|
-
};
|
|
65
|
-
if (parsed._tag === "Err") {
|
|
66
|
-
p.log.error(`Invalid repositories: ${parsed.invalid.join(", ")}. Use owner/repo.`);
|
|
67
|
-
process.exitCode = 1;
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
if (parsed.repositories.length === 0) {
|
|
71
|
-
p.log.warn("No installed GitHub repositories found.");
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
const result = await watchRepositories(parsed.repositories).catch((error) => {
|
|
75
|
-
p.log.error(`Failed to watch repositories: ${error instanceof Error ? error.message : String(error)}`);
|
|
76
|
-
process.exitCode = 1;
|
|
77
|
-
return null;
|
|
78
|
-
});
|
|
79
|
-
if (result?._tag === "AuthRequired") {
|
|
80
|
-
p.log.error("Not logged in. Run `skilld login` first.");
|
|
81
|
-
process.exitCode = 1;
|
|
82
|
-
}
|
|
83
|
-
if (result?._tag === "Watched") p.log.success(`Watching ${parsed.repositories.length} repositories. ${result.inserted} added.`);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
const unwatchCommandDef = defineCommand({
|
|
87
|
-
meta: {
|
|
88
|
-
name: "unwatch",
|
|
89
|
-
description: "Stop watching a repository"
|
|
90
|
-
},
|
|
91
|
-
args: { repository: {
|
|
92
|
-
type: "positional",
|
|
93
|
-
description: "GitHub repository in owner/repo form",
|
|
94
|
-
required: true
|
|
95
|
-
} },
|
|
96
|
-
async run({ args }) {
|
|
97
|
-
const parsed = parseRepositoryInputs([args.repository]);
|
|
98
|
-
if (parsed._tag === "Err") {
|
|
99
|
-
p.log.error(`Invalid repository: ${args.repository}. Use owner/repo.`);
|
|
100
|
-
process.exitCode = 1;
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
if (!await loadSession()) {
|
|
104
|
-
p.log.error("Not logged in. Run `skilld login` first.");
|
|
105
|
-
process.exitCode = 1;
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
await createRegistryClient().my.unwatch(parsed.repositories[0]).then(() => {
|
|
109
|
-
p.log.success(`Stopped watching ${args.repository}.`);
|
|
110
|
-
}).catch((error) => {
|
|
111
|
-
p.log.error(`Failed to stop watching: ${error instanceof Error ? error.message : String(error)}`);
|
|
112
|
-
process.exitCode = 1;
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
export { installedRepositories, parseRepositoryInputs, unwatchCommandDef, watchCommandDef, watchRepositories };
|
|
117
|
-
|
|
118
|
-
//# sourceMappingURL=watch2.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"watch2.mjs","names":[],"sources":["../../src/commands/watch.ts"],"sourcesContent":["import type { RepositoryRef } from '../registry/client.ts'\nimport * as p from '@clack/prompts'\nimport { defineCommand } from 'citty'\nimport { loadSession } from '../auth/store.ts'\nimport { iterateSkills } from '../core/skills.ts'\nimport { createRegistryClient } from '../registry/client.ts'\n\ntype RepositoryInputResult\n = | { _tag: 'Ok', repositories: RepositoryRef[] }\n | { _tag: 'Err', invalid: string[] }\n\nconst REPOSITORY_RE = /^([\\w.-]+)\\/([\\w.-]+)$/\n\nexport function parseRepositoryInputs(inputs: string[]): RepositoryInputResult {\n const repositories: RepositoryRef[] = []\n const invalid: string[] = []\n for (const input of inputs) {\n const match = input.trim().match(REPOSITORY_RE)\n if (!match) {\n invalid.push(input)\n continue\n }\n const repository = { owner: match[1]!, repo: match[2]! }\n if (!repositories.some(item => item.owner === repository.owner && item.repo === repository.repo))\n repositories.push(repository)\n }\n return invalid.length > 0 ? { _tag: 'Err', invalid } : { _tag: 'Ok', repositories }\n}\n\nexport function installedRepositories(cwd = process.cwd()): RepositoryRef[] {\n const values = [...iterateSkills({ scope: 'local', cwd })]\n .flatMap(skill => skill.info?.repo ? [skill.info.repo] : [])\n return values.flatMap((value) => {\n const result = parseRepositoryInputs([value])\n return result._tag === 'Ok' ? result.repositories : []\n }).filter((repository, index, repositories) =>\n repositories.findIndex(candidate => candidate.owner === repository.owner && candidate.repo === repository.repo) === index,\n )\n}\n\nexport type WatchRepositoriesResult\n = | { _tag: 'Watched', inserted: number }\n | { _tag: 'AuthRequired' }\n\nexport async function watchRepositories(repositories: RepositoryRef[]): Promise<WatchRepositoriesResult> {\n if (!await loadSession())\n return { _tag: 'AuthRequired' }\n const response = await createRegistryClient().my.watch(repositories)\n return { _tag: 'Watched', inserted: response.inserted }\n}\n\nfunction commandInputs(args: Record<string, unknown>): string[] {\n return [args.repository, ...((args._ as string[] | undefined) ?? [])]\n .filter((value): value is string => typeof value === 'string' && value.length > 0)\n}\n\nexport const watchCommandDef = defineCommand({\n meta: { name: 'watch', description: 'Watch installed repositories for changes' },\n args: {\n repository: { type: 'positional', description: 'GitHub repository in owner/repo form', required: false },\n },\n async run({ args }) {\n const inputs = commandInputs(args)\n const parsed = inputs.length > 0\n ? parseRepositoryInputs(inputs)\n : { _tag: 'Ok' as const, repositories: installedRepositories() }\n if (parsed._tag === 'Err') {\n p.log.error(`Invalid repositories: ${parsed.invalid.join(', ')}. Use owner/repo.`)\n process.exitCode = 1\n return\n }\n if (parsed.repositories.length === 0) {\n p.log.warn('No installed GitHub repositories found.')\n return\n }\n const result = await watchRepositories(parsed.repositories).catch((error) => {\n p.log.error(`Failed to watch repositories: ${error instanceof Error ? error.message : String(error)}`)\n process.exitCode = 1\n return null\n })\n if (result?._tag === 'AuthRequired') {\n p.log.error('Not logged in. Run `skilld login` first.')\n process.exitCode = 1\n }\n if (result?._tag === 'Watched')\n p.log.success(`Watching ${parsed.repositories.length} repositories. ${result.inserted} added.`)\n },\n})\n\nexport const unwatchCommandDef = defineCommand({\n meta: { name: 'unwatch', description: 'Stop watching a repository' },\n args: {\n repository: { type: 'positional', description: 'GitHub repository in owner/repo form', required: true },\n },\n async run({ args }) {\n const parsed = parseRepositoryInputs([args.repository])\n if (parsed._tag === 'Err') {\n p.log.error(`Invalid repository: ${args.repository}. Use owner/repo.`)\n process.exitCode = 1\n return\n }\n if (!await loadSession()) {\n p.log.error('Not logged in. Run `skilld login` first.')\n process.exitCode = 1\n return\n }\n await createRegistryClient().my.unwatch(parsed.repositories[0]!).then(() => {\n p.log.success(`Stopped watching ${args.repository}.`)\n }).catch((error) => {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G;CACA,MAAM,IAAI,EAAE,QAAQ;EAClB,MAAM,SAAS,sBAAsB,CAAC,KAAK,UAAU,CAAC;EACtD,IAAI,OAAO,SAAS,OAAO;GACzB,EAAE,IAAI,MAAM,uBAAuB,KAAK,WAAW,kBAAkB;GACrE,QAAQ,WAAW;GACnB;EACF;EACA,IAAI,CAAC,MAAM,YAAY,GAAG;GACxB,EAAE,IAAI,MAAM,0CAA0C;GACtD,QAAQ,WAAW;GACnB;EACF;EACA,MAAM,qBAAqB,CAAC,CAAC,GAAG,QAAQ,OAAO,aAAa,EAAG,CAAC,CAAC,WAAW;GAC1E,EAAE,IAAI,QAAQ,oBAAoB,KAAK,WAAW,EAAE;EACtD,CAAC,CAAC,CAAC,OAAO,UAAU;GAClB,EAAE,IAAI,MAAM,4BAA4B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG;GAChG,QAAQ,WAAW;EACrB,CAAC;CACH;AACF,CAAC"}
|
package/dist/_chunks/whoami.mjs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { loadSession } from "./store.mjs";
|
|
2
|
-
import { styleText } from "node:util";
|
|
3
|
-
import * as p from "@clack/prompts";
|
|
4
|
-
import { defineCommand } from "citty";
|
|
5
|
-
const whoamiCommandDef = defineCommand({
|
|
6
|
-
meta: {
|
|
7
|
-
name: "whoami",
|
|
8
|
-
description: "Show the active skilld.dev session"
|
|
9
|
-
},
|
|
10
|
-
async run() {
|
|
11
|
-
const session = await loadSession();
|
|
12
|
-
if (!session) {
|
|
13
|
-
p.log.info("Not logged in. Run `skilld login` to authenticate.");
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
p.log.message(`Logged in as ${styleText("cyan", `@${session.login}`)} ${styleText("gray", `(${session.scheme})`)}`);
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
export { whoamiCommandDef };
|
|
20
|
-
|
|
21
|
-
//# sourceMappingURL=whoami.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"whoami.mjs","names":[],"sources":["../../src/commands/whoami.ts"],"sourcesContent":["/**\n * `skilld whoami` — print the active login + storage scheme.\n */\n\nimport { styleText } from 'node:util'\nimport * as p from '@clack/prompts'\nimport { defineCommand } from 'citty'\nimport { loadSession } from '../auth/store.ts'\n\nexport const whoamiCommandDef = defineCommand({\n meta: { name: 'whoami', description: 'Show the active skilld.dev session' },\n async run() {\n const session = await loadSession()\n if (!session) {\n p.log.info('Not logged in. Run `skilld login` to authenticate.')\n return\n }\n p.log.message(`Logged in as ${styleText('cyan', `@${session.login}`)} ${styleText('gray', `(${session.scheme})`)}`)\n },\n})\n"],"mappings":";;;;;;EASA,MAAa;EACX,aAAM;CAAE;CAAgB,MAAA,MAAA;EAAkD,MAAA,UAAA,MAAA,YAAA;EAC1E,IAAA,CAAM,SAAM;GACV,EAAA,IAAM,KAAA,oDAA4B;GAClC;EACE;EACA,EAAA,IAAA,QAAA,gBAAA,UAAA,QAAA,IAAA,QAAA,OAAA,EAAA,GAAA,UAAA,QAAA,IAAA,QAAA,OAAA,EAAA,GAAA;CACF;AACA,CAAA;AAEJ,SAAC"}
|
package/dist/_chunks/wizard.mjs
DELETED
package/dist/_chunks/wizard2.mjs
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { targets } from "./detect.mjs";
|
|
2
|
-
import { getAvailableModels, getModelName, getOAuthProviderList, loginOAuthProvider } from "./agent.mjs";
|
|
3
|
-
import { defaultFeatures, updateConfig } from "./index-identity.mjs";
|
|
4
|
-
import { isInteractive } from "./env.mjs";
|
|
5
|
-
import { resolveAgent } from "./agent-prompt.mjs";
|
|
6
|
-
import { sharedArgs } from "./args.mjs";
|
|
7
|
-
import { NO_MODELS_MESSAGE, OAUTH_NOTE, pickModel } from "./model-picker.mjs";
|
|
8
|
-
import { styleText } from "node:util";
|
|
9
|
-
import * as p from "@clack/prompts";
|
|
10
|
-
import { defineCommand } from "citty";
|
|
11
|
-
import { execSync } from "node:child_process";
|
|
12
|
-
function hasGhCli() {
|
|
13
|
-
if (process.env.SKILLD_NO_GH) return false;
|
|
14
|
-
try {
|
|
15
|
-
execSync("gh --version", { stdio: "ignore" });
|
|
16
|
-
return true;
|
|
17
|
-
} catch {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
async function runWizard(opts = {}) {
|
|
22
|
-
if (!isInteractive()) return false;
|
|
23
|
-
const agentLabel = opts.agent ? targets[opts.agent].displayName : null;
|
|
24
|
-
const skillsDir = opts.agent ? targets[opts.agent].skillsDir : ".claude/skills";
|
|
25
|
-
const agentLine = agentLabel ? `\n${styleText("gray", `Target agent: ${agentLabel}`)}` : "";
|
|
26
|
-
p.note(`Your AI agent reads docs from its training data - but APIs change,
|
|
27
|
-
versions drift, and patterns go stale. Skilld fixes this.
|
|
28
|
-
|
|
29
|
-
It generates a ${styleText("bold", "SKILL.md")} - a markdown reference card built from\nthe ${styleText("bold", "actual docs, issues, and release notes")} for the exact\npackage versions in your project. Your agent reads this file\nevery session - no hallucinated APIs.\n\n${styleText("bold", "How it works:")}\n 1. Fetch docs, issues, and types for your packages\n 2. Optionally compress with an LLM into a concise cheat sheet\n\n${styleText("gray", `Example: \`skilld add vue\` creates ${skillsDir}/vue-skilld/SKILL.md\nYour agent then knows the right APIs, gotchas, and patterns\nfor your exact version.`)}${agentLine}`, "Welcome to skilld");
|
|
30
|
-
const ghInstalled = hasGhCli();
|
|
31
|
-
if (ghInstalled) p.log.success("GitHub CLI detected — will use it to pull issues and discussions.");
|
|
32
|
-
else p.log.info(`${styleText("gray", "GitHub CLI not installed — issues and discussions disabled.")}\n Install later to enable: ${styleText("cyan", "https://cli.github.com")}`);
|
|
33
|
-
const selected = await p.multiselect({
|
|
34
|
-
message: "What data sources should skills include?",
|
|
35
|
-
options: [
|
|
36
|
-
{
|
|
37
|
-
label: "Local search",
|
|
38
|
-
value: "search",
|
|
39
|
-
hint: "query engine for `skilld search` across all skill docs"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
label: "Release notes",
|
|
43
|
-
value: "releases",
|
|
44
|
-
hint: "changelogs and migration notes per version"
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
label: "GitHub issues",
|
|
48
|
-
value: "issues",
|
|
49
|
-
hint: "common bugs, workarounds, and solutions",
|
|
50
|
-
disabled: !ghInstalled
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
label: "GitHub discussions",
|
|
54
|
-
value: "discussions",
|
|
55
|
-
hint: "community Q&A and usage examples",
|
|
56
|
-
disabled: !ghInstalled
|
|
57
|
-
}
|
|
58
|
-
],
|
|
59
|
-
initialValues: [...Object.entries(defaultFeatures).filter(([, v]) => v).map(([k]) => k), ...ghInstalled ? ["issues", "discussions"] : []],
|
|
60
|
-
required: false
|
|
61
|
-
});
|
|
62
|
-
if (p.isCancel(selected)) {
|
|
63
|
-
p.cancel("Setup cancelled");
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
const features = {
|
|
67
|
-
search: selected.includes("search"),
|
|
68
|
-
issues: selected.includes("issues"),
|
|
69
|
-
discussions: selected.includes("discussions"),
|
|
70
|
-
releases: selected.includes("releases")
|
|
71
|
-
};
|
|
72
|
-
p.note(`An LLM can optionally summarize raw docs into a focused reference
|
|
73
|
-
highlighting best practices, gotchas, and migrations.
|
|
74
|
-
|
|
75
|
-
${styleText("bold", "Without LLM:")} ~2 KB skill with package metadata, types, and links\n${styleText("bold", "With LLM:")} ~5 KB skill with curated gotchas, patterns, and migration notes\n\n${styleText("bold", "This is a one-time build step")} - it generates the SKILL.md, then your\ncoding agent reads the result every session. Can be a different model.\n\n${styleText("gray", "Works with API keys (ANTHROPIC_API_KEY, GEMINI_API_KEY, OPENAI_API_KEY)\nor CLI tools (claude, gemini, codex).")}`, "Enhancement model (optional)");
|
|
76
|
-
let modelId;
|
|
77
|
-
let skippedEnhancement = false;
|
|
78
|
-
let oauthJustConnected = false;
|
|
79
|
-
while (true) {
|
|
80
|
-
const allModels = process.env.SKILLD_NO_AGENTS ? [] : await getAvailableModels();
|
|
81
|
-
if (allModels.length === 0) p.log.warn(NO_MODELS_MESSAGE);
|
|
82
|
-
else if (oauthJustConnected) p.log.step(`${allModels.length} models now available. Select one below.`);
|
|
83
|
-
else {
|
|
84
|
-
const providers = /* @__PURE__ */ new Set();
|
|
85
|
-
for (const m of allModels) {
|
|
86
|
-
const vendor = m.vendorGroup ?? m.providerName;
|
|
87
|
-
if (!m.id.startsWith("pi:")) providers.add(`${vendor} via CLI`);
|
|
88
|
-
else if (m.hint?.includes("API key")) providers.add(`${vendor} via API key`);
|
|
89
|
-
else if (m.hint?.includes("OAuth")) providers.add(`${vendor} via OAuth`);
|
|
90
|
-
}
|
|
91
|
-
if (providers.size > 0) p.log.success(`Found: ${[...providers].join(", ")}`);
|
|
92
|
-
}
|
|
93
|
-
const afterOptions = getOAuthProviderList().length > 0 ? [{
|
|
94
|
-
label: "⚠ Connect OAuth provider...",
|
|
95
|
-
value: "_connect",
|
|
96
|
-
hint: "may violate provider ToS"
|
|
97
|
-
}, {
|
|
98
|
-
label: "Skip enhancement",
|
|
99
|
-
value: "_skip",
|
|
100
|
-
hint: "base skill with docs, issues, and types, add LLM later via `skilld config`"
|
|
101
|
-
}] : [{
|
|
102
|
-
label: "Skip enhancement",
|
|
103
|
-
value: "_skip",
|
|
104
|
-
hint: "base skill with docs, issues, and types, add LLM later via `skilld config`"
|
|
105
|
-
}];
|
|
106
|
-
const choice = await pickModel(allModels, {
|
|
107
|
-
before: allModels.length > 0 ? [{
|
|
108
|
-
label: "Auto",
|
|
109
|
-
value: "_auto",
|
|
110
|
-
hint: "picks best available model from connected providers"
|
|
111
|
-
}] : [],
|
|
112
|
-
after: afterOptions
|
|
113
|
-
});
|
|
114
|
-
if (choice === null) {
|
|
115
|
-
p.cancel("Setup cancelled");
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
if (choice === "_connect") {
|
|
119
|
-
await wizardConnectProvider();
|
|
120
|
-
oauthJustConnected = true;
|
|
121
|
-
continue;
|
|
122
|
-
}
|
|
123
|
-
if (choice === "_skip") {
|
|
124
|
-
skippedEnhancement = true;
|
|
125
|
-
break;
|
|
126
|
-
}
|
|
127
|
-
if (choice === "_auto") break;
|
|
128
|
-
modelId = choice;
|
|
129
|
-
break;
|
|
130
|
-
}
|
|
131
|
-
updateConfig({
|
|
132
|
-
features,
|
|
133
|
-
...modelId ? {
|
|
134
|
-
model: modelId,
|
|
135
|
-
skipLlm: false
|
|
136
|
-
} : {
|
|
137
|
-
model: void 0,
|
|
138
|
-
skipLlm: skippedEnhancement
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
const modelSummary = modelId ? getModelName(modelId) : skippedEnhancement ? "none (raw docs)" : "auto";
|
|
142
|
-
const featureList = Object.entries(features).filter(([, v]) => v).map(([k]) => k).join(", ") || "none";
|
|
143
|
-
p.log.success(`Model: ${modelSummary} · Features: ${featureList}`);
|
|
144
|
-
if (opts.showOutro !== false) p.note(`Run ${styleText("cyan", "skilld add <pkg>")} to generate skills for specific packages\nRun ${styleText("cyan", "skilld")} to scan your project and pick packages interactively\nRun ${styleText("cyan", "skilld config")} to change settings later`, "Setup complete");
|
|
145
|
-
return true;
|
|
146
|
-
}
|
|
147
|
-
async function wizardConnectProvider() {
|
|
148
|
-
p.note(OAUTH_NOTE, "How OAuth works");
|
|
149
|
-
const providers = getOAuthProviderList();
|
|
150
|
-
const provider = await p.select({
|
|
151
|
-
message: "Connect provider",
|
|
152
|
-
options: providers.map((pr) => ({
|
|
153
|
-
label: pr.name,
|
|
154
|
-
value: pr.id,
|
|
155
|
-
hint: pr.loggedIn ? "connected" : void 0
|
|
156
|
-
}))
|
|
157
|
-
});
|
|
158
|
-
if (p.isCancel(provider)) return;
|
|
159
|
-
const spinner = p.spinner();
|
|
160
|
-
spinner.start("Connecting...");
|
|
161
|
-
const success = await loginOAuthProvider(provider, {
|
|
162
|
-
onAuth: (url, instructions) => {
|
|
163
|
-
spinner.stop("Open this URL in your browser:");
|
|
164
|
-
p.log.info(` ${styleText("cyan", url)}`);
|
|
165
|
-
if (instructions) p.log.info(` ${styleText("gray", instructions)}`);
|
|
166
|
-
spinner.start("Waiting for authentication...");
|
|
167
|
-
},
|
|
168
|
-
onPrompt: async (message, placeholder) => {
|
|
169
|
-
const value = await p.text({
|
|
170
|
-
message,
|
|
171
|
-
placeholder
|
|
172
|
-
});
|
|
173
|
-
if (p.isCancel(value)) return "";
|
|
174
|
-
return value;
|
|
175
|
-
},
|
|
176
|
-
onProgress: (msg) => p.log.step(msg)
|
|
177
|
-
}).catch((err) => {
|
|
178
|
-
spinner.stop(`Login failed: ${err.message}`);
|
|
179
|
-
return false;
|
|
180
|
-
});
|
|
181
|
-
spinner.stop();
|
|
182
|
-
if (success) {
|
|
183
|
-
const name = providers.find((pr) => pr.id === provider)?.name ?? provider;
|
|
184
|
-
p.log.success(`Connected to ${name}`);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
const setupCommandDef = defineCommand({
|
|
188
|
-
meta: {
|
|
189
|
-
name: "setup",
|
|
190
|
-
description: "Re-run the setup wizard to configure features and model"
|
|
191
|
-
},
|
|
192
|
-
args: { agent: sharedArgs.agent },
|
|
193
|
-
async run({ args }) {
|
|
194
|
-
const agent = resolveAgent(args.agent);
|
|
195
|
-
await runWizard({ agent: agent && agent !== "none" ? agent : void 0 });
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
export { runWizard, setupCommandDef };
|
|
199
|
-
|
|
200
|
-
//# sourceMappingURL=wizard2.mjs.map
|