
dalec-spec-generator
by Ryuki-997
SKILL.md
name: Dalec Spec Generator description: Agent skill for generating Dalec specification files from GitHub repositories with deterministic workflow
Dalec Spec Generator - Agent Skill
This tool implements a deterministic agent skill for converting GitHub repositories into Dalec specification files for container and package builds.
Workflow Overview
The dalec-spec-generator follows this sequence:
┌───────────────────────────────────────────────────────────────────┐
│ Step 0: Discover Build Files (--discover flag) │
│ ──────────────────────────────────────────────────────────────── │
│ Command: go run main.go -repo owner/repo --discover │
│ Action: DFS search repository for Dockerfile and Makefile paths │
│ Output: result/{repo}/filepath.yml │
│ Note: Clears result directory before starting fresh │
└───────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ Step 1: Download Build Files & Extract Values │
│ ───────────────────────────────────────────────────────────── │
│ Trigger: filepath.yml contains Dockerfile and/or Makefile paths│
│ Action: Download files from paths, extract non-deterministic │
│ values using .github/skills/non-deterministic-setup │
│ Output: result/{repo}/Dockerfile │
│ result/{repo}/Makefile │
│ result/{repo}/NonDeterministicValues.yml │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ Step 2: Run CLI Tool to Generate Dalec Spec │
│ ───────────────────────────────────────────────────────────── │
│ Command: go run main.go -repo <repo> \ │
│ -dockerfile result/{repo}/Dockerfile \ │
│ -makefile result/{repo}/Makefile \ │
│ -output result/{repo}/{name}.yml │
│ Output: result/{repo}/{name}.yml │
└─────────────────────────────────────────────────────────────────┘
Directory Structure
All output is placed in the result/ directory:
dalec-mapping/
├── result/
│ └── {repo}/
│ └── {subdir}/ # Only if subdirectory specified
│ ├── filepath.yml # Discovered file paths (from --discover)
│ ├── Dockerfile # Downloaded from GitHub
│ ├── Makefile # Downloaded from GitHub
│ ├── NonDeterministicValues.yml # Agent-extracted values
│ └── {name}.yml # Generated Dalec spec
└── ...
Directory Naming Convention
| Input Format | Directory Created |
|---|---|
owner/repo | result/{repo}/ |
owner/repo/tree/branch | result/{repo}/ |
owner/repo/tree/branch/subdir | result/{repo}/{subdir}/ |
Examples:
kubernetes/autoscaler→result/autoscaler/kubernetes/autoscaler/tree/master/addon-resizer→result/autoscaler/addon-resizer/
Detailed Workflow Steps
Step 0: Discover Build Files
CRITICAL: Always run --discover first to find all Dockerfiles and Makefiles in the repository.
Command:
go run main.go -repo owner/repo --discover
# Or with branch:
go run main.go -repo owner/repo/tree/main --discover
Action: DFS search the repository for all Dockerfiles and Makefiles
- Input: Repository URL or
owner/repoformat - Operations:
- Clear the
result/{repo}/directory (fresh start each run) - Parse repository URL to extract: owner, repo, branch
- DFS traverse repository via GitHub API
- Find all files named
Dockerfile,*.dockerfile, orMakefile - Skip directories: vendor, node_modules, .git, test, tests, docs, examples
- Write discovered paths to
result/{repo}/filepath.yml
- Clear the
- Output:
result/{repo}/filepath.yml
filepath.yml format:
dockerfiles:
- deploy/Dockerfile
- pkg/blobplugin/Dockerfile
- cmd/Dockerfile
makefiles:
- Makefile
- build/Makefile
Validation:
- Command exits with status 0
- filepath.yml exists in result directory
- At least one Dockerfile or Makefile found
Step 1: Download Files & Extract Non-Deterministic Values
Trigger: filepath.yml exists and contains file paths
Action:
- Read
result/{repo}/filepath.yml - Select the appropriate Dockerfile and Makefile from the paths
- Download the selected files to
result/{repo}/ - Extract non-deterministic values per non-deterministic-setup
- Write
result/{repo}/NonDeterministicValues.yml
Selection Heuristics (for agent):
- Dockerfile priority:
- Root-level
Dockerfile deploy/Dockerfilepkg/*/Dockerfile(matches main package)- First in list
- Root-level
- Makefile priority:
- Root-level
Makefile - First in list
- Root-level
Download URLs:
https://raw.githubusercontent.com/{owner}/{repo}/{branch}/{path}
Output Files:
result/{repo}/Dockerfileresult/{repo}/Makefileresult/{repo}/NonDeterministicValues.yml
Step 2: Run CLI Tool to Generate Dalec Spec
CRITICAL: This step uses the CLI tool. The agent MUST use the CLI.
Command:
go run main.go \
-repo owner/repo/tree/branch \
-dockerfile result/{repo}/Dockerfile \
-makefile result/{repo}/Makefile \
-output result/{repo}/{name}.yml
Operations:
- CLI parses Dockerfile and Makefile
- CLI fetches GitHub metadata (version, commit, license)
- CLI reads NonDeterministicValues.yml from same directory as Dockerfile
- CLI generates complete Dalec spec
- CLI writes output YAML file
Output: result/{repo}/{name}.yml
Validation:
- Command exits with status 0
- Output YAML file exists and is valid YAML
Agent Execution Summary
The agent performs 3 steps:
- Step 0: Run
go run main.go -repo X --discoverto find all build files - Step 1: Read filepath.yml, download correct files, create NonDeterministicValues.yml
- Step 2: Run
go run main.go -repo X -dockerfile Y -makefile Z -output Oto generate spec
CLI Reference
Discover Mode
go run main.go -repo <repository> --discover
Parameters:
-repo: GitHub repository (required)- Formats:
owner/repo,owner/repo/tree/branch,owner/repo/tree/branch/subdir
- Formats:
--discover: Enable discovery mode (no value needed)
Output:
- Clears
result/{repo}/directory - Creates
result/{repo}/filepath.ymlwith discovered paths
Generate Mode (default)
go run main.go -repo <repository> -dockerfile <path> -makefile <path> -output <file>
Parameters:
-repo: GitHub repository (required)-dockerfile: Path to local Dockerfile-makefile: Path to local Makefile-output: Output YAML file path
Example Usage
Simple Repository
# Step 0: Discover
go run main.go -repo google/cadvisor --discover
# Review filepath.yml
cat result/cadvisor/filepath.yml
# Step 1: Download files (agent does this manually via curl)
curl -s "https://raw.githubusercontent.com/google/cadvisor/master/deploy/Dockerfile" \
-o result/cadvisor/Dockerfile
curl -s "https://raw.githubusercontent.com/google/cadvisor/master/Makefile" \
-o result/cadvisor/Makefile
# Step 1: Create NonDeterministicValues.yml (agent extracts values)
# Step 2: Generate
go run main.go -repo google/cadvisor \
-dockerfile result/cadvisor/Dockerfile \
-makefile result/cadvisor/Makefile \
-output result/cadvisor/cadvisor.yml
Monorepo with Subdirectory
# Step 0: Discover (searches entire repo)
go run main.go -repo kubernetes/autoscaler/tree/master/addon-resizer --discover
# Review filepath.yml
cat result/autoscaler/addon-resizer/filepath.yml
# Step 1 & 2: Download and generate
# ... (same pattern as above)
Error Handling
Non-Fatal Warnings
- ⚠️ No Dockerfile found in repository
- ⚠️ No Makefile found in repository
- ⚠️ Multiple Dockerfiles found - agent should select appropriate one
Fatal Errors
- ❌ Repository not found
- ❌ GitHub API rate limit exceeded
- ❌ No build files discovered
Success Criteria
A successful run produces:
- ✅
result/{repo}/filepath.ymlwith discovered paths - ✅
result/{repo}/Dockerfiledownloaded - ✅
result/{repo}/Makefiledownloaded (if exists) - ✅
result/{repo}/NonDeterministicValues.ymlcreated - ✅
result/{repo}/{name}.ymlgenerated
Deterministic Behavior
This agent skill guarantees:
- Fresh Start: Result directory cleared on each
--discoverrun - Idempotent: Same inputs always produce same output
- Sequential: Steps execute in fixed order
- Predictable: No exploratory or adaptive behavior
- Transparent: Each step's purpose and output clearly defined
スコア
総合スコア
リポジトリの品質指標に基づく評価
SKILL.mdファイルが含まれている
ライセンスが設定されている
100文字以上の説明がある
GitHub Stars 100以上
3ヶ月以内に更新がある
10回以上フォークされている
オープンIssueが50未満
プログラミング言語が設定されている
1つ以上のタグが設定されている
レビュー
レビュー機能は近日公開予定です