@rig-c/core 2.64.0 → 2.64.1
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/package.json +1 -1
- package/src/cli/shared.ts +3 -1
- package/src/cli/write_whole.ts +32 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rig-c/core",
|
|
3
|
-
"version": "2.64.
|
|
3
|
+
"version": "2.64.1",
|
|
4
4
|
"description": "AI-authored 2D rigging and animation, verified before it is written. rigc compiles a rig spec into skeleton data in the Spine 4.3 format, gates it with named assertions held to a spine-core round trip's verdicts, and emits nothing that fails. Ships as an agent skill.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/cli/shared.ts
CHANGED
|
@@ -70,7 +70,7 @@ import { RepackError } from '../repack.ts';
|
|
|
70
70
|
import { SplitError } from '../meshsplit.ts';
|
|
71
71
|
import { SpineRuntimeError, SPINE_SIDE_ABSENT } from '../spine_side.ts';
|
|
72
72
|
import type { CompileResult, DroppedState } from '../types.ts';
|
|
73
|
-
import { StdoutWriteError } from './write_whole.ts';
|
|
73
|
+
import { routeConsoleLogThroughWriteWhole, StdoutWriteError } from './write_whole.ts';
|
|
74
74
|
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
75
75
|
import { basename, dirname, isAbsolute, join, relative, resolve } from 'node:path';
|
|
76
76
|
|
|
@@ -2968,6 +2968,8 @@ export function helpArgv(rest: readonly string[]): string[] | null {
|
|
|
2968
2968
|
* always had, written once for both entries.
|
|
2969
2969
|
*/
|
|
2970
2970
|
export function runCli(entry: CliEntry, argv: readonly string[]): void {
|
|
2971
|
+
// Before anything prints: every line on stdout goes out whole, or is refused by name (issue #1493).
|
|
2972
|
+
routeConsoleLogThroughWriteWhole();
|
|
2971
2973
|
const docs = entryCommands(entry.linksRuntime);
|
|
2972
2974
|
const known = docs.map((doc) => doc.name);
|
|
2973
2975
|
const registered = Object.keys(entry.runs).sort();
|
package/src/cli/write_whole.ts
CHANGED
|
@@ -90,3 +90,35 @@ export function writeWhole(fd: number, text: string, plants: WriteWholePlants =
|
|
|
90
90
|
wait(Math.min(2 ** (stalls - 1), STALL_WAIT_CAP_MS));
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The CLI's one stdout policy (issue #1493): `console.log` of this process,
|
|
96
|
+
* every call, through {@link writeWhole} on fd 1 — so the ~250 lines the
|
|
97
|
+
* commands print are written the way the guide's document is, and a
|
|
98
|
+
* non-blocking pipe gets all of them instead of the first ~64 KiB with exit 0.
|
|
99
|
+
* `runCli` installs it before anything prints, for both entries; calling it
|
|
100
|
+
* again changes nothing.
|
|
101
|
+
*
|
|
102
|
+
* ⚖️ One `writeWhole` per call, not a buffer flushed at exit or at a size:
|
|
103
|
+
* Bun's own `console.log` is synchronous per call on a blocking stdout — a
|
|
104
|
+
* line printed between two `console.error` lines lands between them under
|
|
105
|
+
* `2>&1`, to a file and to a pipe, on 1.2.0 and 1.4.2 (measured) — and a
|
|
106
|
+
* write per call keeps that order, keeps a long `render` or `check` printing
|
|
107
|
+
* as it goes, and leaves nothing behind for a `process.exit` to drop, or for a
|
|
108
|
+
* delegate's child, which writes to the same fd, to overtake. A buffer would
|
|
109
|
+
* have to answer all three and still reorders `2>&1`.
|
|
110
|
+
*
|
|
111
|
+
* The text is what Bun's `console.log` prints: the arguments joined by one
|
|
112
|
+
* space, a string as it is and anything else as `Bun.inspect` shows it, and a
|
|
113
|
+
* newline. Format directives (`%s` with a second argument) are not applied —
|
|
114
|
+
* every call in the CLI passes one string, so none has one to apply.
|
|
115
|
+
*/
|
|
116
|
+
let consoleLogRouted = false;
|
|
117
|
+
|
|
118
|
+
export function routeConsoleLogThroughWriteWhole(): void {
|
|
119
|
+
if (consoleLogRouted) return;
|
|
120
|
+
consoleLogRouted = true;
|
|
121
|
+
console.log = (...args: unknown[]): void => {
|
|
122
|
+
writeWhole(1, `${args.map((arg) => (typeof arg === 'string' ? arg : Bun.inspect(arg))).join(' ')}\n`);
|
|
123
|
+
};
|
|
124
|
+
}
|