@jive-sh/skill-sync 0.3.0 → 0.3.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/bin/skill-sync +26 -34
- package/bin/skill-sync-daemon +26 -34
- package/install.cjs +26 -34
- package/package.json +6 -6
package/bin/skill-sync
CHANGED
|
@@ -76,48 +76,40 @@ function fail(message) {
|
|
|
76
76
|
process.exit(1);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
function
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (!packageName) {
|
|
91
|
-
fail(`No platform package is configured for ${platformKey}`);
|
|
79
|
+
function installedPlatformPackage(platformKey) {
|
|
80
|
+
try {
|
|
81
|
+
const packageJsonPath = require.resolve(`${PLATFORM_PACKAGES[platformKey]}/package.json`);
|
|
82
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
83
|
+
return {
|
|
84
|
+
platformKey,
|
|
85
|
+
binaryPath: join(dirname(packageJsonPath), PLATFORM_BINARIES[platformKey]),
|
|
86
|
+
version: packageJson.version,
|
|
87
|
+
};
|
|
88
|
+
} catch {
|
|
89
|
+
return undefined;
|
|
92
90
|
}
|
|
93
|
-
return packageName;
|
|
94
91
|
}
|
|
95
92
|
|
|
96
93
|
/**
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
94
|
+
* The base package has one optional dependency per platform, each holding that platform's build of every
|
|
95
|
+
* command. The package manager installs the one whose "os" and "cpu" match the machine, so the launcher
|
|
96
|
+
* uses whichever is installed rather than deciding the platform again. Asking again can disagree with the
|
|
97
|
+
* package manager: on an Apple Silicon Mac, bun (native) installs darwin-arm64, while an Intel build of
|
|
98
|
+
* Node running under Rosetta reports process.arch "x64".
|
|
100
99
|
* @returns the path to the platform binary and the exact version of the platform package.
|
|
101
100
|
*/
|
|
102
101
|
function currentPlatformPackage() {
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
if (!binaryFile) {
|
|
106
|
-
fail(`No platform binary is configured for ${platformKey}`);
|
|
107
|
-
}
|
|
102
|
+
const installed = Object.keys(PLATFORM_PACKAGES).map(installedPlatformPackage).filter(Boolean);
|
|
103
|
+
if (installed.length === 1) return installed[0];
|
|
108
104
|
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
};
|
|
118
|
-
} catch (error) {
|
|
119
|
-
fail(`Could not resolve optional platform package ${packageName}. Reinstall dependencies for ${process.platform}-${process.arch}.`);
|
|
120
|
-
}
|
|
105
|
+
const reported = PLATFORM_MAP[`${process.platform}-${process.arch}`];
|
|
106
|
+
const matching = installed.find((platformPackage) => platformPackage.platformKey === reported);
|
|
107
|
+
// More than one is installed only when the package manager was told to (npm's --cpu and --os flags).
|
|
108
|
+
if (matching) return matching;
|
|
109
|
+
|
|
110
|
+
fail(installed.length === 0
|
|
111
|
+
? `None of ${PACKAGE_NAME}'s platform packages is installed (${Object.values(PLATFORM_PACKAGES).join(", ")}). Reinstall ${PACKAGE_NAME}.`
|
|
112
|
+
: `Several of ${PACKAGE_NAME}'s platform packages are installed (${installed.map((p) => PLATFORM_PACKAGES[p.platformKey]).join(", ")}) and none matches ${process.platform}-${process.arch}. Reinstall ${PACKAGE_NAME}.`);
|
|
121
113
|
}
|
|
122
114
|
|
|
123
115
|
function commandTargetPath(command) {
|
package/bin/skill-sync-daemon
CHANGED
|
@@ -76,48 +76,40 @@ function fail(message) {
|
|
|
76
76
|
process.exit(1);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
function
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (!packageName) {
|
|
91
|
-
fail(`No platform package is configured for ${platformKey}`);
|
|
79
|
+
function installedPlatformPackage(platformKey) {
|
|
80
|
+
try {
|
|
81
|
+
const packageJsonPath = require.resolve(`${PLATFORM_PACKAGES[platformKey]}/package.json`);
|
|
82
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
83
|
+
return {
|
|
84
|
+
platformKey,
|
|
85
|
+
binaryPath: join(dirname(packageJsonPath), PLATFORM_BINARIES[platformKey]),
|
|
86
|
+
version: packageJson.version,
|
|
87
|
+
};
|
|
88
|
+
} catch {
|
|
89
|
+
return undefined;
|
|
92
90
|
}
|
|
93
|
-
return packageName;
|
|
94
91
|
}
|
|
95
92
|
|
|
96
93
|
/**
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
94
|
+
* The base package has one optional dependency per platform, each holding that platform's build of every
|
|
95
|
+
* command. The package manager installs the one whose "os" and "cpu" match the machine, so the launcher
|
|
96
|
+
* uses whichever is installed rather than deciding the platform again. Asking again can disagree with the
|
|
97
|
+
* package manager: on an Apple Silicon Mac, bun (native) installs darwin-arm64, while an Intel build of
|
|
98
|
+
* Node running under Rosetta reports process.arch "x64".
|
|
100
99
|
* @returns the path to the platform binary and the exact version of the platform package.
|
|
101
100
|
*/
|
|
102
101
|
function currentPlatformPackage() {
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
if (!binaryFile) {
|
|
106
|
-
fail(`No platform binary is configured for ${platformKey}`);
|
|
107
|
-
}
|
|
102
|
+
const installed = Object.keys(PLATFORM_PACKAGES).map(installedPlatformPackage).filter(Boolean);
|
|
103
|
+
if (installed.length === 1) return installed[0];
|
|
108
104
|
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
};
|
|
118
|
-
} catch (error) {
|
|
119
|
-
fail(`Could not resolve optional platform package ${packageName}. Reinstall dependencies for ${process.platform}-${process.arch}.`);
|
|
120
|
-
}
|
|
105
|
+
const reported = PLATFORM_MAP[`${process.platform}-${process.arch}`];
|
|
106
|
+
const matching = installed.find((platformPackage) => platformPackage.platformKey === reported);
|
|
107
|
+
// More than one is installed only when the package manager was told to (npm's --cpu and --os flags).
|
|
108
|
+
if (matching) return matching;
|
|
109
|
+
|
|
110
|
+
fail(installed.length === 0
|
|
111
|
+
? `None of ${PACKAGE_NAME}'s platform packages is installed (${Object.values(PLATFORM_PACKAGES).join(", ")}). Reinstall ${PACKAGE_NAME}.`
|
|
112
|
+
: `Several of ${PACKAGE_NAME}'s platform packages are installed (${installed.map((p) => PLATFORM_PACKAGES[p.platformKey]).join(", ")}) and none matches ${process.platform}-${process.arch}. Reinstall ${PACKAGE_NAME}.`);
|
|
121
113
|
}
|
|
122
114
|
|
|
123
115
|
function commandTargetPath(command) {
|
package/install.cjs
CHANGED
|
@@ -76,48 +76,40 @@ function fail(message) {
|
|
|
76
76
|
process.exit(1);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
function
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (!packageName) {
|
|
91
|
-
fail(`No platform package is configured for ${platformKey}`);
|
|
79
|
+
function installedPlatformPackage(platformKey) {
|
|
80
|
+
try {
|
|
81
|
+
const packageJsonPath = require.resolve(`${PLATFORM_PACKAGES[platformKey]}/package.json`);
|
|
82
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
83
|
+
return {
|
|
84
|
+
platformKey,
|
|
85
|
+
binaryPath: join(dirname(packageJsonPath), PLATFORM_BINARIES[platformKey]),
|
|
86
|
+
version: packageJson.version,
|
|
87
|
+
};
|
|
88
|
+
} catch {
|
|
89
|
+
return undefined;
|
|
92
90
|
}
|
|
93
|
-
return packageName;
|
|
94
91
|
}
|
|
95
92
|
|
|
96
93
|
/**
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
94
|
+
* The base package has one optional dependency per platform, each holding that platform's build of every
|
|
95
|
+
* command. The package manager installs the one whose "os" and "cpu" match the machine, so the launcher
|
|
96
|
+
* uses whichever is installed rather than deciding the platform again. Asking again can disagree with the
|
|
97
|
+
* package manager: on an Apple Silicon Mac, bun (native) installs darwin-arm64, while an Intel build of
|
|
98
|
+
* Node running under Rosetta reports process.arch "x64".
|
|
100
99
|
* @returns the path to the platform binary and the exact version of the platform package.
|
|
101
100
|
*/
|
|
102
101
|
function currentPlatformPackage() {
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
if (!binaryFile) {
|
|
106
|
-
fail(`No platform binary is configured for ${platformKey}`);
|
|
107
|
-
}
|
|
102
|
+
const installed = Object.keys(PLATFORM_PACKAGES).map(installedPlatformPackage).filter(Boolean);
|
|
103
|
+
if (installed.length === 1) return installed[0];
|
|
108
104
|
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
};
|
|
118
|
-
} catch (error) {
|
|
119
|
-
fail(`Could not resolve optional platform package ${packageName}. Reinstall dependencies for ${process.platform}-${process.arch}.`);
|
|
120
|
-
}
|
|
105
|
+
const reported = PLATFORM_MAP[`${process.platform}-${process.arch}`];
|
|
106
|
+
const matching = installed.find((platformPackage) => platformPackage.platformKey === reported);
|
|
107
|
+
// More than one is installed only when the package manager was told to (npm's --cpu and --os flags).
|
|
108
|
+
if (matching) return matching;
|
|
109
|
+
|
|
110
|
+
fail(installed.length === 0
|
|
111
|
+
? `None of ${PACKAGE_NAME}'s platform packages is installed (${Object.values(PLATFORM_PACKAGES).join(", ")}). Reinstall ${PACKAGE_NAME}.`
|
|
112
|
+
: `Several of ${PACKAGE_NAME}'s platform packages are installed (${installed.map((p) => PLATFORM_PACKAGES[p.platformKey]).join(", ")}) and none matches ${process.platform}-${process.arch}. Reinstall ${PACKAGE_NAME}.`);
|
|
121
113
|
}
|
|
122
114
|
|
|
123
115
|
function commandTargetPath(command) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jive-sh/skill-sync",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Keeps one skills directory identical across every machine you work on.",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"skill-sync-daemon": "./bin/skill-sync-daemon"
|
|
33
33
|
},
|
|
34
34
|
"optionalDependencies": {
|
|
35
|
-
"@jive-sh/skill-sync-darwin-arm64": "npm:@jive-sh/skill-sync@0.3.
|
|
36
|
-
"@jive-sh/skill-sync-darwin-x64": "npm:@jive-sh/skill-sync@0.3.
|
|
37
|
-
"@jive-sh/skill-sync-linux-arm64": "npm:@jive-sh/skill-sync@0.3.
|
|
38
|
-
"@jive-sh/skill-sync-linux-x64": "npm:@jive-sh/skill-sync@0.3.
|
|
39
|
-
"@jive-sh/skill-sync-windows-x64": "npm:@jive-sh/skill-sync@0.3.
|
|
35
|
+
"@jive-sh/skill-sync-darwin-arm64": "npm:@jive-sh/skill-sync@0.3.1-latest-darwin-arm64",
|
|
36
|
+
"@jive-sh/skill-sync-darwin-x64": "npm:@jive-sh/skill-sync@0.3.1-latest-darwin-x64",
|
|
37
|
+
"@jive-sh/skill-sync-linux-arm64": "npm:@jive-sh/skill-sync@0.3.1-latest-linux-arm64",
|
|
38
|
+
"@jive-sh/skill-sync-linux-x64": "npm:@jive-sh/skill-sync@0.3.1-latest-linux-x64",
|
|
39
|
+
"@jive-sh/skill-sync-windows-x64": "npm:@jive-sh/skill-sync@0.3.1-latest-windows-x64"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"commander": "^13.1.0"
|