Add Context Studio Wizard — project scaffolding CLI
- wizard.sh: interactive bash wizard that scaffolds new CS projects - lib/: utils, core install, project structure, workflow generation - templates/: Dockerfile, devcontainer.json, agent presets (minimal/standard), system.json, roles, hook rules - README: setup, usage, mobility workflow Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
cd5b28919c
commit
09ff27be92
19 changed files with 1132 additions and 1 deletions
101
lib/project.sh
Normal file
101
lib/project.sh
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
#!/usr/bin/env bash
|
||||
# project.sh — create project directory and devcontainer
|
||||
|
||||
WIZARD_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
create_project_structure() {
|
||||
local project_dir="$1"
|
||||
local project_name="$2"
|
||||
|
||||
info "Creating project structure at $project_dir..."
|
||||
|
||||
mkdir -p "$project_dir/src"
|
||||
mkdir -p "$project_dir/.devcontainer"
|
||||
|
||||
# .gitignore
|
||||
cat > "$project_dir/.gitignore" <<'EOF'
|
||||
# Dependencies
|
||||
node_modules/
|
||||
.pnp/
|
||||
.pnp.js
|
||||
|
||||
# Build outputs
|
||||
dist/
|
||||
build/
|
||||
*.AppImage
|
||||
*.dmg
|
||||
*.exe
|
||||
|
||||
# Environment
|
||||
.env
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Runtime data
|
||||
workflow/data/registry.db
|
||||
workflow/users/*/session-history/
|
||||
|
||||
# Logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
EOF
|
||||
|
||||
# README
|
||||
cat > "$project_dir/README.md" <<EOF
|
||||
# $project_name
|
||||
|
||||
## Quick Start
|
||||
|
||||
### First time setup
|
||||
\`\`\`bash
|
||||
# Open in devcontainer (VS Code)
|
||||
code .
|
||||
# → Reopen in Container
|
||||
|
||||
# Or via CLI
|
||||
docker build -t $( slugify "$project_name" ) .devcontainer/
|
||||
docker run -it --rm \\
|
||||
-v "\$(pwd)":/workspace \\
|
||||
-v "\$HOME/.context-studio/core":/opt/context-studio/core \\
|
||||
-e ANTHROPIC_API_KEY="\$ANTHROPIC_API_KEY" \\
|
||||
$( slugify "$project_name" ) bash
|
||||
\`\`\`
|
||||
|
||||
### Start Context Studio
|
||||
\`\`\`bash
|
||||
CS_WORKFLOW_DIR=/workspace/workflow node /opt/context-studio/core/core/start.js
|
||||
\`\`\`
|
||||
|
||||
### Start headless (no Electron UI)
|
||||
\`\`\`bash
|
||||
CS_WORKFLOW_DIR=/workspace/workflow node /opt/context-studio/core/core/start.js --ui-mode=headless
|
||||
\`\`\`
|
||||
EOF
|
||||
|
||||
success "Project structure created"
|
||||
}
|
||||
|
||||
create_devcontainer() {
|
||||
local project_dir="$1"
|
||||
local project_name="$2"
|
||||
local slug
|
||||
slug="$(slugify "$project_name")"
|
||||
|
||||
info "Generating devcontainer config..."
|
||||
|
||||
# Dockerfile
|
||||
sed "s/{{PROJECT_SLUG}}/$slug/g" \
|
||||
"$WIZARD_DIR/templates/Dockerfile" \
|
||||
> "$project_dir/.devcontainer/Dockerfile"
|
||||
|
||||
# devcontainer.json
|
||||
sed "s/{{PROJECT_NAME}}/$project_name/g; s/{{PROJECT_SLUG}}/$slug/g" \
|
||||
"$WIZARD_DIR/templates/devcontainer.json" \
|
||||
> "$project_dir/.devcontainer/devcontainer.json"
|
||||
|
||||
success "Devcontainer config written to $project_dir/.devcontainer/"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue