codify-plugin-lib 1.0.182-beta16 → 1.0.182-beta18
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/plugin/plugin.js +0 -2
- package/dist/pty/background-pty.js +4 -20
- package/package.json +1 -1
- package/src/plugin/plugin.ts +0 -4
- package/src/pty/background-pty.ts +3 -24
package/dist/plugin/plugin.js
CHANGED
|
@@ -166,9 +166,7 @@ export class Plugin {
|
|
|
166
166
|
// Default back desired back to current if it is not defined (for destroys only)
|
|
167
167
|
const validationPlan = await ptyLocalStorage.run(new BackgroundPty(), async () => {
|
|
168
168
|
const result = await resource.plan(plan.coreParameters, plan.desiredConfig, plan.desiredConfig ?? plan.currentConfig, plan.isStateful, 'validationPlan');
|
|
169
|
-
process.stdout.write(`Validation plan ${result}`);
|
|
170
169
|
await getPty().kill();
|
|
171
|
-
process.stdout.write('Killed');
|
|
172
170
|
return result;
|
|
173
171
|
});
|
|
174
172
|
if (validationPlan.requiresChanges()) {
|
|
@@ -6,6 +6,7 @@ import * as fs from 'node:fs/promises';
|
|
|
6
6
|
import stripAnsi from 'strip-ansi';
|
|
7
7
|
import { debugLog } from '../utils/debug.js';
|
|
8
8
|
import { Shell, Utils } from '../utils/index.js';
|
|
9
|
+
import { VerbosityLevel } from '../utils/verbosity-level.js';
|
|
9
10
|
import { SpawnError } from './index.js';
|
|
10
11
|
import { PromiseQueue } from './promise-queue.js';
|
|
11
12
|
EventEmitter.defaultMaxListeners = 1000;
|
|
@@ -50,9 +51,7 @@ export class BackgroundPty {
|
|
|
50
51
|
let output = '';
|
|
51
52
|
cat.stdout.on('data', (data) => {
|
|
52
53
|
output += data.toString();
|
|
53
|
-
process.stdout.write(data);
|
|
54
54
|
if (output.includes('%%%done%%%"')) {
|
|
55
|
-
process.stdout.write('Done flag detected');
|
|
56
55
|
const truncOutput = output.replace('%%%done%%%"\n', '');
|
|
57
56
|
const [data, exit] = truncOutput.split('%%%');
|
|
58
57
|
// Clean up trailing \n newline if it exists
|
|
@@ -60,9 +59,6 @@ export class BackgroundPty {
|
|
|
60
59
|
if (strippedData.endsWith('\n')) {
|
|
61
60
|
strippedData = strippedData.slice(0, -1);
|
|
62
61
|
}
|
|
63
|
-
process.stdout.write(`Resolved exit ${exit}`);
|
|
64
|
-
process.stdout.write(`Raw data ${data}`);
|
|
65
|
-
process.stdout.write(`Stripped data ${strippedData}`);
|
|
66
62
|
resolve({
|
|
67
63
|
status: Number.parseInt(exit ?? 1, 10) === 0 ? 'success' : 'error',
|
|
68
64
|
exitCode: Number.parseInt(exit ?? 1, 10),
|
|
@@ -71,9 +67,9 @@ export class BackgroundPty {
|
|
|
71
67
|
}
|
|
72
68
|
else {
|
|
73
69
|
// Print to stdout if the verbosity level is above 0
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
if (VerbosityLevel.get() > 0) {
|
|
71
|
+
process.stdout.write(data);
|
|
72
|
+
}
|
|
77
73
|
}
|
|
78
74
|
});
|
|
79
75
|
this.promiseQueue.run(async () => new Promise((resolve) => {
|
|
@@ -110,18 +106,6 @@ export class BackgroundPty {
|
|
|
110
106
|
await this.promiseQueue.run(async () => {
|
|
111
107
|
let outputBuffer = '';
|
|
112
108
|
return new Promise(resolve => {
|
|
113
|
-
// zsh-specific commands
|
|
114
|
-
// switch (Utils.getShell()) {
|
|
115
|
-
// case Shell.ZSH: {
|
|
116
|
-
// this.basePty.write('setopt HIST_NO_STORE;\n');
|
|
117
|
-
// break;
|
|
118
|
-
// }
|
|
119
|
-
//
|
|
120
|
-
// default: {
|
|
121
|
-
// this.basePty.write('export HISTIGNORE=\'history*\';\n');
|
|
122
|
-
// break;
|
|
123
|
-
// }
|
|
124
|
-
// }
|
|
125
109
|
this.basePty.write(' unset PS1;\n');
|
|
126
110
|
this.basePty.write(' unset PS0;\n');
|
|
127
111
|
this.basePty.write(' echo setup complete\\"\n');
|
package/package.json
CHANGED
package/src/plugin/plugin.ts
CHANGED
|
@@ -10,7 +10,6 @@ import { Shell, Utils } from '../utils/index.js';
|
|
|
10
10
|
import { VerbosityLevel } from '../utils/verbosity-level.js';
|
|
11
11
|
import { IPty, SpawnError, SpawnOptions, SpawnResult } from './index.js';
|
|
12
12
|
import { PromiseQueue } from './promise-queue.js';
|
|
13
|
-
import { str } from 'ajv';
|
|
14
13
|
|
|
15
14
|
EventEmitter.defaultMaxListeners = 1000;
|
|
16
15
|
|
|
@@ -65,10 +64,7 @@ export class BackgroundPty implements IPty {
|
|
|
65
64
|
cat.stdout.on('data', (data) => {
|
|
66
65
|
output += data.toString();
|
|
67
66
|
|
|
68
|
-
process.stdout.write(data);
|
|
69
|
-
|
|
70
67
|
if (output.includes('%%%done%%%"')) {
|
|
71
|
-
process.stdout.write('Done flag detected')
|
|
72
68
|
const truncOutput = output.replace('%%%done%%%"\n', '');
|
|
73
69
|
const [data, exit] = truncOutput.split('%%%');
|
|
74
70
|
|
|
@@ -78,10 +74,6 @@ export class BackgroundPty implements IPty {
|
|
|
78
74
|
strippedData = strippedData.slice(0, -1);
|
|
79
75
|
}
|
|
80
76
|
|
|
81
|
-
process.stdout.write(`Resolved exit ${exit}`);
|
|
82
|
-
process.stdout.write(`Raw data ${data}`);
|
|
83
|
-
process.stdout.write(`Stripped data ${strippedData}`);
|
|
84
|
-
|
|
85
77
|
resolve(<SpawnResult>{
|
|
86
78
|
status: Number.parseInt(exit ?? 1, 10) === 0 ? 'success' : 'error',
|
|
87
79
|
exitCode: Number.parseInt(exit ?? 1, 10),
|
|
@@ -89,9 +81,9 @@ export class BackgroundPty implements IPty {
|
|
|
89
81
|
});
|
|
90
82
|
} else {
|
|
91
83
|
// Print to stdout if the verbosity level is above 0
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
84
|
+
if (VerbosityLevel.get() > 0) {
|
|
85
|
+
process.stdout.write(data);
|
|
86
|
+
}
|
|
95
87
|
}
|
|
96
88
|
})
|
|
97
89
|
|
|
@@ -138,19 +130,6 @@ export class BackgroundPty implements IPty {
|
|
|
138
130
|
let outputBuffer = '';
|
|
139
131
|
|
|
140
132
|
return new Promise(resolve => {
|
|
141
|
-
// zsh-specific commands
|
|
142
|
-
// switch (Utils.getShell()) {
|
|
143
|
-
// case Shell.ZSH: {
|
|
144
|
-
// this.basePty.write('setopt HIST_NO_STORE;\n');
|
|
145
|
-
// break;
|
|
146
|
-
// }
|
|
147
|
-
//
|
|
148
|
-
// default: {
|
|
149
|
-
// this.basePty.write('export HISTIGNORE=\'history*\';\n');
|
|
150
|
-
// break;
|
|
151
|
-
// }
|
|
152
|
-
// }
|
|
153
|
-
|
|
154
133
|
this.basePty.write(' unset PS1;\n');
|
|
155
134
|
this.basePty.write(' unset PS0;\n')
|
|
156
135
|
this.basePty.write(' echo setup complete\\"\n')
|