contexthub-cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/ch +25 -0
- package/contexthub/__init__.py +3 -0
- package/contexthub/cli.py +1331 -0
- package/contexthub/core/__init__.py +0 -0
- package/contexthub/core/context.py +207 -0
- package/contexthub/core/git.py +173 -0
- package/contexthub/core/github.py +35 -0
- package/contexthub/core/models.py +81 -0
- package/contexthub/core/r2.py +221 -0
- package/contexthub/hooks.py +154 -0
- package/install.sh +44 -0
- package/package.json +22 -0
- package/requirements.txt +2 -0
package/bin/ch
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# ContextHub CLI wrapper — resolves symlinks to find the venv Python
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
# Resolve symlinks to find the real package directory.
|
|
6
|
+
# npm global install creates: <prefix>/bin/ch -> <prefix>/lib/node_modules/contexthub-cli/bin/ch
|
|
7
|
+
SOURCE="${BASH_SOURCE[0]}"
|
|
8
|
+
while [ -L "$SOURCE" ]; do
|
|
9
|
+
DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
|
|
10
|
+
SOURCE="$(readlink "$SOURCE")"
|
|
11
|
+
# If readlink is relative, resolve it relative to the symlink's dir
|
|
12
|
+
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE"
|
|
13
|
+
done
|
|
14
|
+
PACKAGE_DIR="$(cd -P "$(dirname "$SOURCE")/.." && pwd)"
|
|
15
|
+
|
|
16
|
+
VENV_PYTHON="$PACKAGE_DIR/.venv/bin/python3"
|
|
17
|
+
|
|
18
|
+
if [ ! -f "$VENV_PYTHON" ]; then
|
|
19
|
+
echo "error: ContextHub venv not found at $PACKAGE_DIR/.venv" >&2
|
|
20
|
+
echo "Try reinstalling: npm install -g contexthub-cli" >&2
|
|
21
|
+
exit 1
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
export PYTHONPATH="$PACKAGE_DIR${PYTHONPATH:+:$PYTHONPATH}"
|
|
25
|
+
exec "$VENV_PYTHON" -c "from contexthub.cli import cli; cli()" "$@"
|