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.
- package/dist/sync/skill-files.js +34 -19
- package/package.json +1 -1
- package/src/sync/skill-files.ts +36 -19
package/dist/sync/skill-files.js
CHANGED
|
@@ -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⚠️
|
|
105
|
-
// ANSI color codes
|
|
106
|
-
const
|
|
107
|
-
const
|
|
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
|
|
111
|
-
const
|
|
112
|
-
//
|
|
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 =
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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
|
-
|
|
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.
|
|
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": {
|
package/src/sync/skill-files.ts
CHANGED
|
@@ -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⚠️
|
|
157
|
+
console.log(`\n⚠️ Local changes will be replaced by remote content for skill ${skillIdn} (${fileName}):`);
|
|
158
158
|
|
|
159
|
-
// ANSI color codes
|
|
160
|
-
const
|
|
161
|
-
const
|
|
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
|
|
166
|
-
const
|
|
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
|
-
//
|
|
169
|
+
// Create a unified diff view
|
|
170
|
+
const maxLines = Math.max(localLines.length, remoteLines.length);
|
|
169
171
|
let diffShown = 0;
|
|
170
|
-
const maxDiffLines =
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
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
|
-
|
|
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) => {
|