@posthog/agent 1.27.0 → 1.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -196,7 +196,7 @@ function createTappedWritableStream(underlying, options) {
196
196
  // package.json
197
197
  var package_default = {
198
198
  name: "@posthog/agent",
199
- version: "1.27.0",
199
+ version: "1.28.0",
200
200
  repository: "https://github.com/PostHog/array",
201
201
  description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
202
202
  main: "./dist/index.js",
@@ -7127,6 +7127,37 @@ ${ignorePattern}
7127
7127
  };
7128
7128
  }
7129
7129
  async deleteWorktree(worktreePath) {
7130
+ const resolvedWorktreePath = path2.resolve(worktreePath);
7131
+ const resolvedMainRepoPath = path2.resolve(this.mainRepoPath);
7132
+ if (resolvedWorktreePath === resolvedMainRepoPath) {
7133
+ const error = new Error(
7134
+ "Cannot delete worktree: path matches main repo path"
7135
+ );
7136
+ this.logger.error("Safety check failed", { worktreePath, error });
7137
+ throw error;
7138
+ }
7139
+ if (resolvedMainRepoPath.startsWith(resolvedWorktreePath) && resolvedMainRepoPath !== resolvedWorktreePath) {
7140
+ const error = new Error(
7141
+ "Cannot delete worktree: path is a parent of main repo path"
7142
+ );
7143
+ this.logger.error("Safety check failed", { worktreePath, error });
7144
+ throw error;
7145
+ }
7146
+ try {
7147
+ const gitPath = path2.join(resolvedWorktreePath, ".git");
7148
+ const stat2 = await fs5.stat(gitPath);
7149
+ if (stat2.isDirectory()) {
7150
+ const error = new Error(
7151
+ "Cannot delete worktree: path appears to be a main repository (contains .git directory)"
7152
+ );
7153
+ this.logger.error("Safety check failed", { worktreePath, error });
7154
+ throw error;
7155
+ }
7156
+ } catch (error) {
7157
+ if (error instanceof Error && error.message.includes("Cannot delete worktree")) {
7158
+ throw error;
7159
+ }
7160
+ }
7130
7161
  this.logger.info("Deleting worktree", { worktreePath });
7131
7162
  try {
7132
7163
  await execFileAsync(