amalgm 0.1.236 → 0.1.238

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amalgm",
3
- "version": "0.1.236",
3
+ "version": "0.1.238",
4
4
  "description": "Amalgm local computer runtime: login, MCP, chat, events, previews, and tunnels.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -389,6 +389,7 @@ test('an empty project folder hydrates from the winning card bundle without clon
389
389
  const source = sourceRepo.repo;
390
390
  fs.mkdirSync(path.join(source, '.amalgam', 'context'), { recursive: true });
391
391
  fs.writeFileSync(path.join(source, '.amalgam', 'context', 'notes.md'), 'committed note\n');
392
+ fs.symlinkSync('notes.md', path.join(source, '.amalgam', 'context', 'current.md'));
392
393
  await git(source, 'add', '.');
393
394
  await git(source, 'commit', '-m', 'track project memory');
394
395
  const oid = (await git(source, 'rev-parse', 'HEAD')).trim();
@@ -403,6 +404,7 @@ test('an empty project folder hydrates from the winning card bundle without clon
403
404
  const target = path.join(tempRoot, 'hydrate-target');
404
405
  fs.mkdirSync(path.join(target, '.amalgam', 'context'), { recursive: true });
405
406
  fs.writeFileSync(path.join(target, '.amalgam', 'context', 'notes.md'), 'local note\n');
407
+ fs.symlinkSync('notes.md', path.join(target, '.amalgam', 'context', 'current.md'));
406
408
  const winning = card('/remote', oid, 1);
407
409
  winning.repo.remote = 'https://example.com/org/repo';
408
410
  winning.objects = {
@@ -425,6 +427,7 @@ test('an empty project folder hydrates from the winning card bundle without clon
425
427
  assert.equal((await git(target, 'symbolic-ref', '--short', 'HEAD')).trim(), 'main');
426
428
  assert.equal(fs.readFileSync(path.join(target, 'a.txt'), 'utf8'), 'a0\n');
427
429
  assert.equal(fs.readFileSync(path.join(target, '.amalgam', 'context', 'notes.md'), 'utf8'), 'local note\n');
430
+ assert.equal(fs.readlinkSync(path.join(target, '.amalgam', 'context', 'current.md')), 'notes.md');
428
431
  assert.match(await git(target, 'status', '--porcelain=v1'), /\.amalgam\/context\/notes\.md/);
429
432
  });
430
433
 
@@ -31,7 +31,7 @@ const {
31
31
  pruneMutationJournal,
32
32
  } = require('../state/mutations');
33
33
  const { registerReplica } = require('../state/replicas');
34
- const { upsertWorkspace } = require('../workspace/store');
34
+ const { listWorkspaces, upsertWorkspace } = require('../workspace/store');
35
35
  const { refreshRepoCards } = require('../workspace/cards');
36
36
  const { checkpointFile, repoKeyOfCard } = require('../workspace/checkpoint');
37
37
  const projectStream = require('../workspace/project-stream');
@@ -330,6 +330,7 @@ test('a collaborator binds the same repo to the owner project, not a parallel pr
330
330
  assert.equal(projectForRepo('repo-shared').resourceId, shared);
331
331
  assert.equal(projectForRepo('repo-shared').ownerUserId, '22222222-2222-4222-8222-222222222222');
332
332
  assert.equal(projectForRepo('repo-shared').path, localPath);
333
+ assert.equal(listWorkspaces().find((workspace) => workspace.path === localPath)?.source, 'computer');
333
334
  });
334
335
 
335
336
  test('a repo project appends immutable machine records', async () => {
@@ -158,7 +158,12 @@ function holdInitialFiles(worktreeRoot) {
158
158
 
159
159
  function restoreInitialFiles(worktreeRoot, holding) {
160
160
  if (!holding) return;
161
- fs.cpSync(holding, worktreeRoot, { recursive: true, force: true, dereference: false });
161
+ fs.cpSync(holding, worktreeRoot, {
162
+ recursive: true,
163
+ force: true,
164
+ dereference: false,
165
+ verbatimSymlinks: true,
166
+ });
162
167
  fs.rmSync(holding, { recursive: true, force: true });
163
168
  journal({ action: 'restore-initial-files', worktree: worktreeRoot, holding, ok: true });
164
169
  }
@@ -105,6 +105,14 @@ function bindProject(repoKey, resourceId, ownerUserId = null, localPath = null)
105
105
  joinedAt: new Date().toISOString(),
106
106
  };
107
107
  writeRegistry(registry);
108
+ if (localPath) {
109
+ require('./store').upsertWorkspace({
110
+ path: localPath,
111
+ name: path.basename(localPath),
112
+ source: 'computer',
113
+ managed: false,
114
+ }, { source: 'workspace:code-project-bind' });
115
+ }
108
116
  if (service.started) {
109
117
  ensureProjectBound(projectForRepo(repoKey))
110
118
  .then(() => {