commit 9
This commit is contained in:
45
readme.md
45
readme.md
@@ -1,2 +1,43 @@
|
||||
このリポジトリはインターネットからアクセスするためのものです。
|
||||
公開用のため個人情報はアップロードしてはいけません。
|
||||
# Strudel Code Assistant (Gemini CLI Skills)
|
||||
|
||||
このプロジェクトは、Gemini CLIの「Skills」機能を活用して、Strudelスクリプトの解説、構文修正、およびリファクタリングを自動化するためのツール群です。
|
||||
|
||||
⚠️ **注意**: このリポジトリは公開用です。個人情報や機密情報は絶対にアップロードしないでください。
|
||||
|
||||
## ファイル説明
|
||||
- `/.gemini/gemini.md`: コードスタイルや公式URLのリファレンス
|
||||
- `/.gemini/reference.md`: gemini.mdから参照する詳細なstrudelの情報
|
||||
- `/.gemini/skills/strudel_fix_and_explain.md`: strudelコードの誤りの修正とコードの説明のためのskill
|
||||
- `/.gemini/skills/strudel_refactor.md`: strudelコードをより良いコードにするためのskill
|
||||
|
||||
## ディレクトリ構成
|
||||
|
||||
- `/strudel/`: 既存のStrudelコード(Markdown形式)
|
||||
- `/.gemini/`: Strudelの知識ベース(Markdown形式)
|
||||
- `/.gemini/skills/`: Gemini CLI用のスキル定義ファイル(プロンプトエンジニアリング)
|
||||
- `/script/`: スキルを実行するための各種シェルスクリプト
|
||||
- `/refactoring/`: リファクタリング後のコード出力先(実行時に自動生成)
|
||||
- `/explained/`: 解説・修正後のコード出力先(実行時に自動生成)
|
||||
|
||||
## 主な機能
|
||||
|
||||
1. **コード解説と修正**: `fix_and_explain_strudel.sh` を使用して、コードのバグ修正と詳細な解説を生成します。
|
||||
2. **リファクタリング**: `refactor_strudel.sh` を使用して、より洗練されたStrudelコードへの書き換えを行います。
|
||||
|
||||
## ワークフロー
|
||||
|
||||
プロジェクトのルートディレクトリ(`notebook/`)から、対象に合わせて以下のコマンドを実行します。
|
||||
|
||||
### 1. 全ファイルを一括で修正・解説する
|
||||
`strudel/` フォルダ内のすべての `.md` ファイルを処理します。
|
||||
```bash
|
||||
bash script/fix_and_explain_strudel.sh
|
||||
```
|
||||
|
||||
### 2. 特定のファイルにリファクタリングを適用する
|
||||
個別のファイルを指定して実行することも可能です。
|
||||
```bash
|
||||
bash script/refactor_strudel.sh strudel/my-beat.md
|
||||
```
|
||||
|
||||
実行後、結果は `refactoring/` や `explained/` フォルダに自動的に保存されます。
|
||||
10
script/fix_and_explain_strudel.sh
Normal file → Executable file
10
script/fix_and_explain_strudel.sh
Normal file → Executable file
@@ -4,6 +4,8 @@
|
||||
BASE_DIR=$(cd "$(dirname "$0")/.." && pwd)
|
||||
OUTPUT_DIR="$BASE_DIR/explained"
|
||||
SKILL_FILE="$BASE_DIR/.gemini/skills/strudel_fix_and_explain.md"
|
||||
GEMINI_REF="$BASE_DIR/.gemini/gemini.md"
|
||||
STRUDEL_REF="$BASE_DIR/.gemini/reference.md"
|
||||
|
||||
# 出力先フォルダの作成
|
||||
if [ ! -f "$SKILL_FILE" ]; then
|
||||
@@ -29,13 +31,17 @@ for file in "${files[@]}"; do
|
||||
filename=$(basename "$file")
|
||||
# 特定のファイルやディレクトリを除外
|
||||
[[ "$filename" =~ ^(Strudel Making Sound|Strudel Study)\.md$ ]] && continue
|
||||
[[ "$file" =~ /(refactoring|script|explained|organized_strudel)/ ]] && continue
|
||||
[[ "$file" =~ /(refactoring|script|explained)/ ]] && continue
|
||||
|
||||
echo "Analyzing and fixing $filename..."
|
||||
|
||||
# 一時ファイルに出力
|
||||
tmp_file="$OUTPUT_DIR/tmp_$filename"
|
||||
(cat "$SKILL_FILE"; echo ""; cat "$file") | gemini > "$tmp_file"
|
||||
|
||||
( [ -f "$GEMINI_REF" ] && cat "$GEMINI_REF"; \
|
||||
[ -f "$STRUDEL_REF" ] && cat "$STRUDEL_REF"; \
|
||||
echo ""; cat "$SKILL_FILE"; \
|
||||
echo ""; cat "$file" ) | gemini > "$tmp_file"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
# FILENAME: タグを検索
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# スクリプトの場所 (scripts/) からプロジェクトルートを動的に取得
|
||||
ROOT_DIR=$(cd "$(dirname "$0")/.." && pwd)
|
||||
BASE_DIR="$ROOT_DIR/organized_strudel"
|
||||
SOURCE_DIR="$ROOT_DIR/strudel"
|
||||
|
||||
mkdir -p "$BASE_DIR"
|
||||
|
||||
echo "Starting Strudel code categorization..."
|
||||
|
||||
for file in "$SOURCE_DIR"/*.md; do
|
||||
# ドキュメントファイル自体は除外
|
||||
[[ "$file" == *"Strudel Making Sound.md"* ]] && continue
|
||||
[[ "$file" == *"Strudel Study.md"* ]] && continue
|
||||
[[ "$file" == *"/script/"* ]] && continue
|
||||
[ -e "$file" ] || continue
|
||||
|
||||
filename=$(basename "$file")
|
||||
echo "Analyzing $filename..."
|
||||
|
||||
# gemini を使用してカテゴリを判定
|
||||
category=$( (echo "Analyze this Strudel code.
|
||||
Based on functions like s(), note(), fm(), degrade(), or effects like lpf(),
|
||||
classify this into exactly one of these categories:
|
||||
'Sampling', 'Synthesis', 'Generative', 'Ambient_FX'.
|
||||
Return only the category name as a single word."; echo ""; cat "$file") | gemini)
|
||||
|
||||
# カテゴリが取得できなかった場合のデフォルト
|
||||
if [ -z "$category" ]; then
|
||||
category="Unclassified"
|
||||
fi
|
||||
|
||||
target_path="$BASE_DIR/$category"
|
||||
mkdir -p "$target_path"
|
||||
|
||||
cp "$file" "$target_path/"
|
||||
echo "-> Moved to $category/"
|
||||
done
|
||||
12
script/refactor_strudel.sh
Normal file → Executable file
12
script/refactor_strudel.sh
Normal file → Executable file
@@ -4,6 +4,8 @@
|
||||
BASE_DIR=$(cd "$(dirname "$0")/.." && pwd)
|
||||
REFACTOR_DIR="$BASE_DIR/refactoring"
|
||||
SKILL_FILE="$BASE_DIR/.gemini/skills/strudel_refactor.md"
|
||||
GEMINI_REF="$BASE_DIR/.gemini/gemini.md"
|
||||
STRUDEL_REF="$BASE_DIR/.gemini/reference.md"
|
||||
|
||||
# 出力先フォルダの作成
|
||||
if [ ! -f "$SKILL_FILE" ]; then
|
||||
@@ -29,13 +31,17 @@ for file in "${files[@]}"; do
|
||||
filename=$(basename "$file")
|
||||
# 特定のファイルやディレクトリを除外
|
||||
[[ "$filename" =~ ^(Strudel Making Sound|Strudel Study)\.md$ ]] && continue
|
||||
[[ "$file" =~ /(refactoring|script|explained|organized_strudel)/ ]] && continue
|
||||
[[ "$file" =~ /(refactoring|script|explained)/ ]] && continue
|
||||
|
||||
echo "Processing $filename..."
|
||||
|
||||
# スキルファイルをシステムプロンプトとして使用
|
||||
# 知識ベースとスキルファイルを組み合わせて実行
|
||||
tmp_file="$REFACTOR_DIR/tmp_$filename"
|
||||
(cat "$SKILL_FILE"; echo ""; cat "$file") | gemini > "$tmp_file"
|
||||
|
||||
( [ -f "$GEMINI_REF" ] && cat "$GEMINI_REF"; \
|
||||
[ -f "$STRUDEL_REF" ] && cat "$STRUDEL_REF"; \
|
||||
echo ""; cat "$SKILL_FILE"; \
|
||||
echo ""; cat "$file" ) | gemini > "$tmp_file"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
# 最初の数行から FILENAME: タグを検索(より柔軟な抽出)
|
||||
|
||||
Reference in New Issue
Block a user