@cortexkit/magic-context 0.27.0 → 0.27.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/dist/index.js +69 -50
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7806,8 +7806,10 @@ var require_src2 = __commonJS((exports, module) => {
|
|
|
7806
7806
|
});
|
|
7807
7807
|
|
|
7808
7808
|
// src/lib/atomic-write.ts
|
|
7809
|
-
import { chmodSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
7809
|
+
import { chmodSync, mkdirSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
7810
|
+
import { dirname } from "node:path";
|
|
7810
7811
|
function writeFileAtomic(targetPath, data) {
|
|
7812
|
+
mkdirSync(dirname(targetPath), { recursive: true });
|
|
7811
7813
|
const tmpPath = `${targetPath}.tmp`;
|
|
7812
7814
|
writeFileSync(tmpPath, data, { encoding: "utf-8" });
|
|
7813
7815
|
try {
|
|
@@ -7881,7 +7883,7 @@ var init_opencode_install = __esm(() => {
|
|
|
7881
7883
|
import {
|
|
7882
7884
|
closeSync,
|
|
7883
7885
|
existsSync as existsSync3,
|
|
7884
|
-
mkdirSync,
|
|
7886
|
+
mkdirSync as mkdirSync2,
|
|
7885
7887
|
openSync,
|
|
7886
7888
|
readFileSync,
|
|
7887
7889
|
renameSync as renameSync2,
|
|
@@ -7891,7 +7893,7 @@ import {
|
|
|
7891
7893
|
writeFileSync as writeFileSync2
|
|
7892
7894
|
} from "node:fs";
|
|
7893
7895
|
import { homedir as homedir2 } from "node:os";
|
|
7894
|
-
import { basename, dirname, isAbsolute, join as join3 } from "node:path";
|
|
7896
|
+
import { basename, dirname as dirname2, isAbsolute, join as join3 } from "node:path";
|
|
7895
7897
|
function homeDir() {
|
|
7896
7898
|
if (process.platform === "win32") {
|
|
7897
7899
|
return process.env.USERPROFILE || process.env.HOME || homedir2();
|
|
@@ -7922,7 +7924,18 @@ function legacySourcesForBase(basePath, label) {
|
|
|
7922
7924
|
{ path: `${basePath}.json`, label: `${label} magic-context.json` }
|
|
7923
7925
|
];
|
|
7924
7926
|
}
|
|
7927
|
+
function userScopeConfigPaths() {
|
|
7928
|
+
return new Set([
|
|
7929
|
+
`${cortexKitUserConfigBasePath()}.jsonc`,
|
|
7930
|
+
`${cortexKitUserConfigBasePath()}.json`,
|
|
7931
|
+
join3(configHome(), "opencode", `${CONFIG_FILE_BASENAME}.jsonc`),
|
|
7932
|
+
join3(configHome(), "opencode", `${CONFIG_FILE_BASENAME}.json`),
|
|
7933
|
+
join3(homeDir(), ".pi", "agent", `${CONFIG_FILE_BASENAME}.jsonc`),
|
|
7934
|
+
join3(homeDir(), ".pi", "agent", `${CONFIG_FILE_BASENAME}.json`)
|
|
7935
|
+
]);
|
|
7936
|
+
}
|
|
7925
7937
|
function resolveLegacyConfigSources(directory) {
|
|
7938
|
+
const userPaths = userScopeConfigPaths();
|
|
7926
7939
|
return {
|
|
7927
7940
|
user: [
|
|
7928
7941
|
...legacySourcesForBase(join3(configHome(), "opencode", CONFIG_FILE_BASENAME), "OpenCode user"),
|
|
@@ -7932,7 +7945,7 @@ function resolveLegacyConfigSources(directory) {
|
|
|
7932
7945
|
...legacySourcesForBase(join3(directory, CONFIG_FILE_BASENAME), "project root"),
|
|
7933
7946
|
...legacySourcesForBase(join3(directory, ".opencode", CONFIG_FILE_BASENAME), "OpenCode project"),
|
|
7934
7947
|
...legacySourcesForBase(join3(directory, ".pi", CONFIG_FILE_BASENAME), "Pi project")
|
|
7935
|
-
]
|
|
7948
|
+
].filter((source) => !userPaths.has(source.path))
|
|
7936
7949
|
};
|
|
7937
7950
|
}
|
|
7938
7951
|
function resolveLegacyConfigSourcesForHarness(directory, harness) {
|
|
@@ -8046,7 +8059,7 @@ function fileSemanticsMatch(a, b) {
|
|
|
8046
8059
|
function acquireConfigMigrationLock(lockDir) {
|
|
8047
8060
|
for (let attempt = 0;attempt < 2; attempt++) {
|
|
8048
8061
|
try {
|
|
8049
|
-
|
|
8062
|
+
mkdirSync2(lockDir, { recursive: false });
|
|
8050
8063
|
return () => {
|
|
8051
8064
|
try {
|
|
8052
8065
|
rmSync(lockDir, { recursive: true, force: true });
|
|
@@ -8071,8 +8084,8 @@ function acquireConfigMigrationLock(lockDir) {
|
|
|
8071
8084
|
return null;
|
|
8072
8085
|
}
|
|
8073
8086
|
function atomicCopyConfigFile(sourcePath, targetPath) {
|
|
8074
|
-
|
|
8075
|
-
const tmpPath = join3(
|
|
8087
|
+
mkdirSync2(dirname2(targetPath), { recursive: true });
|
|
8088
|
+
const tmpPath = join3(dirname2(targetPath), `.${basename(targetPath)}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}.tmp`);
|
|
8076
8089
|
let fd = null;
|
|
8077
8090
|
try {
|
|
8078
8091
|
fd = openSync(tmpPath, "wx", 384);
|
|
@@ -8093,8 +8106,8 @@ function atomicCopyConfigFile(sourcePath, targetPath) {
|
|
|
8093
8106
|
}
|
|
8094
8107
|
}
|
|
8095
8108
|
function atomicWriteConfigFile(targetPath, content) {
|
|
8096
|
-
|
|
8097
|
-
const tmpPath = join3(
|
|
8109
|
+
mkdirSync2(dirname2(targetPath), { recursive: true });
|
|
8110
|
+
const tmpPath = join3(dirname2(targetPath), `.${basename(targetPath)}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}.tmp`);
|
|
8098
8111
|
let fd = null;
|
|
8099
8112
|
try {
|
|
8100
8113
|
fd = openSync(tmpPath, "wx", 384);
|
|
@@ -8166,7 +8179,7 @@ function migrateConfigFile(opts) {
|
|
|
8166
8179
|
if (existingSources.length === 0) {
|
|
8167
8180
|
return { migrated: false, conflict: false, targetPath: opts.targetPath, warnings };
|
|
8168
8181
|
}
|
|
8169
|
-
|
|
8182
|
+
mkdirSync2(dirname2(opts.targetPath), { recursive: true });
|
|
8170
8183
|
const release = acquireConfigMigrationLock(`${opts.targetPath}.lock`);
|
|
8171
8184
|
if (!release) {
|
|
8172
8185
|
warnings.push(`Config migration for ${opts.scope} skipped this run (another instance is migrating); will retry on next start.`);
|
|
@@ -8341,7 +8354,7 @@ function detectConfigPaths() {
|
|
|
8341
8354
|
tuiConfig = tuiJsonPath;
|
|
8342
8355
|
tuiConfigFormat = "json";
|
|
8343
8356
|
} else {
|
|
8344
|
-
tuiConfig =
|
|
8357
|
+
tuiConfig = tuiJsoncPath;
|
|
8345
8358
|
tuiConfigFormat = "none";
|
|
8346
8359
|
}
|
|
8347
8360
|
return {
|
|
@@ -8415,7 +8428,7 @@ var init_paths = __esm(() => {
|
|
|
8415
8428
|
|
|
8416
8429
|
// src/adapters/opencode.ts
|
|
8417
8430
|
import { existsSync as existsSync5, readFileSync as readFileSync2 } from "node:fs";
|
|
8418
|
-
import { dirname as
|
|
8431
|
+
import { dirname as dirname3 } from "node:path";
|
|
8419
8432
|
|
|
8420
8433
|
class OpenCodeAdapter {
|
|
8421
8434
|
kind = "opencode";
|
|
@@ -8641,10 +8654,10 @@ function matchesPluginEntry(entry, pkgName) {
|
|
|
8641
8654
|
return head === pkgName;
|
|
8642
8655
|
}
|
|
8643
8656
|
function ensureDir(filePath) {
|
|
8644
|
-
const dir =
|
|
8657
|
+
const dir = dirname3(filePath);
|
|
8645
8658
|
if (!existsSync5(dir)) {
|
|
8646
|
-
const { mkdirSync:
|
|
8647
|
-
|
|
8659
|
+
const { mkdirSync: mkdirSync3 } = __require("node:fs");
|
|
8660
|
+
mkdirSync3(dir, { recursive: true });
|
|
8648
8661
|
}
|
|
8649
8662
|
}
|
|
8650
8663
|
var import_comment_json, PLUGIN_NAME = "@cortexkit/opencode-magic-context", PLUGIN_ENTRY;
|
|
@@ -8746,7 +8759,7 @@ var init_pi_helpers = __esm(() => {
|
|
|
8746
8759
|
// src/adapters/pi.ts
|
|
8747
8760
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
8748
8761
|
import { existsSync as existsSync7, readFileSync as readFileSync3 } from "node:fs";
|
|
8749
|
-
import { dirname as
|
|
8762
|
+
import { dirname as dirname4 } from "node:path";
|
|
8750
8763
|
|
|
8751
8764
|
class PiAdapter {
|
|
8752
8765
|
kind = "pi";
|
|
@@ -8903,10 +8916,10 @@ function matchesPiPackage(entry) {
|
|
|
8903
8916
|
return false;
|
|
8904
8917
|
}
|
|
8905
8918
|
function ensureDir2(filePath) {
|
|
8906
|
-
const dir =
|
|
8919
|
+
const dir = dirname4(filePath);
|
|
8907
8920
|
if (!existsSync7(dir)) {
|
|
8908
|
-
const { mkdirSync:
|
|
8909
|
-
|
|
8921
|
+
const { mkdirSync: mkdirSync3 } = __require("node:fs");
|
|
8922
|
+
mkdirSync3(dir, { recursive: true });
|
|
8910
8923
|
}
|
|
8911
8924
|
}
|
|
8912
8925
|
var import_comment_json2, PLUGIN_NAME2 = "@cortexkit/pi-magic-context";
|
|
@@ -11484,11 +11497,11 @@ var init_opencode_helpers = __esm(() => {
|
|
|
11484
11497
|
});
|
|
11485
11498
|
|
|
11486
11499
|
// src/commands/setup-opencode.ts
|
|
11487
|
-
import { existsSync as existsSync10, mkdirSync as
|
|
11488
|
-
import { dirname as
|
|
11500
|
+
import { existsSync as existsSync10, mkdirSync as mkdirSync3, readFileSync as readFileSync6 } from "node:fs";
|
|
11501
|
+
import { basename as basename2, dirname as dirname5 } from "node:path";
|
|
11489
11502
|
function ensureDir3(dir) {
|
|
11490
11503
|
if (!existsSync10(dir)) {
|
|
11491
|
-
|
|
11504
|
+
mkdirSync3(dir, { recursive: true });
|
|
11492
11505
|
}
|
|
11493
11506
|
}
|
|
11494
11507
|
function readJsonc(path2) {
|
|
@@ -11501,7 +11514,7 @@ function readJsonc(path2) {
|
|
|
11501
11514
|
}
|
|
11502
11515
|
}
|
|
11503
11516
|
function addPluginToOpenCodeConfig(configPath, format) {
|
|
11504
|
-
ensureDir3(
|
|
11517
|
+
ensureDir3(dirname5(configPath));
|
|
11505
11518
|
if (format === "none") {
|
|
11506
11519
|
const config = {
|
|
11507
11520
|
plugin: [PLUGIN_ENTRY2],
|
|
@@ -11531,7 +11544,7 @@ function addPluginToOpenCodeConfig(configPath, format) {
|
|
|
11531
11544
|
`);
|
|
11532
11545
|
}
|
|
11533
11546
|
function addPluginToTuiConfig(configPath, format) {
|
|
11534
|
-
ensureDir3(
|
|
11547
|
+
ensureDir3(dirname5(configPath));
|
|
11535
11548
|
if (format === "none") {
|
|
11536
11549
|
writeFileAtomic(configPath, `${import_comment_json4.stringify({ plugin: [PLUGIN_ENTRY2] }, null, 2)}
|
|
11537
11550
|
`);
|
|
@@ -11734,7 +11747,7 @@ async function runSetup(dryRun = false) {
|
|
|
11734
11747
|
}
|
|
11735
11748
|
if (dryRun) {
|
|
11736
11749
|
log.message(`[dry-run] would write Magic Context config to ${paths.magicContextConfig}`);
|
|
11737
|
-
log.message(
|
|
11750
|
+
log.message(`[dry-run] would add the TUI sidebar plugin to ${paths.tuiConfig}`);
|
|
11738
11751
|
} else {
|
|
11739
11752
|
writeMagicContextConfig(paths.magicContextConfig, {
|
|
11740
11753
|
historianModel,
|
|
@@ -11747,7 +11760,7 @@ async function runSetup(dryRun = false) {
|
|
|
11747
11760
|
});
|
|
11748
11761
|
log.success(`Config written to ${paths.magicContextConfig}`);
|
|
11749
11762
|
addPluginToTuiConfig(paths.tuiConfig, paths.tuiConfigFormat);
|
|
11750
|
-
log.success(
|
|
11763
|
+
log.success(`TUI sidebar plugin added to ${basename2(paths.tuiConfig)}`);
|
|
11751
11764
|
}
|
|
11752
11765
|
if (paths.omoConfig && !hadExistingSetup) {
|
|
11753
11766
|
log.warn(`Found oh-my-opencode config: ${paths.omoConfig}`);
|
|
@@ -11872,11 +11885,11 @@ var init_pi_package_entry = __esm(() => {
|
|
|
11872
11885
|
});
|
|
11873
11886
|
|
|
11874
11887
|
// src/commands/setup-pi.ts
|
|
11875
|
-
import { existsSync as existsSync11, mkdirSync as
|
|
11876
|
-
import { dirname as
|
|
11888
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync4, readFileSync as readFileSync7 } from "node:fs";
|
|
11889
|
+
import { dirname as dirname6 } from "node:path";
|
|
11877
11890
|
function ensureDir4(path2) {
|
|
11878
11891
|
if (!existsSync11(path2))
|
|
11879
|
-
|
|
11892
|
+
mkdirSync4(path2, { recursive: true });
|
|
11880
11893
|
}
|
|
11881
11894
|
async function getDefaultPrompts() {
|
|
11882
11895
|
const { promptIO: promptIO2 } = await Promise.resolve().then(() => (init_prompts(), exports_prompts));
|
|
@@ -11916,7 +11929,7 @@ function comparePiVersion(a, b2) {
|
|
|
11916
11929
|
return 0;
|
|
11917
11930
|
}
|
|
11918
11931
|
function writePiSettingsPackage(settingsPath, packageSource = PI_PACKAGE_SOURCE) {
|
|
11919
|
-
ensureDir4(
|
|
11932
|
+
ensureDir4(dirname6(settingsPath));
|
|
11920
11933
|
const settings = existsSync11(settingsPath) ? readJsonc2(settingsPath) ?? {} : {};
|
|
11921
11934
|
const packages = Array.isArray(settings.packages) ? settings.packages : [];
|
|
11922
11935
|
const hasPackage = hasPiMagicContextPackage(packages);
|
|
@@ -11928,7 +11941,7 @@ function writePiSettingsPackage(settingsPath, packageSource = PI_PACKAGE_SOURCE)
|
|
|
11928
11941
|
return !hasPackage;
|
|
11929
11942
|
}
|
|
11930
11943
|
function writeMagicContextConfig2(configPath, options) {
|
|
11931
|
-
ensureDir4(
|
|
11944
|
+
ensureDir4(dirname6(configPath));
|
|
11932
11945
|
const config = existsSync11(configPath) ? readJsonc2(configPath) ?? {} : {};
|
|
11933
11946
|
if (!config.$schema) {
|
|
11934
11947
|
config.$schema = "https://raw.githubusercontent.com/cortexkit/magic-context/master/assets/magic-context.schema.json";
|
|
@@ -12262,7 +12275,7 @@ __export(exports_migrate, {
|
|
|
12262
12275
|
formatPiFilenameTimestamp: () => formatPiFilenameTimestamp
|
|
12263
12276
|
});
|
|
12264
12277
|
import { randomBytes } from "node:crypto";
|
|
12265
|
-
import { existsSync as existsSync12, mkdirSync as
|
|
12278
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync5, unlinkSync as unlinkSync2, writeFileSync as writeFileSync4 } from "node:fs";
|
|
12266
12279
|
import { homedir as homedir7 } from "node:os";
|
|
12267
12280
|
import { join as join10 } from "node:path";
|
|
12268
12281
|
function defaultOpenCodeDbPath() {
|
|
@@ -12275,7 +12288,7 @@ function defaultPiSessionsRoot() {
|
|
|
12275
12288
|
return join10(homedir7(), ".pi", "agent", "sessions");
|
|
12276
12289
|
}
|
|
12277
12290
|
function defaultFs() {
|
|
12278
|
-
return { existsSync: existsSync12, mkdirSync:
|
|
12291
|
+
return { existsSync: existsSync12, mkdirSync: mkdirSync5, writeFileSync: writeFileSync4, unlinkSync: unlinkSync2 };
|
|
12279
12292
|
}
|
|
12280
12293
|
function stmt(db, sql) {
|
|
12281
12294
|
return db.prepare(sql);
|
|
@@ -146500,10 +146513,10 @@ var init_tool_owner_backfill = __esm(() => {
|
|
|
146500
146513
|
});
|
|
146501
146514
|
|
|
146502
146515
|
// ../plugin/src/features/magic-context/storage-db.ts
|
|
146503
|
-
import { chmodSync as chmodSync2, copyFileSync as copyFileSync2, cpSync, existsSync as existsSync15, mkdirSync as
|
|
146504
|
-
import { dirname as
|
|
146516
|
+
import { chmodSync as chmodSync2, copyFileSync as copyFileSync2, cpSync, existsSync as existsSync15, mkdirSync as mkdirSync7, mkdtempSync } from "node:fs";
|
|
146517
|
+
import { dirname as dirname8, join as join13 } from "node:path";
|
|
146505
146518
|
function ensureSecureStorageDir(dir) {
|
|
146506
|
-
|
|
146519
|
+
mkdirSync7(dir, { recursive: true, mode: 448 });
|
|
146507
146520
|
if (!PERMISSIONS_ENFORCEABLE)
|
|
146508
146521
|
return;
|
|
146509
146522
|
try {
|
|
@@ -146528,7 +146541,7 @@ function restrictDatabaseFilePermissions(dbPath) {
|
|
|
146528
146541
|
}
|
|
146529
146542
|
function resolveDatabasePath(dbPathOverride) {
|
|
146530
146543
|
if (dbPathOverride) {
|
|
146531
|
-
return { dbDir:
|
|
146544
|
+
return { dbDir: dirname8(dbPathOverride), dbPath: dbPathOverride };
|
|
146532
146545
|
}
|
|
146533
146546
|
const testDataDir = process.env.MAGIC_CONTEXT_TEST_DATA_DIR;
|
|
146534
146547
|
if (testDataDir && !process.env.XDG_DATA_HOME) {
|
|
@@ -164931,7 +164944,7 @@ var init_magic_context = __esm(() => {
|
|
|
164931
164944
|
// ../plugin/src/config/variable.ts
|
|
164932
164945
|
import { existsSync as existsSync16, readFileSync as readFileSync8 } from "node:fs";
|
|
164933
164946
|
import { homedir as homedir9 } from "node:os";
|
|
164934
|
-
import { dirname as
|
|
164947
|
+
import { dirname as dirname9, isAbsolute as isAbsolute2, resolve as resolve2 } from "node:path";
|
|
164935
164948
|
function sensitiveFilePathReason(resolvedPath) {
|
|
164936
164949
|
const home = homedir9();
|
|
164937
164950
|
const sensitiveDirs = [
|
|
@@ -164978,7 +164991,7 @@ function substituteConfigVariables(input) {
|
|
|
164978
164991
|
if (fileMatches.length === 0) {
|
|
164979
164992
|
return { text: text2, warnings };
|
|
164980
164993
|
}
|
|
164981
|
-
const configDir = input.configPath ?
|
|
164994
|
+
const configDir = input.configPath ? dirname9(input.configPath) : process.cwd();
|
|
164982
164995
|
let output = "";
|
|
164983
164996
|
let cursor = 0;
|
|
164984
164997
|
for (const match of fileMatches) {
|
|
@@ -165442,13 +165455,13 @@ var DEFAULT_TIMEOUT_MS = 1e4, MAX_PREVIEW_CHARS = 240;
|
|
|
165442
165455
|
import {
|
|
165443
165456
|
chmodSync as chmodSync3,
|
|
165444
165457
|
existsSync as existsSync18,
|
|
165445
|
-
mkdirSync as
|
|
165458
|
+
mkdirSync as mkdirSync8,
|
|
165446
165459
|
readFileSync as readFileSync10,
|
|
165447
165460
|
renameSync as renameSync3,
|
|
165448
165461
|
statSync as statSync6,
|
|
165449
165462
|
writeFileSync as writeFileSync5
|
|
165450
165463
|
} from "node:fs";
|
|
165451
|
-
import { dirname as
|
|
165464
|
+
import { dirname as dirname10, join as join14 } from "node:path";
|
|
165452
165465
|
function pluginEntryId(entry) {
|
|
165453
165466
|
if (typeof entry === "string")
|
|
165454
165467
|
return entry;
|
|
@@ -165495,7 +165508,7 @@ function resolveTuiConfigPath() {
|
|
|
165495
165508
|
return jsoncPath;
|
|
165496
165509
|
if (existsSync18(jsonPath))
|
|
165497
165510
|
return jsonPath;
|
|
165498
|
-
return
|
|
165511
|
+
return jsoncPath;
|
|
165499
165512
|
}
|
|
165500
165513
|
function ensureTuiPluginEntry() {
|
|
165501
165514
|
try {
|
|
@@ -165536,7 +165549,7 @@ function ensureTuiPluginEntry() {
|
|
|
165536
165549
|
}
|
|
165537
165550
|
}
|
|
165538
165551
|
config2.plugin = plugins;
|
|
165539
|
-
|
|
165552
|
+
mkdirSync8(dirname10(configPath), { recursive: true });
|
|
165540
165553
|
writeTuiConfigAtomic(configPath, config2);
|
|
165541
165554
|
log2(`[magic-context] updated TUI plugin entry in ${configPath}`);
|
|
165542
165555
|
return true;
|
|
@@ -165721,6 +165734,12 @@ function redactionTypeForKey(key) {
|
|
|
165721
165734
|
const suffix = normalized.split(".").filter(Boolean).at(-1) ?? normalized;
|
|
165722
165735
|
return suffix || "secret";
|
|
165723
165736
|
}
|
|
165737
|
+
function isNonSecretScalarValue(value) {
|
|
165738
|
+
const v2 = value.trim();
|
|
165739
|
+
if (v2 === "true" || v2 === "false" || v2 === "null" || v2 === "undefined")
|
|
165740
|
+
return true;
|
|
165741
|
+
return /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/.test(v2);
|
|
165742
|
+
}
|
|
165724
165743
|
function isSecretKey(key) {
|
|
165725
165744
|
const segments = key.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toLowerCase().split(/[._-]+/).filter(Boolean);
|
|
165726
165745
|
if (segments.length === 0)
|
|
@@ -165880,11 +165899,11 @@ var init_redaction = __esm(() => {
|
|
|
165880
165899
|
},
|
|
165881
165900
|
{
|
|
165882
165901
|
pattern: /(["'])([^"']*(?:key|token|secret|password|auth|bearer|credential)[^"']*)\1(\s*:\s*)(["'])([^"']*)\4/gi,
|
|
165883
|
-
replacement: (
|
|
165902
|
+
replacement: (full, quote, key, separator, valueQuote, value) => isNonSecretScalarValue(value) ? full : `${quote}${key}${quote}${separator}${valueQuote}<REDACTED:${redactionTypeForKey(key)}>${valueQuote}`
|
|
165884
165903
|
},
|
|
165885
165904
|
{
|
|
165886
165905
|
pattern: /\b([A-Za-z0-9_.-]*(?:key|token|secret|password|auth|bearer|credential)[A-Za-z0-9_.-]*)\s*=\s*([^\s'"`]+)/gi,
|
|
165887
|
-
replacement: (
|
|
165906
|
+
replacement: (full, key, value) => isNonSecretScalarValue(value) ? full : `${key}=<REDACTED:${redactionTypeForKey(key)}>`
|
|
165888
165907
|
}
|
|
165889
165908
|
];
|
|
165890
165909
|
});
|
|
@@ -166382,7 +166401,7 @@ var init_diagnostics_opencode = __esm(() => {
|
|
|
166382
166401
|
// src/lib/embedding-runtime.ts
|
|
166383
166402
|
import { existsSync as existsSync20 } from "node:fs";
|
|
166384
166403
|
import { createRequire as createRequire3 } from "node:module";
|
|
166385
|
-
import { dirname as
|
|
166404
|
+
import { dirname as dirname11, join as join16, sep } from "node:path";
|
|
166386
166405
|
function expectedBinaryRelPath(platform, arch) {
|
|
166387
166406
|
const supportedPlatform = platform === "linux" || platform === "darwin" || platform === "win32";
|
|
166388
166407
|
const supportedArch = arch === "x64" || arch === "arm64";
|
|
@@ -166426,7 +166445,7 @@ function checkLocalEmbeddingRuntime(installRoots, platform = process.platform, a
|
|
|
166426
166445
|
function packageDirFromResolved(resolvedPath, packageName) {
|
|
166427
166446
|
const marker = `node_modules${sep}${packageName.split("/").join(sep)}`;
|
|
166428
166447
|
const idx = resolvedPath.indexOf(marker);
|
|
166429
|
-
return idx >= 0 ? resolvedPath.slice(0, idx + marker.length) :
|
|
166448
|
+
return idx >= 0 ? resolvedPath.slice(0, idx + marker.length) : dirname11(resolvedPath);
|
|
166430
166449
|
}
|
|
166431
166450
|
function checkLocalEmbeddingRuntimeByResolution(pluginDir, platform = process.platform, arch = process.arch) {
|
|
166432
166451
|
if (!existsSync20(join16(pluginDir, "package.json"))) {
|
|
@@ -168454,10 +168473,10 @@ var init_logs_pi = __esm(() => {
|
|
|
168454
168473
|
|
|
168455
168474
|
// src/commands/doctor-pi.ts
|
|
168456
168475
|
import { execFileSync as execFileSync4, spawnSync as spawnSync3 } from "node:child_process";
|
|
168457
|
-
import { existsSync as existsSync24, mkdirSync as
|
|
168476
|
+
import { existsSync as existsSync24, mkdirSync as mkdirSync9, readdirSync as readdirSync4, readFileSync as readFileSync17, rmSync as rmSync3, statSync as statSync10 } from "node:fs";
|
|
168458
168477
|
import { createRequire as createRequire6 } from "node:module";
|
|
168459
168478
|
import { homedir as homedir15 } from "node:os";
|
|
168460
|
-
import { dirname as
|
|
168479
|
+
import { dirname as dirname12, isAbsolute as isAbsolute3, join as join21 } from "node:path";
|
|
168461
168480
|
function depsFrom(options) {
|
|
168462
168481
|
return {
|
|
168463
168482
|
...DEFAULT_DEPS,
|
|
@@ -168930,7 +168949,7 @@ async function runHealthChecks(options) {
|
|
|
168930
168949
|
return { results, repairPlan, ...summarize(results) };
|
|
168931
168950
|
}
|
|
168932
168951
|
function writeDefaultMagicContextConfig(path6) {
|
|
168933
|
-
|
|
168952
|
+
mkdirSync9(dirname12(path6), { recursive: true });
|
|
168934
168953
|
const config2 = {
|
|
168935
168954
|
$schema: "https://raw.githubusercontent.com/cortexkit/magic-context/master/assets/magic-context.schema.json",
|
|
168936
168955
|
...MagicContextConfigSchema.parse({})
|