@optima-chat/dev-skills 0.7.10 → 0.7.11

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.
@@ -214,42 +214,21 @@ async function main() {
214
214
  { encoding: 'utf-8' }
215
215
  );
216
216
 
217
- console.log('\n' + result);
218
- } else if (environment === 'stage') {
219
- // Stage 环境:直连 RDS(Stage RDS 在公有子网,可以本地直连)
220
- const infisicalConfig = getInfisicalConfig();
221
- console.log('✓ Loaded Infisical config from GitHub Variables');
222
-
223
- const token = getInfisicalToken(infisicalConfig);
224
- console.log('✓ Obtained Infisical access token');
225
-
226
- const secrets = getInfisicalSecrets(infisicalConfig, token, 'staging');
227
- console.log('✓ Retrieved database credentials from Infisical');
228
-
229
- const { userKey, passwordKey, database } = serviceConfig as any;
230
- const dbHost = RDS_HOSTS.stage;
231
- const dbUser = secrets[userKey];
232
- const dbPassword = secrets[passwordKey];
233
-
234
- if (!dbUser || !dbPassword) {
235
- throw new Error(`Database credentials not found in Infisical for ${service}. Keys: ${userKey}, ${passwordKey}`);
236
- }
237
-
238
- const result = queryDatabase(dbHost, 5432, dbUser, dbPassword, database, sql);
239
217
  console.log('\n' + result);
240
218
  } else {
241
- // Prod 环境:通过 SSH 隧道访问 RDS(Prod RDS 在私有子网)
219
+ // Stage/Prod 环境:通过 SSH 隧道访问 RDS
242
220
  const infisicalConfig = getInfisicalConfig();
243
221
  console.log('✓ Loaded Infisical config from GitHub Variables');
244
222
 
245
223
  const token = getInfisicalToken(infisicalConfig);
246
224
  console.log('✓ Obtained Infisical access token');
247
225
 
226
+ // 数据库凭证统一存储在 Infisical 的 prod 环境(Stage/Prod 共享相同凭证)
248
227
  const secrets = getInfisicalSecrets(infisicalConfig, token, 'prod');
249
228
  console.log('✓ Retrieved database credentials from Infisical');
250
229
 
251
230
  const { userKey, passwordKey, database } = serviceConfig as any;
252
- const dbHost = RDS_HOSTS.prod;
231
+ const dbHost = RDS_HOSTS[environment as 'stage' | 'prod'];
253
232
  const dbUser = secrets[userKey];
254
233
  const dbPassword = secrets[passwordKey];
255
234
 
@@ -257,7 +236,7 @@ async function main() {
257
236
  throw new Error(`Database credentials not found in Infisical for ${service}. Keys: ${userKey}, ${passwordKey}`);
258
237
  }
259
238
 
260
- const localPort = 15433;
239
+ const localPort = environment === 'stage' ? 15432 : 15433;
261
240
 
262
241
  setupSSHTunnel(EC2_HOST, dbHost, localPort);
263
242
 
@@ -195,40 +195,23 @@ async function main() {
195
195
  const result = (0, child_process_1.execSync)(`sshpass -p "${ciPassword}" ssh -o StrictHostKeyChecking=no ${ciUser}@${ciHost} "docker exec ${container} psql -U ${user} -d ${database} -c \\"${sql}\\""`, { encoding: 'utf-8' });
196
196
  console.log('\n' + result);
197
197
  }
198
- else if (environment === 'stage') {
199
- // Stage 环境:直连 RDS(Stage RDS 在公有子网,可以本地直连)
200
- const infisicalConfig = getInfisicalConfig();
201
- console.log('✓ Loaded Infisical config from GitHub Variables');
202
- const token = getInfisicalToken(infisicalConfig);
203
- console.log('✓ Obtained Infisical access token');
204
- const secrets = getInfisicalSecrets(infisicalConfig, token, 'staging');
205
- console.log('✓ Retrieved database credentials from Infisical');
206
- const { userKey, passwordKey, database } = serviceConfig;
207
- const dbHost = RDS_HOSTS.stage;
208
- const dbUser = secrets[userKey];
209
- const dbPassword = secrets[passwordKey];
210
- if (!dbUser || !dbPassword) {
211
- throw new Error(`Database credentials not found in Infisical for ${service}. Keys: ${userKey}, ${passwordKey}`);
212
- }
213
- const result = queryDatabase(dbHost, 5432, dbUser, dbPassword, database, sql);
214
- console.log('\n' + result);
215
- }
216
198
  else {
217
- // Prod 环境:通过 SSH 隧道访问 RDS(Prod RDS 在私有子网)
199
+ // Stage/Prod 环境:通过 SSH 隧道访问 RDS
218
200
  const infisicalConfig = getInfisicalConfig();
219
201
  console.log('✓ Loaded Infisical config from GitHub Variables');
220
202
  const token = getInfisicalToken(infisicalConfig);
221
203
  console.log('✓ Obtained Infisical access token');
204
+ // 数据库凭证统一存储在 Infisical 的 prod 环境(Stage/Prod 共享相同凭证)
222
205
  const secrets = getInfisicalSecrets(infisicalConfig, token, 'prod');
223
206
  console.log('✓ Retrieved database credentials from Infisical');
224
207
  const { userKey, passwordKey, database } = serviceConfig;
225
- const dbHost = RDS_HOSTS.prod;
208
+ const dbHost = RDS_HOSTS[environment];
226
209
  const dbUser = secrets[userKey];
227
210
  const dbPassword = secrets[passwordKey];
228
211
  if (!dbUser || !dbPassword) {
229
212
  throw new Error(`Database credentials not found in Infisical for ${service}. Keys: ${userKey}, ${passwordKey}`);
230
213
  }
231
- const localPort = 15433;
214
+ const localPort = environment === 'stage' ? 15432 : 15433;
232
215
  setupSSHTunnel(EC2_HOST, dbHost, localPort);
233
216
  // 等待隧道建立
234
217
  await new Promise(resolve => setTimeout(resolve, 1000));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optima-chat/dev-skills",
3
- "version": "0.7.10",
3
+ "version": "0.7.11",
4
4
  "description": "Claude Code Skills for Optima development team - cross-environment collaboration tools",
5
5
  "main": "index.js",
6
6
  "bin": {