start-command 0.20.2 → 0.20.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,62 @@
1
1
  # start-command
2
2
 
3
+ ## 0.20.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 688f1f5: fix: Add empty line before result marker for visual continuity
8
+ - Added empty line before result marker (✓/✗) after command output
9
+ - Ensures consistent visual formatting: command → empty line → output → empty line → result marker
10
+ - Applied to both docker pull virtual commands and user commands
11
+ - Tests document the expected visual format
12
+
13
+ Expected format:
14
+
15
+ ```
16
+
17
+ $ docker pull alpine:latest
18
+
19
+ latest: Pulling from library/alpine
20
+ ...
21
+
22
+
23
+
24
+ $ echo hi
25
+
26
+ hi
27
+
28
+
29
+ ```
30
+
31
+ Fixes #73
32
+
33
+ ## 0.20.3
34
+
35
+ ### Patch Changes
36
+
37
+ - 3598f38: Fix visual continuity in docker isolation mode (#73)
38
+
39
+ The empty line is now properly placed after the command line (e.g., `$ docker pull alpine:latest`)
40
+ instead of before it, maintaining consistent visual structure in the timeline output.
41
+
42
+ Before:
43
+
44
+ ```
45
+
46
+
47
+ $ docker pull alpine:latest
48
+ latest: Pulling from library/alpine
49
+ ```
50
+
51
+ After:
52
+
53
+ ```
54
+
55
+ $ docker pull alpine:latest
56
+
57
+ latest: Pulling from library/alpine
58
+ ```
59
+
3
60
  ## 0.20.2
4
61
 
5
62
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "start-command",
3
- "version": "0.20.2",
3
+ "version": "0.20.4",
4
4
  "description": "Gamification of coding, execute any command with ability to auto-report issues on GitHub",
5
5
  "main": "src/bin/cli.js",
6
6
  "exports": {
package/src/bin/cli.js CHANGED
@@ -523,7 +523,10 @@ async function runWithIsolation(
523
523
  deferCommand,
524
524
  })
525
525
  );
526
- console.log('');
526
+ // Only print empty line when not deferring command (docker isolation handles its own spacing)
527
+ if (!deferCommand) {
528
+ console.log('');
529
+ }
527
530
 
528
531
  // Save initial execution record and set global reference for signal cleanup
529
532
  if (executionRecord && store) {
@@ -115,8 +115,9 @@ function dockerPullImage(image) {
115
115
  createTimelineSeparator,
116
116
  } = require('./output-blocks');
117
117
 
118
- // Print the virtual command line
118
+ // Print the virtual command line followed by empty line for visual separation
119
119
  console.log(createVirtualCommandBlock(`docker pull ${image}`));
120
+ console.log();
120
121
 
121
122
  let output = '';
122
123
  let success = false;
@@ -141,7 +142,8 @@ function dockerPullImage(image) {
141
142
  success = false;
142
143
  }
143
144
 
144
- // Print result marker and separator
145
+ // Print empty line before result marker for visual separation (issue #73)
146
+ // This ensures output is visually separated from the result marker
145
147
  console.log();
146
148
  console.log(createVirtualCommandResult(success));
147
149
  console.log(createTimelineSeparator());
@@ -458,6 +458,116 @@ describe('output-blocks module', () => {
458
458
  });
459
459
  expect(block).not.toContain('$ echo hello');
460
460
  });
461
+
462
+ it('should end with empty timeline line when deferCommand is true (issue #73)', () => {
463
+ // Issue #73: Visual continuity - when deferCommand is true,
464
+ // the start block should end with │ (empty timeline line)
465
+ // and no trailing empty line should be added by the CLI
466
+ const block = createStartBlock({
467
+ sessionId: 'test-uuid',
468
+ timestamp: '2025-01-01 00:00:00',
469
+ command: 'echo hello',
470
+ extraLines: [
471
+ '[Isolation] Environment: docker, Mode: attached',
472
+ '[Isolation] Image: alpine:latest',
473
+ '[Isolation] Session: docker-container-123',
474
+ ],
475
+ deferCommand: true,
476
+ });
477
+ const lines = block.split('\n');
478
+ // Last line should be empty timeline line (│)
479
+ expect(lines[lines.length - 1]).toBe('│');
480
+ // Should not contain the command
481
+ expect(block).not.toContain('$ echo hello');
482
+ });
483
+ });
484
+
485
+ describe('Visual Continuity (issue #73)', () => {
486
+ it('virtual command block should be followed by empty line for visual separation', () => {
487
+ // Issue #73: The empty line should come AFTER the command
488
+ // ($ docker pull ...), not BEFORE it
489
+ // This test verifies the expected format: command line followed by
490
+ // empty line before output
491
+ const virtualCommand = createVirtualCommandBlock(
492
+ 'docker pull alpine:latest'
493
+ );
494
+ expect(virtualCommand).toBe('$ docker pull alpine:latest');
495
+ // The empty line is added by the caller (dockerPullImage)
496
+ // after the command and before running docker pull
497
+ });
498
+
499
+ it('timeline separator should be empty timeline line for visual structure', () => {
500
+ // After virtual command output, we print result marker and separator
501
+ const separator = createTimelineSeparator();
502
+ expect(separator).toBe('│');
503
+ });
504
+
505
+ it('start block with docker isolation should end cleanly for virtual commands', () => {
506
+ // When using docker isolation with defer_command, the block ends with │
507
+ // The virtual command (docker pull) starts immediately after
508
+ const block = createStartBlock({
509
+ sessionId: 'uuid-abc',
510
+ timestamp: '2026-01-08 12:00:00',
511
+ command: 'echo hi',
512
+ extraLines: [
513
+ '[Isolation] Environment: docker, Mode: attached',
514
+ '[Isolation] Image: alpine:latest',
515
+ '[Isolation] Session: docker-1234',
516
+ ],
517
+ deferCommand: true,
518
+ });
519
+
520
+ // Expected structure:
521
+ // │ session uuid-abc
522
+ // │ start 2026-01-08 12:00:00
523
+ // │
524
+ // │ isolation docker
525
+ // │ mode attached
526
+ // │ image alpine:latest
527
+ // │ container docker-1234
528
+ // │ <-- ends here with empty timeline line
529
+ const lines = block.split('\n');
530
+ expect(lines[lines.length - 1]).toBe('│');
531
+
532
+ // Next should be virtual command (added separately by docker-utils):
533
+ // $ docker pull alpine:latest
534
+ // <empty line>
535
+ // <docker output>
536
+ // <empty line>
537
+ // ✓
538
+ // │
539
+ // $ echo hi
540
+ // <empty line>
541
+ // hi
542
+ // <empty line>
543
+ // ✓
544
+ });
545
+
546
+ it('output formatting follows visual continuity pattern', () => {
547
+ // Issue #73: All commands should have consistent formatting:
548
+ // 1. Command line ($ ...)
549
+ // 2. Empty line (visual separation)
550
+ // 3. Command output
551
+ // 4. Empty line (visual separation)
552
+ // 5. Result marker (✓ or ✗)
553
+ //
554
+ // This test documents the expected output structure that
555
+ // dockerPullImage and runInDocker should produce.
556
+
557
+ // Verify createCommandLine produces the correct format
558
+ const commandLine = createCommandLine('docker pull alpine:latest');
559
+ expect(commandLine).toBe('$ docker pull alpine:latest');
560
+
561
+ // Verify createVirtualCommandBlock matches
562
+ const virtualCommandLine = createVirtualCommandBlock(
563
+ 'docker pull alpine:latest'
564
+ );
565
+ expect(virtualCommandLine).toBe(commandLine);
566
+
567
+ // Verify result markers
568
+ expect(createVirtualCommandResult(true)).toBe('✓');
569
+ expect(createVirtualCommandResult(false)).toBe('✗');
570
+ });
461
571
  });
462
572
  });
463
573