prpm 0.0.5 → 0.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.
@@ -115,6 +115,7 @@ async function loginWithOAuth(registryUrl) {
115
115
  const userId = `cli_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
116
116
  try {
117
117
  // Get the Nango connect session from the registry
118
+ console.log(` Connecting to: ${registryUrl}`);
118
119
  const response = await fetch(`${registryUrl}/api/v1/auth/nango/cli/connect-session`, {
119
120
  method: 'POST',
120
121
  headers: {
@@ -127,7 +128,8 @@ async function loginWithOAuth(registryUrl) {
127
128
  }),
128
129
  });
129
130
  if (!response.ok) {
130
- throw new Error('Failed to get authentication session');
131
+ const errorText = await response.text().catch(() => 'Unable to read error response');
132
+ throw new Error(`Failed to get authentication session (${response.status}): ${errorText}`);
131
133
  }
132
134
  const responseData = await response.json();
133
135
  const { connectSessionToken } = responseData;
@@ -156,6 +158,15 @@ async function loginWithOAuth(registryUrl) {
156
158
  return { token: result.token, username: result.username || 'unknown' };
157
159
  }
158
160
  catch (error) {
161
+ if (error instanceof Error) {
162
+ // Check for common network errors
163
+ if (error.message.includes('ECONNREFUSED')) {
164
+ throw new Error(`Cannot connect to registry at ${registryUrl}. Is the registry running?`);
165
+ }
166
+ else if (error.message.includes('ENOTFOUND') || error.message.includes('getaddrinfo')) {
167
+ throw new Error(`Cannot resolve registry hostname: ${registryUrl}. Check your internet connection.`);
168
+ }
169
+ }
159
170
  throw new Error(`Authentication failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
160
171
  }
161
172
  }
@@ -172,22 +183,15 @@ async function pollForAuthentication(registryUrl, userId) {
172
183
  const { authenticated, connectionId } = await response.json();
173
184
  if (authenticated && connectionId) {
174
185
  // Authentication completed, get the JWT token
175
- const callbackResponse = await fetch(`${registryUrl}/api/v1/auth/nango/callback`, {
176
- method: 'POST',
177
- headers: {
178
- 'Content-Type': 'application/json',
179
- },
180
- body: JSON.stringify({
181
- connectionId,
182
- redirectUrl: '/cli-success',
183
- }),
184
- });
185
- if (callbackResponse.ok) {
186
- const result = await callbackResponse.json();
187
- return {
188
- token: result.token,
189
- username: result.username,
190
- };
186
+ const statusResponse = await fetch(`${registryUrl}/api/v1/auth/nango/status/${connectionId}`);
187
+ if (statusResponse.ok) {
188
+ const result = await statusResponse.json();
189
+ if (result.ready && result.token) {
190
+ return {
191
+ token: result.token,
192
+ username: result.username,
193
+ };
194
+ }
191
195
  }
192
196
  }
193
197
  }
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ /**
3
+ * Remove command implementation
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.handleRemove = handleRemove;
7
+ exports.createRemoveCommand = createRemoveCommand;
8
+ const commander_1 = require("commander");
9
+ const lockfile_1 = require("../core/lockfile");
10
+ const filesystem_1 = require("../core/filesystem");
11
+ const fs_1 = require("fs");
12
+ /**
13
+ * Handle the remove command
14
+ */
15
+ async function handleRemove(name) {
16
+ try {
17
+ console.log(`🗑️ Removing package: ${name}`);
18
+ // Remove from lockfile and get package info
19
+ const pkg = await (0, lockfile_1.removePackage)(name);
20
+ if (!pkg) {
21
+ console.error(`❌ Package "${name}" not found`);
22
+ process.exit(1);
23
+ }
24
+ // Determine file path based on package type and format
25
+ const effectiveType = (pkg.format === 'claude' ? 'claude-skill' :
26
+ pkg.format === 'cursor' ? 'cursor' :
27
+ pkg.format === 'continue' ? 'continue' :
28
+ pkg.format === 'windsurf' ? 'windsurf' :
29
+ pkg.type);
30
+ const destDir = (0, filesystem_1.getDestinationDir)(effectiveType);
31
+ const fileExtension = pkg.format === 'cursor' ? 'mdc' : 'md';
32
+ // Strip author namespace to get just the package name
33
+ const packageName = (0, filesystem_1.stripAuthorNamespace)(name);
34
+ // Try single file first
35
+ const singleFilePath = `${destDir}/${packageName}.${fileExtension}`;
36
+ if (await (0, filesystem_1.fileExists)(singleFilePath)) {
37
+ // Single file package
38
+ await (0, filesystem_1.deleteFile)(singleFilePath);
39
+ console.log(` 🗑️ Deleted file: ${singleFilePath}`);
40
+ }
41
+ else {
42
+ // Try multi-file package directory
43
+ const packageDir = `${destDir}/${packageName}`;
44
+ try {
45
+ const stats = await fs_1.promises.stat(packageDir);
46
+ if (stats.isDirectory()) {
47
+ await fs_1.promises.rm(packageDir, { recursive: true, force: true });
48
+ console.log(` 🗑️ Deleted directory: ${packageDir}`);
49
+ }
50
+ }
51
+ catch (error) {
52
+ const err = error;
53
+ if (err.code !== 'ENOENT') {
54
+ console.warn(` ⚠️ Could not delete package files: ${err.message}`);
55
+ }
56
+ }
57
+ }
58
+ console.log(`✅ Successfully removed ${name}`);
59
+ process.exit(0);
60
+ }
61
+ catch (error) {
62
+ console.error(`❌ Failed to remove package: ${error}`);
63
+ process.exit(1);
64
+ }
65
+ }
66
+ /**
67
+ * Create the remove command
68
+ */
69
+ function createRemoveCommand() {
70
+ const command = new commander_1.Command('remove');
71
+ command
72
+ .description('Remove a prompt package')
73
+ .argument('<id>', 'Package ID to remove')
74
+ .action(handleRemove);
75
+ return command;
76
+ }
package/dist/index.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prpm",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Prompt Package Manager CLI - Install and manage prompt-based files",
5
5
  "main": "dist/index.js",
6
6
  "bin": {