@ultimat3/manifest 2.0.0 → 3.0.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/CLAUDE.md +5 -0
- package/package.json +6 -6
- package/src/emit.ts +8 -3
package/CLAUDE.md
CHANGED
|
@@ -47,6 +47,11 @@ by the CLI, not imported.
|
|
|
47
47
|
section a truncated or hand-trimmed file happens not to carry was a bare `TypeError` two calls
|
|
48
48
|
from the gate that exists to explain. The FACTS inside a section stay unwalked — a manifest
|
|
49
49
|
written before a field existed is still readable, which is `MANIFEST_VERSION`'s rule.
|
|
50
|
+
- **A byte count is `Buffer.byteLength`, never `String.length`.** `EmitResult.bytes` measures the
|
|
51
|
+
file on disk and a manifest carries the APP's strings — a locale name, an entity description, a
|
|
52
|
+
title in the app's own language — so UTF-16 code units under-report every non-ASCII one.
|
|
53
|
+
`agents-md.ts` measures the same quantity the same way. Nothing committed carries the number:
|
|
54
|
+
`writeAppManifest` is the only caller and it reads `path` alone, so correcting it is not drift.
|
|
50
55
|
- **`--json` is awaited.** `emitManifest({ stdout: true })` writes through `await Bun.write(
|
|
51
56
|
Bun.stdout, …)`: a write to a pipe is asynchronous and `process.exit()` discards the queue, and
|
|
52
57
|
this is the largest payload the CLI prints. Same bug `scripts/stdout-truncation.test.ts` pins.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/manifest",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "x.manifest.json: deterministic generated facts, contract diff, AGENTS.md budget",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"test": "bun test"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@ultimat3/action": "
|
|
35
|
-
"@ultimat3/core": "
|
|
36
|
-
"@ultimat3/entity": "
|
|
37
|
-
"@ultimat3/jobs": "
|
|
38
|
-
"@ultimat3/query": "
|
|
34
|
+
"@ultimat3/action": "3.0.0",
|
|
35
|
+
"@ultimat3/core": "3.0.0",
|
|
36
|
+
"@ultimat3/entity": "3.0.0",
|
|
37
|
+
"@ultimat3/jobs": "3.0.0",
|
|
38
|
+
"@ultimat3/query": "3.0.0"
|
|
39
39
|
}
|
|
40
40
|
}
|
package/src/emit.ts
CHANGED
|
@@ -54,6 +54,11 @@ export interface EmitResult {
|
|
|
54
54
|
export async function emitManifest(input: EmitInput): Promise<EmitResult> {
|
|
55
55
|
const path = input.path ?? `./${MANIFEST_FILENAME}`;
|
|
56
56
|
const text = manifestJson(input.manifest);
|
|
57
|
+
// The bytes on disk, never `text.length`: a manifest carries the APP's strings — a locale name,
|
|
58
|
+
// an entity description, a title in the app's own language — and `String.length` counts UTF-16
|
|
59
|
+
// code units, so it under-reports every one of them and over-reports nothing. `agents-md.ts`
|
|
60
|
+
// measures the same quantity the same way.
|
|
61
|
+
const bytes = Buffer.byteLength(text, 'utf8');
|
|
57
62
|
|
|
58
63
|
if (input.stdout === true) {
|
|
59
64
|
// stdout is the wire in `--json` mode; nothing else may be written to it — and the write is
|
|
@@ -61,16 +66,16 @@ export async function emitManifest(input: EmitInput): Promise<EmitResult> {
|
|
|
61
66
|
// is still queued. Unawaited, the largest payload the CLI prints was the one that lost bytes,
|
|
62
67
|
// exactly as `scripts/stdout-truncation.test.ts` documents for the same bug elsewhere.
|
|
63
68
|
await Bun.write(Bun.stdout, text);
|
|
64
|
-
return { path, bytes
|
|
69
|
+
return { path, bytes, buildId: input.manifest.buildId, changed: false };
|
|
65
70
|
}
|
|
66
71
|
|
|
67
72
|
const existing = await readIfExists(path);
|
|
68
73
|
// Skip the write when nothing moved: an unchanged mtime keeps file watchers quiet.
|
|
69
74
|
if (existing === text) {
|
|
70
|
-
return { path, bytes
|
|
75
|
+
return { path, bytes, buildId: input.manifest.buildId, changed: false };
|
|
71
76
|
}
|
|
72
77
|
await Bun.write(path, text);
|
|
73
|
-
return { path, bytes
|
|
78
|
+
return { path, bytes, buildId: input.manifest.buildId, changed: true };
|
|
74
79
|
}
|
|
75
80
|
|
|
76
81
|
/** Read and structurally validate a manifest. `undefined` when absent or unparseable. */
|