antigravity-seo-kit 3.9.1 → 3.9.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.
Files changed (2) hide show
  1. package/lib/installer.js +74 -2
  2. package/package.json +1 -1
package/lib/installer.js CHANGED
@@ -18,6 +18,56 @@ const downloader = require('./downloader');
18
18
  const LEGACY_SEO_PREFIX = 'seo-';
19
19
  const LEGACY_DIRS = ['skills', 'workflows', 'rules', 'agents', 'agent'];
20
20
 
21
+ // ─── Env Parsing Utilities ──────────────────────────────────────────────────
22
+
23
+ function loadEnv(cwd) {
24
+ const envPath = path.join(cwd, '.env');
25
+ const env = {};
26
+ if (fs.existsSync(envPath)) {
27
+ try {
28
+ const content = fs.readFileSync(envPath, 'utf-8');
29
+ const lines = content.split('\n');
30
+ for (let line of lines) {
31
+ line = line.trim();
32
+ if (!line || line.startsWith('#')) continue;
33
+ const index = line.indexOf('=');
34
+ if (index > 0) {
35
+ const key = line.substring(0, index).trim();
36
+ let value = line.substring(index + 1).trim();
37
+ if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) {
38
+ value = value.substring(1, value.length - 1);
39
+ }
40
+ env[key] = value;
41
+ if (!process.env[key]) {
42
+ process.env[key] = value;
43
+ }
44
+ }
45
+ }
46
+ } catch (err) {
47
+ // ignore
48
+ }
49
+ }
50
+ return env;
51
+ }
52
+
53
+ function resolveEnvVars(data, env) {
54
+ if (typeof data === 'string') {
55
+ return data.replace(/\$\{([^}]+)\}/g, (match, varName) => {
56
+ return env[varName] !== undefined ? env[varName] : (process.env[varName] !== undefined ? process.env[varName] : match);
57
+ });
58
+ } else if (Array.isArray(data)) {
59
+ return data.map(item => resolveEnvVars(item, env));
60
+ } else if (data !== null && typeof data === 'object') {
61
+ const resolved = {};
62
+ for (const key in data) {
63
+ resolved[key] = resolveEnvVars(data[key], env);
64
+ }
65
+ return resolved;
66
+ }
67
+ return data;
68
+ }
69
+
70
+
21
71
  // ─── Install Command ────────────────────────────────────────────────────────
22
72
 
23
73
  async function install(licenseKey, cwd) {
@@ -114,7 +164,7 @@ async function install(licenseKey, cwd) {
114
164
  ? path.join(newAgentsDir, '.env.example')
115
165
  : path.join(cwd, '.agent', '.env.example');
116
166
  const localEnvExample = path.join(cwd, '.env.example');
117
- if (fs.existsSync(installedEnvExample) && !fs.existsSync(localEnvExample)) {
167
+ if (fs.existsSync(installedEnvExample)) {
118
168
  fs.copyFileSync(installedEnvExample, localEnvExample);
119
169
  }
120
170
 
@@ -645,11 +695,33 @@ function setupWorkspace(cwd) {
645
695
  // Copy .env.example to workspace root if not exists
646
696
  const globalEnvExample = path.join(globalDir, '.env.example');
647
697
  const localEnvExample = path.join(cwd, '.env.example');
648
- if (fs.existsSync(globalEnvExample) && !fs.existsSync(localEnvExample)) {
698
+ if (fs.existsSync(globalEnvExample)) {
649
699
  fs.copyFileSync(globalEnvExample, localEnvExample);
650
700
  }
651
701
 
702
+ // Resolve environment variables in copied configurations
703
+ const envVars = loadEnv(cwd);
704
+ const configsToResolve = [
705
+ path.join(localAgentsDir, 'mcp_config.json'),
706
+ path.join(localAgentsDir, 'config', 'solann-api.json'),
707
+ path.join(localAgentsDir, 'config', 'serper-api.json')
708
+ ];
709
+
710
+ for (const configPath of configsToResolve) {
711
+ if (fs.existsSync(configPath)) {
712
+ try {
713
+ const content = fs.readFileSync(configPath, 'utf-8');
714
+ const json = JSON.parse(content);
715
+ const resolvedJson = resolveEnvVars(json, envVars);
716
+ fs.writeFileSync(configPath, JSON.stringify(resolvedJson, null, 2), 'utf-8');
717
+ } catch (err) {
718
+ // ignore
719
+ }
720
+ }
721
+ }
722
+
652
723
  spin.succeed(`Workspace setup complete! Copied ${count} files to .agents/`);
724
+
653
725
  console.log('');
654
726
  info('Skills and rules are loaded from global plugin automatically.');
655
727
  info('Workspace-level files (workflows, agents, scripts) are now local.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antigravity-seo-kit",
3
- "version": "3.9.1",
3
+ "version": "3.9.5",
4
4
  "description": "Professional Agentic SEO Platform for Google Antigravity 2 AI Agent — 44 specialized skills covering technical audit, E-E-A-T, schema, GEO, local SEO & more",
5
5
  "main": "lib/installer.js",
6
6
  "bin": {