specsmd 0.1.38 → 0.1.39

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,9 +1,18 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
3
  const { spawnSync } = require('child_process');
4
+ const stringWidthModule = require('string-width');
5
+ const sliceAnsiModule = require('slice-ansi');
4
6
  const { createWatchRuntime } = require('../runtime/watch-runtime');
5
7
  const { createInitialUIState } = require('./store');
6
8
 
9
+ const stringWidth = typeof stringWidthModule === 'function'
10
+ ? stringWidthModule
11
+ : stringWidthModule.default;
12
+ const sliceAnsi = typeof sliceAnsiModule === 'function'
13
+ ? sliceAnsiModule
14
+ : sliceAnsiModule.default;
15
+
7
16
  function toDashboardError(error, defaultCode = 'DASHBOARD_ERROR') {
8
17
  if (!error) {
9
18
  return {
@@ -87,15 +96,26 @@ function resolveIconSet() {
87
96
 
88
97
  function truncate(value, width) {
89
98
  const text = String(value ?? '');
90
- if (!Number.isFinite(width) || width <= 0 || text.length <= width) {
99
+ if (!Number.isFinite(width)) {
100
+ return text;
101
+ }
102
+
103
+ const safeWidth = Math.max(0, Math.floor(width));
104
+ if (safeWidth === 0) {
105
+ return '';
106
+ }
107
+
108
+ if (stringWidth(text) <= safeWidth) {
91
109
  return text;
92
110
  }
93
111
 
94
- if (width <= 3) {
95
- return text.slice(0, width);
112
+ if (safeWidth <= 3) {
113
+ return sliceAnsi(text, 0, safeWidth);
96
114
  }
97
115
 
98
- return `${text.slice(0, width - 3)}...`;
116
+ const ellipsis = '...';
117
+ const bodyWidth = Math.max(0, safeWidth - stringWidth(ellipsis));
118
+ return `${sliceAnsi(text, 0, bodyWidth)}${ellipsis}`;
99
119
  }
100
120
 
101
121
  function normalizePanelLine(line) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specsmd",
3
- "version": "0.1.38",
3
+ "version": "0.1.39",
4
4
  "description": "Multi-agent orchestration system for AI-native software development. Delivers AI-DLC, Agile, and custom SDLC flows as markdown-based agent systems.",
5
5
  "main": "lib/installer.js",
6
6
  "bin": {