@dosu/cli 0.67.2 → 0.68.0
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/bin/dosu.js +108 -41
- package/package.json +1 -1
package/bin/dosu.js
CHANGED
|
@@ -1128,7 +1128,7 @@ function isNpxInvocation(channel = INSTALL_CHANNEL, env = process.env) {
|
|
|
1128
1128
|
function getVersionString() {
|
|
1129
1129
|
return `v${VERSION}`;
|
|
1130
1130
|
}
|
|
1131
|
-
var VERSION = "0.
|
|
1131
|
+
var VERSION = "0.68.0", INSTALL_CHANNEL = "npm";
|
|
1132
1132
|
|
|
1133
1133
|
// src/debug/logger.ts
|
|
1134
1134
|
import {
|
|
@@ -14333,7 +14333,7 @@ var init_conflicts = __esm(() => {
|
|
|
14333
14333
|
});
|
|
14334
14334
|
|
|
14335
14335
|
// src/telemetry/debug-id.ts
|
|
14336
|
-
var BUNDLE_DEBUG_ID_PLACEHOLDER = "
|
|
14336
|
+
var BUNDLE_DEBUG_ID_PLACEHOLDER = "2a77eea3-ffbe-b0f0-6475-6e2164756e21";
|
|
14337
14337
|
|
|
14338
14338
|
// src/telemetry/telemetry.ts
|
|
14339
14339
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
@@ -62521,10 +62521,13 @@ function hasShape(expected, actual) {
|
|
|
62521
62521
|
}
|
|
62522
62522
|
return expected === actual;
|
|
62523
62523
|
}
|
|
62524
|
+
function isUserChoiceKey(key) {
|
|
62525
|
+
return USER_CHOICE_KEYS.has(key);
|
|
62526
|
+
}
|
|
62524
62527
|
function withoutUserChoices(entry) {
|
|
62525
62528
|
if (typeof entry !== "object" || entry === null || Array.isArray(entry))
|
|
62526
62529
|
return entry;
|
|
62527
|
-
return Object.fromEntries(Object.entries(entry).filter(([key]) => !
|
|
62530
|
+
return Object.fromEntries(Object.entries(entry).filter(([key]) => !isUserChoiceKey(key)));
|
|
62528
62531
|
}
|
|
62529
62532
|
function entryHasShape(expected, actual) {
|
|
62530
62533
|
return hasShape(withoutUserChoices(expected), withoutUserChoices(actual));
|
|
@@ -62723,7 +62726,7 @@ var init_cline_cli = __esm(() => {
|
|
|
62723
62726
|
import { existsSync as existsSync22, readFileSync as readFileSync22 } from "node:fs";
|
|
62724
62727
|
import { dirname as dirname11, join as join29 } from "node:path";
|
|
62725
62728
|
function codexHome3() {
|
|
62726
|
-
return process.env.CODEX_HOME
|
|
62729
|
+
return process.env.CODEX_HOME || expandHome("~/.codex");
|
|
62727
62730
|
}
|
|
62728
62731
|
function getConfigPath2(global2) {
|
|
62729
62732
|
if (global2)
|
|
@@ -62745,66 +62748,130 @@ function tomlValue(value) {
|
|
|
62745
62748
|
return Array.isArray(value) ? `[${value.map(tomlString).join(", ")}]` : tomlString(value);
|
|
62746
62749
|
}
|
|
62747
62750
|
function dosuEntry(url, apiKey, npx, path) {
|
|
62748
|
-
return npxRemoteEntry(url, apiKey, npx, path);
|
|
62751
|
+
return { ...npxRemoteEntry(url, apiKey, npx, path), omit_tools_from: ["deferred"] };
|
|
62752
|
+
}
|
|
62753
|
+
function isUserKey(key) {
|
|
62754
|
+
return isUserChoiceKey(key) || key === "tools" || key.startsWith("tools.");
|
|
62749
62755
|
}
|
|
62750
|
-
function
|
|
62751
|
-
|
|
62756
|
+
function isUserTable(name) {
|
|
62757
|
+
return name === `${DOSU_TABLE}.tools` || name.startsWith(`${DOSU_TABLE}.tools.`);
|
|
62758
|
+
}
|
|
62759
|
+
function renderDosuEntry(entry, kept) {
|
|
62760
|
+
const tables = [[DOSU_TABLE, []]];
|
|
62752
62761
|
for (const [key, value] of Object.entries(entry)) {
|
|
62753
|
-
if (typeof value === "string" || Array.isArray(value))
|
|
62754
|
-
tables[0][1]
|
|
62755
|
-
else
|
|
62756
|
-
|
|
62762
|
+
if (typeof value === "string" || Array.isArray(value)) {
|
|
62763
|
+
tables[0][1].push(`${key} = ${tomlValue(value)}`);
|
|
62764
|
+
} else {
|
|
62765
|
+
const lines = Object.entries(value).map(([k, v]) => `${k} = ${tomlValue(v)}`);
|
|
62766
|
+
tables.push([`${DOSU_TABLE}.${key}`, lines]);
|
|
62767
|
+
}
|
|
62757
62768
|
}
|
|
62758
|
-
|
|
62759
|
-
|
|
62760
|
-
return `
|
|
62769
|
+
tables[0][1].push(...kept.root);
|
|
62770
|
+
return tables.map(([name, lines]) => `
|
|
62761
62771
|
[${name}]
|
|
62762
62772
|
${lines.join(`
|
|
62763
62773
|
`)}
|
|
62764
|
-
|
|
62765
|
-
|
|
62766
|
-
|
|
62767
|
-
|
|
62768
|
-
|
|
62774
|
+
`).join("") + kept.tables.map((table) => `
|
|
62775
|
+
${table}
|
|
62776
|
+
`).join("");
|
|
62777
|
+
}
|
|
62778
|
+
function openBrackets(text) {
|
|
62779
|
+
let depth = 0;
|
|
62780
|
+
let quote = null;
|
|
62781
|
+
for (let i = 0;i < text.length; i++) {
|
|
62782
|
+
const c = text[i];
|
|
62783
|
+
if (quote) {
|
|
62784
|
+
if (c === "\\" && quote === '"')
|
|
62785
|
+
i++;
|
|
62786
|
+
else if (c === quote)
|
|
62787
|
+
quote = null;
|
|
62788
|
+
} else if (c === '"' || c === "'")
|
|
62789
|
+
quote = c;
|
|
62790
|
+
else if (c === "#")
|
|
62791
|
+
break;
|
|
62792
|
+
else if (c === "[" || c === "{")
|
|
62793
|
+
depth++;
|
|
62794
|
+
else if (c === "]" || c === "}")
|
|
62795
|
+
depth--;
|
|
62796
|
+
}
|
|
62797
|
+
return depth;
|
|
62769
62798
|
}
|
|
62770
|
-
function
|
|
62771
|
-
|
|
62799
|
+
function dosuTables(content) {
|
|
62800
|
+
const tables = [];
|
|
62772
62801
|
let table;
|
|
62802
|
+
let open;
|
|
62803
|
+
let depth = 0;
|
|
62773
62804
|
for (const line of content.split(`
|
|
62774
62805
|
`)) {
|
|
62775
62806
|
const name = sectionName(line);
|
|
62776
62807
|
if (name !== null) {
|
|
62777
|
-
|
|
62778
|
-
|
|
62779
|
-
|
|
62780
|
-
|
|
62781
|
-
|
|
62782
|
-
|
|
62783
|
-
|
|
62784
|
-
|
|
62785
|
-
|
|
62786
|
-
|
|
62808
|
+
open = undefined;
|
|
62809
|
+
table = isDosuSection(name) ? { name, header: line.trim(), statements: [] } : undefined;
|
|
62810
|
+
if (table)
|
|
62811
|
+
tables.push(table);
|
|
62812
|
+
continue;
|
|
62813
|
+
}
|
|
62814
|
+
if (open && depth > 0) {
|
|
62815
|
+
open.value += `
|
|
62816
|
+
${line}`;
|
|
62817
|
+
open.text += `
|
|
62818
|
+
${line}`;
|
|
62819
|
+
depth += openBrackets(line);
|
|
62787
62820
|
continue;
|
|
62788
62821
|
}
|
|
62822
|
+
open = undefined;
|
|
62789
62823
|
const text = line.trim();
|
|
62790
62824
|
if (!table || !text || text.startsWith("#"))
|
|
62791
62825
|
continue;
|
|
62792
62826
|
const eq = text.indexOf("=");
|
|
62793
62827
|
const key = eq === -1 ? text : text.slice(0, eq).trim();
|
|
62794
|
-
const
|
|
62795
|
-
|
|
62796
|
-
|
|
62797
|
-
|
|
62798
|
-
|
|
62828
|
+
const value = eq === -1 ? "" : text.slice(eq + 1).trim();
|
|
62829
|
+
open = { key, value, text: line };
|
|
62830
|
+
table.statements.push(open);
|
|
62831
|
+
depth = openBrackets(value);
|
|
62832
|
+
}
|
|
62833
|
+
return tables;
|
|
62834
|
+
}
|
|
62835
|
+
function readDosuEntry(content) {
|
|
62836
|
+
let entry;
|
|
62837
|
+
for (const { name, statements } of dosuTables(content)) {
|
|
62838
|
+
entry ??= {};
|
|
62839
|
+
if (isUserTable(name))
|
|
62840
|
+
continue;
|
|
62841
|
+
const isRoot = name === DOSU_TABLE;
|
|
62842
|
+
const table = isRoot ? entry : {};
|
|
62843
|
+
if (!isRoot)
|
|
62844
|
+
entry[name.slice(DOSU_TABLE.length + 1)] = table;
|
|
62845
|
+
for (const { key, value } of statements) {
|
|
62846
|
+
if (isRoot && isUserKey(key))
|
|
62847
|
+
continue;
|
|
62848
|
+
try {
|
|
62849
|
+
table[key] = JSON.parse(value);
|
|
62850
|
+
} catch {
|
|
62851
|
+
table[key] = value;
|
|
62852
|
+
}
|
|
62799
62853
|
}
|
|
62800
62854
|
}
|
|
62801
62855
|
return entry;
|
|
62802
62856
|
}
|
|
62857
|
+
function userSettings(content) {
|
|
62858
|
+
const kept = { root: [], tables: [] };
|
|
62859
|
+
for (const { name, header, statements } of dosuTables(content)) {
|
|
62860
|
+
if (name === DOSU_TABLE) {
|
|
62861
|
+
kept.root.push(...statements.filter(({ key }) => isUserKey(key)).map(({ text }) => text));
|
|
62862
|
+
} else if (isUserTable(name)) {
|
|
62863
|
+
kept.tables.push([header, ...statements.map(({ text }) => text)].join(`
|
|
62864
|
+
`));
|
|
62865
|
+
}
|
|
62866
|
+
}
|
|
62867
|
+
return kept;
|
|
62868
|
+
}
|
|
62803
62869
|
function installDosuToTOML(path, cfg) {
|
|
62804
|
-
const
|
|
62870
|
+
const existing = readTOML(path);
|
|
62871
|
+
const content = removeDosuFromTOML(existing);
|
|
62805
62872
|
const npx = findNpx();
|
|
62806
62873
|
const entry = dosuEntry(mcpEndpoint(cfg), cfg.active_account?.target?.api_key, npx, npxPathEnv(npx));
|
|
62807
|
-
writeTOML(path, content + renderDosuEntry(entry));
|
|
62874
|
+
writeTOML(path, content + renderDosuEntry(entry, userSettings(existing)));
|
|
62808
62875
|
}
|
|
62809
62876
|
function sectionName(line) {
|
|
62810
62877
|
const header = line.trim();
|
|
@@ -62812,7 +62879,7 @@ function sectionName(line) {
|
|
|
62812
62879
|
return match ? match[1].trim() : null;
|
|
62813
62880
|
}
|
|
62814
62881
|
function isDosuSection(name) {
|
|
62815
|
-
return name ===
|
|
62882
|
+
return name === DOSU_TABLE || name.startsWith(`${DOSU_TABLE}.`);
|
|
62816
62883
|
}
|
|
62817
62884
|
function removeDosuFromTOML(content) {
|
|
62818
62885
|
const result = [];
|
|
@@ -62870,7 +62937,7 @@ function pruneLegacyRemoteEntry(path) {
|
|
|
62870
62937
|
return;
|
|
62871
62938
|
writeTOML(path, removeDosuFromTOML(content));
|
|
62872
62939
|
}
|
|
62873
|
-
var REMOTE_HTTP_KEY, CodexProvider = () => ({
|
|
62940
|
+
var DOSU_TABLE = "mcp_servers.dosu", REMOTE_HTTP_KEY, CodexProvider = () => ({
|
|
62874
62941
|
name: () => "Codex (CLI + Desktop)",
|
|
62875
62942
|
id: () => "codex",
|
|
62876
62943
|
supportsLocal: () => true,
|
|
@@ -69217,4 +69284,4 @@ main().catch((err) => {
|
|
|
69217
69284
|
process.exit(1);
|
|
69218
69285
|
});
|
|
69219
69286
|
|
|
69220
|
-
//# debugId=
|
|
69287
|
+
//# debugId=2a77eea3-ffbe-b0f0-6475-6e2164756e21
|