Move src/ → apps/server/ and packages/web/ → apps/web/ to adopt standard monorepo conventions (apps/ for runnable apps, packages/ for reusable libraries). Update all config files, shared package imports, test fixtures, and documentation to reflect new paths. Key fixes: - Update workspace config to ["apps/*", "packages/*"] - Update tsconfig.json rootDir/include for apps/server/ - Add apps/web/** to vitest exclude list - Update drizzle.config.ts schema path - Fix ensure-schema.ts migration path detection (3 levels up in dev, 2 levels up in dist) - Fix tests/integration/cli-server.test.ts import paths - Update packages/shared imports to apps/server/ paths - Update all docs/ files with new paths
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
/**
|
|
* Workspace layout section describing the agent's working directory.
|
|
*/
|
|
|
|
import { readdirSync } from 'node:fs';
|
|
import { join } from 'node:path';
|
|
|
|
export function buildWorkspaceLayout(agentCwd: string): string {
|
|
let entries: string[];
|
|
try {
|
|
entries = readdirSync(agentCwd, { withFileTypes: true })
|
|
.filter(d => d.isDirectory() && d.name !== '.cw')
|
|
.map(d => d.name);
|
|
} catch {
|
|
return '';
|
|
}
|
|
|
|
if (entries.length === 0) {
|
|
return `
|
|
|
|
<workspace>
|
|
Your working directory is: ${agentCwd}
|
|
This is an isolated git worktree. Other agents may be working in parallel on separate branches — do not assume you have exclusive access to the repository.
|
|
</workspace>`;
|
|
}
|
|
|
|
const lines = entries.map(
|
|
name => `- \`${name}/\` — ${join(agentCwd, name)}`
|
|
);
|
|
|
|
return `
|
|
|
|
<workspace>
|
|
Your working directory is: ${agentCwd}
|
|
This is an isolated git worktree. Other agents may be working in parallel on separate branches — do not assume you have exclusive access to the repository.
|
|
The following project directories contain the source code (git worktrees):
|
|
|
|
${lines.join('\n')}
|
|
</workspace>`;
|
|
}
|