@gifflet/ccmd 1.0.0-test.2 → 1.0.0-test.4

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/index.js CHANGED
@@ -22,7 +22,7 @@ let fullPath = null;
22
22
  /**
23
23
  * @return {Promise<string>}
24
24
  */
25
- export async function findCcmdBinary() {
25
+ async function findCcmdBinary() {
26
26
  if (fullPath) {
27
27
  // return the previously cached value
28
28
  return fullPath;
@@ -66,6 +66,8 @@ async function main() {
66
66
  }
67
67
 
68
68
 
69
+ module.exports = { findCcmdBinary };
70
+
69
71
  if (require.main === module) {
70
72
  (async () => await main())();
71
73
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gifflet/ccmd",
3
- "version": "1.0.0-test.2",
3
+ "version": "1.0.0-test.4",
4
4
  "description": "Simple command-line tool for managing custom commands in Claude Code. Install and share commands from Git repositories with the ease of a package manager.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/postinstall.js CHANGED
@@ -45,8 +45,6 @@ async function getInstallationPath() {
45
45
  } else {
46
46
  dir = value.trim();
47
47
  }
48
- //throw (dir)
49
- ///Users/danielpaulus/.nvm/versions/node/v19.7.0/lib/node_modules/go-ios/node_modules/.bin
50
48
  await mkdirp(dir);
51
49
  return dir;
52
50
  }
@@ -152,12 +150,11 @@ async function install(callback) {
152
150
  src = `./dist/ccmd-${PLATFORM_MAPPING[process.platform]}-amd64_${PLATFORM_MAPPING[process.platform]}_amd64/${opts.binName}`;
153
151
  }
154
152
 
155
- if (PLATFORM_MAPPING[process.platform] === "windows") {
156
- let cmd = `copy ${src} ${opts.binPath}/${opts.binName}`
157
- cmd = cmd.replace(/\//g, "\\")
158
- await execShellCommand(cmd);
159
- } else {
160
- await execShellCommand(`cp ${src} ${opts.binPath}/${opts.binName}`);
153
+ const dest = path.join(opts.binPath, opts.binName);
154
+ try {
155
+ await fs.promises.copyFile(src, dest);
156
+ } catch (err) {
157
+ return callback(`Failed to copy binary: ${err.message}`);
161
158
  }
162
159
 
163
160
  await verifyAndPlaceBinary(opts.binName, opts.binPath, callback);
@@ -185,22 +182,6 @@ var actions = {
185
182
  "install": install,
186
183
  "uninstall": uninstall
187
184
  };
188
- /**
189
- * Executes a shell command and return it as a Promise.
190
- * @param cmd {string}
191
- * @return {Promise<string>}
192
- */
193
- function execShellCommand(cmd) {
194
- const exec = require('child_process').exec;
195
- return new Promise((resolve, reject) => {
196
- exec(cmd, (error, stdout, stderr) => {
197
- if (error) {
198
- console.warn(error);
199
- }
200
- resolve(stdout ? stdout : stderr);
201
- });
202
- });
203
- }
204
185
 
205
186
  var argv = process.argv;
206
187
  if (argv && argv.length > 2) {