@polka-codes/cli-shared 0.10.29 → 0.10.30
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/index.js +11 -5
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -502,6 +502,12 @@ var InMemoryStore = class {
|
|
|
502
502
|
this.#data = data;
|
|
503
503
|
}
|
|
504
504
|
};
|
|
505
|
+
function notifyCommandObserver(callback, value) {
|
|
506
|
+
try {
|
|
507
|
+
callback?.(value);
|
|
508
|
+
} catch {
|
|
509
|
+
}
|
|
510
|
+
}
|
|
505
511
|
function isIMemoryStore(store) {
|
|
506
512
|
return "readMemory" in store && "updateMemory" in store;
|
|
507
513
|
}
|
|
@@ -723,7 +729,7 @@ ${content}`;
|
|
|
723
729
|
},
|
|
724
730
|
executeCommand: (command, _needApprove) => {
|
|
725
731
|
return new Promise((resolve5, reject) => {
|
|
726
|
-
options.command?.onStarted
|
|
732
|
+
notifyCommandObserver(options.command?.onStarted, command);
|
|
727
733
|
const child = spawn2(command, [], {
|
|
728
734
|
shell: true,
|
|
729
735
|
stdio: "pipe"
|
|
@@ -732,16 +738,16 @@ ${content}`;
|
|
|
732
738
|
let stderrText = "";
|
|
733
739
|
child.stdout.on("data", (data) => {
|
|
734
740
|
const dataStr = data.toString();
|
|
735
|
-
options.command?.onStdout
|
|
741
|
+
notifyCommandObserver(options.command?.onStdout, dataStr);
|
|
736
742
|
stdoutText += dataStr;
|
|
737
743
|
});
|
|
738
744
|
child.stderr.on("data", (data) => {
|
|
739
745
|
const dataStr = data.toString();
|
|
740
|
-
options.command?.onStderr
|
|
746
|
+
notifyCommandObserver(options.command?.onStderr, dataStr);
|
|
741
747
|
stderrText += dataStr;
|
|
742
748
|
});
|
|
743
749
|
child.on("close", async (code) => {
|
|
744
|
-
options.command?.onExit
|
|
750
|
+
notifyCommandObserver(options.command?.onExit, code ?? 0);
|
|
745
751
|
const totalLength = stdoutText.length + stderrText.length;
|
|
746
752
|
if (totalLength > (options.summaryThreshold ?? 5e3) && options.summarizeOutput) {
|
|
747
753
|
try {
|
|
@@ -766,7 +772,7 @@ ${content}`;
|
|
|
766
772
|
});
|
|
767
773
|
});
|
|
768
774
|
child.on("error", (err) => {
|
|
769
|
-
options.command?.onError
|
|
775
|
+
notifyCommandObserver(options.command?.onError, err);
|
|
770
776
|
reject(err);
|
|
771
777
|
});
|
|
772
778
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polka-codes/cli-shared",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.30",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"author": "github@polka.codes",
|
|
6
6
|
"repository": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@ai-sdk/provider": "^3.0.9",
|
|
31
31
|
"@ai-sdk/provider-utils": "^4.0.24",
|
|
32
32
|
"@inquirer/prompts": "^8.4.2",
|
|
33
|
-
"@polka-codes/core": "^0.10.
|
|
33
|
+
"@polka-codes/core": "^0.10.30",
|
|
34
34
|
"ai": "^6.0.170",
|
|
35
35
|
"chalk": "^5.6.2",
|
|
36
36
|
"ignore": "^7.0.5",
|