newo 2.0.1 → 2.0.2

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,41 @@ 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⚠️ Content differs for skill ${skillIdn} (${fileName}):`);
105
+ // ANSI color codes
106
+ const red = '\x1b[31m';
107
+ const green = '\x1b[32m';
108
+ 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
113
+ 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++;
124
+ }
125
+ }
126
+ if (diffShown === maxDiffLines) {
127
+ console.log(' ... (more differences)');
128
+ }
107
129
  const answer = await new Promise((resolve) => {
108
- rl.question('Overwrite? (y)es/(n)o/(a)ll/(q)uit: ', resolve);
130
+ rl.question(`\nReplace local with remote? (y)es/(n)o/(a)ll/(q)uit: `, resolve);
109
131
  });
110
132
  rl.close();
111
133
  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.2",
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,47 @@ 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⚠️ Content differs for skill ${skillIdn} (${fileName}):`);
158
+
159
+ // ANSI color codes
160
+ const red = '\x1b[31m';
161
+ const green = '\x1b[32m';
162
+ const reset = '\x1b[0m';
163
+
164
+ // Show a GitHub-style colored diff
165
+ const existingLines = existingContent.trim().split('\n');
166
+ const newLines = newContent.trim().split('\n');
167
+
168
+ // Show first few different lines with colors
169
+ 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++;
180
+ }
181
+ }
182
+
183
+ if (diffShown === maxDiffLines) {
184
+ console.log(' ... (more differences)');
185
+ }
160
186
 
161
187
  const answer = await new Promise<string>((resolve) => {
162
- rl.question('Overwrite? (y)es/(n)o/(a)ll/(q)uit: ', resolve);
188
+ rl.question(`\nReplace local with remote? (y)es/(n)o/(a)ll/(q)uit: `, resolve);
163
189
  });
164
190
  rl.close();
165
191