@eliware/vyops 1.0.7 → 1.0.8

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/RELEASE_NOTES.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Release Notes
2
2
 
3
+ ## 1.0.8
4
+
5
+ - Fail immediately with a redacted VyOS error when confirmed commits reject a
6
+ configuration after the confirmation prompt.
7
+ - Prevent malformed PKI and other validation failures from appearing to hang
8
+ at the commit-confirm step.
9
+ - Add regression coverage for post-prompt validation errors and structured
10
+ failures without detail text.
11
+
12
+ Verification:
13
+
14
+ - `npm test` (100% coverage across statements, branches, functions, and lines)
15
+ - `npm run lint`
16
+ - `npm run audit`
17
+
3
18
  ## 1.0.7
4
19
 
5
20
  - Add password-based SSH bootstrap through the secure `--password-stdin` mode.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eliware/vyops",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Deploy native VyOS configuration files over SSH.",
5
5
  "main": "vyops.mjs",
6
6
  "scripts": {
package/src/ssh.mjs CHANGED
@@ -167,6 +167,12 @@ export function interactive(client, commands, log = () => {}) {
167
167
  const ansi = new RegExp(`${String.fromCharCode(27)}\\[[0-9;?]*[ -/]*[@-~]`, 'g');
168
168
  const title = new RegExp(`${String.fromCharCode(27)}\\][^${String.fromCharCode(7)}]*(?:${String.fromCharCode(7)}|${String.fromCharCode(27)}\\\\)`, 'g');
169
169
  const clean = value => value.replace(ansi, '').replace(title, '').replace(/\r/g, '');
170
+ const failureDetail = value => value.split('\n')
171
+ .map(line => line.trim())
172
+ .find(line => /(?:failed|failure|invalid|error|aborted|pending)/i.test(line))
173
+ ?.replace(/(certificate|private key|key)\s+"[^"]+"/ig, '$1 "[redacted]"')
174
+ .replace(/\s+/g, ' ')
175
+ .slice(0, 240);
170
176
  const prompt = value => /(?:^|\n)[A-Za-z0-9._-]+@[A-Za-z0-9._:-]+(?::~\$|#)\s*$/.test(value);
171
177
  const sendNext = () => {
172
178
  if (waiting || index >= commands.length) return;
@@ -190,7 +196,8 @@ export function interactive(client, commands, log = () => {}) {
190
196
  settled = true;
191
197
  clearTimeout(timer);
192
198
  stream.close();
193
- reject(new Error(`interactive command failed: ${currentItem.command}`));
199
+ const detail = failureDetail(cleaned);
200
+ reject(new Error(`interactive command failed: ${currentItem.command}${detail ? ` (${detail})` : ''}`));
194
201
  return;
195
202
  }
196
203
  const pagerReturn = /No next tag\s*\(press RETURN\)/i.test(cleaned);