Some checks are pending
Create Release / Check if Version Bump PR Merged (push) Waiting to run
Create Release / Create Git Tag and GitHub Release (push) Blocked by required conditions
Post-Merge Version Bump / Check if Version Bump Needed (push) Waiting to run
Post-Merge Version Bump / Create Version Bump PR (push) Blocked by required conditions
The novel-writing agent pack existed only as three byte-identical copies inside
Obsidian vaults (Die-Kessler-Zwillinge, Scruffy-der-Weltenhund, OpenNovelWriter),
with no version control anywhere. It is now versioned here as the single source
of truth.
Contents (novel/):
- .opencode/agent/ OpenNovelAgent (primary) + LineEditor, Proofreader,
StyleAnalyst, ContinuityEditor, StoryReviewer, Translator, Importer,
Illustrator, CopyrightWatchdog
- .opencode/command/ import.md, init.md
- .opencode/languages.yaml, .opencode/opencode.json (pristine: default_agent)
- docs/SCHEMA.md canonical schema — the newer OpenNovelWriter revision, which
supersedes the stale copy in the Scruffy vault (adds workspace = book,
images/prompts + images/generated, parallel books, rewrites section 7)
- templates/ AGENTS.md placeholder + DATA/{wiki,timeline,glossary}.yaml.md, style.md
- sync-to-vault.sh dry-run by default; --apply backs up what it replaces and
never touches DATA/, AGENTS.md, chapters or a vault's own opencode.json
- PACK-NOTES.md per-file md5 provenance and the verified cross-vault comparison
Verified before committing: all 10 agents, both commands, languages.yaml and
start.sh are md5-identical across the three vaults.
82 lines
2.5 KiB
Bash
Executable file
82 lines
2.5 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Sync the OpenNovelWriter agent pack from this repo into an Obsidian vault.
|
|
#
|
|
# sync-to-vault.sh <vault-path> # dry run: report what differs
|
|
# sync-to-vault.sh <vault-path> --apply # write, backing up what it replaces
|
|
#
|
|
# Overwrites ONLY: .opencode/agent/*, .opencode/command/*, .opencode/languages.yaml,
|
|
# docs/SCHEMA.md, start.sh
|
|
# Never touches: DATA/, AGENTS.md, 01/, Notizen/, Welt/, .obsidian/, the vault's own
|
|
# .opencode/*.json (created only if missing)
|
|
set -euo pipefail
|
|
|
|
PACK="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
VAULT="${1:-}"
|
|
APPLY="${2:-}"
|
|
if [ -z "$VAULT" ] || [ ! -d "$VAULT" ]; then
|
|
echo "usage: $(basename "$0") <vault-path> [--apply]" >&2
|
|
exit 2
|
|
fi
|
|
if [ "$APPLY" != "" ] && [ "$APPLY" != "--apply" ]; then
|
|
echo "unknown option: $APPLY (use --apply to write)" >&2
|
|
exit 2
|
|
fi
|
|
|
|
STAMP="$(date +%Y%m%d-%H%M%S)"
|
|
BACKUP="$VAULT/.pack-backup/$STAMP"
|
|
|
|
MANAGED=(
|
|
".opencode/languages.yaml"
|
|
"docs/SCHEMA.md"
|
|
"start.sh"
|
|
".opencode/opencode.json" # created only if missing
|
|
)
|
|
for d in ".opencode/agent" ".opencode/command"; do
|
|
for f in "$PACK/$d"/*; do
|
|
[ -e "$f" ] && MANAGED+=("$d/$(basename "$f")")
|
|
done
|
|
done
|
|
|
|
md5of() { [ -f "$1" ] && md5 -q "$1" || echo "-"; }
|
|
|
|
mode="DRY RUN (nothing will be written — add --apply)"
|
|
[ "$APPLY" = "--apply" ] && mode="APPLY"
|
|
echo "vault : $VAULT"
|
|
echo "pack : $PACK"
|
|
echo "mode : $mode"
|
|
echo
|
|
|
|
same=0; changed=0; missing=0; skipped=0
|
|
for rel in "${MANAGED[@]}"; do
|
|
src="$PACK/$rel"; dst="$VAULT/$rel"
|
|
# never clobber an existing instance config
|
|
if [ "$rel" = ".opencode/opencode.json" ] && [ -f "$dst" ]; then
|
|
echo " keep $rel (vault's own config preserved)"
|
|
skipped=$((skipped+1)); continue
|
|
fi
|
|
if [ ! -f "$dst" ]; then
|
|
state="new"; missing=$((missing+1))
|
|
elif [ "$(md5of "$src")" = "$(md5of "$dst")" ]; then
|
|
state="same"; same=$((same+1))
|
|
else
|
|
state="UPDATE"; changed=$((changed+1))
|
|
fi
|
|
printf " %-7s %s\n" "$state" "$rel"
|
|
if [ "$APPLY" = "--apply" ] && [ "$state" != "same" ]; then
|
|
if [ -f "$dst" ]; then
|
|
mkdir -p "$(dirname "$BACKUP/$rel")"
|
|
cp -p "$dst" "$BACKUP/$rel"
|
|
fi
|
|
mkdir -p "$(dirname "$dst")"
|
|
cp -p "$src" "$dst"
|
|
fi
|
|
done
|
|
|
|
echo
|
|
echo "identical: $same to update: $changed missing: $missing kept local: $skipped"
|
|
if [ "$APPLY" = "--apply" ]; then
|
|
[ -d "$BACKUP" ] && echo "replaced files backed up to: $BACKUP"
|
|
echo "verify with: opencode agent list (in $VAULT)"
|
|
else
|
|
echo "run again with --apply to write these changes"
|
|
fi
|