skilluse 0.1.9 → 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.
- package/dist/cli.js +432 -423
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
2
|
-
// @bun
|
|
1
|
+
#!/usr/bin/env node
|
|
3
2
|
import { createRequire } from "node:module";
|
|
4
3
|
var __create = Object.create;
|
|
5
4
|
var __getProtoOf = Object.getPrototypeOf;
|
|
@@ -44831,14 +44830,6 @@ var require_semver2 = __commonJS((exports, module) => {
|
|
|
44831
44830
|
};
|
|
44832
44831
|
});
|
|
44833
44832
|
|
|
44834
|
-
// node_modules/react/jsx-dev-runtime.js
|
|
44835
|
-
var require_jsx_dev_runtime2 = __commonJS((exports, module) => {
|
|
44836
|
-
var react_jsx_dev_runtime_development = __toESM(require_react_jsx_dev_runtime_development(), 1);
|
|
44837
|
-
if (false) {} else {
|
|
44838
|
-
module.exports = react_jsx_dev_runtime_development;
|
|
44839
|
-
}
|
|
44840
|
-
});
|
|
44841
|
-
|
|
44842
44833
|
// node_modules/commander/esm.mjs
|
|
44843
44834
|
var import__ = __toESM(require_commander(), 1);
|
|
44844
44835
|
var {
|
|
@@ -50446,6 +50437,25 @@ var getInstance = (stdout, createInstance) => {
|
|
|
50446
50437
|
};
|
|
50447
50438
|
// node_modules/ink/build/components/Static.js
|
|
50448
50439
|
var import_react14 = __toESM(require_react(), 1);
|
|
50440
|
+
function Static(props) {
|
|
50441
|
+
const { items, children: render2, style: customStyle } = props;
|
|
50442
|
+
const [index, setIndex] = import_react14.useState(0);
|
|
50443
|
+
const itemsToRender = import_react14.useMemo(() => {
|
|
50444
|
+
return items.slice(index);
|
|
50445
|
+
}, [items, index]);
|
|
50446
|
+
import_react14.useLayoutEffect(() => {
|
|
50447
|
+
setIndex(items.length);
|
|
50448
|
+
}, [items.length]);
|
|
50449
|
+
const children = itemsToRender.map((item, itemIndex) => {
|
|
50450
|
+
return render2(item, index + itemIndex);
|
|
50451
|
+
});
|
|
50452
|
+
const style = import_react14.useMemo(() => ({
|
|
50453
|
+
position: "absolute",
|
|
50454
|
+
flexDirection: "column",
|
|
50455
|
+
...customStyle
|
|
50456
|
+
}), [customStyle]);
|
|
50457
|
+
return import_react14.default.createElement("ink-box", { internal_static: true, style }, children);
|
|
50458
|
+
}
|
|
50449
50459
|
// node_modules/ink/build/components/Transform.js
|
|
50450
50460
|
var import_react15 = __toESM(require_react(), 1);
|
|
50451
50461
|
// node_modules/ink/build/components/Newline.js
|
|
@@ -66570,18 +66580,63 @@ function getSkillsPath(agentId, scope) {
|
|
|
66570
66580
|
}
|
|
66571
66581
|
return join(process.cwd(), agent.localPath);
|
|
66572
66582
|
}
|
|
66583
|
+
// src/services/github.ts
|
|
66584
|
+
function buildGitHubHeaders(token) {
|
|
66585
|
+
const headers = {
|
|
66586
|
+
Accept: "application/vnd.github+json",
|
|
66587
|
+
"X-GitHub-Api-Version": "2022-11-28"
|
|
66588
|
+
};
|
|
66589
|
+
if (token) {
|
|
66590
|
+
headers.Authorization = `Bearer ${token}`;
|
|
66591
|
+
}
|
|
66592
|
+
return headers;
|
|
66593
|
+
}
|
|
66594
|
+
function buildGitHubRawHeaders(token) {
|
|
66595
|
+
const headers = {
|
|
66596
|
+
Accept: "application/vnd.github.raw+json",
|
|
66597
|
+
"X-GitHub-Api-Version": "2022-11-28"
|
|
66598
|
+
};
|
|
66599
|
+
if (token) {
|
|
66600
|
+
headers.Authorization = `Bearer ${token}`;
|
|
66601
|
+
}
|
|
66602
|
+
return headers;
|
|
66603
|
+
}
|
|
66604
|
+
function isAuthRequired(response) {
|
|
66605
|
+
return response.status === 401 || response.status === 403 && !isRateLimited(response);
|
|
66606
|
+
}
|
|
66607
|
+
function isRateLimited(response) {
|
|
66608
|
+
return response.headers.get("X-RateLimit-Remaining") === "0";
|
|
66609
|
+
}
|
|
66610
|
+
function getGitHubErrorMessage(response) {
|
|
66611
|
+
if (response.status === 401) {
|
|
66612
|
+
return "This repository requires authentication. Run 'skilluse login' to access private repos.";
|
|
66613
|
+
}
|
|
66614
|
+
if (response.status === 403) {
|
|
66615
|
+
if (isRateLimited(response)) {
|
|
66616
|
+
return "Rate limit exceeded. Run 'skilluse login' for higher rate limits (5000 req/hr vs 60 req/hr).";
|
|
66617
|
+
}
|
|
66618
|
+
return "This repository requires authentication. Run 'skilluse login' to access private repos.";
|
|
66619
|
+
}
|
|
66620
|
+
if (response.status === 404) {
|
|
66621
|
+
return "Repository not found or requires authentication.";
|
|
66622
|
+
}
|
|
66623
|
+
return `GitHub API error: ${response.status}`;
|
|
66624
|
+
}
|
|
66625
|
+
|
|
66573
66626
|
// src/services/discovery.ts
|
|
66574
66627
|
var GITHUB_API_URL2 = "https://api.github.com";
|
|
66575
66628
|
async function discoverSkillPaths(owner, repo, branch, token) {
|
|
66576
66629
|
const url2 = `${GITHUB_API_URL2}/repos/${owner}/${repo}/git/trees/${branch}?recursive=1`;
|
|
66577
66630
|
const response = await fetch(url2, {
|
|
66578
|
-
headers:
|
|
66579
|
-
Accept: "application/vnd.github+json",
|
|
66580
|
-
Authorization: `Bearer ${token}`,
|
|
66581
|
-
"X-GitHub-Api-Version": "2022-11-28"
|
|
66582
|
-
}
|
|
66631
|
+
headers: buildGitHubHeaders(token)
|
|
66583
66632
|
});
|
|
66584
66633
|
if (!response.ok) {
|
|
66634
|
+
if (isAuthRequired(response)) {
|
|
66635
|
+
return {
|
|
66636
|
+
authRequired: true,
|
|
66637
|
+
message: getGitHubErrorMessage(response)
|
|
66638
|
+
};
|
|
66639
|
+
}
|
|
66585
66640
|
if (response.status === 404) {
|
|
66586
66641
|
throw new Error(`Repository ${owner}/${repo} not found or branch '${branch}' doesn't exist`);
|
|
66587
66642
|
}
|
|
@@ -66686,24 +66741,23 @@ async function getRemoteSkillInfo(token, skillName, repos) {
|
|
|
66686
66741
|
try {
|
|
66687
66742
|
const apiPath = basePath ? `https://api.github.com/repos/${repo}/contents/${basePath}?ref=${branch}` : `https://api.github.com/repos/${repo}/contents?ref=${branch}`;
|
|
66688
66743
|
const response = await fetch(apiPath, {
|
|
66689
|
-
headers:
|
|
66690
|
-
Authorization: `Bearer ${token}`,
|
|
66691
|
-
Accept: "application/vnd.github+json",
|
|
66692
|
-
"X-GitHub-Api-Version": "2022-11-28"
|
|
66693
|
-
}
|
|
66744
|
+
headers: buildGitHubHeaders(token)
|
|
66694
66745
|
});
|
|
66695
|
-
if (!response.ok)
|
|
66746
|
+
if (!response.ok) {
|
|
66747
|
+
if (isAuthRequired(response)) {
|
|
66748
|
+
return {
|
|
66749
|
+
authRequired: true,
|
|
66750
|
+
message: getGitHubErrorMessage(response)
|
|
66751
|
+
};
|
|
66752
|
+
}
|
|
66696
66753
|
continue;
|
|
66754
|
+
}
|
|
66697
66755
|
const contents = await response.json();
|
|
66698
66756
|
const dirs = contents.filter((item) => item.type === "dir" && item.name.toLowerCase() === skillName.toLowerCase());
|
|
66699
66757
|
for (const dir of dirs) {
|
|
66700
66758
|
const skillMdUrl = `https://api.github.com/repos/${repo}/contents/${dir.path}/SKILL.md?ref=${branch}`;
|
|
66701
66759
|
const skillResponse = await fetch(skillMdUrl, {
|
|
66702
|
-
headers:
|
|
66703
|
-
Authorization: `Bearer ${token}`,
|
|
66704
|
-
Accept: "application/vnd.github.raw+json",
|
|
66705
|
-
"X-GitHub-Api-Version": "2022-11-28"
|
|
66706
|
-
}
|
|
66760
|
+
headers: buildGitHubRawHeaders(token)
|
|
66707
66761
|
});
|
|
66708
66762
|
if (skillResponse.ok) {
|
|
66709
66763
|
const content = await skillResponse.text();
|
|
@@ -66731,12 +66785,6 @@ function Info({ args: [skillName] }) {
|
|
|
66731
66785
|
const [state, setState] = import_react31.useState({ phase: "checking" });
|
|
66732
66786
|
import_react31.useEffect(() => {
|
|
66733
66787
|
async function loadInfo() {
|
|
66734
|
-
const credentials = await getCredentials();
|
|
66735
|
-
if (!credentials) {
|
|
66736
|
-
setState({ phase: "not_logged_in" });
|
|
66737
|
-
exit();
|
|
66738
|
-
return;
|
|
66739
|
-
}
|
|
66740
66788
|
setState({ phase: "loading" });
|
|
66741
66789
|
const config2 = getConfig();
|
|
66742
66790
|
const installedSkill = config2.installed.find((s) => s.name.toLowerCase() === skillName.toLowerCase());
|
|
@@ -66748,9 +66796,16 @@ function Info({ args: [skillName] }) {
|
|
|
66748
66796
|
return;
|
|
66749
66797
|
}
|
|
66750
66798
|
}
|
|
66751
|
-
const
|
|
66752
|
-
|
|
66753
|
-
|
|
66799
|
+
const credentials = await getCredentials();
|
|
66800
|
+
const token = credentials?.token;
|
|
66801
|
+
const remoteResult = await getRemoteSkillInfo(token, skillName, config2.repos);
|
|
66802
|
+
if (remoteResult && "authRequired" in remoteResult) {
|
|
66803
|
+
setState({ phase: "auth_required", message: remoteResult.message });
|
|
66804
|
+
exit();
|
|
66805
|
+
return;
|
|
66806
|
+
}
|
|
66807
|
+
if (remoteResult) {
|
|
66808
|
+
setState({ phase: "success", info: remoteResult });
|
|
66754
66809
|
} else {
|
|
66755
66810
|
setState({ phase: "not_found", skillName });
|
|
66756
66811
|
}
|
|
@@ -66769,20 +66824,14 @@ function Info({ args: [skillName] }) {
|
|
|
66769
66824
|
return /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Spinner2, {
|
|
66770
66825
|
text: "Initializing..."
|
|
66771
66826
|
}, undefined, false, undefined, this);
|
|
66772
|
-
case "
|
|
66827
|
+
case "auth_required":
|
|
66773
66828
|
return /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
66774
66829
|
flexDirection: "column",
|
|
66775
|
-
children:
|
|
66776
|
-
|
|
66777
|
-
|
|
66778
|
-
|
|
66779
|
-
|
|
66780
|
-
/* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
66781
|
-
dimColor: true,
|
|
66782
|
-
children: "Run 'skilluse login' to authenticate with GitHub"
|
|
66783
|
-
}, undefined, false, undefined, this)
|
|
66784
|
-
]
|
|
66785
|
-
}, undefined, true, undefined, this);
|
|
66830
|
+
children: /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(StatusMessage, {
|
|
66831
|
+
type: "error",
|
|
66832
|
+
children: state.message
|
|
66833
|
+
}, undefined, false, undefined, this)
|
|
66834
|
+
}, undefined, false, undefined, this);
|
|
66786
66835
|
case "loading":
|
|
66787
66836
|
return /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Spinner2, {
|
|
66788
66837
|
text: `Loading info for "${skillName}"...`
|
|
@@ -67013,35 +67062,30 @@ async function findSkill(token, repos, skillName) {
|
|
|
67013
67062
|
try {
|
|
67014
67063
|
const apiPath = basePath ? `https://api.github.com/repos/${repo}/contents/${basePath}?ref=${branch}` : `https://api.github.com/repos/${repo}/contents?ref=${branch}`;
|
|
67015
67064
|
const response = await fetch(apiPath, {
|
|
67016
|
-
headers:
|
|
67017
|
-
Authorization: `Bearer ${token}`,
|
|
67018
|
-
Accept: "application/vnd.github+json",
|
|
67019
|
-
"X-GitHub-Api-Version": "2022-11-28"
|
|
67020
|
-
}
|
|
67065
|
+
headers: buildGitHubHeaders(token)
|
|
67021
67066
|
});
|
|
67022
|
-
if (!response.ok)
|
|
67067
|
+
if (!response.ok) {
|
|
67068
|
+
if (isAuthRequired(response)) {
|
|
67069
|
+
return {
|
|
67070
|
+
authRequired: true,
|
|
67071
|
+
message: getGitHubErrorMessage(response)
|
|
67072
|
+
};
|
|
67073
|
+
}
|
|
67023
67074
|
continue;
|
|
67075
|
+
}
|
|
67024
67076
|
const contents = await response.json();
|
|
67025
67077
|
const dirs = contents.filter((item) => item.type === "dir" && item.name.toLowerCase() === skillName.toLowerCase());
|
|
67026
67078
|
for (const dir of dirs) {
|
|
67027
67079
|
const skillMdUrl = `https://api.github.com/repos/${repo}/contents/${dir.path}/SKILL.md?ref=${branch}`;
|
|
67028
67080
|
const skillResponse = await fetch(skillMdUrl, {
|
|
67029
|
-
headers:
|
|
67030
|
-
Authorization: `Bearer ${token}`,
|
|
67031
|
-
Accept: "application/vnd.github.raw+json",
|
|
67032
|
-
"X-GitHub-Api-Version": "2022-11-28"
|
|
67033
|
-
}
|
|
67081
|
+
headers: buildGitHubRawHeaders(token)
|
|
67034
67082
|
});
|
|
67035
67083
|
if (skillResponse.ok) {
|
|
67036
67084
|
const content = await skillResponse.text();
|
|
67037
67085
|
const frontmatter = parseFrontmatter2(content);
|
|
67038
67086
|
const refUrl = `https://api.github.com/repos/${repo}/commits/${branch}`;
|
|
67039
67087
|
const refResponse = await fetch(refUrl, {
|
|
67040
|
-
headers:
|
|
67041
|
-
Authorization: `Bearer ${token}`,
|
|
67042
|
-
Accept: "application/vnd.github+json",
|
|
67043
|
-
"X-GitHub-Api-Version": "2022-11-28"
|
|
67044
|
-
}
|
|
67088
|
+
headers: buildGitHubHeaders(token)
|
|
67045
67089
|
});
|
|
67046
67090
|
let commitSha = branch;
|
|
67047
67091
|
if (refResponse.ok) {
|
|
@@ -67065,18 +67109,20 @@ async function findSkill(token, repos, skillName) {
|
|
|
67065
67109
|
} catch {}
|
|
67066
67110
|
}
|
|
67067
67111
|
}
|
|
67068
|
-
return results;
|
|
67112
|
+
return { results };
|
|
67069
67113
|
}
|
|
67070
67114
|
async function downloadSkillFiles(token, repo, skillPath, branch, targetDir, onProgress) {
|
|
67071
67115
|
const treeUrl = `https://api.github.com/repos/${repo}/git/trees/${branch}?recursive=1`;
|
|
67072
67116
|
const treeResponse = await fetch(treeUrl, {
|
|
67073
|
-
headers:
|
|
67074
|
-
Authorization: `Bearer ${token}`,
|
|
67075
|
-
Accept: "application/vnd.github+json",
|
|
67076
|
-
"X-GitHub-Api-Version": "2022-11-28"
|
|
67077
|
-
}
|
|
67117
|
+
headers: buildGitHubHeaders(token)
|
|
67078
67118
|
});
|
|
67079
67119
|
if (!treeResponse.ok) {
|
|
67120
|
+
if (isAuthRequired(treeResponse)) {
|
|
67121
|
+
return {
|
|
67122
|
+
authRequired: true,
|
|
67123
|
+
message: getGitHubErrorMessage(treeResponse)
|
|
67124
|
+
};
|
|
67125
|
+
}
|
|
67080
67126
|
throw new Error(`Failed to fetch repository tree: ${treeResponse.status}`);
|
|
67081
67127
|
}
|
|
67082
67128
|
const treeData = await treeResponse.json();
|
|
@@ -67095,13 +67141,15 @@ async function downloadSkillFiles(token, repo, skillPath, branch, targetDir, onP
|
|
|
67095
67141
|
}
|
|
67096
67142
|
const fileUrl = `https://api.github.com/repos/${repo}/contents/${file2.path}?ref=${branch}`;
|
|
67097
67143
|
const fileResponse = await fetch(fileUrl, {
|
|
67098
|
-
headers:
|
|
67099
|
-
Authorization: `Bearer ${token}`,
|
|
67100
|
-
Accept: "application/vnd.github.raw+json",
|
|
67101
|
-
"X-GitHub-Api-Version": "2022-11-28"
|
|
67102
|
-
}
|
|
67144
|
+
headers: buildGitHubRawHeaders(token)
|
|
67103
67145
|
});
|
|
67104
67146
|
if (!fileResponse.ok) {
|
|
67147
|
+
if (isAuthRequired(fileResponse)) {
|
|
67148
|
+
return {
|
|
67149
|
+
authRequired: true,
|
|
67150
|
+
message: getGitHubErrorMessage(fileResponse)
|
|
67151
|
+
};
|
|
67152
|
+
}
|
|
67105
67153
|
throw new Error(`Failed to download file: ${file2.path}`);
|
|
67106
67154
|
}
|
|
67107
67155
|
const content = await fileResponse.text();
|
|
@@ -67118,13 +67166,15 @@ async function fetchGitHubSkill(token, owner, repo, path6, branch = "main") {
|
|
|
67118
67166
|
try {
|
|
67119
67167
|
const refUrl = `https://api.github.com/repos/${fullRepo}/commits/${branch}`;
|
|
67120
67168
|
const refResponse = await fetch(refUrl, {
|
|
67121
|
-
headers:
|
|
67122
|
-
Authorization: `Bearer ${token}`,
|
|
67123
|
-
Accept: "application/vnd.github+json",
|
|
67124
|
-
"X-GitHub-Api-Version": "2022-11-28"
|
|
67125
|
-
}
|
|
67169
|
+
headers: buildGitHubHeaders(token)
|
|
67126
67170
|
});
|
|
67127
67171
|
if (!refResponse.ok) {
|
|
67172
|
+
if (isAuthRequired(refResponse)) {
|
|
67173
|
+
return {
|
|
67174
|
+
authRequired: true,
|
|
67175
|
+
message: getGitHubErrorMessage(refResponse)
|
|
67176
|
+
};
|
|
67177
|
+
}
|
|
67128
67178
|
return null;
|
|
67129
67179
|
}
|
|
67130
67180
|
const refData = await refResponse.json();
|
|
@@ -67132,13 +67182,15 @@ async function fetchGitHubSkill(token, owner, repo, path6, branch = "main") {
|
|
|
67132
67182
|
const skillMdPath = skillPath ? `${skillPath}/SKILL.md` : "SKILL.md";
|
|
67133
67183
|
const skillMdUrl = `https://api.github.com/repos/${fullRepo}/contents/${skillMdPath}?ref=${branch}`;
|
|
67134
67184
|
const skillResponse = await fetch(skillMdUrl, {
|
|
67135
|
-
headers:
|
|
67136
|
-
Authorization: `Bearer ${token}`,
|
|
67137
|
-
Accept: "application/vnd.github.raw+json",
|
|
67138
|
-
"X-GitHub-Api-Version": "2022-11-28"
|
|
67139
|
-
}
|
|
67185
|
+
headers: buildGitHubRawHeaders(token)
|
|
67140
67186
|
});
|
|
67141
67187
|
if (!skillResponse.ok) {
|
|
67188
|
+
if (isAuthRequired(skillResponse)) {
|
|
67189
|
+
return {
|
|
67190
|
+
authRequired: true,
|
|
67191
|
+
message: getGitHubErrorMessage(skillResponse)
|
|
67192
|
+
};
|
|
67193
|
+
}
|
|
67142
67194
|
return null;
|
|
67143
67195
|
}
|
|
67144
67196
|
const content = await skillResponse.text();
|
|
@@ -67262,14 +67314,15 @@ function Install({ args: [skillName], options: opts }) {
|
|
|
67262
67314
|
}
|
|
67263
67315
|
}
|
|
67264
67316
|
const credentials = await getCredentials();
|
|
67265
|
-
|
|
67266
|
-
setState({ phase: "not_logged_in" });
|
|
67267
|
-
exit();
|
|
67268
|
-
return;
|
|
67269
|
-
}
|
|
67317
|
+
const token = credentials?.token;
|
|
67270
67318
|
if (source.type === "github") {
|
|
67271
67319
|
setState({ phase: "searching", repo: `${source.owner}/${source.repo}` });
|
|
67272
|
-
const result = await fetchGitHubSkill(
|
|
67320
|
+
const result = await fetchGitHubSkill(token, source.owner, source.repo, source.path);
|
|
67321
|
+
if (result && "authRequired" in result) {
|
|
67322
|
+
setState({ phase: "auth_required", message: result.message });
|
|
67323
|
+
exit();
|
|
67324
|
+
return;
|
|
67325
|
+
}
|
|
67273
67326
|
if (!result) {
|
|
67274
67327
|
setState({
|
|
67275
67328
|
phase: "not_found",
|
|
@@ -67299,7 +67352,7 @@ function Install({ args: [skillName], options: opts }) {
|
|
|
67299
67352
|
});
|
|
67300
67353
|
try {
|
|
67301
67354
|
const skillPath = source.path || "";
|
|
67302
|
-
await downloadSkillFiles(
|
|
67355
|
+
const downloadResult = await downloadSkillFiles(token, `${source.owner}/${source.repo}`, skillPath, "main", installPath2, (downloaded, total) => {
|
|
67303
67356
|
const downloadProgress = 25 + downloaded / total * 50;
|
|
67304
67357
|
setState((prev) => {
|
|
67305
67358
|
if (prev.phase !== "installing")
|
|
@@ -67307,6 +67360,11 @@ function Install({ args: [skillName], options: opts }) {
|
|
|
67307
67360
|
return { ...prev, progress: Math.round(downloadProgress) };
|
|
67308
67361
|
});
|
|
67309
67362
|
});
|
|
67363
|
+
if (downloadResult && "authRequired" in downloadResult) {
|
|
67364
|
+
setState({ phase: "auth_required", message: downloadResult.message });
|
|
67365
|
+
exit();
|
|
67366
|
+
return;
|
|
67367
|
+
}
|
|
67310
67368
|
steps2[1].status = "done";
|
|
67311
67369
|
steps2[2].status = "in_progress";
|
|
67312
67370
|
setState((prev) => {
|
|
@@ -67351,7 +67409,13 @@ function Install({ args: [skillName], options: opts }) {
|
|
|
67351
67409
|
for (const repo of allRepos) {
|
|
67352
67410
|
setState({ phase: "searching", repo: repo.repo });
|
|
67353
67411
|
}
|
|
67354
|
-
const
|
|
67412
|
+
const findResult = await findSkill(token, allRepos, source.name);
|
|
67413
|
+
if ("authRequired" in findResult) {
|
|
67414
|
+
setState({ phase: "auth_required", message: findResult.message });
|
|
67415
|
+
exit();
|
|
67416
|
+
return;
|
|
67417
|
+
}
|
|
67418
|
+
const { results } = findResult;
|
|
67355
67419
|
if (results.length === 0) {
|
|
67356
67420
|
setState({ phase: "not_found", skillName: source.name });
|
|
67357
67421
|
exit();
|
|
@@ -67391,7 +67455,7 @@ function Install({ args: [skillName], options: opts }) {
|
|
|
67391
67455
|
try {
|
|
67392
67456
|
const repoConfig = config2.repos.find((r) => r.repo === skill.repo);
|
|
67393
67457
|
const branch = repoConfig?.branch || "main";
|
|
67394
|
-
await downloadSkillFiles(
|
|
67458
|
+
const downloadResult = await downloadSkillFiles(token, skill.repo, skill.path, branch, installPath, (downloaded, total) => {
|
|
67395
67459
|
const downloadProgress = 25 + downloaded / total * 50;
|
|
67396
67460
|
setState((prev) => {
|
|
67397
67461
|
if (prev.phase !== "installing")
|
|
@@ -67399,6 +67463,11 @@ function Install({ args: [skillName], options: opts }) {
|
|
|
67399
67463
|
return { ...prev, progress: Math.round(downloadProgress) };
|
|
67400
67464
|
});
|
|
67401
67465
|
});
|
|
67466
|
+
if (downloadResult && "authRequired" in downloadResult) {
|
|
67467
|
+
setState({ phase: "auth_required", message: downloadResult.message });
|
|
67468
|
+
exit();
|
|
67469
|
+
return;
|
|
67470
|
+
}
|
|
67402
67471
|
steps[1].status = "done";
|
|
67403
67472
|
steps[2].status = "in_progress";
|
|
67404
67473
|
setState((prev) => {
|
|
@@ -67458,20 +67527,14 @@ function Install({ args: [skillName], options: opts }) {
|
|
|
67458
67527
|
return /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Spinner2, {
|
|
67459
67528
|
text: "Initializing..."
|
|
67460
67529
|
}, undefined, false, undefined, this);
|
|
67461
|
-
case "
|
|
67530
|
+
case "auth_required":
|
|
67462
67531
|
return /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
|
|
67463
67532
|
flexDirection: "column",
|
|
67464
|
-
children:
|
|
67465
|
-
|
|
67466
|
-
|
|
67467
|
-
|
|
67468
|
-
|
|
67469
|
-
/* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
67470
|
-
dimColor: true,
|
|
67471
|
-
children: "Run 'skilluse login' to authenticate with GitHub"
|
|
67472
|
-
}, undefined, false, undefined, this)
|
|
67473
|
-
]
|
|
67474
|
-
}, undefined, true, undefined, this);
|
|
67533
|
+
children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(StatusMessage, {
|
|
67534
|
+
type: "error",
|
|
67535
|
+
children: state.message
|
|
67536
|
+
}, undefined, false, undefined, this)
|
|
67537
|
+
}, undefined, false, undefined, this);
|
|
67475
67538
|
case "no_repos":
|
|
67476
67539
|
return /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
|
|
67477
67540
|
flexDirection: "column",
|
|
@@ -67678,13 +67741,15 @@ async function checkForUpdate(token, skill, repoConfig) {
|
|
|
67678
67741
|
try {
|
|
67679
67742
|
const refUrl = `https://api.github.com/repos/${repo}/commits/${branch}`;
|
|
67680
67743
|
const refResponse = await fetch(refUrl, {
|
|
67681
|
-
headers:
|
|
67682
|
-
Authorization: `Bearer ${token}`,
|
|
67683
|
-
Accept: "application/vnd.github+json",
|
|
67684
|
-
"X-GitHub-Api-Version": "2022-11-28"
|
|
67685
|
-
}
|
|
67744
|
+
headers: buildGitHubHeaders(token)
|
|
67686
67745
|
});
|
|
67687
67746
|
if (!refResponse.ok) {
|
|
67747
|
+
if (isAuthRequired(refResponse)) {
|
|
67748
|
+
return {
|
|
67749
|
+
authRequired: true,
|
|
67750
|
+
message: getGitHubErrorMessage(refResponse)
|
|
67751
|
+
};
|
|
67752
|
+
}
|
|
67688
67753
|
return { ...skill, hasUpdate: false };
|
|
67689
67754
|
}
|
|
67690
67755
|
const refData = await refResponse.json();
|
|
@@ -67694,11 +67759,7 @@ async function checkForUpdate(token, skill, repoConfig) {
|
|
|
67694
67759
|
}
|
|
67695
67760
|
const skillMdUrl = `https://api.github.com/repos/${repo}/contents/${skill.repoPath}/SKILL.md?ref=${branch}`;
|
|
67696
67761
|
const skillResponse = await fetch(skillMdUrl, {
|
|
67697
|
-
headers:
|
|
67698
|
-
Authorization: `Bearer ${token}`,
|
|
67699
|
-
Accept: "application/vnd.github.raw+json",
|
|
67700
|
-
"X-GitHub-Api-Version": "2022-11-28"
|
|
67701
|
-
}
|
|
67762
|
+
headers: buildGitHubRawHeaders(token)
|
|
67702
67763
|
});
|
|
67703
67764
|
let latestVersion = skill.version;
|
|
67704
67765
|
if (skillResponse.ok) {
|
|
@@ -67723,12 +67784,6 @@ function List({ options: opts }) {
|
|
|
67723
67784
|
const [state, setState] = import_react33.useState({ phase: "checking" });
|
|
67724
67785
|
import_react33.useEffect(() => {
|
|
67725
67786
|
async function loadSkills() {
|
|
67726
|
-
const credentials = await getCredentials();
|
|
67727
|
-
if (!credentials) {
|
|
67728
|
-
setState({ phase: "not_logged_in" });
|
|
67729
|
-
exit();
|
|
67730
|
-
return;
|
|
67731
|
-
}
|
|
67732
67787
|
const config2 = getConfig();
|
|
67733
67788
|
const currentAgent = getCurrentAgent();
|
|
67734
67789
|
const skills = opts.all ? config2.installed : config2.installed.filter((s) => s.agent === currentAgent || !s.agent);
|
|
@@ -67743,6 +67798,8 @@ function List({ options: opts }) {
|
|
|
67743
67798
|
exit();
|
|
67744
67799
|
return;
|
|
67745
67800
|
}
|
|
67801
|
+
const credentials = await getCredentials();
|
|
67802
|
+
const token = credentials?.token;
|
|
67746
67803
|
const skillsWithUpdates = [];
|
|
67747
67804
|
for (let i = 0;i < skills.length; i++) {
|
|
67748
67805
|
setState({
|
|
@@ -67753,9 +67810,17 @@ function List({ options: opts }) {
|
|
|
67753
67810
|
const skill = skills[i];
|
|
67754
67811
|
const repoConfig = config2.repos.find((r) => r.repo === skill.repo);
|
|
67755
67812
|
if (repoConfig) {
|
|
67756
|
-
const
|
|
67757
|
-
if (
|
|
67758
|
-
|
|
67813
|
+
const result = await checkForUpdate(token, skill, repoConfig);
|
|
67814
|
+
if ("authRequired" in result) {
|
|
67815
|
+
setState({
|
|
67816
|
+
phase: "auth_required",
|
|
67817
|
+
message: result.message
|
|
67818
|
+
});
|
|
67819
|
+
exit();
|
|
67820
|
+
return;
|
|
67821
|
+
}
|
|
67822
|
+
if (result.hasUpdate) {
|
|
67823
|
+
skillsWithUpdates.push(result);
|
|
67759
67824
|
}
|
|
67760
67825
|
}
|
|
67761
67826
|
}
|
|
@@ -67775,20 +67840,14 @@ function List({ options: opts }) {
|
|
|
67775
67840
|
return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Spinner2, {
|
|
67776
67841
|
text: "Loading..."
|
|
67777
67842
|
}, undefined, false, undefined, this);
|
|
67778
|
-
case "
|
|
67843
|
+
case "auth_required":
|
|
67779
67844
|
return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Box_default, {
|
|
67780
67845
|
flexDirection: "column",
|
|
67781
|
-
children:
|
|
67782
|
-
|
|
67783
|
-
|
|
67784
|
-
|
|
67785
|
-
|
|
67786
|
-
/* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Text, {
|
|
67787
|
-
dimColor: true,
|
|
67788
|
-
children: "Run 'skilluse login' to authenticate with GitHub"
|
|
67789
|
-
}, undefined, false, undefined, this)
|
|
67790
|
-
]
|
|
67791
|
-
}, undefined, true, undefined, this);
|
|
67846
|
+
children: /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(StatusMessage, {
|
|
67847
|
+
type: "error",
|
|
67848
|
+
children: state.message
|
|
67849
|
+
}, undefined, false, undefined, this)
|
|
67850
|
+
}, undefined, false, undefined, this);
|
|
67792
67851
|
case "checking_updates":
|
|
67793
67852
|
return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Spinner2, {
|
|
67794
67853
|
text: `Checking for updates (${state.current}/${state.total})...`
|
|
@@ -68340,12 +68399,6 @@ function RepoAdd({ args: [repoArg], options: opts }) {
|
|
|
68340
68399
|
const [state, setState] = import_react36.useState({ phase: "checking" });
|
|
68341
68400
|
import_react36.useEffect(() => {
|
|
68342
68401
|
async function checkAndAdd() {
|
|
68343
|
-
const credentials = await getCredentials();
|
|
68344
|
-
if (!credentials) {
|
|
68345
|
-
setState({ phase: "not_logged_in" });
|
|
68346
|
-
exit();
|
|
68347
|
-
return;
|
|
68348
|
-
}
|
|
68349
68402
|
if (!repoArg.match(/^[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+$/)) {
|
|
68350
68403
|
setState({ phase: "invalid_repo" });
|
|
68351
68404
|
exit();
|
|
@@ -68380,15 +68433,22 @@ function RepoAdd({ args: [repoArg], options: opts }) {
|
|
|
68380
68433
|
}
|
|
68381
68434
|
setState({ phase: "discovering", repo: repoArg });
|
|
68382
68435
|
try {
|
|
68436
|
+
const credentials = await getCredentials();
|
|
68437
|
+
const token = credentials?.token;
|
|
68383
68438
|
const [owner, repo] = repoArg.split("/");
|
|
68384
|
-
const
|
|
68385
|
-
if (
|
|
68439
|
+
const result = await discoverSkillPaths(owner, repo, opts.branch, token);
|
|
68440
|
+
if ("authRequired" in result) {
|
|
68441
|
+
setState({ phase: "auth_required", message: result.message });
|
|
68442
|
+
exit();
|
|
68443
|
+
return;
|
|
68444
|
+
}
|
|
68445
|
+
if (result.totalSkills === 0) {
|
|
68386
68446
|
setState({ phase: "no_skills_found", repo: repoArg });
|
|
68387
68447
|
} else {
|
|
68388
68448
|
setState({
|
|
68389
68449
|
phase: "select_paths",
|
|
68390
68450
|
repo: repoArg,
|
|
68391
|
-
discovery
|
|
68451
|
+
discovery: result
|
|
68392
68452
|
});
|
|
68393
68453
|
}
|
|
68394
68454
|
} catch (error46) {
|
|
@@ -68494,20 +68554,14 @@ function RepoAdd({ args: [repoArg], options: opts }) {
|
|
|
68494
68554
|
return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Spinner2, {
|
|
68495
68555
|
text: "Checking..."
|
|
68496
68556
|
}, undefined, false, undefined, this);
|
|
68497
|
-
case "
|
|
68557
|
+
case "auth_required":
|
|
68498
68558
|
return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Box_default, {
|
|
68499
68559
|
flexDirection: "column",
|
|
68500
|
-
children:
|
|
68501
|
-
|
|
68502
|
-
|
|
68503
|
-
|
|
68504
|
-
|
|
68505
|
-
/* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
|
|
68506
|
-
dimColor: true,
|
|
68507
|
-
children: "Run 'skilluse login' to authenticate with GitHub"
|
|
68508
|
-
}, undefined, false, undefined, this)
|
|
68509
|
-
]
|
|
68510
|
-
}, undefined, true, undefined, this);
|
|
68560
|
+
children: /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(StatusMessage, {
|
|
68561
|
+
type: "error",
|
|
68562
|
+
children: state.message
|
|
68563
|
+
}, undefined, false, undefined, this)
|
|
68564
|
+
}, undefined, false, undefined, this);
|
|
68511
68565
|
case "invalid_repo":
|
|
68512
68566
|
return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Box_default, {
|
|
68513
68567
|
flexDirection: "column",
|
|
@@ -68714,13 +68768,7 @@ function RepoEdit({ args: [repoArg], options: opts }) {
|
|
|
68714
68768
|
const { exit } = use_app_default();
|
|
68715
68769
|
const [state, setState] = import_react37.useState({ phase: "checking" });
|
|
68716
68770
|
import_react37.useEffect(() => {
|
|
68717
|
-
|
|
68718
|
-
const credentials = await getCredentials();
|
|
68719
|
-
if (!credentials) {
|
|
68720
|
-
setState({ phase: "not_logged_in" });
|
|
68721
|
-
exit();
|
|
68722
|
-
return;
|
|
68723
|
-
}
|
|
68771
|
+
function checkAndEdit() {
|
|
68724
68772
|
const config2 = getConfig();
|
|
68725
68773
|
const existingConfig = config2.repos.find((r) => r.repo === repoArg);
|
|
68726
68774
|
if (!existingConfig) {
|
|
@@ -68793,20 +68841,6 @@ function RepoEdit({ args: [repoArg], options: opts }) {
|
|
|
68793
68841
|
return /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(Spinner2, {
|
|
68794
68842
|
text: "Checking..."
|
|
68795
68843
|
}, undefined, false, undefined, this);
|
|
68796
|
-
case "not_logged_in":
|
|
68797
|
-
return /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(Box_default, {
|
|
68798
|
-
flexDirection: "column",
|
|
68799
|
-
children: [
|
|
68800
|
-
/* @__PURE__ */ jsx_dev_runtime14.jsxDEV(StatusMessage, {
|
|
68801
|
-
type: "error",
|
|
68802
|
-
children: "Not authenticated"
|
|
68803
|
-
}, undefined, false, undefined, this),
|
|
68804
|
-
/* @__PURE__ */ jsx_dev_runtime14.jsxDEV(Text, {
|
|
68805
|
-
dimColor: true,
|
|
68806
|
-
children: "Run 'skilluse login' to authenticate with GitHub"
|
|
68807
|
-
}, undefined, false, undefined, this)
|
|
68808
|
-
]
|
|
68809
|
-
}, undefined, true, undefined, this);
|
|
68810
68844
|
case "not_found":
|
|
68811
68845
|
return /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(Box_default, {
|
|
68812
68846
|
flexDirection: "column",
|
|
@@ -69080,71 +69114,58 @@ var options9 = exports_external.object({});
|
|
|
69080
69114
|
function RepoList(_props) {
|
|
69081
69115
|
const { exit } = use_app_default();
|
|
69082
69116
|
const [state, setState] = import_react39.useState({ phase: "checking" });
|
|
69117
|
+
const [outputItems, setOutputItems] = import_react39.useState([]);
|
|
69083
69118
|
import_react39.useEffect(() => {
|
|
69084
|
-
|
|
69085
|
-
|
|
69086
|
-
|
|
69087
|
-
|
|
69088
|
-
|
|
69089
|
-
|
|
69090
|
-
|
|
69091
|
-
|
|
69092
|
-
|
|
69093
|
-
|
|
69094
|
-
defaultRepo: config2.defaultRepo,
|
|
69095
|
-
repos: config2.repos
|
|
69096
|
-
});
|
|
69097
|
-
exit();
|
|
69119
|
+
const config2 = getConfig();
|
|
69120
|
+
setState({
|
|
69121
|
+
phase: "success",
|
|
69122
|
+
defaultRepo: config2.defaultRepo,
|
|
69123
|
+
repos: config2.repos
|
|
69124
|
+
});
|
|
69125
|
+
}, []);
|
|
69126
|
+
import_react39.useEffect(() => {
|
|
69127
|
+
if (state.phase !== "checking" && outputItems.length === 0) {
|
|
69128
|
+
setOutputItems([{ id: "output" }]);
|
|
69098
69129
|
}
|
|
69099
|
-
|
|
69100
|
-
|
|
69101
|
-
|
|
69102
|
-
|
|
69103
|
-
|
|
69104
|
-
|
|
69130
|
+
}, [state.phase, outputItems.length]);
|
|
69131
|
+
import_react39.useEffect(() => {
|
|
69132
|
+
if (outputItems.length > 0) {
|
|
69133
|
+
process.nextTick(() => exit());
|
|
69134
|
+
}
|
|
69135
|
+
}, [outputItems.length, exit]);
|
|
69136
|
+
const renderContent = () => {
|
|
69137
|
+
if (state.phase === "error") {
|
|
69138
|
+
return /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(StatusMessage, {
|
|
69139
|
+
type: "error",
|
|
69140
|
+
children: state.message
|
|
69105
69141
|
}, undefined, false, undefined, this);
|
|
69106
|
-
|
|
69107
|
-
|
|
69108
|
-
|
|
69142
|
+
}
|
|
69143
|
+
if (state.phase === "success" && state.repos.length === 0) {
|
|
69144
|
+
return /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(jsx_dev_runtime16.Fragment, {
|
|
69109
69145
|
children: [
|
|
69110
|
-
/* @__PURE__ */ jsx_dev_runtime16.jsxDEV(StatusMessage, {
|
|
69111
|
-
type: "error",
|
|
69112
|
-
children: "Not authenticated"
|
|
69113
|
-
}, undefined, false, undefined, this),
|
|
69114
69146
|
/* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Text, {
|
|
69115
|
-
|
|
69116
|
-
children: "
|
|
69147
|
+
bold: true,
|
|
69148
|
+
children: "Configured Repositories"
|
|
69149
|
+
}, undefined, false, undefined, this),
|
|
69150
|
+
/* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Box_default, {
|
|
69151
|
+
marginTop: 1,
|
|
69152
|
+
children: /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Text, {
|
|
69153
|
+
dimColor: true,
|
|
69154
|
+
children: "(no repositories configured)"
|
|
69155
|
+
}, undefined, false, undefined, this)
|
|
69156
|
+
}, undefined, false, undefined, this),
|
|
69157
|
+
/* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Box_default, {
|
|
69158
|
+
marginTop: 1,
|
|
69159
|
+
children: /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Text, {
|
|
69160
|
+
dimColor: true,
|
|
69161
|
+
children: "Run 'skilluse repo add owner/repo' to add one."
|
|
69162
|
+
}, undefined, false, undefined, this)
|
|
69117
69163
|
}, undefined, false, undefined, this)
|
|
69118
69164
|
]
|
|
69119
69165
|
}, undefined, true, undefined, this);
|
|
69120
|
-
|
|
69121
|
-
|
|
69122
|
-
|
|
69123
|
-
flexDirection: "column",
|
|
69124
|
-
children: [
|
|
69125
|
-
/* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Text, {
|
|
69126
|
-
bold: true,
|
|
69127
|
-
children: "Configured Repositories"
|
|
69128
|
-
}, undefined, false, undefined, this),
|
|
69129
|
-
/* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Box_default, {
|
|
69130
|
-
marginTop: 1,
|
|
69131
|
-
children: /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Text, {
|
|
69132
|
-
dimColor: true,
|
|
69133
|
-
children: "(no repositories configured)"
|
|
69134
|
-
}, undefined, false, undefined, this)
|
|
69135
|
-
}, undefined, false, undefined, this),
|
|
69136
|
-
/* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Box_default, {
|
|
69137
|
-
marginTop: 1,
|
|
69138
|
-
children: /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Text, {
|
|
69139
|
-
dimColor: true,
|
|
69140
|
-
children: "Run 'skilluse repo add owner/repo' to add one."
|
|
69141
|
-
}, undefined, false, undefined, this)
|
|
69142
|
-
}, undefined, false, undefined, this)
|
|
69143
|
-
]
|
|
69144
|
-
}, undefined, true, undefined, this);
|
|
69145
|
-
}
|
|
69146
|
-
return /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Box_default, {
|
|
69147
|
-
flexDirection: "column",
|
|
69166
|
+
}
|
|
69167
|
+
if (state.phase === "success") {
|
|
69168
|
+
return /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(jsx_dev_runtime16.Fragment, {
|
|
69148
69169
|
children: [
|
|
69149
69170
|
/* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Text, {
|
|
69150
69171
|
bold: true,
|
|
@@ -69194,12 +69215,23 @@ function RepoList(_props) {
|
|
|
69194
69215
|
})
|
|
69195
69216
|
]
|
|
69196
69217
|
}, undefined, true, undefined, this);
|
|
69197
|
-
|
|
69198
|
-
|
|
69199
|
-
|
|
69200
|
-
|
|
69201
|
-
|
|
69202
|
-
|
|
69218
|
+
}
|
|
69219
|
+
return null;
|
|
69220
|
+
};
|
|
69221
|
+
return /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(jsx_dev_runtime16.Fragment, {
|
|
69222
|
+
children: [
|
|
69223
|
+
state.phase === "checking" && /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Spinner2, {
|
|
69224
|
+
text: "Loading..."
|
|
69225
|
+
}, undefined, false, undefined, this),
|
|
69226
|
+
/* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Static, {
|
|
69227
|
+
items: outputItems,
|
|
69228
|
+
children: (item) => /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Box_default, {
|
|
69229
|
+
flexDirection: "column",
|
|
69230
|
+
children: renderContent()
|
|
69231
|
+
}, item.id, false, undefined, this)
|
|
69232
|
+
}, undefined, false, undefined, this)
|
|
69233
|
+
]
|
|
69234
|
+
}, undefined, true, undefined, this);
|
|
69203
69235
|
}
|
|
69204
69236
|
|
|
69205
69237
|
// src/commands/repo/remove.tsx
|
|
@@ -69215,13 +69247,7 @@ function RepoRemove({ args: [repoArg], options: opts }) {
|
|
|
69215
69247
|
const { exit } = use_app_default();
|
|
69216
69248
|
const [state, setState] = import_react40.useState({ phase: "checking" });
|
|
69217
69249
|
import_react40.useEffect(() => {
|
|
69218
|
-
|
|
69219
|
-
const credentials = await getCredentials();
|
|
69220
|
-
if (!credentials) {
|
|
69221
|
-
setState({ phase: "not_logged_in" });
|
|
69222
|
-
exit();
|
|
69223
|
-
return;
|
|
69224
|
-
}
|
|
69250
|
+
function checkAndRemove() {
|
|
69225
69251
|
const config2 = getConfig();
|
|
69226
69252
|
if (!config2.repos.find((r) => r.repo === repoArg)) {
|
|
69227
69253
|
setState({ phase: "not_found", repo: repoArg });
|
|
@@ -69258,20 +69284,6 @@ function RepoRemove({ args: [repoArg], options: opts }) {
|
|
|
69258
69284
|
return /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Spinner2, {
|
|
69259
69285
|
text: "Checking..."
|
|
69260
69286
|
}, undefined, false, undefined, this);
|
|
69261
|
-
case "not_logged_in":
|
|
69262
|
-
return /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Box_default, {
|
|
69263
|
-
flexDirection: "column",
|
|
69264
|
-
children: [
|
|
69265
|
-
/* @__PURE__ */ jsx_dev_runtime17.jsxDEV(StatusMessage, {
|
|
69266
|
-
type: "error",
|
|
69267
|
-
children: "Not authenticated"
|
|
69268
|
-
}, undefined, false, undefined, this),
|
|
69269
|
-
/* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Text, {
|
|
69270
|
-
dimColor: true,
|
|
69271
|
-
children: "Run 'skilluse login' to authenticate with GitHub"
|
|
69272
|
-
}, undefined, false, undefined, this)
|
|
69273
|
-
]
|
|
69274
|
-
}, undefined, true, undefined, this);
|
|
69275
69287
|
case "not_found":
|
|
69276
69288
|
return /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Box_default, {
|
|
69277
69289
|
flexDirection: "column",
|
|
@@ -69344,94 +69356,92 @@ var options11 = exports_external.object({});
|
|
|
69344
69356
|
function RepoUse({ args: [repoArg], options: _opts }) {
|
|
69345
69357
|
const { exit } = use_app_default();
|
|
69346
69358
|
const [state, setState] = import_react41.useState({ phase: "checking" });
|
|
69359
|
+
const [outputItems, setOutputItems] = import_react41.useState([]);
|
|
69347
69360
|
import_react41.useEffect(() => {
|
|
69348
|
-
|
|
69349
|
-
|
|
69350
|
-
|
|
69351
|
-
|
|
69352
|
-
exit();
|
|
69353
|
-
return;
|
|
69354
|
-
}
|
|
69355
|
-
const config2 = getConfig();
|
|
69356
|
-
if (!config2.repos.find((r) => r.repo === repoArg)) {
|
|
69357
|
-
setState({ phase: "not_found", repo: repoArg });
|
|
69358
|
-
exit();
|
|
69359
|
-
return;
|
|
69360
|
-
}
|
|
69361
|
-
if (config2.defaultRepo === repoArg) {
|
|
69362
|
-
setState({ phase: "already_default", repo: repoArg });
|
|
69363
|
-
exit();
|
|
69364
|
-
return;
|
|
69365
|
-
}
|
|
69366
|
-
setDefaultRepo(repoArg);
|
|
69367
|
-
setState({ phase: "success", repo: repoArg });
|
|
69368
|
-
exit();
|
|
69361
|
+
const config2 = getConfig();
|
|
69362
|
+
if (!config2.repos.find((r) => r.repo === repoArg)) {
|
|
69363
|
+
setState({ phase: "not_found", repo: repoArg });
|
|
69364
|
+
return;
|
|
69369
69365
|
}
|
|
69370
|
-
|
|
69371
|
-
|
|
69372
|
-
|
|
69373
|
-
|
|
69374
|
-
|
|
69366
|
+
if (config2.defaultRepo === repoArg) {
|
|
69367
|
+
setState({ phase: "already_default", repo: repoArg });
|
|
69368
|
+
return;
|
|
69369
|
+
}
|
|
69370
|
+
setDefaultRepo(repoArg);
|
|
69371
|
+
setState({ phase: "success", repo: repoArg });
|
|
69372
|
+
}, [repoArg]);
|
|
69373
|
+
import_react41.useEffect(() => {
|
|
69374
|
+
if (state.phase !== "checking" && outputItems.length === 0) {
|
|
69375
|
+
setOutputItems([{ id: "output" }]);
|
|
69376
|
+
}
|
|
69377
|
+
}, [state.phase, outputItems.length]);
|
|
69378
|
+
import_react41.useEffect(() => {
|
|
69379
|
+
if (outputItems.length > 0) {
|
|
69380
|
+
process.nextTick(() => exit());
|
|
69381
|
+
}
|
|
69382
|
+
}, [outputItems.length, exit]);
|
|
69383
|
+
const renderContent = () => {
|
|
69384
|
+
switch (state.phase) {
|
|
69385
|
+
case "not_found":
|
|
69386
|
+
return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(jsx_dev_runtime18.Fragment, {
|
|
69387
|
+
children: [
|
|
69388
|
+
/* @__PURE__ */ jsx_dev_runtime18.jsxDEV(StatusMessage, {
|
|
69389
|
+
type: "error",
|
|
69390
|
+
children: [
|
|
69391
|
+
"Repository ",
|
|
69392
|
+
state.repo,
|
|
69393
|
+
" not found in config"
|
|
69394
|
+
]
|
|
69395
|
+
}, undefined, true, undefined, this),
|
|
69396
|
+
/* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Text, {
|
|
69397
|
+
dimColor: true,
|
|
69398
|
+
children: [
|
|
69399
|
+
"Run 'skilluse repo add ",
|
|
69400
|
+
state.repo,
|
|
69401
|
+
"' to add it first."
|
|
69402
|
+
]
|
|
69403
|
+
}, undefined, true, undefined, this)
|
|
69404
|
+
]
|
|
69405
|
+
}, undefined, true, undefined, this);
|
|
69406
|
+
case "already_default":
|
|
69407
|
+
return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(StatusMessage, {
|
|
69408
|
+
type: "success",
|
|
69409
|
+
children: [
|
|
69410
|
+
state.repo,
|
|
69411
|
+
" is already the default"
|
|
69412
|
+
]
|
|
69413
|
+
}, undefined, true, undefined, this);
|
|
69414
|
+
case "success":
|
|
69415
|
+
return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(StatusMessage, {
|
|
69416
|
+
type: "success",
|
|
69417
|
+
children: [
|
|
69418
|
+
"Default repo set to ",
|
|
69419
|
+
state.repo
|
|
69420
|
+
]
|
|
69421
|
+
}, undefined, true, undefined, this);
|
|
69422
|
+
case "error":
|
|
69423
|
+
return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(StatusMessage, {
|
|
69424
|
+
type: "error",
|
|
69425
|
+
children: state.message
|
|
69426
|
+
}, undefined, false, undefined, this);
|
|
69427
|
+
default:
|
|
69428
|
+
return null;
|
|
69429
|
+
}
|
|
69430
|
+
};
|
|
69431
|
+
return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(jsx_dev_runtime18.Fragment, {
|
|
69432
|
+
children: [
|
|
69433
|
+
state.phase === "checking" && /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Spinner2, {
|
|
69375
69434
|
text: "Setting default..."
|
|
69376
|
-
}, undefined, false, undefined, this)
|
|
69377
|
-
|
|
69378
|
-
|
|
69379
|
-
|
|
69380
|
-
|
|
69381
|
-
|
|
69382
|
-
|
|
69383
|
-
|
|
69384
|
-
|
|
69385
|
-
|
|
69386
|
-
dimColor: true,
|
|
69387
|
-
children: "Run 'skilluse login' to authenticate with GitHub"
|
|
69388
|
-
}, undefined, false, undefined, this)
|
|
69389
|
-
]
|
|
69390
|
-
}, undefined, true, undefined, this);
|
|
69391
|
-
case "not_found":
|
|
69392
|
-
return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Box_default, {
|
|
69393
|
-
flexDirection: "column",
|
|
69394
|
-
children: [
|
|
69395
|
-
/* @__PURE__ */ jsx_dev_runtime18.jsxDEV(StatusMessage, {
|
|
69396
|
-
type: "error",
|
|
69397
|
-
children: [
|
|
69398
|
-
"Repository ",
|
|
69399
|
-
state.repo,
|
|
69400
|
-
" not found in config"
|
|
69401
|
-
]
|
|
69402
|
-
}, undefined, true, undefined, this),
|
|
69403
|
-
/* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Text, {
|
|
69404
|
-
dimColor: true,
|
|
69405
|
-
children: [
|
|
69406
|
-
"Run 'skilluse repo add ",
|
|
69407
|
-
state.repo,
|
|
69408
|
-
"' to add it first."
|
|
69409
|
-
]
|
|
69410
|
-
}, undefined, true, undefined, this)
|
|
69411
|
-
]
|
|
69412
|
-
}, undefined, true, undefined, this);
|
|
69413
|
-
case "already_default":
|
|
69414
|
-
return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(StatusMessage, {
|
|
69415
|
-
type: "success",
|
|
69416
|
-
children: [
|
|
69417
|
-
state.repo,
|
|
69418
|
-
" is already the default"
|
|
69419
|
-
]
|
|
69420
|
-
}, undefined, true, undefined, this);
|
|
69421
|
-
case "success":
|
|
69422
|
-
return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(StatusMessage, {
|
|
69423
|
-
type: "success",
|
|
69424
|
-
children: [
|
|
69425
|
-
"Default repo set to ",
|
|
69426
|
-
state.repo
|
|
69427
|
-
]
|
|
69428
|
-
}, undefined, true, undefined, this);
|
|
69429
|
-
case "error":
|
|
69430
|
-
return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(StatusMessage, {
|
|
69431
|
-
type: "error",
|
|
69432
|
-
children: state.message
|
|
69433
|
-
}, undefined, false, undefined, this);
|
|
69434
|
-
}
|
|
69435
|
+
}, undefined, false, undefined, this),
|
|
69436
|
+
/* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Static, {
|
|
69437
|
+
items: outputItems,
|
|
69438
|
+
children: (item) => /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Box_default, {
|
|
69439
|
+
flexDirection: "column",
|
|
69440
|
+
children: renderContent()
|
|
69441
|
+
}, item.id, false, undefined, this)
|
|
69442
|
+
}, undefined, false, undefined, this)
|
|
69443
|
+
]
|
|
69444
|
+
}, undefined, true, undefined, this);
|
|
69435
69445
|
}
|
|
69436
69446
|
|
|
69437
69447
|
// src/commands/agent/index.tsx
|
|
@@ -69642,13 +69652,15 @@ async function fetchSkillsFromRepo(token, repoConfig) {
|
|
|
69642
69652
|
try {
|
|
69643
69653
|
const apiPath = basePath ? `https://api.github.com/repos/${repo}/contents/${basePath}?ref=${branch}` : `https://api.github.com/repos/${repo}/contents?ref=${branch}`;
|
|
69644
69654
|
const response = await fetch(apiPath, {
|
|
69645
|
-
headers:
|
|
69646
|
-
Authorization: `Bearer ${token}`,
|
|
69647
|
-
Accept: "application/vnd.github+json",
|
|
69648
|
-
"X-GitHub-Api-Version": "2022-11-28"
|
|
69649
|
-
}
|
|
69655
|
+
headers: buildGitHubHeaders(token)
|
|
69650
69656
|
});
|
|
69651
69657
|
if (!response.ok) {
|
|
69658
|
+
if (isAuthRequired(response)) {
|
|
69659
|
+
return {
|
|
69660
|
+
authRequired: true,
|
|
69661
|
+
message: getGitHubErrorMessage(response)
|
|
69662
|
+
};
|
|
69663
|
+
}
|
|
69652
69664
|
continue;
|
|
69653
69665
|
}
|
|
69654
69666
|
const contents = await response.json();
|
|
@@ -69656,11 +69668,7 @@ async function fetchSkillsFromRepo(token, repoConfig) {
|
|
|
69656
69668
|
for (const dir of dirs) {
|
|
69657
69669
|
const skillMdUrl = `https://api.github.com/repos/${repo}/contents/${dir.path}/SKILL.md?ref=${branch}`;
|
|
69658
69670
|
const skillResponse = await fetch(skillMdUrl, {
|
|
69659
|
-
headers:
|
|
69660
|
-
Authorization: `Bearer ${token}`,
|
|
69661
|
-
Accept: "application/vnd.github.raw+json",
|
|
69662
|
-
"X-GitHub-Api-Version": "2022-11-28"
|
|
69663
|
-
}
|
|
69671
|
+
headers: buildGitHubRawHeaders(token)
|
|
69664
69672
|
});
|
|
69665
69673
|
if (skillResponse.ok) {
|
|
69666
69674
|
const content = await skillResponse.text();
|
|
@@ -69702,12 +69710,6 @@ function Search({ args: [keyword], options: opts }) {
|
|
|
69702
69710
|
const [state, setState] = import_react44.useState({ phase: "checking" });
|
|
69703
69711
|
import_react44.useEffect(() => {
|
|
69704
69712
|
async function search() {
|
|
69705
|
-
const credentials = await getCredentials();
|
|
69706
|
-
if (!credentials) {
|
|
69707
|
-
setState({ phase: "not_logged_in" });
|
|
69708
|
-
exit();
|
|
69709
|
-
return;
|
|
69710
|
-
}
|
|
69711
69713
|
const config2 = getConfig();
|
|
69712
69714
|
let reposToSearch = [];
|
|
69713
69715
|
if (opts.all) {
|
|
@@ -69725,11 +69727,18 @@ function Search({ args: [keyword], options: opts }) {
|
|
|
69725
69727
|
exit();
|
|
69726
69728
|
return;
|
|
69727
69729
|
}
|
|
69730
|
+
const credentials = await getCredentials();
|
|
69731
|
+
const token = credentials?.token;
|
|
69728
69732
|
const allSkills = [];
|
|
69729
69733
|
for (const repoConfig of reposToSearch) {
|
|
69730
69734
|
setState({ phase: "searching", repo: repoConfig.repo });
|
|
69731
|
-
const
|
|
69732
|
-
|
|
69735
|
+
const result = await fetchSkillsFromRepo(token, repoConfig);
|
|
69736
|
+
if ("authRequired" in result) {
|
|
69737
|
+
setState({ phase: "auth_required", message: result.message });
|
|
69738
|
+
exit();
|
|
69739
|
+
return;
|
|
69740
|
+
}
|
|
69741
|
+
allSkills.push(...result);
|
|
69733
69742
|
}
|
|
69734
69743
|
const matchingSkills = filterSkills(allSkills, keyword);
|
|
69735
69744
|
setState({ phase: "success", skills: matchingSkills, keyword });
|
|
@@ -69748,20 +69757,14 @@ function Search({ args: [keyword], options: opts }) {
|
|
|
69748
69757
|
return /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Spinner2, {
|
|
69749
69758
|
text: "Initializing..."
|
|
69750
69759
|
}, undefined, false, undefined, this);
|
|
69751
|
-
case "
|
|
69760
|
+
case "auth_required":
|
|
69752
69761
|
return /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Box_default, {
|
|
69753
69762
|
flexDirection: "column",
|
|
69754
|
-
children:
|
|
69755
|
-
|
|
69756
|
-
|
|
69757
|
-
|
|
69758
|
-
|
|
69759
|
-
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
69760
|
-
dimColor: true,
|
|
69761
|
-
children: "Run 'skilluse login' to authenticate with GitHub"
|
|
69762
|
-
}, undefined, false, undefined, this)
|
|
69763
|
-
]
|
|
69764
|
-
}, undefined, true, undefined, this);
|
|
69763
|
+
children: /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(StatusMessage, {
|
|
69764
|
+
type: "error",
|
|
69765
|
+
children: state.message
|
|
69766
|
+
}, undefined, false, undefined, this)
|
|
69767
|
+
}, undefined, false, undefined, this);
|
|
69765
69768
|
case "no_repos":
|
|
69766
69769
|
return /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Box_default, {
|
|
69767
69770
|
flexDirection: "column",
|
|
@@ -70113,14 +70116,17 @@ async function checkForUpdate2(token, skill, repoConfig) {
|
|
|
70113
70116
|
try {
|
|
70114
70117
|
const refUrl = `https://api.github.com/repos/${repo}/commits/${branch}`;
|
|
70115
70118
|
const refResponse = await fetch(refUrl, {
|
|
70116
|
-
headers:
|
|
70117
|
-
Authorization: `Bearer ${token}`,
|
|
70118
|
-
Accept: "application/vnd.github+json",
|
|
70119
|
-
"X-GitHub-Api-Version": "2022-11-28"
|
|
70120
|
-
}
|
|
70119
|
+
headers: buildGitHubHeaders(token)
|
|
70121
70120
|
});
|
|
70122
|
-
if (!refResponse.ok)
|
|
70121
|
+
if (!refResponse.ok) {
|
|
70122
|
+
if (isAuthRequired(refResponse)) {
|
|
70123
|
+
return {
|
|
70124
|
+
authRequired: true,
|
|
70125
|
+
message: getGitHubErrorMessage(refResponse)
|
|
70126
|
+
};
|
|
70127
|
+
}
|
|
70123
70128
|
return null;
|
|
70129
|
+
}
|
|
70124
70130
|
const refData = await refResponse.json();
|
|
70125
70131
|
const latestSha = refData.sha;
|
|
70126
70132
|
if (latestSha === skill.commitSha) {
|
|
@@ -70128,11 +70134,7 @@ async function checkForUpdate2(token, skill, repoConfig) {
|
|
|
70128
70134
|
}
|
|
70129
70135
|
const skillMdUrl = `https://api.github.com/repos/${repo}/contents/${skill.repoPath}/SKILL.md?ref=${branch}`;
|
|
70130
70136
|
const skillResponse = await fetch(skillMdUrl, {
|
|
70131
|
-
headers:
|
|
70132
|
-
Authorization: `Bearer ${token}`,
|
|
70133
|
-
Accept: "application/vnd.github.raw+json",
|
|
70134
|
-
"X-GitHub-Api-Version": "2022-11-28"
|
|
70135
|
-
}
|
|
70137
|
+
headers: buildGitHubRawHeaders(token)
|
|
70136
70138
|
});
|
|
70137
70139
|
let latestVersion = skill.version;
|
|
70138
70140
|
if (skillResponse.ok) {
|
|
@@ -70155,13 +70157,15 @@ async function checkForUpdate2(token, skill, repoConfig) {
|
|
|
70155
70157
|
async function downloadSkillFiles2(token, repo, skillPath, branch, targetDir) {
|
|
70156
70158
|
const treeUrl = `https://api.github.com/repos/${repo}/git/trees/${branch}?recursive=1`;
|
|
70157
70159
|
const treeResponse = await fetch(treeUrl, {
|
|
70158
|
-
headers:
|
|
70159
|
-
Authorization: `Bearer ${token}`,
|
|
70160
|
-
Accept: "application/vnd.github+json",
|
|
70161
|
-
"X-GitHub-Api-Version": "2022-11-28"
|
|
70162
|
-
}
|
|
70160
|
+
headers: buildGitHubHeaders(token)
|
|
70163
70161
|
});
|
|
70164
70162
|
if (!treeResponse.ok) {
|
|
70163
|
+
if (isAuthRequired(treeResponse)) {
|
|
70164
|
+
return {
|
|
70165
|
+
authRequired: true,
|
|
70166
|
+
message: getGitHubErrorMessage(treeResponse)
|
|
70167
|
+
};
|
|
70168
|
+
}
|
|
70165
70169
|
throw new Error(`Failed to fetch repository tree: ${treeResponse.status}`);
|
|
70166
70170
|
}
|
|
70167
70171
|
const treeData = await treeResponse.json();
|
|
@@ -70180,13 +70184,15 @@ async function downloadSkillFiles2(token, repo, skillPath, branch, targetDir) {
|
|
|
70180
70184
|
}
|
|
70181
70185
|
const fileUrl = `https://api.github.com/repos/${repo}/contents/${file2.path}?ref=${branch}`;
|
|
70182
70186
|
const fileResponse = await fetch(fileUrl, {
|
|
70183
|
-
headers:
|
|
70184
|
-
Authorization: `Bearer ${token}`,
|
|
70185
|
-
Accept: "application/vnd.github.raw+json",
|
|
70186
|
-
"X-GitHub-Api-Version": "2022-11-28"
|
|
70187
|
-
}
|
|
70187
|
+
headers: buildGitHubRawHeaders(token)
|
|
70188
70188
|
});
|
|
70189
70189
|
if (!fileResponse.ok) {
|
|
70190
|
+
if (isAuthRequired(fileResponse)) {
|
|
70191
|
+
return {
|
|
70192
|
+
authRequired: true,
|
|
70193
|
+
message: getGitHubErrorMessage(fileResponse)
|
|
70194
|
+
};
|
|
70195
|
+
}
|
|
70190
70196
|
throw new Error(`Failed to download file: ${file2.path}`);
|
|
70191
70197
|
}
|
|
70192
70198
|
const content = await fileResponse.text();
|
|
@@ -70198,12 +70204,6 @@ function Upgrade({ args: [skillName] }) {
|
|
|
70198
70204
|
const [state, setState] = import_react46.useState({ phase: "checking" });
|
|
70199
70205
|
import_react46.useEffect(() => {
|
|
70200
70206
|
async function upgrade() {
|
|
70201
|
-
const credentials = await getCredentials();
|
|
70202
|
-
if (!credentials) {
|
|
70203
|
-
setState({ phase: "not_logged_in" });
|
|
70204
|
-
exit();
|
|
70205
|
-
return;
|
|
70206
|
-
}
|
|
70207
70207
|
const config2 = getConfig();
|
|
70208
70208
|
let skillsToCheck = [];
|
|
70209
70209
|
if (skillName) {
|
|
@@ -70222,6 +70222,8 @@ function Upgrade({ args: [skillName] }) {
|
|
|
70222
70222
|
exit();
|
|
70223
70223
|
return;
|
|
70224
70224
|
}
|
|
70225
|
+
const credentials = await getCredentials();
|
|
70226
|
+
const token = credentials?.token;
|
|
70225
70227
|
const upgrades = [];
|
|
70226
70228
|
for (let i = 0;i < skillsToCheck.length; i++) {
|
|
70227
70229
|
setState({
|
|
@@ -70233,9 +70235,14 @@ function Upgrade({ args: [skillName] }) {
|
|
|
70233
70235
|
const repoConfig = config2.repos.find((r) => r.repo === skill.repo);
|
|
70234
70236
|
if (!repoConfig)
|
|
70235
70237
|
continue;
|
|
70236
|
-
const
|
|
70237
|
-
if (
|
|
70238
|
-
|
|
70238
|
+
const result = await checkForUpdate2(token, skill, repoConfig);
|
|
70239
|
+
if (result && "authRequired" in result) {
|
|
70240
|
+
setState({ phase: "auth_required", message: result.message });
|
|
70241
|
+
exit();
|
|
70242
|
+
return;
|
|
70243
|
+
}
|
|
70244
|
+
if (result) {
|
|
70245
|
+
upgrades.push(result);
|
|
70239
70246
|
}
|
|
70240
70247
|
}
|
|
70241
70248
|
if (upgrades.length === 0) {
|
|
@@ -70256,7 +70263,15 @@ function Upgrade({ args: [skillName] }) {
|
|
|
70256
70263
|
const repoConfig = config2.repos.find((r) => r.repo === skill.repo);
|
|
70257
70264
|
if (!repoConfig)
|
|
70258
70265
|
continue;
|
|
70259
|
-
await downloadSkillFiles2(
|
|
70266
|
+
const downloadResult = await downloadSkillFiles2(token, skill.repo, skill.repoPath, repoConfig.branch, skill.installedPath);
|
|
70267
|
+
if (downloadResult && "authRequired" in downloadResult) {
|
|
70268
|
+
setState({
|
|
70269
|
+
phase: "auth_required",
|
|
70270
|
+
message: downloadResult.message
|
|
70271
|
+
});
|
|
70272
|
+
exit();
|
|
70273
|
+
return;
|
|
70274
|
+
}
|
|
70260
70275
|
const updatedSkill = {
|
|
70261
70276
|
...skill,
|
|
70262
70277
|
commitSha: latestSha,
|
|
@@ -70286,20 +70301,14 @@ function Upgrade({ args: [skillName] }) {
|
|
|
70286
70301
|
return /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(Spinner2, {
|
|
70287
70302
|
text: "Initializing..."
|
|
70288
70303
|
}, undefined, false, undefined, this);
|
|
70289
|
-
case "
|
|
70304
|
+
case "auth_required":
|
|
70290
70305
|
return /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(Box_default, {
|
|
70291
70306
|
flexDirection: "column",
|
|
70292
|
-
children:
|
|
70293
|
-
|
|
70294
|
-
|
|
70295
|
-
|
|
70296
|
-
|
|
70297
|
-
/* @__PURE__ */ jsx_dev_runtime23.jsxDEV(Text, {
|
|
70298
|
-
dimColor: true,
|
|
70299
|
-
children: "Run 'skilluse login' to authenticate with GitHub"
|
|
70300
|
-
}, undefined, false, undefined, this)
|
|
70301
|
-
]
|
|
70302
|
-
}, undefined, true, undefined, this);
|
|
70307
|
+
children: /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(StatusMessage, {
|
|
70308
|
+
type: "error",
|
|
70309
|
+
children: state.message
|
|
70310
|
+
}, undefined, false, undefined, this)
|
|
70311
|
+
}, undefined, false, undefined, this);
|
|
70303
70312
|
case "not_found":
|
|
70304
70313
|
return /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(Box_default, {
|
|
70305
70314
|
flexDirection: "column",
|
|
@@ -70418,7 +70427,7 @@ function Upgrade({ args: [skillName] }) {
|
|
|
70418
70427
|
// package.json
|
|
70419
70428
|
var package_default = {
|
|
70420
70429
|
name: "skilluse",
|
|
70421
|
-
version: "0.
|
|
70430
|
+
version: "0.2.0",
|
|
70422
70431
|
description: "CLI tool for managing and installing AI Coding Agent Skills",
|
|
70423
70432
|
main: "dist/cli.js",
|
|
70424
70433
|
bin: {
|
|
@@ -70450,7 +70459,7 @@ var package_default = {
|
|
|
70450
70459
|
format: "biome format --write .",
|
|
70451
70460
|
lint: "biome lint .",
|
|
70452
70461
|
check: "biome check .",
|
|
70453
|
-
start: "
|
|
70462
|
+
start: "node dist/cli.js",
|
|
70454
70463
|
prepublishOnly: "bun run build"
|
|
70455
70464
|
},
|
|
70456
70465
|
keywords: [
|
|
@@ -70488,7 +70497,7 @@ var package_default = {
|
|
|
70488
70497
|
};
|
|
70489
70498
|
|
|
70490
70499
|
// src/cli.tsx
|
|
70491
|
-
var jsx_dev_runtime24 = __toESM(
|
|
70500
|
+
var jsx_dev_runtime24 = __toESM(require_jsx_dev_runtime(), 1);
|
|
70492
70501
|
var VERSION = process.env.VERSION || package_default.version;
|
|
70493
70502
|
var BUILD_TIME = process.env.BUILD_TIME || new Date().toISOString();
|
|
70494
70503
|
var program2 = new Command;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skilluse",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "CLI tool for managing and installing AI Coding Agent Skills",
|
|
5
5
|
"main": "dist/cli.js",
|
|
6
6
|
"bin": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"format": "biome format --write .",
|
|
33
33
|
"lint": "biome lint .",
|
|
34
34
|
"check": "biome check .",
|
|
35
|
-
"start": "
|
|
35
|
+
"start": "node dist/cli.js",
|
|
36
36
|
"prepublishOnly": "bun run build"
|
|
37
37
|
},
|
|
38
38
|
"keywords": [
|