@posthog/agent 2.3.62 → 2.3.67
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/agent.js +41 -41
- package/dist/agent.js.map +1 -1
- package/dist/posthog-api.js +3 -3
- package/dist/posthog-api.js.map +1 -1
- package/dist/server/agent-server.js +93 -93
- package/dist/server/agent-server.js.map +1 -1
- package/dist/server/bin.cjs +80 -80
- package/dist/server/bin.cjs.map +1 -1
- package/package.json +3 -3
- package/src/adapters/claude/conversion/acp-to-sdk.ts +3 -3
package/dist/server/bin.cjs
CHANGED
|
@@ -805,10 +805,10 @@ var require_src2 = __commonJS({
|
|
|
805
805
|
var fs_1 = require("fs");
|
|
806
806
|
var debug_1 = __importDefault(require_src());
|
|
807
807
|
var log = debug_1.default("@kwsites/file-exists");
|
|
808
|
-
function check(
|
|
809
|
-
log(`checking %s`,
|
|
808
|
+
function check(path12, isFile, isDirectory) {
|
|
809
|
+
log(`checking %s`, path12);
|
|
810
810
|
try {
|
|
811
|
-
const stat = fs_1.statSync(
|
|
811
|
+
const stat = fs_1.statSync(path12);
|
|
812
812
|
if (stat.isFile() && isFile) {
|
|
813
813
|
log(`[OK] path represents a file`);
|
|
814
814
|
return true;
|
|
@@ -828,8 +828,8 @@ var require_src2 = __commonJS({
|
|
|
828
828
|
throw e;
|
|
829
829
|
}
|
|
830
830
|
}
|
|
831
|
-
function exists2(
|
|
832
|
-
return check(
|
|
831
|
+
function exists2(path12, type = exports2.READABLE) {
|
|
832
|
+
return check(path12, (type & exports2.FILE) > 0, (type & exports2.FOLDER) > 0);
|
|
833
833
|
}
|
|
834
834
|
exports2.exists = exists2;
|
|
835
835
|
exports2.FILE = 1;
|
|
@@ -904,7 +904,7 @@ var import_hono = require("hono");
|
|
|
904
904
|
// package.json
|
|
905
905
|
var package_default = {
|
|
906
906
|
name: "@posthog/agent",
|
|
907
|
-
version: "2.3.
|
|
907
|
+
version: "2.3.67",
|
|
908
908
|
repository: "https://github.com/PostHog/code",
|
|
909
909
|
description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
|
|
910
910
|
exports: {
|
|
@@ -968,13 +968,13 @@ var package_default = {
|
|
|
968
968
|
author: "PostHog",
|
|
969
969
|
license: "SEE LICENSE IN LICENSE",
|
|
970
970
|
scripts: {
|
|
971
|
-
build: "
|
|
971
|
+
build: "node ../../scripts/rimraf.mjs dist && tsup",
|
|
972
972
|
dev: "tsup --watch",
|
|
973
973
|
test: "vitest run",
|
|
974
974
|
"test:watch": "vitest",
|
|
975
975
|
typecheck: "pnpm exec tsc --noEmit",
|
|
976
976
|
prepublishOnly: "pnpm run build",
|
|
977
|
-
clean: "
|
|
977
|
+
clean: "node ../../scripts/rimraf.mjs dist .turbo"
|
|
978
978
|
},
|
|
979
979
|
engines: {
|
|
980
980
|
node: ">=20.0.0"
|
|
@@ -1290,7 +1290,7 @@ function nodeWritableToWebWritable(nodeStream) {
|
|
|
1290
1290
|
var import_node_crypto = require("crypto");
|
|
1291
1291
|
var fs4 = __toESM(require("fs"), 1);
|
|
1292
1292
|
var os4 = __toESM(require("os"), 1);
|
|
1293
|
-
var
|
|
1293
|
+
var path6 = __toESM(require("path"), 1);
|
|
1294
1294
|
var import_sdk2 = require("@agentclientprotocol/sdk");
|
|
1295
1295
|
var import_claude_agent_sdk = require("@anthropic-ai/claude-agent-sdk");
|
|
1296
1296
|
var import_uuid = require("uuid");
|
|
@@ -1455,6 +1455,7 @@ var BaseAcpAgent = class {
|
|
|
1455
1455
|
};
|
|
1456
1456
|
|
|
1457
1457
|
// src/adapters/claude/conversion/acp-to-sdk.ts
|
|
1458
|
+
var path = __toESM(require("path"), 1);
|
|
1458
1459
|
function sdkText(value) {
|
|
1459
1460
|
return { type: "text", text: value };
|
|
1460
1461
|
}
|
|
@@ -1462,12 +1463,11 @@ function formatUriAsLink(uri) {
|
|
|
1462
1463
|
try {
|
|
1463
1464
|
if (uri.startsWith("file://")) {
|
|
1464
1465
|
const filePath = uri.slice(7);
|
|
1465
|
-
const name =
|
|
1466
|
+
const name = path.basename(filePath) || filePath;
|
|
1466
1467
|
return `[@${name}](${uri})`;
|
|
1467
1468
|
}
|
|
1468
1469
|
if (uri.startsWith("zed://")) {
|
|
1469
|
-
const
|
|
1470
|
-
const name = parts[parts.length - 1] || uri;
|
|
1470
|
+
const name = path.basename(uri) || uri;
|
|
1471
1471
|
return `[@${name}](${uri})`;
|
|
1472
1472
|
}
|
|
1473
1473
|
return uri;
|
|
@@ -1572,8 +1572,8 @@ var ToolContentBuilder = class {
|
|
|
1572
1572
|
this.items.push({ type: "content", content: image(data, mimeType, uri) });
|
|
1573
1573
|
return this;
|
|
1574
1574
|
}
|
|
1575
|
-
diff(
|
|
1576
|
-
this.items.push({ type: "diff", path:
|
|
1575
|
+
diff(path12, oldText, newText) {
|
|
1576
|
+
this.items.push({ type: "diff", path: path12, oldText, newText });
|
|
1577
1577
|
return this;
|
|
1578
1578
|
}
|
|
1579
1579
|
build() {
|
|
@@ -2857,18 +2857,18 @@ async function handleUserAssistantMessage(message, context) {
|
|
|
2857
2857
|
|
|
2858
2858
|
// src/adapters/claude/plan/utils.ts
|
|
2859
2859
|
var os = __toESM(require("os"), 1);
|
|
2860
|
-
var
|
|
2860
|
+
var path3 = __toESM(require("path"), 1);
|
|
2861
2861
|
function getClaudeConfigDir() {
|
|
2862
|
-
return process.env.CLAUDE_CONFIG_DIR ||
|
|
2862
|
+
return process.env.CLAUDE_CONFIG_DIR || path3.join(os.homedir(), ".claude");
|
|
2863
2863
|
}
|
|
2864
2864
|
function getClaudePlansDir() {
|
|
2865
|
-
return
|
|
2865
|
+
return path3.join(getClaudeConfigDir(), "plans");
|
|
2866
2866
|
}
|
|
2867
2867
|
function isClaudePlanFilePath(filePath) {
|
|
2868
2868
|
if (!filePath) return false;
|
|
2869
|
-
const resolved =
|
|
2870
|
-
const plansDir =
|
|
2871
|
-
return resolved === plansDir || resolved.startsWith(plansDir +
|
|
2869
|
+
const resolved = path3.resolve(filePath);
|
|
2870
|
+
const plansDir = path3.resolve(getClaudePlansDir());
|
|
2871
|
+
return resolved === plansDir || resolved.startsWith(plansDir + path3.sep);
|
|
2872
2872
|
}
|
|
2873
2873
|
function isPlanReady(plan) {
|
|
2874
2874
|
if (!plan) return false;
|
|
@@ -3508,7 +3508,7 @@ function getEffortOptions(modelId) {
|
|
|
3508
3508
|
var import_node_child_process = require("child_process");
|
|
3509
3509
|
var fs2 = __toESM(require("fs"), 1);
|
|
3510
3510
|
var os2 = __toESM(require("os"), 1);
|
|
3511
|
-
var
|
|
3511
|
+
var path4 = __toESM(require("path"), 1);
|
|
3512
3512
|
|
|
3513
3513
|
// src/adapters/claude/session/instructions.ts
|
|
3514
3514
|
var BRANCH_NAMING = `
|
|
@@ -3654,8 +3654,8 @@ function buildSpawnWrapper(sessionId, onProcessSpawned, onProcessExited, logger)
|
|
|
3654
3654
|
};
|
|
3655
3655
|
}
|
|
3656
3656
|
function ensureLocalSettings(cwd) {
|
|
3657
|
-
const claudeDir =
|
|
3658
|
-
const localSettingsPath =
|
|
3657
|
+
const claudeDir = path4.join(cwd, ".claude");
|
|
3658
|
+
const localSettingsPath = path4.join(claudeDir, "settings.local.json");
|
|
3659
3659
|
try {
|
|
3660
3660
|
if (!fs2.existsSync(localSettingsPath)) {
|
|
3661
3661
|
fs2.mkdirSync(claudeDir, { recursive: true });
|
|
@@ -3726,8 +3726,8 @@ function buildSessionOptions(params) {
|
|
|
3726
3726
|
return options;
|
|
3727
3727
|
}
|
|
3728
3728
|
function clearStatsigCache() {
|
|
3729
|
-
const statsigPath =
|
|
3730
|
-
process.env.CLAUDE_CONFIG_DIR ||
|
|
3729
|
+
const statsigPath = path4.join(
|
|
3730
|
+
process.env.CLAUDE_CONFIG_DIR || path4.join(os2.homedir(), ".claude"),
|
|
3731
3731
|
"statsig"
|
|
3732
3732
|
);
|
|
3733
3733
|
fs2.rm(statsigPath, { recursive: true, force: true }, () => {
|
|
@@ -3737,7 +3737,7 @@ function clearStatsigCache() {
|
|
|
3737
3737
|
// src/adapters/claude/session/settings.ts
|
|
3738
3738
|
var fs3 = __toESM(require("fs"), 1);
|
|
3739
3739
|
var os3 = __toESM(require("os"), 1);
|
|
3740
|
-
var
|
|
3740
|
+
var path5 = __toESM(require("path"), 1);
|
|
3741
3741
|
var import_minimatch = require("minimatch");
|
|
3742
3742
|
var ACP_TOOL_NAME_PREFIX = "mcp__acp__";
|
|
3743
3743
|
var acpToolNames = {
|
|
@@ -3777,13 +3777,13 @@ function parseRule(rule) {
|
|
|
3777
3777
|
function normalizePath(filePath, cwd) {
|
|
3778
3778
|
let resolved = filePath;
|
|
3779
3779
|
if (resolved.startsWith("~/")) {
|
|
3780
|
-
resolved =
|
|
3780
|
+
resolved = path5.join(os3.homedir(), resolved.slice(2));
|
|
3781
3781
|
} else if (resolved.startsWith("./")) {
|
|
3782
|
-
resolved =
|
|
3783
|
-
} else if (!
|
|
3784
|
-
resolved =
|
|
3782
|
+
resolved = path5.join(cwd, resolved.slice(2));
|
|
3783
|
+
} else if (!path5.isAbsolute(resolved)) {
|
|
3784
|
+
resolved = path5.join(cwd, resolved);
|
|
3785
3785
|
}
|
|
3786
|
-
return
|
|
3786
|
+
return path5.normalize(resolved).replace(/\\/g, "/");
|
|
3787
3787
|
}
|
|
3788
3788
|
function matchesGlob(pattern, filePath, cwd) {
|
|
3789
3789
|
const normalizedPattern = normalizePath(pattern, cwd);
|
|
@@ -3867,14 +3867,14 @@ var SettingsManager = class {
|
|
|
3867
3867
|
this.initialized = true;
|
|
3868
3868
|
}
|
|
3869
3869
|
getUserSettingsPath() {
|
|
3870
|
-
const configDir = process.env.CLAUDE_CONFIG_DIR ||
|
|
3871
|
-
return
|
|
3870
|
+
const configDir = process.env.CLAUDE_CONFIG_DIR || path5.join(os3.homedir(), ".claude");
|
|
3871
|
+
return path5.join(configDir, "settings.json");
|
|
3872
3872
|
}
|
|
3873
3873
|
getProjectSettingsPath() {
|
|
3874
|
-
return
|
|
3874
|
+
return path5.join(this.cwd, ".claude", "settings.json");
|
|
3875
3875
|
}
|
|
3876
3876
|
getLocalSettingsPath() {
|
|
3877
|
-
return
|
|
3877
|
+
return path5.join(this.cwd, ".claude", "settings.local.json");
|
|
3878
3878
|
}
|
|
3879
3879
|
async loadAllSettings() {
|
|
3880
3880
|
const [userSettings, projectSettings, localSettings, enterpriseSettings] = await Promise.all([
|
|
@@ -4039,7 +4039,7 @@ var ClaudeAcpAgent = class extends BaseAcpAgent {
|
|
|
4039
4039
|
};
|
|
4040
4040
|
}
|
|
4041
4041
|
async newSession(params) {
|
|
4042
|
-
if (fs4.existsSync(
|
|
4042
|
+
if (fs4.existsSync(path6.resolve(os4.homedir(), ".claude.json.backup")) && !fs4.existsSync(path6.resolve(os4.homedir(), ".claude.json"))) {
|
|
4043
4043
|
throw import_sdk2.RequestError.authRequired();
|
|
4044
4044
|
}
|
|
4045
4045
|
const response = await this.createSession(params, {
|
|
@@ -5161,7 +5161,7 @@ function createCodexConnection(config) {
|
|
|
5161
5161
|
var import_node_crypto2 = require("crypto");
|
|
5162
5162
|
var fs5 = __toESM(require("fs/promises"), 1);
|
|
5163
5163
|
var os5 = __toESM(require("os"), 1);
|
|
5164
|
-
var
|
|
5164
|
+
var path7 = __toESM(require("path"), 1);
|
|
5165
5165
|
var CHARS_PER_TOKEN = 4;
|
|
5166
5166
|
var DEFAULT_MAX_TOKENS = 15e4;
|
|
5167
5167
|
function estimateTurnTokens(turn) {
|
|
@@ -5508,7 +5508,7 @@ var Saga = class {
|
|
|
5508
5508
|
|
|
5509
5509
|
// ../git/dist/queries.js
|
|
5510
5510
|
var fs7 = __toESM(require("fs/promises"), 1);
|
|
5511
|
-
var
|
|
5511
|
+
var path9 = __toESM(require("path"), 1);
|
|
5512
5512
|
|
|
5513
5513
|
// ../../node_modules/simple-git/dist/esm/index.js
|
|
5514
5514
|
var import_node_buffer = require("buffer");
|
|
@@ -5547,8 +5547,8 @@ function pathspec(...paths) {
|
|
|
5547
5547
|
cache.set(key, paths);
|
|
5548
5548
|
return key;
|
|
5549
5549
|
}
|
|
5550
|
-
function isPathSpec(
|
|
5551
|
-
return
|
|
5550
|
+
function isPathSpec(path12) {
|
|
5551
|
+
return path12 instanceof String && cache.has(path12);
|
|
5552
5552
|
}
|
|
5553
5553
|
function toPaths(pathSpec) {
|
|
5554
5554
|
return cache.get(pathSpec) || [];
|
|
@@ -5637,8 +5637,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
|
|
|
5637
5637
|
function forEachLineWithContent(input, callback) {
|
|
5638
5638
|
return toLinesWithContent(input, true).map((line) => callback(line));
|
|
5639
5639
|
}
|
|
5640
|
-
function folderExists(
|
|
5641
|
-
return (0, import_file_exists.exists)(
|
|
5640
|
+
function folderExists(path12) {
|
|
5641
|
+
return (0, import_file_exists.exists)(path12, import_file_exists.FOLDER);
|
|
5642
5642
|
}
|
|
5643
5643
|
function append(target, item) {
|
|
5644
5644
|
if (Array.isArray(target)) {
|
|
@@ -6042,8 +6042,8 @@ function checkIsRepoRootTask() {
|
|
|
6042
6042
|
commands,
|
|
6043
6043
|
format: "utf-8",
|
|
6044
6044
|
onError,
|
|
6045
|
-
parser(
|
|
6046
|
-
return /^\.(git)?$/.test(
|
|
6045
|
+
parser(path12) {
|
|
6046
|
+
return /^\.(git)?$/.test(path12.trim());
|
|
6047
6047
|
}
|
|
6048
6048
|
};
|
|
6049
6049
|
}
|
|
@@ -6477,11 +6477,11 @@ function parseGrep(grep) {
|
|
|
6477
6477
|
const paths = /* @__PURE__ */ new Set();
|
|
6478
6478
|
const results = {};
|
|
6479
6479
|
forEachLineWithContent(grep, (input) => {
|
|
6480
|
-
const [
|
|
6481
|
-
paths.add(
|
|
6482
|
-
(results[
|
|
6480
|
+
const [path12, line, preview] = input.split(NULL);
|
|
6481
|
+
paths.add(path12);
|
|
6482
|
+
(results[path12] = results[path12] || []).push({
|
|
6483
6483
|
line: asNumber(line),
|
|
6484
|
-
path:
|
|
6484
|
+
path: path12,
|
|
6485
6485
|
preview
|
|
6486
6486
|
});
|
|
6487
6487
|
});
|
|
@@ -7246,14 +7246,14 @@ var init_hash_object = __esm({
|
|
|
7246
7246
|
init_task();
|
|
7247
7247
|
}
|
|
7248
7248
|
});
|
|
7249
|
-
function parseInit(bare,
|
|
7249
|
+
function parseInit(bare, path12, text2) {
|
|
7250
7250
|
const response = String(text2).trim();
|
|
7251
7251
|
let result;
|
|
7252
7252
|
if (result = initResponseRegex.exec(response)) {
|
|
7253
|
-
return new InitSummary(bare,
|
|
7253
|
+
return new InitSummary(bare, path12, false, result[1]);
|
|
7254
7254
|
}
|
|
7255
7255
|
if (result = reInitResponseRegex.exec(response)) {
|
|
7256
|
-
return new InitSummary(bare,
|
|
7256
|
+
return new InitSummary(bare, path12, true, result[1]);
|
|
7257
7257
|
}
|
|
7258
7258
|
let gitDir = "";
|
|
7259
7259
|
const tokens = response.split(" ");
|
|
@@ -7264,7 +7264,7 @@ function parseInit(bare, path11, text2) {
|
|
|
7264
7264
|
break;
|
|
7265
7265
|
}
|
|
7266
7266
|
}
|
|
7267
|
-
return new InitSummary(bare,
|
|
7267
|
+
return new InitSummary(bare, path12, /^re/i.test(response), gitDir);
|
|
7268
7268
|
}
|
|
7269
7269
|
var InitSummary;
|
|
7270
7270
|
var initResponseRegex;
|
|
@@ -7273,9 +7273,9 @@ var init_InitSummary = __esm({
|
|
|
7273
7273
|
"src/lib/responses/InitSummary.ts"() {
|
|
7274
7274
|
"use strict";
|
|
7275
7275
|
InitSummary = class {
|
|
7276
|
-
constructor(bare,
|
|
7276
|
+
constructor(bare, path12, existing, gitDir) {
|
|
7277
7277
|
this.bare = bare;
|
|
7278
|
-
this.path =
|
|
7278
|
+
this.path = path12;
|
|
7279
7279
|
this.existing = existing;
|
|
7280
7280
|
this.gitDir = gitDir;
|
|
7281
7281
|
}
|
|
@@ -7287,7 +7287,7 @@ var init_InitSummary = __esm({
|
|
|
7287
7287
|
function hasBareCommand(command) {
|
|
7288
7288
|
return command.includes(bareCommand);
|
|
7289
7289
|
}
|
|
7290
|
-
function initTask(bare = false,
|
|
7290
|
+
function initTask(bare = false, path12, customArgs) {
|
|
7291
7291
|
const commands = ["init", ...customArgs];
|
|
7292
7292
|
if (bare && !hasBareCommand(commands)) {
|
|
7293
7293
|
commands.splice(1, 0, bareCommand);
|
|
@@ -7296,7 +7296,7 @@ function initTask(bare = false, path11, customArgs) {
|
|
|
7296
7296
|
commands,
|
|
7297
7297
|
format: "utf-8",
|
|
7298
7298
|
parser(text2) {
|
|
7299
|
-
return parseInit(commands.includes("--bare"),
|
|
7299
|
+
return parseInit(commands.includes("--bare"), path12, text2);
|
|
7300
7300
|
}
|
|
7301
7301
|
};
|
|
7302
7302
|
}
|
|
@@ -8112,12 +8112,12 @@ var init_FileStatusSummary = __esm({
|
|
|
8112
8112
|
"use strict";
|
|
8113
8113
|
fromPathRegex = /^(.+)\0(.+)$/;
|
|
8114
8114
|
FileStatusSummary = class {
|
|
8115
|
-
constructor(
|
|
8116
|
-
this.path =
|
|
8115
|
+
constructor(path12, index, working_dir) {
|
|
8116
|
+
this.path = path12;
|
|
8117
8117
|
this.index = index;
|
|
8118
8118
|
this.working_dir = working_dir;
|
|
8119
8119
|
if (index === "R" || working_dir === "R") {
|
|
8120
|
-
const detail = fromPathRegex.exec(
|
|
8120
|
+
const detail = fromPathRegex.exec(path12) || [null, path12, path12];
|
|
8121
8121
|
this.from = detail[2] || "";
|
|
8122
8122
|
this.path = detail[1] || "";
|
|
8123
8123
|
}
|
|
@@ -8148,14 +8148,14 @@ function splitLine(result, lineStr) {
|
|
|
8148
8148
|
default:
|
|
8149
8149
|
return;
|
|
8150
8150
|
}
|
|
8151
|
-
function data(index, workingDir,
|
|
8151
|
+
function data(index, workingDir, path12) {
|
|
8152
8152
|
const raw = `${index}${workingDir}`;
|
|
8153
8153
|
const handler = parsers6.get(raw);
|
|
8154
8154
|
if (handler) {
|
|
8155
|
-
handler(result,
|
|
8155
|
+
handler(result, path12);
|
|
8156
8156
|
}
|
|
8157
8157
|
if (raw !== "##" && raw !== "!!") {
|
|
8158
|
-
result.files.push(new FileStatusSummary(
|
|
8158
|
+
result.files.push(new FileStatusSummary(path12, index, workingDir));
|
|
8159
8159
|
}
|
|
8160
8160
|
}
|
|
8161
8161
|
}
|
|
@@ -8468,9 +8468,9 @@ var init_simple_git_api = __esm({
|
|
|
8468
8468
|
next
|
|
8469
8469
|
);
|
|
8470
8470
|
}
|
|
8471
|
-
hashObject(
|
|
8471
|
+
hashObject(path12, write) {
|
|
8472
8472
|
return this._runTask(
|
|
8473
|
-
hashObjectTask(
|
|
8473
|
+
hashObjectTask(path12, write === true),
|
|
8474
8474
|
trailingFunctionArgument(arguments)
|
|
8475
8475
|
);
|
|
8476
8476
|
}
|
|
@@ -8823,8 +8823,8 @@ var init_branch = __esm({
|
|
|
8823
8823
|
}
|
|
8824
8824
|
});
|
|
8825
8825
|
function toPath(input) {
|
|
8826
|
-
const
|
|
8827
|
-
return
|
|
8826
|
+
const path12 = input.trim().replace(/^["']|["']$/g, "");
|
|
8827
|
+
return path12 && (0, import_node_path3.normalize)(path12);
|
|
8828
8828
|
}
|
|
8829
8829
|
var parseCheckIgnore;
|
|
8830
8830
|
var init_CheckIgnore = __esm({
|
|
@@ -9138,8 +9138,8 @@ __export(sub_module_exports, {
|
|
|
9138
9138
|
subModuleTask: () => subModuleTask,
|
|
9139
9139
|
updateSubModuleTask: () => updateSubModuleTask
|
|
9140
9140
|
});
|
|
9141
|
-
function addSubModuleTask(repo,
|
|
9142
|
-
return subModuleTask(["add", repo,
|
|
9141
|
+
function addSubModuleTask(repo, path12) {
|
|
9142
|
+
return subModuleTask(["add", repo, path12]);
|
|
9143
9143
|
}
|
|
9144
9144
|
function initSubModuleTask(customArgs) {
|
|
9145
9145
|
return subModuleTask(["init", ...customArgs]);
|
|
@@ -9469,8 +9469,8 @@ var require_git = __commonJS2({
|
|
|
9469
9469
|
}
|
|
9470
9470
|
return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
|
|
9471
9471
|
};
|
|
9472
|
-
Git2.prototype.submoduleAdd = function(repo,
|
|
9473
|
-
return this._runTask(addSubModuleTask2(repo,
|
|
9472
|
+
Git2.prototype.submoduleAdd = function(repo, path12, then) {
|
|
9473
|
+
return this._runTask(addSubModuleTask2(repo, path12), trailingFunctionArgument2(arguments));
|
|
9474
9474
|
};
|
|
9475
9475
|
Git2.prototype.submoduleUpdate = function(args, then) {
|
|
9476
9476
|
return this._runTask(
|
|
@@ -10269,7 +10269,7 @@ var import_node_path5 = require("path");
|
|
|
10269
10269
|
// ../git/dist/sagas/tree.js
|
|
10270
10270
|
var import_node_fs3 = require("fs");
|
|
10271
10271
|
var fs8 = __toESM(require("fs/promises"), 1);
|
|
10272
|
-
var
|
|
10272
|
+
var path10 = __toESM(require("path"), 1);
|
|
10273
10273
|
var tar = __toESM(require("tar"), 1);
|
|
10274
10274
|
|
|
10275
10275
|
// ../git/dist/git-saga.js
|
|
@@ -10296,14 +10296,14 @@ var CaptureTreeSaga = class extends GitSaga {
|
|
|
10296
10296
|
tempIndexPath = null;
|
|
10297
10297
|
async executeGitOperations(input) {
|
|
10298
10298
|
const { baseDir, lastTreeHash, archivePath, signal } = input;
|
|
10299
|
-
const tmpDir =
|
|
10299
|
+
const tmpDir = path10.join(baseDir, ".git", "posthog-code-tmp");
|
|
10300
10300
|
await this.step({
|
|
10301
10301
|
name: "create_tmp_dir",
|
|
10302
10302
|
execute: () => fs8.mkdir(tmpDir, { recursive: true }),
|
|
10303
10303
|
rollback: async () => {
|
|
10304
10304
|
}
|
|
10305
10305
|
});
|
|
10306
|
-
this.tempIndexPath =
|
|
10306
|
+
this.tempIndexPath = path10.join(tmpDir, `index-${Date.now()}`);
|
|
10307
10307
|
const tempIndexGit = this.git.env({
|
|
10308
10308
|
...process.env,
|
|
10309
10309
|
GIT_INDEX_FILE: this.tempIndexPath
|
|
@@ -10358,14 +10358,14 @@ var CaptureTreeSaga = class extends GitSaga {
|
|
|
10358
10358
|
if (filesToArchive.length === 0) {
|
|
10359
10359
|
return void 0;
|
|
10360
10360
|
}
|
|
10361
|
-
const existingFiles = filesToArchive.filter((f) => (0, import_node_fs3.existsSync)(
|
|
10361
|
+
const existingFiles = filesToArchive.filter((f) => (0, import_node_fs3.existsSync)(path10.join(baseDir, f)));
|
|
10362
10362
|
if (existingFiles.length === 0) {
|
|
10363
10363
|
return void 0;
|
|
10364
10364
|
}
|
|
10365
10365
|
await this.step({
|
|
10366
10366
|
name: "create_archive",
|
|
10367
10367
|
execute: async () => {
|
|
10368
|
-
const archiveDir =
|
|
10368
|
+
const archiveDir = path10.dirname(archivePath);
|
|
10369
10369
|
await fs8.mkdir(archiveDir, { recursive: true });
|
|
10370
10370
|
await tar.create({
|
|
10371
10371
|
gzip: true,
|
|
@@ -10474,7 +10474,7 @@ var ApplyTreeSaga = class extends GitSaga {
|
|
|
10474
10474
|
const filesToExtract = changes.filter((c) => c.status !== "D").map((c) => c.path);
|
|
10475
10475
|
await this.readOnlyStep("backup_existing_files", async () => {
|
|
10476
10476
|
for (const filePath of filesToExtract) {
|
|
10477
|
-
const fullPath =
|
|
10477
|
+
const fullPath = path10.join(baseDir, filePath);
|
|
10478
10478
|
try {
|
|
10479
10479
|
const content = await fs8.readFile(fullPath);
|
|
10480
10480
|
this.fileBackups.set(filePath, content);
|
|
@@ -10493,10 +10493,10 @@ var ApplyTreeSaga = class extends GitSaga {
|
|
|
10493
10493
|
},
|
|
10494
10494
|
rollback: async () => {
|
|
10495
10495
|
for (const filePath of this.extractedFiles) {
|
|
10496
|
-
const fullPath =
|
|
10496
|
+
const fullPath = path10.join(baseDir, filePath);
|
|
10497
10497
|
const backup = this.fileBackups.get(filePath);
|
|
10498
10498
|
if (backup) {
|
|
10499
|
-
const dir =
|
|
10499
|
+
const dir = path10.dirname(fullPath);
|
|
10500
10500
|
await fs8.mkdir(dir, { recursive: true }).catch(() => {
|
|
10501
10501
|
});
|
|
10502
10502
|
await fs8.writeFile(fullPath, backup).catch(() => {
|
|
@@ -10510,7 +10510,7 @@ var ApplyTreeSaga = class extends GitSaga {
|
|
|
10510
10510
|
});
|
|
10511
10511
|
}
|
|
10512
10512
|
for (const change of changes.filter((c) => c.status === "D")) {
|
|
10513
|
-
const fullPath =
|
|
10513
|
+
const fullPath = path10.join(baseDir, change.path);
|
|
10514
10514
|
const backupContent = await this.readOnlyStep(`backup_${change.path}`, async () => {
|
|
10515
10515
|
try {
|
|
10516
10516
|
return await fs8.readFile(fullPath);
|
|
@@ -10526,7 +10526,7 @@ var ApplyTreeSaga = class extends GitSaga {
|
|
|
10526
10526
|
},
|
|
10527
10527
|
rollback: async () => {
|
|
10528
10528
|
if (backupContent) {
|
|
10529
|
-
const dir =
|
|
10529
|
+
const dir = path10.dirname(fullPath);
|
|
10530
10530
|
await fs8.mkdir(dir, { recursive: true }).catch(() => {
|
|
10531
10531
|
});
|
|
10532
10532
|
await fs8.writeFile(fullPath, backupContent).catch(() => {
|