newo 2.0.1 → 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.
@@ -203,7 +203,7 @@ export async function pullSingleProject(client, customer, projectId, verbose = f
203
203
  else if (!globalOverwriteAll) {
204
204
  // Content is different, ask for overwrite unless global override is set
205
205
  const existingFile = existingFiles[0];
206
- const overwriteChoice = await askForOverwrite(skill.idn, existingFile.fileName, `${skill.idn}.${getExtensionForRunner(skill.runner_type)}`);
206
+ const overwriteChoice = await askForOverwrite(skill.idn, existingFile.content, scriptContent, existingFile.fileName);
207
207
  if (overwriteChoice === 'quit') {
208
208
  console.log('❌ Pull operation cancelled by user');
209
209
  process.exit(0);
@@ -37,7 +37,7 @@ export declare function getSingleSkillFile(customerIdn: string, projectIdn: stri
37
37
  export declare function isContentDifferent(existingContent: string, newContent: string): boolean;
38
38
  export type OverwriteChoice = 'yes' | 'no' | 'all' | 'quit';
39
39
  /**
40
- * Interactive overwrite confirmation
40
+ * Interactive overwrite confirmation with content diff
41
41
  */
42
- export declare function askForOverwrite(skillIdn: string, existingFile: string, newFile: string): Promise<OverwriteChoice>;
42
+ export declare function askForOverwrite(skillIdn: string, existingContent: string, newContent: string, fileName: string): Promise<OverwriteChoice>;
43
43
  //# sourceMappingURL=skill-files.d.ts.map
@@ -93,19 +93,56 @@ export function isContentDifferent(existingContent, newContent) {
93
93
  return sha256(existingContent.trim()) !== sha256(newContent.trim());
94
94
  }
95
95
  /**
96
- * Interactive overwrite confirmation
96
+ * Interactive overwrite confirmation with content diff
97
97
  */
98
- export async function askForOverwrite(skillIdn, existingFile, newFile) {
98
+ export async function askForOverwrite(skillIdn, existingContent, newContent, fileName) {
99
99
  const readline = await import('readline');
100
100
  const rl = readline.createInterface({
101
101
  input: process.stdin,
102
102
  output: process.stdout
103
103
  });
104
- console.log(`\n⚠️ File exists for skill ${skillIdn}:`);
105
- console.log(` Existing: ${existingFile}`);
106
- console.log(` New: ${newFile}`);
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';
109
+ const reset = '\x1b[0m';
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);
115
+ let diffShown = 0;
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
+ }
136
+ }
137
+ }
138
+ if (diffShown === maxDiffLines) {
139
+ const remainingDiffs = Math.abs(localLines.length - remoteLines.length);
140
+ if (remainingDiffs > 0) {
141
+ console.log(`${gray} ... (${remainingDiffs} more line differences)${reset}`);
142
+ }
143
+ }
107
144
  const answer = await new Promise((resolve) => {
108
- rl.question('Overwrite? (y)es/(n)o/(a)ll/(q)uit: ', resolve);
145
+ rl.question(`\nReplace local with remote? (y)es/(n)o/(a)ll/(q)uit: `, resolve);
109
146
  });
110
147
  rl.close();
111
148
  const choice = answer.toLowerCase().trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newo",
3
- "version": "2.0.1",
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": {
@@ -270,8 +270,9 @@ export async function pullSingleProject(
270
270
  const existingFile = existingFiles[0]!;
271
271
  const overwriteChoice: OverwriteChoice = await askForOverwrite(
272
272
  skill.idn,
273
- existingFile.fileName,
274
- `${skill.idn}.${getExtensionForRunner(skill.runner_type)}`
273
+ existingFile.content,
274
+ scriptContent,
275
+ existingFile.fileName
275
276
  );
276
277
 
277
278
  if (overwriteChoice === 'quit') {
@@ -145,21 +145,64 @@ export function isContentDifferent(existingContent: string, newContent: string):
145
145
  export type OverwriteChoice = 'yes' | 'no' | 'all' | 'quit';
146
146
 
147
147
  /**
148
- * Interactive overwrite confirmation
148
+ * Interactive overwrite confirmation with content diff
149
149
  */
150
- export async function askForOverwrite(skillIdn: string, existingFile: string, newFile: string): Promise<OverwriteChoice> {
150
+ export async function askForOverwrite(skillIdn: string, existingContent: string, newContent: string, fileName: string): Promise<OverwriteChoice> {
151
151
  const readline = await import('readline');
152
152
  const rl = readline.createInterface({
153
153
  input: process.stdin,
154
154
  output: process.stdout
155
155
  });
156
156
 
157
- console.log(`\n⚠️ File exists for skill ${skillIdn}:`);
158
- console.log(` Existing: ${existingFile}`);
159
- console.log(` New: ${newFile}`);
157
+ console.log(`\n⚠️ Local changes will be replaced by remote content for skill ${skillIdn} (${fileName}):`);
158
+
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';
163
+ const reset = '\x1b[0m';
164
+
165
+ // Show a GitHub-style colored diff with line numbers
166
+ const localLines = existingContent.trim().split('\n');
167
+ const remoteLines = newContent.trim().split('\n');
168
+
169
+ // Create a unified diff view
170
+ const maxLines = Math.max(localLines.length, remoteLines.length);
171
+ let diffShown = 0;
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
+ }
194
+ }
195
+ }
196
+
197
+ if (diffShown === maxDiffLines) {
198
+ const remainingDiffs = Math.abs(localLines.length - remoteLines.length);
199
+ if (remainingDiffs > 0) {
200
+ console.log(`${gray} ... (${remainingDiffs} more line differences)${reset}`);
201
+ }
202
+ }
160
203
 
161
204
  const answer = await new Promise<string>((resolve) => {
162
- rl.question('Overwrite? (y)es/(n)o/(a)ll/(q)uit: ', resolve);
205
+ rl.question(`\nReplace local with remote? (y)es/(n)o/(a)ll/(q)uit: `, resolve);
163
206
  });
164
207
  rl.close();
165
208