singleton-pipeline 0.4.0-beta.1 → 0.4.0-beta.13

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.
@@ -1,5 +1,5 @@
1
1
  import blessed from 'blessed';
2
- import { C } from './shell.js';
2
+ import { S } from './shell.js';
3
3
 
4
4
  const FRAMES = ['⣾', '⣽', '⣻', '⢿', '⡿', '⣟', '⣯', '⣷'];
5
5
 
@@ -13,10 +13,10 @@ export function createTimeline(stepNames, widgets = null) {
13
13
  let spinnerInterval = null;
14
14
  let spinnerFrame = 0;
15
15
 
16
- let screen, logPanel, statusBox, ownScreen = false;
16
+ let screen, logPanel, statusBox, setLabel = null, mirror = null, ownScreen = false;
17
17
 
18
18
  if (widgets) {
19
- ({ screen, logPanel, statusBox } = widgets);
19
+ ({ screen, logPanel, statusBox, setLabel = null, mirror = null } = widgets);
20
20
  } else {
21
21
  ownScreen = true;
22
22
  screen = blessed.screen({ smartCSR: true, title: 'Singleton' });
@@ -34,7 +34,7 @@ export function createTimeline(stepNames, widgets = null) {
34
34
  orientation: 'horizontal',
35
35
  bottom: 5, left: 0,
36
36
  width: '100%',
37
- style: { fg: C.line }
37
+ style: { fg: S.border }
38
38
  });
39
39
 
40
40
  statusBox = blessed.box({
@@ -52,19 +52,19 @@ export function createTimeline(stepNames, widgets = null) {
52
52
  }
53
53
 
54
54
  function dot(status, frame = 0) {
55
- if (status === 'done') return `{${C.mint}-fg}●{/}`;
56
- if (status === 'running') return `{#FFFFFF-fg}${FRAMES[frame % FRAMES.length]}{/}`;
57
- if (status === 'paused') return `{${C.peach}-fg}●{/}`;
58
- if (status === 'error') return `{${C.salmon}-fg}●{/}`;
59
- return `{${C.ghost}-fg}○{/}`;
55
+ if (status === 'done') return `{${S.success}-fg}●{/}`;
56
+ if (status === 'running') return `{${S.text}-fg}${FRAMES[frame % FRAMES.length]}{/}`;
57
+ if (status === 'paused') return `{${S.warning}-fg}●{/}`;
58
+ if (status === 'error') return `{${S.error}-fg}●{/}`;
59
+ return `{${S.subtle}-fg}○{/}`;
60
60
  }
61
61
 
62
62
  function shimmerName(text, frame = 0) {
63
63
  const peak = frame % (text.length + 6);
64
64
  return text.split('').map((ch, i) => {
65
65
  const dist = Math.abs(i - peak);
66
- let color = C.violet;
67
- if (dist === 0) color = '#FFFFFF';
66
+ let color = S.accent;
67
+ if (dist === 0) color = S.text;
68
68
  else if (dist === 1) color = '#EDD9FF';
69
69
  else if (dist === 2) color = '#D4B0FE';
70
70
  return ch === ' ' ? ch : `{${color}-fg}{bold}${ch}{/}`;
@@ -72,23 +72,23 @@ export function createTimeline(stepNames, widgets = null) {
72
72
  }
73
73
 
74
74
  function compactDots(frame = 0) {
75
- return stepNames.map((_name, i) => dot(statuses[i], frame)).join(` {${C.ghost}-fg}─{/} `);
75
+ return stepNames.map((_name, i) => dot(statuses[i], frame)).join(` {${S.subtle}-fg}─{/} `);
76
76
  }
77
77
 
78
78
  function renderTimeline(frame = 0) {
79
79
  const currentMeta = runningIdx >= 0 && meta[runningIdx]
80
- ? ` {${C.ghost}-fg}${meta[runningIdx]}{/}`
80
+ ? ` {${S.muted}-fg}${meta[runningIdx]}{/}`
81
81
  : '';
82
82
  const isPaused = runningIdx >= 0 && statuses[runningIdx] === 'paused';
83
83
  const activityLabel = isPaused
84
- ? `{${C.peach}-fg}{bold}Paused{/}`
84
+ ? `{${S.warning}-fg}{bold}Paused{/}`
85
85
  : `{bold}Running{/}`;
86
86
  const activityIcon = isPaused
87
- ? `{${C.peach}-fg}●{/}`
88
- : `{#FFFFFF-fg}${FRAMES[frame % FRAMES.length]}{/}`;
87
+ ? `{${S.warning}-fg}●{/}`
88
+ : `{${S.text}-fg}${FRAMES[frame % FRAMES.length]}{/}`;
89
89
  const runningLabel = runningIdx >= 0
90
- ? `${activityLabel} ${activityIcon} ${shimmerName(stepNames[runningIdx], frame)} {${C.ghost}-fg}step ${runningIdx + 1}/${N}{/}${currentMeta}`
91
- : `{bold}Running:{/} {${C.dimV}-fg}idle{/}`;
90
+ ? `${activityLabel} ${activityIcon} ${shimmerName(stepNames[runningIdx], frame)}${currentMeta}`
91
+ : `{bold}Running:{/} {${S.muted}-fg}idle{/}`;
92
92
  const statusLines = [
93
93
  '',
94
94
  runningLabel,
@@ -96,14 +96,48 @@ export function createTimeline(stepNames, widgets = null) {
96
96
  compactDots(frame)
97
97
  ];
98
98
  statusBox.setContent(statusLines.join('\n'));
99
+ if (setLabel) {
100
+ if (runningIdx < 0) {
101
+ setLabel('');
102
+ } else if (runningIdx === 0) {
103
+ // Index 0 is always the preflight pseudo-step — it's not a "real" pipeline step,
104
+ // so show "preflight" rather than fold it into the X/N count.
105
+ const labelText = isPaused ? 'preflight — paused' : 'preflight';
106
+ setLabel(`{${S.text}-fg}{bold}${labelText}{/}`);
107
+ } else {
108
+ // Real steps: 1..(N-1). Subtract 1 from N to exclude preflight from the total.
109
+ const labelText = isPaused
110
+ ? `step ${runningIdx}/${N - 1} — paused`
111
+ : `step ${runningIdx}/${N - 1}`;
112
+ setLabel(`{${S.text}-fg}{bold}${labelText}{/}`);
113
+ }
114
+ }
99
115
  screen.render();
100
116
  }
101
117
 
102
118
  renderTimeline();
103
119
 
104
120
  return {
105
- log(text) { logPanel.log(`{${C.blue}-fg}${text}{/}`); screen.render(); },
106
- logMuted(text) { logPanel.log(`{${C.dimV}-fg}${text}{/}`); screen.render(); },
121
+ log(text) { const s = `{${S.keyword}-fg}${text}{/}`; logPanel.log(s); mirror?.(s); screen.render(); },
122
+ logMuted(text) { const s = `{${S.muted}-fg}${text}{/}`; logPanel.log(s); mirror?.(s); screen.render(); },
123
+ logSuccess(text) { const s = `{${S.success}-fg}${text}{/}`; logPanel.log(s); mirror?.(s); screen.render(); },
124
+ logError(text) { const s = `{${S.error}-fg}${text}{/}`; logPanel.log(s); mirror?.(s); screen.render(); },
125
+ logDiffLine(raw) {
126
+ const text = String(raw ?? '');
127
+ const body = text.replace(/^\s+/, '');
128
+ // Default to S.subtle for all non-signal lines (meta git, context, untracked previews) —
129
+ // one consistent gray instead of two slightly different ones. Check git meta starts before
130
+ // +/- because +++ and --- would otherwise match the body coloring.
131
+ let color = S.muted;
132
+ if (/^(diff --git|index |--- |\+\+\+ )/.test(body)) color = S.muted;
133
+ else if (body.startsWith('@@')) color = S.keyword;
134
+ else if (body.startsWith('+')) color = S.success;
135
+ else if (body.startsWith('-')) color = S.error;
136
+ const s = `{${color}-fg}${text}{/}`;
137
+ logPanel.log(s);
138
+ mirror?.(s);
139
+ screen.render();
140
+ },
107
141
 
108
142
  setRunning(i, info = '') {
109
143
  if (spinnerInterval) { clearInterval(spinnerInterval); spinnerInterval = null; }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singleton/server",
3
- "version": "0.4.0-beta.1",
3
+ "version": "0.4.0-beta.12",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "dependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singleton/web",
3
- "version": "0.4.0-beta.1",
3
+ "version": "0.4.0-beta.12",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {