mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-14 02:29:33 +01:00
fix: apply the review items for #708 at merge
- test/cli-agent-project-spawn.test.ts:345: the doc-sync test no longer reads .changeset/project-worker-directories.md (changeset version deletes it at release); README, API reference and wiki stay. - CLAUDE.md:132 + src/cli-agent.ts @fileoverview (invariant 5): the directory spawn (POST /api/v1/sessions plus /interactive or /shell, no Agent-Origin header, so no marker) and its refusals (empty --working-dir, bare spawn from a HOME cwd); the invariants now name test/cli-agent-project-spawn.test.ts too. - test/cli-agent-project-spawn.test.ts:322: "allows a cwd below HOME" mocks the cwd to <temp HOME>/src/app, so it covers the case the guard must leave alone. - docs/wiki/Driving-Codeman-From-An-Agent.md:59: split the sentence so exit 4 covers only the empty --working-dir; spawn "" reaches quick-start and exits 1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
003398e209
commit
4b3eebd0ed
4 files changed
+19
-13
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { mkdtemp, rm, symlink, writeFile } from 'node:fs/promises';
|
||||
import { mkdir, mkdtemp, rm, symlink, writeFile } from 'node:fs/promises';
|
||||
import http from 'node:http';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { readFileSync } from 'node:fs';
|
||||
@@ -321,10 +321,13 @@ describe('agent spawn never treats an implicit HOME cwd as a project', () => {
|
||||
});
|
||||
it('allows a cwd below HOME', async () => {
|
||||
const home = await homeDir();
|
||||
const project = join(home, 'src', 'app');
|
||||
await mkdir(project, { recursive: true });
|
||||
vi.stubEnv('HOME', home);
|
||||
vi.spyOn(process, 'cwd').mockReturnValue(project);
|
||||
const t = deps([ok({ session: { id: OTHER } }), ok({})]);
|
||||
expect(await agentSpawn(t.d, base)).toBe(EXIT.ok);
|
||||
expect(t.calls[0].body).toMatchObject({ workingDir: process.cwd() });
|
||||
expect(t.calls[0].body).toMatchObject({ workingDir: project });
|
||||
});
|
||||
it('never throws when HOME cannot be resolved, and compares the resolved paths instead', async () => {
|
||||
const missing = join(await homeDir(), 'absent');
|
||||
@@ -340,12 +343,7 @@ describe('the directory-spawn --json shape is documented the same way everywhere
|
||||
// The wiki wraps lines, so whitespace is normalized before comparing.
|
||||
const clause =
|
||||
'`{ sessionId, workingDir, created: true }`, plus `ready` when a readiness wait ran, `readinessError` when that call failed, and `startupError` when the start failed';
|
||||
for (const file of [
|
||||
'README.md',
|
||||
'docs/api-reference.md',
|
||||
'docs/wiki/Driving-Codeman-From-An-Agent.md',
|
||||
'.changeset/project-worker-directories.md',
|
||||
]) {
|
||||
for (const file of ['README.md', 'docs/api-reference.md', 'docs/wiki/Driving-Codeman-From-An-Agent.md']) {
|
||||
it(file, () => {
|
||||
expect(readFileSync(new URL(`../${file}`, import.meta.url), 'utf8').replace(/\s+/g, ' ')).toContain(clause);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user