@tryaura/aura-testkit 0.3.0 → 0.3.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.
Files changed (2) hide show
  1. package/dist/index.js +24 -7
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -1379,15 +1379,21 @@ function hashContent(content) {
1379
1379
  return createHash("sha256").update(canonicalizeContent(content), "utf8").digest("hex");
1380
1380
  }
1381
1381
  //#endregion
1382
- //#region ../core/src/preset/repo-trust.ts
1382
+ //#region ../core/src/preset/repo-content.ts
1383
1383
  /**
1384
- * Hashes repository preset contents for the trust record.
1384
+ * Hashes the repository content set for the trust record.
1385
1385
  *
1386
- * Normalizes line endings so a checkout that rewrites them does not invalidate a trust the user
1387
- * already granted to the same bytes-as-authored.
1386
+ * With no snippet files the hash is exactly the preset file's own content hash, so a repository
1387
+ * that never adds `.aura/snippets` keeps every trust its users already recorded. The first
1388
+ * snippet changes the descriptor shape — and consent is re-asked, which is the point.
1388
1389
  */
1389
- function hashRepoPreset(content) {
1390
- return hashContent(content);
1390
+ function hashRepoContentSet(presetText, snippets) {
1391
+ if (snippets.length === 0) return hashContent(presetText);
1392
+ return hashContent([
1393
+ "aura-repo-content-v1",
1394
+ `preset ${hashContent(presetText)}`,
1395
+ ...[...snippets].sort((left, right) => left.id < right.id ? -1 : 1).map((file) => `snippet ${file.id} ${hashContent(file.text)}`)
1396
+ ].join("\n"));
1391
1397
  }
1392
1398
  //#endregion
1393
1399
  //#region src/http.ts
@@ -1840,7 +1846,7 @@ async function recordTrustedPresets(homeDir, workspaceDir, presets) {
1840
1846
  throw new Error(`trustWorkspacePreset needs the seeded workspace file: ${relativePath}`);
1841
1847
  });
1842
1848
  added.push({
1843
- hash: hashRepoPreset(content),
1849
+ hash: hashRepoContentSet(content, await seededSnippets(dirname(path))),
1844
1850
  path
1845
1851
  });
1846
1852
  }
@@ -1856,6 +1862,17 @@ async function recordTrustedPresets(homeDir, workspaceDir, presets) {
1856
1862
  mode: 384
1857
1863
  });
1858
1864
  }
1865
+ /** The snippet files beside a seeded preset, in the shape the composite hash consumes. */
1866
+ async function seededSnippets(auraDir) {
1867
+ const root = join(auraDir, "snippets");
1868
+ const names = await readdir(root).catch(() => []);
1869
+ const files = [];
1870
+ for (const name of names.filter((entry) => !entry.startsWith(".") && entry.endsWith(".md"))) files.push({
1871
+ id: `repo/${name.slice(0, -3)}`,
1872
+ text: await readFile(join(root, name), "utf8")
1873
+ });
1874
+ return files;
1875
+ }
1859
1876
  function parseSeedManifest(source, path) {
1860
1877
  const value = JSON.parse(source);
1861
1878
  if (!isRecord(value)) throw new Error(`Seed manifest ${path} must contain a JSON object`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryaura/aura-testkit",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Deterministic filesystem seeds and CLI harnesses for Aura plugins and distributions.",
5
5
  "keywords": [
6
6
  "aura",
@@ -30,17 +30,17 @@
30
30
  "access": "public"
31
31
  },
32
32
  "dependencies": {
33
- "@tryaura/aura-cli": "0.3.0",
34
- "@tryaura/aura-sdk": "0.3.0"
33
+ "@tryaura/aura-cli": "0.3.2",
34
+ "@tryaura/aura-sdk": "0.3.2"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "24.13.3",
38
38
  "diff": "9.0.0",
39
39
  "vitest": "4.1.10",
40
- "@tryaura/adapter-codex": "0.0.0",
41
40
  "@tryaura/adapter-claude-code": "0.0.0",
42
- "@tryaura/core": "0.0.0",
43
- "@tryaura/adapter-cursor": "0.0.0"
41
+ "@tryaura/adapter-codex": "0.0.0",
42
+ "@tryaura/adapter-cursor": "0.0.0",
43
+ "@tryaura/core": "0.0.0"
44
44
  },
45
45
  "engines": {
46
46
  "node": ">=24"