@pourkit/cli 0.0.0-next-20260625073725 → 0.0.0-next-20260625084151
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/cli.js +61 -66
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -10674,6 +10674,50 @@ icm --db .pourkit/icm/memories.db topics # list a
|
|
|
10674
10674
|
<!-- icm:end -->`;
|
|
10675
10675
|
}
|
|
10676
10676
|
|
|
10677
|
+
// shared/managed-block.ts
|
|
10678
|
+
var MANAGED_BLOCK_BEGIN = "<!-- BEGIN POURKIT MANAGED BLOCK -->";
|
|
10679
|
+
var MANAGED_BLOCK_END = "<!-- END POURKIT MANAGED BLOCK -->";
|
|
10680
|
+
var MANAGED_BLOCK_PATTERN = new RegExp(
|
|
10681
|
+
`${escapeRegExp(MANAGED_BLOCK_BEGIN)}\\r?\\n[\\s\\S]*?${escapeRegExp(
|
|
10682
|
+
MANAGED_BLOCK_END
|
|
10683
|
+
)}[ \\t]*(?:\\r?\\n)?`,
|
|
10684
|
+
"g"
|
|
10685
|
+
);
|
|
10686
|
+
function escapeRegExp(value) {
|
|
10687
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
10688
|
+
}
|
|
10689
|
+
function buildManagedBlock(content) {
|
|
10690
|
+
const body = content.endsWith("\n") ? content : `${content}
|
|
10691
|
+
`;
|
|
10692
|
+
return `${MANAGED_BLOCK_BEGIN}
|
|
10693
|
+
${body}${MANAGED_BLOCK_END}
|
|
10694
|
+
`;
|
|
10695
|
+
}
|
|
10696
|
+
function upsertManagedBlock(existing, content) {
|
|
10697
|
+
const blockContent = buildManagedBlock(content);
|
|
10698
|
+
const matches = [...existing.matchAll(MANAGED_BLOCK_PATTERN)];
|
|
10699
|
+
if (matches.length === 0) {
|
|
10700
|
+
if (existing.length === 0) {
|
|
10701
|
+
return blockContent;
|
|
10702
|
+
}
|
|
10703
|
+
const separator = existing.endsWith("\n") ? "\n" : "\n\n";
|
|
10704
|
+
return `${existing}${separator}${blockContent}`;
|
|
10705
|
+
}
|
|
10706
|
+
let next = "";
|
|
10707
|
+
let cursor = 0;
|
|
10708
|
+
for (const [index, match] of matches.entries()) {
|
|
10709
|
+
const start = match.index ?? 0;
|
|
10710
|
+
const end = start + match[0].length;
|
|
10711
|
+
next += existing.slice(cursor, start);
|
|
10712
|
+
if (index === 0) {
|
|
10713
|
+
next += blockContent;
|
|
10714
|
+
}
|
|
10715
|
+
cursor = end;
|
|
10716
|
+
}
|
|
10717
|
+
next += existing.slice(cursor);
|
|
10718
|
+
return next;
|
|
10719
|
+
}
|
|
10720
|
+
|
|
10677
10721
|
// commands/init.ts
|
|
10678
10722
|
var execFileAsync2 = promisify2(execFile2);
|
|
10679
10723
|
var __filename2 = fileURLToPath2(import.meta.url);
|
|
@@ -11930,9 +11974,7 @@ Do not edit this file.
|
|
|
11930
11974
|
reason: "Init AGENTS.md with Pourkit managed block",
|
|
11931
11975
|
requiresConfirmation: false,
|
|
11932
11976
|
destructive: false,
|
|
11933
|
-
content:
|
|
11934
|
-
${managedAgentContent}${MANAGED_BLOCK_END}
|
|
11935
|
-
`
|
|
11977
|
+
content: buildManagedBlock(managedAgentContent)
|
|
11936
11978
|
});
|
|
11937
11979
|
}
|
|
11938
11980
|
const hasExistingClaude = operations.some(
|
|
@@ -11946,9 +11988,7 @@ ${managedAgentContent}${MANAGED_BLOCK_END}
|
|
|
11946
11988
|
reason: "Init CLAUDE.md with Pourkit managed block",
|
|
11947
11989
|
requiresConfirmation: false,
|
|
11948
11990
|
destructive: false,
|
|
11949
|
-
content:
|
|
11950
|
-
${managedAgentContent}${MANAGED_BLOCK_END}
|
|
11951
|
-
`
|
|
11991
|
+
content: buildManagedBlock(managedAgentContent)
|
|
11952
11992
|
});
|
|
11953
11993
|
}
|
|
11954
11994
|
const gitignoreTarget = path5.join(targetRoot, ".gitignore");
|
|
@@ -11961,9 +12001,7 @@ ${managedAgentContent}${MANAGED_BLOCK_END}
|
|
|
11961
12001
|
reason: "Init .gitignore with Pourkit entries",
|
|
11962
12002
|
requiresConfirmation: false,
|
|
11963
12003
|
destructive: false,
|
|
11964
|
-
content:
|
|
11965
|
-
${gitignoreContent}${MANAGED_BLOCK_END}
|
|
11966
|
-
`
|
|
12004
|
+
content: buildManagedBlock(gitignoreContent)
|
|
11967
12005
|
});
|
|
11968
12006
|
} else {
|
|
11969
12007
|
operations.push({
|
|
@@ -12391,29 +12429,15 @@ async function writeFileAtomic(filePath, content) {
|
|
|
12391
12429
|
await writeFile(tmpPath, content, "utf-8");
|
|
12392
12430
|
await rename(tmpPath, filePath);
|
|
12393
12431
|
}
|
|
12394
|
-
var MANAGED_BLOCK_BEGIN = "<!-- BEGIN POURKIT MANAGED BLOCK -->";
|
|
12395
|
-
var MANAGED_BLOCK_END = "<!-- END POURKIT MANAGED BLOCK -->";
|
|
12396
12432
|
async function updateManagedBlock(filePath, content) {
|
|
12397
|
-
const blockContent = `${MANAGED_BLOCK_BEGIN}
|
|
12398
|
-
${content}${MANAGED_BLOCK_END}
|
|
12399
|
-
`;
|
|
12400
12433
|
if (!existsSync16(filePath)) {
|
|
12401
12434
|
const dir = path5.dirname(filePath);
|
|
12402
12435
|
await mkdir4(dir, { recursive: true });
|
|
12403
|
-
await writeFileAtomic(filePath,
|
|
12436
|
+
await writeFileAtomic(filePath, buildManagedBlock(content));
|
|
12404
12437
|
return;
|
|
12405
12438
|
}
|
|
12406
12439
|
const existing = await readFile4(filePath, "utf-8");
|
|
12407
|
-
|
|
12408
|
-
const endIdx = existing.indexOf(MANAGED_BLOCK_END);
|
|
12409
|
-
if (beginIdx !== -1 && endIdx !== -1 && endIdx > beginIdx) {
|
|
12410
|
-
const before = existing.slice(0, beginIdx);
|
|
12411
|
-
const after = existing.slice(endIdx + MANAGED_BLOCK_END.length);
|
|
12412
|
-
await writeFileAtomic(filePath, before + blockContent + after);
|
|
12413
|
-
} else {
|
|
12414
|
-
const suffix = existing.endsWith("\n") ? "" : "\n";
|
|
12415
|
-
await writeFileAtomic(filePath, existing + suffix + blockContent + "\n");
|
|
12416
|
-
}
|
|
12440
|
+
await writeFileAtomic(filePath, upsertManagedBlock(existing, content));
|
|
12417
12441
|
}
|
|
12418
12442
|
async function writeManifest(plan, sourceMeta, agentFiles, packageManager) {
|
|
12419
12443
|
const manifestDir = path5.join(plan.targetRoot, ".pourkit");
|
|
@@ -12917,24 +12941,12 @@ async function runMemoryInitCommand(options) {
|
|
|
12917
12941
|
};
|
|
12918
12942
|
}
|
|
12919
12943
|
function updateManagedBlockSync(filePath, content) {
|
|
12920
|
-
const blockContent = `${MANAGED_BLOCK_BEGIN}
|
|
12921
|
-
${content}${MANAGED_BLOCK_END}
|
|
12922
|
-
`;
|
|
12923
12944
|
if (!existsSync17(filePath)) {
|
|
12924
|
-
writeFileSync5(filePath,
|
|
12945
|
+
writeFileSync5(filePath, buildManagedBlock(content));
|
|
12925
12946
|
return;
|
|
12926
12947
|
}
|
|
12927
12948
|
const existing = readFileSync17(filePath, "utf8");
|
|
12928
|
-
|
|
12929
|
-
const endIdx = existing.indexOf(MANAGED_BLOCK_END);
|
|
12930
|
-
if (beginIdx !== -1 && endIdx !== -1 && endIdx > beginIdx) {
|
|
12931
|
-
const before = existing.slice(0, beginIdx);
|
|
12932
|
-
const after = existing.slice(endIdx + MANAGED_BLOCK_END.length);
|
|
12933
|
-
writeFileSync5(filePath, before + blockContent + after);
|
|
12934
|
-
return;
|
|
12935
|
-
}
|
|
12936
|
-
const suffix = existing.endsWith("\n") ? "" : "\n";
|
|
12937
|
-
writeFileSync5(filePath, `${existing}${suffix}${blockContent}`);
|
|
12949
|
+
writeFileSync5(filePath, upsertManagedBlock(existing, content));
|
|
12938
12950
|
}
|
|
12939
12951
|
|
|
12940
12952
|
// commands/serena.ts
|
|
@@ -13854,8 +13866,6 @@ var PROJECT_OWNED_DIRECTORIES = [
|
|
|
13854
13866
|
".pourkit/handoffs"
|
|
13855
13867
|
];
|
|
13856
13868
|
var OVERRIDES_DIR = ".pourkit/overrides";
|
|
13857
|
-
var MANAGED_BLOCK_BEGIN3 = "<!-- BEGIN POURKIT MANAGED BLOCK -->\n";
|
|
13858
|
-
var MANAGED_BLOCK_END2 = "\n<!-- END POURKIT MANAGED BLOCK -->";
|
|
13859
13869
|
function resolvePackagedManagedPath2(...segments) {
|
|
13860
13870
|
const bundledPath = resolve4(__dirname4, "managed", ...segments);
|
|
13861
13871
|
const sourcePath = resolve4(__dirname4, "..", "managed", ...segments);
|
|
@@ -14158,34 +14168,19 @@ async function runWorkflowPackSyncCommand(options) {
|
|
|
14158
14168
|
} catch {
|
|
14159
14169
|
}
|
|
14160
14170
|
const managedBlockContent = generateManagedBlockContent(configMemory);
|
|
14161
|
-
const fullManagedBlock =
|
|
14171
|
+
const fullManagedBlock = buildManagedBlock(managedBlockContent);
|
|
14162
14172
|
async function syncManagedAgentFile(fileName, options2) {
|
|
14163
14173
|
const filePath = resolve4(cwd, fileName);
|
|
14164
14174
|
if (!existsSync19(filePath)) {
|
|
14165
14175
|
if (!options2.createIfMissing) return false;
|
|
14166
|
-
await writeFile3(filePath, fullManagedBlock
|
|
14176
|
+
await writeFile3(filePath, fullManagedBlock, "utf-8");
|
|
14167
14177
|
return true;
|
|
14168
14178
|
}
|
|
14169
14179
|
const existing = await readFile6(filePath, "utf-8");
|
|
14170
|
-
const
|
|
14171
|
-
|
|
14172
|
-
|
|
14173
|
-
|
|
14174
|
-
const afterBlock = existing.slice(endIdx + MANAGED_BLOCK_END2.length);
|
|
14175
|
-
const newContent = `${beforeBlock}${fullManagedBlock}${afterBlock}`;
|
|
14176
|
-
if (newContent !== existing) {
|
|
14177
|
-
await writeFile3(filePath, newContent, "utf-8");
|
|
14178
|
-
return true;
|
|
14179
|
-
}
|
|
14180
|
-
} else {
|
|
14181
|
-
const newContent = `${existing}
|
|
14182
|
-
|
|
14183
|
-
${fullManagedBlock}
|
|
14184
|
-
`;
|
|
14185
|
-
if (newContent !== existing) {
|
|
14186
|
-
await writeFile3(filePath, newContent, "utf-8");
|
|
14187
|
-
return true;
|
|
14188
|
-
}
|
|
14180
|
+
const newContent = upsertManagedBlock(existing, managedBlockContent);
|
|
14181
|
+
if (newContent !== existing) {
|
|
14182
|
+
await writeFile3(filePath, newContent, "utf-8");
|
|
14183
|
+
return true;
|
|
14189
14184
|
}
|
|
14190
14185
|
return false;
|
|
14191
14186
|
}
|
|
@@ -16133,11 +16128,11 @@ function createCliProgram(version) {
|
|
|
16133
16128
|
return program;
|
|
16134
16129
|
}
|
|
16135
16130
|
async function resolveCliVersion() {
|
|
16136
|
-
if (isPackageVersion("0.0.0-next-
|
|
16137
|
-
return "0.0.0-next-
|
|
16131
|
+
if (isPackageVersion("0.0.0-next-20260625084151")) {
|
|
16132
|
+
return "0.0.0-next-20260625084151";
|
|
16138
16133
|
}
|
|
16139
|
-
if (isReleaseVersion("0.0.0-next-
|
|
16140
|
-
return "0.0.0-next-
|
|
16134
|
+
if (isReleaseVersion("0.0.0-next-20260625084151")) {
|
|
16135
|
+
return "0.0.0-next-20260625084151";
|
|
16141
16136
|
}
|
|
16142
16137
|
try {
|
|
16143
16138
|
const root = repoRoot();
|