skill-organizer 0.0.4 → 1.0.2-beta.1
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 +2 -1
- package/package.json +2 -2
- package/scripts/postinstall.js +38 -3
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
This package installs the `skill-organizer` CLI by downloading the matching prebuilt binary from GitHub Releases.
|
|
4
4
|
|
|
5
|
-
Agent-first install and onboarding instructions are documented in [
|
|
5
|
+
Agent-first install and onboarding instructions are documented in [`../../../AGENTS_README.md`](../../../AGENTS_README.md).
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -19,6 +19,7 @@ skill-organizer --version
|
|
|
19
19
|
## Notes
|
|
20
20
|
|
|
21
21
|
- The install script downloads a release artifact for your current OS and architecture.
|
|
22
|
+
- The install script only downloads from `sergiocarracedo/skill-organizer` GitHub Releases.
|
|
22
23
|
- The package version must match an existing GitHub release and its uploaded assets.
|
|
23
24
|
- Installs with `--ignore-scripts` are not supported.
|
|
24
25
|
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skill-organizer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.2-beta.1",
|
|
4
4
|
"description": "Install the skill-organizer CLI from GitHub Releases",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"homepage": "https://github.com/sergiocarracedo/skill-organizer",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/sergiocarracedo/skill-organizer.git",
|
|
10
|
-
"directory": "cli/packages/npm"
|
|
10
|
+
"directory": "packages/cli/packages/npm"
|
|
11
11
|
},
|
|
12
12
|
"bugs": {
|
|
13
13
|
"url": "https://github.com/sergiocarracedo/skill-organizer/issues"
|
package/scripts/postinstall.js
CHANGED
|
@@ -10,8 +10,8 @@ const { spawn } = require("node:child_process");
|
|
|
10
10
|
|
|
11
11
|
const pkg = require("../package.json");
|
|
12
12
|
|
|
13
|
-
const owner =
|
|
14
|
-
const repo =
|
|
13
|
+
const owner = "sergiocarracedo";
|
|
14
|
+
const repo = "skill-organizer";
|
|
15
15
|
const version = pkg.version;
|
|
16
16
|
const tag = `v${version}`;
|
|
17
17
|
const osMap = {
|
|
@@ -25,6 +25,11 @@ const archMap = {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
async function main() {
|
|
28
|
+
if (isSourceCheckoutInstall()) {
|
|
29
|
+
console.log("Skipping binary download for source checkout install.");
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
28
33
|
const osName = osMap[process.platform];
|
|
29
34
|
const archName = archMap[process.arch];
|
|
30
35
|
if (!osName || !archName) {
|
|
@@ -69,12 +74,42 @@ async function main() {
|
|
|
69
74
|
await fsp.rm(tmpDir, { recursive: true, force: true });
|
|
70
75
|
}
|
|
71
76
|
|
|
77
|
+
function isSourceCheckoutInstall() {
|
|
78
|
+
let current = path.resolve(__dirname, "..");
|
|
79
|
+
|
|
80
|
+
while (true) {
|
|
81
|
+
const manifestPath = path.join(current, "package.json");
|
|
82
|
+
if (fs.existsSync(manifestPath)) {
|
|
83
|
+
try {
|
|
84
|
+
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
|
85
|
+
if (manifest.name === "skill-organizer-monorepo" && manifest.private === true) {
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
} catch {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const parent = path.dirname(current);
|
|
94
|
+
if (parent === current) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
current = parent;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
72
101
|
function download(url, destination) {
|
|
73
102
|
return new Promise((resolve, reject) => {
|
|
74
103
|
https.get(url, (response) => {
|
|
75
104
|
if (response.statusCode >= 300 && response.statusCode < 400 && response.headers.location) {
|
|
105
|
+
const redirect = new URL(response.headers.location, url);
|
|
106
|
+
if (redirect.protocol !== "https:" || redirect.hostname !== "github.com") {
|
|
107
|
+
reject(new Error(`refusing redirect to unexpected host: ${redirect.origin}`));
|
|
108
|
+
response.resume();
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
76
111
|
response.resume();
|
|
77
|
-
download(
|
|
112
|
+
download(redirect.toString(), destination).then(resolve, reject);
|
|
78
113
|
return;
|
|
79
114
|
}
|
|
80
115
|
|