idea-manager 0.9.0 → 0.9.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/package.json +1 -1
- package/src/cli.ts +40 -2
- package/src/lib/sync/index.ts +5 -0
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -15,6 +15,45 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
15
15
|
const __dirname = path.dirname(__filename);
|
|
16
16
|
const PKG_ROOT = path.resolve(__dirname, '..');
|
|
17
17
|
|
|
18
|
+
async function openAsApp(url: string) {
|
|
19
|
+
const { exec: execCb } = await import('child_process');
|
|
20
|
+
const platform = process.platform;
|
|
21
|
+
|
|
22
|
+
// Shell commands for --app mode per platform
|
|
23
|
+
const commands: string[] =
|
|
24
|
+
platform === 'darwin'
|
|
25
|
+
? [
|
|
26
|
+
`open -a "Google Chrome" --args --app=${url}`,
|
|
27
|
+
`open -a "Microsoft Edge" --args --app=${url}`,
|
|
28
|
+
`open -a "Chromium" --args --app=${url}`,
|
|
29
|
+
]
|
|
30
|
+
: platform === 'win32'
|
|
31
|
+
? [
|
|
32
|
+
`start "" chrome --app=${url}`,
|
|
33
|
+
`start "" msedge --app=${url}`,
|
|
34
|
+
]
|
|
35
|
+
: [
|
|
36
|
+
`google-chrome --app=${url}`,
|
|
37
|
+
`chromium-browser --app=${url}`,
|
|
38
|
+
`microsoft-edge --app=${url}`,
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
for (const cmd of commands) {
|
|
42
|
+
try {
|
|
43
|
+
await new Promise<void>((resolve, reject) => {
|
|
44
|
+
execCb(cmd, (err) => { if (err) reject(err); else resolve(); });
|
|
45
|
+
});
|
|
46
|
+
return; // success
|
|
47
|
+
} catch {
|
|
48
|
+
continue; // try next browser
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Fallback: open normally
|
|
53
|
+
const open = (await import('open')).default;
|
|
54
|
+
await open(url);
|
|
55
|
+
}
|
|
56
|
+
|
|
18
57
|
const program = new Command();
|
|
19
58
|
|
|
20
59
|
program
|
|
@@ -87,8 +126,7 @@ program
|
|
|
87
126
|
|
|
88
127
|
setTimeout(async () => {
|
|
89
128
|
try {
|
|
90
|
-
|
|
91
|
-
await open(`http://localhost:${port}`);
|
|
129
|
+
await openAsApp(`http://localhost:${port}`);
|
|
92
130
|
} catch { /* ignore */ }
|
|
93
131
|
}, 3000);
|
|
94
132
|
|
package/src/lib/sync/index.ts
CHANGED
|
@@ -66,6 +66,11 @@ export async function syncInit() {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
if (!repoUrl) {
|
|
69
|
+
if (!ghAvailable) {
|
|
70
|
+
console.log('\n gh CLI not found — auto repo creation unavailable.');
|
|
71
|
+
console.log(' Create a repo on GitHub first, then paste the URL below.');
|
|
72
|
+
console.log(' (Install gh: https://cli.github.com)\n');
|
|
73
|
+
}
|
|
69
74
|
repoUrl = await ask('Enter git repository URL');
|
|
70
75
|
if (!repoUrl) {
|
|
71
76
|
console.error('\n Error: Repository URL is required.\n');
|