@abyrd9/harbor-cli 2.2.0 → 2.3.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.
- package/dist/index.js +24 -15
- package/harbor.package-json.schema.json +1 -0
- package/package.json +1 -1
- package/scripts/dev.sh +2 -2
package/dist/index.js
CHANGED
|
@@ -327,13 +327,15 @@ PREREQUISITES: harbor.json or harbor config in package.json.
|
|
|
327
327
|
EXAMPLES:
|
|
328
328
|
harbor launch # Start and attach to tmux session
|
|
329
329
|
harbor launch -d # Start in background (headless mode)
|
|
330
|
-
harbor launch --headless # Same as -d
|
|
330
|
+
harbor launch --headless # Same as -d
|
|
331
|
+
harbor launch --name my-session # Use custom session name`)
|
|
331
332
|
.option('-d, --detach', 'Run in background without attaching (headless mode). Use "anchor" to attach later.')
|
|
332
333
|
.option('--headless', 'Alias for --detach')
|
|
334
|
+
.option('--name <name>', 'Override tmux session name from config')
|
|
333
335
|
.action(async (options) => {
|
|
334
336
|
try {
|
|
335
337
|
await checkDependencies();
|
|
336
|
-
await runServices({ detach: options.detach || options.headless });
|
|
338
|
+
await runServices({ detach: options.detach || options.headless, name: options.name });
|
|
337
339
|
}
|
|
338
340
|
catch (err) {
|
|
339
341
|
console.log('❌ Error:', err instanceof Error ? err.message : 'Unknown error');
|
|
@@ -353,13 +355,15 @@ WHAT IT DOES:
|
|
|
353
355
|
|
|
354
356
|
PREREQUISITES: Services must be running (started with 'harbor launch').
|
|
355
357
|
|
|
356
|
-
|
|
357
|
-
harbor launch -d
|
|
358
|
-
harbor anchor
|
|
359
|
-
|
|
358
|
+
EXAMPLES:
|
|
359
|
+
harbor launch -d # Start in background
|
|
360
|
+
harbor anchor # Attach to default session
|
|
361
|
+
harbor anchor --name my-app # Attach to a specific named session`)
|
|
362
|
+
.option('--name <name>', 'Specify which tmux session to attach to (defaults to config sessionName or "harbor")')
|
|
363
|
+
.action(async (options) => {
|
|
360
364
|
try {
|
|
361
365
|
const config = await readHarborConfig();
|
|
362
|
-
const sessionName = config.sessionName || 'harbor';
|
|
366
|
+
const sessionName = options.name || config.sessionName || 'harbor';
|
|
363
367
|
// Check if session exists
|
|
364
368
|
const checkSession = spawn('tmux', ['has-session', '-t', sessionName], {
|
|
365
369
|
stdio: 'pipe',
|
|
@@ -400,12 +404,14 @@ WHAT IT DOES:
|
|
|
400
404
|
|
|
401
405
|
SAFE TO RUN: If no session is running, it simply reports that and exits cleanly.
|
|
402
406
|
|
|
403
|
-
|
|
404
|
-
harbor scuttle
|
|
405
|
-
|
|
407
|
+
EXAMPLES:
|
|
408
|
+
harbor scuttle # Stop default session
|
|
409
|
+
harbor scuttle --name my-app # Stop a specific named session`)
|
|
410
|
+
.option('--name <name>', 'Specify which tmux session to stop (defaults to config sessionName or "harbor")')
|
|
411
|
+
.action(async (options) => {
|
|
406
412
|
try {
|
|
407
413
|
const config = await readHarborConfig();
|
|
408
|
-
const sessionName = config.sessionName || 'harbor';
|
|
414
|
+
const sessionName = options.name || config.sessionName || 'harbor';
|
|
409
415
|
// Check if session exists
|
|
410
416
|
const checkSession = spawn('tmux', ['has-session', '-t', sessionName], {
|
|
411
417
|
stdio: 'pipe',
|
|
@@ -458,12 +464,14 @@ OUTPUT EXAMPLE:
|
|
|
458
464
|
|
|
459
465
|
SAFE TO RUN: Works whether services are running or not.
|
|
460
466
|
|
|
461
|
-
|
|
462
|
-
harbor bearings
|
|
463
|
-
|
|
467
|
+
EXAMPLES:
|
|
468
|
+
harbor bearings # Check default session
|
|
469
|
+
harbor bearings --name my-app # Check a specific named session`)
|
|
470
|
+
.option('--name <name>', 'Specify which tmux session to check (defaults to config sessionName or "harbor")')
|
|
471
|
+
.action(async (options) => {
|
|
464
472
|
try {
|
|
465
473
|
const config = await readHarborConfig();
|
|
466
|
-
const sessionName = config.sessionName || 'harbor';
|
|
474
|
+
const sessionName = options.name || config.sessionName || 'harbor';
|
|
467
475
|
// Check if session exists
|
|
468
476
|
const checkSession = spawn('tmux', ['has-session', '-t', sessionName], {
|
|
469
477
|
stdio: 'pipe',
|
|
@@ -815,6 +823,7 @@ async function runServices(options = {}) {
|
|
|
815
823
|
const env = {
|
|
816
824
|
...process.env,
|
|
817
825
|
HARBOR_DETACH: options.detach ? '1' : '0',
|
|
826
|
+
HARBOR_SESSION_NAME: options.name || '',
|
|
818
827
|
};
|
|
819
828
|
const command = spawn('bash', [scriptPath], {
|
|
820
829
|
stdio: 'inherit', // This will pipe stdin/stdout/stderr to the parent process
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abyrd9/harbor-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "A CLI tool for orchestrating local development services in a tmux session. Perfect for microservices and polyglot projects with automatic service discovery and before/after script support.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/scripts/dev.sh
CHANGED
|
@@ -11,8 +11,8 @@ get_harbor_config() {
|
|
|
11
11
|
fi
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
# Get session name from config or use default
|
|
15
|
-
session_name
|
|
14
|
+
# Get session name from env, config, or use default
|
|
15
|
+
session_name="${HARBOR_SESSION_NAME:-$(get_harbor_config | jq -r '.sessionName // "harbor"')}"
|
|
16
16
|
|
|
17
17
|
# Check if the session already exists and kill it
|
|
18
18
|
if tmux has-session -t "$session_name" 2>/dev/null; then
|