codequill 0.9.1 → 0.9.2
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/services/fs.js +13 -43
- package/dist/services/fs.js.map +1 -1
- package/package.json +3 -2
package/dist/services/fs.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { promises as fs } from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import os from 'node:os';
|
|
4
|
-
import
|
|
5
|
-
import { promisify } from 'node:util';
|
|
6
|
-
const execFileAsync = promisify(execFile);
|
|
4
|
+
import * as tar from 'tar';
|
|
7
5
|
export async function readFileUtf8(filePath) {
|
|
8
6
|
return await fs.readFile(filePath, 'utf8');
|
|
9
7
|
}
|
|
@@ -27,55 +25,27 @@ export async function fileExists(p) {
|
|
|
27
25
|
}
|
|
28
26
|
}
|
|
29
27
|
/**
|
|
30
|
-
* Create a deterministic .tar.gz from a directory
|
|
28
|
+
* Create a deterministic .tar.gz from a directory.
|
|
31
29
|
*
|
|
32
30
|
* Determinism guarantees:
|
|
33
|
-
* -
|
|
34
|
-
* - All timestamps zeroed (
|
|
35
|
-
* - Ownership normalized to 0:0 (--owner=0 --group=0 --numeric-owner)
|
|
36
|
-
* - Gzip header timestamp omitted (-n via env GZIP=-n)
|
|
31
|
+
* - Ownership normalized (portable: true sets uid/gid to 0)
|
|
32
|
+
* - All timestamps zeroed (mtime set to Unix epoch)
|
|
37
33
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
34
|
+
* Uses the `tar` npm package — fully cross-platform (macOS, Linux, Windows).
|
|
35
|
+
* No system binary dependency.
|
|
40
36
|
*
|
|
41
37
|
* @returns Absolute path to the temporary .tar.gz file.
|
|
42
38
|
*/
|
|
43
39
|
export async function createDeterministicTarGz(dirAbs) {
|
|
44
|
-
const tarBin = await resolveGnuTar();
|
|
45
40
|
const dirName = path.basename(dirAbs);
|
|
46
41
|
const outPath = path.join(os.tmpdir(), `codequill-attest-${dirName}-${Date.now()}.tar.gz`);
|
|
47
|
-
await
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
'-C', path.dirname(dirAbs),
|
|
55
|
-
dirName,
|
|
56
|
-
], {
|
|
57
|
-
env: { ...process.env, GZIP: '-n' },
|
|
58
|
-
});
|
|
42
|
+
await tar.create({
|
|
43
|
+
gzip: { level: 9 },
|
|
44
|
+
file: outPath,
|
|
45
|
+
cwd: path.dirname(dirAbs),
|
|
46
|
+
portable: true,
|
|
47
|
+
mtime: new Date(0),
|
|
48
|
+
}, [dirName]);
|
|
59
49
|
return outPath;
|
|
60
50
|
}
|
|
61
|
-
/**
|
|
62
|
-
* Resolve the path to a GNU tar binary.
|
|
63
|
-
* On macOS, GNU tar is typically installed via Homebrew as `gtar`.
|
|
64
|
-
* On Linux, the system `tar` is usually GNU tar.
|
|
65
|
-
*/
|
|
66
|
-
async function resolveGnuTar() {
|
|
67
|
-
// Try gtar first (Homebrew GNU tar on macOS)
|
|
68
|
-
for (const bin of ['gtar', 'tar']) {
|
|
69
|
-
try {
|
|
70
|
-
const { stdout } = await execFileAsync(bin, ['--version']);
|
|
71
|
-
if (stdout.includes('GNU'))
|
|
72
|
-
return bin;
|
|
73
|
-
}
|
|
74
|
-
catch {
|
|
75
|
-
// binary not found or failed, try next
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
throw new Error('Directory attestation requires GNU tar.\n' +
|
|
79
|
-
'On macOS, install with: brew install gnu-tar');
|
|
80
|
-
}
|
|
81
51
|
//# sourceMappingURL=fs.js.map
|
package/dist/services/fs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.js","sourceRoot":"","sources":["../../src/services/fs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;A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M,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACtC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CACrB,EAAE,CAAC,MAAM,EAAE,EACX,oBAAoB,OAAO,IAAI,IAAI,CAAC,GAAG,EAAE,SAAS,CACrD,CAAC;IAEF,MAAM,GAAG,CAAC,MAAM,CACZ;QACI,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE;QAClB,IAAI,EAAE,OAAO;QACb,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;QACzB,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC;KACrB,EACD,CAAC,OAAO,CAAC,CACZ,CAAC;IAEF,OAAO,OAAO,CAAC;AACnB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codequill",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "CodeQuill CLI — claim authorship, create snapshots, attest artifact and push preservations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
"ethers": "^6.13.0",
|
|
39
39
|
"kleur": "^4.1.5",
|
|
40
40
|
"libsodium-wrappers": "^0.8.0",
|
|
41
|
-
"ora": "^8.0.1"
|
|
41
|
+
"ora": "^8.0.1",
|
|
42
|
+
"tar": "^7.5.13"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
45
|
"@types/libsodium-wrappers": "^0.7.14",
|