Ariver
2026-08-25 418efa7113c42a1c575b2569edb018d480f7ddbf
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
SOURCE=${1:-}
STAGED_HTML=${2:-}
case "$#" in
  1) ;;
  2) ;;
  *)
    printf '%s\n' "Usage: sh symposium-publish.sh <source-note-path> [staged-html-path]" >&2
    exit 1
    ;;
esac
[ -n "$SOURCE" ] && { [ "$#" -eq 1 ] || [ -n "$STAGED_HTML" ]; } || {
  printf '%s\n' "Usage: sh symposium-publish.sh <source-note-path> [staged-html-path]" >&2
  exit 1
}
 
OBSIDIAN_CLI=${COPILOT_OBSIDIAN_CLI:-}
WORKSPACE_ROOT=${SYMPOSIUM_WORKSPACE_ROOT:-}
[ -n "$WORKSPACE_ROOT" ] || {
  printf '%s\n' "The owning Obsidian workspace is unavailable." >&2
  exit 1
}
 
[ -n "$OBSIDIAN_CLI" ] || {
  printf '%s\n' "A compatible Obsidian CLI is unavailable." >&2
  exit 1
}
 
cd "$WORKSPACE_ROOT" || {
  printf '%s\n' "The owning Obsidian workspace is unavailable." >&2
  exit 1
}
VAULT_NAME=${WORKSPACE_ROOT%/}
VAULT_NAME=${VAULT_NAME##*/}
[ -n "$VAULT_NAME" ] || {
  printf '%s\n' "The owning Obsidian vault is unavailable." >&2
  exit 1
}
 
SOURCE_B64=$(printf '%s' "$SOURCE" | base64 | tr -d '\r\n')
if [ "$#" -eq 1 ]; then
  CODE="(()=>{const decode=(value)=>new TextDecoder().decode(Uint8Array.from(atob(value),(char)=>char.charCodeAt(0)));const bridge=app.plugins.plugins.copilot?.symposiumAgentBridge;if(!bridge)throw new Error('Copilot Symposium host is unavailable.');return bridge.reviewAgentManage(decode('$SOURCE_B64')).then(JSON.stringify);})()"
else
  HTML_B64=$(printf '%s' "$STAGED_HTML" | base64 | tr -d '\r\n')
  CODE="(()=>{const decode=(value)=>new TextDecoder().decode(Uint8Array.from(atob(value),(char)=>char.charCodeAt(0)));const bridge=app.plugins.plugins.copilot?.symposiumAgentBridge;if(!bridge)throw new Error('Copilot Symposium host is unavailable.');return bridge.reviewAgentPublish(decode('$SOURCE_B64'),decode('$HTML_B64')).then(JSON.stringify);})()"
fi
 
CLI_OUTPUT=$("$OBSIDIAN_CLI" "vault=$VAULT_NAME" eval "code=$CODE") || exit $?
CLI_RESULT=$(printf '%s\n' "$CLI_OUTPUT" | sed -n '/^=> {/p' | sed -n '$p')
case "$CLI_RESULT" in
  "=> {"*)
    OUTCOME=${CLI_RESULT#"=> "}
    printf '%s\n' "$OUTCOME"
    exit 0
    ;;
  *)
    printf '%s\n' "Copilot could not complete the Symposium review." >&2
    exit 1
    ;;
esac