mirror of
https://github.com/obra/superpowers.git
synced 2026-06-18 16:49:04 +08:00
Compare commits
1 Commits
codex/pri-
...
codex/pri-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0ebbf5ba0 |
@@ -52,9 +52,11 @@ EXCLUDES=(
|
|||||||
"/.gitattributes"
|
"/.gitattributes"
|
||||||
"/.github/"
|
"/.github/"
|
||||||
"/.gitignore"
|
"/.gitignore"
|
||||||
|
"/.gitmodules"
|
||||||
"/.kimi-plugin/"
|
"/.kimi-plugin/"
|
||||||
"/.opencode/"
|
"/.opencode/"
|
||||||
"/.pi/"
|
"/.pi/"
|
||||||
|
"/.pre-commit-config.yaml"
|
||||||
"/.version-bump.json"
|
"/.version-bump.json"
|
||||||
"/.worktrees/"
|
"/.worktrees/"
|
||||||
".DS_Store"
|
".DS_Store"
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
# through the controller's context.
|
# through the controller's context.
|
||||||
#
|
#
|
||||||
# Usage: task-brief PLAN_FILE TASK_NUMBER [OUTFILE]
|
# Usage: task-brief PLAN_FILE TASK_NUMBER [OUTFILE]
|
||||||
# Default OUTFILE: <git-dir>/sdd/task-<N>.<unique>/task-<N>-brief.md.
|
# Default OUTFILE: <git-dir>/sdd/task-<N>-brief.md — unique per repo
|
||||||
|
# instance, so concurrent sessions cannot collide.
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
if [ $# -lt 2 ] || [ $# -gt 3 ]; then
|
if [ $# -lt 2 ] || [ $# -gt 3 ]; then
|
||||||
@@ -22,8 +23,7 @@ else
|
|||||||
dir=$(git rev-parse --git-path sdd)
|
dir=$(git rev-parse --git-path sdd)
|
||||||
mkdir -p "$dir"
|
mkdir -p "$dir"
|
||||||
dir=$(cd "$dir" && pwd)
|
dir=$(cd "$dir" && pwd)
|
||||||
brief_dir=$(mktemp -d "$dir/task-${n}.XXXXXX")
|
out="$dir/task-${n}-brief.md"
|
||||||
out="$brief_dir/task-${n}-brief.md"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
awk -v n="$n" '
|
awk -v n="$n" '
|
||||||
|
|||||||
@@ -1,117 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
||||||
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
||||||
TASK_BRIEF="$REPO_ROOT/skills/subagent-driven-development/scripts/task-brief"
|
|
||||||
|
|
||||||
FAILURES=0
|
|
||||||
TEST_ROOT=""
|
|
||||||
|
|
||||||
pass() {
|
|
||||||
echo " [PASS] $1"
|
|
||||||
}
|
|
||||||
|
|
||||||
fail() {
|
|
||||||
echo " [FAIL] $1"
|
|
||||||
FAILURES=$((FAILURES + 1))
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanup() {
|
|
||||||
if [[ -n "$TEST_ROOT" && -d "$TEST_ROOT" ]]; then
|
|
||||||
rm -rf "$TEST_ROOT"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
extract_written_path() {
|
|
||||||
local output="$1"
|
|
||||||
printf '%s\n' "$output" | sed -n 's/^wrote \(.*\): [0-9][0-9]* lines$/\1/p'
|
|
||||||
}
|
|
||||||
|
|
||||||
assert_not_equals() {
|
|
||||||
local actual="$1"
|
|
||||||
local expected="$2"
|
|
||||||
local description="$3"
|
|
||||||
|
|
||||||
if [[ "$actual" != "$expected" ]]; then
|
|
||||||
pass "$description"
|
|
||||||
else
|
|
||||||
fail "$description"
|
|
||||||
echo " both were: $actual"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
assert_file_contains() {
|
|
||||||
local path="$1"
|
|
||||||
local needle="$2"
|
|
||||||
local description="$3"
|
|
||||||
|
|
||||||
if grep -Fq -- "$needle" "$path"; then
|
|
||||||
pass "$description"
|
|
||||||
else
|
|
||||||
fail "$description"
|
|
||||||
echo " expected $path to contain: $needle"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
|
||||||
echo "=== Test: task-brief output paths ==="
|
|
||||||
|
|
||||||
TEST_ROOT="$(mktemp -d)"
|
|
||||||
trap cleanup EXIT
|
|
||||||
|
|
||||||
local repo="$TEST_ROOT/repo"
|
|
||||||
local plan="$repo/plan.md"
|
|
||||||
local output_one
|
|
||||||
local output_two
|
|
||||||
local path_one
|
|
||||||
local path_two
|
|
||||||
|
|
||||||
git init -q -b main "$repo"
|
|
||||||
|
|
||||||
cat > "$plan" <<'EOF'
|
|
||||||
# Implementation Plan
|
|
||||||
|
|
||||||
## Task 1: First thing
|
|
||||||
|
|
||||||
Do the first thing.
|
|
||||||
|
|
||||||
## Task 2: Second thing
|
|
||||||
|
|
||||||
Do the second thing.
|
|
||||||
EOF
|
|
||||||
|
|
||||||
output_one="$(cd "$repo" && "$TASK_BRIEF" "$plan" 1)"
|
|
||||||
output_two="$(cd "$repo" && "$TASK_BRIEF" "$plan" 1)"
|
|
||||||
path_one="$(extract_written_path "$output_one")"
|
|
||||||
path_two="$(extract_written_path "$output_two")"
|
|
||||||
|
|
||||||
assert_not_equals "$path_one" "$path_two" "Default task brief paths are unique per invocation"
|
|
||||||
assert_file_contains "$path_one" "## Task 1: First thing" "First default brief contains the requested task"
|
|
||||||
assert_file_contains "$path_two" "## Task 1: First thing" "Second default brief contains the requested task"
|
|
||||||
|
|
||||||
if [[ "$path_one" == "$repo/.git/sdd/"* ]]; then
|
|
||||||
pass "First default brief stays under the repo git metadata directory"
|
|
||||||
else
|
|
||||||
fail "First default brief stays under the repo git metadata directory"
|
|
||||||
echo " actual: $path_one"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$path_two" == "$repo/.git/sdd/"* ]]; then
|
|
||||||
pass "Second default brief stays under the repo git metadata directory"
|
|
||||||
else
|
|
||||||
fail "Second default brief stays under the repo git metadata directory"
|
|
||||||
echo " actual: $path_two"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $FAILURES -ne 0 ]]; then
|
|
||||||
echo ""
|
|
||||||
echo "FAILED: $FAILURES assertion(s) failed."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "PASS"
|
|
||||||
}
|
|
||||||
|
|
||||||
main "$@"
|
|
||||||
@@ -200,6 +200,23 @@ EOF
|
|||||||
.private-journal/
|
.private-journal/
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
cat > "$repo/.gitmodules" <<'EOF'
|
||||||
|
[submodule "evals"]
|
||||||
|
path = evals
|
||||||
|
url = git@example.com:example/evals.git
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat > "$repo/.pre-commit-config.yaml" <<'EOF'
|
||||||
|
repos:
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: evals-check
|
||||||
|
name: evals check
|
||||||
|
entry: echo evals
|
||||||
|
language: system
|
||||||
|
files: ^evals/
|
||||||
|
EOF
|
||||||
|
|
||||||
if [[ "$with_pure_ignored" == "1" ]]; then
|
if [[ "$with_pure_ignored" == "1" ]]; then
|
||||||
cat >> "$repo/.gitignore" <<'EOF'
|
cat >> "$repo/.gitignore" <<'EOF'
|
||||||
ignored-cache/
|
ignored-cache/
|
||||||
@@ -277,6 +294,8 @@ EOF
|
|||||||
.codex-plugin/plugin.json \
|
.codex-plugin/plugin.json \
|
||||||
.kimi-plugin/plugin.json \
|
.kimi-plugin/plugin.json \
|
||||||
.gitignore \
|
.gitignore \
|
||||||
|
.gitmodules \
|
||||||
|
.pre-commit-config.yaml \
|
||||||
assets/app-icon.png \
|
assets/app-icon.png \
|
||||||
assets/superpowers-small.svg \
|
assets/superpowers-small.svg \
|
||||||
evals/drill/README.md \
|
evals/drill/README.md \
|
||||||
@@ -643,6 +662,8 @@ main() {
|
|||||||
assert_not_contains "$preview_section" ".private-journal/leak.txt" "Preview excludes ignored untracked file"
|
assert_not_contains "$preview_section" ".private-journal/leak.txt" "Preview excludes ignored untracked file"
|
||||||
assert_not_contains "$preview_section" "ignored-cache/" "Preview excludes pure ignored directories"
|
assert_not_contains "$preview_section" "ignored-cache/" "Preview excludes pure ignored directories"
|
||||||
assert_not_contains "$preview_section" "evals/" "Preview excludes eval harness"
|
assert_not_contains "$preview_section" "evals/" "Preview excludes eval harness"
|
||||||
|
assert_not_contains "$preview_section" ".gitmodules" "Preview excludes repo submodule metadata"
|
||||||
|
assert_not_contains "$preview_section" ".pre-commit-config.yaml" "Preview excludes repo pre-commit config"
|
||||||
assert_not_contains "$preview_output" "Overlay file (.codex-plugin/plugin.json) will be regenerated" "Preview omits overlay regeneration note"
|
assert_not_contains "$preview_output" "Overlay file (.codex-plugin/plugin.json) will be regenerated" "Preview omits overlay regeneration note"
|
||||||
assert_not_contains "$preview_output" "Assets (superpowers-small.svg, app-icon.png) will be seeded from" "Preview omits assets seeding note"
|
assert_not_contains "$preview_output" "Assets (superpowers-small.svg, app-icon.png) will be seeded from" "Preview omits assets seeding note"
|
||||||
assert_contains "$preview_section" "skills/example/SKILL.md" "Preview reflects dirty tracked destination file"
|
assert_contains "$preview_section" "skills/example/SKILL.md" "Preview reflects dirty tracked destination file"
|
||||||
|
|||||||
Reference in New Issue
Block a user