@pieai/pro-gov 0.9.7 → 0.9.9
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 +71 -48
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -2318,8 +2318,10 @@ function pathExistsEvenIfDanglingSymlink3(path) {
|
|
|
2318
2318
|
}
|
|
2319
2319
|
|
|
2320
2320
|
// src/asset-targets/check.ts
|
|
2321
|
-
import { existsSync as existsSync10, lstatSync as lstatSync5, readFileSync as readFileSync6, realpathSync as realpathSync4 } from "node:fs";
|
|
2322
|
-
import { join as join10 } from "node:path";
|
|
2321
|
+
import { existsSync as existsSync10, lstatSync as lstatSync5, readFileSync as readFileSync6, readlinkSync as readlinkSync3, realpathSync as realpathSync4 } from "node:fs";
|
|
2322
|
+
import { join as join10, relative as relative7, resolve as resolve4 } from "node:path";
|
|
2323
|
+
var SHARED_RULE_PATH_PREFIX = "docs/policy/shared-rules/";
|
|
2324
|
+
var PGS_SHARED_RULE_TARGET_PATTERN = /^(?:\.\.\/)+ProjectGovernanceSystem\/agent-assets\/rules\/pie-rules\/([^/]+\.md)$/;
|
|
2323
2325
|
function checkInstalledAssets(options) {
|
|
2324
2326
|
const lockfilePath = join10(options.targetDir, ".pro-gov/assets.lock.json");
|
|
2325
2327
|
if (!existsSync10(lockfilePath)) {
|
|
@@ -2366,6 +2368,7 @@ function checkInstalledAssets(options) {
|
|
|
2366
2368
|
const targetAbsolutePath = join10(options.targetDir, entry.targetPath);
|
|
2367
2369
|
const delivery = entry.delivery ?? "symlink";
|
|
2368
2370
|
const portableDeferredSkill = delivery === "symlink" && !strictRegistry && isProjectSkillTarget(entry.targetPath);
|
|
2371
|
+
const portableDeferredSharedRule = delivery === "symlink" && !strictRegistry && isPortableManagedSharedRuleSymlink(options.targetDir, targetAbsolutePath);
|
|
2369
2372
|
if (delivery !== "symlink" && delivery !== "snapshot") {
|
|
2370
2373
|
issues.push({
|
|
2371
2374
|
type: "unsupported-delivery",
|
|
@@ -2416,7 +2419,7 @@ function checkInstalledAssets(options) {
|
|
|
2416
2419
|
}
|
|
2417
2420
|
}
|
|
2418
2421
|
if (!pathExistsEvenIfDanglingSymlink4(targetAbsolutePath)) {
|
|
2419
|
-
if (portableDeferredSkill) continue;
|
|
2422
|
+
if (portableDeferredSkill || portableDeferredSharedRule) continue;
|
|
2420
2423
|
issues.push({
|
|
2421
2424
|
type: "missing-target",
|
|
2422
2425
|
id: entry.id,
|
|
@@ -2445,7 +2448,7 @@ function checkInstalledAssets(options) {
|
|
|
2445
2448
|
continue;
|
|
2446
2449
|
}
|
|
2447
2450
|
if (delivery === "symlink" && !existsSync10(targetAbsolutePath)) {
|
|
2448
|
-
if (portableDeferredSkill) continue;
|
|
2451
|
+
if (portableDeferredSkill || portableDeferredSharedRule) continue;
|
|
2449
2452
|
issues.push({
|
|
2450
2453
|
type: "dangling-symlink",
|
|
2451
2454
|
id: entry.id,
|
|
@@ -2585,6 +2588,26 @@ function pathExistsEvenIfDanglingSymlink4(path) {
|
|
|
2585
2588
|
function isProjectSkillTarget(targetPath) {
|
|
2586
2589
|
return targetPath.startsWith(".agents/skills/") || targetPath.startsWith(".agents/manual-skills/");
|
|
2587
2590
|
}
|
|
2591
|
+
function isPortableManagedSharedRuleSymlink(targetDir, candidatePath) {
|
|
2592
|
+
const repoPath = relative7(resolve4(targetDir), resolve4(candidatePath)).split(/\\/g).join("/");
|
|
2593
|
+
if (!repoPath.startsWith(SHARED_RULE_PATH_PREFIX)) return false;
|
|
2594
|
+
const filename = repoPath.slice(SHARED_RULE_PATH_PREFIX.length);
|
|
2595
|
+
if (!filename || filename.includes("/") || !filename.endsWith(".md")) return false;
|
|
2596
|
+
let stats;
|
|
2597
|
+
try {
|
|
2598
|
+
stats = lstatSync5(candidatePath);
|
|
2599
|
+
} catch {
|
|
2600
|
+
return false;
|
|
2601
|
+
}
|
|
2602
|
+
if (!stats.isSymbolicLink() || existsSync10(candidatePath)) return false;
|
|
2603
|
+
try {
|
|
2604
|
+
const target = normalizeSymlinkTarget(readlinkSync3(candidatePath));
|
|
2605
|
+
const match = target.match(PGS_SHARED_RULE_TARGET_PATTERN);
|
|
2606
|
+
return match?.[1] === filename;
|
|
2607
|
+
} catch {
|
|
2608
|
+
return false;
|
|
2609
|
+
}
|
|
2610
|
+
}
|
|
2588
2611
|
|
|
2589
2612
|
// src/asset-targets/recommend.ts
|
|
2590
2613
|
import { existsSync as existsSync11, readdirSync as readdirSync7, readFileSync as readFileSync7 } from "node:fs";
|
|
@@ -3521,7 +3544,7 @@ function readFlag(args, flag) {
|
|
|
3521
3544
|
|
|
3522
3545
|
// src/commands/host-lens.ts
|
|
3523
3546
|
import { mkdirSync as mkdirSync7, writeFileSync as writeFileSync6 } from "node:fs";
|
|
3524
|
-
import { dirname as dirname11, resolve as
|
|
3547
|
+
import { dirname as dirname11, resolve as resolve7 } from "node:path";
|
|
3525
3548
|
|
|
3526
3549
|
// src/host-lens.ts
|
|
3527
3550
|
import { execFileSync } from "node:child_process";
|
|
@@ -3535,7 +3558,7 @@ import {
|
|
|
3535
3558
|
writeFileSync as writeFileSync5
|
|
3536
3559
|
} from "node:fs";
|
|
3537
3560
|
import { homedir } from "node:os";
|
|
3538
|
-
import { dirname as dirname9, join as join15, relative as
|
|
3561
|
+
import { dirname as dirname9, join as join15, relative as relative8, resolve as resolve5 } from "node:path";
|
|
3539
3562
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
3540
3563
|
var ROOT_DEFINITIONS = [
|
|
3541
3564
|
{
|
|
@@ -3617,7 +3640,7 @@ var ROOT_DEFINITIONS = [
|
|
|
3617
3640
|
}
|
|
3618
3641
|
];
|
|
3619
3642
|
function inspectHost(options = {}) {
|
|
3620
|
-
const homePath =
|
|
3643
|
+
const homePath = resolve5(options.homeDir ?? homedir());
|
|
3621
3644
|
const now = options.now ?? /* @__PURE__ */ new Date();
|
|
3622
3645
|
const rootPaths = ROOT_DEFINITIONS.map((definition) => join15(homePath, definition.relativePath));
|
|
3623
3646
|
const rootSizes = measurePaths(rootPaths);
|
|
@@ -3930,7 +3953,7 @@ function matchingChildren(root, predicate) {
|
|
|
3930
3953
|
}
|
|
3931
3954
|
}
|
|
3932
3955
|
function measurePaths(paths) {
|
|
3933
|
-
const uniquePaths = [...new Set(paths.map((path) =>
|
|
3956
|
+
const uniquePaths = [...new Set(paths.map((path) => resolve5(path)))].filter(
|
|
3934
3957
|
(path) => existsSync14(path)
|
|
3935
3958
|
);
|
|
3936
3959
|
const result = /* @__PURE__ */ new Map();
|
|
@@ -3944,7 +3967,7 @@ function measurePaths(paths) {
|
|
|
3944
3967
|
for (const line of output.split(/\r?\n/)) {
|
|
3945
3968
|
const match = line.match(/^(\d+)\s+(.+)$/);
|
|
3946
3969
|
if (!match) continue;
|
|
3947
|
-
result.set(
|
|
3970
|
+
result.set(resolve5(match[2]), Number(match[1]) * 1024);
|
|
3948
3971
|
}
|
|
3949
3972
|
return result;
|
|
3950
3973
|
} catch {
|
|
@@ -3994,8 +4017,8 @@ function countImmediateEntries(path) {
|
|
|
3994
4017
|
}
|
|
3995
4018
|
}
|
|
3996
4019
|
function displayPath(path, homePath) {
|
|
3997
|
-
const absolute =
|
|
3998
|
-
const withinHome =
|
|
4020
|
+
const absolute = resolve5(path);
|
|
4021
|
+
const withinHome = relative8(homePath, absolute);
|
|
3999
4022
|
if (withinHome === "") return "~";
|
|
4000
4023
|
if (!withinHome.startsWith("..")) return `~/${withinHome.replaceAll("\\", "/")}`;
|
|
4001
4024
|
return absolute;
|
|
@@ -4003,7 +4026,7 @@ function displayPath(path, homePath) {
|
|
|
4003
4026
|
function undisplayPath(path, homePath) {
|
|
4004
4027
|
if (path === "~") return homePath;
|
|
4005
4028
|
if (path.startsWith("~/")) return join15(homePath, path.slice(2));
|
|
4006
|
-
return
|
|
4029
|
+
return resolve5(path);
|
|
4007
4030
|
}
|
|
4008
4031
|
function findHostDashboardAssets() {
|
|
4009
4032
|
const packageRoot2 = dirname9(dirname9(fileURLToPath3(import.meta.url)));
|
|
@@ -4029,7 +4052,7 @@ function safeJavaScriptJson(value) {
|
|
|
4029
4052
|
|
|
4030
4053
|
// src/portfolio/manifest.ts
|
|
4031
4054
|
import { existsSync as existsSync15, readFileSync as readFileSync10 } from "node:fs";
|
|
4032
|
-
import { dirname as dirname10, isAbsolute as isAbsolute4, resolve as
|
|
4055
|
+
import { dirname as dirname10, isAbsolute as isAbsolute4, resolve as resolve6 } from "node:path";
|
|
4033
4056
|
function loadPortfolioManifest(configPath) {
|
|
4034
4057
|
let parsed;
|
|
4035
4058
|
try {
|
|
@@ -4045,7 +4068,7 @@ function loadPortfolioManifest(configPath) {
|
|
|
4045
4068
|
]
|
|
4046
4069
|
};
|
|
4047
4070
|
}
|
|
4048
|
-
const normalized = resolveManifestPaths(parsed, dirname10(
|
|
4071
|
+
const normalized = resolveManifestPaths(parsed, dirname10(resolve6(configPath)));
|
|
4049
4072
|
const issues = validatePortfolioManifest(normalized);
|
|
4050
4073
|
return {
|
|
4051
4074
|
configPath,
|
|
@@ -4059,13 +4082,13 @@ function resolveManifestPaths(value, configDir) {
|
|
|
4059
4082
|
if (!isRecord(endpoint) || typeof endpoint.path !== "string" || isAbsolute4(endpoint.path)) {
|
|
4060
4083
|
return endpoint;
|
|
4061
4084
|
}
|
|
4062
|
-
return { ...endpoint, path:
|
|
4085
|
+
return { ...endpoint, path: resolve6(configDir, endpoint.path) };
|
|
4063
4086
|
};
|
|
4064
4087
|
return {
|
|
4065
4088
|
...value,
|
|
4066
4089
|
technologyGovernance: isRecord(value.technologyGovernance) && typeof value.technologyGovernance.strategySource === "string" && !isAbsolute4(value.technologyGovernance.strategySource) ? {
|
|
4067
4090
|
...value.technologyGovernance,
|
|
4068
|
-
strategySource:
|
|
4091
|
+
strategySource: resolve6(configDir, value.technologyGovernance.strategySource)
|
|
4069
4092
|
} : value.technologyGovernance,
|
|
4070
4093
|
controlPlane: resolveEndpoint(value.controlPlane),
|
|
4071
4094
|
executionEngine: resolveEndpoint(value.executionEngine),
|
|
@@ -4985,7 +5008,7 @@ function runScan(options) {
|
|
|
4985
5008
|
const inspection = resolveInspectionOptions(options);
|
|
4986
5009
|
if (!inspection.ok) return reportConfigError(inspection.error);
|
|
4987
5010
|
const report = inspectHost(inspection.value);
|
|
4988
|
-
const written = writeHostLensReport(report,
|
|
5011
|
+
const written = writeHostLensReport(report, resolve7(options.outPath));
|
|
4989
5012
|
if (options.json) {
|
|
4990
5013
|
console.log(JSON.stringify({ ok: true, ...written, summary: report.summary }, null, 2));
|
|
4991
5014
|
} else {
|
|
@@ -5005,7 +5028,7 @@ function runPlan(options) {
|
|
|
5005
5028
|
if (!inspection.ok) return reportConfigError(inspection.error);
|
|
5006
5029
|
const report = inspectHost(inspection.value);
|
|
5007
5030
|
const plan = createHostLensCleanupPlan(report);
|
|
5008
|
-
const outPath =
|
|
5031
|
+
const outPath = resolve7(options.outPath);
|
|
5009
5032
|
mkdirSync7(dirname11(outPath), { recursive: true });
|
|
5010
5033
|
writeFileSync6(outPath, `${JSON.stringify(plan, null, 2)}
|
|
5011
5034
|
`);
|
|
@@ -5080,7 +5103,7 @@ function parseOptions(args) {
|
|
|
5080
5103
|
if (arg === "--home") {
|
|
5081
5104
|
const value = args[index + 1];
|
|
5082
5105
|
if (!value) return { ok: false, error: "Expected value after --home" };
|
|
5083
|
-
options.homeDir =
|
|
5106
|
+
options.homeDir = resolve7(value);
|
|
5084
5107
|
index += 1;
|
|
5085
5108
|
continue;
|
|
5086
5109
|
}
|
|
@@ -5094,7 +5117,7 @@ function parseOptions(args) {
|
|
|
5094
5117
|
if (arg === "--config") {
|
|
5095
5118
|
const value = args[index + 1];
|
|
5096
5119
|
if (!value) return { ok: false, error: "Expected value after --config" };
|
|
5097
|
-
options.configPath =
|
|
5120
|
+
options.configPath = resolve7(value);
|
|
5098
5121
|
index += 1;
|
|
5099
5122
|
continue;
|
|
5100
5123
|
}
|
|
@@ -5121,7 +5144,7 @@ function printUsage2() {
|
|
|
5121
5144
|
|
|
5122
5145
|
// src/learning/recall.ts
|
|
5123
5146
|
import { existsSync as existsSync16, readdirSync as readdirSync9, readFileSync as readFileSync11 } from "node:fs";
|
|
5124
|
-
import { basename as basename4, join as join16, relative as
|
|
5147
|
+
import { basename as basename4, join as join16, relative as relative9 } from "node:path";
|
|
5125
5148
|
function recallLearnings(root, options) {
|
|
5126
5149
|
const query = options.query.trim();
|
|
5127
5150
|
const terms = tokenize(query);
|
|
@@ -5176,7 +5199,7 @@ function readLearningRecord(root, absolutePath) {
|
|
|
5176
5199
|
const parsed = splitFrontmatter(content);
|
|
5177
5200
|
const body = parsed.body;
|
|
5178
5201
|
return {
|
|
5179
|
-
relativePath: normalizePath(
|
|
5202
|
+
relativePath: normalizePath(relative9(root, absolutePath)),
|
|
5180
5203
|
title: findTitle(parsed.frontmatter, body) ?? titleFromPath(absolutePath),
|
|
5181
5204
|
metadata: parsed.frontmatter,
|
|
5182
5205
|
body
|
|
@@ -5258,7 +5281,7 @@ function cleanMarkdownLine(input) {
|
|
|
5258
5281
|
|
|
5259
5282
|
// src/learning/capture.ts
|
|
5260
5283
|
import { existsSync as existsSync17, mkdirSync as mkdirSync8, writeFileSync as writeFileSync7 } from "node:fs";
|
|
5261
|
-
import { basename as basename5, join as join17, relative as
|
|
5284
|
+
import { basename as basename5, join as join17, relative as relative10 } from "node:path";
|
|
5262
5285
|
function captureLearning(root, options) {
|
|
5263
5286
|
const title = options.title.trim();
|
|
5264
5287
|
const summary = options.summary.trim();
|
|
@@ -5272,7 +5295,7 @@ function captureLearning(root, options) {
|
|
|
5272
5295
|
const idSlug = basename5(path, ".md");
|
|
5273
5296
|
writeFileSync7(path, renderLearning({ title, summary, category, moduleName, idSlug }));
|
|
5274
5297
|
return {
|
|
5275
|
-
relativePath: normalizePath2(
|
|
5298
|
+
relativePath: normalizePath2(relative10(root, path)),
|
|
5276
5299
|
title,
|
|
5277
5300
|
captureMode: "pgs-native"
|
|
5278
5301
|
};
|
|
@@ -5896,8 +5919,8 @@ import { homedir as homedir3 } from "node:os";
|
|
|
5896
5919
|
import { join as join23 } from "node:path";
|
|
5897
5920
|
|
|
5898
5921
|
// src/host-ssot.ts
|
|
5899
|
-
import { lstatSync as lstatSync8, readlinkSync as
|
|
5900
|
-
import { dirname as dirname13, isAbsolute as isAbsolute5, join as join19, resolve as
|
|
5922
|
+
import { lstatSync as lstatSync8, readlinkSync as readlinkSync4, realpathSync as realpathSync5 } from "node:fs";
|
|
5923
|
+
import { dirname as dirname13, isAbsolute as isAbsolute5, join as join19, resolve as resolve8 } from "node:path";
|
|
5901
5924
|
function inspectProjectHostSsot(root) {
|
|
5902
5925
|
const agentsEntry = inspectCanonicalPath(root, "AGENTS.md");
|
|
5903
5926
|
const canonicalSkills = inspectCanonicalPath(root, ".agents/skills");
|
|
@@ -5966,9 +5989,9 @@ function inspectCompatibilityLink(root, path, expectedRawTarget) {
|
|
|
5966
5989
|
if (stat.isDirectory()) return { ...base, status: "directory" };
|
|
5967
5990
|
return { ...base, status: "other" };
|
|
5968
5991
|
}
|
|
5969
|
-
const rawTarget = normalizeSymlinkTarget(
|
|
5970
|
-
const resolvedTarget =
|
|
5971
|
-
const expectedPath =
|
|
5992
|
+
const rawTarget = normalizeSymlinkTarget(readlinkSync4(absolutePath));
|
|
5993
|
+
const resolvedTarget = resolve8(dirname13(absolutePath), rawTarget);
|
|
5994
|
+
const expectedPath = resolve8(dirname13(absolutePath), expectedRawTarget);
|
|
5972
5995
|
const targetStat = safeLstat2(resolvedTarget);
|
|
5973
5996
|
if (!targetStat) {
|
|
5974
5997
|
return {
|
|
@@ -6174,7 +6197,7 @@ function readPackageJson(path) {
|
|
|
6174
6197
|
// src/repository-files.ts
|
|
6175
6198
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
6176
6199
|
import { existsSync as existsSync21, readdirSync as readdirSync11 } from "node:fs";
|
|
6177
|
-
import { isAbsolute as isAbsolute6, join as join22, posix as posix3, relative as
|
|
6200
|
+
import { isAbsolute as isAbsolute6, join as join22, posix as posix3, relative as relative11 } from "node:path";
|
|
6178
6201
|
var gitMaxBufferBytes = 64 * 1024 * 1024;
|
|
6179
6202
|
var RepositoryFileDiscoveryError = class extends Error {
|
|
6180
6203
|
constructor(message) {
|
|
@@ -6242,7 +6265,7 @@ function discoverFilesystemFiles(root, options) {
|
|
|
6242
6265
|
continue;
|
|
6243
6266
|
}
|
|
6244
6267
|
if (!entry.isFile()) continue;
|
|
6245
|
-
const relativePath = normalizeRepositoryRelativePath(
|
|
6268
|
+
const relativePath = normalizeRepositoryRelativePath(relative11(root, absolutePath));
|
|
6246
6269
|
if (isSafeRepositoryRelativePath(relativePath) && (options.fallbackIncludeFile?.(relativePath) ?? true)) {
|
|
6247
6270
|
files.add(relativePath);
|
|
6248
6271
|
}
|
|
@@ -7088,7 +7111,7 @@ function deduplicateIssues(issues) {
|
|
|
7088
7111
|
|
|
7089
7112
|
// src/portfolio/ai-health/index.ts
|
|
7090
7113
|
import { homedir as homedir5 } from "node:os";
|
|
7091
|
-
import { dirname as dirname18, join as join34, resolve as
|
|
7114
|
+
import { dirname as dirname18, join as join34, resolve as resolve11 } from "node:path";
|
|
7092
7115
|
|
|
7093
7116
|
// src/portfolio/ai-health/entries.ts
|
|
7094
7117
|
import { existsSync as existsSync27, lstatSync as lstatSync12, realpathSync as realpathSync7 } from "node:fs";
|
|
@@ -7394,11 +7417,11 @@ function inspectGit2(root) {
|
|
|
7394
7417
|
|
|
7395
7418
|
// src/portfolio/ai-health/hosts.ts
|
|
7396
7419
|
import { existsSync as existsSync29 } from "node:fs";
|
|
7397
|
-
import { join as join29, resolve as
|
|
7420
|
+
import { join as join29, resolve as resolve10, sep as sep3 } from "node:path";
|
|
7398
7421
|
|
|
7399
7422
|
// src/portfolio/ai-health/devspace.ts
|
|
7400
7423
|
import { existsSync as existsSync28, statSync as statSync9 } from "node:fs";
|
|
7401
|
-
import { join as join28, relative as
|
|
7424
|
+
import { join as join28, relative as relative12, resolve as resolve9, sep as sep2 } from "node:path";
|
|
7402
7425
|
function inspectDevSpaceHealth(options) {
|
|
7403
7426
|
const run = options.run ?? runDevSpaceCommand;
|
|
7404
7427
|
const configDirectory = join28(options.homeDir, ".devspace");
|
|
@@ -7498,7 +7521,7 @@ function isLoopbackHost(host) {
|
|
|
7498
7521
|
return ["127.0.0.1", "localhost", "::1"].includes(host.trim().toLowerCase());
|
|
7499
7522
|
}
|
|
7500
7523
|
function isPathInside(path, root) {
|
|
7501
|
-
const fromRoot =
|
|
7524
|
+
const fromRoot = relative12(resolve9(root), resolve9(path));
|
|
7502
7525
|
return fromRoot === "" || fromRoot !== ".." && !fromRoot.startsWith(`..${sep2}`);
|
|
7503
7526
|
}
|
|
7504
7527
|
|
|
@@ -7560,11 +7583,11 @@ function claudeProjectLocalMcpNames(homeDir, root) {
|
|
|
7560
7583
|
const value = readJson4(join29(homeDir, MCP_DISCOVERY_PATHS.user.claudeCode));
|
|
7561
7584
|
if (!isRecord3(value) || !isRecord3(value.projects)) return [];
|
|
7562
7585
|
const candidates = new Set(
|
|
7563
|
-
[
|
|
7586
|
+
[resolve10(root), safeRealpath(root)].filter((path) => Boolean(path))
|
|
7564
7587
|
);
|
|
7565
7588
|
const names = /* @__PURE__ */ new Set();
|
|
7566
7589
|
for (const [path, project] of Object.entries(value.projects)) {
|
|
7567
|
-
const projectPaths = [
|
|
7590
|
+
const projectPaths = [resolve10(path), safeRealpath(path)].filter(
|
|
7568
7591
|
(candidate) => Boolean(candidate)
|
|
7569
7592
|
);
|
|
7570
7593
|
if (!projectPaths.some((candidate) => candidates.has(candidate)) || !isRecord3(project) || !isRecord3(project.mcpServers))
|
|
@@ -7663,23 +7686,23 @@ function inferGrokMcpScope(name, sourceType, sourcePath, root, homeDir, userClau
|
|
|
7663
7686
|
if (userClaudeNames.has(name)) return "user";
|
|
7664
7687
|
return "unknown";
|
|
7665
7688
|
}
|
|
7666
|
-
const resolvedSource = safeRealpath(sourcePath) ??
|
|
7667
|
-
const resolvedRoot = safeRealpath(root) ??
|
|
7689
|
+
const resolvedSource = safeRealpath(sourcePath) ?? resolve10(sourcePath);
|
|
7690
|
+
const resolvedRoot = safeRealpath(root) ?? resolve10(root);
|
|
7668
7691
|
if (resolvedSource === join29(resolvedRoot, MCP_DISCOVERY_PATHS.project.claudeCodeShared))
|
|
7669
7692
|
return "project-shared";
|
|
7670
7693
|
if (resolvedSource.startsWith(resolvedRoot + sep3)) return "project";
|
|
7671
|
-
if (homeDir && resolvedSource === join29(
|
|
7694
|
+
if (homeDir && resolvedSource === join29(resolve10(homeDir), MCP_DISCOVERY_PATHS.user.claudeCode)) {
|
|
7672
7695
|
if (localClaudeNames.has(name)) return "project-local";
|
|
7673
7696
|
if (userClaudeNames.has(name)) return "user";
|
|
7674
7697
|
}
|
|
7675
|
-
if (homeDir && resolvedSource.startsWith(
|
|
7698
|
+
if (homeDir && resolvedSource.startsWith(resolve10(homeDir) + sep3)) return "user";
|
|
7676
7699
|
if (sourceType === "project") return "project";
|
|
7677
7700
|
return "unknown";
|
|
7678
7701
|
}
|
|
7679
7702
|
|
|
7680
7703
|
// src/portfolio/ai-health/secrets.ts
|
|
7681
7704
|
import { existsSync as existsSync30, lstatSync as lstatSync13, readdirSync as readdirSync13, statSync as statSync10 } from "node:fs";
|
|
7682
|
-
import { join as join30, relative as
|
|
7705
|
+
import { join as join30, relative as relative13, sep as sep4 } from "node:path";
|
|
7683
7706
|
var supportsPosixModes = process.platform !== "win32";
|
|
7684
7707
|
function inspectRepositorySecrets(root, id, secretsRoot, isRepository, environmentPolicy) {
|
|
7685
7708
|
const centralPath = join30(secretsRoot, id);
|
|
@@ -7731,7 +7754,7 @@ function collectEnvironmentFiles(root, current = root, depth = 0) {
|
|
|
7731
7754
|
if (!SKIP_ENV_DIRECTORIES.has(entry.name))
|
|
7732
7755
|
found.push(...collectEnvironmentFiles(root, join30(current, entry.name), depth + 1));
|
|
7733
7756
|
} else if (isEnvironmentFilename(entry.name) && !isProviderGeneratedEnvironmentFile(entry.name)) {
|
|
7734
|
-
found.push(
|
|
7757
|
+
found.push(relative13(root, join30(current, entry.name)).replaceAll("\\", "/"));
|
|
7735
7758
|
}
|
|
7736
7759
|
}
|
|
7737
7760
|
} catch {
|
|
@@ -7748,7 +7771,7 @@ function collectCentralSecretFiles(root, current = root, depth = 0) {
|
|
|
7748
7771
|
if (entry.isDirectory()) found.push(...collectCentralSecretFiles(root, path, depth + 1));
|
|
7749
7772
|
else
|
|
7750
7773
|
found.push({
|
|
7751
|
-
path:
|
|
7774
|
+
path: relative13(root, path).replaceAll("\\", "/"),
|
|
7752
7775
|
mode: supportsPosixModes ? modeString(lstatSync13(path).mode) : "unknown"
|
|
7753
7776
|
});
|
|
7754
7777
|
}
|
|
@@ -7777,7 +7800,7 @@ function pointsInside(path, expectedRoot) {
|
|
|
7777
7800
|
if (!expectedRoot || !lstatSync13(path).isSymbolicLink()) return false;
|
|
7778
7801
|
const target = safeRealpath(path);
|
|
7779
7802
|
if (!target) return false;
|
|
7780
|
-
const fromRoot =
|
|
7803
|
+
const fromRoot = relative13(expectedRoot, target);
|
|
7781
7804
|
return fromRoot === "" || fromRoot !== ".." && !fromRoot.startsWith(`..${sep4}`);
|
|
7782
7805
|
}
|
|
7783
7806
|
function hasUnsafeCentralSecretPermissions(secrets) {
|
|
@@ -8366,7 +8389,7 @@ function collectEndpoints(manifest) {
|
|
|
8366
8389
|
for (const target of manifest.targets) result.push({ endpoint: target, role: "target" });
|
|
8367
8390
|
const seen = /* @__PURE__ */ new Set();
|
|
8368
8391
|
return result.filter(({ endpoint }) => {
|
|
8369
|
-
const key =
|
|
8392
|
+
const key = resolve11(endpoint.path);
|
|
8370
8393
|
if (seen.has(key)) return false;
|
|
8371
8394
|
seen.add(key);
|
|
8372
8395
|
return true;
|
|
@@ -9079,7 +9102,7 @@ function readExistingAiHealthReport(outDir, portfolioId) {
|
|
|
9079
9102
|
}
|
|
9080
9103
|
|
|
9081
9104
|
// src/commands/sync.ts
|
|
9082
|
-
import { existsSync as existsSync35, lstatSync as lstatSync15, readFileSync as readFileSync20, readlinkSync as
|
|
9105
|
+
import { existsSync as existsSync35, lstatSync as lstatSync15, readFileSync as readFileSync20, readlinkSync as readlinkSync5 } from "node:fs";
|
|
9083
9106
|
import { join as join36 } from "node:path";
|
|
9084
9107
|
function runSync(args) {
|
|
9085
9108
|
const check = args.includes("--check");
|
|
@@ -9126,7 +9149,7 @@ function runSync(args) {
|
|
|
9126
9149
|
continue;
|
|
9127
9150
|
}
|
|
9128
9151
|
if (file.kind === "symlink") {
|
|
9129
|
-
if (!stat.isSymbolicLink() || normalizeSymlinkTarget(
|
|
9152
|
+
if (!stat.isSymbolicLink() || normalizeSymlinkTarget(readlinkSync5(targetPath)) !== file.linkTarget) {
|
|
9130
9153
|
console.log(`different: ${file.targetPath}`);
|
|
9131
9154
|
differences += 1;
|
|
9132
9155
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pieai/pro-gov",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.9",
|
|
4
4
|
"description": "Project-level distribution kit for Project Governance System.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-agents",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@pieai/doc-gov": "^0.9.
|
|
38
|
+
"@pieai/doc-gov": "^0.9.9"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@pieai/swimmer-ui-kit": "1.3.2",
|