@fro.bot/systematic 3.31.0 → 3.31.2
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/HARNESSES.md +1 -1
- package/dist/cli.js +1 -1
- package/dist/{index-a5jd8n2y.js → index-8rz6cepj.js} +248 -253
- package/dist/index.js +1 -1
- package/dist/lib/search-corpus.d.ts +5 -0
- package/dist/lib/search-user-config.d.ts +7 -0
- package/dist/pi.js +46 -49
- package/package.json +3 -3
- package/skills/ce-review/scripts/ensure-ignore.mjs +5 -3
package/HARNESSES.md
CHANGED
|
@@ -241,7 +241,7 @@ Migrated-skill discipline is enforced by the [content-integrity gate](scripts/co
|
|
|
241
241
|
- **PI-3** — `src/pi.ts:218-237`.
|
|
242
242
|
- **PI-4** — `package.json:17-23`; `tests/unit/package-exports.test.ts:64-84,268-288`.
|
|
243
243
|
- **PI-5** — `tests/integration/pi.test.ts:348-387`; installed Pi source `node_modules/@earendil-works/pi-coding-agent/dist/config.js:396-398`.
|
|
244
|
-
- **PI-6** — `src/pi.ts:182-187` (merged `disabled_skills` passed to the skill resolver); `src/pi.ts:250-263` (`systematic_delegate` catalog filtered with `isAgentDisabled`); `src/lib/config.ts:
|
|
244
|
+
- **PI-6** — `src/pi.ts:182-187` (merged `disabled_skills` passed to the skill resolver); `src/pi.ts:250-263` (`systematic_delegate` catalog filtered with `isAgentDisabled`); `src/lib/config.ts:2577-2589` (`isAgentDisabled`); `src/lib/pi-subagents-export.ts:857-893` (`generateEntries` applies it to the export); `tests/unit/disable-parity.test.ts` (parity with OpenCode's config handler); OpenCode's contrasting permission gate at `src/lib/skill-tool.ts:198-203`.
|
|
245
245
|
- **PI-7** — `package.json:24-28` (the `pi.subagents.agents` declaration); `scripts/build-pi-package-agents.ts` (writes `dist/pi-subagents/agents/` at build time); `tests/unit/package-exports.test.ts:76-83,289-344` (manifest key, `pi-package` keyword, packed files byte-equal to the fixtures); `tests/integration/pi.test.ts:1553-1655` (real Pi host: dispatch from the package at project and global scope, the `packageAgents: false` fallback to `general-purpose`, and a local file outranking the packaged one); `node_modules/@tintinweb/pi-subagents/dist/package-resources.js:90,327-341,432` (which packages are read, trust), `node_modules/@tintinweb/pi-subagents/dist/custom-agents.js:36-39,59-64` (precedence), `node_modules/@tintinweb/pi-subagents/dist/settings.js:133-135` (`packageAgents` gate), `node_modules/@tintinweb/pi-subagents/dist/index.js:361,1187` (registry setter and background default), `node_modules/@tintinweb/pi-subagents/dist/agent-types.js:65` (`registerAgents`); `src/lib/pi-subagents-export.ts` (export lifecycle, manifest, rollback, stale-file removal and retention); `src/lib/pi-subagents-personas.ts` (curated persona list, compatibility screening); `src/cli.ts:1080-1106` (CLI surface: `pi-subagents preview|export|refresh|cleanup`). Tested interop contract: pi-subagents 0.22.0 on Pi 1.3.0.
|
|
246
246
|
- **PI-8** — `src/pi.ts:189-204` (rule supplied, `piConfig.disabled_skills` the only config passed); `src/lib/bootstrap.ts:172-198` (`computeBootstrapContentSafe` keeps `bootstrap.enabled` and `bootstrap.file` at their defaults); `tests/unit/pi.test.ts:1317-1447` (real extension init: default, `git-worktree` disabled, `bootstrap.file` set, `bootstrap.enabled: false`, foreign prompt text kept and not doubled).
|
|
247
247
|
- **CC-P** — [Claude Code profile](skills/using-systematic/references/claude-code-profile.md#L3-L9).
|
package/dist/cli.js
CHANGED
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
SEARCH_NOTICES,
|
|
48
48
|
SEARCH_CONFIG_UNREADABLE_NOTE,
|
|
49
49
|
runSearch
|
|
50
|
-
} from "./index-
|
|
50
|
+
} from "./index-8rz6cepj.js";
|
|
51
51
|
var __defProp = Object.defineProperty;
|
|
52
52
|
var __returnValue = (v) => v;
|
|
53
53
|
function __exportSetter(name, newValue) {
|
|
@@ -23,8 +23,9 @@ function parseFrontmatter(content) {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
// src/lib/config.ts
|
|
26
|
-
import
|
|
27
|
-
import
|
|
26
|
+
import fs5 from "fs";
|
|
27
|
+
import os3 from "os";
|
|
28
|
+
import path4 from "path";
|
|
28
29
|
|
|
29
30
|
// node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
30
31
|
function createScanner(text, ignoreTrivia = false) {
|
|
@@ -8067,6 +8068,10 @@ function validateSearchConfig(value, trust, sourcePath) {
|
|
|
8067
8068
|
entries: state.entries
|
|
8068
8069
|
};
|
|
8069
8070
|
}
|
|
8071
|
+
function withoutEntryWarnings(validation) {
|
|
8072
|
+
const aboutEntries = new Set(validation.entries.flatMap((entry) => entry.warnings));
|
|
8073
|
+
return validation.warnings.filter((warning) => !aboutEntries.has(warning));
|
|
8074
|
+
}
|
|
8070
8075
|
function formatSearchFileWarning(sourcePath, reason) {
|
|
8071
8076
|
return `[systematic] search settings in ${displaySafe(sourcePath)} could not be read (${reason}); the settings were ignored, search still runs and its results carry a \`config unreadable\` note.`;
|
|
8072
8077
|
}
|
|
@@ -8204,17 +8209,9 @@ function readTextBounded(filePath, maxBytes) {
|
|
|
8204
8209
|
function absentOrDangling(filePath) {
|
|
8205
8210
|
return configEntryExists(filePath) ? { kind: "failed", reason: "unable to read file" } : { kind: "absent" };
|
|
8206
8211
|
}
|
|
8207
|
-
|
|
8208
|
-
try {
|
|
8209
|
-
return { kind: "text", content: fs2.readFileSync(filePath, "utf-8") };
|
|
8210
|
-
} catch (error) {
|
|
8211
|
-
if (errorCode2(error) === "ENOENT")
|
|
8212
|
-
return absentOrDangling(filePath);
|
|
8213
|
-
return { kind: "failed", reason: "unable to read file" };
|
|
8214
|
-
}
|
|
8215
|
-
}
|
|
8212
|
+
var USER_LEVEL_FILE_MAX_BYTES = Number.POSITIVE_INFINITY;
|
|
8216
8213
|
function readSearchBlock(filePath, maxBytes) {
|
|
8217
|
-
const text =
|
|
8214
|
+
const text = readTextBounded(filePath, maxBytes ?? USER_LEVEL_FILE_MAX_BYTES);
|
|
8218
8215
|
if (text.kind !== "text")
|
|
8219
8216
|
return text;
|
|
8220
8217
|
const content = text.content;
|
|
@@ -9214,6 +9211,9 @@ var PROJECT_ROOT_REJECTION_REASONS = {
|
|
|
9214
9211
|
ancestor: "a project root passes through a symlink",
|
|
9215
9212
|
outside: "a project root resolves outside the project root"
|
|
9216
9213
|
};
|
|
9214
|
+
function projectRootRejectionWarning(sourceName, rejection) {
|
|
9215
|
+
return rejection === "outside" ? `${sourceName} resolves outside the project root; not loaded` : `${sourceName}: ${PROJECT_ROOT_REJECTION_REASONS[rejection]}; source dropped`;
|
|
9216
|
+
}
|
|
9217
9217
|
function rejectedProjectRoot(checkoutRoot, root) {
|
|
9218
9218
|
const symlinked = symlinkedComponent(checkoutRoot, root);
|
|
9219
9219
|
if (symlinked !== undefined)
|
|
@@ -9516,6 +9516,159 @@ function loadCorpus(root, kind = "solution") {
|
|
|
9516
9516
|
};
|
|
9517
9517
|
}
|
|
9518
9518
|
|
|
9519
|
+
// src/lib/search-project-identity.ts
|
|
9520
|
+
import fs4 from "fs";
|
|
9521
|
+
import os2 from "os";
|
|
9522
|
+
import path3 from "path";
|
|
9523
|
+
var MAX_IDENTITY_FILE_BYTES = 1024 * 1024;
|
|
9524
|
+
function realpath(target) {
|
|
9525
|
+
return fs4.realpathSync.native(target);
|
|
9526
|
+
}
|
|
9527
|
+
function readSmallFile(file) {
|
|
9528
|
+
const read = readBytesBounded(file, MAX_IDENTITY_FILE_BYTES);
|
|
9529
|
+
if (read.kind !== "bytes") {
|
|
9530
|
+
throw new Error(`${path3.basename(file)} cannot be read as an identity file`);
|
|
9531
|
+
}
|
|
9532
|
+
return read.bytes.toString("utf8");
|
|
9533
|
+
}
|
|
9534
|
+
function firstLine(text) {
|
|
9535
|
+
return (text.split(`
|
|
9536
|
+
`, 1)[0] ?? "").replace(/\r$/, "").trim();
|
|
9537
|
+
}
|
|
9538
|
+
function resolveFrom(base, value) {
|
|
9539
|
+
return path3.isAbsolute(value) ? value : path3.resolve(base, value);
|
|
9540
|
+
}
|
|
9541
|
+
function setsCoreWorktree(config) {
|
|
9542
|
+
let inCore = false;
|
|
9543
|
+
for (const raw of config.split(`
|
|
9544
|
+
`)) {
|
|
9545
|
+
let line = raw.trim();
|
|
9546
|
+
if (line.startsWith("[")) {
|
|
9547
|
+
const end = line.indexOf("]");
|
|
9548
|
+
if (end === -1) {
|
|
9549
|
+
inCore = false;
|
|
9550
|
+
continue;
|
|
9551
|
+
}
|
|
9552
|
+
inCore = line.slice(1, end).trim().toLowerCase() === "core";
|
|
9553
|
+
line = line.slice(end + 1).trim();
|
|
9554
|
+
}
|
|
9555
|
+
if (inCore && /^worktree\s*(=|$)/i.test(line)) {
|
|
9556
|
+
return true;
|
|
9557
|
+
}
|
|
9558
|
+
}
|
|
9559
|
+
return false;
|
|
9560
|
+
}
|
|
9561
|
+
function isSubmoduleGitdir(gitdir) {
|
|
9562
|
+
return gitdir.split(path3.sep).includes("modules");
|
|
9563
|
+
}
|
|
9564
|
+
function resolveLinkedWorktree(gitFile, gitdir) {
|
|
9565
|
+
const commonFile = path3.join(gitdir, "commondir");
|
|
9566
|
+
if (!fs4.existsSync(commonFile)) {
|
|
9567
|
+
return { reason: "missing-commondir" };
|
|
9568
|
+
}
|
|
9569
|
+
const commonRaw = firstLine(readSmallFile(commonFile));
|
|
9570
|
+
if (commonRaw === "") {
|
|
9571
|
+
return { reason: "corrupt-git-file" };
|
|
9572
|
+
}
|
|
9573
|
+
const common = realpath(resolveFrom(gitdir, commonRaw));
|
|
9574
|
+
if (gitdir !== path3.join(common, "worktrees", path3.basename(gitdir))) {
|
|
9575
|
+
return { reason: "inconsistent" };
|
|
9576
|
+
}
|
|
9577
|
+
const backRaw = firstLine(readSmallFile(path3.join(gitdir, "gitdir")));
|
|
9578
|
+
if (backRaw === "") {
|
|
9579
|
+
return { reason: "corrupt-git-file" };
|
|
9580
|
+
}
|
|
9581
|
+
if (realpath(resolveFrom(gitdir, backRaw)) !== realpath(gitFile)) {
|
|
9582
|
+
return { reason: "inconsistent" };
|
|
9583
|
+
}
|
|
9584
|
+
if (path3.basename(common) !== ".git") {
|
|
9585
|
+
return { reason: "unsupported-layout" };
|
|
9586
|
+
}
|
|
9587
|
+
if (setsCoreWorktree(readSmallFile(path3.join(common, "config")))) {
|
|
9588
|
+
return { reason: "core-worktree" };
|
|
9589
|
+
}
|
|
9590
|
+
return { root: path3.dirname(common) };
|
|
9591
|
+
}
|
|
9592
|
+
function deriveMainRoot(checkoutRoot) {
|
|
9593
|
+
const root = realpath(checkoutRoot);
|
|
9594
|
+
const gitPath = path3.join(root, ".git");
|
|
9595
|
+
let stat;
|
|
9596
|
+
try {
|
|
9597
|
+
stat = fs4.lstatSync(gitPath);
|
|
9598
|
+
} catch {
|
|
9599
|
+
return { reason: "not-a-checkout" };
|
|
9600
|
+
}
|
|
9601
|
+
if (stat.isSymbolicLink()) {
|
|
9602
|
+
return { reason: "symlinked-git" };
|
|
9603
|
+
}
|
|
9604
|
+
if (stat.isDirectory()) {
|
|
9605
|
+
return { root };
|
|
9606
|
+
}
|
|
9607
|
+
if (!stat.isFile()) {
|
|
9608
|
+
return { reason: "corrupt-git-file" };
|
|
9609
|
+
}
|
|
9610
|
+
const match = /^gitdir:[ \t]*(.+)$/.exec(firstLine(readSmallFile(gitPath)));
|
|
9611
|
+
const claimed = match?.[1]?.trim();
|
|
9612
|
+
if (claimed === undefined || claimed === "") {
|
|
9613
|
+
return { reason: "corrupt-git-file" };
|
|
9614
|
+
}
|
|
9615
|
+
const gitdir = realpath(resolveFrom(root, claimed));
|
|
9616
|
+
if (!fs4.statSync(gitdir).isDirectory()) {
|
|
9617
|
+
return { reason: "corrupt-git-file" };
|
|
9618
|
+
}
|
|
9619
|
+
if (path3.basename(path3.dirname(gitdir)) === "worktrees") {
|
|
9620
|
+
return resolveLinkedWorktree(gitPath, gitdir);
|
|
9621
|
+
}
|
|
9622
|
+
if (isSubmoduleGitdir(gitdir)) {
|
|
9623
|
+
return { root };
|
|
9624
|
+
}
|
|
9625
|
+
return { reason: "unsupported-layout" };
|
|
9626
|
+
}
|
|
9627
|
+
function resolveProjectIdentity(checkoutRoot) {
|
|
9628
|
+
try {
|
|
9629
|
+
const derived = deriveMainRoot(checkoutRoot);
|
|
9630
|
+
return "root" in derived ? { status: "resolved", mainRoot: derived.root } : { status: "unresolved", reason: derived.reason };
|
|
9631
|
+
} catch {
|
|
9632
|
+
return { status: "unresolved", reason: "unreadable" };
|
|
9633
|
+
}
|
|
9634
|
+
}
|
|
9635
|
+
function expandHome(entry, homeDir) {
|
|
9636
|
+
if (entry === "~") {
|
|
9637
|
+
return homeDir;
|
|
9638
|
+
}
|
|
9639
|
+
if (entry.startsWith("~/") || entry.startsWith(`~${path3.sep}`)) {
|
|
9640
|
+
return path3.join(homeDir, entry.slice(2));
|
|
9641
|
+
}
|
|
9642
|
+
return entry;
|
|
9643
|
+
}
|
|
9644
|
+
function isAllowedProject(identity, allowList, options = {}) {
|
|
9645
|
+
if (identity.status !== "resolved") {
|
|
9646
|
+
return false;
|
|
9647
|
+
}
|
|
9648
|
+
let mainRoot;
|
|
9649
|
+
try {
|
|
9650
|
+
mainRoot = realpath(identity.mainRoot);
|
|
9651
|
+
} catch {
|
|
9652
|
+
return false;
|
|
9653
|
+
}
|
|
9654
|
+
const homeDir = options.homeDir ?? os2.homedir();
|
|
9655
|
+
for (const entry of allowList) {
|
|
9656
|
+
if (typeof entry !== "string" || entry === "") {
|
|
9657
|
+
continue;
|
|
9658
|
+
}
|
|
9659
|
+
const expanded = expandHome(entry, homeDir);
|
|
9660
|
+
if (expanded === undefined || !path3.isAbsolute(expanded)) {
|
|
9661
|
+
continue;
|
|
9662
|
+
}
|
|
9663
|
+
try {
|
|
9664
|
+
if (realpath(expanded) === mainRoot) {
|
|
9665
|
+
return true;
|
|
9666
|
+
}
|
|
9667
|
+
} catch {}
|
|
9668
|
+
}
|
|
9669
|
+
return false;
|
|
9670
|
+
}
|
|
9671
|
+
|
|
9519
9672
|
// src/lib/config.ts
|
|
9520
9673
|
var CONFIG_AUTHORITY_FIELD_PATHS = [
|
|
9521
9674
|
"bootstrap.enabled",
|
|
@@ -9641,21 +9794,9 @@ function warnDroppedNames(dropped, field, warned, removalVersion, warningSink =
|
|
|
9641
9794
|
warningSink(`[systematic] "${displayName}" in \`${field}\` is no longer a bundled name and will be ignored.${removalNote} Remove it from your config to silence this warning. See ${MIGRATION_DOCS_URL} for migration guidance.`);
|
|
9642
9795
|
}
|
|
9643
9796
|
}
|
|
9644
|
-
function isErrorWithCode(error) {
|
|
9645
|
-
return error instanceof Error && "code" in error;
|
|
9646
|
-
}
|
|
9647
9797
|
var OVERSIZED_FILE_REASON = `file is larger than ${MAX_PROJECT_CONFIG_BYTES / (1024 * 1024)} MB`;
|
|
9798
|
+
var USER_LEVEL_CONFIG_MAX_BYTES = Number.POSITIVE_INFINITY;
|
|
9648
9799
|
function readConfigText(filePath, maxBytes) {
|
|
9649
|
-
if (maxBytes === undefined) {
|
|
9650
|
-
try {
|
|
9651
|
-
return fs4.readFileSync(filePath, "utf-8");
|
|
9652
|
-
} catch (error) {
|
|
9653
|
-
if (isErrorWithCode(error) && error.code === "ENOENT" && !configEntryExists(filePath)) {
|
|
9654
|
-
return null;
|
|
9655
|
-
}
|
|
9656
|
-
throw new Error(`Invalid Systematic config in ${filePath}: unable to read file`, { cause: error });
|
|
9657
|
-
}
|
|
9658
|
-
}
|
|
9659
9800
|
const read = readBytesBounded(filePath, maxBytes);
|
|
9660
9801
|
switch (read.kind) {
|
|
9661
9802
|
case "bytes":
|
|
@@ -9666,6 +9807,8 @@ function readConfigText(filePath, maxBytes) {
|
|
|
9666
9807
|
throw new Error(`Invalid Systematic config in ${filePath}: unable to read file`);
|
|
9667
9808
|
case "too-large":
|
|
9668
9809
|
throw new Error(`Invalid Systematic config in ${filePath}: unable to read file (${OVERSIZED_FILE_REASON})`);
|
|
9810
|
+
case "not-regular":
|
|
9811
|
+
throw new Error(`Invalid Systematic config in ${filePath}: unable to read file (not a regular file)`);
|
|
9669
9812
|
default:
|
|
9670
9813
|
throw new Error(`Invalid Systematic config in ${filePath}: unable to read file`);
|
|
9671
9814
|
}
|
|
@@ -9773,10 +9916,17 @@ ${formatted.map((entry) => ` - ${entry}`).join(`
|
|
|
9773
9916
|
});
|
|
9774
9917
|
}
|
|
9775
9918
|
function loadConfigSource(input) {
|
|
9776
|
-
const {
|
|
9919
|
+
const {
|
|
9920
|
+
filePath,
|
|
9921
|
+
layer,
|
|
9922
|
+
invalidSource,
|
|
9923
|
+
warningSink,
|
|
9924
|
+
allowProjectProfiles,
|
|
9925
|
+
projectAllowed
|
|
9926
|
+
} = input;
|
|
9777
9927
|
const trust = LAYER_TRUST[layer];
|
|
9778
9928
|
try {
|
|
9779
|
-
const rawConfig = loadJsoncFile(filePath, layer === "project" ? MAX_PROJECT_CONFIG_BYTES :
|
|
9929
|
+
const rawConfig = loadJsoncFile(filePath, layer === "project" ? MAX_PROJECT_CONFIG_BYTES : USER_LEVEL_CONFIG_MAX_BYTES);
|
|
9780
9930
|
if (!rawConfig) {
|
|
9781
9931
|
return {
|
|
9782
9932
|
metadata: { kind: trust, presence: "absent" },
|
|
@@ -9786,7 +9936,7 @@ function loadConfigSource(input) {
|
|
|
9786
9936
|
const protectedFields = collectProjectProtectedFields(rawConfig, trust, allowProjectProfiles);
|
|
9787
9937
|
const topLevelStripped = trust === "project" ? stripProjectProtectedFields(rawConfig, allowProjectProfiles) : rawConfig;
|
|
9788
9938
|
const config = trust === "project" ? stripProjectSecurityOverlayFields(topLevelStripped, filePath, warningSink) : topLevelStripped;
|
|
9789
|
-
const { config: configWithoutSearch, search } = splitSearchBlock(config, filePath, trust, warningSink);
|
|
9939
|
+
const { config: configWithoutSearch, search } = splitSearchBlock(config, filePath, trust, warningSink, projectAllowed);
|
|
9790
9940
|
const result = SystematicConfigSchema.safeParse(configWithoutSearch);
|
|
9791
9941
|
if (!result.success) {
|
|
9792
9942
|
throwTopLevelConfigSchemaError(filePath, trust, result.error.issues, configWithoutSearch);
|
|
@@ -9816,12 +9966,14 @@ function loadConfigSource(input) {
|
|
|
9816
9966
|
};
|
|
9817
9967
|
}
|
|
9818
9968
|
}
|
|
9819
|
-
function splitSearchBlock(config, filePath, trust, warningSink) {
|
|
9969
|
+
function splitSearchBlock(config, filePath, trust, warningSink, projectAllowed) {
|
|
9820
9970
|
if (!Object.hasOwn(config, "search"))
|
|
9821
9971
|
return { config, search: undefined };
|
|
9822
9972
|
const { search: rawSearch, ...rest } = config;
|
|
9823
9973
|
const validation = validateSearchConfig(rawSearch, trust === "project" ? "project" : "user", filePath);
|
|
9824
|
-
|
|
9974
|
+
const hideEntryWarnings = trust === "project" && validation.entries.some((entry) => entry.warnings.length > 0) && !projectAllowed();
|
|
9975
|
+
const warnings = hideEntryWarnings ? withoutEntryWarnings(validation) : validation.warnings;
|
|
9976
|
+
for (const message of warnings)
|
|
9825
9977
|
warningSink(message);
|
|
9826
9978
|
return {
|
|
9827
9979
|
config: rest,
|
|
@@ -9844,9 +9996,9 @@ function isConfigSchemaError(error) {
|
|
|
9844
9996
|
}
|
|
9845
9997
|
function resolveConfigSourcePath(filePath) {
|
|
9846
9998
|
try {
|
|
9847
|
-
return
|
|
9999
|
+
return fs5.realpathSync(filePath);
|
|
9848
10000
|
} catch {
|
|
9849
|
-
return
|
|
10001
|
+
return path4.resolve(filePath);
|
|
9850
10002
|
}
|
|
9851
10003
|
}
|
|
9852
10004
|
function emitTopLevelProtectedFieldWarning(projectSource, fieldPath, messageTemplate, sink) {
|
|
@@ -10186,7 +10338,8 @@ function loadUserLevelSources(paths, context) {
|
|
|
10186
10338
|
...context,
|
|
10187
10339
|
filePath,
|
|
10188
10340
|
layer,
|
|
10189
|
-
allowProjectProfiles: false
|
|
10341
|
+
allowProjectProfiles: false,
|
|
10342
|
+
projectAllowed: () => false
|
|
10190
10343
|
});
|
|
10191
10344
|
loadedByRealFile.set(realFile, loaded);
|
|
10192
10345
|
return loaded;
|
|
@@ -10265,6 +10418,9 @@ function loadConfigWithSources(projectDir, options) {
|
|
|
10265
10418
|
warningSink
|
|
10266
10419
|
});
|
|
10267
10420
|
const { allowProjectProfiles } = userLevel;
|
|
10421
|
+
const mergedSearch = mergeUserLevelSearch(userLevel);
|
|
10422
|
+
const homeDir = resolveUserLevelConfigDirs(options).homeDir || os3.homedir();
|
|
10423
|
+
const projectAllowed = () => isAllowedProject(resolveProjectIdentity(paths.projectRoot), mergedSearch.settings?.allow_project_sources ?? [], { homeDir });
|
|
10268
10424
|
const aliasLoaded = aliasedFiles.some(({ layer }) => userLevel[USER_LEVEL_SLOT[layer]].source !== null);
|
|
10269
10425
|
const project = includeProject ? loadConfigSource({
|
|
10270
10426
|
filePath: paths.projectConfig,
|
|
@@ -10272,7 +10428,8 @@ function loadConfigWithSources(projectDir, options) {
|
|
|
10272
10428
|
invalidSource,
|
|
10273
10429
|
warningSink: boundedProjectStrip.sink,
|
|
10274
10430
|
reportInvalid,
|
|
10275
|
-
allowProjectProfiles
|
|
10431
|
+
allowProjectProfiles,
|
|
10432
|
+
projectAllowed
|
|
10276
10433
|
}) : {
|
|
10277
10434
|
metadata: { kind: "project", presence: "absent" },
|
|
10278
10435
|
source: null
|
|
@@ -10310,10 +10467,6 @@ function loadConfigWithSources(projectDir, options) {
|
|
|
10310
10467
|
const sources = chainOf(layers);
|
|
10311
10468
|
warnRemovedKeys(sources, warningSink);
|
|
10312
10469
|
const warned = new Set;
|
|
10313
|
-
const mergedSearch = mergeSearchSettings(["user", "userLocal", "custom", "customLocal"].flatMap((slot) => {
|
|
10314
|
-
const source = layers[slot];
|
|
10315
|
-
return source?.search && isUserLevelLayer(source.layer) ? [{ ...source.search, layer: source.layer }] : [];
|
|
10316
|
-
}));
|
|
10317
10470
|
assertAllProfileBundlesAreValid([
|
|
10318
10471
|
layers.user,
|
|
10319
10472
|
layers.userLocal,
|
|
@@ -10387,6 +10540,12 @@ function loadConfigWithSources(projectDir, options) {
|
|
|
10387
10540
|
activeProfileSourcePath: profileSelection.bundleSource?.path ?? null
|
|
10388
10541
|
};
|
|
10389
10542
|
}
|
|
10543
|
+
function mergeUserLevelSearch(userLevel) {
|
|
10544
|
+
return mergeSearchSettings(["user", "userLocal", "custom", "customLocal"].flatMap((slot) => {
|
|
10545
|
+
const source = userLevel[slot].source;
|
|
10546
|
+
return source?.search && isUserLevelLayer(source.layer) ? [{ ...source.search, layer: source.layer }] : [];
|
|
10547
|
+
}));
|
|
10548
|
+
}
|
|
10390
10549
|
function isUserLevelLayer(layer) {
|
|
10391
10550
|
return layer !== "project";
|
|
10392
10551
|
}
|
|
@@ -10740,7 +10899,7 @@ function getConfigPaths(projectDir, options) {
|
|
|
10740
10899
|
const repoRoot = options?.includeProject ?? true ? lookupSearchRoot(projectDir) : undefined;
|
|
10741
10900
|
const projectRoot = repoRoot?.root ?? projectDir;
|
|
10742
10901
|
const project = repoRoot ? selectProjectConfigFile(projectRoot) : {
|
|
10743
|
-
path: selectConfigFile(
|
|
10902
|
+
path: selectConfigFile(path4.join(projectDir, ".opencode"), "systematic")
|
|
10744
10903
|
};
|
|
10745
10904
|
const startDirProjectConfig = repoRoot ? findStartDirProjectConfig(projectDir, repoRoot, project.path) : undefined;
|
|
10746
10905
|
const ignoredProjectConfig = "ignoredPath" in project ? project.ignoredPath : undefined;
|
|
@@ -10751,36 +10910,36 @@ function getConfigPaths(projectDir, options) {
|
|
|
10751
10910
|
userLocalConfig: userFile("user.local"),
|
|
10752
10911
|
projectConfig: project.path,
|
|
10753
10912
|
projectRoot,
|
|
10754
|
-
userDir:
|
|
10755
|
-
projectDir:
|
|
10913
|
+
userDir: path4.join(homeDir, ".config/opencode/systematic"),
|
|
10914
|
+
projectDir: path4.join(projectRoot, ".opencode/systematic"),
|
|
10756
10915
|
customAliasesUser: selection.aliased,
|
|
10757
10916
|
...ignoredProjectConfig !== undefined && { ignoredProjectConfig },
|
|
10758
10917
|
...startDirProjectConfig !== undefined && { startDirProjectConfig },
|
|
10759
10918
|
...customConfigDir && customConfig !== undefined && customLocalConfig !== undefined && {
|
|
10760
10919
|
customConfig,
|
|
10761
10920
|
customLocalConfig,
|
|
10762
|
-
customDir:
|
|
10921
|
+
customDir: path4.join(customConfigDir, "systematic")
|
|
10763
10922
|
}
|
|
10764
10923
|
};
|
|
10765
10924
|
}
|
|
10766
10925
|
|
|
10767
10926
|
// src/lib/walk-dir.ts
|
|
10768
|
-
import
|
|
10769
|
-
import
|
|
10927
|
+
import fs6 from "fs";
|
|
10928
|
+
import path5 from "path";
|
|
10770
10929
|
function isDiscoverableMarkdown(fileName) {
|
|
10771
10930
|
return fileName.endsWith(".md") && fileName.toLowerCase() !== "readme.md";
|
|
10772
10931
|
}
|
|
10773
10932
|
function walkDir(rootDir, options = {}) {
|
|
10774
10933
|
const { maxDepth = 3, filter } = options;
|
|
10775
10934
|
const results = [];
|
|
10776
|
-
if (!
|
|
10935
|
+
if (!fs6.existsSync(rootDir))
|
|
10777
10936
|
return results;
|
|
10778
10937
|
function recurse(currentDir, depth, category) {
|
|
10779
10938
|
if (depth > maxDepth)
|
|
10780
10939
|
return;
|
|
10781
|
-
const entries =
|
|
10940
|
+
const entries = fs6.readdirSync(currentDir, { withFileTypes: true });
|
|
10782
10941
|
for (const entry of entries) {
|
|
10783
|
-
const fullPath =
|
|
10942
|
+
const fullPath = path5.join(currentDir, entry.name);
|
|
10784
10943
|
const walkEntry = {
|
|
10785
10944
|
path: fullPath,
|
|
10786
10945
|
name: entry.name,
|
|
@@ -10875,12 +11034,12 @@ function extractCommandFrontmatter(content) {
|
|
|
10875
11034
|
}
|
|
10876
11035
|
|
|
10877
11036
|
// src/lib/discovered-skills.ts
|
|
10878
|
-
import
|
|
10879
|
-
import
|
|
11037
|
+
import fs8 from "fs";
|
|
11038
|
+
import path7 from "path";
|
|
10880
11039
|
|
|
10881
11040
|
// src/lib/skills.ts
|
|
10882
|
-
import
|
|
10883
|
-
import
|
|
11041
|
+
import fs7 from "fs";
|
|
11042
|
+
import path6 from "path";
|
|
10884
11043
|
function parseMetadata(data) {
|
|
10885
11044
|
const metadataRaw = data.metadata;
|
|
10886
11045
|
if (!isRecord(metadataRaw)) {
|
|
@@ -10917,7 +11076,7 @@ function extractFrontmatterFromContent(content) {
|
|
|
10917
11076
|
}
|
|
10918
11077
|
function extractFrontmatter(filePath) {
|
|
10919
11078
|
try {
|
|
10920
|
-
const content =
|
|
11079
|
+
const content = fs7.readFileSync(filePath, "utf8");
|
|
10921
11080
|
return extractFrontmatterFromContent(content);
|
|
10922
11081
|
} catch {
|
|
10923
11082
|
return { name: "", description: "" };
|
|
@@ -10930,8 +11089,8 @@ function findSkillsInDir(dir, maxDepth = 3) {
|
|
|
10930
11089
|
filter: (e) => e.isDirectory
|
|
10931
11090
|
});
|
|
10932
11091
|
for (const entry of entries) {
|
|
10933
|
-
const skillFile =
|
|
10934
|
-
if (
|
|
11092
|
+
const skillFile = path6.join(entry.path, "SKILL.md");
|
|
11093
|
+
if (fs7.existsSync(skillFile)) {
|
|
10935
11094
|
const frontmatter = extractFrontmatter(skillFile);
|
|
10936
11095
|
skills.push({
|
|
10937
11096
|
path: entry.path,
|
|
@@ -10960,16 +11119,16 @@ function isValidSkillName(name) {
|
|
|
10960
11119
|
return name.length >= 1 && name.length <= 64 && SKILL_NAME_REGEX.test(name);
|
|
10961
11120
|
}
|
|
10962
11121
|
function findGitWorktreeRoot(startDir) {
|
|
10963
|
-
let current =
|
|
11122
|
+
let current = path7.resolve(startDir);
|
|
10964
11123
|
while (true) {
|
|
10965
11124
|
try {
|
|
10966
|
-
if (
|
|
11125
|
+
if (fs8.existsSync(path7.join(current, ".git"))) {
|
|
10967
11126
|
return current;
|
|
10968
11127
|
}
|
|
10969
11128
|
} catch {
|
|
10970
11129
|
return null;
|
|
10971
11130
|
}
|
|
10972
|
-
const parent =
|
|
11131
|
+
const parent = path7.dirname(current);
|
|
10973
11132
|
if (parent === current)
|
|
10974
11133
|
return null;
|
|
10975
11134
|
current = parent;
|
|
@@ -10977,20 +11136,20 @@ function findGitWorktreeRoot(startDir) {
|
|
|
10977
11136
|
}
|
|
10978
11137
|
function upWalk(targets, start, stop) {
|
|
10979
11138
|
const results = [];
|
|
10980
|
-
let current =
|
|
10981
|
-
const resolvedStop = stop === undefined ? undefined :
|
|
11139
|
+
let current = path7.resolve(start);
|
|
11140
|
+
const resolvedStop = stop === undefined ? undefined : path7.resolve(stop);
|
|
10982
11141
|
while (true) {
|
|
10983
11142
|
for (const target of targets) {
|
|
10984
|
-
const candidate =
|
|
11143
|
+
const candidate = path7.join(current, target);
|
|
10985
11144
|
try {
|
|
10986
|
-
if (
|
|
11145
|
+
if (fs8.existsSync(candidate)) {
|
|
10987
11146
|
results.push(candidate);
|
|
10988
11147
|
}
|
|
10989
11148
|
} catch {}
|
|
10990
11149
|
}
|
|
10991
11150
|
if (resolvedStop !== undefined && current === resolvedStop)
|
|
10992
11151
|
break;
|
|
10993
|
-
const parent =
|
|
11152
|
+
const parent = path7.dirname(current);
|
|
10994
11153
|
if (parent === current)
|
|
10995
11154
|
break;
|
|
10996
11155
|
current = parent;
|
|
@@ -11012,9 +11171,9 @@ function buildOpencodeConfigDirs(startDir, homeDir, gitRoot, globalConfigDir, op
|
|
|
11012
11171
|
function globSkillFiles(rootDir, subdirNames) {
|
|
11013
11172
|
const results = [];
|
|
11014
11173
|
for (const subdirName of subdirNames) {
|
|
11015
|
-
const scanRoot =
|
|
11174
|
+
const scanRoot = path7.join(rootDir, subdirName);
|
|
11016
11175
|
try {
|
|
11017
|
-
if (!
|
|
11176
|
+
if (!fs8.existsSync(scanRoot))
|
|
11018
11177
|
continue;
|
|
11019
11178
|
const entries = walkDir(scanRoot, {
|
|
11020
11179
|
maxDepth: 10,
|
|
@@ -11030,7 +11189,7 @@ function globSkillFiles(rootDir, subdirNames) {
|
|
|
11030
11189
|
function toDiscoveredSkill(skillPath, rootId, onIssue) {
|
|
11031
11190
|
let content;
|
|
11032
11191
|
try {
|
|
11033
|
-
content =
|
|
11192
|
+
content = fs8.readFileSync(skillPath, "utf8");
|
|
11034
11193
|
} catch {
|
|
11035
11194
|
onIssue?.("read-failed");
|
|
11036
11195
|
return;
|
|
@@ -11056,7 +11215,7 @@ function toDiscoveredSkill(skillPath, rootId, onIssue) {
|
|
|
11056
11215
|
}
|
|
11057
11216
|
function discoverSkills(options) {
|
|
11058
11217
|
const { startDir, homeDir, configDir, onIssue, opencodeConfigDirOverride } = options;
|
|
11059
|
-
const globalConfigDir = configDir ??
|
|
11218
|
+
const globalConfigDir = configDir ?? path7.join(homeDir, ".config/opencode");
|
|
11060
11219
|
const gitRoot = findGitWorktreeRoot(startDir);
|
|
11061
11220
|
const byName = new Map;
|
|
11062
11221
|
function upsertAll(skillPaths, rootId) {
|
|
@@ -11070,8 +11229,8 @@ function discoverSkills(options) {
|
|
|
11070
11229
|
upsertAll(globSkillFiles(homeDir, [".agents/skills"]), "global-agents");
|
|
11071
11230
|
const externalLevels = upWalk([".claude", ".agents"], startDir, gitRoot ?? startDir);
|
|
11072
11231
|
for (const levelDir of externalLevels) {
|
|
11073
|
-
const isClaudeDir =
|
|
11074
|
-
const parentDir =
|
|
11232
|
+
const isClaudeDir = path7.basename(levelDir) === ".claude";
|
|
11233
|
+
const parentDir = path7.dirname(levelDir);
|
|
11075
11234
|
const subdirGlob = isClaudeDir ? ".claude/skills" : ".agents/skills";
|
|
11076
11235
|
const rootId = isClaudeDir ? "project-claude" : "project-agents";
|
|
11077
11236
|
upsertAll(globSkillFiles(parentDir, [subdirGlob]), rootId);
|
|
@@ -11089,11 +11248,11 @@ import fs10 from "fs";
|
|
|
11089
11248
|
import path11 from "path";
|
|
11090
11249
|
|
|
11091
11250
|
// src/lib/search-external.ts
|
|
11092
|
-
import
|
|
11251
|
+
import path9 from "path";
|
|
11093
11252
|
|
|
11094
11253
|
// src/lib/search-external-deciduous.ts
|
|
11095
|
-
import
|
|
11096
|
-
import
|
|
11254
|
+
import fs9 from "fs";
|
|
11255
|
+
import path8 from "path";
|
|
11097
11256
|
var RECORD_NODE_TYPES = new Set([
|
|
11098
11257
|
"decision",
|
|
11099
11258
|
"option",
|
|
@@ -11116,14 +11275,14 @@ function probeRoot(root, containedIn) {
|
|
|
11116
11275
|
let real;
|
|
11117
11276
|
let container;
|
|
11118
11277
|
try {
|
|
11119
|
-
real =
|
|
11120
|
-
container = containedIn === undefined ? undefined :
|
|
11278
|
+
real = fs9.realpathSync(root);
|
|
11279
|
+
container = containedIn === undefined ? undefined : fs9.realpathSync(containedIn);
|
|
11121
11280
|
} catch (error) {
|
|
11122
11281
|
return { kind: isAbsence2(error) ? "missing" : "unreadable" };
|
|
11123
11282
|
}
|
|
11124
11283
|
let stat;
|
|
11125
11284
|
try {
|
|
11126
|
-
stat =
|
|
11285
|
+
stat = fs9.lstatSync(real, { throwIfNoEntry: false });
|
|
11127
11286
|
} catch (error) {
|
|
11128
11287
|
return { kind: isAbsence2(error) ? "missing" : "unreadable" };
|
|
11129
11288
|
}
|
|
@@ -11139,7 +11298,7 @@ function classifyJsonEntry(directory, folder, name, skips, isExcluded) {
|
|
|
11139
11298
|
return;
|
|
11140
11299
|
if (isExcluded(`${folder}/${name}`))
|
|
11141
11300
|
return;
|
|
11142
|
-
const absolute =
|
|
11301
|
+
const absolute = path8.join(directory, name);
|
|
11143
11302
|
const entry = safeLstat(absolute);
|
|
11144
11303
|
if (entry === null)
|
|
11145
11304
|
return;
|
|
@@ -11161,7 +11320,7 @@ function folderScan(status) {
|
|
|
11161
11320
|
}
|
|
11162
11321
|
function statFolder(directory) {
|
|
11163
11322
|
try {
|
|
11164
|
-
const stat =
|
|
11323
|
+
const stat = fs9.lstatSync(directory, { throwIfNoEntry: false });
|
|
11165
11324
|
return stat === undefined ? { kind: "absent" } : { kind: "stat", stat };
|
|
11166
11325
|
} catch (error) {
|
|
11167
11326
|
return { kind: isAbsence2(error) ? "absent" : "failed" };
|
|
@@ -11170,7 +11329,7 @@ function statFolder(directory) {
|
|
|
11170
11329
|
function scanFolder(rootReal, folder, limit, skips, budget, isExcluded) {
|
|
11171
11330
|
if (isExcluded(folder))
|
|
11172
11331
|
return folderScan("excluded");
|
|
11173
|
-
const directory =
|
|
11332
|
+
const directory = path8.join(rootReal, folder);
|
|
11174
11333
|
const probed = statFolder(directory);
|
|
11175
11334
|
if (probed.kind === "absent")
|
|
11176
11335
|
return folderScan("absent");
|
|
@@ -11204,18 +11363,14 @@ function probeRoots(input, warnings) {
|
|
|
11204
11363
|
const reals = [];
|
|
11205
11364
|
let unreadable = false;
|
|
11206
11365
|
for (const root of input.roots) {
|
|
11207
|
-
const
|
|
11208
|
-
if (
|
|
11209
|
-
warnings.push(
|
|
11210
|
-
return { kind: "dropped" };
|
|
11211
|
-
}
|
|
11212
|
-
if (symlinked === "ancestor") {
|
|
11213
|
-
warnings.push(`${name}: a project root passes through a symlink; source dropped`);
|
|
11366
|
+
const rejection = containedIn === undefined ? undefined : rejectedProjectRoot(containedIn, root);
|
|
11367
|
+
if (rejection !== undefined) {
|
|
11368
|
+
warnings.push(projectRootRejectionWarning(name, rejection));
|
|
11214
11369
|
return { kind: "dropped" };
|
|
11215
11370
|
}
|
|
11216
11371
|
const probe = probeRoot(root, containedIn);
|
|
11217
11372
|
if (probe.kind === "outside") {
|
|
11218
|
-
warnings.push(
|
|
11373
|
+
warnings.push(projectRootRejectionWarning(name, "outside"));
|
|
11219
11374
|
return { kind: "dropped" };
|
|
11220
11375
|
}
|
|
11221
11376
|
if (probe.kind === "unreadable") {
|
|
@@ -11311,7 +11466,7 @@ function isTombstone(data) {
|
|
|
11311
11466
|
const deletedAt = data.deleted_at;
|
|
11312
11467
|
return deletedAt !== undefined && deletedAt !== null && deletedAt !== "" && deletedAt !== false;
|
|
11313
11468
|
}
|
|
11314
|
-
function
|
|
11469
|
+
function firstLine2(text) {
|
|
11315
11470
|
if (text === undefined)
|
|
11316
11471
|
return;
|
|
11317
11472
|
for (const line of text.split(/\r?\n/)) {
|
|
@@ -11415,7 +11570,7 @@ function readNodes(nodes, input, reader, skips) {
|
|
|
11415
11570
|
const description = trimmedText(data.description) ?? "";
|
|
11416
11571
|
entries.set(changeId, {
|
|
11417
11572
|
path: `${input.name}/${candidate.relative}`,
|
|
11418
|
-
title: trimmedText(data.title) ??
|
|
11573
|
+
title: trimmedText(data.title) ?? firstLine2(description) ?? changeId,
|
|
11419
11574
|
nodeType,
|
|
11420
11575
|
description,
|
|
11421
11576
|
rationale: [],
|
|
@@ -11660,9 +11815,7 @@ function projectRootWarning(source, context, root) {
|
|
|
11660
11815
|
if (source.origin !== "project")
|
|
11661
11816
|
return;
|
|
11662
11817
|
const rejection = rejectedProjectRoot(context.checkoutRoot, root);
|
|
11663
|
-
|
|
11664
|
-
return;
|
|
11665
|
-
return rejection === "outside" ? `${source.name} resolves outside the project root; not loaded` : `${source.name}: ${PROJECT_ROOT_REJECTION_REASONS[rejection]}; source dropped`;
|
|
11818
|
+
return rejection === undefined ? undefined : projectRootRejectionWarning(source.name, rejection);
|
|
11666
11819
|
}
|
|
11667
11820
|
function gatherCandidates(source, context, warnings) {
|
|
11668
11821
|
const { name, origin } = source;
|
|
@@ -11771,7 +11924,7 @@ function loadSource(source, context) {
|
|
|
11771
11924
|
return LOADERS[source.format](source, context);
|
|
11772
11925
|
}
|
|
11773
11926
|
function loadExternalSources(input) {
|
|
11774
|
-
const checkoutRoot =
|
|
11927
|
+
const checkoutRoot = path9.resolve(input.checkoutRoot);
|
|
11775
11928
|
let remainingBytes = input.budgetBytes ?? EXTERNAL_TOTAL_BUDGET_BYTES;
|
|
11776
11929
|
const loads = [];
|
|
11777
11930
|
for (const source of input.sources) {
|
|
@@ -11787,163 +11940,8 @@ function loadExternalSources(input) {
|
|
|
11787
11940
|
}
|
|
11788
11941
|
|
|
11789
11942
|
// src/lib/search-external-sources.ts
|
|
11790
|
-
import
|
|
11943
|
+
import os4 from "os";
|
|
11791
11944
|
import path10 from "path";
|
|
11792
|
-
|
|
11793
|
-
// src/lib/search-project-identity.ts
|
|
11794
|
-
import fs9 from "fs";
|
|
11795
|
-
import os2 from "os";
|
|
11796
|
-
import path9 from "path";
|
|
11797
|
-
var MAX_IDENTITY_FILE_BYTES = 1024 * 1024;
|
|
11798
|
-
function realpath(target) {
|
|
11799
|
-
return fs9.realpathSync.native(target);
|
|
11800
|
-
}
|
|
11801
|
-
function readSmallFile(file) {
|
|
11802
|
-
const read = readBytesBounded(file, MAX_IDENTITY_FILE_BYTES);
|
|
11803
|
-
if (read.kind !== "bytes") {
|
|
11804
|
-
throw new Error(`${path9.basename(file)} cannot be read as an identity file`);
|
|
11805
|
-
}
|
|
11806
|
-
return read.bytes.toString("utf8");
|
|
11807
|
-
}
|
|
11808
|
-
function firstLine2(text) {
|
|
11809
|
-
return (text.split(`
|
|
11810
|
-
`, 1)[0] ?? "").replace(/\r$/, "").trim();
|
|
11811
|
-
}
|
|
11812
|
-
function resolveFrom(base, value) {
|
|
11813
|
-
return path9.isAbsolute(value) ? value : path9.resolve(base, value);
|
|
11814
|
-
}
|
|
11815
|
-
function setsCoreWorktree(config) {
|
|
11816
|
-
let inCore = false;
|
|
11817
|
-
for (const raw of config.split(`
|
|
11818
|
-
`)) {
|
|
11819
|
-
let line = raw.trim();
|
|
11820
|
-
if (line.startsWith("[")) {
|
|
11821
|
-
const end = line.indexOf("]");
|
|
11822
|
-
if (end === -1) {
|
|
11823
|
-
inCore = false;
|
|
11824
|
-
continue;
|
|
11825
|
-
}
|
|
11826
|
-
inCore = line.slice(1, end).trim().toLowerCase() === "core";
|
|
11827
|
-
line = line.slice(end + 1).trim();
|
|
11828
|
-
}
|
|
11829
|
-
if (inCore && /^worktree\s*(=|$)/i.test(line)) {
|
|
11830
|
-
return true;
|
|
11831
|
-
}
|
|
11832
|
-
}
|
|
11833
|
-
return false;
|
|
11834
|
-
}
|
|
11835
|
-
function isSubmoduleGitdir(gitdir) {
|
|
11836
|
-
return gitdir.split(path9.sep).includes("modules");
|
|
11837
|
-
}
|
|
11838
|
-
function resolveLinkedWorktree(gitFile, gitdir) {
|
|
11839
|
-
const commonFile = path9.join(gitdir, "commondir");
|
|
11840
|
-
if (!fs9.existsSync(commonFile)) {
|
|
11841
|
-
return { reason: "missing-commondir" };
|
|
11842
|
-
}
|
|
11843
|
-
const commonRaw = firstLine2(readSmallFile(commonFile));
|
|
11844
|
-
if (commonRaw === "") {
|
|
11845
|
-
return { reason: "corrupt-git-file" };
|
|
11846
|
-
}
|
|
11847
|
-
const common = realpath(resolveFrom(gitdir, commonRaw));
|
|
11848
|
-
if (gitdir !== path9.join(common, "worktrees", path9.basename(gitdir))) {
|
|
11849
|
-
return { reason: "inconsistent" };
|
|
11850
|
-
}
|
|
11851
|
-
const backRaw = firstLine2(readSmallFile(path9.join(gitdir, "gitdir")));
|
|
11852
|
-
if (backRaw === "") {
|
|
11853
|
-
return { reason: "corrupt-git-file" };
|
|
11854
|
-
}
|
|
11855
|
-
if (realpath(resolveFrom(gitdir, backRaw)) !== realpath(gitFile)) {
|
|
11856
|
-
return { reason: "inconsistent" };
|
|
11857
|
-
}
|
|
11858
|
-
if (path9.basename(common) !== ".git") {
|
|
11859
|
-
return { reason: "unsupported-layout" };
|
|
11860
|
-
}
|
|
11861
|
-
if (setsCoreWorktree(readSmallFile(path9.join(common, "config")))) {
|
|
11862
|
-
return { reason: "core-worktree" };
|
|
11863
|
-
}
|
|
11864
|
-
return { root: path9.dirname(common) };
|
|
11865
|
-
}
|
|
11866
|
-
function deriveMainRoot(checkoutRoot) {
|
|
11867
|
-
const root = realpath(checkoutRoot);
|
|
11868
|
-
const gitPath = path9.join(root, ".git");
|
|
11869
|
-
let stat;
|
|
11870
|
-
try {
|
|
11871
|
-
stat = fs9.lstatSync(gitPath);
|
|
11872
|
-
} catch {
|
|
11873
|
-
return { reason: "not-a-checkout" };
|
|
11874
|
-
}
|
|
11875
|
-
if (stat.isSymbolicLink()) {
|
|
11876
|
-
return { reason: "symlinked-git" };
|
|
11877
|
-
}
|
|
11878
|
-
if (stat.isDirectory()) {
|
|
11879
|
-
return { root };
|
|
11880
|
-
}
|
|
11881
|
-
if (!stat.isFile()) {
|
|
11882
|
-
return { reason: "corrupt-git-file" };
|
|
11883
|
-
}
|
|
11884
|
-
const match = /^gitdir:[ \t]*(.+)$/.exec(firstLine2(readSmallFile(gitPath)));
|
|
11885
|
-
const claimed = match?.[1]?.trim();
|
|
11886
|
-
if (claimed === undefined || claimed === "") {
|
|
11887
|
-
return { reason: "corrupt-git-file" };
|
|
11888
|
-
}
|
|
11889
|
-
const gitdir = realpath(resolveFrom(root, claimed));
|
|
11890
|
-
if (!fs9.statSync(gitdir).isDirectory()) {
|
|
11891
|
-
return { reason: "corrupt-git-file" };
|
|
11892
|
-
}
|
|
11893
|
-
if (path9.basename(path9.dirname(gitdir)) === "worktrees") {
|
|
11894
|
-
return resolveLinkedWorktree(gitPath, gitdir);
|
|
11895
|
-
}
|
|
11896
|
-
if (isSubmoduleGitdir(gitdir)) {
|
|
11897
|
-
return { root };
|
|
11898
|
-
}
|
|
11899
|
-
return { reason: "unsupported-layout" };
|
|
11900
|
-
}
|
|
11901
|
-
function resolveProjectIdentity(checkoutRoot) {
|
|
11902
|
-
try {
|
|
11903
|
-
const derived = deriveMainRoot(checkoutRoot);
|
|
11904
|
-
return "root" in derived ? { status: "resolved", mainRoot: derived.root } : { status: "unresolved", reason: derived.reason };
|
|
11905
|
-
} catch {
|
|
11906
|
-
return { status: "unresolved", reason: "unreadable" };
|
|
11907
|
-
}
|
|
11908
|
-
}
|
|
11909
|
-
function expandHome(entry, homeDir) {
|
|
11910
|
-
if (entry === "~") {
|
|
11911
|
-
return homeDir;
|
|
11912
|
-
}
|
|
11913
|
-
if (entry.startsWith("~/") || entry.startsWith(`~${path9.sep}`)) {
|
|
11914
|
-
return path9.join(homeDir, entry.slice(2));
|
|
11915
|
-
}
|
|
11916
|
-
return entry;
|
|
11917
|
-
}
|
|
11918
|
-
function isAllowedProject(identity, allowList, options = {}) {
|
|
11919
|
-
if (identity.status !== "resolved") {
|
|
11920
|
-
return false;
|
|
11921
|
-
}
|
|
11922
|
-
let mainRoot;
|
|
11923
|
-
try {
|
|
11924
|
-
mainRoot = realpath(identity.mainRoot);
|
|
11925
|
-
} catch {
|
|
11926
|
-
return false;
|
|
11927
|
-
}
|
|
11928
|
-
const homeDir = options.homeDir ?? os2.homedir();
|
|
11929
|
-
for (const entry of allowList) {
|
|
11930
|
-
if (typeof entry !== "string" || entry === "") {
|
|
11931
|
-
continue;
|
|
11932
|
-
}
|
|
11933
|
-
const expanded = expandHome(entry, homeDir);
|
|
11934
|
-
if (expanded === undefined || !path9.isAbsolute(expanded)) {
|
|
11935
|
-
continue;
|
|
11936
|
-
}
|
|
11937
|
-
try {
|
|
11938
|
-
if (realpath(expanded) === mainRoot) {
|
|
11939
|
-
return true;
|
|
11940
|
-
}
|
|
11941
|
-
} catch {}
|
|
11942
|
-
}
|
|
11943
|
-
return false;
|
|
11944
|
-
}
|
|
11945
|
-
|
|
11946
|
-
// src/lib/search-external-sources.ts
|
|
11947
11945
|
var MAX_ACTIVE_SOURCES = 8;
|
|
11948
11946
|
var MAX_LISTED_DROPPED = 8;
|
|
11949
11947
|
function expandHome2(root, homeDir) {
|
|
@@ -11988,10 +11986,7 @@ function projectSourcesOf(proposals, checkoutRoot, shadowed) {
|
|
|
11988
11986
|
return proposals.filter((entry) => !shadowed.has(entry.name)).map((entry) => projectSourceOf(entry, checkoutRoot));
|
|
11989
11987
|
}
|
|
11990
11988
|
function forwardedProjectWarnings(project, projectAllowed) {
|
|
11991
|
-
|
|
11992
|
-
return project.warnings;
|
|
11993
|
-
const aboutEntries = new Set(project.entries.flatMap((entry) => entry.warnings));
|
|
11994
|
-
return project.warnings.filter((warning) => !aboutEntries.has(warning));
|
|
11989
|
+
return projectAllowed ? project.warnings : withoutEntryWarnings(project);
|
|
11995
11990
|
}
|
|
11996
11991
|
function startDirWarnings(startDir, lookup, checkoutRoot) {
|
|
11997
11992
|
const selected = selectProjectConfigFile(checkoutRoot).path;
|
|
@@ -12000,7 +11995,7 @@ function startDirWarnings(startDir, lookup, checkoutRoot) {
|
|
|
12000
11995
|
}
|
|
12001
11996
|
function resolveExternalSources(input) {
|
|
12002
11997
|
const dirs = resolveUserLevelConfigDirs(input.configOptions);
|
|
12003
|
-
const homeDir = dirs.homeDir ||
|
|
11998
|
+
const homeDir = dirs.homeDir || os4.homedir();
|
|
12004
11999
|
const lookup = lookupSearchRoot(input.startDir);
|
|
12005
12000
|
const checkoutRoot = lookup.foundGit ? lookup.root : resolveSearchRoot(input.startDir);
|
|
12006
12001
|
const identity = input.identity ?? resolveProjectIdentity(checkoutRoot);
|
|
@@ -12063,7 +12058,7 @@ function firstRootRejection(checkoutRoot, roots) {
|
|
|
12063
12058
|
function inspectSearch(input) {
|
|
12064
12059
|
const { checkoutRoot } = input;
|
|
12065
12060
|
const dirs = resolveUserLevelConfigDirs(input.configOptions);
|
|
12066
|
-
const homeDir = dirs.homeDir ||
|
|
12061
|
+
const homeDir = dirs.homeDir || os4.homedir();
|
|
12067
12062
|
const identity = input.identity ?? resolveProjectIdentity(checkoutRoot);
|
|
12068
12063
|
const user = loadUserLevelSearchSettings(input.configOptions);
|
|
12069
12064
|
const allow = user.settings?.allow_project_sources ?? [];
|
package/dist/index.js
CHANGED
|
@@ -194,6 +194,11 @@ export declare function symlinkedComponent(container: string, target: string): S
|
|
|
194
194
|
export type ProjectRootRejection = SymlinkedComponent | 'outside';
|
|
195
195
|
/** The reason each rejection gives, as the loaders and the inspector word it. */
|
|
196
196
|
export declare const PROJECT_ROOT_REJECTION_REASONS: Readonly<Record<ProjectRootRejection, string>>;
|
|
197
|
+
/**
|
|
198
|
+
* The warning a loader prints when a project source root is rejected, for the
|
|
199
|
+
* Markdown and Deciduous loaders alike. It names the source, never a path.
|
|
200
|
+
*/
|
|
201
|
+
export declare function projectRootRejectionWarning(sourceName: string, rejection: ProjectRootRejection): string;
|
|
197
202
|
/**
|
|
198
203
|
* Whether a project source root is rejected before it is walked: it is a
|
|
199
204
|
* symlink, passes through a symlink below the checkout, or its real path is not
|
|
@@ -147,6 +147,13 @@ export declare function displaySafe(text: string): string;
|
|
|
147
147
|
* never a value.
|
|
148
148
|
*/
|
|
149
149
|
export declare function validateSearchConfig(value: unknown, trust: SearchConfigTrust, sourcePath: string): SearchConfigValidation;
|
|
150
|
+
/**
|
|
151
|
+
* The warnings of a validation, less the ones about a single source entry (a
|
|
152
|
+
* dropped entry, a dropped `exclude` pattern). Those name a proposal; what is
|
|
153
|
+
* left names fields only. A caller that must not name the proposals of a
|
|
154
|
+
* project that is not allowed uses this on that project's file.
|
|
155
|
+
*/
|
|
156
|
+
export declare function withoutEntryWarnings(validation: Pick<SearchConfigValidation, 'entries' | 'warnings'>): readonly string[];
|
|
150
157
|
/**
|
|
151
158
|
* One source's `search` block after schema validation. `settings` is the
|
|
152
159
|
* schema-parsed block, absent when the source has none. `unreadable` is true
|
package/dist/pi.js
CHANGED
|
@@ -3469,6 +3469,9 @@ var PROJECT_ROOT_REJECTION_REASONS = {
|
|
|
3469
3469
|
ancestor: "a project root passes through a symlink",
|
|
3470
3470
|
outside: "a project root resolves outside the project root"
|
|
3471
3471
|
};
|
|
3472
|
+
function projectRootRejectionWarning(sourceName, rejection) {
|
|
3473
|
+
return rejection === "outside" ? `${sourceName} resolves outside the project root; not loaded` : `${sourceName}: ${PROJECT_ROOT_REJECTION_REASONS[rejection]}; source dropped`;
|
|
3474
|
+
}
|
|
3472
3475
|
function rejectedProjectRoot(checkoutRoot, root) {
|
|
3473
3476
|
const symlinked = symlinkedComponent(checkoutRoot, root);
|
|
3474
3477
|
if (symlinked !== undefined)
|
|
@@ -4064,18 +4067,14 @@ function probeRoots(input, warnings) {
|
|
|
4064
4067
|
const reals = [];
|
|
4065
4068
|
let unreadable = false;
|
|
4066
4069
|
for (const root of input.roots) {
|
|
4067
|
-
const
|
|
4068
|
-
if (
|
|
4069
|
-
warnings.push(
|
|
4070
|
-
return { kind: "dropped" };
|
|
4071
|
-
}
|
|
4072
|
-
if (symlinked === "ancestor") {
|
|
4073
|
-
warnings.push(`${name}: a project root passes through a symlink; source dropped`);
|
|
4070
|
+
const rejection = containedIn === undefined ? undefined : rejectedProjectRoot(containedIn, root);
|
|
4071
|
+
if (rejection !== undefined) {
|
|
4072
|
+
warnings.push(projectRootRejectionWarning(name, rejection));
|
|
4074
4073
|
return { kind: "dropped" };
|
|
4075
4074
|
}
|
|
4076
4075
|
const probe = probeRoot(root, containedIn);
|
|
4077
4076
|
if (probe.kind === "outside") {
|
|
4078
|
-
warnings.push(
|
|
4077
|
+
warnings.push(projectRootRejectionWarning(name, "outside"));
|
|
4079
4078
|
return { kind: "dropped" };
|
|
4080
4079
|
}
|
|
4081
4080
|
if (probe.kind === "unreadable") {
|
|
@@ -4520,9 +4519,7 @@ function projectRootWarning(source, context, root) {
|
|
|
4520
4519
|
if (source.origin !== "project")
|
|
4521
4520
|
return;
|
|
4522
4521
|
const rejection = rejectedProjectRoot(context.checkoutRoot, root);
|
|
4523
|
-
|
|
4524
|
-
return;
|
|
4525
|
-
return rejection === "outside" ? `${source.name} resolves outside the project root; not loaded` : `${source.name}: ${PROJECT_ROOT_REJECTION_REASONS[rejection]}; source dropped`;
|
|
4522
|
+
return rejection === undefined ? undefined : projectRootRejectionWarning(source.name, rejection);
|
|
4526
4523
|
}
|
|
4527
4524
|
function gatherCandidates(source, context, warnings) {
|
|
4528
4525
|
const { name, origin } = source;
|
|
@@ -10972,6 +10969,10 @@ function validateSearchConfig(value, trust, sourcePath) {
|
|
|
10972
10969
|
entries: state.entries
|
|
10973
10970
|
};
|
|
10974
10971
|
}
|
|
10972
|
+
function withoutEntryWarnings(validation) {
|
|
10973
|
+
const aboutEntries = new Set(validation.entries.flatMap((entry) => entry.warnings));
|
|
10974
|
+
return validation.warnings.filter((warning) => !aboutEntries.has(warning));
|
|
10975
|
+
}
|
|
10975
10976
|
function formatSearchFileWarning(sourcePath, reason) {
|
|
10976
10977
|
return `[systematic] search settings in ${displaySafe(sourcePath)} could not be read (${reason}); the settings were ignored, search still runs and its results carry a \`config unreadable\` note.`;
|
|
10977
10978
|
}
|
|
@@ -11109,17 +11110,9 @@ function readTextBounded(filePath, maxBytes) {
|
|
|
11109
11110
|
function absentOrDangling(filePath) {
|
|
11110
11111
|
return configEntryExists(filePath) ? { kind: "failed", reason: "unable to read file" } : { kind: "absent" };
|
|
11111
11112
|
}
|
|
11112
|
-
|
|
11113
|
-
try {
|
|
11114
|
-
return { kind: "text", content: fs6.readFileSync(filePath, "utf-8") };
|
|
11115
|
-
} catch (error) {
|
|
11116
|
-
if (errorCode2(error) === "ENOENT")
|
|
11117
|
-
return absentOrDangling(filePath);
|
|
11118
|
-
return { kind: "failed", reason: "unable to read file" };
|
|
11119
|
-
}
|
|
11120
|
-
}
|
|
11113
|
+
var USER_LEVEL_FILE_MAX_BYTES = Number.POSITIVE_INFINITY;
|
|
11121
11114
|
function readSearchBlock(filePath, maxBytes) {
|
|
11122
|
-
const text =
|
|
11115
|
+
const text = readTextBounded(filePath, maxBytes ?? USER_LEVEL_FILE_MAX_BYTES);
|
|
11123
11116
|
if (text.kind !== "text")
|
|
11124
11117
|
return text;
|
|
11125
11118
|
const content = text.content;
|
|
@@ -11294,10 +11287,7 @@ function projectSourcesOf(proposals, checkoutRoot, shadowed) {
|
|
|
11294
11287
|
return proposals.filter((entry) => !shadowed.has(entry.name)).map((entry) => projectSourceOf(entry, checkoutRoot));
|
|
11295
11288
|
}
|
|
11296
11289
|
function forwardedProjectWarnings(project, projectAllowed) {
|
|
11297
|
-
|
|
11298
|
-
return project.warnings;
|
|
11299
|
-
const aboutEntries = new Set(project.entries.flatMap((entry) => entry.warnings));
|
|
11300
|
-
return project.warnings.filter((warning) => !aboutEntries.has(warning));
|
|
11290
|
+
return projectAllowed ? project.warnings : withoutEntryWarnings(project);
|
|
11301
11291
|
}
|
|
11302
11292
|
function startDirWarnings(startDir, lookup, checkoutRoot) {
|
|
11303
11293
|
const selected = selectProjectConfigFile(checkoutRoot).path;
|
|
@@ -12610,6 +12600,7 @@ ${skillUsage}${ruleSection}${profileSection}
|
|
|
12610
12600
|
|
|
12611
12601
|
// src/lib/config.ts
|
|
12612
12602
|
import fs10 from "node:fs";
|
|
12603
|
+
import os5 from "node:os";
|
|
12613
12604
|
import path10 from "node:path";
|
|
12614
12605
|
import {
|
|
12615
12606
|
parse as parseJsonc2,
|
|
@@ -13502,21 +13493,9 @@ function warnDroppedNames(dropped, field, warned, removalVersion, warningSink =
|
|
|
13502
13493
|
warningSink(`[systematic] "${displayName}" in \`${field}\` is no longer a bundled name and will be ignored.${removalNote} Remove it from your config to silence this warning. See ${MIGRATION_DOCS_URL} for migration guidance.`);
|
|
13503
13494
|
}
|
|
13504
13495
|
}
|
|
13505
|
-
function isErrorWithCode(error) {
|
|
13506
|
-
return error instanceof Error && "code" in error;
|
|
13507
|
-
}
|
|
13508
13496
|
var OVERSIZED_FILE_REASON = `file is larger than ${MAX_PROJECT_CONFIG_BYTES / (1024 * 1024)} MB`;
|
|
13497
|
+
var USER_LEVEL_CONFIG_MAX_BYTES = Number.POSITIVE_INFINITY;
|
|
13509
13498
|
function readConfigText(filePath, maxBytes) {
|
|
13510
|
-
if (maxBytes === undefined) {
|
|
13511
|
-
try {
|
|
13512
|
-
return fs10.readFileSync(filePath, "utf-8");
|
|
13513
|
-
} catch (error) {
|
|
13514
|
-
if (isErrorWithCode(error) && error.code === "ENOENT" && !configEntryExists(filePath)) {
|
|
13515
|
-
return null;
|
|
13516
|
-
}
|
|
13517
|
-
throw new Error(`Invalid Systematic config in ${filePath}: unable to read file`, { cause: error });
|
|
13518
|
-
}
|
|
13519
|
-
}
|
|
13520
13499
|
const read = readBytesBounded(filePath, maxBytes);
|
|
13521
13500
|
switch (read.kind) {
|
|
13522
13501
|
case "bytes":
|
|
@@ -13527,6 +13506,8 @@ function readConfigText(filePath, maxBytes) {
|
|
|
13527
13506
|
throw new Error(`Invalid Systematic config in ${filePath}: unable to read file`);
|
|
13528
13507
|
case "too-large":
|
|
13529
13508
|
throw new Error(`Invalid Systematic config in ${filePath}: unable to read file (${OVERSIZED_FILE_REASON})`);
|
|
13509
|
+
case "not-regular":
|
|
13510
|
+
throw new Error(`Invalid Systematic config in ${filePath}: unable to read file (not a regular file)`);
|
|
13530
13511
|
default:
|
|
13531
13512
|
throw new Error(`Invalid Systematic config in ${filePath}: unable to read file`);
|
|
13532
13513
|
}
|
|
@@ -13634,10 +13615,17 @@ ${formatted.map((entry) => ` - ${entry}`).join(`
|
|
|
13634
13615
|
});
|
|
13635
13616
|
}
|
|
13636
13617
|
function loadConfigSource(input) {
|
|
13637
|
-
const {
|
|
13618
|
+
const {
|
|
13619
|
+
filePath,
|
|
13620
|
+
layer,
|
|
13621
|
+
invalidSource,
|
|
13622
|
+
warningSink,
|
|
13623
|
+
allowProjectProfiles,
|
|
13624
|
+
projectAllowed
|
|
13625
|
+
} = input;
|
|
13638
13626
|
const trust = LAYER_TRUST[layer];
|
|
13639
13627
|
try {
|
|
13640
|
-
const rawConfig = loadJsoncFile(filePath, layer === "project" ? MAX_PROJECT_CONFIG_BYTES :
|
|
13628
|
+
const rawConfig = loadJsoncFile(filePath, layer === "project" ? MAX_PROJECT_CONFIG_BYTES : USER_LEVEL_CONFIG_MAX_BYTES);
|
|
13641
13629
|
if (!rawConfig) {
|
|
13642
13630
|
return {
|
|
13643
13631
|
metadata: { kind: trust, presence: "absent" },
|
|
@@ -13647,7 +13635,7 @@ function loadConfigSource(input) {
|
|
|
13647
13635
|
const protectedFields = collectProjectProtectedFields(rawConfig, trust, allowProjectProfiles);
|
|
13648
13636
|
const topLevelStripped = trust === "project" ? stripProjectProtectedFields(rawConfig, allowProjectProfiles) : rawConfig;
|
|
13649
13637
|
const config = trust === "project" ? stripProjectSecurityOverlayFields(topLevelStripped, filePath, warningSink) : topLevelStripped;
|
|
13650
|
-
const { config: configWithoutSearch, search } = splitSearchBlock(config, filePath, trust, warningSink);
|
|
13638
|
+
const { config: configWithoutSearch, search } = splitSearchBlock(config, filePath, trust, warningSink, projectAllowed);
|
|
13651
13639
|
const result = SystematicConfigSchema.safeParse(configWithoutSearch);
|
|
13652
13640
|
if (!result.success) {
|
|
13653
13641
|
throwTopLevelConfigSchemaError(filePath, trust, result.error.issues, configWithoutSearch);
|
|
@@ -13677,12 +13665,14 @@ function loadConfigSource(input) {
|
|
|
13677
13665
|
};
|
|
13678
13666
|
}
|
|
13679
13667
|
}
|
|
13680
|
-
function splitSearchBlock(config, filePath, trust, warningSink) {
|
|
13668
|
+
function splitSearchBlock(config, filePath, trust, warningSink, projectAllowed) {
|
|
13681
13669
|
if (!Object.hasOwn(config, "search"))
|
|
13682
13670
|
return { config, search: undefined };
|
|
13683
13671
|
const { search: rawSearch, ...rest } = config;
|
|
13684
13672
|
const validation = validateSearchConfig(rawSearch, trust === "project" ? "project" : "user", filePath);
|
|
13685
|
-
|
|
13673
|
+
const hideEntryWarnings = trust === "project" && validation.entries.some((entry) => entry.warnings.length > 0) && !projectAllowed();
|
|
13674
|
+
const warnings = hideEntryWarnings ? withoutEntryWarnings(validation) : validation.warnings;
|
|
13675
|
+
for (const message of warnings)
|
|
13686
13676
|
warningSink(message);
|
|
13687
13677
|
return {
|
|
13688
13678
|
config: rest,
|
|
@@ -14044,7 +14034,8 @@ function loadUserLevelSources(paths, context) {
|
|
|
14044
14034
|
...context,
|
|
14045
14035
|
filePath,
|
|
14046
14036
|
layer,
|
|
14047
|
-
allowProjectProfiles: false
|
|
14037
|
+
allowProjectProfiles: false,
|
|
14038
|
+
projectAllowed: () => false
|
|
14048
14039
|
});
|
|
14049
14040
|
loadedByRealFile.set(realFile, loaded);
|
|
14050
14041
|
return loaded;
|
|
@@ -14123,6 +14114,9 @@ function loadConfigWithSources(projectDir, options) {
|
|
|
14123
14114
|
warningSink
|
|
14124
14115
|
});
|
|
14125
14116
|
const { allowProjectProfiles } = userLevel;
|
|
14117
|
+
const mergedSearch = mergeUserLevelSearch(userLevel);
|
|
14118
|
+
const homeDir = resolveUserLevelConfigDirs(options).homeDir || os5.homedir();
|
|
14119
|
+
const projectAllowed = () => isAllowedProject(resolveProjectIdentity(paths.projectRoot), mergedSearch.settings?.allow_project_sources ?? [], { homeDir });
|
|
14126
14120
|
const aliasLoaded = aliasedFiles.some(({ layer }) => userLevel[USER_LEVEL_SLOT[layer]].source !== null);
|
|
14127
14121
|
const project = includeProject ? loadConfigSource({
|
|
14128
14122
|
filePath: paths.projectConfig,
|
|
@@ -14130,7 +14124,8 @@ function loadConfigWithSources(projectDir, options) {
|
|
|
14130
14124
|
invalidSource,
|
|
14131
14125
|
warningSink: boundedProjectStrip.sink,
|
|
14132
14126
|
reportInvalid,
|
|
14133
|
-
allowProjectProfiles
|
|
14127
|
+
allowProjectProfiles,
|
|
14128
|
+
projectAllowed
|
|
14134
14129
|
}) : {
|
|
14135
14130
|
metadata: { kind: "project", presence: "absent" },
|
|
14136
14131
|
source: null
|
|
@@ -14168,10 +14163,6 @@ function loadConfigWithSources(projectDir, options) {
|
|
|
14168
14163
|
const sources = chainOf(layers);
|
|
14169
14164
|
warnRemovedKeys(sources, warningSink);
|
|
14170
14165
|
const warned = new Set;
|
|
14171
|
-
const mergedSearch = mergeSearchSettings(["user", "userLocal", "custom", "customLocal"].flatMap((slot) => {
|
|
14172
|
-
const source = layers[slot];
|
|
14173
|
-
return source?.search && isUserLevelLayer(source.layer) ? [{ ...source.search, layer: source.layer }] : [];
|
|
14174
|
-
}));
|
|
14175
14166
|
assertAllProfileBundlesAreValid([
|
|
14176
14167
|
layers.user,
|
|
14177
14168
|
layers.userLocal,
|
|
@@ -14245,6 +14236,12 @@ function loadConfigWithSources(projectDir, options) {
|
|
|
14245
14236
|
activeProfileSourcePath: profileSelection.bundleSource?.path ?? null
|
|
14246
14237
|
};
|
|
14247
14238
|
}
|
|
14239
|
+
function mergeUserLevelSearch(userLevel) {
|
|
14240
|
+
return mergeSearchSettings(["user", "userLocal", "custom", "customLocal"].flatMap((slot) => {
|
|
14241
|
+
const source = userLevel[slot].source;
|
|
14242
|
+
return source?.search && isUserLevelLayer(source.layer) ? [{ ...source.search, layer: source.layer }] : [];
|
|
14243
|
+
}));
|
|
14244
|
+
}
|
|
14248
14245
|
function isUserLevelLayer(layer) {
|
|
14249
14246
|
return layer !== "project";
|
|
14250
14247
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fro.bot/systematic",
|
|
3
|
-
"version": "3.31.
|
|
3
|
+
"version": "3.31.2",
|
|
4
4
|
"description": "Compound-engineering loops for OpenCode, Pi, and Claude Code",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://fro.bot/systematic",
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
},
|
|
118
118
|
"devDependencies": {
|
|
119
119
|
"@biomejs/biome": "2.6.4",
|
|
120
|
-
"@earendil-works/pi-coding-agent": "1.
|
|
120
|
+
"@earendil-works/pi-coding-agent": "1.5.0",
|
|
121
121
|
"@opencode-ai/plugin": "1.19.5",
|
|
122
122
|
"@opencode-ai/sdk": "1.19.5",
|
|
123
123
|
"@opencode/client": "2.2.5",
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
"zod": "4.6.7"
|
|
146
146
|
},
|
|
147
147
|
"overrides": {
|
|
148
|
-
"@earendil-works/pi-ai": "1.
|
|
148
|
+
"@earendil-works/pi-ai": "1.5.0",
|
|
149
149
|
"brace-expansion": "^5.0.8",
|
|
150
150
|
"conventional-changelog-writer": ">=9",
|
|
151
151
|
"devalue": "^5.9.3",
|
|
@@ -384,11 +384,13 @@ export function runGit(args, cwd, options = {}) {
|
|
|
384
384
|
})
|
|
385
385
|
}
|
|
386
386
|
|
|
387
|
-
// Controlled-locale
|
|
388
|
-
//
|
|
387
|
+
// Controlled-locale messages for git's unambiguous "no repository"
|
|
388
|
+
// diagnostics: discovery reached the filesystem root ("or any of the parent
|
|
389
|
+
// directories"), or stopped at a mount point ("or any parent up to mount
|
|
390
|
+
// point"). Both are distinct from the corrupt-metadata message ("not a git
|
|
389
391
|
// repository: <path>"), which lacks the parenthetical and must not match.
|
|
390
392
|
const NOT_A_REPO_PATTERN =
|
|
391
|
-
/^fatal: not a git repository \(or any of the parent directories\): /m
|
|
393
|
+
/^fatal: not a git repository \(or any (?:of the parent directories\): |parent up to mount point )/m
|
|
392
394
|
|
|
393
395
|
export function classifyGitWorkTree(root, options = {}) {
|
|
394
396
|
const result = runGit(['rev-parse', '--is-inside-work-tree'], root, options)
|