fix repl-block, check-tangle, commands: READMEs, exit codes, path resolution

repl-block:
- Listing mode exits 0, not 1 (listing is not an error)
- Dead lines parameter removed from find_by_function
- Block listing goes to stderr (not stdout) so piped use works
- Added README.org

check-tangle:
- Fixed tangle tool resolution: prefer local projects/tangle-tool/tangle
- Fixed path resolution for relative and absolute tangle paths
- Removed 2>/dev/null suppression so tangle errors are visible
- Added README.org

Commands:
- Rewrote all three .opencode/commands/*.md with proper prompts
This commit is contained in:
2026-05-13 12:57:06 -04:00
parent c9cc874e53
commit a2a7b4ca08
7 changed files with 93 additions and 16 deletions

View File

@@ -0,0 +1,22 @@
#+TITLE: check-tangle
Tangle an .org file and compile the resulting .lisp with SBCL in one step.
== Usage
#+begin_src shell
check-tangle org/file.org
#+end_src
Exit 0 if compilation succeeds, 1 if tangling or compilation fails.
== What it checks
1. Reads the ~:tangle~ header from the org file to find the target .lisp path
2. Runs ~tangle~ to generate the .lisp from the .org source
3. Runs ~sbcl compile-file~ on the result
4. Reports the first compile error if any
== Requires
Emacs (for tangling), SBCL (for compilation).

View File

@@ -28,13 +28,26 @@ fi
# Resolve relative tangle path
ORG_DIR=$(dirname "$ORG_FILE")
LISP_FILE=$(cd "$ORG_DIR" && realpath -m "$TANGLE" 2>/dev/null || echo "$ORG_DIR/$TANGLE")
if [ "$TANGLE" = "${TANGLE#/}" ]; then
# Relative path
LISP_FILE=$(cd "$ORG_DIR" && realpath -m "$TANGLE" 2>/dev/null || echo "$ORG_DIR/$TANGLE")
else
# Absolute path
LISP_FILE="$TANGLE"
fi
echo "Tangling: $ORG_FILE → $LISP_FILE" >&2
# Tangle using opencode's tangle tool
TANGLE_CMD=$(command -v tangle 2>/dev/null || echo "/home/user/.opencode/bin/tangle")
if ! "$TANGLE_CMD" "$ORG_FILE" 2>/dev/null; then
# Prefer the memex's own tangle tool, then fall back to PATH
if [ -x "projects/tangle-tool/tangle" ]; then
TANGLE_CMD="projects/tangle-tool/tangle"
elif command -v tangle &>/dev/null; then
TANGLE_CMD="tangle"
else
TANGLE_CMD="/home/user/.opencode/bin/tangle"
fi
if ! "$TANGLE_CMD" "$ORG_FILE"; then
echo "FAIL: Tangling $ORG_FILE failed" >&2
exit 1
fi