newo 2.0.2 → 2.0.3

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.
@@ -101,30 +101,45 @@ export async function askForOverwrite(skillIdn, existingContent, newContent, fil
101
101
  input: process.stdin,
102
102
  output: process.stdout
103
103
  });
104
- console.log(`\n⚠️ Content differs for skill ${skillIdn} (${fileName}):`);
105
- // ANSI color codes
106
- const red = '\x1b[31m';
107
- const green = '\x1b[32m';
104
+ console.log(`\n⚠️ Local changes will be replaced by remote content for skill ${skillIdn} (${fileName}):`);
105
+ // ANSI color codes with background colors
106
+ const redBg = '\x1b[41m\x1b[37m'; // Red background, white text
107
+ const greenBg = '\x1b[42m\x1b[30m'; // Green background, black text
108
+ const gray = '\x1b[90m';
108
109
  const reset = '\x1b[0m';
109
- // Show a GitHub-style colored diff
110
- const existingLines = existingContent.trim().split('\n');
111
- const newLines = newContent.trim().split('\n');
112
- // Show first few different lines with colors
110
+ // Show a GitHub-style colored diff with line numbers
111
+ const localLines = existingContent.trim().split('\n');
112
+ const remoteLines = newContent.trim().split('\n');
113
+ // Create a unified diff view
114
+ const maxLines = Math.max(localLines.length, remoteLines.length);
113
115
  let diffShown = 0;
114
- const maxDiffLines = 5;
115
- for (let i = 0; i < Math.max(existingLines.length, newLines.length) && diffShown < maxDiffLines; i++) {
116
- const existingLine = existingLines[i] || '';
117
- const newLine = newLines[i] || '';
118
- if (existingLine !== newLine) {
119
- if (existingLine)
120
- console.log(`${red}-${existingLine}${reset}`);
121
- if (newLine)
122
- console.log(`${green}+${newLine}${reset}`);
123
- diffShown++;
116
+ const maxDiffLines = 10;
117
+ console.log(`${gray} Local (-) vs Remote (+):${reset}`);
118
+ for (let i = 0; i < maxLines && diffShown < maxDiffLines; i++) {
119
+ const localLine = localLines[i];
120
+ const remoteLine = remoteLines[i];
121
+ const lineNum = String(i + 1).padStart(3);
122
+ // Show context line if both exist and are the same
123
+ if (localLine !== undefined && remoteLine !== undefined && localLine === remoteLine) {
124
+ console.log(`${gray} ${lineNum} ${localLine}${reset}`);
125
+ }
126
+ else {
127
+ // Show differences
128
+ if (localLine !== undefined) {
129
+ console.log(`${redBg} - ${lineNum} ${localLine} ${reset}`);
130
+ diffShown++;
131
+ }
132
+ if (remoteLine !== undefined) {
133
+ console.log(`${greenBg} + ${lineNum} ${remoteLine} ${reset}`);
134
+ diffShown++;
135
+ }
124
136
  }
125
137
  }
126
138
  if (diffShown === maxDiffLines) {
127
- console.log(' ... (more differences)');
139
+ const remainingDiffs = Math.abs(localLines.length - remoteLines.length);
140
+ if (remainingDiffs > 0) {
141
+ console.log(`${gray} ... (${remainingDiffs} more line differences)${reset}`);
142
+ }
128
143
  }
129
144
  const answer = await new Promise((resolve) => {
130
145
  rl.question(`\nReplace local with remote? (y)es/(n)o/(a)ll/(q)uit: `, resolve);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newo",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "NEWO CLI: Professional command-line tool with modular architecture for NEWO AI Agent development. Features IDN-based file management, real-time progress tracking, intelligent sync operations, and comprehensive multi-customer support.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -154,34 +154,51 @@ export async function askForOverwrite(skillIdn: string, existingContent: string,
154
154
  output: process.stdout
155
155
  });
156
156
 
157
- console.log(`\n⚠️ Content differs for skill ${skillIdn} (${fileName}):`);
157
+ console.log(`\n⚠️ Local changes will be replaced by remote content for skill ${skillIdn} (${fileName}):`);
158
158
 
159
- // ANSI color codes
160
- const red = '\x1b[31m';
161
- const green = '\x1b[32m';
159
+ // ANSI color codes with background colors
160
+ const redBg = '\x1b[41m\x1b[37m'; // Red background, white text
161
+ const greenBg = '\x1b[42m\x1b[30m'; // Green background, black text
162
+ const gray = '\x1b[90m';
162
163
  const reset = '\x1b[0m';
163
164
 
164
- // Show a GitHub-style colored diff
165
- const existingLines = existingContent.trim().split('\n');
166
- const newLines = newContent.trim().split('\n');
165
+ // Show a GitHub-style colored diff with line numbers
166
+ const localLines = existingContent.trim().split('\n');
167
+ const remoteLines = newContent.trim().split('\n');
167
168
 
168
- // Show first few different lines with colors
169
+ // Create a unified diff view
170
+ const maxLines = Math.max(localLines.length, remoteLines.length);
169
171
  let diffShown = 0;
170
- const maxDiffLines = 5;
171
-
172
- for (let i = 0; i < Math.max(existingLines.length, newLines.length) && diffShown < maxDiffLines; i++) {
173
- const existingLine = existingLines[i] || '';
174
- const newLine = newLines[i] || '';
175
-
176
- if (existingLine !== newLine) {
177
- if (existingLine) console.log(`${red}-${existingLine}${reset}`);
178
- if (newLine) console.log(`${green}+${newLine}${reset}`);
179
- diffShown++;
172
+ const maxDiffLines = 10;
173
+
174
+ console.log(`${gray} Local (-) vs Remote (+):${reset}`);
175
+
176
+ for (let i = 0; i < maxLines && diffShown < maxDiffLines; i++) {
177
+ const localLine = localLines[i];
178
+ const remoteLine = remoteLines[i];
179
+ const lineNum = String(i + 1).padStart(3);
180
+
181
+ // Show context line if both exist and are the same
182
+ if (localLine !== undefined && remoteLine !== undefined && localLine === remoteLine) {
183
+ console.log(`${gray} ${lineNum} ${localLine}${reset}`);
184
+ } else {
185
+ // Show differences
186
+ if (localLine !== undefined) {
187
+ console.log(`${redBg} - ${lineNum} ${localLine} ${reset}`);
188
+ diffShown++;
189
+ }
190
+ if (remoteLine !== undefined) {
191
+ console.log(`${greenBg} + ${lineNum} ${remoteLine} ${reset}`);
192
+ diffShown++;
193
+ }
180
194
  }
181
195
  }
182
196
 
183
197
  if (diffShown === maxDiffLines) {
184
- console.log(' ... (more differences)');
198
+ const remainingDiffs = Math.abs(localLines.length - remoteLines.length);
199
+ if (remainingDiffs > 0) {
200
+ console.log(`${gray} ... (${remainingDiffs} more line differences)${reset}`);
201
+ }
185
202
  }
186
203
 
187
204
  const answer = await new Promise<string>((resolve) => {