prpm 0.0.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.
@@ -0,0 +1,179 @@
1
+ "use strict";
2
+ /**
3
+ * Search command - Search for packages in the registry
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.handleSearch = handleSearch;
7
+ exports.createSearchCommand = createSearchCommand;
8
+ const commander_1 = require("commander");
9
+ const registry_client_1 = require("@prpm/registry-client");
10
+ const user_config_1 = require("../core/user-config");
11
+ const telemetry_1 = require("../core/telemetry");
12
+ /**
13
+ * Get icon for package type
14
+ */
15
+ function getTypeIcon(type) {
16
+ const icons = {
17
+ skill: 'šŸŽ“',
18
+ agent: 'šŸ¤–',
19
+ rule: 'šŸ“‹',
20
+ plugin: 'šŸ”Œ',
21
+ prompt: 'šŸ’¬',
22
+ workflow: '⚔',
23
+ tool: 'šŸ”§',
24
+ template: 'šŸ“„',
25
+ mcp: 'šŸ”—',
26
+ };
27
+ return icons[type] || 'šŸ“¦';
28
+ }
29
+ /**
30
+ * Get human-readable label for package type
31
+ */
32
+ function getTypeLabel(type) {
33
+ const labels = {
34
+ skill: 'Skill',
35
+ agent: 'Agent',
36
+ rule: 'Rule',
37
+ plugin: 'Plugin',
38
+ prompt: 'Prompt',
39
+ workflow: 'Workflow',
40
+ tool: 'Tool',
41
+ template: 'Template',
42
+ mcp: 'MCP Server',
43
+ };
44
+ return labels[type] || type;
45
+ }
46
+ /**
47
+ * Map user-friendly CLI types to registry schema
48
+ */
49
+ function mapTypeToRegistry(cliType) {
50
+ const typeMap = {
51
+ rule: { type: 'cursor', tags: ['cursor-rule'] },
52
+ skill: { type: 'claude', tags: ['claude-skill'] },
53
+ agent: { type: 'claude' },
54
+ mcp: { type: 'generic', tags: ['mcp', 'mcp-server'] },
55
+ plugin: { type: 'generic', tags: ['plugin'] },
56
+ prompt: { type: 'generic', tags: ['prompt'] },
57
+ workflow: { type: 'generic', tags: ['workflow'] },
58
+ tool: { type: 'generic', tags: ['tool'] },
59
+ template: { type: 'generic', tags: ['template'] },
60
+ };
61
+ return typeMap[cliType] || {};
62
+ }
63
+ async function handleSearch(query, options) {
64
+ const startTime = Date.now();
65
+ let success = false;
66
+ let error;
67
+ let result = null;
68
+ try {
69
+ // Allow empty query when filtering by type
70
+ if (query) {
71
+ console.log(`šŸ” Searching for "${query}"...`);
72
+ }
73
+ else if (options.type) {
74
+ console.log(`šŸ” Listing ${options.type} packages...`);
75
+ }
76
+ else {
77
+ console.log('āŒ Please provide a search query or use --type to filter by package type');
78
+ console.log('\nšŸ’” Examples:');
79
+ console.log(' prpm search react');
80
+ console.log(' prpm search --type skill');
81
+ console.log(' prpm search react --type rule');
82
+ return;
83
+ }
84
+ const config = await (0, user_config_1.getConfig)();
85
+ const client = (0, registry_client_1.getRegistryClient)(config);
86
+ // Map CLI type to registry schema
87
+ const searchOptions = {
88
+ limit: options.limit || 20,
89
+ };
90
+ if (options.type) {
91
+ const mapped = mapTypeToRegistry(options.type);
92
+ if (mapped.type) {
93
+ searchOptions.type = mapped.type;
94
+ }
95
+ if (mapped.tags) {
96
+ searchOptions.tags = mapped.tags;
97
+ }
98
+ }
99
+ result = await client.search(query || '', searchOptions);
100
+ if (result.packages.length === 0) {
101
+ console.log('\nāŒ No packages found');
102
+ console.log(`\nTry:`);
103
+ console.log(` - Broadening your search terms`);
104
+ console.log(` - Checking spelling`);
105
+ console.log(` - Browsing trending: prpm trending`);
106
+ return;
107
+ }
108
+ console.log(`\n✨ Found ${result.total} package(s):\n`);
109
+ // Display results
110
+ result.packages.forEach((pkg) => {
111
+ const badges = [];
112
+ if (pkg.featured || pkg.official)
113
+ badges.push('Official');
114
+ if (pkg.verified && !pkg.featured && !pkg.official)
115
+ badges.push('Verified');
116
+ const badgeStr = badges.length > 0 ? `[${badges.join(', ')}] ` : '';
117
+ const rating = pkg.rating_average ? `⭐ ${pkg.rating_average.toFixed(1)}` : '';
118
+ const downloads = pkg.total_downloads >= 1000
119
+ ? `${(pkg.total_downloads / 1000).toFixed(1)}k`
120
+ : pkg.total_downloads;
121
+ const typeIcon = getTypeIcon(pkg.type);
122
+ const typeLabel = getTypeLabel(pkg.type);
123
+ console.log(`${badgeStr}${pkg.display_name} ${rating}`);
124
+ console.log(` ${pkg.description || 'No description'}`);
125
+ console.log(` šŸ“¦ ${pkg.id} | ${typeIcon} ${typeLabel} | šŸ“„ ${downloads} | šŸ·ļø ${pkg.tags.slice(0, 3).join(', ')}`);
126
+ console.log();
127
+ });
128
+ console.log(`\nšŸ’” Install a package: prpm install <package-id>`);
129
+ console.log(` Get more info: prpm info <package-id>`);
130
+ if (result.total > result.packages.length) {
131
+ console.log(`\n Showing ${result.packages.length} of ${result.total} results`);
132
+ }
133
+ success = true;
134
+ }
135
+ catch (err) {
136
+ error = err instanceof Error ? err.message : String(err);
137
+ console.error(`\nāŒ Search failed: ${error}`);
138
+ console.log(`\nšŸ’” Tip: Make sure you have internet connection`);
139
+ console.log(` Registry: ${process.env.PRPM_REGISTRY_URL || 'https://registry.prpm.dev'}`);
140
+ process.exit(1);
141
+ }
142
+ finally {
143
+ await telemetry_1.telemetry.track({
144
+ command: 'search',
145
+ success,
146
+ error,
147
+ duration: Date.now() - startTime,
148
+ data: {
149
+ query: query.substring(0, 100),
150
+ type: options.type,
151
+ resultCount: success && result ? result.packages.length : 0,
152
+ },
153
+ });
154
+ }
155
+ }
156
+ function createSearchCommand() {
157
+ const command = new commander_1.Command('search');
158
+ command
159
+ .description('Search for packages in the registry')
160
+ .argument('[query]', 'Search query (optional when using --type)')
161
+ .option('--type <type>', 'Filter by package type (skill, agent, rule, plugin, prompt, workflow, tool, template, mcp)')
162
+ .option('--limit <number>', 'Number of results to show', '20')
163
+ .action(async (query, options) => {
164
+ const type = options.type;
165
+ const limit = parseInt(options.limit, 10);
166
+ const validTypes = ['skill', 'agent', 'rule', 'plugin', 'prompt', 'workflow', 'tool', 'template', 'mcp'];
167
+ if (options.type && !validTypes.includes(type)) {
168
+ console.error(`āŒ Type must be one of: ${validTypes.join(', ')}`);
169
+ console.log(`\nšŸ’” Examples:`);
170
+ console.log(` prpm search postgres --type skill`);
171
+ console.log(` prpm search debugging --type agent`);
172
+ console.log(` prpm search react --type rule`);
173
+ console.log(` prpm search --type skill # List all skills`);
174
+ process.exit(1);
175
+ }
176
+ await handleSearch(query || '', { type, limit });
177
+ });
178
+ return command;
179
+ }
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createTelemetryCommand = createTelemetryCommand;
4
+ const commander_1 = require("commander");
5
+ const telemetry_1 = require("../core/telemetry");
6
+ function createTelemetryCommand() {
7
+ return new commander_1.Command('telemetry')
8
+ .description('Manage telemetry and analytics settings')
9
+ .addCommand(createStatusCommand(), { hidden: true })
10
+ .addCommand(createEnableCommand())
11
+ .addCommand(createDisableCommand())
12
+ .addCommand(createStatsCommand(), { hidden: true })
13
+ .addCommand(createTestCommand(), { hidden: true });
14
+ }
15
+ function createStatusCommand() {
16
+ return new commander_1.Command('status')
17
+ .description('Show current telemetry status')
18
+ .action(async () => {
19
+ const enabled = telemetry_1.telemetry.isEnabled();
20
+ const stats = await telemetry_1.telemetry.getStats();
21
+ console.log('šŸ“Š Telemetry Status:');
22
+ console.log(` Status: ${enabled ? 'āœ… Enabled' : 'āŒ Disabled'}`);
23
+ console.log(` Analytics: šŸ“ˆ PostHog`);
24
+ console.log(` Total events: ${stats.totalEvents}`);
25
+ if (stats.lastEvent) {
26
+ console.log(` Last event: ${stats.lastEvent}`);
27
+ }
28
+ if (enabled) {
29
+ console.log('\nšŸ’” Telemetry helps us improve the tool by collecting anonymous usage data.');
30
+ console.log(' Data is sent to PostHog for analysis.');
31
+ console.log(' Run "prpm telemetry disable" to opt out.');
32
+ }
33
+ else {
34
+ console.log('\nšŸ’” Telemetry is disabled. Run "prpm telemetry enable" to help improve the tool.');
35
+ }
36
+ });
37
+ }
38
+ function createEnableCommand() {
39
+ return new commander_1.Command('enable')
40
+ .description('Enable telemetry and analytics')
41
+ .action(async () => {
42
+ await telemetry_1.telemetry.enable();
43
+ console.log('āœ… Telemetry enabled');
44
+ console.log('šŸ“Š Anonymous usage data will be collected to help improve the tool.');
45
+ });
46
+ }
47
+ function createDisableCommand() {
48
+ return new commander_1.Command('disable')
49
+ .description('Disable telemetry and analytics')
50
+ .action(async () => {
51
+ await telemetry_1.telemetry.disable();
52
+ console.log('āŒ Telemetry disabled');
53
+ console.log('šŸ“Š No usage data will be collected.');
54
+ });
55
+ }
56
+ function createStatsCommand() {
57
+ return new commander_1.Command('stats')
58
+ .description('Show telemetry statistics')
59
+ .action(async () => {
60
+ const stats = await telemetry_1.telemetry.getStats();
61
+ console.log('šŸ“Š Telemetry Statistics:');
62
+ console.log(` Total events: ${stats.totalEvents}`);
63
+ if (stats.lastEvent) {
64
+ console.log(` Last event: ${stats.lastEvent}`);
65
+ }
66
+ });
67
+ }
68
+ function createTestCommand() {
69
+ return new commander_1.Command('test')
70
+ .description('Send a test event to PostHog')
71
+ .action(async () => {
72
+ console.log('🧪 Sending test event to PostHog...');
73
+ try {
74
+ await telemetry_1.telemetry.track({
75
+ command: 'test',
76
+ success: true,
77
+ duration: 100,
78
+ data: {
79
+ testType: 'manual',
80
+ message: 'This is a test event from PPM CLI',
81
+ timestamp: new Date().toISOString(),
82
+ uniqueId: Math.random().toString(36).substring(7),
83
+ },
84
+ });
85
+ console.log('āœ… Test event sent successfully!');
86
+ console.log('šŸ“ˆ Check your PostHog dashboard for the event: prpm_test');
87
+ console.log('šŸ”— Dashboard: https://app.posthog.com');
88
+ console.log('ā° Note: Events may take 1-2 minutes to appear in the dashboard');
89
+ // Wait a moment for the event to be sent
90
+ await new Promise(resolve => setTimeout(resolve, 3000));
91
+ const stats = await telemetry_1.telemetry.getStats();
92
+ console.log(`šŸ“Š Total events now: ${stats.totalEvents}`);
93
+ console.log('\nšŸ” Troubleshooting tips:');
94
+ console.log('1. Check the "Live Events" section in PostHog');
95
+ console.log('2. Look for events with name "prpm_test"');
96
+ console.log('3. Make sure you\'re in the correct PostHog project');
97
+ console.log('4. Events may take 1-2 minutes to appear');
98
+ }
99
+ catch (error) {
100
+ console.error('āŒ Failed to send test event:', error);
101
+ }
102
+ });
103
+ }
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ /**
3
+ * Trending command - Show trending packages
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.handleTrending = handleTrending;
7
+ exports.createTrendingCommand = createTrendingCommand;
8
+ const commander_1 = require("commander");
9
+ const registry_client_1 = require("@prpm/registry-client");
10
+ const user_config_1 = require("../core/user-config");
11
+ const telemetry_1 = require("../core/telemetry");
12
+ async function handleTrending(options) {
13
+ const startTime = Date.now();
14
+ let success = false;
15
+ let error;
16
+ try {
17
+ console.log(`šŸ”„ Fetching trending packages...`);
18
+ const config = await (0, user_config_1.getConfig)();
19
+ const client = (0, registry_client_1.getRegistryClient)(config);
20
+ const packages = await client.getTrending(options.type, options.limit || 10);
21
+ if (packages.length === 0) {
22
+ console.log('\nāŒ No trending packages found');
23
+ return;
24
+ }
25
+ console.log(`\n✨ Trending packages (last 7 days):\n`);
26
+ packages.forEach((pkg, index) => {
27
+ const verified = pkg.verified ? 'āœ“' : ' ';
28
+ const rating = pkg.rating_average ? `⭐ ${pkg.rating_average.toFixed(1)}` : '';
29
+ const downloads = pkg.total_downloads >= 1000
30
+ ? `${(pkg.total_downloads / 1000).toFixed(1)}k`
31
+ : pkg.total_downloads;
32
+ console.log(`${index + 1}. [${verified}] ${pkg.display_name} ${rating}`);
33
+ console.log(` ${pkg.description || 'No description'}`);
34
+ console.log(` šŸ“¦ ${pkg.id} | šŸ“„ ${downloads} downloads`);
35
+ console.log();
36
+ });
37
+ console.log(`šŸ’” Install a package: prpm install <package-id>`);
38
+ success = true;
39
+ }
40
+ catch (err) {
41
+ error = err instanceof Error ? err.message : String(err);
42
+ console.error(`\nāŒ Failed to fetch trending packages: ${error}`);
43
+ console.log(`\nšŸ’” Tip: Check your internet connection`);
44
+ process.exit(1);
45
+ }
46
+ finally {
47
+ await telemetry_1.telemetry.track({
48
+ command: 'trending',
49
+ success,
50
+ error,
51
+ duration: Date.now() - startTime,
52
+ data: {
53
+ type: options.type,
54
+ limit: options.limit || 10,
55
+ },
56
+ });
57
+ }
58
+ }
59
+ function createTrendingCommand() {
60
+ const command = new commander_1.Command('trending');
61
+ command
62
+ .description('Show trending packages')
63
+ .option('--type <type>', 'Filter by package type (cursor, claude, continue)')
64
+ .option('--limit <number>', 'Number of packages to show', '10')
65
+ .action(async (options) => {
66
+ const type = options.type;
67
+ const limit = parseInt(options.limit, 10);
68
+ if (options.type && !['cursor', 'claude', 'continue', 'windsurf', 'generic'].includes(type)) {
69
+ console.error('āŒ Type must be one of: cursor, claude, continue, windsurf, generic');
70
+ process.exit(1);
71
+ }
72
+ await handleTrending({ type, limit });
73
+ });
74
+ return command;
75
+ }
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ /**
3
+ * Update command - Update packages to latest compatible versions
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.handleUpdate = handleUpdate;
7
+ exports.createUpdateCommand = createUpdateCommand;
8
+ const commander_1 = require("commander");
9
+ const registry_client_1 = require("@prpm/registry-client");
10
+ const user_config_1 = require("../core/user-config");
11
+ const config_1 = require("../core/config");
12
+ const install_1 = require("./install");
13
+ const telemetry_1 = require("../core/telemetry");
14
+ /**
15
+ * Update packages to latest minor/patch versions
16
+ */
17
+ async function handleUpdate(packageName, options = {}) {
18
+ const startTime = Date.now();
19
+ let success = false;
20
+ let error;
21
+ let updatedCount = 0;
22
+ try {
23
+ const config = await (0, user_config_1.getConfig)();
24
+ const client = (0, registry_client_1.getRegistryClient)(config);
25
+ const installedPackages = await (0, config_1.listPackages)();
26
+ if (installedPackages.length === 0) {
27
+ console.log('No packages installed.');
28
+ success = true;
29
+ return;
30
+ }
31
+ // Determine which packages to update
32
+ let packagesToUpdate = installedPackages;
33
+ if (packageName) {
34
+ // Update specific package
35
+ packagesToUpdate = installedPackages.filter(p => p.id === packageName);
36
+ if (packagesToUpdate.length === 0) {
37
+ throw new Error(`Package ${packageName} is not installed`);
38
+ }
39
+ }
40
+ console.log('šŸ”„ Checking for updates...\n');
41
+ for (const pkg of packagesToUpdate) {
42
+ try {
43
+ // Get package info from registry
44
+ const registryPkg = await client.getPackage(pkg.id);
45
+ if (!registryPkg.latest_version || !pkg.version) {
46
+ continue;
47
+ }
48
+ const currentVersion = pkg.version;
49
+ const latestVersion = registryPkg.latest_version.version;
50
+ // Only update if it's a minor or patch update (not major)
51
+ const updateType = getUpdateType(currentVersion, latestVersion);
52
+ if (updateType === 'major') {
53
+ console.log(`ā­ļø Skipping ${pkg.id} (major update ${currentVersion} → ${latestVersion}, use upgrade)`);
54
+ continue;
55
+ }
56
+ if (currentVersion === latestVersion) {
57
+ console.log(`āœ… ${pkg.id} is already up to date (${currentVersion})`);
58
+ continue;
59
+ }
60
+ console.log(`\nšŸ“¦ Updating ${pkg.id}: ${currentVersion} → ${latestVersion}`);
61
+ // Install new version
62
+ await (0, install_1.handleInstall)(`${pkg.id}@${latestVersion}`, {
63
+ type: pkg.type,
64
+ });
65
+ updatedCount++;
66
+ }
67
+ catch (err) {
68
+ console.error(` āŒ Failed to update ${pkg.id}: ${err instanceof Error ? err.message : String(err)}`);
69
+ }
70
+ }
71
+ if (updatedCount === 0) {
72
+ console.log('\nāœ… All packages are up to date!\n');
73
+ }
74
+ else {
75
+ console.log(`\nāœ… Updated ${updatedCount} package(s)\n`);
76
+ }
77
+ success = true;
78
+ }
79
+ catch (err) {
80
+ error = err instanceof Error ? err.message : String(err);
81
+ console.error(`\nāŒ Update failed: ${error}`);
82
+ process.exit(1);
83
+ }
84
+ finally {
85
+ await telemetry_1.telemetry.track({
86
+ command: 'update',
87
+ success,
88
+ error,
89
+ duration: Date.now() - startTime,
90
+ data: {
91
+ packageName,
92
+ updatedCount,
93
+ },
94
+ });
95
+ }
96
+ }
97
+ /**
98
+ * Determine update type based on semver
99
+ */
100
+ function getUpdateType(current, latest) {
101
+ const currentParts = current.split('.').map(Number);
102
+ const latestParts = latest.split('.').map(Number);
103
+ const [currMajor = 0, currMinor = 0, currPatch = 0] = currentParts;
104
+ const [latestMajor = 0, latestMinor = 0, latestPatch = 0] = latestParts;
105
+ if (latestMajor > currMajor)
106
+ return 'major';
107
+ if (latestMinor > currMinor)
108
+ return 'minor';
109
+ return 'patch';
110
+ }
111
+ /**
112
+ * Create the update command
113
+ */
114
+ function createUpdateCommand() {
115
+ return new commander_1.Command('update')
116
+ .description('Update packages to latest compatible versions (minor/patch only)')
117
+ .argument('[package]', 'Specific package to update (optional)')
118
+ .option('--all', 'Update all packages')
119
+ .action(handleUpdate);
120
+ }
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ /**
3
+ * Upgrade command - Upgrade packages to latest versions (including major)
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.handleUpgrade = handleUpgrade;
7
+ exports.createUpgradeCommand = createUpgradeCommand;
8
+ const commander_1 = require("commander");
9
+ const registry_client_1 = require("@prpm/registry-client");
10
+ const user_config_1 = require("../core/user-config");
11
+ const config_1 = require("../core/config");
12
+ const install_1 = require("./install");
13
+ const telemetry_1 = require("../core/telemetry");
14
+ /**
15
+ * Upgrade packages to latest versions (including major updates)
16
+ */
17
+ async function handleUpgrade(packageName, options = {}) {
18
+ const startTime = Date.now();
19
+ let success = false;
20
+ let error;
21
+ let upgradedCount = 0;
22
+ try {
23
+ const config = await (0, user_config_1.getConfig)();
24
+ const client = (0, registry_client_1.getRegistryClient)(config);
25
+ const installedPackages = await (0, config_1.listPackages)();
26
+ if (installedPackages.length === 0) {
27
+ console.log('No packages installed.');
28
+ success = true;
29
+ return;
30
+ }
31
+ // Determine which packages to upgrade
32
+ let packagesToUpgrade = installedPackages;
33
+ if (packageName) {
34
+ // Upgrade specific package
35
+ packagesToUpgrade = installedPackages.filter(p => p.id === packageName);
36
+ if (packagesToUpgrade.length === 0) {
37
+ throw new Error(`Package ${packageName} is not installed`);
38
+ }
39
+ }
40
+ console.log('šŸš€ Checking for upgrades...\n');
41
+ for (const pkg of packagesToUpgrade) {
42
+ try {
43
+ // Get package info from registry
44
+ const registryPkg = await client.getPackage(pkg.id);
45
+ if (!registryPkg.latest_version || !pkg.version) {
46
+ continue;
47
+ }
48
+ const currentVersion = pkg.version;
49
+ const latestVersion = registryPkg.latest_version.version;
50
+ if (currentVersion === latestVersion) {
51
+ console.log(`āœ… ${pkg.id} is already at latest version (${currentVersion})`);
52
+ continue;
53
+ }
54
+ const updateType = getUpdateType(currentVersion, latestVersion);
55
+ const emoji = updateType === 'major' ? 'šŸ”“' : updateType === 'minor' ? '🟔' : '🟢';
56
+ console.log(`\n${emoji} Upgrading ${pkg.id}: ${currentVersion} → ${latestVersion} (${updateType})`);
57
+ if (updateType === 'major' && !options.force) {
58
+ console.log(` āš ļø This is a major version upgrade and may contain breaking changes`);
59
+ }
60
+ // Install new version
61
+ await (0, install_1.handleInstall)(`${pkg.id}@${latestVersion}`, {
62
+ type: pkg.type,
63
+ });
64
+ upgradedCount++;
65
+ }
66
+ catch (err) {
67
+ console.error(` āŒ Failed to upgrade ${pkg.id}: ${err instanceof Error ? err.message : String(err)}`);
68
+ }
69
+ }
70
+ if (upgradedCount === 0) {
71
+ console.log('\nāœ… All packages are at the latest version!\n');
72
+ }
73
+ else {
74
+ console.log(`\nāœ… Upgraded ${upgradedCount} package(s)\n`);
75
+ }
76
+ success = true;
77
+ }
78
+ catch (err) {
79
+ error = err instanceof Error ? err.message : String(err);
80
+ console.error(`\nāŒ Upgrade failed: ${error}`);
81
+ process.exit(1);
82
+ }
83
+ finally {
84
+ await telemetry_1.telemetry.track({
85
+ command: 'upgrade',
86
+ success,
87
+ error,
88
+ duration: Date.now() - startTime,
89
+ data: {
90
+ packageName,
91
+ upgradedCount,
92
+ },
93
+ });
94
+ }
95
+ }
96
+ /**
97
+ * Determine update type based on semver
98
+ */
99
+ function getUpdateType(current, latest) {
100
+ const currentParts = current.split('.').map(Number);
101
+ const latestParts = latest.split('.').map(Number);
102
+ const [currMajor = 0, currMinor = 0, currPatch = 0] = currentParts;
103
+ const [latestMajor = 0, latestMinor = 0, latestPatch = 0] = latestParts;
104
+ if (latestMajor > currMajor)
105
+ return 'major';
106
+ if (latestMinor > currMinor)
107
+ return 'minor';
108
+ return 'patch';
109
+ }
110
+ /**
111
+ * Create the upgrade command
112
+ */
113
+ function createUpgradeCommand() {
114
+ return new commander_1.Command('upgrade')
115
+ .description('Upgrade packages to latest versions (including major updates)')
116
+ .argument('[package]', 'Specific package to upgrade (optional)')
117
+ .option('--all', 'Upgrade all packages')
118
+ .option('--force', 'Skip warning for major version upgrades')
119
+ .action(handleUpgrade);
120
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ /**
3
+ * Whoami command implementation
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.handleWhoami = handleWhoami;
7
+ exports.createWhoamiCommand = createWhoamiCommand;
8
+ const commander_1 = require("commander");
9
+ const user_config_1 = require("../core/user-config");
10
+ const telemetry_1 = require("../core/telemetry");
11
+ /**
12
+ * Show current logged-in user
13
+ */
14
+ async function handleWhoami() {
15
+ const startTime = Date.now();
16
+ let success = false;
17
+ let error;
18
+ try {
19
+ const config = await (0, user_config_1.getConfig)();
20
+ if (!config.token || !config.username) {
21
+ console.log('Not logged in');
22
+ console.log('\nšŸ’” Run "prpm login" to authenticate\n');
23
+ success = true;
24
+ return;
25
+ }
26
+ console.log(`${config.username}`);
27
+ success = true;
28
+ }
29
+ catch (err) {
30
+ error = err instanceof Error ? err.message : String(err);
31
+ console.error(`āŒ Error: ${error}`);
32
+ process.exit(1);
33
+ }
34
+ finally {
35
+ // Track telemetry
36
+ await telemetry_1.telemetry.track({
37
+ command: 'whoami',
38
+ success,
39
+ error,
40
+ duration: Date.now() - startTime,
41
+ });
42
+ }
43
+ }
44
+ /**
45
+ * Create the whoami command
46
+ */
47
+ function createWhoamiCommand() {
48
+ return new commander_1.Command('whoami')
49
+ .description('Show current logged-in user')
50
+ .action(handleWhoami);
51
+ }