@hmcs/sdk 1.0.0 → 1.1.0
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/commands.cjs +14 -5
- package/dist/commands.d.ts +12 -5
- package/dist/commands.js +14 -5
- package/package.json +9 -9
package/dist/commands.cjs
CHANGED
|
@@ -248,24 +248,33 @@ exports.output = void 0;
|
|
|
248
248
|
}
|
|
249
249
|
output.writeError = writeError;
|
|
250
250
|
/**
|
|
251
|
-
*
|
|
251
|
+
* Exit the process with code 0, optionally writing a JSON result to stdout.
|
|
252
252
|
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
253
|
+
* When called with a `data` argument, serializes it to stdout via
|
|
254
|
+
* {@link output.write} before exiting. When called without arguments,
|
|
255
|
+
* exits immediately without writing to stdout — useful for commands
|
|
256
|
+
* that perform a side effect (e.g., opening a UI) with no return value.
|
|
255
257
|
*
|
|
256
|
-
* @param data -
|
|
258
|
+
* @param data - Optional value to serialize as JSON and write to stdout
|
|
257
259
|
*
|
|
258
260
|
* @example
|
|
259
261
|
* ```typescript
|
|
260
262
|
* import { input, output } from "@hmcs/sdk/commands";
|
|
261
263
|
*
|
|
264
|
+
* // With payload
|
|
262
265
|
* const data = await input.parse(schema);
|
|
263
266
|
* const result = await doWork(data);
|
|
264
267
|
* output.succeed({ processed: result.count });
|
|
268
|
+
*
|
|
269
|
+
* // Without payload (side-effect only command)
|
|
270
|
+
* await openWebview();
|
|
271
|
+
* output.succeed();
|
|
265
272
|
* ```
|
|
266
273
|
*/
|
|
267
274
|
function succeed(data) {
|
|
268
|
-
|
|
275
|
+
if (data !== undefined) {
|
|
276
|
+
write(data);
|
|
277
|
+
}
|
|
269
278
|
process.exit(0);
|
|
270
279
|
}
|
|
271
280
|
output.succeed = succeed;
|
package/dist/commands.d.ts
CHANGED
|
@@ -810,23 +810,30 @@ declare namespace output {
|
|
|
810
810
|
*/
|
|
811
811
|
function writeError(code: string, message: string): void;
|
|
812
812
|
/**
|
|
813
|
-
*
|
|
813
|
+
* Exit the process with code 0, optionally writing a JSON result to stdout.
|
|
814
814
|
*
|
|
815
|
-
*
|
|
816
|
-
*
|
|
815
|
+
* When called with a `data` argument, serializes it to stdout via
|
|
816
|
+
* {@link output.write} before exiting. When called without arguments,
|
|
817
|
+
* exits immediately without writing to stdout — useful for commands
|
|
818
|
+
* that perform a side effect (e.g., opening a UI) with no return value.
|
|
817
819
|
*
|
|
818
|
-
* @param data -
|
|
820
|
+
* @param data - Optional value to serialize as JSON and write to stdout
|
|
819
821
|
*
|
|
820
822
|
* @example
|
|
821
823
|
* ```typescript
|
|
822
824
|
* import { input, output } from "@hmcs/sdk/commands";
|
|
823
825
|
*
|
|
826
|
+
* // With payload
|
|
824
827
|
* const data = await input.parse(schema);
|
|
825
828
|
* const result = await doWork(data);
|
|
826
829
|
* output.succeed({ processed: result.count });
|
|
830
|
+
*
|
|
831
|
+
* // Without payload (side-effect only command)
|
|
832
|
+
* await openWebview();
|
|
833
|
+
* output.succeed();
|
|
827
834
|
* ```
|
|
828
835
|
*/
|
|
829
|
-
function succeed(data
|
|
836
|
+
function succeed(data?: unknown): never;
|
|
830
837
|
/**
|
|
831
838
|
* Write a structured error to stderr and exit the process.
|
|
832
839
|
*
|
package/dist/commands.js
CHANGED
|
@@ -246,24 +246,33 @@ var output;
|
|
|
246
246
|
}
|
|
247
247
|
output.writeError = writeError;
|
|
248
248
|
/**
|
|
249
|
-
*
|
|
249
|
+
* Exit the process with code 0, optionally writing a JSON result to stdout.
|
|
250
250
|
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
251
|
+
* When called with a `data` argument, serializes it to stdout via
|
|
252
|
+
* {@link output.write} before exiting. When called without arguments,
|
|
253
|
+
* exits immediately without writing to stdout — useful for commands
|
|
254
|
+
* that perform a side effect (e.g., opening a UI) with no return value.
|
|
253
255
|
*
|
|
254
|
-
* @param data -
|
|
256
|
+
* @param data - Optional value to serialize as JSON and write to stdout
|
|
255
257
|
*
|
|
256
258
|
* @example
|
|
257
259
|
* ```typescript
|
|
258
260
|
* import { input, output } from "@hmcs/sdk/commands";
|
|
259
261
|
*
|
|
262
|
+
* // With payload
|
|
260
263
|
* const data = await input.parse(schema);
|
|
261
264
|
* const result = await doWork(data);
|
|
262
265
|
* output.succeed({ processed: result.count });
|
|
266
|
+
*
|
|
267
|
+
* // Without payload (side-effect only command)
|
|
268
|
+
* await openWebview();
|
|
269
|
+
* output.succeed();
|
|
263
270
|
* ```
|
|
264
271
|
*/
|
|
265
272
|
function succeed(data) {
|
|
266
|
-
|
|
273
|
+
if (data !== undefined) {
|
|
274
|
+
write(data);
|
|
275
|
+
}
|
|
267
276
|
process.exit(0);
|
|
268
277
|
}
|
|
269
278
|
output.succeed = succeed;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hmcs/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "TypeScript SDK for building mods and extensions for Desktop Homunculus",
|
|
5
5
|
"author": "notelm",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,20 +36,20 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"eventsource": "^4.1.0",
|
|
39
|
-
"zod": "^3.25.
|
|
39
|
+
"zod": "^3.25.76"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@eslint/js": "^9.39.
|
|
42
|
+
"@eslint/js": "^9.39.3",
|
|
43
43
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
44
|
-
"@types/node": "^20.19.
|
|
45
|
-
"eslint": "^9.39.
|
|
46
|
-
"rimraf": "^6.1.
|
|
47
|
-
"rollup": "^4.
|
|
44
|
+
"@types/node": "^20.19.35",
|
|
45
|
+
"eslint": "^9.39.3",
|
|
46
|
+
"rimraf": "^6.1.3",
|
|
47
|
+
"rollup": "^4.59.0",
|
|
48
48
|
"rollup-plugin-dts": "^6.3.0",
|
|
49
49
|
"tslib": "^2.8.1",
|
|
50
50
|
"typescript": "^5.9.3",
|
|
51
|
-
"typescript-eslint": "^8.56.
|
|
52
|
-
"vitest": "^3.
|
|
51
|
+
"typescript-eslint": "^8.56.1",
|
|
52
|
+
"vitest": "^3.2.4"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"dev": "rollup -c --configPlugin typescript --watch",
|