-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·60 lines (57 loc) · 3.46 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·60 lines (57 loc) · 3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/sh
# Installs the PDD kit into a target project:
# SPECS/{CONSTITUTION.md,REGULATIONS.md,FEATURES/,TASKS/} — the corpus (seeded; existing files untouched)
# SPECS/.pdd.conf — corpus config: language packs (PDD_LANGS),
# conception depth (PDD_DEPTH)
# .pdd/{templates,scripts,docs,lang,prompts} — templates, scripts, docs, language packs, judge prompt
# .claude/commands/*.md — slash commands (/feature /task /uphold /close /calibrate /backfill /inspect /audit)
# .git/hooks/prepare-commit-msg — strips IDE trailers (if the project is a git repo)
# Running again = upgrade: .pdd/ and the commands are refreshed, the corpus is never overwritten.
# Usage: install.sh TARGET_PROJECT_DIR [LANGS]
# LANGS — space-separated language packs, first = primary (ledger language).
# Available: see lang/*.sh. Default: "en". Example: install.sh . "ru en"
set -e
TARGET="${1:?usage: install.sh TARGET_PROJECT_DIR [LANGS]}"
LANGS="${2:-en}"
[ -d "$TARGET" ] || { echo "FAIL: no such directory: $TARGET" >&2; exit 1; }
SRC="$(cd "$(dirname "$0")" && pwd)"
for L in $LANGS; do
[ -f "$SRC/lang/$L.sh" ] || { echo "FAIL: unknown language pack: $L (have: $(ls "$SRC/lang" | sed 's/\.sh$//' | tr '\n' ' '))" >&2; exit 1; }
done
# --- framework: always refreshed ---
rm -rf "$TARGET/.pdd"
mkdir -p "$TARGET/.pdd" "$TARGET/.claude/commands"
cp -R "$SRC/templates" "$SRC/scripts" "$SRC/docs" "$SRC/lang" "$SRC/prompts" "$TARGET/.pdd/"
chmod +x "$TARGET/.pdd/scripts/"*.sh
cp "$SRC/commands/"*.md "$TARGET/.claude/commands/"
# --- corpus: seeded, existing files untouched ---
mkdir -p "$TARGET/SPECS/FEATURES" "$TARGET/SPECS/TASKS"
[ -f "$TARGET/SPECS/CONSTITUTION.md" ] || cp "$SRC/templates/constitution.md" "$TARGET/SPECS/CONSTITUTION.md"
[ -f "$TARGET/SPECS/REGULATIONS.md" ] || cp "$SRC/templates/regulations.md" "$TARGET/SPECS/REGULATIONS.md"
if [ -f "$TARGET/SPECS/.pdd.conf" ]; then
echo " = SPECS/.pdd.conf (kept; edit PDD_LANGS / PDD_DEPTH there)"
grep -q '^PDD_DEPTH=' "$TARGET/SPECS/.pdd.conf" || {
printf '\n# PDD_DEPTH: how independent the voices are (thrifty|standard|greedy).\n# See docs/conception.md — the cost is tokens, the payoff is that roles\n# genuinely disagree instead of one agent agreeing with itself.\nPDD_DEPTH="standard"\n' >> "$TARGET/SPECS/.pdd.conf"
echo " + PDD_DEPTH=\"standard\" appended to SPECS/.pdd.conf"
}
else
{
printf '# PDD corpus config.\n'
printf '# PDD_LANGS: selected language packs, first = primary.\n'
printf 'PDD_LANGS="%s"\n\n' "$LANGS"
printf '# PDD_DEPTH: how independent the voices are (thrifty|standard|greedy).\n'
printf '# See docs/conception.md — the cost is tokens, the payoff is that roles\n'
printf '# genuinely disagree instead of one agent agreeing with itself.\n'
printf 'PDD_DEPTH="standard"\n'
} > "$TARGET/SPECS/.pdd.conf"
echo " + SPECS/.pdd.conf (PDD_LANGS=\"$LANGS\", PDD_DEPTH=\"standard\")"
fi
if [ -d "$TARGET/.git" ]; then
cp "$SRC/hooks/prepare-commit-msg" "$TARGET/.git/hooks/prepare-commit-msg"
chmod +x "$TARGET/.git/hooks/prepare-commit-msg"
fi
echo "OK: PDD installed into $TARGET (languages: $LANGS)"
echo " commands: /feature /task /uphold /close /calibrate /backfill /inspect /audit"
echo " housekeeping: $TARGET/.pdd/scripts/ (check-uphold.sh, check-promises.sh, corpus-map.sh)"
echo " fill in the author documents: SPECS/CONSTITUTION.md, SPECS/REGULATIONS.md"
echo " lifecycle: $TARGET/.pdd/docs/workflow.md"