foxref-remote 0.1.3 → 0.1.5

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 CHANGED
@@ -183,6 +183,7 @@ program
183
183
  console.log(` Built: ${res.built_at}`);
184
184
  console.log(` Age: ${res.index_age_hours.toFixed(1)}h`);
185
185
  console.log(` Server: ${process.env.FOXREF_SERVER || "https://foxref.lienly.com"}`);
186
+ console.log(` CLI: foxref-remote v${pkg.version}`);
186
187
  }
187
188
  catch (e) {
188
189
  handleError(e);
package/dist/client.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * FoxRef Remote Client — HTTP client for the foxref API.
3
3
  *
4
4
  * All code intelligence queries go through this client.
5
- * Server URL comes from FOXREF_SERVER env var or defaults to foxref.lienly.com.
5
+ * Config resolution: CLI flags > env vars > ~/.foxref-remote.json > defaults
6
6
  */
7
7
  export interface UseHit {
8
8
  source_file: string;
package/dist/client.js CHANGED
@@ -3,20 +3,36 @@
3
3
  * FoxRef Remote Client — HTTP client for the foxref API.
4
4
  *
5
5
  * All code intelligence queries go through this client.
6
- * Server URL comes from FOXREF_SERVER env var or defaults to foxref.lienly.com.
6
+ * Config resolution: CLI flags > env vars > ~/.foxref-remote.json > defaults
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.FoxRefClient = void 0;
10
+ const node_fs_1 = require("node:fs");
11
+ const node_path_1 = require("node:path");
12
+ const node_os_1 = require("node:os");
13
+ function loadConfig() {
14
+ const configPath = (0, node_path_1.join)((0, node_os_1.homedir)(), ".foxref-remote.json");
15
+ if (!(0, node_fs_1.existsSync)(configPath))
16
+ return {};
17
+ try {
18
+ return JSON.parse((0, node_fs_1.readFileSync)(configPath, "utf-8"));
19
+ }
20
+ catch {
21
+ return {};
22
+ }
23
+ }
10
24
  class FoxRefClient {
11
25
  baseUrl;
12
26
  apiKey;
13
27
  branch;
14
28
  constructor(serverUrl, apiKey, branch) {
29
+ const config = loadConfig();
15
30
  this.baseUrl = (serverUrl ||
16
31
  process.env.FOXREF_SERVER ||
32
+ config.server ||
17
33
  "https://foxref.lienly.com").replace(/\/$/, "");
18
- this.apiKey = apiKey || process.env.FOXREF_API_KEY;
19
- this.branch = branch || process.env.FOXREF_BRANCH;
34
+ this.apiKey = apiKey || process.env.FOXREF_API_KEY || config.apiKey;
35
+ this.branch = branch || process.env.FOXREF_BRANCH || config.branch;
20
36
  }
21
37
  async request(path, params = {}) {
22
38
  const url = new URL(`${this.baseUrl}${path}`);
package/dist/init.js CHANGED
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.initProject = initProject;
13
13
  const node_fs_1 = require("node:fs");
14
14
  const node_path_1 = require("node:path");
15
+ const node_os_1 = require("node:os");
15
16
  const HOOK_SCRIPT = `#!/usr/bin/env bash
16
17
  # FoxRef Remote Search Injection — ambient code intelligence via foxref.lienly.com
17
18
  #
@@ -270,6 +271,13 @@ function initProject(projectDir, serverUrl = "https://foxref.lienly.com", apiKey
270
271
  // 4. Write memory file
271
272
  (0, node_fs_1.writeFileSync)(memoryPath, MEMORY_CONTENT);
272
273
  console.log(` Created: ${memoryPath}`);
274
+ // 5. Write persistent config (~/.foxref-remote.json)
275
+ const configPath = (0, node_path_1.join)((0, node_os_1.homedir)(), ".foxref-remote.json");
276
+ const config = { server: serverUrl };
277
+ if (apiKey)
278
+ config.apiKey = apiKey;
279
+ (0, node_fs_1.writeFileSync)(configPath, JSON.stringify(config, null, 2) + "\n", { mode: 0o600 });
280
+ console.log(` Created: ${configPath} (API key saved — no need to pass --key again)`);
273
281
  console.log();
274
282
  console.log("Done! foxref-remote is ready.");
275
283
  console.log();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foxref-remote",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Code intelligence CLI — search symbols, find references, analyze impact across the Lienly codebase",
5
5
  "bin": {
6
6
  "foxref-remote": "dist/cli.js"