pinsay-cli 0.6.7 → 0.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +19 -9
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -14,8 +14,8 @@ var BUILD_DEFAULT_SERVER, BUILD_CLI_VERSION;
|
|
|
14
14
|
var init_build_constants = __esm({
|
|
15
15
|
"src/build-constants.ts"() {
|
|
16
16
|
"use strict";
|
|
17
|
-
BUILD_DEFAULT_SERVER = true ? "https://
|
|
18
|
-
BUILD_CLI_VERSION = true ? "0.6.
|
|
17
|
+
BUILD_DEFAULT_SERVER = true ? "https://app.pinsay.dev" : "https://app.pinsay.dev";
|
|
18
|
+
BUILD_CLI_VERSION = true ? "0.6.8" : "0.0.0-dev";
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
|
|
@@ -89,10 +89,18 @@ async function findRepoRoot(cwd2) {
|
|
|
89
89
|
dir = parent;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
+
function canonicalServer(server) {
|
|
93
|
+
if (!server)
|
|
94
|
+
return server;
|
|
95
|
+
return server.replace(/\/+$/, "") === LEGACY_SERVER ? CANONICAL_SERVER : server;
|
|
96
|
+
}
|
|
92
97
|
async function readConfig(cwd2) {
|
|
93
98
|
try {
|
|
94
99
|
const content = await fs.readFile(join(cwd2, CONFIG_FILE), "utf8");
|
|
95
|
-
|
|
100
|
+
const config = JSON.parse(content);
|
|
101
|
+
if (config.server)
|
|
102
|
+
config.server = canonicalServer(config.server);
|
|
103
|
+
return config;
|
|
96
104
|
} catch (err) {
|
|
97
105
|
if (err.code !== "ENOENT")
|
|
98
106
|
throw err;
|
|
@@ -180,12 +188,14 @@ async function upsertGitignore(cwd2, productName = "Feedback tool", skillsDir) {
|
|
|
180
188
|
await fs.writeFile(file, content, "utf8");
|
|
181
189
|
}
|
|
182
190
|
}
|
|
183
|
-
var CONFIG_FILE, CREDENTIALS_FILE, IGNORED_SKILL_DIRS, LEGACY_REPO_FILES;
|
|
191
|
+
var CONFIG_FILE, CREDENTIALS_FILE, LEGACY_SERVER, CANONICAL_SERVER, IGNORED_SKILL_DIRS, LEGACY_REPO_FILES;
|
|
184
192
|
var init_config = __esm({
|
|
185
193
|
"src/config.ts"() {
|
|
186
194
|
"use strict";
|
|
187
195
|
CONFIG_FILE = ".pinsay/config.json";
|
|
188
196
|
CREDENTIALS_FILE = ".pinsay/credentials.env";
|
|
197
|
+
LEGACY_SERVER = "https://api.pinsay.dev";
|
|
198
|
+
CANONICAL_SERVER = "https://app.pinsay.dev";
|
|
189
199
|
IGNORED_SKILL_DIRS = [
|
|
190
200
|
".claude/skills/pinsay-init/",
|
|
191
201
|
".claude/skills/pinsay-feedback/",
|
|
@@ -3356,7 +3366,7 @@ async function initCommand(cwd2, options = {}) {
|
|
|
3356
3366
|
const configIsMulti = isMultiProject(config);
|
|
3357
3367
|
const isJoin = !isAddProject && Boolean(config.server) && (Boolean(config.project) || configIsMulti);
|
|
3358
3368
|
const mode = isJoin ? "join" : "install";
|
|
3359
|
-
let server = options["server"] || config.server || process.env.PINSAY_SERVER || BUILD_DEFAULT_SERVER;
|
|
3369
|
+
let server = options["server"] || config.server || canonicalServer(process.env.PINSAY_SERVER) || BUILD_DEFAULT_SERVER;
|
|
3360
3370
|
if (!isYes && !options["server"] && !config.server) {
|
|
3361
3371
|
server = await ask("Server URL", { default: server });
|
|
3362
3372
|
}
|
|
@@ -12198,7 +12208,7 @@ async function runMcpServer(ctx, logFile) {
|
|
|
12198
12208
|
async function mcpCommand(cwd2, parsed = {}) {
|
|
12199
12209
|
const root = await findRepoRoot(cwd2);
|
|
12200
12210
|
const config = await readConfig(root).catch(() => ({}));
|
|
12201
|
-
const server = ((typeof parsed["server"] === "string" ? parsed["server"] : config.server) || process.env.PINSAY_SERVER || BUILD_DEFAULT_SERVER).replace(/\/$/, "");
|
|
12211
|
+
const server = ((typeof parsed["server"] === "string" ? parsed["server"] : config.server) || canonicalServer(process.env.PINSAY_SERVER) || BUILD_DEFAULT_SERVER).replace(/\/$/, "");
|
|
12202
12212
|
const projectFlag = typeof parsed["project"] === "string" ? parsed["project"] : void 0;
|
|
12203
12213
|
const project = projectFlag || config.project || process.env.PINSAY_PROJECT || "";
|
|
12204
12214
|
const explicitKey = typeof parsed["key"] === "string" ? parsed["key"] : void 0;
|
|
@@ -12239,7 +12249,7 @@ init_build_constants();
|
|
|
12239
12249
|
async function loginCommand(cwd2, options = {}) {
|
|
12240
12250
|
const root = await findRepoRoot(cwd2);
|
|
12241
12251
|
const config = await readConfig(root).catch(() => ({}));
|
|
12242
|
-
const server = ((typeof options["server"] === "string" ? options["server"] : void 0) || config.server || process.env.PINSAY_SERVER || BUILD_DEFAULT_SERVER).replace(/\/$/, "");
|
|
12252
|
+
const server = ((typeof options["server"] === "string" ? options["server"] : void 0) || config.server || canonicalServer(process.env.PINSAY_SERVER) || BUILD_DEFAULT_SERVER).replace(/\/$/, "");
|
|
12243
12253
|
const branding = await getBranding(server);
|
|
12244
12254
|
const product = branding.productName;
|
|
12245
12255
|
const flagKey = typeof options["key"] === "string" ? options["key"] : void 0;
|
|
@@ -12297,7 +12307,7 @@ init_build_constants();
|
|
|
12297
12307
|
async function logoutCommand(cwd2, options = {}) {
|
|
12298
12308
|
const root = await findRepoRoot(cwd2);
|
|
12299
12309
|
const config = await readConfig(root).catch(() => ({}));
|
|
12300
|
-
const server = ((typeof options["server"] === "string" ? options["server"] : void 0) || config.server || process.env.PINSAY_SERVER || BUILD_DEFAULT_SERVER).replace(/\/$/, "");
|
|
12310
|
+
const server = ((typeof options["server"] === "string" ? options["server"] : void 0) || config.server || canonicalServer(process.env.PINSAY_SERVER) || BUILD_DEFAULT_SERVER).replace(/\/$/, "");
|
|
12301
12311
|
const origin = normalizeServerOrigin(server);
|
|
12302
12312
|
const removed = await removeGlobalCredential(server);
|
|
12303
12313
|
if (options["json"] === true) {
|
|
@@ -12318,7 +12328,7 @@ init_build_constants();
|
|
|
12318
12328
|
async function whoamiCommand(cwd2, options = {}) {
|
|
12319
12329
|
const root = await findRepoRoot(cwd2);
|
|
12320
12330
|
const config = await readConfig(root).catch(() => ({}));
|
|
12321
|
-
const server = ((typeof options["server"] === "string" ? options["server"] : void 0) || config.server || process.env.PINSAY_SERVER || BUILD_DEFAULT_SERVER).replace(/\/$/, "");
|
|
12331
|
+
const server = ((typeof options["server"] === "string" ? options["server"] : void 0) || config.server || canonicalServer(process.env.PINSAY_SERVER) || BUILD_DEFAULT_SERVER).replace(/\/$/, "");
|
|
12322
12332
|
const isJson = options["json"] === true;
|
|
12323
12333
|
const { key, source } = await resolveApiKey(root, server);
|
|
12324
12334
|
if (!key) {
|
package/package.json
CHANGED