@agent-nexus/csreg 0.1.3 → 0.1.5

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/dist/index.js +27 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -298,7 +298,12 @@ var initCommand = new Command4("init").description("Initialize a new skill proje
298
298
  message: "User-invocable (show in /slash command menu)?",
299
299
  default: true
300
300
  });
301
- const targetDir = resolve(dir ?? name.trim());
301
+ const defaultDir = dir ?? join2(".claude", "skills", name.trim());
302
+ const chosenDir = await input2({
303
+ message: "Directory to create skill in:",
304
+ default: defaultDir
305
+ });
306
+ const targetDir = resolve(chosenDir.trim());
302
307
  if (existsSync2(targetDir)) {
303
308
  throw new CliError(`Directory already exists: ${targetDir}`, [
304
309
  "Choose a different name or directory."
@@ -346,7 +351,7 @@ For example: \`/my-skill some-argument\` makes \`$ARGUMENTS\` = "some-argument".
346
351
  console.log(" 3. Run `csreg push` to publish to the registry");
347
352
  console.log("");
348
353
  info("To use locally without publishing:");
349
- console.log(` cp -r ${targetDir} .claude/skills/${name.trim()}`);
354
+ console.log(` Ensure your skill is inside .claude/skills/ in your project root`);
350
355
  } catch (err) {
351
356
  handleError(err);
352
357
  }
@@ -779,14 +784,28 @@ async function pushSingle(resolved) {
779
784
  spin.succeed("Version prepared.");
780
785
  spin.start("Uploading archive...");
781
786
  const archiveData = readFileSync3(archive.path);
782
- const uploadResponse = await fetch(prepared.uploadUrl, {
787
+ const uploadHeaders = {
788
+ "Content-Type": "application/gzip",
789
+ "Content-Length": String(archive.size)
790
+ };
791
+ let uploadResponse = await fetch(prepared.uploadUrl, {
783
792
  method: "PUT",
784
- headers: {
785
- "Content-Type": "application/gzip",
786
- "Content-Length": String(archive.size)
787
- },
788
- body: archiveData
793
+ headers: uploadHeaders,
794
+ body: archiveData,
795
+ redirect: "manual"
789
796
  });
797
+ if (uploadResponse.status === 301 || uploadResponse.status === 302 || uploadResponse.status === 307 || uploadResponse.status === 308) {
798
+ const redirectUrl = uploadResponse.headers.get("location");
799
+ if (!redirectUrl) {
800
+ spin.fail("Upload failed.");
801
+ throw new CliError("Upload redirect missing Location header.");
802
+ }
803
+ uploadResponse = await fetch(redirectUrl, {
804
+ method: "PUT",
805
+ headers: uploadHeaders,
806
+ body: archiveData
807
+ });
808
+ }
790
809
  if (!uploadResponse.ok) {
791
810
  spin.fail("Upload failed.");
792
811
  throw new CliError(`Upload failed with status ${uploadResponse.status}.`, [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-nexus/csreg",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "CLI for Claude Skills Registry",
5
5
  "license": "MIT",
6
6
  "type": "module",