tools: add repl-block, check-tangle; move existing tools into memex
New tools (projects/<tool>/ — standalone, git-committed): - repl-block: extract and pipe lisp blocks from org files to the REPL - check-tangle: tangle + compile in one step, reports errors Existing tools moved from ~/.opencode/bin/ into memex (survives reinstalls): - repl, tangle, org-eval, verify-repl AGENTS.md updated: - Tool reference table with all 7 tools - Package reference table for passepartout and cl-tty - Updated tangle command to use project-local tools .opencode/commands/ added: check-parens, repl-block, check-tangle commands
This commit is contained in:
43
projects/org-eval-tool/org-eval
Executable file
43
projects/org-eval-tool/org-eval
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
# Evaluate an org src block using Emacs batch mode
|
||||
# Usage: org-eval <org-file> [block-index]
|
||||
# If block-index is not provided, evaluates all blocks
|
||||
|
||||
set -e
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "Usage: org-eval <org-file> [block-index]"
|
||||
echo " Evaluates src blocks in the org file"
|
||||
echo " If block-index is omitted, evaluates ALL blocks"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ORG_FILE="$1"
|
||||
BLOCK_INDEX="${2:-}"
|
||||
|
||||
if [ ! -f "$ORG_FILE" ]; then
|
||||
echo "Error: File not found: $ORG_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Evaluating: $ORG_FILE"
|
||||
|
||||
if [ -n "$BLOCK_INDEX" ]; then
|
||||
# Evaluate specific block
|
||||
emacs --batch \
|
||||
--load org \
|
||||
--eval "(setq org-confirm-babel-evaluate nil)" \
|
||||
--eval "(with-current-buffer (find-file-noselect \"$ORG_FILE\") \
|
||||
(goto-char (point-min)) \
|
||||
(dotimes (_ $BLOCK_INDEX) \
|
||||
(org-babel-next-src-block)) \
|
||||
(org-babel-execute-src-block))"
|
||||
else
|
||||
# Evaluate all blocks
|
||||
emacs --batch \
|
||||
--load org \
|
||||
--eval "(setq org-confirm-babel-evaluate nil)" \
|
||||
--eval "(org-babel-execute-buffer)"
|
||||
fi
|
||||
|
||||
echo "Done."
|
||||
Reference in New Issue
Block a user