@ainyc/canonry 1.27.1 → 1.27.2

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.
@@ -88,13 +88,42 @@ Do not write config.yaml by hand; use "canonry init", "canonry settings", or "ca
88
88
  }
89
89
  return parsed;
90
90
  }
91
+ function loadConfigRaw() {
92
+ const configPath = getConfigPath();
93
+ if (!fs.existsSync(configPath)) return null;
94
+ try {
95
+ return parse(fs.readFileSync(configPath, "utf-8")) ?? null;
96
+ } catch {
97
+ return null;
98
+ }
99
+ }
91
100
  function saveConfig(config) {
92
101
  const configDir = getConfigDir();
93
102
  if (!fs.existsSync(configDir)) {
94
103
  fs.mkdirSync(configDir, { recursive: true });
95
104
  }
96
- const yaml = stringify(config);
97
- fs.writeFileSync(getConfigPath(), yaml, { encoding: "utf-8", mode: 384 });
105
+ const configPath = getConfigPath();
106
+ const onDisk = loadConfigRaw();
107
+ const merged = onDisk ? { ...onDisk } : {};
108
+ for (const [key, value] of Object.entries(config)) {
109
+ if (value !== void 0) {
110
+ merged[key] = value;
111
+ }
112
+ }
113
+ if (onDisk) {
114
+ if (process.env.CANONRY_PORT?.trim() || onDisk.basePath) {
115
+ merged.apiUrl = onDisk.apiUrl;
116
+ }
117
+ if ("CANONRY_BASE_PATH" in process.env) {
118
+ if (onDisk.basePath !== void 0) {
119
+ merged.basePath = onDisk.basePath;
120
+ } else {
121
+ delete merged.basePath;
122
+ }
123
+ }
124
+ }
125
+ const yaml = stringify(merged);
126
+ fs.writeFileSync(configPath, yaml, { encoding: "utf-8", mode: 384 });
98
127
  }
99
128
  function configExists() {
100
129
  return fs.existsSync(getConfigPath());
package/dist/cli.js CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  setGoogleAuthConfig,
20
20
  showFirstRunNotice,
21
21
  trackEvent
22
- } from "./chunk-UTRZ3UB5.js";
22
+ } from "./chunk-727N35MW.js";
23
23
 
24
24
  // src/cli.ts
25
25
  import { pathToFileURL } from "url";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createServer,
3
3
  loadConfig
4
- } from "./chunk-UTRZ3UB5.js";
4
+ } from "./chunk-727N35MW.js";
5
5
  export {
6
6
  createServer,
7
7
  loadConfig
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ainyc/canonry",
3
- "version": "1.27.1",
3
+ "version": "1.27.2",
4
4
  "type": "module",
5
5
  "description": "The ultimate open-source AEO monitoring tool - track how answer engines cite your domain",
6
6
  "license": "FSL-1.1-ALv2",
@@ -53,18 +53,18 @@
53
53
  "@types/node-cron": "^3.0.11",
54
54
  "tsup": "^8.5.1",
55
55
  "tsx": "^4.19.0",
56
- "@ainyc/canonry-config": "0.0.0",
57
- "@ainyc/canonry-contracts": "0.0.0",
58
- "@ainyc/canonry-provider-claude": "0.0.0",
59
56
  "@ainyc/canonry-api-routes": "0.0.0",
57
+ "@ainyc/canonry-provider-claude": "0.0.0",
58
+ "@ainyc/canonry-contracts": "0.0.0",
60
59
  "@ainyc/canonry-provider-gemini": "0.0.0",
60
+ "@ainyc/canonry-config": "0.0.0",
61
+ "@ainyc/canonry-provider-local": "0.0.0",
61
62
  "@ainyc/canonry-db": "0.0.0",
62
63
  "@ainyc/canonry-provider-cdp": "0.0.0",
63
- "@ainyc/canonry-provider-local": "0.0.0",
64
- "@ainyc/canonry-integration-bing": "0.0.0",
65
64
  "@ainyc/canonry-integration-google": "0.0.0",
65
+ "@ainyc/canonry-provider-perplexity": "0.0.0",
66
66
  "@ainyc/canonry-provider-openai": "0.0.0",
67
- "@ainyc/canonry-provider-perplexity": "0.0.0"
67
+ "@ainyc/canonry-integration-bing": "0.0.0"
68
68
  },
69
69
  "scripts": {
70
70
  "build": "tsup && tsx build-web.ts",