show-me-the-env 0.96.1 → 0.96.3

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agenv",
3
- "version": "0.96.1",
3
+ "version": "0.96.3",
4
4
  "description": "Save and restore your whole agent and coding environment as one versioned .agenv repository.",
5
5
  "skills": [
6
6
  "./skills/init",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "show-me-the-env",
3
- "version": "0.96.1",
3
+ "version": "0.96.3",
4
4
  "description": "Save and restore your whole agent and coding environment as one versioned .agenv repository.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -13,12 +13,26 @@ export function verifySource(source) {
13
13
  // git names the top level by its long path, so an 8.3 alias in the source (a Windows TEMP like RUNNER~1) is resolved first.
14
14
  const relative = path.relative(root, realpathSync.native(source)).split(path.sep).join('/');
15
15
  const files = git('ls-tree', '-r', '--name-only', '-z', remote, '--', relative || '.').split('\0');
16
- const missing = files.filter(file => (file === 'SKILL.md' || file.endsWith('/SKILL.md')) && !existsSync(path.dirname(path.join(root, file))));
17
- if (!missing.length) return [];
16
+ const skills = files.filter(file => file === 'SKILL.md' || file.endsWith('/SKILL.md')).map(file => path.posix.dirname(file));
17
+ const missing = skills.filter(skill => !existsSync(path.join(root, skill)));
18
+ // A skill the default branch changed after this checkout left it stays old in every agent home, though its folder is there.
19
+ const changed = behind ? git('diff', '--name-only', '-z', `HEAD...${remote}`, '--', relative || '.').split('\0').filter(Boolean) : [];
20
+ const stale = skills.filter(skill => !missing.includes(skill) && changed.some(file => skill === '.' || file.startsWith(`${skill}/`)));
21
+ // A detached HEAD follows no branch, so nothing moves it to a newer default branch and its skills age without a word.
22
+ let branch = '';
23
+ try { branch = git('symbolic-ref', '--quiet', '--short', 'HEAD'); } catch { branch = ''; }
24
+ const failures = [];
25
+ if (!branch) failures.push(`${root}: HEAD is detached at ${git('rev-parse', '--short', 'HEAD')}, so nothing moves it past ${remote}; switch it to a branch that tracks ${remote}`);
26
+ if (!missing.length && !stale.length) return failures;
18
27
  const log = path.join(root, '.re0', 'catchup.log');
19
28
  const lines = existsSync(log) ? readFileSync(log, 'utf8').split(/\r?\n/) : [];
20
29
  const refusal = lines.filter(line => /옮기지 않|원격에 없는 내용/.test(line)).at(-1);
21
- return missing.map(file => `${path.basename(path.dirname(file))}: ${root} is ${behind} commits behind ${remote}${refusal ? `; ${refusal}` : ''}`);
30
+ const why = `${root} is ${behind} commits behind ${remote}${refusal ? `; ${refusal}` : ''}`;
31
+ return [
32
+ ...failures,
33
+ ...missing.map(skill => `${path.posix.basename(skill)}: ${why}`),
34
+ ...stale.map(skill => `${path.posix.basename(skill)}: changed on ${remote}; ${why}`),
35
+ ];
22
36
  }
23
37
 
24
38
  if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
@@ -26,6 +40,6 @@ if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.me
26
40
  const failures = process.argv.slice(2).flatMap(verifySource);
27
41
  for (const failure of failures) console.error(failure);
28
42
  if (failures.length) process.exitCode = 1;
29
- else console.log('Skill sources contain every skill in their fetched default branch');
43
+ else console.log('Skill sources sit on a branch and contain every skill of their fetched default branch as it stands there');
30
44
  } catch (error) { console.error(`Cannot verify skill source: ${error.message}`); process.exitCode = 1; }
31
45
  }
@@ -320,7 +320,7 @@ if ($Mode -eq 'Live') {
320
320
  $skillSources = @($manifest.skillLinks.sources | ForEach-Object { Expand-Token $_ $manifest })
321
321
  if ($skillSources.Count -gt 0) {
322
322
  & node (Join-Path $PSScriptRoot 'verify-skill-sources.mjs') @skillSources 2>&1 | ForEach-Object { Write-Info "$_" }
323
- Test-Check ($LASTEXITCODE -eq 0) 'skill sources contain every skill in their fetched default branch'
323
+ Test-Check ($LASTEXITCODE -eq 0) 'skill sources sit on a branch and contain every skill of their fetched default branch as it stands there'
324
324
  }
325
325
 
326
326
  Write-Step 'Live parity (repo snapshot vs installed machine)'
package/src/load.mjs CHANGED
@@ -112,7 +112,10 @@ export function planLoad({ dataRoot, profile, home, platform = process.platform,
112
112
  if (fresh) unchecked.add(key);
113
113
  observed[key] = { digest: fresh ? null : have };
114
114
  files.set(key, { target, bytes: w.bytes });
115
- desired.push({ id: w.repo, adapterId: 'files', operation: 'configure', inputs: { repo: w.repo, live: w.live, sha256: want }, writes: [key], soft: [...softAfterTools, ...ownLists(w.repo)], permissions: ['write-home'] });
115
+ // The live file is a second resource key: two profile files may name one live file, and sharing
116
+ // it keeps the executor from running both writes at once, so the later one in plan order finds
117
+ // the file changed and stops as a conflict whatever --jobs is (scripts/benchmark.mjs plants this).
118
+ desired.push({ id: w.repo, adapterId: 'files', operation: 'configure', inputs: { repo: w.repo, live: w.live, sha256: want }, writes: [key], reads: ['file:' + target], soft: [...softAfterTools, ...ownLists(w.repo)], permissions: ['write-home'] });
116
119
  }
117
120
  // Signing keys the profile names and gpg here does not list as secret keys are imported once
118
121
  // every secrets/ file of this load is written, since their secret key files are among them.
@@ -158,7 +161,7 @@ export async function applyLoad({ planned, approval, stateRoot, journal, jobs =
158
161
  const filesAdapter = {
159
162
  async observe(keys) { return Object.fromEntries(keys.map((k) => [k, planned.files.has(k) && !planned.unchecked?.has(k) ? fileDigest(planned.files.get(k).target) : null])); },
160
163
  async apply(action) {
161
- const key = action.resourceKeys[0];
164
+ const key = action.resourceKeys.find((k) => planned.files.has(k));
162
165
  const { target, bytes } = planned.files.get(key);
163
166
  const out = ownedWrite({ journal, stateRoot, runId: id, actionId: action.actionId, resourceKey: key, file: target, bytes });
164
167
  return { status: out.status, summary: 'wrote ' + action.inputs.repo, changedResources: out.status === 'changed' ? [key] : [], rollbackCapability: 'reversible' };