fix(bootstrap): $HOME in fish + parity with sh; ignore Windows ADS
copilot-bootstrap.fish hatte /home/rd13server/.git-templates hartkodiert und legte nur .github/.vscode an. Jetzt $HOME und volle Funktions-Paritaet zu copilot-bootstrap.sh (--with-update-hook, data/, history/, docs/ USER+ADMIN+MAINTAINER, pre-commit/post-commit Hooks, .gitignore-Append). Zusaetzlich *:Zone.Identifier (Windows NTFS ADS) in .gitignore aufgenommen und vom Bootstrap in Ziel-Repos propagiert.
This commit is contained in:
parent
114bb5b22b
commit
80b6248fe3
2 changed files with 128 additions and 9 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,6 +1,9 @@
|
|||
.env
|
||||
*.local
|
||||
|
||||
# Windows Mark-of-the-Web / NTFS ADS cruft (entsteht beim Download/Entpacken auf NTFS)
|
||||
*:Zone.Identifier
|
||||
|
||||
# Persistente Service-Daten (nie committen!)
|
||||
data/**/*
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,30 @@
|
|||
#!/usr/bin/env fish
|
||||
# copilot-bootstrap.fish
|
||||
# Fügt Copilot-Grundkonfiguration zu einem bestehenden oder neu geklonten Repo hinzu.
|
||||
# Funktions-Parität mit copilot-bootstrap.sh (POSIX-Variante).
|
||||
#
|
||||
# Usage:
|
||||
# fish copilot-bootstrap.fish # aktuelles Verzeichnis
|
||||
# fish copilot-bootstrap.fish /path/to/repo # anderes Verzeichnis
|
||||
# fish copilot-bootstrap.fish # aktuelles Verzeichnis
|
||||
# fish copilot-bootstrap.fish /path/to/repo # anderes Verzeichnis
|
||||
# fish copilot-bootstrap.fish --with-update-hook # + post-merge Hook (auto-update nach git pull)
|
||||
|
||||
set TEMPLATE_DIR /home/rd13server/.git-templates
|
||||
set TARGET (test (count $argv) -gt 0; and echo $argv[1]; or echo (pwd))
|
||||
set TEMPLATE_DIR $HOME/.git-templates
|
||||
set WITH_UPDATE_HOOK 0
|
||||
set TARGET .
|
||||
|
||||
for arg in $argv
|
||||
switch $arg
|
||||
case --with-update-hook
|
||||
set WITH_UPDATE_HOOK 1
|
||||
case '-*'
|
||||
# andere Flags ignorieren
|
||||
case '*'
|
||||
set TARGET $arg
|
||||
end
|
||||
end
|
||||
|
||||
if not test -d "$TARGET/.git"
|
||||
echo "Error: $TARGET is not a git repository"
|
||||
echo "Error: $TARGET is not a git repository" >&2
|
||||
exit 1
|
||||
end
|
||||
|
||||
|
|
@ -20,7 +34,7 @@ echo "Bootstrapping Copilot config in: $TARGET"
|
|||
if not test -f "$TARGET/.github/copilot-instructions.md"
|
||||
mkdir -p "$TARGET/.github"
|
||||
cp "$TEMPLATE_DIR/.github/copilot-instructions.md" "$TARGET/.github/copilot-instructions.md"
|
||||
echo " ✓ .github/copilot-instructions.md created (fill in TODO sections)"
|
||||
echo " ✓ .github/copilot-instructions.md created (TODO-Felder ausfüllen)"
|
||||
else
|
||||
echo " ─ .github/copilot-instructions.md already exists, skipping"
|
||||
end
|
||||
|
|
@ -43,7 +57,109 @@ else
|
|||
echo " ─ .vscode/extensions.json already exists, skipping"
|
||||
end
|
||||
|
||||
# ── data/ – Persistente Service-Daten ────────────────────────────────────────
|
||||
if not test -d "$TARGET/data"
|
||||
mkdir -p "$TARGET/data"
|
||||
touch "$TARGET/data/.gitkeep"
|
||||
echo " ✓ data/ created (persistente Service-Daten – gitignored)"
|
||||
else
|
||||
echo " ─ data/ already exists, skipping"
|
||||
end
|
||||
|
||||
# ── history/ – Agent-History und Kontext-Summary ─────────────────────────────
|
||||
if not test -d "$TARGET/history/prompts"
|
||||
mkdir -p "$TARGET/history/prompts"
|
||||
echo " ✓ history/prompts/ created (Agent-Logs – committed)"
|
||||
end
|
||||
if not test -f "$TARGET/history/summary/PROJECT_CONTEXT.md"
|
||||
mkdir -p "$TARGET/history/summary"
|
||||
cp "$TEMPLATE_DIR/history/summary/PROJECT_CONTEXT.md" "$TARGET/history/summary/PROJECT_CONTEXT.md"
|
||||
echo " ✓ history/summary/PROJECT_CONTEXT.md created (Agent-Kontext – committed)"
|
||||
else
|
||||
echo " ─ history/summary/PROJECT_CONTEXT.md already exists, skipping"
|
||||
end
|
||||
|
||||
# ── docs/ – Zielgruppen-Dokumentation ────────────────────────────────────────
|
||||
if not test -d "$TARGET/docs"
|
||||
mkdir -p "$TARGET/docs"
|
||||
cp "$TEMPLATE_DIR/docs/USER.md" "$TARGET/docs/USER.md"
|
||||
cp "$TEMPLATE_DIR/docs/ADMIN.md" "$TARGET/docs/ADMIN.md"
|
||||
cp "$TEMPLATE_DIR/docs/MAINTAINER.md" "$TARGET/docs/MAINTAINER.md"
|
||||
echo " ✓ docs/ created with USER.md, ADMIN.md, MAINTAINER.md (TODO-Felder ausfüllen)"
|
||||
else
|
||||
# Fehlende Zielgruppen-Docs ergänzen ohne vorhandene zu überschreiben
|
||||
for doc in USER ADMIN MAINTAINER
|
||||
if not test -f "$TARGET/docs/$doc.md"
|
||||
cp "$TEMPLATE_DIR/docs/$doc.md" "$TARGET/docs/$doc.md"
|
||||
echo " ✓ docs/$doc.md created"
|
||||
else
|
||||
echo " ─ docs/$doc.md already exists, skipping"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# ── Git-Hooks – Quality Gate + History ───────────────────────────────────────
|
||||
mkdir -p "$TARGET/.git/hooks"
|
||||
if not test -f "$TARGET/.git/hooks/pre-commit"
|
||||
cp "$TEMPLATE_DIR/hooks/pre-commit" "$TARGET/.git/hooks/pre-commit"
|
||||
chmod +x "$TARGET/.git/hooks/pre-commit"
|
||||
echo " ✓ .git/hooks/pre-commit installed (Quality Gate: Tests + Docs)"
|
||||
else
|
||||
echo " ─ .git/hooks/pre-commit already exists, skipping"
|
||||
end
|
||||
if not test -f "$TARGET/.git/hooks/post-commit"; and test -f "$TEMPLATE_DIR/hooks/post-commit"
|
||||
cp "$TEMPLATE_DIR/hooks/post-commit" "$TARGET/.git/hooks/post-commit"
|
||||
chmod +x "$TARGET/.git/hooks/post-commit"
|
||||
echo " ✓ .git/hooks/post-commit installed (Auto-History-Log)"
|
||||
end
|
||||
|
||||
# ── post-merge Hook – opt-in: automatisches copilot-update nach git pull ──────
|
||||
if test "$WITH_UPDATE_HOOK" -eq 1
|
||||
if test -f "$TEMPLATE_DIR/hooks/post-merge"
|
||||
if not test -f "$TARGET/.git/hooks/post-merge"
|
||||
cp "$TEMPLATE_DIR/hooks/post-merge" "$TARGET/.git/hooks/post-merge"
|
||||
chmod +x "$TARGET/.git/hooks/post-merge"
|
||||
echo " ✓ .git/hooks/post-merge installed (Copilot-Update nach git pull)"
|
||||
else
|
||||
echo " ─ .git/hooks/post-merge already exists, skipping"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# ── .gitignore – data/ + Windows-ADS ausschließen ───────────────────────────
|
||||
set -g GITIGNORE "$TARGET/.gitignore"
|
||||
set -g GITIGNORE_UPDATED 0
|
||||
|
||||
# set -g, damit die Funktion den Zähler im Skript-Scope ändern kann (fish-Scoping)
|
||||
function _append_gitignore --argument-names pattern comment
|
||||
if not grep -qF "$pattern" "$GITIGNORE" 2>/dev/null
|
||||
printf '\n%s\n%s\n' "$comment" "$pattern" >> "$GITIGNORE"
|
||||
set -g GITIGNORE_UPDATED 1
|
||||
end
|
||||
end
|
||||
|
||||
_append_gitignore "data/**/*" "# Persistente Service-Daten (nie committen!)"
|
||||
_append_gitignore "!data/.gitkeep" ""
|
||||
_append_gitignore "*:Zone.Identifier" "# Windows Mark-of-the-Web / NTFS ADS cruft"
|
||||
|
||||
if test "$GITIGNORE_UPDATED" -eq 1
|
||||
echo " ✓ .gitignore aktualisiert (data/ + Windows-ADS excluded)"
|
||||
else
|
||||
echo " ─ .gitignore already has required entries, skipping"
|
||||
end
|
||||
|
||||
functions -e _append_gitignore
|
||||
|
||||
echo ""
|
||||
echo "Done. Next steps:"
|
||||
echo " 1. Fill in TODO sections in .github/copilot-instructions.md"
|
||||
echo " 2. git add .github .vscode && git commit -m 'chore: add copilot workspace config'"
|
||||
echo "Done. Nächste Schritte:"
|
||||
echo " 1. TODO-Felder ausfüllen:"
|
||||
echo " - .github/copilot-instructions.md"
|
||||
echo " - history/summary/PROJECT_CONTEXT.md"
|
||||
echo " - docs/USER.md, docs/ADMIN.md, docs/MAINTAINER.md"
|
||||
echo " 2. git add .github .vscode docs history .gitignore"
|
||||
echo " git commit -m 'chore: add copilot workspace config'"
|
||||
echo " 3. Templates aktuell halten: git copilot-update"
|
||||
echo ""
|
||||
echo " Hinweis: Git-Hooks (pre-commit, post-commit) werden NICHT automatisch"
|
||||
echo " aktualisiert wenn sie bereits existieren. Neue Hook-Versionen holen mit:"
|
||||
echo " git copilot-update"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue