@lvnt/release-radar 1.7.0 → 1.7.2

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/cli/src/index.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  import chalk from 'chalk';
2
+ import { readFileSync } from 'fs';
3
+ import { fileURLToPath } from 'url';
4
+ import { dirname, join } from 'path';
2
5
  import { ConfigManager } from './config.js';
3
6
  import { DownloadTracker } from './tracker.js';
4
7
  import { loadVersions } from './versions.js';
@@ -7,6 +10,46 @@ import { downloadFile, updateNpmPackage } from './downloader.js';
7
10
  import { promptSetup, promptToolSelection, type ToolChoice } from './ui.js';
8
11
  import { isNpmTool } from './types.js';
9
12
 
13
+ function getVersion(): string {
14
+ const __dirname = dirname(fileURLToPath(import.meta.url));
15
+ const pkgPath = join(__dirname, '..', 'package.json');
16
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
17
+ return pkg.version;
18
+ }
19
+
20
+ function showHelp(): void {
21
+ const version = getVersion();
22
+ console.log(`
23
+ ${chalk.bold('release-radar-cli')} v${version}
24
+
25
+ ${chalk.bold('USAGE:')}
26
+ release-radar-cli [command] [options]
27
+
28
+ ${chalk.bold('COMMANDS:')}
29
+ ${chalk.cyan('(default)')} Interactive mode - select and download tools
30
+ ${chalk.cyan('status')} Show tool versions and download status
31
+ ${chalk.cyan('config')} Configure or reconfigure settings (Nexus URL, download dir)
32
+ ${chalk.cyan('version')} Show CLI version
33
+ ${chalk.cyan('help')} Show this help message
34
+
35
+ ${chalk.bold('OPTIONS:')}
36
+ ${chalk.cyan('-v, --version')} Show version number
37
+ ${chalk.cyan('-h, --help')} Show help
38
+ ${chalk.cyan('--skip-update')} Skip auto-update check on startup
39
+
40
+ ${chalk.bold('EXAMPLES:')}
41
+ release-radar-cli # Interactive mode
42
+ release-radar-cli status # Show all tool versions
43
+ release-radar-cli config # Reconfigure settings
44
+ release-radar-cli --version # Show version
45
+
46
+ ${chalk.bold('CONFIG LOCATION:')}
47
+ ~/.release-radar-cli/config.json
48
+
49
+ ${chalk.gray('For more info: https://github.com/lvnt/release-radar')}
50
+ `);
51
+ }
52
+
10
53
  async function showStatus(): Promise<void> {
11
54
  const tracker = new DownloadTracker();
12
55
  const versions = loadVersions();
@@ -37,8 +80,38 @@ async function showStatus(): Promise<void> {
37
80
 
38
81
  async function runConfig(): Promise<void> {
39
82
  const configManager = new ConfigManager();
40
- const config = await promptSetup();
41
- configManager.save(config);
83
+
84
+ // Check if already configured and show current values
85
+ if (configManager.isConfigured()) {
86
+ const current = configManager.load();
87
+ console.log(chalk.bold('\nCurrent configuration:'));
88
+ console.log(` Nexus URL: ${chalk.cyan(current.nexusUrl)}`);
89
+ console.log(` Download dir: ${chalk.cyan(current.downloadDir)}`);
90
+ console.log('');
91
+
92
+ const { reconfigure } = await (await import('inquirer')).default.prompt([
93
+ {
94
+ type: 'confirm',
95
+ name: 'reconfigure',
96
+ message: 'Do you want to update these settings?',
97
+ default: false,
98
+ },
99
+ ]);
100
+
101
+ if (!reconfigure) {
102
+ console.log(chalk.gray('Configuration unchanged.'));
103
+ return;
104
+ }
105
+
106
+ // Prompt with current values as defaults
107
+ const { promptReconfigure } = await import('./ui.js');
108
+ const config = await promptReconfigure(current);
109
+ configManager.save(config);
110
+ } else {
111
+ const config = await promptSetup();
112
+ configManager.save(config);
113
+ }
114
+
42
115
  console.log(chalk.green('\nConfiguration saved!'));
43
116
  }
44
117
 
@@ -143,10 +216,29 @@ async function runInteractive(): Promise<void> {
143
216
  }
144
217
 
145
218
  async function main(): Promise<void> {
146
- const args = process.argv.slice(2).filter(arg => !arg.startsWith('--'));
219
+ const rawArgs = process.argv.slice(2);
220
+
221
+ // Handle flags first
222
+ if (rawArgs.includes('-v') || rawArgs.includes('--version')) {
223
+ console.log(getVersion());
224
+ return;
225
+ }
226
+
227
+ if (rawArgs.includes('-h') || rawArgs.includes('--help')) {
228
+ showHelp();
229
+ return;
230
+ }
231
+
232
+ const args = rawArgs.filter(arg => !arg.startsWith('--') && !arg.startsWith('-'));
147
233
  const command = args[0];
148
234
 
149
235
  switch (command) {
236
+ case 'version':
237
+ console.log(getVersion());
238
+ break;
239
+ case 'help':
240
+ showHelp();
241
+ break;
150
242
  case 'status':
151
243
  await showStatus();
152
244
  break;
package/cli/src/ui.ts CHANGED
@@ -35,6 +35,36 @@ export async function promptSetup(): Promise<CliConfig> {
35
35
  };
36
36
  }
37
37
 
38
+ export async function promptReconfigure(current: CliConfig): Promise<CliConfig> {
39
+ console.log(chalk.bold('\nUpdate your settings:\n'));
40
+
41
+ const answers = await inquirer.prompt([
42
+ {
43
+ type: 'input',
44
+ name: 'nexusUrl',
45
+ message: 'Nexus proxy base URL:',
46
+ default: current.nexusUrl,
47
+ validate: (input: string) => {
48
+ if (!input.trim()) return 'URL is required';
49
+ if (!input.startsWith('http')) return 'URL must start with http:// or https://';
50
+ return true;
51
+ },
52
+ },
53
+ {
54
+ type: 'input',
55
+ name: 'downloadDir',
56
+ message: 'Download directory:',
57
+ default: current.downloadDir,
58
+ validate: (input: string) => input.trim() ? true : 'Directory is required',
59
+ },
60
+ ]);
61
+
62
+ return {
63
+ nexusUrl: answers.nexusUrl.replace(/\/$/, ''),
64
+ downloadDir: answers.downloadDir.replace('~', process.env.HOME || ''),
65
+ };
66
+ }
67
+
38
68
  interface ToolChoiceBase {
39
69
  name: string;
40
70
  displayName: string;
@@ -19,9 +19,7 @@ export class CliPublisher {
19
19
  try {
20
20
  // Generate versions.json
21
21
  const versionsJson = generateVersionsJson(versions, this.downloadsConfig);
22
- // Write to data/ for reference
23
- writeFileSync('./data/cli-versions.json', JSON.stringify(versionsJson, null, 2));
24
- // Copy to CLI package
22
+ // Write to CLI package
25
23
  const cliVersionsPath = `${this.cliPath}/versions.json`;
26
24
  writeFileSync(cliVersionsPath, JSON.stringify(versionsJson, null, 2));
27
25
  // Read current CLI version
@@ -34,9 +32,14 @@ export class CliPublisher {
34
32
  const newVersion = versionParts.join('.');
35
33
  pkg.version = newVersion;
36
34
  writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
35
+ // Install dependencies (including devDependencies for TypeScript)
36
+ console.log('[CliPublisher] Installing dependencies...');
37
+ execSync('npm install', { cwd: this.cliPath, stdio: 'pipe' });
37
38
  // Build CLI
39
+ console.log('[CliPublisher] Building...');
38
40
  execSync('npm run build', { cwd: this.cliPath, stdio: 'pipe' });
39
41
  // Publish to npm
42
+ console.log('[CliPublisher] Publishing...');
40
43
  execSync('npm publish --access public', { cwd: this.cliPath, stdio: 'pipe' });
41
44
  console.log(`[CliPublisher] Published @lvnt/release-radar-cli v${newVersion}`);
42
45
  return { success: true, version: newVersion };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvnt/release-radar",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "description": "Monitor tool versions and notify via Telegram when updates are detected",
5
5
  "main": "dist/index.js",
6
6
  "bin": {