Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ src/
workspace/readiness.ts Workspace readiness: environment detection, folder selection
test/
unit/ Unit tests (node:test, dependency-injected, no VS Code API)
batchApply.test.ts Batch template and operation count parsing (11 tests)
batchApply.test.ts Batch template and operation count parsing (12 tests)
binary.test.ts Binary discovery, managed install, compatibility, workspace env (59 tests)
binaryDiscovery.test.ts Real executable discovery on PATH (13 tests)
initializeProject.test.ts Status display, agents file classification, formatError (26 tests)
Expand Down
8 changes: 6 additions & 2 deletions src/commands/batchApply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ export function parseBatchOperationCount(plan: string): number {
return plan.split("\n").filter((line) => line.trim().length > 0).length;
}

/** CLI argv for Batch Apply. Global --contain first (CLI 0.10+ path guard). */
export function buildBatchApplyArgs(): string[] {
return ["--contain", "batch", "--apply"];
}

export async function batchApply(): Promise<void> {
const binaryPath = await ensurePatchloomReadyOrNotify("Upgrade Patchloom before running batch operations.");
if (!binaryPath) {
Expand Down Expand Up @@ -53,8 +58,7 @@ export async function batchApply(): Promise<void> {

const plan = doc.getText();
const log = getPatchloomLog();
// Global --contain rejects plan ops that escape the workspace root (CLI 0.10+).
const args = ["--contain", "batch", "--apply"];
const args = buildBatchApplyArgs();
log?.logCommand(binaryPath, args, folder.uri.fsPath);

const result = await executePatchloomWithStdin(binaryPath, args, folder.uri.fsPath, plan);
Expand Down
10 changes: 9 additions & 1 deletion test/unit/batchApply.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import assert from "node:assert/strict";
import test from "node:test";
import { buildBatchTemplate, parseBatchOperationCount } from "../../src/commands/batchApply.js";
import {
buildBatchApplyArgs,
buildBatchTemplate,
parseBatchOperationCount
} from "../../src/commands/batchApply.js";

test("buildBatchTemplate returns line-oriented format with four operations", () => {
const template = buildBatchTemplate();
Expand Down Expand Up @@ -73,3 +77,7 @@ test("buildBatchTemplate file.append line has file and quoted content", () => {
assert.ok(appendLine, "template should contain a file.append line");
assert.match(appendLine, /file\.append \S+ ".+"/, "file.append should have file and quoted content");
});

test("buildBatchApplyArgs prefixes global --contain before batch --apply", () => {
assert.deepEqual(buildBatchApplyArgs(), ["--contain", "batch", "--apply"]);
});
4 changes: 2 additions & 2 deletions walkthrough/initialize.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Generate an `AGENTS.md` file that tells AI agents how to work with
your codebase.

Click **Initialize Project** above to run `patchloom agent-rules` in
your workspace. This analyzes your project and creates a tailored
configuration.
your workspace. You can choose integration mode (CLI + MCP, CLI only, or
MCP only) and shell platform examples (all, Linux/macOS, or Windows).

## What AGENTS.md Contains

Expand Down
Loading