@pourkit/cli 0.0.0-next-20260617183635 → 0.0.0-next-20260617195445
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 +83 -89
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -11941,6 +11941,7 @@ import { createHash as createHash2, randomUUID } from "crypto";
|
|
|
11941
11941
|
import path5 from "path";
|
|
11942
11942
|
import { execFile as execFile2 } from "child_process";
|
|
11943
11943
|
import { promisify as promisify2 } from "util";
|
|
11944
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
11944
11945
|
import { confirm, isCancel, log, select, text } from "@clack/prompts";
|
|
11945
11946
|
|
|
11946
11947
|
// providers/github-client.ts
|
|
@@ -12124,7 +12125,17 @@ function buildWorkflowPackMetadata(enabledAddons) {
|
|
|
12124
12125
|
|
|
12125
12126
|
// commands/init.ts
|
|
12126
12127
|
var execFileAsync2 = promisify2(execFile2);
|
|
12128
|
+
var __filename2 = fileURLToPath2(import.meta.url);
|
|
12129
|
+
var __dirname2 = path5.dirname(__filename2);
|
|
12127
12130
|
var RELEASE_ADDON_SKILL_NAMES = ["changeset", "promote-release"];
|
|
12131
|
+
function resolvePackagedSourceRoot() {
|
|
12132
|
+
return path5.resolve(__dirname2, "..");
|
|
12133
|
+
}
|
|
12134
|
+
function resolveSourceAssetPath(sourceRoot, ...segments) {
|
|
12135
|
+
const packagedPath = path5.join(sourceRoot, ...segments);
|
|
12136
|
+
if (existsSync18(packagedPath)) return packagedPath;
|
|
12137
|
+
return path5.join(sourceRoot, "pourkit", ...segments);
|
|
12138
|
+
}
|
|
12128
12139
|
var BASELINE_SKILL_NAMES = [
|
|
12129
12140
|
"code-review",
|
|
12130
12141
|
"diagnose",
|
|
@@ -12690,16 +12701,24 @@ async function checkExistingLabelConflicts(client, canonicalLabels) {
|
|
|
12690
12701
|
}
|
|
12691
12702
|
}
|
|
12692
12703
|
async function planInit(options) {
|
|
12693
|
-
const { targetRoot
|
|
12704
|
+
const { targetRoot } = options;
|
|
12705
|
+
let sourceRoot = options.sourceRoot ?? resolvePackagedSourceRoot();
|
|
12706
|
+
let usingExplicitSource = Boolean(options.sourceRoot);
|
|
12694
12707
|
const operations = [];
|
|
12695
12708
|
const warnings = [];
|
|
12696
12709
|
let hasLabelConflicts = false;
|
|
12697
|
-
|
|
12698
|
-
|
|
12699
|
-
|
|
12700
|
-
|
|
12710
|
+
if (options.sourceRoot) {
|
|
12711
|
+
warnings.push("--from-local is deprecated; omit it to use packaged assets");
|
|
12712
|
+
operations.push({
|
|
12713
|
+
kind: "warn",
|
|
12714
|
+
reason: "--from-local is deprecated; omit it to use packaged assets",
|
|
12715
|
+
destructive: false,
|
|
12716
|
+
requiresConfirmation: false
|
|
12701
12717
|
});
|
|
12702
12718
|
}
|
|
12719
|
+
const managedAgentContent = await generateManagedAgentInstructions({
|
|
12720
|
+
sourceRoot
|
|
12721
|
+
});
|
|
12703
12722
|
const pm = options.packageManager ?? detectPackageManager(targetRoot);
|
|
12704
12723
|
if (pm) {
|
|
12705
12724
|
operations.push({
|
|
@@ -12730,39 +12749,28 @@ async function planInit(options) {
|
|
|
12730
12749
|
const agentFiles = await discoverAgentFiles(targetRoot);
|
|
12731
12750
|
if (agentFiles.length > 0) {
|
|
12732
12751
|
for (const f of agentFiles) {
|
|
12733
|
-
|
|
12734
|
-
|
|
12735
|
-
|
|
12736
|
-
if (agentFileMode === "skip" || agentFileMode === "agents" && basename !== "AGENTS.md" || agentFileMode === "claude" && basename !== "CLAUDE.md") {
|
|
12737
|
-
operations.push({
|
|
12738
|
-
kind: "skip",
|
|
12739
|
-
path: f,
|
|
12740
|
-
ownership: "project-owned",
|
|
12741
|
-
reason: `Existing agent file skipped per policy: ${basename}`,
|
|
12742
|
-
requiresConfirmation: false,
|
|
12743
|
-
destructive: false
|
|
12744
|
-
});
|
|
12745
|
-
continue;
|
|
12746
|
-
}
|
|
12747
|
-
operations.push({
|
|
12748
|
-
kind: "update",
|
|
12749
|
-
path: f,
|
|
12750
|
-
ownership: "managed",
|
|
12751
|
-
reason: `Update existing ${basename} with Pourkit managed block`,
|
|
12752
|
-
requiresConfirmation: false,
|
|
12753
|
-
destructive: false,
|
|
12754
|
-
content: managedAgentContent
|
|
12755
|
-
});
|
|
12756
|
-
} else {
|
|
12752
|
+
const agentFileMode = options.conflictPolicy?.agentFile ?? "both";
|
|
12753
|
+
const basename = path5.basename(f);
|
|
12754
|
+
if (agentFileMode === "skip" || agentFileMode === "agents" && basename !== "AGENTS.md" || agentFileMode === "claude" && basename !== "CLAUDE.md") {
|
|
12757
12755
|
operations.push({
|
|
12758
12756
|
kind: "skip",
|
|
12759
12757
|
path: f,
|
|
12760
12758
|
ownership: "project-owned",
|
|
12761
|
-
reason: `Existing agent file: ${
|
|
12759
|
+
reason: `Existing agent file skipped per policy: ${basename}`,
|
|
12762
12760
|
requiresConfirmation: false,
|
|
12763
12761
|
destructive: false
|
|
12764
12762
|
});
|
|
12763
|
+
continue;
|
|
12765
12764
|
}
|
|
12765
|
+
operations.push({
|
|
12766
|
+
kind: "update",
|
|
12767
|
+
path: f,
|
|
12768
|
+
ownership: "managed",
|
|
12769
|
+
reason: `Update existing ${basename} with Pourkit managed block`,
|
|
12770
|
+
requiresConfirmation: false,
|
|
12771
|
+
destructive: false,
|
|
12772
|
+
content: managedAgentContent
|
|
12773
|
+
});
|
|
12766
12774
|
}
|
|
12767
12775
|
}
|
|
12768
12776
|
const merlleState = await discoverMerlleState(targetRoot);
|
|
@@ -12856,7 +12864,10 @@ async function planInit(options) {
|
|
|
12856
12864
|
destructive: false,
|
|
12857
12865
|
requiresConfirmation: false
|
|
12858
12866
|
});
|
|
12859
|
-
|
|
12867
|
+
sourceRoot = resolvePackagedSourceRoot();
|
|
12868
|
+
usingExplicitSource = false;
|
|
12869
|
+
}
|
|
12870
|
+
{
|
|
12860
12871
|
let sourceMeta;
|
|
12861
12872
|
try {
|
|
12862
12873
|
sourceMeta = await discoverLocalSource(sourceRoot);
|
|
@@ -12869,17 +12880,19 @@ async function planInit(options) {
|
|
|
12869
12880
|
releaseChannel: "unknown",
|
|
12870
12881
|
latestTag: null
|
|
12871
12882
|
};
|
|
12872
|
-
|
|
12873
|
-
|
|
12874
|
-
|
|
12875
|
-
|
|
12876
|
-
|
|
12877
|
-
|
|
12878
|
-
|
|
12879
|
-
|
|
12880
|
-
|
|
12883
|
+
if (usingExplicitSource) {
|
|
12884
|
+
warnings.push(
|
|
12885
|
+
"Source is not a Git repository; version metadata unavailable"
|
|
12886
|
+
);
|
|
12887
|
+
operations.push({
|
|
12888
|
+
kind: "warn",
|
|
12889
|
+
reason: "Source is not a Git repository; version metadata unavailable",
|
|
12890
|
+
destructive: false,
|
|
12891
|
+
requiresConfirmation: false
|
|
12892
|
+
});
|
|
12893
|
+
}
|
|
12881
12894
|
}
|
|
12882
|
-
if (sourceMeta.sourceDirty) {
|
|
12895
|
+
if (usingExplicitSource && sourceMeta.sourceDirty) {
|
|
12883
12896
|
warnings.push("Local source has uncommitted changes");
|
|
12884
12897
|
operations.push({
|
|
12885
12898
|
kind: "warn",
|
|
@@ -12894,15 +12907,13 @@ async function planInit(options) {
|
|
|
12894
12907
|
plannedSkillDests.add(op.path);
|
|
12895
12908
|
}
|
|
12896
12909
|
}
|
|
12897
|
-
const packagedManagedSkills =
|
|
12910
|
+
const packagedManagedSkills = resolveSourceAssetPath(
|
|
12898
12911
|
sourceRoot,
|
|
12899
|
-
"pourkit",
|
|
12900
12912
|
"managed",
|
|
12901
12913
|
"skills"
|
|
12902
12914
|
);
|
|
12903
|
-
const packagedReleaseAddonSkills =
|
|
12915
|
+
const packagedReleaseAddonSkills = resolveSourceAssetPath(
|
|
12904
12916
|
sourceRoot,
|
|
12905
|
-
"pourkit",
|
|
12906
12917
|
"managed",
|
|
12907
12918
|
"addons",
|
|
12908
12919
|
"release",
|
|
@@ -13151,9 +13162,8 @@ async function planInit(options) {
|
|
|
13151
13162
|
destructive: false
|
|
13152
13163
|
});
|
|
13153
13164
|
}
|
|
13154
|
-
const packagedManagedDocAgents =
|
|
13165
|
+
const packagedManagedDocAgents = resolveSourceAssetPath(
|
|
13155
13166
|
sourceRoot,
|
|
13156
|
-
"pourkit",
|
|
13157
13167
|
"managed",
|
|
13158
13168
|
"docs",
|
|
13159
13169
|
"agents"
|
|
@@ -13231,9 +13241,8 @@ Do not edit this file.
|
|
|
13231
13241
|
}
|
|
13232
13242
|
}
|
|
13233
13243
|
if (options.releaseWorkflow?.enabled) {
|
|
13234
|
-
const packagedReleaseAddonDocs =
|
|
13244
|
+
const packagedReleaseAddonDocs = resolveSourceAssetPath(
|
|
13235
13245
|
sourceRoot,
|
|
13236
|
-
"pourkit",
|
|
13237
13246
|
"managed",
|
|
13238
13247
|
"addons",
|
|
13239
13248
|
"release",
|
|
@@ -13267,9 +13276,8 @@ Do not edit this file.
|
|
|
13267
13276
|
}
|
|
13268
13277
|
}
|
|
13269
13278
|
}
|
|
13270
|
-
const packagedManagedPrompts =
|
|
13279
|
+
const packagedManagedPrompts = resolveSourceAssetPath(
|
|
13271
13280
|
sourceRoot,
|
|
13272
|
-
"pourkit",
|
|
13273
13281
|
"managed",
|
|
13274
13282
|
"prompts"
|
|
13275
13283
|
);
|
|
@@ -13369,9 +13377,8 @@ Do not edit this file.
|
|
|
13369
13377
|
"schema",
|
|
13370
13378
|
"pourkit.schema.json"
|
|
13371
13379
|
);
|
|
13372
|
-
const srcSchemaJson =
|
|
13380
|
+
const srcSchemaJson = resolveSourceAssetPath(
|
|
13373
13381
|
sourceRoot,
|
|
13374
|
-
"pourkit",
|
|
13375
13382
|
"schema",
|
|
13376
13383
|
"pourkit.schema.json"
|
|
13377
13384
|
);
|
|
@@ -13405,9 +13412,8 @@ Do not edit this file.
|
|
|
13405
13412
|
"schema",
|
|
13406
13413
|
"pourkit.schema.hash"
|
|
13407
13414
|
);
|
|
13408
|
-
const srcSchemaHash =
|
|
13415
|
+
const srcSchemaHash = resolveSourceAssetPath(
|
|
13409
13416
|
sourceRoot,
|
|
13410
|
-
"pourkit",
|
|
13411
13417
|
"schema",
|
|
13412
13418
|
"pourkit.schema.hash"
|
|
13413
13419
|
);
|
|
@@ -13562,7 +13568,7 @@ ${gitignoreContent}${MANAGED_BLOCK_END}
|
|
|
13562
13568
|
conflict: "already exists"
|
|
13563
13569
|
});
|
|
13564
13570
|
}
|
|
13565
|
-
const sourceLabel = sourceMeta.versionSource === "local-git" ? `Init from local source (${sourceMeta.branch}@${sourceMeta.sha.slice(0, 7)})` : "Init from local source (non-Git)";
|
|
13571
|
+
const sourceLabel = usingExplicitSource ? sourceMeta.versionSource === "local-git" ? `Init from local source (${sourceMeta.branch}@${sourceMeta.sha.slice(0, 7)})` : "Init from local source (non-Git)" : "Init from packaged assets";
|
|
13566
13572
|
operations.push({
|
|
13567
13573
|
kind: "copy",
|
|
13568
13574
|
sourcePath: sourceRoot,
|
|
@@ -13573,18 +13579,10 @@ ${gitignoreContent}${MANAGED_BLOCK_END}
|
|
|
13573
13579
|
destructive: false
|
|
13574
13580
|
});
|
|
13575
13581
|
}
|
|
13576
|
-
} else {
|
|
13577
|
-
warnings.push("No --from-local source provided");
|
|
13578
|
-
operations.push({
|
|
13579
|
-
kind: "warn",
|
|
13580
|
-
reason: "No --from-local source provided",
|
|
13581
|
-
destructive: false,
|
|
13582
|
-
requiresConfirmation: false
|
|
13583
|
-
});
|
|
13584
13582
|
}
|
|
13585
13583
|
return {
|
|
13586
13584
|
targetRoot,
|
|
13587
|
-
sourceRoot
|
|
13585
|
+
sourceRoot,
|
|
13588
13586
|
operations,
|
|
13589
13587
|
warnings,
|
|
13590
13588
|
hasLabelConflicts,
|
|
@@ -13990,7 +13988,7 @@ async function writeManifest(plan, sourceMeta, agentFiles, packageManager) {
|
|
|
13990
13988
|
schemaVersion: 1,
|
|
13991
13989
|
initializedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13992
13990
|
pourkit: {
|
|
13993
|
-
versionSource:
|
|
13991
|
+
versionSource: sourceMeta.versionSource,
|
|
13994
13992
|
releaseVersion: sourceMeta.latestTag,
|
|
13995
13993
|
releaseChannel: sourceMeta.releaseChannel,
|
|
13996
13994
|
sourceBranch: sourceMeta.branch,
|
|
@@ -14185,7 +14183,7 @@ async function applyInitFromSource(options) {
|
|
|
14185
14183
|
}
|
|
14186
14184
|
let sourceMeta;
|
|
14187
14185
|
try {
|
|
14188
|
-
sourceMeta = await discoverLocalSource(
|
|
14186
|
+
sourceMeta = await discoverLocalSource(plan.sourceRoot);
|
|
14189
14187
|
} catch {
|
|
14190
14188
|
sourceMeta = {
|
|
14191
14189
|
versionSource: "local-path",
|
|
@@ -14231,7 +14229,6 @@ async function runInitCommand(options) {
|
|
|
14231
14229
|
}
|
|
14232
14230
|
if (!isInteractive && !options.yes && !options.dryRun) {
|
|
14233
14231
|
const missing = [];
|
|
14234
|
-
if (!options.fromLocal) missing.push("--from-local");
|
|
14235
14232
|
if (!options.docsMigration) missing.push("--docs-migration");
|
|
14236
14233
|
if (!options.agentFile) missing.push("--agent-file");
|
|
14237
14234
|
if (!options.packageManager) {
|
|
@@ -14341,12 +14338,6 @@ ${plan.warnings.length} warning(s) \u2014 review above before applying.`
|
|
|
14341
14338
|
}
|
|
14342
14339
|
return;
|
|
14343
14340
|
}
|
|
14344
|
-
if (!options.fromLocal) {
|
|
14345
|
-
console.error(
|
|
14346
|
-
"\nError: --from-local <path> is required to apply the init plan."
|
|
14347
|
-
);
|
|
14348
|
-
process.exit(1);
|
|
14349
|
-
}
|
|
14350
14341
|
const result = await applyInitFromSource({
|
|
14351
14342
|
targetRoot,
|
|
14352
14343
|
fromLocal: options.fromLocal,
|
|
@@ -14505,14 +14496,14 @@ async function runSerenaStatusCommand(options) {
|
|
|
14505
14496
|
import { readFileSync as readFileSync20, existsSync as existsSync19 } from "fs";
|
|
14506
14497
|
import { mkdir as mkdir6, readFile as readFile6, writeFile as writeFile3, readdir as readdir2 } from "fs/promises";
|
|
14507
14498
|
import { resolve as resolve4, dirname as dirname5, relative as relative2 } from "path";
|
|
14508
|
-
import { fileURLToPath as
|
|
14499
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
14509
14500
|
import Ajv2 from "ajv";
|
|
14510
|
-
var
|
|
14511
|
-
var
|
|
14501
|
+
var __filename3 = fileURLToPath3(import.meta.url);
|
|
14502
|
+
var __dirname3 = dirname5(__filename3);
|
|
14512
14503
|
function resolvePackagedAssetPath2(fileName) {
|
|
14513
14504
|
const candidates = [
|
|
14514
|
-
resolve4(
|
|
14515
|
-
resolve4(
|
|
14505
|
+
resolve4(__dirname3, "schema", fileName),
|
|
14506
|
+
resolve4(__dirname3, "../schema", fileName)
|
|
14516
14507
|
];
|
|
14517
14508
|
return candidates.find((candidate) => existsSync19(candidate)) ?? candidates[0];
|
|
14518
14509
|
}
|
|
@@ -14544,7 +14535,7 @@ function localSchemaDir(repoRoot2) {
|
|
|
14544
14535
|
var MANAGED_BLOCK_BEGIN2 = "<!-- BEGIN POURKIT MANAGED BLOCK -->\n";
|
|
14545
14536
|
var OLD_DOCS_PATH_PATTERN = ".pourkit/docs/agents/";
|
|
14546
14537
|
function resolvePackagedManagedPath(...segments) {
|
|
14547
|
-
return resolve4(
|
|
14538
|
+
return resolve4(__dirname3, "..", "managed", ...segments);
|
|
14548
14539
|
}
|
|
14549
14540
|
function resolvePackagedManagedDocPath(docName) {
|
|
14550
14541
|
return resolvePackagedManagedPath("docs", "agents", docName);
|
|
@@ -15211,9 +15202,9 @@ async function runConfigSyncSchemaCommand(options) {
|
|
|
15211
15202
|
import { existsSync as existsSync20, readdirSync as readdirSync5 } from "fs";
|
|
15212
15203
|
import { mkdir as mkdir7, readFile as readFile7, writeFile as writeFile4, readdir as readdir3 } from "fs/promises";
|
|
15213
15204
|
import { resolve as resolve5, dirname as dirname6, relative as relative3, normalize as normalize2 } from "path";
|
|
15214
|
-
import { fileURLToPath as
|
|
15215
|
-
var
|
|
15216
|
-
var
|
|
15205
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
15206
|
+
var __filename4 = fileURLToPath4(import.meta.url);
|
|
15207
|
+
var __dirname4 = dirname6(__filename4);
|
|
15217
15208
|
var PROJECT_OWNED_PATHS = [".pourkit/CONTEXT.md", ".pourkit/CONTEXT-MAP.md"];
|
|
15218
15209
|
var PROJECT_OWNED_DIRECTORIES = [
|
|
15219
15210
|
".pourkit/docs/adr",
|
|
@@ -15224,7 +15215,7 @@ var OVERRIDES_DIR = ".pourkit/overrides";
|
|
|
15224
15215
|
var MANAGED_BLOCK_BEGIN3 = "<!-- BEGIN POURKIT MANAGED BLOCK -->\n";
|
|
15225
15216
|
var MANAGED_BLOCK_END2 = "\n<!-- END POURKIT MANAGED BLOCK -->";
|
|
15226
15217
|
function resolvePackagedManagedPath2(...segments) {
|
|
15227
|
-
const candidates = [resolve5(
|
|
15218
|
+
const candidates = [resolve5(__dirname4, "..", "managed", ...segments)];
|
|
15228
15219
|
return candidates[0];
|
|
15229
15220
|
}
|
|
15230
15221
|
function resolvePackagedManagedDocPath2(docName) {
|
|
@@ -17193,7 +17184,10 @@ function createCliProgram(version) {
|
|
|
17193
17184
|
const result = runPrdRunListCommand({ repoRoot: targetRepoRoot });
|
|
17194
17185
|
console.log(JSON.stringify(result, null, 2));
|
|
17195
17186
|
});
|
|
17196
|
-
program.command("init").description("Initialize .pourkit layout in a target repo").option("--dry-run", "print the init plan without applying changes").option("--json", "output machine-readable JSON plan").option(
|
|
17187
|
+
program.command("init").description("Initialize .pourkit layout in a target repo").option("--dry-run", "print the init plan without applying changes").option("--json", "output machine-readable JSON plan").option(
|
|
17188
|
+
"--from-local <path>",
|
|
17189
|
+
"deprecated: local source repo to copy artifacts from"
|
|
17190
|
+
).option("--cwd <path>", "target repository directory").addOption(
|
|
17197
17191
|
new Option(
|
|
17198
17192
|
"--docs-migration <mode>",
|
|
17199
17193
|
"docs migration mode: copy, move, skip"
|
|
@@ -17392,11 +17386,11 @@ function createCliProgram(version) {
|
|
|
17392
17386
|
return program;
|
|
17393
17387
|
}
|
|
17394
17388
|
async function resolveCliVersion() {
|
|
17395
|
-
if (isPackageVersion("0.0.0-next-
|
|
17396
|
-
return "0.0.0-next-
|
|
17389
|
+
if (isPackageVersion("0.0.0-next-20260617195445")) {
|
|
17390
|
+
return "0.0.0-next-20260617195445";
|
|
17397
17391
|
}
|
|
17398
|
-
if (isReleaseVersion("0.0.0-next-
|
|
17399
|
-
return "0.0.0-next-
|
|
17392
|
+
if (isReleaseVersion("0.0.0-next-20260617195445")) {
|
|
17393
|
+
return "0.0.0-next-20260617195445";
|
|
17400
17394
|
}
|
|
17401
17395
|
try {
|
|
17402
17396
|
const root = repoRoot();
|