Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions src/ai-claude/NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
## Claude Code AI Feature

This feature installs [Anthropic's Claude Code](https://code.claude.com/docs/en/vs-code) CLI and VS Code extension with support for DuploCloud AI skills.

### What's Included

- **Claude Code CLI** - `@anthropic-ai/claude-code` npm package installed globally
- **VS Code Extension** - [Claude Code extension](https://marketplace.visualstudio.com/items?itemName=anthropic.claude-code) automatically installed
- **Skills Support** - Automatic installation of skills from [duplocloud/ai-ops](https://github.com/duplocloud/ai-ops)

### Usage in devcontainer.json

```json
{
"features": {
"ghcr.io/duplocloud/devcontainers/ai-claude:1": {
"skills": "tf-module,api-design"
}
}
}
```

### Options

- `skills` - Comma-separated list of skills to install (default: "")

### Skills Installation

Skills are installed to `~/.claude/skills/` during container creation. You can specify skills in two ways:

1. **Feature option**: Set the `skills` option in your devcontainer.json
2. **Environment variable**: Set `DUPLO_AI_SKILLS` in your devcontainer.json

Both sources are merged, so you can have a common set via environment variable and feature-specific additions via the option.

### Example: Installing Multiple Skills

```json
{
"containerEnv": {
"DUPLO_AI_SKILLS": "tf-module,api-design"
},
"features": {
"ghcr.io/duplocloud/devcontainers/ai-claude:1": {
"skills": "code-review"
}
}
}
```

This configuration installs all three skills: `tf-module`, `api-design`, and `code-review`.

### Skill Location

Claude Code discovers skills from multiple locations:
- **User skills**: `~/.claude/skills/` (installed by this feature)
- **Project skills**: `.claude/skills/` (commit to version control)
- **Plugin skills**: Provided by extensions

For more details on how Claude Code uses skills, see the [Skills documentation](https://code.claude.com/docs/en/skills).

### Available Skills

Skills are published in the [duplocloud/ai-ops releases](https://github.com/duplocloud/ai-ops/releases).

## References

- [Claude Code Documentation](https://code.claude.com/docs/en/vs-code)
- [Claude Code VS Code Extension](https://marketplace.visualstudio.com/items?itemName=anthropic.claude-code)
- [Claude Code Skills Guide](https://code.claude.com/docs/en/skills)
- [Agent Skills Standard](https://agentskills.io/)
23 changes: 23 additions & 0 deletions src/ai-claude/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"id": "ai-claude",
"version": "1.0.0",
"name": "Claude Code AI",
"description": "Anthropic's Claude Code CLI with VS Code integration and skills support",
"options": {
"skills": {
"type": "string",
"default": "",
"description": "Comma-separated list of skills to install (e.g., 'tf-module,api-design')"
}
},
"customizations": {
"vscode": {
"extensions": [
"anthropic.claude-code"
]
}
},
"dependsOn": {
"ghcr.io/duplocloud/devcontainers/ai:latest": {}
}
}
32 changes: 32 additions & 0 deletions src/ai-claude/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -e

echo "Installing Claude Code AI..."

# Install Claude Code CLI globally
echo "Installing @anthropic-ai/claude-code..."
npm install -g @anthropic-ai/claude-code

# Verify installation
if command -v claude-code &> /dev/null; then
echo "✓ Claude Code CLI installed successfully"
claude-code --version || true
else
echo "⚠ Claude Code CLI installation could not be verified"
fi

# Copy on-create script to shared location
FEATURE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cp "${FEATURE_DIR}/on-create.sh" /usr/local/share/ai-claude-on-create.sh
chmod +x /usr/local/share/ai-claude-on-create.sh

# Save feature options to config file for use during onCreate lifecycle hook
mkdir -p /usr/local/etc
cat <<EOF > /usr/local/etc/ai-claude-feature.conf
SKILLS="${SKILLS:-}"
EOF
chmod 644 /usr/local/etc/ai-claude-feature.conf

echo "Claude Code AI installed successfully!"
echo ""
echo "Note: Skills will be installed during container creation (on-create hook)"
82 changes: 82 additions & 0 deletions src/ai-claude/on-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!/usr/bin/env bash
set -e

echo "Installing Claude Code skills..."

# Use devcontainer environment variables with fallbacks
USER_HOME="${_REMOTE_USER_HOME:-$HOME}"
USER_NAME="${_REMOTE_USER:-$(whoami)}"

# Load feature configuration
if [ -f /usr/local/etc/ai-claude-feature.conf ]; then
source /usr/local/etc/ai-claude-feature.conf
fi

# Skills directory for Claude Code (user scope)
SKILLS_DIR="${USER_HOME}/.claude/skills"
mkdir -p "${USER_HOME}/.claude" "${SKILLS_DIR}"

# Get skills from option
FEATURE_SKILLS="${SKILLS:-}"

# Get skills from environment variable
ENV_SKILLS="${DUPLO_AI_SKILLS:-}"

# Merge skills from both sources
ALL_SKILLS=""
if [ -n "${FEATURE_SKILLS}" ]; then
ALL_SKILLS="${FEATURE_SKILLS}"
fi
if [ -n "${ENV_SKILLS}" ]; then
if [ -n "${ALL_SKILLS}" ]; then
ALL_SKILLS="${ALL_SKILLS},${ENV_SKILLS}"
else
ALL_SKILLS="${ENV_SKILLS}"
fi
fi

# If no skills specified, exit early
if [ -z "${ALL_SKILLS}" ]; then
echo "No skills specified. Skipping skill installation."
echo "To install skills, set 'skills' option or DUPLO_AI_SKILLS environment variable."
exit 0
fi

# Convert comma-separated list to array
IFS=',' read -ra SKILL_ARRAY <<< "${ALL_SKILLS}"

# Install each skill
INSTALLED_COUNT=0
FAILED_COUNT=0

for SKILL in "${SKILL_ARRAY[@]}"; do
# Trim whitespace
SKILL="$(echo "${SKILL}" | xargs)"

if [ -z "${SKILL}" ]; then
continue
fi

echo ""
echo "Installing skill: ${SKILL}"

if duplo-skills --dir "${SKILLS_DIR}" --skill "${SKILL}"; then
((INSTALLED_COUNT++))
else
echo "⚠ Failed to install skill: ${SKILL}"
((FAILED_COUNT++))
fi
done

echo ""
echo "========================================"
echo "Skills installation complete"
echo "========================================"
echo "Installed: ${INSTALLED_COUNT}"
echo "Failed: ${FAILED_COUNT}"
echo "Location: ${SKILLS_DIR}"
echo ""

if [ ${INSTALLED_COUNT} -gt 0 ]; then
echo "✓ Claude Code skills are ready to use"
fi
85 changes: 85 additions & 0 deletions src/ai-codex/NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
## OpenAI Codex AI Feature

This feature installs [OpenAI's Codex CLI](https://developers.openai.com/codex/skills/) with VS Code integration and support for DuploCloud AI skills.

### What's Included

- **Codex CLI** - `@openai/codex` npm package installed globally
- **VS Code Extension** - [ChatGPT extension](https://marketplace.visualstudio.com/items?itemName=openai.chatgpt) automatically installed
- **Skills Support** - Automatic installation of skills from [duplocloud/ai-ops](https://github.com/duplocloud/ai-ops)

### Usage in devcontainer.json

```json
{
"features": {
"ghcr.io/duplocloud/devcontainers/ai-codex:1": {
"skills": "tf-module,api-design"
}
}
}
```

### Options

- `skills` - Comma-separated list of skills to install (default: "")

### Skills Installation

Skills are installed to `$CODEX_HOME/skills/` (defaults to `~/.codex/skills/`) during container creation. You can specify skills in two ways:

1. **Feature option**: Set the `skills` option in your devcontainer.json
2. **Environment variable**: Set `DUPLO_AI_SKILLS` in your devcontainer.json

Both sources are merged, so you can have a common set via environment variable and feature-specific additions via the option.

### Example: Installing Multiple Skills

```json
{
"containerEnv": {
"DUPLO_AI_SKILLS": "tf-module,api-design"
},
"features": {
"ghcr.io/duplocloud/devcontainers/ai-codex:1": {
"skills": "code-review"
}
}
}
```

This configuration installs all three skills: `tf-module`, `api-design`, and `code-review`.

### Skill Location

Codex discovers skills from multiple scopes (in order of precedence):
- **Repo (CWD)**: `$CWD/.codex/skills` - Current working directory
- **Repo (Parent)**: `$CWD/../.codex/skills` - Parent folders
- **Repo (Root)**: `$REPO_ROOT/.codex/skills` - Git repository root
- **User**: `$CODEX_HOME/skills` (installed by this feature)
- **Admin**: `/etc/codex/skills` - System-wide
- **System**: Bundled with Codex

For more details on how Codex uses skills, see the [Agent Skills documentation](https://developers.openai.com/codex/skills/).

### Managing Skills

Skills can be enabled/disabled in `~/.codex/config.toml`:

```toml
[[skills.config]]
path = "/path/to/skill"
enabled = false
```

### Available Skills

Skills are published in the [duplocloud/ai-ops releases](https://github.com/duplocloud/ai-ops/releases).

## References

- [Codex Overview](https://developers.openai.com/codex)
- [ChatGPT VS Code Extension](https://marketplace.visualstudio.com/items?itemName=openai.chatgpt)
- [Codex Skills Guide](https://developers.openai.com/codex/skills/)
- [Codex IDE Integration](https://developers.openai.com/codex/ide/)
- [Agent Skills Standard](https://agentskills.io/)
23 changes: 23 additions & 0 deletions src/ai-codex/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"id": "ai-codex",
"version": "1.0.0",
"name": "OpenAI Codex AI",
"description": "OpenAI's Codex CLI with VS Code integration and skills support",
"options": {
"skills": {
"type": "string",
"default": "",
"description": "Comma-separated list of skills to install (e.g., 'tf-module,api-design')"
}
},
"customizations": {
"vscode": {
"extensions": [
"openai.chatgpt"
]
}
},
"dependsOn": {
"ghcr.io/duplocloud/devcontainers/ai:latest": {}
}
}
32 changes: 32 additions & 0 deletions src/ai-codex/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -e

echo "Installing OpenAI Codex AI..."

# Install Codex CLI globally
echo "Installing @openai/codex..."
npm install -g @openai/codex

# Verify installation
if command -v codex &> /dev/null; then
echo "✓ Codex CLI installed successfully"
codex --version || true
else
echo "⚠ Codex CLI installation could not be verified"
fi

# Copy on-create script to shared location
FEATURE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cp "${FEATURE_DIR}/on-create.sh" /usr/local/share/ai-codex-on-create.sh
chmod +x /usr/local/share/ai-codex-on-create.sh

# Save feature options to config file for use during onCreate lifecycle hook
mkdir -p /usr/local/etc
cat <<EOF > /usr/local/etc/ai-codex-feature.conf
SKILLS="${SKILLS:-}"
EOF
chmod 644 /usr/local/etc/ai-codex-feature.conf

echo "OpenAI Codex AI installed successfully!"
echo ""
echo "Note: Skills will be installed during container creation (on-create hook)"
Loading