@dosu/cli 0.49.4 → 0.50.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 +701 -218
- package/package.json +1 -1
package/bin/dosu.js
CHANGED
|
@@ -5000,7 +5000,7 @@ function isNpxInvocation(channel = INSTALL_CHANNEL, env = process.env) {
|
|
|
5000
5000
|
function getVersionString() {
|
|
5001
5001
|
return `v${VERSION}`;
|
|
5002
5002
|
}
|
|
5003
|
-
var VERSION = "0.
|
|
5003
|
+
var VERSION = "0.50.0", INSTALL_CHANNEL = "npm";
|
|
5004
5004
|
|
|
5005
5005
|
// src/debug/logger.ts
|
|
5006
5006
|
import {
|
|
@@ -5134,7 +5134,7 @@ var init_logger = __esm(() => {
|
|
|
5134
5134
|
});
|
|
5135
5135
|
|
|
5136
5136
|
// src/client/contract.ts
|
|
5137
|
-
var CLI_CONTRACT_HASH = "
|
|
5137
|
+
var CLI_CONTRACT_HASH = "ac90a31489e1";
|
|
5138
5138
|
|
|
5139
5139
|
// src/client/trpc.ts
|
|
5140
5140
|
var exports_trpc = {};
|
|
@@ -6864,7 +6864,7 @@ var init_dist8 = __esm(() => {
|
|
|
6864
6864
|
|
|
6865
6865
|
// src/setup/styles.ts
|
|
6866
6866
|
function dim(msg) {
|
|
6867
|
-
return
|
|
6867
|
+
return import_picocolors9.default.dim(msg);
|
|
6868
6868
|
}
|
|
6869
6869
|
function formatSetupSummary(title, items, marker = IconAdd) {
|
|
6870
6870
|
const lines = items.map((item) => {
|
|
@@ -6881,11 +6881,11 @@ function browserFallbackHint(url) {
|
|
|
6881
6881
|
${url}`);
|
|
6882
6882
|
}
|
|
6883
6883
|
function info(msg) {
|
|
6884
|
-
return
|
|
6884
|
+
return import_picocolors9.default.cyan(msg);
|
|
6885
6885
|
}
|
|
6886
|
-
var
|
|
6886
|
+
var import_picocolors9, IconAdd = "+", IconRemove = "-";
|
|
6887
6887
|
var init_styles = __esm(() => {
|
|
6888
|
-
|
|
6888
|
+
import_picocolors9 = __toESM(require_picocolors(), 1);
|
|
6889
6889
|
});
|
|
6890
6890
|
|
|
6891
6891
|
// node_modules/is-docker/index.js
|
|
@@ -8715,8 +8715,8 @@ async function fetchLatestSha() {
|
|
|
8715
8715
|
}
|
|
8716
8716
|
function displayNotice() {
|
|
8717
8717
|
const msg = `
|
|
8718
|
-
${
|
|
8719
|
-
` + `${
|
|
8718
|
+
${import_picocolors14.default.yellow(" Dosu skill update available")}
|
|
8719
|
+
` + `${import_picocolors14.default.dim(' Run "dosu skill update" to upgrade')}
|
|
8720
8720
|
`;
|
|
8721
8721
|
console.error(msg);
|
|
8722
8722
|
}
|
|
@@ -8746,11 +8746,11 @@ function checkForSkillUpdates() {
|
|
|
8746
8746
|
logger.error("skill-update-check", `Skill update check failed: ${err}`);
|
|
8747
8747
|
}
|
|
8748
8748
|
}
|
|
8749
|
-
var
|
|
8749
|
+
var import_picocolors14, CACHE_FILENAME2 = "skill-update-check.json", CHECK_INTERVAL_MS2, FETCH_TIMEOUT_MS2 = 5000, GITHUB_API_URL = "https://api.github.com/repos/dosu-ai/dosu-skill/commits/HEAD";
|
|
8750
8750
|
var init_skill_update_check = __esm(() => {
|
|
8751
8751
|
init_config();
|
|
8752
8752
|
init_logger();
|
|
8753
|
-
|
|
8753
|
+
import_picocolors14 = __toESM(require_picocolors(), 1);
|
|
8754
8754
|
CHECK_INTERVAL_MS2 = 24 * 60 * 60 * 1000;
|
|
8755
8755
|
});
|
|
8756
8756
|
|
|
@@ -8857,10 +8857,10 @@ function skillCommand() {
|
|
|
8857
8857
|
console.log(`Installing skills from ${SKILL_REPO}...`);
|
|
8858
8858
|
const result = await installSkill();
|
|
8859
8859
|
if (result.success) {
|
|
8860
|
-
console.log(
|
|
8860
|
+
console.log(import_picocolors15.default.green(`
|
|
8861
8861
|
✓ Skills installed successfully.`));
|
|
8862
8862
|
} else {
|
|
8863
|
-
console.error(
|
|
8863
|
+
console.error(import_picocolors15.default.red(`
|
|
8864
8864
|
Failed to install skill. Make sure npx is available.`));
|
|
8865
8865
|
process.exit(1);
|
|
8866
8866
|
}
|
|
@@ -8878,10 +8878,10 @@ Failed to install skill. Make sure npx is available.`));
|
|
|
8878
8878
|
stdio: "inherit"
|
|
8879
8879
|
});
|
|
8880
8880
|
clearInstalledSha();
|
|
8881
|
-
console.log(
|
|
8881
|
+
console.log(import_picocolors15.default.green(`
|
|
8882
8882
|
✓ Skills removed.`));
|
|
8883
8883
|
} catch {
|
|
8884
|
-
console.error(
|
|
8884
|
+
console.error(import_picocolors15.default.red(`
|
|
8885
8885
|
Failed to remove skills.`));
|
|
8886
8886
|
process.exit(1);
|
|
8887
8887
|
}
|
|
@@ -8890,21 +8890,21 @@ Failed to remove skills.`));
|
|
|
8890
8890
|
console.log(`Updating skills from ${SKILL_REPO}...`);
|
|
8891
8891
|
const result = await installSkill();
|
|
8892
8892
|
if (!result.success) {
|
|
8893
|
-
console.error(
|
|
8893
|
+
console.error(import_picocolors15.default.red(`
|
|
8894
8894
|
Failed to update skill.`));
|
|
8895
8895
|
process.exit(1);
|
|
8896
8896
|
}
|
|
8897
|
-
console.log(
|
|
8897
|
+
console.log(import_picocolors15.default.green(`
|
|
8898
8898
|
✓ Skills updated.`));
|
|
8899
8899
|
});
|
|
8900
8900
|
return cmd;
|
|
8901
8901
|
}
|
|
8902
|
-
var
|
|
8902
|
+
var import_picocolors15, SKILL_REPO = "dosu-ai/dosu-skill", SKILL_NAME = "dosu", SAFE_SKILL_NAME, SUPPORTED_SKILL_AGENTS, SKILL_AGENT_BY_PROVIDER;
|
|
8903
8903
|
var init_skill = __esm(() => {
|
|
8904
8904
|
init_commander();
|
|
8905
8905
|
init_logger();
|
|
8906
8906
|
init_skill_update_check();
|
|
8907
|
-
|
|
8907
|
+
import_picocolors15 = __toESM(require_picocolors(), 1);
|
|
8908
8908
|
SAFE_SKILL_NAME = /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/;
|
|
8909
8909
|
SUPPORTED_SKILL_AGENTS = [
|
|
8910
8910
|
"claude-code",
|
|
@@ -10593,7 +10593,7 @@ var init_settings = __esm(() => {
|
|
|
10593
10593
|
});
|
|
10594
10594
|
|
|
10595
10595
|
// src/telemetry/debug-id.ts
|
|
10596
|
-
var BUNDLE_DEBUG_ID_PLACEHOLDER = "
|
|
10596
|
+
var BUNDLE_DEBUG_ID_PLACEHOLDER = "9d873764-f667-b08c-6475-6e2164756e21";
|
|
10597
10597
|
|
|
10598
10598
|
// src/telemetry/telemetry.ts
|
|
10599
10599
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
@@ -12908,7 +12908,7 @@ function createDotsSpinner() {
|
|
|
12908
12908
|
let current = "";
|
|
12909
12909
|
const isTTY = Boolean(process.stdout.isTTY) && process.env.CI !== "true";
|
|
12910
12910
|
const draw = () => {
|
|
12911
|
-
process.stdout.write(`\r\x1B[2K${
|
|
12911
|
+
process.stdout.write(`\r\x1B[2K${import_picocolors16.default.cyan(SPINNER_FRAMES[frameIdx])} ${current}`);
|
|
12912
12912
|
frameIdx = (frameIdx + 1) % SPINNER_FRAMES.length;
|
|
12913
12913
|
};
|
|
12914
12914
|
return {
|
|
@@ -12930,7 +12930,7 @@ function createDotsSpinner() {
|
|
|
12930
12930
|
clearInterval(timer);
|
|
12931
12931
|
timer = undefined;
|
|
12932
12932
|
}
|
|
12933
|
-
const symbol3 = code === 0 ?
|
|
12933
|
+
const symbol3 = code === 0 ? import_picocolors16.default.green("✓") : import_picocolors16.default.red("✗");
|
|
12934
12934
|
if (isTTY) {
|
|
12935
12935
|
process.stdout.write(`\r\x1B[2K${symbol3} ${msg}
|
|
12936
12936
|
`);
|
|
@@ -13071,18 +13071,18 @@ async function runInsights(cfg, runner) {
|
|
|
13071
13071
|
runner.writeFile(latestPath, html);
|
|
13072
13072
|
runner.prune(insightsDir(), KEEP_REPORTS);
|
|
13073
13073
|
console.log("");
|
|
13074
|
-
console.log(
|
|
13074
|
+
console.log(import_picocolors16.default.bold(`\uD83D\uDCCA Dosu Insights · ${report.spaceName}`));
|
|
13075
13075
|
if (report.cheers[0]) {
|
|
13076
|
-
console.log(
|
|
13076
|
+
console.log(import_picocolors16.default.green(` ${report.cheers[0]}`));
|
|
13077
13077
|
}
|
|
13078
13078
|
console.log("");
|
|
13079
|
-
console.log(` Snapshot: ${
|
|
13080
|
-
console.log(` Latest: ${
|
|
13081
|
-
console.log(
|
|
13079
|
+
console.log(` Snapshot: ${import_picocolors16.default.cyan(`file://${snapshotPath}`)}`);
|
|
13080
|
+
console.log(` Latest: ${import_picocolors16.default.cyan(`file://${latestPath}`)}`);
|
|
13081
|
+
console.log(import_picocolors16.default.dim(" Opening in your browser..."));
|
|
13082
13082
|
try {
|
|
13083
13083
|
await runner.openInBrowser(snapshotPath);
|
|
13084
13084
|
} catch {
|
|
13085
|
-
console.log(
|
|
13085
|
+
console.log(import_picocolors16.default.dim(" (couldn't auto-open. Copy the link above.)"));
|
|
13086
13086
|
}
|
|
13087
13087
|
return snapshotPath;
|
|
13088
13088
|
}
|
|
@@ -13109,7 +13109,7 @@ async function executeInsights(cfg) {
|
|
|
13109
13109
|
try {
|
|
13110
13110
|
await runInsights(cfg, defaultRunner(cfg));
|
|
13111
13111
|
} catch (err) {
|
|
13112
|
-
console.error(
|
|
13112
|
+
console.error(import_picocolors16.default.red(`Error: ${err instanceof Error ? err.message : String(err)}`));
|
|
13113
13113
|
}
|
|
13114
13114
|
}
|
|
13115
13115
|
function insightsCommand() {
|
|
@@ -13120,12 +13120,12 @@ function insightsCommand() {
|
|
|
13120
13120
|
try {
|
|
13121
13121
|
await runInsights(cfg, defaultRunner(cfg));
|
|
13122
13122
|
} catch (err) {
|
|
13123
|
-
console.error(
|
|
13123
|
+
console.error(import_picocolors16.default.red(`Error: ${err instanceof Error ? err.message : String(err)}`));
|
|
13124
13124
|
process.exit(1);
|
|
13125
13125
|
}
|
|
13126
13126
|
});
|
|
13127
13127
|
}
|
|
13128
|
-
var
|
|
13128
|
+
var import_picocolors16, ASK_TIMEOUT_MS = 90000, KEEP_REPORTS = 20, REPORT_FILE_PATTERN, HINT_INTERVAL_MS = 6000, NARRATIVE_HINTS, SPINNER_FRAMES, SPINNER_INTERVAL_MS = 80;
|
|
13129
13129
|
var init_insights3 = __esm(() => {
|
|
13130
13130
|
init_dist8();
|
|
13131
13131
|
init_commander();
|
|
@@ -13134,7 +13134,7 @@ var init_insights3 = __esm(() => {
|
|
|
13134
13134
|
init_logger();
|
|
13135
13135
|
init_insights2();
|
|
13136
13136
|
init_flow2();
|
|
13137
|
-
|
|
13137
|
+
import_picocolors16 = __toESM(require_picocolors(), 1);
|
|
13138
13138
|
REPORT_FILE_PATTERN = /^report-\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}Z\.html$/;
|
|
13139
13139
|
NARRATIVE_HINTS = [
|
|
13140
13140
|
"Reading your reactions and confidence levels",
|
|
@@ -13163,7 +13163,7 @@ __export(exports_tui, {
|
|
|
13163
13163
|
handleLogout: () => handleLogout
|
|
13164
13164
|
});
|
|
13165
13165
|
async function runTUI() {
|
|
13166
|
-
console.log(
|
|
13166
|
+
console.log(import_picocolors29.default.magenta(LOGO));
|
|
13167
13167
|
const cfg = loadConfig();
|
|
13168
13168
|
while (true) {
|
|
13169
13169
|
const insightsReady = Boolean(cfg.active_account?.target?.space_id && cfg.active_account?.target?.deployment_id && cfg.active_account?.target?.api_key);
|
|
@@ -13277,7 +13277,7 @@ function handleLogout(cfg) {
|
|
|
13277
13277
|
saveConfig(cfg);
|
|
13278
13278
|
log.success("Credentials cleared.");
|
|
13279
13279
|
}
|
|
13280
|
-
var
|
|
13280
|
+
var import_picocolors29, LOGO = `
|
|
13281
13281
|
/$$$$$$$
|
|
13282
13282
|
| $$__ $$
|
|
13283
13283
|
| $$ \\ $$ /$$$$$$ /$$$$$$$ /$$ /$$
|
|
@@ -13294,7 +13294,7 @@ var init_tui = __esm(() => {
|
|
|
13294
13294
|
init_config();
|
|
13295
13295
|
init_flow2();
|
|
13296
13296
|
init_styles();
|
|
13297
|
-
|
|
13297
|
+
import_picocolors29 = __toESM(require_picocolors(), 1);
|
|
13298
13298
|
});
|
|
13299
13299
|
|
|
13300
13300
|
// src/auth/ticket.ts
|
|
@@ -13934,10 +13934,10 @@ import {
|
|
|
13934
13934
|
unlinkSync as unlinkSync5
|
|
13935
13935
|
} from "node:fs";
|
|
13936
13936
|
|
|
13937
|
-
// src/commands/
|
|
13937
|
+
// src/commands/agents.ts
|
|
13938
13938
|
init_commander();
|
|
13939
13939
|
init_trpc();
|
|
13940
|
-
var
|
|
13940
|
+
var import_picocolors5 = __toESM(require_picocolors(), 1);
|
|
13941
13941
|
|
|
13942
13942
|
// src/commands/arguments.ts
|
|
13943
13943
|
init_commander();
|
|
@@ -13970,6 +13970,44 @@ function uuid(value) {
|
|
|
13970
13970
|
}
|
|
13971
13971
|
return value;
|
|
13972
13972
|
}
|
|
13973
|
+
function uuidV4(value) {
|
|
13974
|
+
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value)) {
|
|
13975
|
+
throw new InvalidArgumentError("must be a UUID v4");
|
|
13976
|
+
}
|
|
13977
|
+
return value;
|
|
13978
|
+
}
|
|
13979
|
+
function jsonValue(value) {
|
|
13980
|
+
try {
|
|
13981
|
+
return JSON.parse(value);
|
|
13982
|
+
} catch {
|
|
13983
|
+
throw new InvalidArgumentError("must be valid JSON");
|
|
13984
|
+
}
|
|
13985
|
+
}
|
|
13986
|
+
function jsonStringArray(value) {
|
|
13987
|
+
const parsed = jsonValue(value);
|
|
13988
|
+
if (!Array.isArray(parsed) || !parsed.every((item) => typeof item === "string")) {
|
|
13989
|
+
throw new InvalidArgumentError("must be a JSON array of strings");
|
|
13990
|
+
}
|
|
13991
|
+
return parsed;
|
|
13992
|
+
}
|
|
13993
|
+
function onOrOff(value) {
|
|
13994
|
+
if (value === "on")
|
|
13995
|
+
return true;
|
|
13996
|
+
if (value === "off")
|
|
13997
|
+
return false;
|
|
13998
|
+
throw new InvalidArgumentError("must be 'on' or 'off'");
|
|
13999
|
+
}
|
|
14000
|
+
function boundedText(maximum) {
|
|
14001
|
+
return (value) => {
|
|
14002
|
+
const trimmed = value.trim();
|
|
14003
|
+
if (!trimmed)
|
|
14004
|
+
throw new InvalidArgumentError("must not be empty");
|
|
14005
|
+
if (trimmed.length > maximum) {
|
|
14006
|
+
throw new InvalidArgumentError(`must be at most ${maximum} characters`);
|
|
14007
|
+
}
|
|
14008
|
+
return trimmed;
|
|
14009
|
+
};
|
|
14010
|
+
}
|
|
13973
14011
|
|
|
13974
14012
|
// src/commands/auth.ts
|
|
13975
14013
|
init_config();
|
|
@@ -13982,6 +14020,15 @@ function requireLoginConfig() {
|
|
|
13982
14020
|
}
|
|
13983
14021
|
return cfg;
|
|
13984
14022
|
}
|
|
14023
|
+
function requireOrgConfig() {
|
|
14024
|
+
const cfg = requireLoginConfig();
|
|
14025
|
+
const orgId = cfg.active_account?.target?.org_id;
|
|
14026
|
+
if (!orgId) {
|
|
14027
|
+
console.error(import_picocolors2.default.red("Missing org config. Run 'dosu setup' to reconfigure."));
|
|
14028
|
+
process.exit(1);
|
|
14029
|
+
}
|
|
14030
|
+
return { cfg, orgId };
|
|
14031
|
+
}
|
|
13985
14032
|
function requireAPIKey(cfg) {
|
|
13986
14033
|
if (!cfg.active_account?.target?.api_key) {
|
|
13987
14034
|
console.error(import_picocolors2.default.red("API key not configured. Run 'dosu setup' first."));
|
|
@@ -13990,6 +14037,10 @@ function requireAPIKey(cfg) {
|
|
|
13990
14037
|
return cfg.active_account?.target?.api_key;
|
|
13991
14038
|
}
|
|
13992
14039
|
|
|
14040
|
+
// src/commands/confirmation.ts
|
|
14041
|
+
init_dist8();
|
|
14042
|
+
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
14043
|
+
|
|
13993
14044
|
// src/commands/output.ts
|
|
13994
14045
|
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
13995
14046
|
var stripAnsi = (str) => str.replace(/\x1b\[[0-9;]*m/g, "");
|
|
@@ -14009,14 +14060,14 @@ function printTable(headers, rows, opts = {}) {
|
|
|
14009
14060
|
console.log(import_picocolors3.default.dim("No results found."));
|
|
14010
14061
|
return;
|
|
14011
14062
|
}
|
|
14012
|
-
const widths = headers.map((
|
|
14013
|
-
const headerLine = headers.map((
|
|
14063
|
+
const widths = headers.map((h2, i2) => Math.max(h2.length, ...rows.map((r2) => stripAnsi(r2[i2] ?? "").length)));
|
|
14064
|
+
const headerLine = headers.map((h2, i2) => h2.padEnd(widths[i2])).join(" ");
|
|
14014
14065
|
console.log(import_picocolors3.default.bold(headerLine));
|
|
14015
14066
|
console.log(import_picocolors3.default.dim("─".repeat(headerLine.length)));
|
|
14016
14067
|
for (const row of rows) {
|
|
14017
|
-
console.log(row.map((cell,
|
|
14068
|
+
console.log(row.map((cell, i2) => {
|
|
14018
14069
|
const s = cell ?? "";
|
|
14019
|
-
const pad = Math.max(0, widths[
|
|
14070
|
+
const pad = Math.max(0, widths[i2] - stripAnsi(s).length);
|
|
14020
14071
|
return s + " ".repeat(pad);
|
|
14021
14072
|
}).join(" "));
|
|
14022
14073
|
}
|
|
@@ -14049,11 +14100,192 @@ function formatDate(dateStr) {
|
|
|
14049
14100
|
});
|
|
14050
14101
|
}
|
|
14051
14102
|
|
|
14103
|
+
// src/commands/confirmation.ts
|
|
14104
|
+
async function confirmAction({
|
|
14105
|
+
confirmed,
|
|
14106
|
+
json,
|
|
14107
|
+
message,
|
|
14108
|
+
preview
|
|
14109
|
+
}) {
|
|
14110
|
+
if (confirmed)
|
|
14111
|
+
return true;
|
|
14112
|
+
if (!json && process.stdin?.isTTY) {
|
|
14113
|
+
const answer = await confirm({ message, initialValue: false });
|
|
14114
|
+
if (isCancel(answer)) {
|
|
14115
|
+
console.log(import_picocolors4.default.dim("Cancelled."));
|
|
14116
|
+
return false;
|
|
14117
|
+
}
|
|
14118
|
+
if (answer === true)
|
|
14119
|
+
return true;
|
|
14120
|
+
}
|
|
14121
|
+
if (json) {
|
|
14122
|
+
printResult({ ...preview, applied: false, confirmRequired: true }, { json: true });
|
|
14123
|
+
} else {
|
|
14124
|
+
console.log(import_picocolors4.default.dim("Aborted. Re-run with --confirm to apply."));
|
|
14125
|
+
}
|
|
14126
|
+
return false;
|
|
14127
|
+
}
|
|
14128
|
+
|
|
14129
|
+
// src/commands/agents.ts
|
|
14130
|
+
function validateConfigPath(path2) {
|
|
14131
|
+
if (path2.length > 200) {
|
|
14132
|
+
throw new InvalidArgumentError("must be at most 200 characters");
|
|
14133
|
+
}
|
|
14134
|
+
const parts = path2.split(".");
|
|
14135
|
+
if (parts.some((part) => !part || part.trim() !== part || ["__proto__", "constructor", "prototype"].includes(part))) {
|
|
14136
|
+
throw new InvalidArgumentError("must be a dot-separated config leaf path");
|
|
14137
|
+
}
|
|
14138
|
+
return path2;
|
|
14139
|
+
}
|
|
14140
|
+
function agentsCommand() {
|
|
14141
|
+
const cmd = new Command("agents").description("Manage Dosu agents");
|
|
14142
|
+
cmd.command("list").description("List configurable agents in the selected organization").option("--json", "Output as JSON").action(async (opts) => {
|
|
14143
|
+
const { cfg, orgId } = requireOrgConfig();
|
|
14144
|
+
const agents = await createTypedClient(cfg).agents.list.query({ org_id: orgId });
|
|
14145
|
+
if (opts.json)
|
|
14146
|
+
return printResult(agents, opts);
|
|
14147
|
+
printTable(["ID", "Name", "Provider", "Library", "Status"], agents.map((agent) => [
|
|
14148
|
+
agent.deployment_id.slice(0, 8),
|
|
14149
|
+
agent.name,
|
|
14150
|
+
agent.provider_slug,
|
|
14151
|
+
agent.space_id.slice(0, 8),
|
|
14152
|
+
agent.enabled ? "active" : "disabled"
|
|
14153
|
+
]), { rawData: agents });
|
|
14154
|
+
});
|
|
14155
|
+
cmd.command("info").description("Show an agent").argument("<agent-id>", "Agent ID", uuidV4).option("--json", "Output as JSON").action(async (agentId, opts) => {
|
|
14156
|
+
const { cfg } = requireOrgConfig();
|
|
14157
|
+
const agent = await createTypedClient(cfg).agents.get.query(agentId);
|
|
14158
|
+
if (opts.json)
|
|
14159
|
+
return printResult(agent, opts);
|
|
14160
|
+
printInfo([
|
|
14161
|
+
["ID", agent.deployment_id],
|
|
14162
|
+
["Name", agent.name],
|
|
14163
|
+
["Provider", agent.provider_slug],
|
|
14164
|
+
["Library", agent.space_id],
|
|
14165
|
+
["Status", agent.enabled ? "active" : "disabled"],
|
|
14166
|
+
["Guidelines", agent.response_guidelines ?? undefined],
|
|
14167
|
+
["Updated", formatDate(agent.updated_at)]
|
|
14168
|
+
], { rawData: agent });
|
|
14169
|
+
});
|
|
14170
|
+
cmd.command("create").description("Create a safe Mention-only agent from an existing data source").requiredOption("--library <id>", "Library ID", uuidV4).requiredOption("--source <id>", "Data source ID", uuidV4).option("--name <name>", "Agent name", boundedText(80)).option("--guidelines <text>", "Response guidelines").option("--json", "Output as JSON").action(async (opts) => {
|
|
14171
|
+
if (opts.guidelines && opts.guidelines.length > 20000) {
|
|
14172
|
+
throw new InvalidArgumentError("--guidelines must be at most 20000 characters");
|
|
14173
|
+
}
|
|
14174
|
+
const { cfg, orgId } = requireOrgConfig();
|
|
14175
|
+
const agent = await createTypedClient(cfg).agents.create.mutate({
|
|
14176
|
+
data_source_id: opts.source,
|
|
14177
|
+
name: opts.name,
|
|
14178
|
+
org_id: orgId,
|
|
14179
|
+
response_guidelines: opts.guidelines,
|
|
14180
|
+
space_id: opts.library
|
|
14181
|
+
});
|
|
14182
|
+
if (opts.json)
|
|
14183
|
+
return printResult(agent, opts);
|
|
14184
|
+
console.log(import_picocolors5.default.green(`Created agent '${agent.name}' (${agent.deployment_id}).`));
|
|
14185
|
+
});
|
|
14186
|
+
cmd.command("update").description("Update an agent (requires confirmation)").argument("<agent-id>", "Agent ID", uuidV4).option("--name <name>", "New name", boundedText(80)).addOption(new Option("--enabled <on|off>", "Enable or disable the agent").argParser(onOrOff)).addOption(new Option("--guidelines <text>", "Replace response guidelines").conflicts("clearGuidelines")).addOption(new Option("--clear-guidelines", "Clear response guidelines").conflicts("guidelines")).option("--confirm", "Apply without the interactive prompt").option("--json", "Output as JSON").action(async (agentId, opts) => {
|
|
14187
|
+
if (opts.name === undefined && opts.enabled === undefined && opts.guidelines === undefined && !opts.clearGuidelines) {
|
|
14188
|
+
throw new InvalidArgumentError("specify --name, --enabled, --guidelines, or --clear-guidelines");
|
|
14189
|
+
}
|
|
14190
|
+
if (opts.guidelines && opts.guidelines.length > 20000) {
|
|
14191
|
+
throw new InvalidArgumentError("--guidelines must be at most 20000 characters");
|
|
14192
|
+
}
|
|
14193
|
+
const responseGuidelines = opts.clearGuidelines ? null : opts.guidelines;
|
|
14194
|
+
if (!await confirmAction({
|
|
14195
|
+
confirmed: opts.confirm,
|
|
14196
|
+
json: opts.json,
|
|
14197
|
+
message: "Update this agent?",
|
|
14198
|
+
preview: {
|
|
14199
|
+
action: "update_agent",
|
|
14200
|
+
id: agentId,
|
|
14201
|
+
name: opts.name,
|
|
14202
|
+
enabled: opts.enabled,
|
|
14203
|
+
response_guidelines: responseGuidelines
|
|
14204
|
+
}
|
|
14205
|
+
}))
|
|
14206
|
+
return;
|
|
14207
|
+
const { cfg } = requireOrgConfig();
|
|
14208
|
+
const agent = await createTypedClient(cfg).agents.update.mutate({
|
|
14209
|
+
deployment_id: agentId,
|
|
14210
|
+
enabled: opts.enabled,
|
|
14211
|
+
name: opts.name,
|
|
14212
|
+
response_guidelines: responseGuidelines
|
|
14213
|
+
});
|
|
14214
|
+
if (opts.json)
|
|
14215
|
+
return printResult(agent, opts);
|
|
14216
|
+
console.log(import_picocolors5.default.green(`Updated agent '${agent.name}'.`));
|
|
14217
|
+
});
|
|
14218
|
+
cmd.command("delete").description("Delete an agent (requires confirmation)").argument("<agent-id>", "Agent ID", uuidV4).option("--confirm", "Apply without the interactive prompt").option("--json", "Output as JSON").action(async (agentId, opts) => {
|
|
14219
|
+
if (!await confirmAction({
|
|
14220
|
+
confirmed: opts.confirm,
|
|
14221
|
+
json: opts.json,
|
|
14222
|
+
message: "Delete this agent?",
|
|
14223
|
+
preview: { action: "delete_agent", id: agentId }
|
|
14224
|
+
}))
|
|
14225
|
+
return;
|
|
14226
|
+
const { cfg } = requireOrgConfig();
|
|
14227
|
+
const result = await createTypedClient(cfg).agents.delete.mutate(agentId);
|
|
14228
|
+
if (opts.json)
|
|
14229
|
+
return printResult(result, opts);
|
|
14230
|
+
console.log(import_picocolors5.default.green(`Deleted agent ${agentId}.`));
|
|
14231
|
+
});
|
|
14232
|
+
cmd.command("move").description("Move an agent to another library (requires confirmation)").argument("<agent-id>", "Agent ID", uuidV4).requiredOption("--library <id>", "Destination library ID", uuidV4).option("--confirm", "Apply without the interactive prompt").option("--json", "Output as JSON").action(async (agentId, opts) => {
|
|
14233
|
+
if (!await confirmAction({
|
|
14234
|
+
confirmed: opts.confirm,
|
|
14235
|
+
json: opts.json,
|
|
14236
|
+
message: "Move this agent to another library?",
|
|
14237
|
+
preview: { action: "move_agent", id: agentId, library_id: opts.library }
|
|
14238
|
+
}))
|
|
14239
|
+
return;
|
|
14240
|
+
const { cfg } = requireOrgConfig();
|
|
14241
|
+
const result = await createTypedClient(cfg).agents.move.mutate({
|
|
14242
|
+
deployment_id: agentId,
|
|
14243
|
+
space_id: opts.library
|
|
14244
|
+
});
|
|
14245
|
+
if (opts.json)
|
|
14246
|
+
return printResult(result, opts);
|
|
14247
|
+
console.log(import_picocolors5.default.green(`Moved agent '${result.name}' to library ${result.space_id}.`));
|
|
14248
|
+
});
|
|
14249
|
+
const config = cmd.command("config").description("Read or patch agent configuration");
|
|
14250
|
+
config.command("get").description("Show agent configuration").argument("<agent-id>", "Agent ID", uuidV4).option("--json", "Output as JSON").action(async (agentId, opts) => {
|
|
14251
|
+
const { cfg } = requireOrgConfig();
|
|
14252
|
+
const result = await createTypedClient(cfg).agents.getConfig.query(agentId);
|
|
14253
|
+
if (opts.json)
|
|
14254
|
+
return printResult(result, opts);
|
|
14255
|
+
printResult(result.config, opts);
|
|
14256
|
+
});
|
|
14257
|
+
config.command("set").description("Set one existing config leaf (requires confirmation)").argument("<agent-id>", "Agent ID", uuidV4).argument("<path>", "Dot-separated config leaf path", validateConfigPath).requiredOption("--value <json>", "New value as JSON", jsonValue).option("--confirm", "Apply without the interactive prompt").option("--json", "Output as JSON").action(async (agentId, path2, opts) => {
|
|
14258
|
+
if (!await confirmAction({
|
|
14259
|
+
confirmed: opts.confirm,
|
|
14260
|
+
json: opts.json,
|
|
14261
|
+
message: `Set agent config '${path2}'?`,
|
|
14262
|
+
preview: { action: "set_agent_config", id: agentId, path: path2, value: opts.value }
|
|
14263
|
+
}))
|
|
14264
|
+
return;
|
|
14265
|
+
const { cfg } = requireOrgConfig();
|
|
14266
|
+
const client = createTypedClient(cfg);
|
|
14267
|
+
const current = await client.agents.getConfig.query(agentId);
|
|
14268
|
+
const result = await client.agents.setConfig.mutate({
|
|
14269
|
+
deployment_id: agentId,
|
|
14270
|
+
expected_updated_at: current.updated_at,
|
|
14271
|
+
path: path2,
|
|
14272
|
+
value: opts.value
|
|
14273
|
+
});
|
|
14274
|
+
if (opts.json)
|
|
14275
|
+
return printResult(result, opts);
|
|
14276
|
+
console.log(import_picocolors5.default.green(`Updated agent config '${path2}'.`));
|
|
14277
|
+
});
|
|
14278
|
+
return cmd;
|
|
14279
|
+
}
|
|
14280
|
+
|
|
14052
14281
|
// src/commands/analytics.ts
|
|
14282
|
+
init_commander();
|
|
14283
|
+
init_trpc();
|
|
14284
|
+
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
14053
14285
|
function requireConfig() {
|
|
14054
14286
|
const cfg = requireLoginConfig();
|
|
14055
14287
|
if (!cfg.active_account?.target?.space_id) {
|
|
14056
|
-
console.error(
|
|
14288
|
+
console.error(import_picocolors6.default.red("Missing space config. Run 'dosu setup' to reconfigure."));
|
|
14057
14289
|
process.exit(1);
|
|
14058
14290
|
}
|
|
14059
14291
|
return cfg;
|
|
@@ -14090,16 +14322,16 @@ function analyticsCommand() {
|
|
|
14090
14322
|
init_commander();
|
|
14091
14323
|
init_config();
|
|
14092
14324
|
init_logger();
|
|
14093
|
-
var
|
|
14325
|
+
var import_picocolors7 = __toESM(require_picocolors(), 1);
|
|
14094
14326
|
var DEFAULT_TIMEOUT_SECONDS = 600;
|
|
14095
14327
|
function requireConfig2() {
|
|
14096
14328
|
const cfg = loadConfig();
|
|
14097
14329
|
if (!cfg.active_account?.target?.api_key) {
|
|
14098
|
-
console.error(
|
|
14330
|
+
console.error(import_picocolors7.default.red("Not configured. Run 'dosu setup' first."));
|
|
14099
14331
|
process.exit(1);
|
|
14100
14332
|
}
|
|
14101
14333
|
if (!cfg.active_account?.target?.deployment_id || !cfg.active_account?.target?.space_id) {
|
|
14102
|
-
console.error(
|
|
14334
|
+
console.error(import_picocolors7.default.red("Missing deployment config. Run 'dosu setup' to reconfigure."));
|
|
14103
14335
|
process.exit(1);
|
|
14104
14336
|
}
|
|
14105
14337
|
return cfg;
|
|
@@ -14109,14 +14341,14 @@ function askCommand() {
|
|
|
14109
14341
|
const cfg = requireConfig2();
|
|
14110
14342
|
const backendURL = getBackendURL();
|
|
14111
14343
|
if (!backendURL) {
|
|
14112
|
-
console.error(
|
|
14344
|
+
console.error(import_picocolors7.default.red("Backend URL not configured."));
|
|
14113
14345
|
process.exit(1);
|
|
14114
14346
|
}
|
|
14115
14347
|
let timeoutSeconds = DEFAULT_TIMEOUT_SECONDS;
|
|
14116
14348
|
if (opts.timeout !== undefined) {
|
|
14117
14349
|
timeoutSeconds = Number(opts.timeout);
|
|
14118
14350
|
if (!Number.isFinite(timeoutSeconds) || timeoutSeconds <= 0) {
|
|
14119
|
-
console.error(
|
|
14351
|
+
console.error(import_picocolors7.default.red("--timeout must be a positive number of seconds."));
|
|
14120
14352
|
process.exit(1);
|
|
14121
14353
|
}
|
|
14122
14354
|
}
|
|
@@ -14144,7 +14376,7 @@ function askCommand() {
|
|
|
14144
14376
|
const raw = errBody.detail ?? detail;
|
|
14145
14377
|
detail = typeof raw === "string" ? raw : JSON.stringify(raw, null, 2);
|
|
14146
14378
|
} catch {}
|
|
14147
|
-
console.error(
|
|
14379
|
+
console.error(import_picocolors7.default.red(`Error: ${detail}`));
|
|
14148
14380
|
process.exit(1);
|
|
14149
14381
|
}
|
|
14150
14382
|
const body = await resp.json();
|
|
@@ -14159,18 +14391,18 @@ function askCommand() {
|
|
|
14159
14391
|
}
|
|
14160
14392
|
if (body.session_id) {
|
|
14161
14393
|
console.log(`
|
|
14162
|
-
${
|
|
14394
|
+
${import_picocolors7.default.dim(`Session: ${body.session_id}`)}`);
|
|
14163
14395
|
}
|
|
14164
14396
|
if (body.observations && body.observations.length > 0) {
|
|
14165
14397
|
console.log(`
|
|
14166
|
-
${
|
|
14398
|
+
${import_picocolors7.default.bold("Key observations:")}`);
|
|
14167
14399
|
for (const obs of body.observations) {
|
|
14168
|
-
console.log(` ${
|
|
14400
|
+
console.log(` ${import_picocolors7.default.dim("•")} ${obs}`);
|
|
14169
14401
|
}
|
|
14170
14402
|
}
|
|
14171
14403
|
} catch (err) {
|
|
14172
14404
|
if (err instanceof Error && err.name === "AbortError") {
|
|
14173
|
-
console.error(
|
|
14405
|
+
console.error(import_picocolors7.default.red("Request timed out."));
|
|
14174
14406
|
process.exit(1);
|
|
14175
14407
|
}
|
|
14176
14408
|
throw err;
|
|
@@ -14186,7 +14418,7 @@ init_dist8();
|
|
|
14186
14418
|
init_commander();
|
|
14187
14419
|
init_trpc();
|
|
14188
14420
|
init_logger();
|
|
14189
|
-
var
|
|
14421
|
+
var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
14190
14422
|
import { existsSync as existsSync5, readFileSync as readFileSync5, rmSync, writeFileSync as writeFileSync5 } from "node:fs";
|
|
14191
14423
|
import { dirname, join as join5 } from "node:path";
|
|
14192
14424
|
|
|
@@ -14290,7 +14522,7 @@ var DEFAULT_DEPLOYMENT_CONFIG_GITHUB = {
|
|
|
14290
14522
|
|
|
14291
14523
|
// src/setup/github-repo-prompt.ts
|
|
14292
14524
|
init_dist7();
|
|
14293
|
-
var
|
|
14525
|
+
var import_picocolors8 = __toESM(require_picocolors(), 1);
|
|
14294
14526
|
|
|
14295
14527
|
// src/setup/prompt-symbols.ts
|
|
14296
14528
|
var unicode2 = supportsUnicode();
|
|
@@ -14408,33 +14640,33 @@ class GitHubRepoPrompt extends V {
|
|
|
14408
14640
|
this.selected = this.selected.length === repoValues.length ? [] : repoValues;
|
|
14409
14641
|
}
|
|
14410
14642
|
renderPrompt() {
|
|
14411
|
-
const symbolByState = this.state === "submit" ?
|
|
14412
|
-
const header = `${
|
|
14643
|
+
const symbolByState = this.state === "submit" ? import_picocolors8.default.green(SUBMIT_SYMBOL) : this.state === "cancel" ? import_picocolors8.default.red(CANCEL_SYMBOL2) : import_picocolors8.default.cyan(ACTIVE_SYMBOL);
|
|
14644
|
+
const header = `${import_picocolors8.default.gray(BAR)}
|
|
14413
14645
|
${symbolByState} ${this.message}
|
|
14414
14646
|
`;
|
|
14415
14647
|
if (this.state === "submit") {
|
|
14416
|
-
return `${header}${
|
|
14648
|
+
return `${header}${import_picocolors8.default.gray(BAR)} ${import_picocolors8.default.dim(this.submitLabel())}`;
|
|
14417
14649
|
}
|
|
14418
14650
|
if (this.state === "cancel") {
|
|
14419
|
-
return `${header}${
|
|
14651
|
+
return `${header}${import_picocolors8.default.gray(BAR)}`;
|
|
14420
14652
|
}
|
|
14421
14653
|
const body = visibleOptions(this.cursor, this.options, this.maxItems).map((option) => {
|
|
14422
14654
|
if (option.kind === "ellipsis") {
|
|
14423
|
-
return `${
|
|
14655
|
+
return `${import_picocolors8.default.gray(BAR)} ${import_picocolors8.default.dim(ELLIPSIS)}`;
|
|
14424
14656
|
}
|
|
14425
14657
|
const current = this.options[option.index];
|
|
14426
14658
|
if (current.kind === "separator") {
|
|
14427
|
-
return `${
|
|
14659
|
+
return `${import_picocolors8.default.gray(BAR)} ${import_picocolors8.default.dim(SEPARATOR_LINE)}`;
|
|
14428
14660
|
}
|
|
14429
14661
|
const isActive = option.index === this.cursor;
|
|
14430
|
-
const marker = current.kind === "action" ? isActive ?
|
|
14431
|
-
const label = isActive ?
|
|
14432
|
-
const hint = current.hint ? ` ${
|
|
14433
|
-
return `${
|
|
14662
|
+
const marker = current.kind === "action" ? isActive ? import_picocolors8.default.cyan(ACTION_ARROW) : import_picocolors8.default.dim(ACTION_ARROW) : this.selected.includes(current.value) ? isActive ? import_picocolors8.default.cyan(CHECKBOX_ON) : CHECKBOX_ON : isActive ? import_picocolors8.default.cyan(CHECKBOX_OFF) : CHECKBOX_OFF;
|
|
14663
|
+
const label = isActive ? import_picocolors8.default.cyan(current.label) : current.label;
|
|
14664
|
+
const hint = current.hint ? ` ${import_picocolors8.default.dim(`(${current.hint})`)}` : "";
|
|
14665
|
+
return `${import_picocolors8.default.gray(BAR)} ${marker} ${label}${hint}`;
|
|
14434
14666
|
});
|
|
14435
14667
|
return `${header}${body.join(`
|
|
14436
14668
|
`)}
|
|
14437
|
-
${
|
|
14669
|
+
${import_picocolors8.default.cyan(FOOTER)}`;
|
|
14438
14670
|
}
|
|
14439
14671
|
submitLabel() {
|
|
14440
14672
|
if (typeof this.value === "string") {
|
|
@@ -15061,7 +15293,7 @@ ${dim(`deployment ${deployment_id}`)}`);
|
|
|
15061
15293
|
// src/version/pending-tasks-check.ts
|
|
15062
15294
|
init_config();
|
|
15063
15295
|
init_logger();
|
|
15064
|
-
var
|
|
15296
|
+
var import_picocolors10 = __toESM(require_picocolors(), 1);
|
|
15065
15297
|
import { existsSync as existsSync4, mkdirSync as mkdirSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync4 } from "node:fs";
|
|
15066
15298
|
import { join as join4 } from "node:path";
|
|
15067
15299
|
var CACHE_FILENAME = "pending-tasks.json";
|
|
@@ -15126,11 +15358,11 @@ async function fetchTaskRun(backendURL, apiKey, taskId) {
|
|
|
15126
15358
|
function displayTask(task) {
|
|
15127
15359
|
if (task.prUrl) {
|
|
15128
15360
|
console.error(`
|
|
15129
|
-
${
|
|
15361
|
+
${import_picocolors10.default.green(`✓ Dosu PR ready (${task.repo}): ${task.prUrl}`)}
|
|
15130
15362
|
`);
|
|
15131
15363
|
} else {
|
|
15132
15364
|
console.error(`
|
|
15133
|
-
${
|
|
15365
|
+
${import_picocolors10.default.yellow(`✗ Dosu doc generation failed (${task.repo}): ${task.error}`)}
|
|
15134
15366
|
`);
|
|
15135
15367
|
}
|
|
15136
15368
|
}
|
|
@@ -15196,11 +15428,11 @@ var INDEX_POLL_TIMEOUT_MS = 120000;
|
|
|
15196
15428
|
function requireConfig3() {
|
|
15197
15429
|
const cfg = requireLoginConfig();
|
|
15198
15430
|
if (!cfg.active_account?.target?.api_key) {
|
|
15199
|
-
console.error(
|
|
15431
|
+
console.error(import_picocolors11.default.red("API key not configured. Run 'dosu setup' first."));
|
|
15200
15432
|
process.exit(1);
|
|
15201
15433
|
}
|
|
15202
15434
|
if (!cfg.active_account?.target?.org_id) {
|
|
15203
|
-
console.error(
|
|
15435
|
+
console.error(import_picocolors11.default.red("Missing org config. Run 'dosu setup' to reconfigure."));
|
|
15204
15436
|
process.exit(1);
|
|
15205
15437
|
}
|
|
15206
15438
|
return cfg;
|
|
@@ -15208,7 +15440,7 @@ function requireConfig3() {
|
|
|
15208
15440
|
function requireBackendURL() {
|
|
15209
15441
|
const backendURL = getBackendURL();
|
|
15210
15442
|
if (!backendURL) {
|
|
15211
|
-
console.error(
|
|
15443
|
+
console.error(import_picocolors11.default.red("Backend URL not configured."));
|
|
15212
15444
|
process.exit(1);
|
|
15213
15445
|
}
|
|
15214
15446
|
return backendURL;
|
|
@@ -15284,25 +15516,25 @@ async function ensureSyncedRepo(cfg, client, detected, explicitDataSourceId, non
|
|
|
15284
15516
|
let match = findMatch(sources, detected);
|
|
15285
15517
|
if (!match) {
|
|
15286
15518
|
if (nonInteractive) {
|
|
15287
|
-
console.error(
|
|
15519
|
+
console.error(import_picocolors11.default.red(`${detected.slug} isn't connected to Dosu. Run 'dosu setup' to connect it first.`));
|
|
15288
15520
|
process.exit(1);
|
|
15289
15521
|
}
|
|
15290
15522
|
const connect = await confirm({
|
|
15291
15523
|
message: `${detected.slug} isn't connected to Dosu. Connect and sync it now?`
|
|
15292
15524
|
});
|
|
15293
15525
|
if (isCancel(connect) || !connect) {
|
|
15294
|
-
console.error(
|
|
15526
|
+
console.error(import_picocolors11.default.red(`Repo not connected. Run 'dosu setup' to connect ${detected.slug}, then retry.`));
|
|
15295
15527
|
process.exit(1);
|
|
15296
15528
|
}
|
|
15297
15529
|
const result = await stepConnectGitHubRepo(cfg, detected);
|
|
15298
15530
|
if (!result.has_connected_repo) {
|
|
15299
|
-
console.error(
|
|
15531
|
+
console.error(import_picocolors11.default.red(`Could not connect ${detected.slug}. Run 'dosu setup' and retry.`));
|
|
15300
15532
|
process.exit(1);
|
|
15301
15533
|
}
|
|
15302
15534
|
sources = await listDataSources(client, orgID);
|
|
15303
15535
|
match = findMatch(sources, detected);
|
|
15304
15536
|
if (!match) {
|
|
15305
|
-
console.error(
|
|
15537
|
+
console.error(import_picocolors11.default.red(`Could not find ${detected.slug} after connecting. Retry shortly.`));
|
|
15306
15538
|
process.exit(1);
|
|
15307
15539
|
}
|
|
15308
15540
|
}
|
|
@@ -15310,7 +15542,7 @@ async function ensureSyncedRepo(cfg, client, detected, explicitDataSourceId, non
|
|
|
15310
15542
|
const indexed = await waitForIndexed(client, orgID, detected, nonInteractive);
|
|
15311
15543
|
if (!indexed) {
|
|
15312
15544
|
if (nonInteractive) {
|
|
15313
|
-
console.error(
|
|
15545
|
+
console.error(import_picocolors11.default.red(`${detected.slug} is still indexing. Re-run once indexing finishes.`));
|
|
15314
15546
|
process.exit(1);
|
|
15315
15547
|
}
|
|
15316
15548
|
log.info(`${detected.slug} is still indexing. Re-run 'dosu audit' in a few minutes once it's ready.`);
|
|
@@ -15319,14 +15551,14 @@ async function ensureSyncedRepo(cfg, client, detected, explicitDataSourceId, non
|
|
|
15319
15551
|
match = indexed;
|
|
15320
15552
|
}
|
|
15321
15553
|
if (!match.data_source_id) {
|
|
15322
|
-
console.error(
|
|
15554
|
+
console.error(import_picocolors11.default.red("Matched data source has no id. Run 'dosu setup' and retry."));
|
|
15323
15555
|
process.exit(1);
|
|
15324
15556
|
}
|
|
15325
15557
|
return match.data_source_id;
|
|
15326
15558
|
}
|
|
15327
15559
|
function loadFindings(findingsPath) {
|
|
15328
15560
|
const fail = () => {
|
|
15329
|
-
console.error(
|
|
15561
|
+
console.error(import_picocolors11.default.red("Run the Dosu audit in your coding agent first (it writes .dosu/audit.json)."));
|
|
15330
15562
|
process.exit(1);
|
|
15331
15563
|
};
|
|
15332
15564
|
if (!existsSync5(findingsPath)) {
|
|
@@ -15389,13 +15621,13 @@ function auditCommand() {
|
|
|
15389
15621
|
return;
|
|
15390
15622
|
}
|
|
15391
15623
|
for (const t2 of tasks) {
|
|
15392
|
-
console.log(`${t2.id} ${
|
|
15624
|
+
console.log(`${t2.id} ${import_picocolors11.default.dim(`(${t2.doc_type})`)} ${t2.label} — ${t2.description}`);
|
|
15393
15625
|
}
|
|
15394
15626
|
return;
|
|
15395
15627
|
}
|
|
15396
15628
|
const detected = detectGitRepo();
|
|
15397
15629
|
if (!detected) {
|
|
15398
|
-
console.error(
|
|
15630
|
+
console.error(import_picocolors11.default.red("Not a GitHub repo. Run 'dosu audit' from a GitHub repository."));
|
|
15399
15631
|
process.exit(1);
|
|
15400
15632
|
}
|
|
15401
15633
|
const nonInteractive = Boolean(opts.tasks);
|
|
@@ -15404,7 +15636,7 @@ function auditCommand() {
|
|
|
15404
15636
|
const findingsPath = opts.findings ?? join5(process.cwd(), ".dosu", "audit.json");
|
|
15405
15637
|
const findings = loadFindings(findingsPath);
|
|
15406
15638
|
if (!opts.dataSourceId && findings.repo?.slug && findings.repo.slug !== detected.slug) {
|
|
15407
|
-
console.error(
|
|
15639
|
+
console.error(import_picocolors11.default.red(`Audit was run on ${findings.repo.slug}, but the current repo is ${detected.slug}. ` + `Run 'dosu audit' from ${findings.repo.slug} so the PR targets the audited repo.`));
|
|
15408
15640
|
process.exit(1);
|
|
15409
15641
|
}
|
|
15410
15642
|
const capsResp = await backendGet("/v1/cli/tasks", apiKey);
|
|
@@ -15433,7 +15665,7 @@ function auditCommand() {
|
|
|
15433
15665
|
message: "Which docs should Dosu generate?",
|
|
15434
15666
|
options: actionable.map((item) => ({
|
|
15435
15667
|
value: item.task,
|
|
15436
|
-
label: `${item.file} ${
|
|
15668
|
+
label: `${item.file} ${import_picocolors11.default.dim(`(${item.type})`)}`,
|
|
15437
15669
|
hint: `${item.status} — ${item.rationale}`
|
|
15438
15670
|
})),
|
|
15439
15671
|
initialValues: actionable.filter(isPreselected).map((item) => item.task),
|
|
@@ -15490,7 +15722,7 @@ init_commander();
|
|
|
15490
15722
|
init_client();
|
|
15491
15723
|
init_trpc();
|
|
15492
15724
|
init_config();
|
|
15493
|
-
var
|
|
15725
|
+
var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
15494
15726
|
var MCP_PROVIDER_SLUG = "dosu_mcp";
|
|
15495
15727
|
function requireConfig4() {
|
|
15496
15728
|
return requireLoginConfig();
|
|
@@ -15514,30 +15746,30 @@ function deploymentsCommand() {
|
|
|
15514
15746
|
return;
|
|
15515
15747
|
}
|
|
15516
15748
|
if (!deployments || deployments.length === 0) {
|
|
15517
|
-
console.log(
|
|
15749
|
+
console.log(import_picocolors12.default.dim("No deployments found."));
|
|
15518
15750
|
return;
|
|
15519
15751
|
}
|
|
15520
15752
|
printTable(["ID", "Name", "Org", "Status"], deployments.map((d) => [
|
|
15521
15753
|
d.deployment_id.slice(0, 8),
|
|
15522
15754
|
d.name ?? "(unnamed)",
|
|
15523
15755
|
d.org_id ? d.org_id.slice(0, 8) : "—",
|
|
15524
|
-
d.enabled ?
|
|
15756
|
+
d.enabled ? import_picocolors12.default.green("active") : import_picocolors12.default.dim("disabled")
|
|
15525
15757
|
]), { rawData: deployments });
|
|
15526
15758
|
if (cfg.active_account?.target?.deployment_id) {
|
|
15527
15759
|
console.log(`
|
|
15528
|
-
${
|
|
15760
|
+
${import_picocolors12.default.dim(`Current: ${cfg.active_account?.target?.deployment_name ?? cfg.active_account?.target?.deployment_id}`)}`);
|
|
15529
15761
|
}
|
|
15530
15762
|
});
|
|
15531
15763
|
cmd.command("info").description("Show current deployment details").option("--json", "Output as JSON").action(async (opts) => {
|
|
15532
15764
|
const cfg = requireConfig4();
|
|
15533
15765
|
if (!cfg.active_account?.target?.deployment_id) {
|
|
15534
|
-
console.error(
|
|
15766
|
+
console.error(import_picocolors12.default.red("No deployment selected. Run 'dosu setup' or 'dosu deployments switch'."));
|
|
15535
15767
|
process.exit(1);
|
|
15536
15768
|
}
|
|
15537
15769
|
const client = createTypedClient(cfg);
|
|
15538
15770
|
const deployment = await client.workspaces.get.query(cfg.active_account?.target?.deployment_id);
|
|
15539
15771
|
if (!deployment) {
|
|
15540
|
-
console.error(
|
|
15772
|
+
console.error(import_picocolors12.default.red(`Deployment not found: ${cfg.active_account?.target?.deployment_id}`));
|
|
15541
15773
|
process.exit(1);
|
|
15542
15774
|
}
|
|
15543
15775
|
if (opts.json) {
|
|
@@ -15560,11 +15792,11 @@ ${import_picocolors10.default.dim(`Current: ${cfg.active_account?.target?.deploy
|
|
|
15560
15792
|
const client = createTypedClient(cfg);
|
|
15561
15793
|
const deployment = await client.workspaces.get.query(id);
|
|
15562
15794
|
if (!deployment) {
|
|
15563
|
-
console.error(
|
|
15795
|
+
console.error(import_picocolors12.default.red(`Deployment not found: ${id}`));
|
|
15564
15796
|
process.exit(1);
|
|
15565
15797
|
}
|
|
15566
15798
|
if (deployment.provider_slug !== MCP_PROVIDER_SLUG) {
|
|
15567
|
-
console.error(
|
|
15799
|
+
console.error(import_picocolors12.default.red(`Not a Dosu MCP deployment: ${id}`));
|
|
15568
15800
|
process.exit(1);
|
|
15569
15801
|
}
|
|
15570
15802
|
const apiKey = await new Client(cfg).createAPIKey(deployment.deployment_id, "dosu-cli");
|
|
@@ -15580,7 +15812,7 @@ ${import_picocolors10.default.dim(`Current: ${cfg.active_account?.target?.deploy
|
|
|
15580
15812
|
printResult({ success: true, deployment_id: deployment.deployment_id, name: deployment.name }, opts);
|
|
15581
15813
|
return;
|
|
15582
15814
|
}
|
|
15583
|
-
console.log(
|
|
15815
|
+
console.log(import_picocolors12.default.green(`Switched to deployment: ${deployment.name}`));
|
|
15584
15816
|
});
|
|
15585
15817
|
return cmd;
|
|
15586
15818
|
}
|
|
@@ -15592,7 +15824,7 @@ init_commander();
|
|
|
15592
15824
|
init_client();
|
|
15593
15825
|
init_trpc();
|
|
15594
15826
|
init_logger();
|
|
15595
|
-
var
|
|
15827
|
+
var import_picocolors13 = __toESM(require_picocolors(), 1);
|
|
15596
15828
|
import { readFileSync as readFileSync6 } from "node:fs";
|
|
15597
15829
|
|
|
15598
15830
|
// src/commands/doc-import.ts
|
|
@@ -15633,7 +15865,7 @@ async function importDocuments(client, platform2, context, ids) {
|
|
|
15633
15865
|
function requireConfig5() {
|
|
15634
15866
|
const cfg = requireLoginConfig();
|
|
15635
15867
|
if (!cfg.active_account?.target?.space_id) {
|
|
15636
|
-
console.error(
|
|
15868
|
+
console.error(import_picocolors13.default.red("Missing space config. Run 'dosu setup' to reconfigure."));
|
|
15637
15869
|
process.exit(1);
|
|
15638
15870
|
}
|
|
15639
15871
|
return cfg;
|
|
@@ -15643,7 +15875,7 @@ async function getKnowledgeStoreId(client, spaceId) {
|
|
|
15643
15875
|
space_id: spaceId
|
|
15644
15876
|
});
|
|
15645
15877
|
if (!store) {
|
|
15646
|
-
console.error(
|
|
15878
|
+
console.error(import_picocolors13.default.red("No knowledge store found for this deployment."));
|
|
15647
15879
|
process.exit(1);
|
|
15648
15880
|
}
|
|
15649
15881
|
return store.id;
|
|
@@ -15711,7 +15943,7 @@ function isConcurrentImportError(err, msg) {
|
|
|
15711
15943
|
async function backendPost2(path3, apiKey, body) {
|
|
15712
15944
|
const backendURL = getBackendURL();
|
|
15713
15945
|
if (!backendURL) {
|
|
15714
|
-
console.error(
|
|
15946
|
+
console.error(import_picocolors13.default.red("Backend URL not configured."));
|
|
15715
15947
|
process.exit(1);
|
|
15716
15948
|
}
|
|
15717
15949
|
const resp = await fetch(`${backendURL}${path3}`, {
|
|
@@ -15750,7 +15982,7 @@ function docsCommand() {
|
|
|
15750
15982
|
return;
|
|
15751
15983
|
}
|
|
15752
15984
|
if (!pages || pages.length === 0) {
|
|
15753
|
-
console.log(
|
|
15985
|
+
console.log(import_picocolors13.default.dim("No documents found."));
|
|
15754
15986
|
return;
|
|
15755
15987
|
}
|
|
15756
15988
|
printTable(["ID", "Title", "Status", "Created"], pages.map((p2) => [
|
|
@@ -15772,10 +16004,10 @@ function docsCommand() {
|
|
|
15772
16004
|
return;
|
|
15773
16005
|
}
|
|
15774
16006
|
if (!page) {
|
|
15775
|
-
console.log(
|
|
16007
|
+
console.log(import_picocolors13.default.dim("Document not found."));
|
|
15776
16008
|
return;
|
|
15777
16009
|
}
|
|
15778
|
-
console.log(
|
|
16010
|
+
console.log(import_picocolors13.default.bold(page.title ?? "(untitled)"));
|
|
15779
16011
|
printInfo([
|
|
15780
16012
|
["ID", page.id],
|
|
15781
16013
|
["Status", page.published ? "published" : "draft"],
|
|
@@ -15800,7 +16032,7 @@ ${page.body}`);
|
|
|
15800
16032
|
printResult(result, opts);
|
|
15801
16033
|
return;
|
|
15802
16034
|
}
|
|
15803
|
-
console.log(
|
|
16035
|
+
console.log(import_picocolors13.default.green(`Document "${opts.title}" created.`));
|
|
15804
16036
|
});
|
|
15805
16037
|
cmd.command("update").description("Update a document").argument("<id>", "Page ID").option("--title <title>", "New title").option("--body <markdown>", "New body (markdown)").addOption(new Option("--body-file <path>", "Read body from file").conflicts("body")).option("--json", "Output as JSON").action(async (id, opts) => {
|
|
15806
16038
|
if (opts.title === undefined && opts.body === undefined && opts.bodyFile === undefined) {
|
|
@@ -15820,7 +16052,7 @@ ${page.body}`);
|
|
|
15820
16052
|
printResult({ success: true, id }, opts);
|
|
15821
16053
|
return;
|
|
15822
16054
|
}
|
|
15823
|
-
console.log(
|
|
16055
|
+
console.log(import_picocolors13.default.green("Document updated."));
|
|
15824
16056
|
});
|
|
15825
16057
|
for (const archived of [true, false]) {
|
|
15826
16058
|
const name = archived ? "archive" : "unarchive";
|
|
@@ -15832,7 +16064,7 @@ ${page.body}`);
|
|
|
15832
16064
|
printResult({ success: true, id, archived }, opts);
|
|
15833
16065
|
return;
|
|
15834
16066
|
}
|
|
15835
|
-
console.log(
|
|
16067
|
+
console.log(import_picocolors13.default.green(`Document ${name}d.`));
|
|
15836
16068
|
});
|
|
15837
16069
|
}
|
|
15838
16070
|
cmd.command("delete").description("Delete a document").argument("<id>", "Page ID").option("--json", "Output as JSON").action(async (id, opts) => {
|
|
@@ -15843,7 +16075,7 @@ ${page.body}`);
|
|
|
15843
16075
|
printResult({ success: true, id }, opts);
|
|
15844
16076
|
return;
|
|
15845
16077
|
}
|
|
15846
|
-
console.log(
|
|
16078
|
+
console.log(import_picocolors13.default.green("Document deleted."));
|
|
15847
16079
|
});
|
|
15848
16080
|
cmd.command("versions").description("List document versions").argument("<id>", "Page ID").option("--json", "Output as JSON").action(async (id, opts) => {
|
|
15849
16081
|
const cfg = requireConfig5();
|
|
@@ -15854,7 +16086,7 @@ ${page.body}`);
|
|
|
15854
16086
|
return;
|
|
15855
16087
|
}
|
|
15856
16088
|
if (!versions || versions.length === 0) {
|
|
15857
|
-
console.log(
|
|
16089
|
+
console.log(import_picocolors13.default.dim("No versions found."));
|
|
15858
16090
|
return;
|
|
15859
16091
|
}
|
|
15860
16092
|
printTable(["Version", "Created"], versions.map((v) => [
|
|
@@ -15873,7 +16105,7 @@ ${page.body}`);
|
|
|
15873
16105
|
printResult({ success: true, id, revision: opts.revision }, opts);
|
|
15874
16106
|
return;
|
|
15875
16107
|
}
|
|
15876
|
-
console.log(
|
|
16108
|
+
console.log(import_picocolors13.default.green(`Document restored to version ${opts.revision}.`));
|
|
15877
16109
|
});
|
|
15878
16110
|
cmd.command("generate").description("Generate a document using AI").requiredOption("--title <title>", "Document title").option("--instructions <text>", "Custom generation instructions").option("--json", "Output as JSON").action(async (opts) => {
|
|
15879
16111
|
const cfg = requireConfig5();
|
|
@@ -15888,7 +16120,7 @@ ${page.body}`);
|
|
|
15888
16120
|
printResult(result, opts);
|
|
15889
16121
|
return;
|
|
15890
16122
|
}
|
|
15891
|
-
console.log(
|
|
16123
|
+
console.log(import_picocolors13.default.green("Document generation started."));
|
|
15892
16124
|
});
|
|
15893
16125
|
cmd.command("auto-tag").description("Auto-tag a document using AI").argument("<id>", "Page ID").option("--json", "Output as JSON").action(async (id, opts) => {
|
|
15894
16126
|
const cfg = requireConfig5();
|
|
@@ -15897,7 +16129,7 @@ ${page.body}`);
|
|
|
15897
16129
|
printResult(result, opts);
|
|
15898
16130
|
return;
|
|
15899
16131
|
}
|
|
15900
|
-
console.log(
|
|
16132
|
+
console.log(import_picocolors13.default.green("Auto-tagging started."));
|
|
15901
16133
|
});
|
|
15902
16134
|
cmd.command("import").description("Import documents from an external platform").addArgument(new Argument("<platform>", "Import platform").choices([...IMPORT_PLATFORMS])).requiredOption("--files <ids>", "Comma-separated file/page IDs to import").option("--json", "Output as JSON").action(async (platform2, opts) => {
|
|
15903
16135
|
const cfg = requireConfig5();
|
|
@@ -15916,7 +16148,7 @@ ${page.body}`);
|
|
|
15916
16148
|
printResult(result, opts);
|
|
15917
16149
|
return;
|
|
15918
16150
|
}
|
|
15919
|
-
console.log(
|
|
16151
|
+
console.log(import_picocolors13.default.green(`Import started.${result.task_id ? ` Task ID: ${result.task_id}` : ""}`));
|
|
15920
16152
|
} catch (err) {
|
|
15921
16153
|
const msg = err instanceof Error ? err.message : String(err);
|
|
15922
16154
|
logger.warn("docs-import", `Import failed: ${msg}`);
|
|
@@ -15927,7 +16159,7 @@ ${page.body}`);
|
|
|
15927
16159
|
console.error(JSON.stringify({ error }));
|
|
15928
16160
|
} else if (isConcurrentImport) {
|
|
15929
16161
|
log.error("An import is already in progress for this organization.");
|
|
15930
|
-
log.info(`Check status with: ${
|
|
16162
|
+
log.info(`Check status with: ${import_picocolors13.default.cyan("dosu docs import-status <task-id>")}`);
|
|
15931
16163
|
log.info("Only one import can run per organization at a time.");
|
|
15932
16164
|
} else {
|
|
15933
16165
|
log.error(detail);
|
|
@@ -15944,7 +16176,7 @@ ${page.body}`);
|
|
|
15944
16176
|
return;
|
|
15945
16177
|
}
|
|
15946
16178
|
if (!status) {
|
|
15947
|
-
console.log(
|
|
16179
|
+
console.log(import_picocolors13.default.dim("Import task not found."));
|
|
15948
16180
|
return;
|
|
15949
16181
|
}
|
|
15950
16182
|
console.log(`Status: ${JSON.stringify(status)}`);
|
|
@@ -15973,7 +16205,7 @@ ${page.body}`);
|
|
|
15973
16205
|
path: `/sync-back/azure_devops/${id}/publish`,
|
|
15974
16206
|
buildBody: () => {
|
|
15975
16207
|
if (!opts.dataSourceId) {
|
|
15976
|
-
console.error(
|
|
16208
|
+
console.error(import_picocolors13.default.red("--data-source-id <id> is required when publishing to azure_devops"));
|
|
15977
16209
|
process.exit(1);
|
|
15978
16210
|
}
|
|
15979
16211
|
return {
|
|
@@ -16006,7 +16238,7 @@ ${page.body}`);
|
|
|
16006
16238
|
};
|
|
16007
16239
|
const config = publishMap[platform2];
|
|
16008
16240
|
if (!config) {
|
|
16009
|
-
console.error(
|
|
16241
|
+
console.error(import_picocolors13.default.red(`Unknown platform: ${platform2}`));
|
|
16010
16242
|
process.exit(1);
|
|
16011
16243
|
}
|
|
16012
16244
|
logger.debug("docs", `Publishing to ${platform2}`);
|
|
@@ -16015,7 +16247,7 @@ ${page.body}`);
|
|
|
16015
16247
|
printResult(result, opts);
|
|
16016
16248
|
return;
|
|
16017
16249
|
}
|
|
16018
|
-
console.log(
|
|
16250
|
+
console.log(import_picocolors13.default.green(`Document published to ${platform2}.`));
|
|
16019
16251
|
});
|
|
16020
16252
|
cmd.command("sync-back").description("Sync document back to its source (Notion/Confluence)").argument("<id>", "Page ID").option("--json", "Output as JSON").action(async (id, opts) => {
|
|
16021
16253
|
const cfg = requireConfig5();
|
|
@@ -16025,7 +16257,7 @@ ${page.body}`);
|
|
|
16025
16257
|
printResult(result, opts);
|
|
16026
16258
|
return;
|
|
16027
16259
|
}
|
|
16028
|
-
console.log(
|
|
16260
|
+
console.log(import_picocolors13.default.green("Sync-back initiated."));
|
|
16029
16261
|
});
|
|
16030
16262
|
return cmd;
|
|
16031
16263
|
}
|
|
@@ -16036,11 +16268,11 @@ init_insights3();
|
|
|
16036
16268
|
// src/commands/integrations.ts
|
|
16037
16269
|
init_commander();
|
|
16038
16270
|
init_trpc();
|
|
16039
|
-
var
|
|
16271
|
+
var import_picocolors17 = __toESM(require_picocolors(), 1);
|
|
16040
16272
|
function requireConfig6() {
|
|
16041
16273
|
const cfg = requireLoginConfig();
|
|
16042
16274
|
if (!cfg.active_account?.target?.org_id) {
|
|
16043
|
-
console.error(
|
|
16275
|
+
console.error(import_picocolors17.default.red("Missing org config. Run 'dosu setup' to reconfigure."));
|
|
16044
16276
|
process.exit(1);
|
|
16045
16277
|
}
|
|
16046
16278
|
return cfg;
|
|
@@ -16103,7 +16335,7 @@ function integrationsCommand() {
|
|
|
16103
16335
|
}
|
|
16104
16336
|
printTable(["Platform", "Status"], results.map((r2) => [
|
|
16105
16337
|
r2.platform,
|
|
16106
|
-
r2.connected === null ?
|
|
16338
|
+
r2.connected === null ? import_picocolors17.default.dim("status unavailable") : r2.connected ? import_picocolors17.default.green("connected") : import_picocolors17.default.dim("not connected")
|
|
16107
16339
|
]), { rawData: results });
|
|
16108
16340
|
});
|
|
16109
16341
|
cmd.command("status").description("Check connection status of a specific platform").addArgument(new Argument("<platform>", "Integration platform").choices([...DISPLAY_PLATFORMS])).option("--json", "Output as JSON").action(async (platform4, opts) => {
|
|
@@ -16115,14 +16347,14 @@ function integrationsCommand() {
|
|
|
16115
16347
|
printResult({ platform: platform4, connected: null, note: "connection status unavailable via CLI" }, opts);
|
|
16116
16348
|
return;
|
|
16117
16349
|
}
|
|
16118
|
-
console.log(`${platform4}: ${
|
|
16350
|
+
console.log(`${platform4}: ${import_picocolors17.default.dim("connection status unavailable via CLI")}`);
|
|
16119
16351
|
return;
|
|
16120
16352
|
}
|
|
16121
16353
|
if (opts.json) {
|
|
16122
16354
|
printResult({ platform: platform4, connected, connection }, opts);
|
|
16123
16355
|
return;
|
|
16124
16356
|
}
|
|
16125
|
-
console.log(`${platform4}: ${connected ?
|
|
16357
|
+
console.log(`${platform4}: ${connected ? import_picocolors17.default.green("connected") : import_picocolors17.default.dim("not connected")}`);
|
|
16126
16358
|
});
|
|
16127
16359
|
cmd.command("slack-channels").description("List Slack channels").option("--json", "Output as JSON").action(async (opts) => {
|
|
16128
16360
|
const cfg = requireConfig6();
|
|
@@ -16133,7 +16365,7 @@ function integrationsCommand() {
|
|
|
16133
16365
|
return;
|
|
16134
16366
|
}
|
|
16135
16367
|
if (!channels || channels.length === 0) {
|
|
16136
|
-
console.log(
|
|
16368
|
+
console.log(import_picocolors17.default.dim("No Slack channels found."));
|
|
16137
16369
|
return;
|
|
16138
16370
|
}
|
|
16139
16371
|
printTable(["ID", "Name"], channels.map((c3) => [
|
|
@@ -16149,7 +16381,7 @@ function integrationsCommand() {
|
|
|
16149
16381
|
printResult({ success: true, channelId }, opts);
|
|
16150
16382
|
return;
|
|
16151
16383
|
}
|
|
16152
|
-
console.log(
|
|
16384
|
+
console.log(import_picocolors17.default.green(`Joined Slack channel ${channelId}.`));
|
|
16153
16385
|
});
|
|
16154
16386
|
cmd.command("github-collaborators").description("List GitHub repository collaborators").addArgument(new Argument("<repository-id>", "Numeric GitHub repository ID").argParser(positiveInteger)).option("--json", "Output as JSON").action(async (repositoryId, opts) => {
|
|
16155
16387
|
const cfg = requireConfig6();
|
|
@@ -16160,7 +16392,7 @@ function integrationsCommand() {
|
|
|
16160
16392
|
return;
|
|
16161
16393
|
}
|
|
16162
16394
|
if (!collaborators || collaborators.length === 0) {
|
|
16163
|
-
console.log(
|
|
16395
|
+
console.log(import_picocolors17.default.dim("No collaborators found."));
|
|
16164
16396
|
return;
|
|
16165
16397
|
}
|
|
16166
16398
|
printTable(["Username", "Name", "Email"], collaborators.map((c3) => [c3.user_name ?? "—", c3.full_name ?? "—", c3.email ?? "—"]), { rawData: collaborators });
|
|
@@ -16171,11 +16403,11 @@ function integrationsCommand() {
|
|
|
16171
16403
|
// src/commands/knowledge.ts
|
|
16172
16404
|
init_commander();
|
|
16173
16405
|
init_trpc();
|
|
16174
|
-
var
|
|
16406
|
+
var import_picocolors18 = __toESM(require_picocolors(), 1);
|
|
16175
16407
|
function requireConfig7() {
|
|
16176
16408
|
const cfg = requireLoginConfig();
|
|
16177
16409
|
if (!cfg.active_account?.target?.org_id || !cfg.active_account?.target?.space_id) {
|
|
16178
|
-
console.error(
|
|
16410
|
+
console.error(import_picocolors18.default.red("Missing org/space config. Run 'dosu setup' to reconfigure."));
|
|
16179
16411
|
process.exit(1);
|
|
16180
16412
|
}
|
|
16181
16413
|
return cfg;
|
|
@@ -16191,7 +16423,7 @@ function knowledgeCommand() {
|
|
|
16191
16423
|
});
|
|
16192
16424
|
const dataSourceIds = dataSources.map((ds) => ds.id).filter((id) => id !== null);
|
|
16193
16425
|
if (dataSourceIds.length === 0) {
|
|
16194
|
-
console.log(
|
|
16426
|
+
console.log(import_picocolors18.default.dim("No data sources connected. Add data sources in the Dosu dashboard."));
|
|
16195
16427
|
return;
|
|
16196
16428
|
}
|
|
16197
16429
|
const data = await client.search.getMentions.query({
|
|
@@ -16205,7 +16437,7 @@ function knowledgeCommand() {
|
|
|
16205
16437
|
return;
|
|
16206
16438
|
}
|
|
16207
16439
|
if (!results || results.length === 0) {
|
|
16208
|
-
console.log(
|
|
16440
|
+
console.log(import_picocolors18.default.dim("No results found."));
|
|
16209
16441
|
return;
|
|
16210
16442
|
}
|
|
16211
16443
|
const limited = results.slice(0, opts.limit);
|
|
@@ -16214,7 +16446,7 @@ function knowledgeCommand() {
|
|
|
16214
16446
|
r2.entity_type ?? "—"
|
|
16215
16447
|
]), { json: false, rawData: limited });
|
|
16216
16448
|
if (results.length > opts.limit) {
|
|
16217
|
-
console.log(
|
|
16449
|
+
console.log(import_picocolors18.default.dim(`
|
|
16218
16450
|
${results.length - opts.limit} more results not shown.`));
|
|
16219
16451
|
}
|
|
16220
16452
|
});
|
|
@@ -16227,24 +16459,287 @@ ${results.length - opts.limit} more results not shown.`));
|
|
|
16227
16459
|
return;
|
|
16228
16460
|
}
|
|
16229
16461
|
if (!store) {
|
|
16230
|
-
console.log(
|
|
16462
|
+
console.log(import_picocolors18.default.dim("No knowledge store found for this deployment."));
|
|
16231
16463
|
return;
|
|
16232
16464
|
}
|
|
16233
|
-
console.log(
|
|
16465
|
+
console.log(import_picocolors18.default.bold("Knowledge Store"));
|
|
16234
16466
|
console.log(` ID: ${store.id}`);
|
|
16235
16467
|
console.log(` Space ID: ${store.space_id}`);
|
|
16236
16468
|
});
|
|
16237
16469
|
return cmd;
|
|
16238
16470
|
}
|
|
16239
16471
|
|
|
16472
|
+
// src/commands/libraries.ts
|
|
16473
|
+
init_commander();
|
|
16474
|
+
init_trpc();
|
|
16475
|
+
var import_picocolors19 = __toESM(require_picocolors(), 1);
|
|
16476
|
+
var LIBRARY_VISIBILITIES = ["public", "internal", "private"];
|
|
16477
|
+
var CONFIG_SETTINGS = {
|
|
16478
|
+
commit_to_trigger_pr: true,
|
|
16479
|
+
default_accept_review: true,
|
|
16480
|
+
default_save_publish: true,
|
|
16481
|
+
review_timeout_days: true
|
|
16482
|
+
};
|
|
16483
|
+
var CONFIG_SETTING_NAMES = Object.keys(CONFIG_SETTINGS);
|
|
16484
|
+
function validatedDocumentationValue(setting, value) {
|
|
16485
|
+
if (setting === "review_timeout_days") {
|
|
16486
|
+
if (typeof value !== "number" || ![7, 14, 30, 90].includes(value)) {
|
|
16487
|
+
throw new InvalidArgumentError("value must be one of 7, 14, 30, or 90");
|
|
16488
|
+
}
|
|
16489
|
+
return value;
|
|
16490
|
+
}
|
|
16491
|
+
if (typeof value !== "boolean") {
|
|
16492
|
+
throw new InvalidArgumentError("value must be true or false");
|
|
16493
|
+
}
|
|
16494
|
+
return value;
|
|
16495
|
+
}
|
|
16496
|
+
function printLibrary(library, opts) {
|
|
16497
|
+
printInfo([
|
|
16498
|
+
["ID", library.id],
|
|
16499
|
+
["Name", library.name],
|
|
16500
|
+
["Visibility", library.visibility],
|
|
16501
|
+
["Created", formatDate(library.created_at)],
|
|
16502
|
+
["Updated", formatDate(library.updated_at)]
|
|
16503
|
+
], { json: opts.json, rawData: library });
|
|
16504
|
+
}
|
|
16505
|
+
function librariesCommand() {
|
|
16506
|
+
const cmd = new Command("libraries").description("Manage Dosu libraries");
|
|
16507
|
+
cmd.command("list").description("List libraries in the selected organization").option("--json", "Output as JSON").action(async (opts) => {
|
|
16508
|
+
const { cfg, orgId } = requireOrgConfig();
|
|
16509
|
+
const libraries = await createTypedClient(cfg).libraries.list.query(orgId);
|
|
16510
|
+
if (opts.json)
|
|
16511
|
+
return printResult(libraries, opts);
|
|
16512
|
+
printTable(["ID", "Name", "Visibility", "Updated"], libraries.map((library) => [
|
|
16513
|
+
library.id.slice(0, 8),
|
|
16514
|
+
library.name,
|
|
16515
|
+
library.visibility,
|
|
16516
|
+
formatDate(library.updated_at)
|
|
16517
|
+
]), { rawData: libraries });
|
|
16518
|
+
});
|
|
16519
|
+
cmd.command("info").description("Show a library").argument("<library-id>", "Library ID", uuidV4).option("--json", "Output as JSON").action(async (libraryId, opts) => {
|
|
16520
|
+
const { cfg } = requireOrgConfig();
|
|
16521
|
+
printLibrary(await createTypedClient(cfg).libraries.info.query(libraryId), opts);
|
|
16522
|
+
});
|
|
16523
|
+
cmd.command("create").description("Create a library").requiredOption("--name <name>", "Library name", boundedText(50)).addOption(new Option("--visibility <visibility>", "Library visibility").choices([
|
|
16524
|
+
...LIBRARY_VISIBILITIES
|
|
16525
|
+
])).option("--json", "Output as JSON").action(async (opts) => {
|
|
16526
|
+
const { cfg, orgId } = requireOrgConfig();
|
|
16527
|
+
const library = await createTypedClient(cfg).libraries.create.mutate({
|
|
16528
|
+
name: opts.name,
|
|
16529
|
+
org_id: orgId,
|
|
16530
|
+
visibility: opts.visibility
|
|
16531
|
+
});
|
|
16532
|
+
if (opts.json)
|
|
16533
|
+
return printResult(library, opts);
|
|
16534
|
+
console.log(import_picocolors19.default.green(`Created library '${library.name}' (${library.id}).`));
|
|
16535
|
+
});
|
|
16536
|
+
cmd.command("update").description("Update a library (requires confirmation)").argument("<library-id>", "Library ID", uuidV4).option("--name <name>", "New name", boundedText(50)).addOption(new Option("--visibility <visibility>", "New visibility").choices([...LIBRARY_VISIBILITIES])).option("--confirm", "Apply without the interactive prompt").option("--json", "Output as JSON").action(async (libraryId, opts) => {
|
|
16537
|
+
if (opts.name === undefined && opts.visibility === undefined) {
|
|
16538
|
+
throw new InvalidArgumentError("specify --name or --visibility");
|
|
16539
|
+
}
|
|
16540
|
+
if (!await confirmAction({
|
|
16541
|
+
confirmed: opts.confirm,
|
|
16542
|
+
json: opts.json,
|
|
16543
|
+
message: "Update this library?",
|
|
16544
|
+
preview: {
|
|
16545
|
+
action: "update_library",
|
|
16546
|
+
id: libraryId,
|
|
16547
|
+
name: opts.name,
|
|
16548
|
+
visibility: opts.visibility
|
|
16549
|
+
}
|
|
16550
|
+
}))
|
|
16551
|
+
return;
|
|
16552
|
+
const { cfg } = requireOrgConfig();
|
|
16553
|
+
const library = await createTypedClient(cfg).libraries.update.mutate({
|
|
16554
|
+
id: libraryId,
|
|
16555
|
+
name: opts.name,
|
|
16556
|
+
visibility: opts.visibility
|
|
16557
|
+
});
|
|
16558
|
+
if (opts.json)
|
|
16559
|
+
return printResult(library, opts);
|
|
16560
|
+
console.log(import_picocolors19.default.green(`Updated library '${library.name}'.`));
|
|
16561
|
+
});
|
|
16562
|
+
cmd.command("delete").description("Delete a library (requires confirmation)").argument("<library-id>", "Library ID", uuidV4).option("--confirm", "Apply without the interactive prompt").option("--json", "Output as JSON").action(async (libraryId, opts) => {
|
|
16563
|
+
if (!await confirmAction({
|
|
16564
|
+
confirmed: opts.confirm,
|
|
16565
|
+
json: opts.json,
|
|
16566
|
+
message: "Delete this library and its child data?",
|
|
16567
|
+
preview: { action: "delete_library", id: libraryId }
|
|
16568
|
+
}))
|
|
16569
|
+
return;
|
|
16570
|
+
const { cfg } = requireOrgConfig();
|
|
16571
|
+
const result = await createTypedClient(cfg).libraries.delete.mutate(libraryId);
|
|
16572
|
+
if (opts.json)
|
|
16573
|
+
return printResult(result, opts);
|
|
16574
|
+
console.log(import_picocolors19.default.green(`Deleted library ${libraryId}.`));
|
|
16575
|
+
});
|
|
16576
|
+
const config = cmd.command("config").description("Manage library documentation settings");
|
|
16577
|
+
config.command("get").description("Show documentation settings").argument("<library-id>", "Library ID", uuidV4).option("--json", "Output as JSON").action(async (libraryId, opts) => {
|
|
16578
|
+
const { cfg } = requireOrgConfig();
|
|
16579
|
+
const result = await createTypedClient(cfg).libraries.configGet.query(libraryId);
|
|
16580
|
+
if (opts.json)
|
|
16581
|
+
return printResult(result, opts);
|
|
16582
|
+
printResult(result.config, opts);
|
|
16583
|
+
});
|
|
16584
|
+
config.command("set").description("Set one documentation setting (requires confirmation)").argument("<library-id>", "Library ID", uuidV4).addArgument(new Argument("<setting>", "Documentation setting").choices(CONFIG_SETTING_NAMES)).requiredOption("--value <json>", "New value as JSON", jsonValue).option("--confirm", "Apply without the interactive prompt").option("--json", "Output as JSON").action(async (libraryId, setting, opts) => {
|
|
16585
|
+
const value = validatedDocumentationValue(setting, opts.value);
|
|
16586
|
+
if (!await confirmAction({
|
|
16587
|
+
confirmed: opts.confirm,
|
|
16588
|
+
json: opts.json,
|
|
16589
|
+
message: `Set documentation.${setting}?`,
|
|
16590
|
+
preview: { action: "set_library_config", id: libraryId, setting, value }
|
|
16591
|
+
}))
|
|
16592
|
+
return;
|
|
16593
|
+
const { cfg } = requireOrgConfig();
|
|
16594
|
+
const client = createTypedClient(cfg);
|
|
16595
|
+
const current = await client.libraries.configGet.query(libraryId);
|
|
16596
|
+
const result = await client.libraries.configSet.mutate({
|
|
16597
|
+
expected_updated_at: current.updated_at,
|
|
16598
|
+
setting,
|
|
16599
|
+
space_id: libraryId,
|
|
16600
|
+
value
|
|
16601
|
+
});
|
|
16602
|
+
if (opts.json)
|
|
16603
|
+
return printResult(result, opts);
|
|
16604
|
+
console.log(import_picocolors19.default.green(`Updated documentation.${setting}.`));
|
|
16605
|
+
});
|
|
16606
|
+
const sources = cmd.command("sources").description("Manage sources attached to a library");
|
|
16607
|
+
sources.command("list").description("List attached sources").argument("<library-id>", "Library ID", uuidV4).option("--json", "Output as JSON").action(async (libraryId, opts) => {
|
|
16608
|
+
const { cfg } = requireOrgConfig();
|
|
16609
|
+
const rows = await createTypedClient(cfg).libraries.sourcesList.query(libraryId);
|
|
16610
|
+
if (opts.json)
|
|
16611
|
+
return printResult(rows, opts);
|
|
16612
|
+
printTable(["ID", "Name", "Provider", "Status"], rows.map((row) => [
|
|
16613
|
+
row.data_source_id.slice(0, 8),
|
|
16614
|
+
row.name,
|
|
16615
|
+
row.provider_slug,
|
|
16616
|
+
row.status
|
|
16617
|
+
]), { rawData: rows });
|
|
16618
|
+
});
|
|
16619
|
+
for (const action of ["attach", "detach"]) {
|
|
16620
|
+
sources.command(action).description(`${action === "attach" ? "Attach" : "Detach"} sources (requires confirmation)`).argument("<library-id>", "Library ID", uuidV4).argument("<source-ids...>", "One or more data source IDs").option("--confirm", "Apply without the interactive prompt").option("--json", "Output as JSON").action(async (libraryId, sourceIds, opts) => {
|
|
16621
|
+
const uniqueIds = [...new Set(sourceIds.map(uuidV4))];
|
|
16622
|
+
if (!await confirmAction({
|
|
16623
|
+
confirmed: opts.confirm,
|
|
16624
|
+
json: opts.json,
|
|
16625
|
+
message: `${action === "attach" ? "Attach" : "Detach"} ${uniqueIds.length} source(s)?`,
|
|
16626
|
+
preview: {
|
|
16627
|
+
action: `${action}_library_sources`,
|
|
16628
|
+
id: libraryId,
|
|
16629
|
+
source_ids: uniqueIds
|
|
16630
|
+
}
|
|
16631
|
+
}))
|
|
16632
|
+
return;
|
|
16633
|
+
const { cfg } = requireOrgConfig();
|
|
16634
|
+
const client = createTypedClient(cfg);
|
|
16635
|
+
const count = await (action === "attach" ? client.libraries.sourcesAttach.mutate({
|
|
16636
|
+
space_id: libraryId,
|
|
16637
|
+
data_source_ids: uniqueIds
|
|
16638
|
+
}) : client.libraries.sourcesDetach.mutate({
|
|
16639
|
+
space_id: libraryId,
|
|
16640
|
+
data_source_ids: uniqueIds
|
|
16641
|
+
}));
|
|
16642
|
+
const result = { action, library_id: libraryId, source_ids: uniqueIds, changed: count };
|
|
16643
|
+
if (opts.json)
|
|
16644
|
+
return printResult(result, opts);
|
|
16645
|
+
console.log(import_picocolors19.default.green(`${action === "attach" ? "Attached" : "Detached"} ${count} source(s).`));
|
|
16646
|
+
});
|
|
16647
|
+
}
|
|
16648
|
+
const sourceConfig = sources.command("config").description("Manage per-library source settings");
|
|
16649
|
+
sourceConfig.command("get").description("Show source settings").argument("<library-id>", "Library ID", uuidV4).argument("<source-id>", "Data source ID", uuidV4).option("--json", "Output as JSON").action(async (libraryId, sourceId, opts) => {
|
|
16650
|
+
const { cfg } = requireOrgConfig();
|
|
16651
|
+
const result = await createTypedClient(cfg).libraries.sourceConfigGet.query({
|
|
16652
|
+
data_source_id: sourceId,
|
|
16653
|
+
space_id: libraryId
|
|
16654
|
+
});
|
|
16655
|
+
printResult(result, opts);
|
|
16656
|
+
});
|
|
16657
|
+
sourceConfig.command("update").description("Update source settings (requires confirmation)").argument("<library-id>", "Library ID", uuidV4).argument("<source-id>", "Data source ID", uuidV4).addOption(new Option("--issues <on|off>", "Read GitHub issues").argParser(onOrOff)).addOption(new Option("--pull-requests <on|off>", "Read GitHub pull requests").argParser(onOrOff)).addOption(new Option("--discussions <on|off>", "Read GitHub discussions").argParser(onOrOff)).addOption(new Option("--wiki <on|off>", "Read the GitHub wiki").argParser(onOrOff)).addOption(new Option("--include-patterns <json>", "Replace included file patterns").argParser(jsonStringArray)).addOption(new Option("--exclude-patterns <json>", "Replace excluded file patterns").argParser(jsonStringArray)).option("--confirm", "Apply without the interactive prompt").option("--json", "Output as JSON").action(async (libraryId, sourceId, opts) => {
|
|
16658
|
+
const updates = {
|
|
16659
|
+
discussions_enabled: opts.discussions,
|
|
16660
|
+
excluded_file_patterns: opts.excludePatterns,
|
|
16661
|
+
included_file_patterns: opts.includePatterns,
|
|
16662
|
+
issues_enabled: opts.issues,
|
|
16663
|
+
pull_requests_enabled: opts.pullRequests,
|
|
16664
|
+
wiki_enabled: opts.wiki
|
|
16665
|
+
};
|
|
16666
|
+
if (Object.values(updates).every((value) => value === undefined)) {
|
|
16667
|
+
throw new InvalidArgumentError("specify at least one source setting");
|
|
16668
|
+
}
|
|
16669
|
+
if (!await confirmAction({
|
|
16670
|
+
confirmed: opts.confirm,
|
|
16671
|
+
json: opts.json,
|
|
16672
|
+
message: "Update this source's library settings?",
|
|
16673
|
+
preview: {
|
|
16674
|
+
action: "update_library_source_config",
|
|
16675
|
+
id: libraryId,
|
|
16676
|
+
source_id: sourceId,
|
|
16677
|
+
...updates
|
|
16678
|
+
}
|
|
16679
|
+
}))
|
|
16680
|
+
return;
|
|
16681
|
+
const { cfg } = requireOrgConfig();
|
|
16682
|
+
const result = await createTypedClient(cfg).libraries.sourceConfigUpdate.mutate({
|
|
16683
|
+
data_source_id: sourceId,
|
|
16684
|
+
space_id: libraryId,
|
|
16685
|
+
...updates
|
|
16686
|
+
});
|
|
16687
|
+
if (opts.json)
|
|
16688
|
+
return printResult(result, opts);
|
|
16689
|
+
console.log(import_picocolors19.default.green("Updated source settings."));
|
|
16690
|
+
});
|
|
16691
|
+
const monitors = cmd.command("monitors").description("Manage source-oriented Monitor settings");
|
|
16692
|
+
monitors.command("list").description("List Monitor settings by source").argument("<library-id>", "Library ID", uuidV4).option("--json", "Output as JSON").action(async (libraryId, opts) => {
|
|
16693
|
+
const { cfg } = requireOrgConfig();
|
|
16694
|
+
const rows = await createTypedClient(cfg).libraries.monitorsList.query(libraryId);
|
|
16695
|
+
if (opts.json)
|
|
16696
|
+
return printResult(rows, opts);
|
|
16697
|
+
printTable(["Source ID", "Name", "Provider", "Monitor", "Setup"], rows.map((row) => [
|
|
16698
|
+
row.data_source_id.slice(0, 8),
|
|
16699
|
+
row.source_name,
|
|
16700
|
+
row.provider_slug,
|
|
16701
|
+
row.enabled ? "on" : "off",
|
|
16702
|
+
row.setup_required ? "web required" : "ready"
|
|
16703
|
+
]), { rawData: rows });
|
|
16704
|
+
});
|
|
16705
|
+
monitors.command("update").description("Update Monitor settings by source (requires confirmation)").argument("<library-id>", "Library ID", uuidV4).argument("<source-id>", "Data source ID", uuidV4).addOption(new Option("--enabled <on|off>", "Turn Monitor on or off").argParser(onOrOff)).addOption(new Option("--paths <json>", "Replace monitored paths").argParser(jsonStringArray)).addOption(new Option("--up-to-date-behavior <behavior>", "Behavior when docs are current").choices([
|
|
16706
|
+
"emoji",
|
|
16707
|
+
"comment",
|
|
16708
|
+
"silent"
|
|
16709
|
+
])).option("--confirm", "Apply without the interactive prompt").option("--json", "Output as JSON").action(async (libraryId, sourceId, opts) => {
|
|
16710
|
+
if (opts.enabled === undefined && opts.paths === undefined && opts.upToDateBehavior === undefined) {
|
|
16711
|
+
throw new InvalidArgumentError("specify at least one Monitor setting");
|
|
16712
|
+
}
|
|
16713
|
+
if (!await confirmAction({
|
|
16714
|
+
confirmed: opts.confirm,
|
|
16715
|
+
json: opts.json,
|
|
16716
|
+
message: "Update Monitor for this source?",
|
|
16717
|
+
preview: { action: "update_library_monitor", id: libraryId, source_id: sourceId }
|
|
16718
|
+
}))
|
|
16719
|
+
return;
|
|
16720
|
+
const { cfg } = requireOrgConfig();
|
|
16721
|
+
const result = await createTypedClient(cfg).libraries.monitorsUpdate.mutate({
|
|
16722
|
+
data_source_id: sourceId,
|
|
16723
|
+
enabled: opts.enabled,
|
|
16724
|
+
monitored_paths: opts.paths,
|
|
16725
|
+
no_update_behavior: opts.upToDateBehavior,
|
|
16726
|
+
space_id: libraryId
|
|
16727
|
+
});
|
|
16728
|
+
if (opts.json)
|
|
16729
|
+
return printResult(result, opts);
|
|
16730
|
+
console.log(import_picocolors19.default.green("Updated Monitor settings."));
|
|
16731
|
+
});
|
|
16732
|
+
return cmd;
|
|
16733
|
+
}
|
|
16734
|
+
|
|
16240
16735
|
// src/commands/members.ts
|
|
16241
16736
|
init_commander();
|
|
16242
16737
|
init_trpc();
|
|
16243
|
-
var
|
|
16738
|
+
var import_picocolors20 = __toESM(require_picocolors(), 1);
|
|
16244
16739
|
function requireConfig8() {
|
|
16245
16740
|
const cfg = requireLoginConfig();
|
|
16246
16741
|
if (!cfg.active_account?.target?.org_id) {
|
|
16247
|
-
console.error(
|
|
16742
|
+
console.error(import_picocolors20.default.red("Missing org config. Run 'dosu setup' to reconfigure."));
|
|
16248
16743
|
process.exit(1);
|
|
16249
16744
|
}
|
|
16250
16745
|
return cfg;
|
|
@@ -16264,7 +16759,7 @@ function membersCommand() {
|
|
|
16264
16759
|
printResult({ success: true, email, role }, opts);
|
|
16265
16760
|
return;
|
|
16266
16761
|
}
|
|
16267
|
-
console.log(
|
|
16762
|
+
console.log(import_picocolors20.default.green(`Invitation sent to ${email} as ${role}.`));
|
|
16268
16763
|
});
|
|
16269
16764
|
return cmd;
|
|
16270
16765
|
}
|
|
@@ -16272,7 +16767,7 @@ function membersCommand() {
|
|
|
16272
16767
|
// src/commands/org.ts
|
|
16273
16768
|
init_commander();
|
|
16274
16769
|
init_trpc();
|
|
16275
|
-
var
|
|
16770
|
+
var import_picocolors21 = __toESM(require_picocolors(), 1);
|
|
16276
16771
|
function requireConfig9() {
|
|
16277
16772
|
return requireLoginConfig();
|
|
16278
16773
|
}
|
|
@@ -16287,7 +16782,7 @@ function orgCommand() {
|
|
|
16287
16782
|
return;
|
|
16288
16783
|
}
|
|
16289
16784
|
if (!orgs || orgs.length === 0) {
|
|
16290
|
-
console.log(
|
|
16785
|
+
console.log(import_picocolors21.default.dim("No organizations found."));
|
|
16291
16786
|
return;
|
|
16292
16787
|
}
|
|
16293
16788
|
if (orgs.length === 1) {
|
|
@@ -16301,18 +16796,17 @@ function orgCommand() {
|
|
|
16301
16796
|
printTable(["ID", "Name"], orgs.map((o2) => [o2.org_id.slice(0, 8), o2.name]), { rawData: orgs });
|
|
16302
16797
|
if (cfg.active_account?.target?.org_id) {
|
|
16303
16798
|
console.log(`
|
|
16304
|
-
${
|
|
16799
|
+
${import_picocolors21.default.dim(`Current: ${cfg.active_account?.target?.org_id}`)}`);
|
|
16305
16800
|
}
|
|
16306
16801
|
});
|
|
16307
16802
|
return cmd;
|
|
16308
16803
|
}
|
|
16309
16804
|
|
|
16310
16805
|
// src/commands/review.ts
|
|
16311
|
-
init_dist8();
|
|
16312
16806
|
init_dist();
|
|
16313
16807
|
init_commander();
|
|
16314
16808
|
init_trpc();
|
|
16315
|
-
var
|
|
16809
|
+
var import_picocolors22 = __toESM(require_picocolors(), 1);
|
|
16316
16810
|
import { readFileSync as readFileSync13 } from "node:fs";
|
|
16317
16811
|
function requireConfig10() {
|
|
16318
16812
|
return requireLoginConfig();
|
|
@@ -16338,7 +16832,7 @@ async function requireChange(client, id) {
|
|
|
16338
16832
|
return await client.review.getChange.query({ id });
|
|
16339
16833
|
} catch (err) {
|
|
16340
16834
|
if (isNotFound(err) || isInvalidId(err)) {
|
|
16341
|
-
console.error(
|
|
16835
|
+
console.error(import_picocolors22.default.red(`No review item found for '${id}'. Run 'dosu review list' to see pending items.`));
|
|
16342
16836
|
process.exit(1);
|
|
16343
16837
|
}
|
|
16344
16838
|
throw err;
|
|
@@ -16347,7 +16841,7 @@ async function requireChange(client, id) {
|
|
|
16347
16841
|
async function requireDraft(client, id) {
|
|
16348
16842
|
const draft = await client.messages.getMessage.query(bareMessageId(id));
|
|
16349
16843
|
if (!draft) {
|
|
16350
|
-
console.error(
|
|
16844
|
+
console.error(import_picocolors22.default.red(`No review item found for '${id}'. Run 'dosu review list' to see pending items.`));
|
|
16351
16845
|
process.exit(1);
|
|
16352
16846
|
}
|
|
16353
16847
|
return draft;
|
|
@@ -16370,12 +16864,12 @@ function colorizeDiff(diff) {
|
|
|
16370
16864
|
return diff.split(`
|
|
16371
16865
|
`).map((line) => {
|
|
16372
16866
|
if (line.startsWith("+"))
|
|
16373
|
-
return
|
|
16867
|
+
return import_picocolors22.default.green(line);
|
|
16374
16868
|
if (line.startsWith("-"))
|
|
16375
|
-
return
|
|
16869
|
+
return import_picocolors22.default.red(line);
|
|
16376
16870
|
if (line.startsWith("@@"))
|
|
16377
|
-
return
|
|
16378
|
-
return
|
|
16871
|
+
return import_picocolors22.default.cyan(line);
|
|
16872
|
+
return import_picocolors22.default.dim(line);
|
|
16379
16873
|
}).join(`
|
|
16380
16874
|
`);
|
|
16381
16875
|
}
|
|
@@ -16389,7 +16883,7 @@ function printChangePreview(change) {
|
|
|
16389
16883
|
]
|
|
16390
16884
|
]);
|
|
16391
16885
|
if (!change.hasChanges) {
|
|
16392
|
-
console.log(
|
|
16886
|
+
console.log(import_picocolors22.default.dim("No content changes."));
|
|
16393
16887
|
return;
|
|
16394
16888
|
}
|
|
16395
16889
|
console.log();
|
|
@@ -16406,7 +16900,7 @@ function printDraftPreview(draft) {
|
|
|
16406
16900
|
async function getKnowledgeStoreId2(client, spaceId) {
|
|
16407
16901
|
const store = await client.knowledgeStore.getBySpaceId.query({ space_id: spaceId });
|
|
16408
16902
|
if (!store) {
|
|
16409
|
-
console.error(
|
|
16903
|
+
console.error(import_picocolors22.default.red("No knowledge store found for this deployment."));
|
|
16410
16904
|
process.exit(1);
|
|
16411
16905
|
}
|
|
16412
16906
|
return store.id;
|
|
@@ -16416,7 +16910,7 @@ function reviewCommand() {
|
|
|
16416
16910
|
cmd.command("list").description("List pending review items (doc changes and draft replies)").option("--json", "Output as JSON").action(async (opts) => {
|
|
16417
16911
|
const cfg = requireConfig10();
|
|
16418
16912
|
if (!cfg.active_account?.target?.space_id) {
|
|
16419
|
-
console.error(
|
|
16913
|
+
console.error(import_picocolors22.default.red("Missing space config. Run 'dosu setup' to reconfigure."));
|
|
16420
16914
|
process.exit(1);
|
|
16421
16915
|
}
|
|
16422
16916
|
const client = createTypedClient(cfg);
|
|
@@ -16431,7 +16925,7 @@ function reviewCommand() {
|
|
|
16431
16925
|
return;
|
|
16432
16926
|
}
|
|
16433
16927
|
if (!items || items.length === 0) {
|
|
16434
|
-
console.log(
|
|
16928
|
+
console.log(import_picocolors22.default.dim("No pending review items."));
|
|
16435
16929
|
return;
|
|
16436
16930
|
}
|
|
16437
16931
|
printTable(["ID", "Kind", "Title", "Source", "Status", "Created"], items.map((i2) => i2.kind === "draft_message" ? [
|
|
@@ -16450,7 +16944,7 @@ function reviewCommand() {
|
|
|
16450
16944
|
formatDate(i2.createdAt)
|
|
16451
16945
|
]), { rawData: items });
|
|
16452
16946
|
if (truncated) {
|
|
16453
|
-
console.log(
|
|
16947
|
+
console.log(import_picocolors22.default.dim(`Showing ${items.length} of ${total}+ pending items (list truncated).`));
|
|
16454
16948
|
}
|
|
16455
16949
|
});
|
|
16456
16950
|
cmd.command("diff").description("Show a pending review item (doc-change diff or draft reply body)").argument("<id>", "Review item ID (from `dosu review list`)").option("--json", "Output as JSON").action(async (id, opts) => {
|
|
@@ -16462,8 +16956,8 @@ function reviewCommand() {
|
|
|
16462
16956
|
printResult({ id, kind: "draft_message", title: draft.title, body: draft.body }, opts);
|
|
16463
16957
|
return;
|
|
16464
16958
|
}
|
|
16465
|
-
console.log(
|
|
16466
|
-
console.log(
|
|
16959
|
+
console.log(import_picocolors22.default.bold(draft.title ?? "(untitled)"));
|
|
16960
|
+
console.log(import_picocolors22.default.dim("Draft reply"));
|
|
16467
16961
|
console.log("");
|
|
16468
16962
|
console.log(draft.body ?? "");
|
|
16469
16963
|
return;
|
|
@@ -16474,8 +16968,8 @@ function reviewCommand() {
|
|
|
16474
16968
|
return;
|
|
16475
16969
|
}
|
|
16476
16970
|
const versions = change.publishedVersion != null ? `v${change.publishedVersion} → v${change.version}` : `v${change.version}`;
|
|
16477
|
-
console.log(
|
|
16478
|
-
console.log(
|
|
16971
|
+
console.log(import_picocolors22.default.bold(change.title));
|
|
16972
|
+
console.log(import_picocolors22.default.dim(`${change.source} · ${versions}`));
|
|
16479
16973
|
console.log("");
|
|
16480
16974
|
console.log(change.diff);
|
|
16481
16975
|
});
|
|
@@ -16483,7 +16977,7 @@ function reviewCommand() {
|
|
|
16483
16977
|
const cfg = requireConfig10();
|
|
16484
16978
|
const client = createTypedClient(cfg);
|
|
16485
16979
|
if (opts.body !== undefined && opts.bodyFile !== undefined) {
|
|
16486
|
-
console.error(
|
|
16980
|
+
console.error(import_picocolors22.default.red("Pass only one of --body or --body-file."));
|
|
16487
16981
|
process.exit(1);
|
|
16488
16982
|
}
|
|
16489
16983
|
let body = opts.body;
|
|
@@ -16491,21 +16985,21 @@ function reviewCommand() {
|
|
|
16491
16985
|
try {
|
|
16492
16986
|
body = readFileSync13(opts.bodyFile, "utf-8");
|
|
16493
16987
|
} catch (err) {
|
|
16494
|
-
console.error(
|
|
16988
|
+
console.error(import_picocolors22.default.red(`Failed to read --body-file: ${err.message}`));
|
|
16495
16989
|
process.exit(1);
|
|
16496
16990
|
}
|
|
16497
16991
|
}
|
|
16498
16992
|
if (body === undefined && opts.title === undefined) {
|
|
16499
|
-
console.error(
|
|
16993
|
+
console.error(import_picocolors22.default.red("Nothing to edit. Pass --title and/or --body/--body-file."));
|
|
16500
16994
|
process.exit(1);
|
|
16501
16995
|
}
|
|
16502
16996
|
if (isDraftId(id)) {
|
|
16503
16997
|
if (opts.title !== undefined) {
|
|
16504
|
-
console.error(
|
|
16998
|
+
console.error(import_picocolors22.default.red("Draft replies support --body only (no --title)."));
|
|
16505
16999
|
process.exit(1);
|
|
16506
17000
|
}
|
|
16507
17001
|
if (body === undefined) {
|
|
16508
|
-
console.error(
|
|
17002
|
+
console.error(import_picocolors22.default.red("Draft replies require --body or --body-file."));
|
|
16509
17003
|
process.exit(1);
|
|
16510
17004
|
}
|
|
16511
17005
|
await requireDraft(client, id);
|
|
@@ -16522,7 +17016,7 @@ function reviewCommand() {
|
|
|
16522
17016
|
});
|
|
16523
17017
|
} catch (err) {
|
|
16524
17018
|
if (isNotFound(err)) {
|
|
16525
|
-
console.error(
|
|
17019
|
+
console.error(import_picocolors22.default.red(`No pending review item found for '${id}'. Run 'dosu review list' to see editable items.`));
|
|
16526
17020
|
process.exit(1);
|
|
16527
17021
|
}
|
|
16528
17022
|
throw err;
|
|
@@ -16532,7 +17026,7 @@ function reviewCommand() {
|
|
|
16532
17026
|
printResult({ success: true, id }, opts);
|
|
16533
17027
|
return;
|
|
16534
17028
|
}
|
|
16535
|
-
console.log(
|
|
17029
|
+
console.log(import_picocolors22.default.green(`Review edited: ${truncateId(id)}`));
|
|
16536
17030
|
});
|
|
16537
17031
|
cmd.command("context").description("Get review context for a thread").argument("<thread-id>", "Thread ID").option("--json", "Output as JSON").action(async (threadId, opts) => {
|
|
16538
17032
|
const cfg = requireConfig10();
|
|
@@ -16572,32 +17066,19 @@ function reviewCommand() {
|
|
|
16572
17066
|
else
|
|
16573
17067
|
printDraftPreview(draft);
|
|
16574
17068
|
}
|
|
16575
|
-
|
|
16576
|
-
|
|
16577
|
-
|
|
16578
|
-
|
|
16579
|
-
|
|
16580
|
-
|
|
16581
|
-
|
|
16582
|
-
|
|
16583
|
-
|
|
16584
|
-
}
|
|
16585
|
-
|
|
16586
|
-
}
|
|
16587
|
-
if (!proceed) {
|
|
16588
|
-
if (opts.json) {
|
|
16589
|
-
const preview = change ?? {
|
|
16590
|
-
id,
|
|
16591
|
-
kind: "draft_message",
|
|
16592
|
-
title: draft?.title,
|
|
16593
|
-
body: draft?.body
|
|
16594
|
-
};
|
|
16595
|
-
printResult({ ...preview, applied: false, confirmRequired: true }, opts);
|
|
16596
|
-
} else {
|
|
16597
|
-
console.log(import_picocolors19.default.dim("Aborted. Re-run with --confirm to apply."));
|
|
16598
|
-
}
|
|
17069
|
+
const preview = change ?? {
|
|
17070
|
+
id,
|
|
17071
|
+
kind: "draft_message",
|
|
17072
|
+
title: draft?.title,
|
|
17073
|
+
body: draft?.body
|
|
17074
|
+
};
|
|
17075
|
+
if (!await confirmAction({
|
|
17076
|
+
confirmed: opts.confirm,
|
|
17077
|
+
json: opts.json,
|
|
17078
|
+
message: `${verb} this ${noun}?`,
|
|
17079
|
+
preview
|
|
17080
|
+
}))
|
|
16599
17081
|
return;
|
|
16600
|
-
}
|
|
16601
17082
|
if (change) {
|
|
16602
17083
|
await client.page.updatePublicationStatus.mutate({ page_version_id: id, action });
|
|
16603
17084
|
} else if (action === "accept") {
|
|
@@ -16609,7 +17090,7 @@ function reviewCommand() {
|
|
|
16609
17090
|
printResult({ success: true, id, action }, opts);
|
|
16610
17091
|
return;
|
|
16611
17092
|
}
|
|
16612
|
-
console.log(
|
|
17093
|
+
console.log(import_picocolors22.default.green(`Review ${name}: ${truncateId(id)}`));
|
|
16613
17094
|
});
|
|
16614
17095
|
}
|
|
16615
17096
|
cmd.command("revert").description("Reopen a previously accepted or declined doc change for review").argument("<id>", "Page version ID (not a pending item from `dosu review list`)").option("--json", "Output as JSON").action(async (id, opts) => {
|
|
@@ -16617,7 +17098,7 @@ function reviewCommand() {
|
|
|
16617
17098
|
const client = createTypedClient(cfg);
|
|
16618
17099
|
if (isDraftId(id)) {
|
|
16619
17100
|
await requireDraft(client, id);
|
|
16620
|
-
console.error(
|
|
17101
|
+
console.error(import_picocolors22.default.red("Revert is not supported for draft replies. A rejected draft is regenerated on the next agent run."));
|
|
16621
17102
|
process.exit(1);
|
|
16622
17103
|
}
|
|
16623
17104
|
await requireChange(client, id);
|
|
@@ -16629,7 +17110,7 @@ function reviewCommand() {
|
|
|
16629
17110
|
printResult({ success: true, id, action: "revert_to_pending" }, opts);
|
|
16630
17111
|
return;
|
|
16631
17112
|
}
|
|
16632
|
-
console.log(
|
|
17113
|
+
console.log(import_picocolors22.default.green(`Review revert: ${truncateId(id)}`));
|
|
16633
17114
|
});
|
|
16634
17115
|
return cmd;
|
|
16635
17116
|
}
|
|
@@ -16640,11 +17121,11 @@ init_skill();
|
|
|
16640
17121
|
// src/commands/sources.ts
|
|
16641
17122
|
init_commander();
|
|
16642
17123
|
init_trpc();
|
|
16643
|
-
var
|
|
17124
|
+
var import_picocolors23 = __toESM(require_picocolors(), 1);
|
|
16644
17125
|
function requireConfig11() {
|
|
16645
17126
|
const cfg = requireLoginConfig();
|
|
16646
17127
|
if (!cfg.active_account?.target?.org_id) {
|
|
16647
|
-
console.error(
|
|
17128
|
+
console.error(import_picocolors23.default.red("Missing org config. Run 'dosu setup' to reconfigure."));
|
|
16648
17129
|
process.exit(1);
|
|
16649
17130
|
}
|
|
16650
17131
|
return cfg;
|
|
@@ -16664,7 +17145,7 @@ function sourcesCommand() {
|
|
|
16664
17145
|
}
|
|
16665
17146
|
const list = dataSources ?? [];
|
|
16666
17147
|
if (list.length === 0) {
|
|
16667
|
-
console.log(
|
|
17148
|
+
console.log(import_picocolors23.default.dim("No data sources connected."));
|
|
16668
17149
|
return;
|
|
16669
17150
|
}
|
|
16670
17151
|
printTable(["ID", "Name", "Provider", "Created"], list.map((ds) => [
|
|
@@ -16683,7 +17164,7 @@ function sourcesCommand() {
|
|
|
16683
17164
|
return;
|
|
16684
17165
|
}
|
|
16685
17166
|
if (!ds) {
|
|
16686
|
-
console.log(
|
|
17167
|
+
console.log(import_picocolors23.default.dim("Data source not found."));
|
|
16687
17168
|
return;
|
|
16688
17169
|
}
|
|
16689
17170
|
printInfo([
|
|
@@ -16702,7 +17183,7 @@ function sourcesCommand() {
|
|
|
16702
17183
|
printResult({ success: true, id }, opts);
|
|
16703
17184
|
return;
|
|
16704
17185
|
}
|
|
16705
|
-
console.log(
|
|
17186
|
+
console.log(import_picocolors23.default.green(`Data source sync triggered for ${id.slice(0, 8)}.`));
|
|
16706
17187
|
});
|
|
16707
17188
|
cmd.command("update").description("Update a data source").argument("<id>", "Data source ID").option("--name <name>", "New name").option("--description <desc>", "New description").option("--json", "Output as JSON").action(async (id, opts) => {
|
|
16708
17189
|
if (opts.name === undefined && opts.description === undefined) {
|
|
@@ -16719,7 +17200,7 @@ function sourcesCommand() {
|
|
|
16719
17200
|
printResult(result, opts);
|
|
16720
17201
|
return;
|
|
16721
17202
|
}
|
|
16722
|
-
console.log(
|
|
17203
|
+
console.log(import_picocolors23.default.green("Data source updated."));
|
|
16723
17204
|
});
|
|
16724
17205
|
cmd.command("delete").description("Delete a data source").argument("<id>", "Data source ID").option("--json", "Output as JSON").action(async (id, opts) => {
|
|
16725
17206
|
const cfg = requireConfig11();
|
|
@@ -16729,14 +17210,14 @@ function sourcesCommand() {
|
|
|
16729
17210
|
printResult({ success: true, id }, opts);
|
|
16730
17211
|
return;
|
|
16731
17212
|
}
|
|
16732
|
-
console.log(
|
|
17213
|
+
console.log(import_picocolors23.default.green("Data source deleted."));
|
|
16733
17214
|
});
|
|
16734
17215
|
return cmd;
|
|
16735
17216
|
}
|
|
16736
17217
|
|
|
16737
17218
|
// src/commands/suggest.ts
|
|
16738
17219
|
init_commander();
|
|
16739
|
-
var
|
|
17220
|
+
var import_picocolors24 = __toESM(require_picocolors(), 1);
|
|
16740
17221
|
|
|
16741
17222
|
// src/client/supabase.ts
|
|
16742
17223
|
async function listSpaceDataSourceIds(config, spaceId) {
|
|
@@ -16770,7 +17251,7 @@ init_trpc();
|
|
|
16770
17251
|
function requireConfig12() {
|
|
16771
17252
|
const cfg = requireLoginConfig();
|
|
16772
17253
|
if (!cfg.active_account?.target?.space_id) {
|
|
16773
|
-
console.error(
|
|
17254
|
+
console.error(import_picocolors24.default.red("Missing space config. Run 'dosu setup' to reconfigure."));
|
|
16774
17255
|
process.exit(1);
|
|
16775
17256
|
}
|
|
16776
17257
|
return cfg;
|
|
@@ -16780,7 +17261,7 @@ async function getKnowledgeStoreId3(client, spaceId) {
|
|
|
16780
17261
|
space_id: spaceId
|
|
16781
17262
|
});
|
|
16782
17263
|
if (!store) {
|
|
16783
|
-
console.error(
|
|
17264
|
+
console.error(import_picocolors24.default.red("No knowledge store found for this deployment."));
|
|
16784
17265
|
process.exit(1);
|
|
16785
17266
|
}
|
|
16786
17267
|
return store.id;
|
|
@@ -16799,7 +17280,7 @@ function suggestCommand() {
|
|
|
16799
17280
|
return;
|
|
16800
17281
|
}
|
|
16801
17282
|
if (!suggestions || suggestions.length === 0) {
|
|
16802
|
-
console.log(
|
|
17283
|
+
console.log(import_picocolors24.default.dim("No pending suggestions."));
|
|
16803
17284
|
return;
|
|
16804
17285
|
}
|
|
16805
17286
|
printTable(["ID", "Title"], suggestions.map((s) => [
|
|
@@ -16823,7 +17304,7 @@ function suggestCommand() {
|
|
|
16823
17304
|
printResult(result, opts);
|
|
16824
17305
|
return;
|
|
16825
17306
|
}
|
|
16826
|
-
console.log(
|
|
17307
|
+
console.log(import_picocolors24.default.green("Document suggestions are being generated."));
|
|
16827
17308
|
});
|
|
16828
17309
|
cmd.command("reject").description("Reject a suggestion").argument("<id>", "Suggestion ID").option("--json", "Output as JSON").action(async (id, opts) => {
|
|
16829
17310
|
const cfg = requireConfig12();
|
|
@@ -16833,7 +17314,7 @@ function suggestCommand() {
|
|
|
16833
17314
|
printResult({ success: true, id }, opts);
|
|
16834
17315
|
return;
|
|
16835
17316
|
}
|
|
16836
|
-
console.log(
|
|
17317
|
+
console.log(import_picocolors24.default.green("Suggestion rejected."));
|
|
16837
17318
|
});
|
|
16838
17319
|
return cmd;
|
|
16839
17320
|
}
|
|
@@ -16906,11 +17387,11 @@ function telemetryCommand() {
|
|
|
16906
17387
|
// src/commands/threads.ts
|
|
16907
17388
|
init_commander();
|
|
16908
17389
|
init_trpc();
|
|
16909
|
-
var
|
|
17390
|
+
var import_picocolors25 = __toESM(require_picocolors(), 1);
|
|
16910
17391
|
function requireConfig13() {
|
|
16911
17392
|
const cfg = requireLoginConfig();
|
|
16912
17393
|
if (!cfg.active_account?.target?.space_id) {
|
|
16913
|
-
console.error(
|
|
17394
|
+
console.error(import_picocolors25.default.red("Missing space config. Run 'dosu setup' to reconfigure."));
|
|
16914
17395
|
process.exit(1);
|
|
16915
17396
|
}
|
|
16916
17397
|
return cfg;
|
|
@@ -16961,7 +17442,7 @@ function threadsCommand() {
|
|
|
16961
17442
|
return;
|
|
16962
17443
|
}
|
|
16963
17444
|
if (!threads || threads.length === 0) {
|
|
16964
|
-
console.log(
|
|
17445
|
+
console.log(import_picocolors25.default.dim("No threads found."));
|
|
16965
17446
|
return;
|
|
16966
17447
|
}
|
|
16967
17448
|
printTable(["ID", "Title", "Status", "Created"], threads.map((t2) => [
|
|
@@ -16986,10 +17467,10 @@ function threadsCommand() {
|
|
|
16986
17467
|
return;
|
|
16987
17468
|
}
|
|
16988
17469
|
if (!thread) {
|
|
16989
|
-
console.log(
|
|
17470
|
+
console.log(import_picocolors25.default.dim("Thread not found."));
|
|
16990
17471
|
return;
|
|
16991
17472
|
}
|
|
16992
|
-
console.log(
|
|
17473
|
+
console.log(import_picocolors25.default.bold(thread.generated_title ?? "(untitled thread)"));
|
|
16993
17474
|
printInfo([
|
|
16994
17475
|
["ID", thread.id],
|
|
16995
17476
|
["Created", formatDate(thread.created_at)],
|
|
@@ -17000,13 +17481,13 @@ function threadsCommand() {
|
|
|
17000
17481
|
if (messages && messages.length > 0) {
|
|
17001
17482
|
const allMessages = messages.flatMap((group) => group.messages);
|
|
17002
17483
|
console.log(`
|
|
17003
|
-
${
|
|
17004
|
-
console.log(
|
|
17484
|
+
${import_picocolors25.default.bold("Messages")} (${allMessages.length})`);
|
|
17485
|
+
console.log(import_picocolors25.default.dim("─".repeat(60)));
|
|
17005
17486
|
for (const msg of allMessages) {
|
|
17006
17487
|
const role = msg.author_role ?? "unknown";
|
|
17007
17488
|
const date = formatDate(msg.created_at);
|
|
17008
17489
|
console.log(`
|
|
17009
|
-
${
|
|
17490
|
+
${import_picocolors25.default.bold(role)} ${import_picocolors25.default.dim(date)}`);
|
|
17010
17491
|
if (msg.body) {
|
|
17011
17492
|
console.log(truncate(msg.body, 500));
|
|
17012
17493
|
}
|
|
@@ -17021,7 +17502,7 @@ ${import_picocolors22.default.bold(role)} ${import_picocolors22.default.dim(date
|
|
|
17021
17502
|
printResult({ success: true, id }, opts);
|
|
17022
17503
|
return;
|
|
17023
17504
|
}
|
|
17024
|
-
console.log(
|
|
17505
|
+
console.log(import_picocolors25.default.green(`Thread ${id.slice(0, 8)} archived.`));
|
|
17025
17506
|
});
|
|
17026
17507
|
return cmd;
|
|
17027
17508
|
}
|
|
@@ -17029,11 +17510,11 @@ ${import_picocolors22.default.bold(role)} ${import_picocolors22.default.dim(date
|
|
|
17029
17510
|
// src/commands/topics.ts
|
|
17030
17511
|
init_commander();
|
|
17031
17512
|
init_trpc();
|
|
17032
|
-
var
|
|
17513
|
+
var import_picocolors26 = __toESM(require_picocolors(), 1);
|
|
17033
17514
|
function requireConfig14() {
|
|
17034
17515
|
const cfg = requireLoginConfig();
|
|
17035
17516
|
if (!cfg.active_account?.target?.space_id) {
|
|
17036
|
-
console.error(
|
|
17517
|
+
console.error(import_picocolors26.default.red("Missing space config. Run 'dosu setup' to reconfigure."));
|
|
17037
17518
|
process.exit(1);
|
|
17038
17519
|
}
|
|
17039
17520
|
return cfg;
|
|
@@ -17043,7 +17524,7 @@ async function getKnowledgeStoreId4(client, spaceId) {
|
|
|
17043
17524
|
space_id: spaceId
|
|
17044
17525
|
});
|
|
17045
17526
|
if (!store) {
|
|
17046
|
-
console.error(
|
|
17527
|
+
console.error(import_picocolors26.default.red("No knowledge store found for this deployment."));
|
|
17047
17528
|
process.exit(1);
|
|
17048
17529
|
}
|
|
17049
17530
|
return store.id;
|
|
@@ -17062,7 +17543,7 @@ function topicsCommand() {
|
|
|
17062
17543
|
return;
|
|
17063
17544
|
}
|
|
17064
17545
|
if (!topics || topics.length === 0) {
|
|
17065
|
-
console.log(
|
|
17546
|
+
console.log(import_picocolors26.default.dim("No topics found."));
|
|
17066
17547
|
return;
|
|
17067
17548
|
}
|
|
17068
17549
|
printTable(["ID", "Name", "Description"], topics.map((t2) => [
|
|
@@ -17087,7 +17568,7 @@ function topicsCommand() {
|
|
|
17087
17568
|
return;
|
|
17088
17569
|
}
|
|
17089
17570
|
if (!pages || pages.length === 0) {
|
|
17090
|
-
console.log(
|
|
17571
|
+
console.log(import_picocolors26.default.dim("No pages found with this topic."));
|
|
17091
17572
|
return;
|
|
17092
17573
|
}
|
|
17093
17574
|
printTable(["ID", "Title"], pages.map((p2) => [
|
|
@@ -17101,7 +17582,7 @@ function topicsCommand() {
|
|
|
17101
17582
|
// src/commands/upgrade.ts
|
|
17102
17583
|
init_commander();
|
|
17103
17584
|
init_skill();
|
|
17104
|
-
var
|
|
17585
|
+
var import_picocolors27 = __toESM(require_picocolors(), 1);
|
|
17105
17586
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
17106
17587
|
import { realpathSync } from "node:fs";
|
|
17107
17588
|
import { homedir as homedir6 } from "node:os";
|
|
@@ -17270,7 +17751,7 @@ Could not update Dosu automatically.`);
|
|
|
17270
17751
|
${plan.manualCommand}`);
|
|
17271
17752
|
return result.status && result.status > 0 ? result.status : 1;
|
|
17272
17753
|
}
|
|
17273
|
-
console.log(
|
|
17754
|
+
console.log(import_picocolors27.default.green(`
|
|
17274
17755
|
✓ Update command completed.`));
|
|
17275
17756
|
console.log('Run "dosu --version" to verify.');
|
|
17276
17757
|
return 0;
|
|
@@ -17283,7 +17764,7 @@ async function completeUpgrade(channel = INSTALL_CHANNEL, options = {}) {
|
|
|
17283
17764
|
try {
|
|
17284
17765
|
const result = await installSkill();
|
|
17285
17766
|
if (result.success) {
|
|
17286
|
-
console.log(
|
|
17767
|
+
console.log(import_picocolors27.default.green("✓ Skills updated."));
|
|
17287
17768
|
} else {
|
|
17288
17769
|
console.error('Skills could not be refreshed. Run "dosu skill update" to retry.');
|
|
17289
17770
|
}
|
|
@@ -17312,7 +17793,7 @@ init_skill_update_check();
|
|
|
17312
17793
|
// src/version/update-check.ts
|
|
17313
17794
|
init_config();
|
|
17314
17795
|
init_logger();
|
|
17315
|
-
var
|
|
17796
|
+
var import_picocolors28 = __toESM(require_picocolors(), 1);
|
|
17316
17797
|
import { existsSync as existsSync17, mkdirSync as mkdirSync10, readFileSync as readFileSync14, writeFileSync as writeFileSync11 } from "node:fs";
|
|
17317
17798
|
import { join as join28 } from "node:path";
|
|
17318
17799
|
var CACHE_FILENAME3 = "update-check.json";
|
|
@@ -17405,7 +17886,7 @@ function buildUpdateNotice(current, latest, channel, interactive, npx = false) {
|
|
|
17405
17886
|
`└${horizontal}┘`
|
|
17406
17887
|
];
|
|
17407
17888
|
return `
|
|
17408
|
-
${frameLines.map((line) =>
|
|
17889
|
+
${frameLines.map((line) => import_picocolors28.default.yellow(line)).join(`
|
|
17409
17890
|
`)}
|
|
17410
17891
|
`;
|
|
17411
17892
|
}
|
|
@@ -17820,6 +18301,7 @@ Start ${provider.name()} in this project directory to use the Dosu MCP.`);
|
|
|
17820
18301
|
console.log(`
|
|
17821
18302
|
Use 'dosu mcp add <agent>' to add Dosu MCP to a tool.`);
|
|
17822
18303
|
});
|
|
18304
|
+
program2.addCommand(agentsCommand());
|
|
17823
18305
|
program2.addCommand(analyticsCommand());
|
|
17824
18306
|
program2.addCommand(askCommand());
|
|
17825
18307
|
program2.addCommand(auditCommand());
|
|
@@ -17828,6 +18310,7 @@ Use 'dosu mcp add <agent>' to add Dosu MCP to a tool.`);
|
|
|
17828
18310
|
program2.addCommand(insightsCommand());
|
|
17829
18311
|
program2.addCommand(integrationsCommand());
|
|
17830
18312
|
program2.addCommand(knowledgeCommand());
|
|
18313
|
+
program2.addCommand(librariesCommand());
|
|
17831
18314
|
program2.addCommand(membersCommand());
|
|
17832
18315
|
program2.addCommand(orgCommand());
|
|
17833
18316
|
program2.addCommand(reviewCommand());
|
|
@@ -17953,4 +18436,4 @@ execute().catch((err) => {
|
|
|
17953
18436
|
process.exit(1);
|
|
17954
18437
|
});
|
|
17955
18438
|
|
|
17956
|
-
//# debugId=
|
|
18439
|
+
//# debugId=9d873764-f667-b08c-6475-6e2164756e21
|