pinsay-cli 0.6.7 → 0.6.9

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.
Files changed (2) hide show
  1. package/dist/cli.js +23 -10
  2. 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://api.pinsay.dev" : "https://api.pinsay.dev";
18
- BUILD_CLI_VERSION = true ? "0.6.7" : "0.0.0-dev";
17
+ BUILD_DEFAULT_SERVER = true ? "https://app.pinsay.dev" : "https://app.pinsay.dev";
18
+ BUILD_CLI_VERSION = true ? "0.6.9" : "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
- return JSON.parse(content);
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/",
@@ -309,7 +319,10 @@ async function writeGlobalStore(store) {
309
319
  }
310
320
  async function getGlobalCredential(server) {
311
321
  const store = await readGlobalStore();
312
- return store[normalizeServerOrigin(server)];
322
+ const origin = normalizeServerOrigin(server);
323
+ if (!store[origin] && origin === "https://app.pinsay.dev")
324
+ return store["https://api.pinsay.dev"];
325
+ return store[origin];
313
326
  }
314
327
  async function saveGlobalCredential(server, entry) {
315
328
  const store = await readGlobalStore();
@@ -3356,7 +3369,7 @@ async function initCommand(cwd2, options = {}) {
3356
3369
  const configIsMulti = isMultiProject(config);
3357
3370
  const isJoin = !isAddProject && Boolean(config.server) && (Boolean(config.project) || configIsMulti);
3358
3371
  const mode = isJoin ? "join" : "install";
3359
- let server = options["server"] || config.server || process.env.PINSAY_SERVER || BUILD_DEFAULT_SERVER;
3372
+ let server = options["server"] || config.server || canonicalServer(process.env.PINSAY_SERVER) || BUILD_DEFAULT_SERVER;
3360
3373
  if (!isYes && !options["server"] && !config.server) {
3361
3374
  server = await ask("Server URL", { default: server });
3362
3375
  }
@@ -12198,7 +12211,7 @@ async function runMcpServer(ctx, logFile) {
12198
12211
  async function mcpCommand(cwd2, parsed = {}) {
12199
12212
  const root = await findRepoRoot(cwd2);
12200
12213
  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(/\/$/, "");
12214
+ const server = ((typeof parsed["server"] === "string" ? parsed["server"] : config.server) || canonicalServer(process.env.PINSAY_SERVER) || BUILD_DEFAULT_SERVER).replace(/\/$/, "");
12202
12215
  const projectFlag = typeof parsed["project"] === "string" ? parsed["project"] : void 0;
12203
12216
  const project = projectFlag || config.project || process.env.PINSAY_PROJECT || "";
12204
12217
  const explicitKey = typeof parsed["key"] === "string" ? parsed["key"] : void 0;
@@ -12239,7 +12252,7 @@ init_build_constants();
12239
12252
  async function loginCommand(cwd2, options = {}) {
12240
12253
  const root = await findRepoRoot(cwd2);
12241
12254
  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(/\/$/, "");
12255
+ const server = ((typeof options["server"] === "string" ? options["server"] : void 0) || config.server || canonicalServer(process.env.PINSAY_SERVER) || BUILD_DEFAULT_SERVER).replace(/\/$/, "");
12243
12256
  const branding = await getBranding(server);
12244
12257
  const product = branding.productName;
12245
12258
  const flagKey = typeof options["key"] === "string" ? options["key"] : void 0;
@@ -12297,7 +12310,7 @@ init_build_constants();
12297
12310
  async function logoutCommand(cwd2, options = {}) {
12298
12311
  const root = await findRepoRoot(cwd2);
12299
12312
  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(/\/$/, "");
12313
+ const server = ((typeof options["server"] === "string" ? options["server"] : void 0) || config.server || canonicalServer(process.env.PINSAY_SERVER) || BUILD_DEFAULT_SERVER).replace(/\/$/, "");
12301
12314
  const origin = normalizeServerOrigin(server);
12302
12315
  const removed = await removeGlobalCredential(server);
12303
12316
  if (options["json"] === true) {
@@ -12318,7 +12331,7 @@ init_build_constants();
12318
12331
  async function whoamiCommand(cwd2, options = {}) {
12319
12332
  const root = await findRepoRoot(cwd2);
12320
12333
  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(/\/$/, "");
12334
+ const server = ((typeof options["server"] === "string" ? options["server"] : void 0) || config.server || canonicalServer(process.env.PINSAY_SERVER) || BUILD_DEFAULT_SERVER).replace(/\/$/, "");
12322
12335
  const isJson = options["json"] === true;
12323
12336
  const { key, source } = await resolveApiKey(root, server);
12324
12337
  if (!key) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinsay-cli",
3
- "version": "0.6.7",
3
+ "version": "0.6.9",
4
4
  "description": "Click-to-comment feedback for your web app: install the widget, then turn pending comments into AI apply prompts.",
5
5
  "type": "module",
6
6
  "license": "MIT",