aranea-sdk-cli 0.3.4 → 0.3.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/README.md CHANGED
@@ -217,7 +217,7 @@ aranea-sdk schema validate --file state.json --type aranea_ar-is04a
217
217
  ```
218
218
 
219
219
  > **Note**: `schema validate` は State Report ペイロードの検証用です。
220
- > スキーマ定義ファイル自体の静的検証機能は将来バージョンで追加予定です。
220
+ > スキーマ定義ファイル自体の静的検証は `schema validate-schema` で実行できます。
221
221
 
222
222
  ### 実装済み vs 計画中
223
223
 
@@ -237,7 +237,7 @@ aranea-sdk schema validate --file state.json --type aranea_ar-is04a
237
237
  すべてのschemaサブコマンドで `--endpoint` オプションが使用可能です:
238
238
 
239
239
  ```bash
240
- # デフォルト: staging
240
+ # デフォルト: staging (安全側)
241
241
  aranea-sdk schema list
242
242
 
243
243
  # 明示的にproduction指定
@@ -247,6 +247,10 @@ aranea-sdk schema list --endpoint production
247
247
  ARANEA_ENV=production aranea-sdk schema list
248
248
  ```
249
249
 
250
+ > ⚠️ **注意**: staging環境のCloud Functionsは現在未デプロイです。
251
+ > `--endpoint staging` を指定するとエラーになります。
252
+ > 本番操作時は `--endpoint production` を明示的に指定してください。
253
+
250
254
  ---
251
255
 
252
256
  ## validate - Type名検証
@@ -61,7 +61,7 @@ const os = __importStar(require("os"));
61
61
  const readline = __importStar(require("readline"));
62
62
  const chalk_1 = __importDefault(require("chalk"));
63
63
  // Firebase Auth REST API configuration
64
- const FIREBASE_API_KEY = 'AIzaSyChVMfLPZ9fL_LQBK2TtLbM2iONPhyU1NY'; // mobesorder project
64
+ const FIREBASE_API_KEY = 'AIzaSyAHt-yE-4oD4iM-8q_hvbCiGk-fhyHtppU'; // mobesorder project
65
65
  const AUTH_ENDPOINT = 'https://identitytoolkit.googleapis.com/v1';
66
66
  // Credentials storage
67
67
  const CONFIG_DIR = path.join(os.homedir(), '.aranea-sdk');
@@ -549,8 +549,15 @@ exports.schemaCommand
549
549
  .option('-t, --token <token>', 'Firebase Auth ID token')
550
550
  .option('-e, --endpoint <env>', 'Environment (staging|production)', 'staging')
551
551
  .option('-d, --dry-run', 'Show what would be pushed without actually pushing')
552
+ .option('--force', 'Force operation on production (required for production)')
552
553
  .action(async (options) => {
553
554
  const env = (0, config_1.resolveEnvironment)(options.endpoint);
555
+ // Check staging availability
556
+ (0, config_1.checkStagingAvailability)(env, 'schema push --endpoint production');
557
+ // Require --force for production
558
+ if (!options.dryRun && !(0, config_1.requireProductionConfirmation)(env, 'schema push', options.force)) {
559
+ process.exit(1);
560
+ }
554
561
  const apiBase = getSchemaApiBase(env);
555
562
  // Warn if production
556
563
  (0, config_1.warnIfProduction)(env, 'schema push');
package/dist/config.d.ts CHANGED
@@ -50,3 +50,18 @@ export declare function getWebhookConfig(env: Environment, fid: string): Webhook
50
50
  * Display environment warning for production operations
51
51
  */
52
52
  export declare function warnIfProduction(env: Environment, operation: string): void;
53
+ /**
54
+ * Staging environment availability status
55
+ * Set to false until staging Cloud Functions are deployed
56
+ */
57
+ export declare const STAGING_AVAILABLE = false;
58
+ /**
59
+ * Check if staging environment is available
60
+ * Throws error with guidance if staging is requested but unavailable
61
+ */
62
+ export declare function checkStagingAvailability(env: Environment, operation: string): void;
63
+ /**
64
+ * Require explicit confirmation for destructive operations on production
65
+ * Returns true if operation should proceed, false if cancelled
66
+ */
67
+ export declare function requireProductionConfirmation(env: Environment, operation: string, forceFlag: boolean): boolean;
package/dist/config.js CHANGED
@@ -8,12 +8,14 @@
8
8
  * - Default: staging (safety first)
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.TEST_TENANT = exports.ENDPOINTS = void 0;
11
+ exports.STAGING_AVAILABLE = exports.TEST_TENANT = exports.ENDPOINTS = void 0;
12
12
  exports.getCurrentEnvironment = getCurrentEnvironment;
13
13
  exports.resolveEnvironment = resolveEnvironment;
14
14
  exports.getEndpoint = getEndpoint;
15
15
  exports.getWebhookConfig = getWebhookConfig;
16
16
  exports.warnIfProduction = warnIfProduction;
17
+ exports.checkStagingAvailability = checkStagingAvailability;
18
+ exports.requireProductionConfirmation = requireProductionConfirmation;
17
19
  exports.ENDPOINTS = {
18
20
  production: {
19
21
  gate: 'https://asia-northeast1-mobesorder.cloudfunctions.net/araneaDeviceGate',
@@ -99,3 +101,44 @@ function warnIfProduction(env, operation) {
99
101
  console.warn(`\x1b[33m⚠️ WARNING: ${operation} targeting PRODUCTION environment\x1b[0m`);
100
102
  }
101
103
  }
104
+ /**
105
+ * Staging environment availability status
106
+ * Set to false until staging Cloud Functions are deployed
107
+ */
108
+ exports.STAGING_AVAILABLE = false;
109
+ /**
110
+ * Check if staging environment is available
111
+ * Throws error with guidance if staging is requested but unavailable
112
+ */
113
+ function checkStagingAvailability(env, operation) {
114
+ if (env === 'staging' && !exports.STAGING_AVAILABLE) {
115
+ console.error('\x1b[31m❌ ERROR: staging環境のCloud Functionsは現在未デプロイです\x1b[0m');
116
+ console.error('');
117
+ console.error('本番環境を使用する場合は --endpoint production を明示的に指定してください:');
118
+ console.error(` aranea-sdk ${operation} --endpoint production`);
119
+ console.error('');
120
+ console.error('または環境変数を設定:');
121
+ console.error(' export ARANEA_ENV=production');
122
+ console.error('');
123
+ process.exit(1);
124
+ }
125
+ }
126
+ /**
127
+ * Require explicit confirmation for destructive operations on production
128
+ * Returns true if operation should proceed, false if cancelled
129
+ */
130
+ function requireProductionConfirmation(env, operation, forceFlag) {
131
+ if (env !== 'production') {
132
+ return true;
133
+ }
134
+ if (forceFlag) {
135
+ console.warn(`\x1b[33m⚠️ --force specified: skipping confirmation for ${operation}\x1b[0m`);
136
+ return true;
137
+ }
138
+ console.error('\x1b[31m❌ ERROR: 本番環境への破壊的操作には --force フラグが必要です\x1b[0m');
139
+ console.error('');
140
+ console.error('例:');
141
+ console.error(` aranea-sdk ${operation} --endpoint production --force`);
142
+ console.error('');
143
+ return false;
144
+ }
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@ const program = new commander_1.Command();
28
28
  program
29
29
  .name('aranea-sdk')
30
30
  .description('AraneaSDK CLI - デバイス開発支援ツール')
31
- .version('0.3.4');
31
+ .version('0.3.5');
32
32
  // test コマンド
33
33
  program.addCommand(test_1.testCommand);
34
34
  // simulate コマンド
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aranea-sdk-cli",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "AraneaSDK CLI - ESP32 IoTデバイス開発支援ツール",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",