write-to-vault.sh bash
44 lines 1.6 KB
Raw
sha256:b5f647cb9c409f563d4671fe3fc05ddea01fabfed9b41fc11cb923588e1c1baf mirror: GitHub Phase A durable MCP OAuth (#270) Human minor ⚠ breaking 10 days ago
1 #!/usr/bin/env bash
2 # Write content from stdin into the Knowtation vault with frontmatter.
3 # Use from agent orchestration (e.g. AgentCeption) to write phase summaries,
4 # plans, or decisions into the vault so they are searchable later.
5 #
6 # Usage:
7 # echo "Phase 1 summary: ..." | ./scripts/write-to-vault.sh vault/projects/myapp/decisions/phase-1.md --source agentception --project myapp
8 # cat plan-summary.md | ./scripts/write-to-vault.sh vault/projects/myapp/plans/2026-03-13.md --source agentception --project myapp --date 2026-03-13
9 #
10 # Requires: KNOWTATION_VAULT_PATH set (or config); knowtation CLI on PATH.
11
12 set -e
13
14 if [[ $# -lt 1 ]]; then
15 echo "Usage: $0 <vault-relative-path> [--source SOURCE] [--project PROJECT] [--date DATE] [--tag TAGS]" >&2
16 echo " Reads body from stdin. Pass optional frontmatter as --key value." >&2
17 exit 1
18 fi
19
20 PATH_ARG="$1"
21 shift
22
23 FRONTMATTER=()
24 while [[ $# -gt 0 ]]; do
25 case "$1" in
26 --source) FRONTMATTER+=(--frontmatter "source=$2"); shift 2 ;;
27 --project) FRONTMATTER+=(--frontmatter "project=$2"); shift 2 ;;
28 --date) FRONTMATTER+=(--frontmatter "date=$2"); DATE_SET=1; shift 2 ;;
29 --tag) FRONTMATTER+=(--frontmatter "tags=$2"); shift 2 ;;
30 *) echo "Unknown option: $1" >&2; exit 1 ;;
31 esac
32 done
33
34 # Ensure date if not provided (ISO date today)
35 if [[ -z "${DATE_SET:-}" ]]; then
36 FRONTMATTER+=(--frontmatter "date=$(date -u +%Y-%m-%d)")
37 fi
38
39 if ! command -v knowtation &>/dev/null; then
40 echo "Error: knowtation CLI not on PATH. Set KNOWTATION_VAULT_PATH and ensure knowtation is installed." >&2
41 exit 2
42 fi
43
44 knowtation write "$PATH_ARG" --stdin "${FRONTMATTER[@]}"
File History 4 commits
sha256:b5f647cb9c409f563d4671fe3fc05ddea01fabfed9b41fc11cb923588e1c1baf mirror: GitHub Phase A durable MCP OAuth (#270) Human minor 10 days ago
sha256:d8c648b20a4d53b2673c5c082ee7edfa7b2fc9b11080832da1f38807b6bf940b fix(7C-L1b): route hosted delegation proposals through cani… Human minor 29 days ago
sha256:2827ba9e7632a4b141c50caf1e8f7d77abbc3515be20e7465f2bccb0ac4edf91 fix: repair endpoint now sets has_active_subscription when … Human minor 49 days ago