find-replace
sd CLI を使用した検索と置換
متاح أيضًا من: 0xDarkMatter
sd CLI ツールを使用して複数のファイルにわたる検索・置換操作を実行します。このツールは、従来の sed より安全なデフォルト設定で、正規表現支持的テキスト置換を簡素化します。
تنزيل ZIP المهارة
رفع في Claude
اذهب إلى Settings → Capabilities → Skills → Upload skill
فعّل وابدأ الاستخدام
اختبرها
استخدام "find-replace". Replace 'console.log' with 'logger.info' in my JavaScript files
النتيجة المتوقعة:
- src/**/*.js 内の置換をプレビュー中...
- 5 ファイルで 12 件検出
- 対象ファイル: src/utils.js, src/handlers.js, src/main.js, src/config.js, src/api.js
- 適用: sd 'console\.log\((.*)\)' 'logger.info($1)' src/**/*.js
استخدام "find-replace". Rename 'getUser' to 'fetchUser' in all TypeScript files
النتيجة المتوقعة:
- 単語境界を使用して 'getUser' を検索中...
- 8 ファイルで 23 件検出
- 完全一致には '\bgetUser\b' パターンを使用
- 適用: sd '\bgetUser\b' 'fetchUser' src/**/*.ts
استخدام "find-replace". Update all API v1 endpoints to v2
النتيجة المتوقعة:
- 6 ファイルで '/api/v1/' を 15 件検出
- ファイル: src/api.ts, src/routes.ts, src/endpoints.js, 他 3 件
- 適用: sd '/api/v1/' '/api/v2/' src/**/*.ts
التدقيق الأمني
آمنPure documentation skill containing only markdown files with examples for the sd CLI tool. No executable code, file access, network access, or command execution capabilities. All static findings are false positives triggered by bash examples in documentation context.
عوامل الخطر
⚙️ الأوامر الخارجية (110)
🔑 متغيرات البيئة (1)
🌐 الوصول إلى الشبكة (1)
📁 الوصول إلى نظام الملفات (2)
درجة الجودة
ماذا يمكنك بناءه
コードベース全体の変数名的変更
多くの TypeScript または JavaScript ファイル間で関数、変数、または定数を精密なマッチングで名前変更
設定文字列の更新
API エンドポイント、環境変数名、またはプロジェクトファイル全体の設定値を一括更新
レガシーコードパターンの近代化
非推奨の API を置換、CommonJS から ES モジュールへの変換、またはインポートパスを体系的に更新
جرّب هذه الموجهات
Replace all occurrences of 'oldFunction' with 'newFunction' in my src directory using sd
Use sd to replace console.log statements with logger.info in my JavaScript files, preserving the logged content
Change all '../utils' imports to '@/utils' in my TypeScript files using sd capture groups
Preview what would change if I replaced 'api.example.com' with 'api.new.com' across my project, then apply safely
أفضل الممارسات
- 一括置換を適用する前に ripgrep でプレビューする
- 部分一致を避けるために '\b' で単語境界を使用する
- 容易なロールバックのため、一括置換を実行する前に git にコミットする
تجنب
- プレビューせずに置換を実行する
- 特別な正規表現文字をエスケープせずにパターンを使用する
- バージョン管理なしで直接本番環境に変更を適用する