merge: integrate upstream main with local Makelore changes

This commit is contained in:
inman
2026-08-31 10:55:48 +08:00
128 changed files with 8278 additions and 3030 deletions

View File

@@ -1,6 +1,6 @@
// @vitest-environment node
import { copyFile, mkdir, mkdtemp, rename, rm, stat } from 'node:fs/promises';
import { copyFile, mkdir, mkdtemp, realpath, rename, rm, stat } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import path from 'node:path';
import { afterEach, describe, expect, it, vi } from 'vitest';
@@ -211,10 +211,10 @@ describe('coding project durable identity', () => {
expect(movedConfig).toMatchObject({ status: 'valid', config: { projectId: PROJECT_ID } });
const copiedPath = path.join(parent, 'copied');
await mkdir(path.join(copiedPath, '.niancode'), { recursive: true });
await mkdir(path.join(copiedPath, '.makelore'), { recursive: true });
await copyFile(
path.join(movedPath, '.niancode', 'project.json'),
path.join(copiedPath, '.niancode', 'project.json'),
path.join(movedPath, '.makelore', 'project.json'),
path.join(copiedPath, '.makelore', 'project.json'),
);
const copied = await readCodingProjectConfigV2(copiedPath);
expect(copied).toMatchObject({ status: 'valid', config: { projectId: PROJECT_ID } });
@@ -229,7 +229,9 @@ describe('coding project durable identity', () => {
const active = await projects.requireActiveRealProjectWithIdentity(projectPath);
expect(active).toMatchObject({ project: local.project, projectId: PROJECT_ID });
expect(normalizeCodingProjectPath(active.path)).toBe(normalizeCodingProjectPath(local.project.path));
expect(normalizeCodingProjectPath(active.path)).toBe(
normalizeCodingProjectPath(await realpath(local.project.path)),
);
const otherPath = await makeRoot('makelore-project-identity-other-');
await expect(projects.requireActiveRealProjectWithIdentity(otherPath)).rejects.toMatchObject({
code: 'CODING_ACTIVE_PROJECT_PATH_MISMATCH',