@dosu/cli 0.17.0 → 0.18.1
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 +29 -6
- package/package.json +1 -1
package/bin/dosu.js
CHANGED
|
@@ -2083,7 +2083,7 @@ var init_esm = __esm(() => {
|
|
|
2083
2083
|
});
|
|
2084
2084
|
|
|
2085
2085
|
// src/config/config.ts
|
|
2086
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2086
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
2087
2087
|
import { join } from "node:path";
|
|
2088
2088
|
function getConfigDir() {
|
|
2089
2089
|
const dirName = process.env.DOSU_DEV === "true" ? "dosu-cli-dev" : "dosu-cli";
|
|
@@ -2118,7 +2118,9 @@ function saveConfig(cfg) {
|
|
|
2118
2118
|
if (!existsSync(dir)) {
|
|
2119
2119
|
mkdirSync(dir, { recursive: true, mode: 448 });
|
|
2120
2120
|
}
|
|
2121
|
-
|
|
2121
|
+
const tmp = `${path}.${process.pid}.tmp`;
|
|
2122
|
+
writeFileSync(tmp, JSON.stringify(cfg, null, 2), { mode: 384 });
|
|
2123
|
+
renameSync(tmp, path);
|
|
2122
2124
|
}
|
|
2123
2125
|
function isAuthenticated(cfg) {
|
|
2124
2126
|
return cfg.access_token !== "";
|
|
@@ -2247,9 +2249,30 @@ class Client {
|
|
|
2247
2249
|
}
|
|
2248
2250
|
}
|
|
2249
2251
|
async refreshToken() {
|
|
2252
|
+
this.adoptNewerDiskTokens();
|
|
2250
2253
|
if (!this.config.refresh_token) {
|
|
2251
2254
|
throw new Error("no refresh token available");
|
|
2252
2255
|
}
|
|
2256
|
+
try {
|
|
2257
|
+
await this.refreshTokenOnce();
|
|
2258
|
+
} catch (err) {
|
|
2259
|
+
if (!this.adoptNewerDiskTokens()) {
|
|
2260
|
+
throw err;
|
|
2261
|
+
}
|
|
2262
|
+
await this.refreshTokenOnce();
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2265
|
+
adoptNewerDiskTokens() {
|
|
2266
|
+
const disk = loadConfig();
|
|
2267
|
+
if (!disk.refresh_token || disk.refresh_token === this.config.refresh_token) {
|
|
2268
|
+
return false;
|
|
2269
|
+
}
|
|
2270
|
+
this.config.access_token = disk.access_token;
|
|
2271
|
+
this.config.refresh_token = disk.refresh_token;
|
|
2272
|
+
this.config.expires_at = disk.expires_at;
|
|
2273
|
+
return true;
|
|
2274
|
+
}
|
|
2275
|
+
async refreshTokenOnce() {
|
|
2253
2276
|
const supabaseURL = getSupabaseURL();
|
|
2254
2277
|
const endpoint = `${supabaseURL}/auth/v1/token?grant_type=refresh_token`;
|
|
2255
2278
|
const resp = await fetch(endpoint, {
|
|
@@ -4525,7 +4548,7 @@ var init_dist4 = __esm(() => {
|
|
|
4525
4548
|
function getVersionString() {
|
|
4526
4549
|
return `v${VERSION}`;
|
|
4527
4550
|
}
|
|
4528
|
-
var VERSION = "0.
|
|
4551
|
+
var VERSION = "0.18.1";
|
|
4529
4552
|
|
|
4530
4553
|
// src/debug/logger.ts
|
|
4531
4554
|
import {
|
|
@@ -5491,8 +5514,8 @@ function buildReadyEnvelope(context, saveRecommended = false) {
|
|
|
5491
5514
|
"How to use this:",
|
|
5492
5515
|
"- Use it quietly to answer faster and with fewer broad searches. Keep working normally.",
|
|
5493
5516
|
"- This is the known likely path, not the full boundary. Before finalizing, verify adjacent " + "public/API entrypoints and edge cases that this route map may not cover.",
|
|
5494
|
-
"- Attribution:
|
|
5495
|
-
"-
|
|
5517
|
+
"- Attribution: this context is your team's existing knowledge (docs, past PRs, discussions) " + "surfaced by Dosu — not the live code you're reading. For each main finding it speaks to, " + "add one brief cited note on how the team's knowledge relates: if it agrees, note it in a " + "line and cite the source; if it differs, flag it as worth confirming and reconcile before " + "finalizing; if it adds something the code alone wouldn't tell you (a rationale, a gotcha, " + "a past decision), surface it, cited.",
|
|
5518
|
+
"- Surface this at each main finding the context speaks to — but skip the ones it is " + "genuinely silent on, and never invent agreement or disagreement. Keep each note brief and " + 'next to the finding; do not open with "Dosu told me…", do not add a closing praise ' + "paragraph, and do not reference any ticket or lookup id."
|
|
5496
5519
|
].join(`
|
|
5497
5520
|
`));
|
|
5498
5521
|
}
|
|
@@ -5505,7 +5528,7 @@ function buildReadyEnvelope(context, saveRecommended = false) {
|
|
|
5505
5528
|
}
|
|
5506
5529
|
var LOOKUP_STARTED_NOTE, STOP_PREFIX, SAVE_NUDGE;
|
|
5507
5530
|
var init_prompts = __esm(() => {
|
|
5508
|
-
LOOKUP_STARTED_NOTE = "Dosu started a background knowledge lookup for this request. Keep working normally — " + "do not wait or pause for it. If Dosu context arrives during this session, fold it in " + "quietly to work faster and avoid wrong assumptions. Mention Dosu
|
|
5531
|
+
LOOKUP_STARTED_NOTE = "Dosu started a background knowledge lookup for this request. Keep working normally — " + "do not wait or pause for it. If Dosu context arrives during this session, fold it in " + "quietly to work faster and avoid wrong assumptions. Mention Dosu when its context " + "helps you.";
|
|
5509
5532
|
STOP_PREFIX = "Dosu knowledge finished after your last action. Re-check your current conclusion against " + "it, then continue or finish — do not redo work it merely confirms.";
|
|
5510
5533
|
SAVE_NUDGE = "Dosu has little or no existing knowledge on this topic. If you uncover something durable — " + "a non-obvious mechanism, a gotcha, or a route through the code — save it with the Dosu " + "`save_topic` tool when you finish, so future sessions start ahead. Only save genuinely " + "reusable knowledge; skip trivial or one-off details.";
|
|
5511
5534
|
});
|