Enhance build configuration and testing
- Added notarization configuration for macOS builds to support app distribution. - Updated CI workflow to run on Ubuntu instead of macOS for improved compatibility. - Modified test cleanup process to include retry logic for file removal. - Refactored path handling in tests to use path.join for better cross-platform compatibility.
This commit is contained in:
parent
c2308f41a9
commit
ed45a1d87c
5 changed files with 13 additions and 10 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
|
@ -11,7 +11,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, windows-latest]
|
os: [ubuntu-latest, windows-latest]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ mac:
|
||||||
hardenedRuntime: true
|
hardenedRuntime: true
|
||||||
gatekeeperAssess: false
|
gatekeeperAssess: false
|
||||||
icon: resources/icons/mac/icon.icns
|
icon: resources/icons/mac/icon.icns
|
||||||
|
notarize:
|
||||||
|
teamId: ${env.APPLE_TEAM_ID}
|
||||||
|
|
||||||
dmg:
|
dmg:
|
||||||
sign: false
|
sign: false
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ describe('ProjectPathResolver', () => {
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
for (const tempDir of tempDirs) {
|
for (const tempDir of tempDirs) {
|
||||||
fs.rmSync(tempDir, { recursive: true, force: true });
|
fs.rmSync(tempDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
||||||
}
|
}
|
||||||
tempDirs.length = 0;
|
tempDirs.length = 0;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import * as path from 'path';
|
||||||
import { describe, expect, it } from 'vitest';
|
import { describe, expect, it } from 'vitest';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|
@ -173,13 +174,13 @@ describe('pathDecoder', () => {
|
||||||
describe('buildSessionPath', () => {
|
describe('buildSessionPath', () => {
|
||||||
it('should construct correct session path', () => {
|
it('should construct correct session path', () => {
|
||||||
expect(buildSessionPath('/base', 'project-id', 'session-123')).toBe(
|
expect(buildSessionPath('/base', 'project-id', 'session-123')).toBe(
|
||||||
'/base/project-id/session-123.jsonl'
|
path.join('/base', 'project-id', 'session-123.jsonl')
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle paths with special characters', () => {
|
it('should handle paths with special characters', () => {
|
||||||
expect(buildSessionPath('/home/user/.claude/projects', '-Users-name', 'abc123')).toBe(
|
expect(buildSessionPath('/home/user/.claude/projects', '-Users-name', 'abc123')).toBe(
|
||||||
'/home/user/.claude/projects/-Users-name/abc123.jsonl'
|
path.join('/home/user/.claude/projects', '-Users-name', 'abc123.jsonl')
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -187,7 +188,7 @@ describe('pathDecoder', () => {
|
||||||
describe('buildSubagentsPath', () => {
|
describe('buildSubagentsPath', () => {
|
||||||
it('should construct correct subagents path', () => {
|
it('should construct correct subagents path', () => {
|
||||||
expect(buildSubagentsPath('/base', 'project-id', 'session-123')).toBe(
|
expect(buildSubagentsPath('/base', 'project-id', 'session-123')).toBe(
|
||||||
'/base/project-id/session-123/subagents'
|
path.join('/base', 'project-id', 'session-123', 'subagents')
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -195,20 +196,20 @@ describe('pathDecoder', () => {
|
||||||
describe('buildTodoPath', () => {
|
describe('buildTodoPath', () => {
|
||||||
it('should construct correct todo path', () => {
|
it('should construct correct todo path', () => {
|
||||||
expect(buildTodoPath('/home/user/.claude', 'session-123')).toBe(
|
expect(buildTodoPath('/home/user/.claude', 'session-123')).toBe(
|
||||||
'/home/user/.claude/todos/session-123.json'
|
path.join('/home/user/.claude', 'todos', 'session-123.json')
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getProjectsBasePath', () => {
|
describe('getProjectsBasePath', () => {
|
||||||
it('should return projects base path', () => {
|
it('should return projects base path', () => {
|
||||||
expect(getProjectsBasePath()).toBe('/home/testuser/.claude/projects');
|
expect(getProjectsBasePath()).toBe(path.join('/home/testuser', '.claude', 'projects'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getTodosBasePath', () => {
|
describe('getTodosBasePath', () => {
|
||||||
it('should return todos base path', () => {
|
it('should return todos base path', () => {
|
||||||
expect(getTodosBasePath()).toBe('/home/testuser/.claude/todos');
|
expect(getTodosBasePath()).toBe(path.join('/home/testuser', '.claude', 'todos'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import {
|
||||||
describe('pathValidation', () => {
|
describe('pathValidation', () => {
|
||||||
const homeDir = os.homedir();
|
const homeDir = os.homedir();
|
||||||
const claudeDir = path.join(homeDir, '.claude');
|
const claudeDir = path.join(homeDir, '.claude');
|
||||||
const testProjectPath = '/home/user/my-project';
|
const testProjectPath = path.resolve('/home/user/my-project');
|
||||||
|
|
||||||
describe('isPathWithinAllowedDirectories', () => {
|
describe('isPathWithinAllowedDirectories', () => {
|
||||||
it('should allow paths within ~/.claude', () => {
|
it('should allow paths within ~/.claude', () => {
|
||||||
|
|
@ -150,7 +150,7 @@ describe('pathValidation', () => {
|
||||||
it('should handle normalized paths with ..', () => {
|
it('should handle normalized paths with ..', () => {
|
||||||
// This path resolves correctly but starts outside project
|
// This path resolves correctly but starts outside project
|
||||||
const result = validateFilePath(
|
const result = validateFilePath(
|
||||||
'/home/user/my-project/../other-project/file.ts',
|
path.join(testProjectPath, '..', 'other-project', 'file.ts'),
|
||||||
testProjectPath
|
testProjectPath
|
||||||
);
|
);
|
||||||
// Should be rejected because final path is outside project
|
// Should be rejected because final path is outside project
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue