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
10 changes: 10 additions & 0 deletions .awf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# AWF Configuration
# https://github.com/awf-project/cli

version: "1"

# Default log level: debug, info, warn, error
log_level: info

# Output format: text, json, table, quiet
output_format: text
14 changes: 14 additions & 0 deletions .awf/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# AWF Project Configuration
# https://github.com/awf-project/cli
#
# This file provides default values for workflow inputs.
# CLI --input flags override these values.
#
# IMPORTANT: Do not store secrets here - use environment variables instead.

# Workflow inputs - pre-populate values for awf run
# Uncomment and modify the examples below:
inputs:
# project: my-project
# environment: staging
# debug: false
46 changes: 46 additions & 0 deletions .awf/scripts/create-feature/validate-name.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash
set -e

# validate-name.sh — Derive or validate a devcontainer feature name
#
# Inputs (AWF interpolation):
# {{.inputs.description}} - Feature description (required)
# {{.inputs.name}} - Feature name override (optional, kebab-case)
#
# Output (stdout): plain feature ID (kebab-case, e.g. "zellij")

DESCRIPTION="{{.inputs.description}}"
NAME="{{.inputs.name}}"

if [ -z "$DESCRIPTION" ]; then
echo "ERROR: DESCRIPTION is required"
exit 1
fi

# Derive name from description if not provided
if [ -z "$NAME" ]; then
# Extract the tool/project name: take the word after "Installs" or first capitalized word
NAME=$(echo "$DESCRIPTION" \
| sed -E 's/^[Ii]nstalls?\s+//' \
| sed -E 's/^(the\s+|a\s+|an\s+)//i' \
| awk '{print $1}' \
| tr '[:upper:]' '[:lower:]' \
| sed -E 's/[^a-z0-9-]//g')
fi

# Validate: must be non-empty kebab-case
if [ -z "$NAME" ]; then
echo "ERROR: could not derive feature name from description: ${DESCRIPTION}"
exit 1
fi

if ! echo "$NAME" | grep -qE '^[a-z][a-z0-9-]*[a-z0-9]$'; then
# Single char names are also valid
if ! echo "$NAME" | grep -qE '^[a-z]$'; then
echo "ERROR: invalid feature name '${NAME}' — must be kebab-case (lowercase, hyphens, start with letter)"
exit 1
fi
fi

# Output just the ID (no JSON — output_format: json is only supported on agent steps)
printf '%s' "$NAME"
Loading
Loading