javi-forge 1.38.5 → 1.38.6

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.
@@ -17,7 +17,9 @@ export declare function runPluginList(onStep: StepCallback): Promise<void>;
17
17
  /**
18
18
  * Search the remote plugin registry.
19
19
  */
20
- export declare function runPluginSearch(query: string | undefined, onStep: StepCallback): Promise<void>;
20
+ export declare function runPluginSearch(query: string | undefined, onStep: StepCallback, options?: {
21
+ signal?: AbortSignal;
22
+ }): Promise<void>;
21
23
  /**
22
24
  * Validate a local plugin directory.
23
25
  */
@@ -58,10 +58,10 @@ export async function runPluginList(onStep) {
58
58
  /**
59
59
  * Search the remote plugin registry.
60
60
  */
61
- export async function runPluginSearch(query, onStep) {
61
+ export async function runPluginSearch(query, onStep, options = {}) {
62
62
  const stepId = "plugin-search";
63
63
  report(onStep, stepId, `Search plugins${query ? `: ${query}` : ""}`, "running");
64
- const results = await searchRegistry(query);
64
+ const results = await searchRegistry(query, options);
65
65
  if (results.status === "cancelled") {
66
66
  report(onStep, stepId, `Search plugins${query ? `: ${query}` : ""}`, "error", "registry search cancelled");
67
67
  }
package/dist/ui/Plugin.js CHANGED
@@ -19,6 +19,15 @@ const STATUS_COLOR = {
19
19
  export default function Plugin({ action, target, dryRun, codex = false, force = false, }) {
20
20
  const [steps, setSteps] = useState([]);
21
21
  const [done, setDone] = useState(false);
22
+ const handleTerminalSignal = (signal, signalController) => {
23
+ if (signalController.signal.aborted)
24
+ return;
25
+ signalController.abort();
26
+ if (signal === "SIGINT")
27
+ process.exitCode = 130;
28
+ if (signal === "SIGTERM")
29
+ process.exitCode = 143;
30
+ };
22
31
  const onStep = (step) => {
23
32
  setSteps((prev) => {
24
33
  const idx = prev.findIndex((s) => s.id === step.id);
@@ -31,6 +40,17 @@ export default function Plugin({ action, target, dryRun, codex = false, force =
31
40
  });
32
41
  };
33
42
  useEffect(() => {
43
+ const controller = action === "search" ? new AbortController() : undefined;
44
+ const sigintHandler = controller === undefined
45
+ ? undefined
46
+ : () => handleTerminalSignal("SIGINT", controller);
47
+ const sigtermHandler = controller === undefined
48
+ ? undefined
49
+ : () => handleTerminalSignal("SIGTERM", controller);
50
+ if (action === "search" && sigintHandler && sigtermHandler) {
51
+ process.on("SIGINT", sigintHandler);
52
+ process.on("SIGTERM", sigtermHandler);
53
+ }
34
54
  const run = async () => {
35
55
  try {
36
56
  switch (action) {
@@ -62,7 +82,9 @@ export default function Plugin({ action, target, dryRun, codex = false, force =
62
82
  await runPluginList(onStep);
63
83
  break;
64
84
  case "search":
65
- await runPluginSearch(target, onStep);
85
+ await runPluginSearch(target, onStep, {
86
+ signal: controller?.signal,
87
+ });
66
88
  break;
67
89
  case "validate":
68
90
  if (!target) {
@@ -129,6 +151,14 @@ export default function Plugin({ action, target, dryRun, codex = false, force =
129
151
  setDone(true);
130
152
  };
131
153
  run();
154
+ return () => {
155
+ if (sigintHandler) {
156
+ process.removeListener("SIGINT", sigintHandler);
157
+ }
158
+ if (sigtermHandler) {
159
+ process.removeListener("SIGTERM", sigtermHandler);
160
+ }
161
+ };
132
162
  }, [action, target, dryRun, force]);
133
163
  return (React.createElement(Box, { flexDirection: "column", padding: 1 },
134
164
  React.createElement(Box, { marginBottom: 1 },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "javi-forge",
3
- "version": "1.38.5",
3
+ "version": "1.38.6",
4
4
  "description": "Project scaffolding and AI-ready CI bootstrap",
5
5
  "type": "module",
6
6
  "bin": {