@valiron/skill 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/cli.mjs +19 -1
  2. package/package.json +1 -1
package/bin/cli.mjs CHANGED
@@ -17,10 +17,28 @@ const PLATFORMS = [
17
17
  { key: "5", name: "Generic (AGENTS.md)", path: "AGENTS.md" },
18
18
  ];
19
19
 
20
- function fetchURL(url) {
20
+ function fetchURL(url, redirectsRemaining = 5) {
21
21
  return new Promise((res, rej) => {
22
22
  get(url, (resp) => {
23
+ if (
24
+ resp.statusCode >= 300 &&
25
+ resp.statusCode < 400 &&
26
+ resp.headers.location
27
+ ) {
28
+ if (redirectsRemaining === 0) {
29
+ resp.resume();
30
+ rej(new Error(`Too many redirects fetching ${url}`));
31
+ return;
32
+ }
33
+
34
+ const nextURL = new URL(resp.headers.location, url).toString();
35
+ resp.resume();
36
+ fetchURL(nextURL, redirectsRemaining - 1).then(res, rej);
37
+ return;
38
+ }
39
+
23
40
  if (resp.statusCode !== 200) {
41
+ resp.resume();
24
42
  rej(new Error(`HTTP ${resp.statusCode} fetching ${url}`));
25
43
  return;
26
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valiron/skill",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Install Valiron agent skill into your project for any AI coding assistant",
5
5
  "bin": {
6
6
  "valiron-skill": "bin/cli.mjs"