dexbot 1.6.12 → 1.6.14
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/CHANGELOG.md +65 -1
- package/README.md +2 -2
- package/analysis/README.md +9 -11
- package/analysis/ama_fitting/README.md +5 -3
- package/claw/README.md +1 -0
- package/claw/docs/AI_BOT_LIBRARY_API.md +3 -1
- package/claw/docs/DEXBOT2_TUNING_CHEAT_SHEET.md +4 -4
- package/claw/modules/claw_bridge.ts +0 -3
- package/claw/modules/claw_catalog.ts +8 -4
- package/claw/modules/claw_skill_md.ts +1 -0
- package/claw/modules/dexbot_profiles.ts +59 -15
- package/claw/modules/types.ts +2 -1
- package/claw/package.json +3 -3
- package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
- package/claw/runtimes/openclaw-plugin/package.json +1 -1
- package/claw/skills/margin-trading/SKILL.md +1 -1
- package/claw/skills/margin-trading/references/position-management.md +1 -1
- package/claw/tsconfig.json +2 -2
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js +1 -14
- package/dist/analysis/ama_fitting/fetch_lp_candles.js +51 -41
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts +1 -24
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js +36 -18
- package/dist/analysis/ama_fitting/optimizer_high_resolution.js +18 -66
- package/dist/analysis/analyze_args.d.ts +12 -0
- package/dist/analysis/analyze_args.js +20 -0
- package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts +1 -16
- package/dist/analysis/bot_fitting/backtest_ama_sweep.js +20 -101
- package/dist/analysis/bot_fitting/backtest_bot_fitting.js +26 -92
- package/dist/analysis/bot_fitting/backtest_lookback_drawdown.js +19 -34
- package/dist/analysis/bot_fitting/shared_utils.d.ts +71 -3
- package/dist/analysis/bot_fitting/shared_utils.js +124 -8
- package/dist/analysis/chart_ui.d.ts +30 -1
- package/dist/analysis/chart_ui.js +37 -1
- package/dist/analysis/fills_cache.d.ts +3 -23
- package/dist/analysis/fills_cache.js +3 -84
- package/dist/analysis/fills_source.d.ts +31 -1
- package/dist/analysis/fills_source.js +69 -1
- package/dist/analysis/grid_correction_check.d.ts +1 -23
- package/dist/analysis/grid_correction_check.js +15 -58
- package/dist/analysis/math_utils.d.ts +85 -1
- package/dist/analysis/math_utils.js +116 -1
- package/dist/analysis/price_sources.d.ts +22 -1
- package/dist/analysis/price_sources.js +23 -0
- package/dist/analysis/resolve_source.js +31 -10
- package/dist/analysis/trade_profitability.d.ts +6 -0
- package/dist/analysis/trade_profitability.js +23 -97
- package/dist/analysis/tradingview/analyze_tradingview.d.ts +1 -17
- package/dist/analysis/tradingview/analyze_tradingview.js +1 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +27 -40
- package/dist/analysis/trend_detection/backtest_ama_slope_huber.d.ts +1 -101
- package/dist/analysis/trend_detection/backtest_ama_slope_huber.js +22 -80
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js +11 -37
- package/dist/analysis/trend_detection/volatility_chart_generator.js +9 -10
- package/dist/analysis/worker_pool.d.ts +38 -0
- package/dist/analysis/worker_pool.js +67 -0
- package/dist/dexbot.js +67 -48
- package/dist/market_adapter/ama_signal_runner.js +21 -54
- package/dist/market_adapter/candle_utils.d.ts +7 -1
- package/dist/market_adapter/candle_utils.js +11 -1
- package/dist/market_adapter/cli_args.d.ts +22 -0
- package/dist/market_adapter/cli_args.js +30 -0
- package/dist/market_adapter/core/config_normalizers.js +11 -6
- package/dist/market_adapter/core/kibana_candles.d.ts +3 -1
- package/dist/market_adapter/core/kibana_candles.js +3 -2
- package/dist/market_adapter/core/market_adapter_service.d.ts +85 -85
- package/dist/market_adapter/core/market_adapter_service.js +93 -158
- package/dist/market_adapter/core/signals/hurst_analyzer.d.ts +1 -6
- package/dist/market_adapter/core/signals/hurst_analyzer.js +1 -1
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.d.ts +1 -11
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.js +1 -1
- package/dist/market_adapter/inputs/fetch_book_data.js +0 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +63 -107
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts +8 -1
- package/dist/market_adapter/inputs/fetch_lp_data.js +25 -7
- package/dist/market_adapter/inputs/kibana_feed_source.js +4 -26
- package/dist/market_adapter/inputs/window_cache.d.ts +4 -72
- package/dist/market_adapter/inputs/window_cache.js +52 -177
- package/dist/market_adapter/interval_utils.d.ts +11 -1
- package/dist/market_adapter/interval_utils.js +16 -1
- package/dist/market_adapter/lp_chart_runner.d.ts +3 -0
- package/dist/market_adapter/lp_chart_runner.js +37 -19
- package/dist/market_adapter/market_adapter.js +27 -72
- package/dist/market_adapter/utils/data_discovery.d.ts +45 -1
- package/dist/market_adapter/utils/data_discovery.js +220 -27
- package/dist/market_adapter/utils/month_shards.d.ts +84 -0
- package/dist/market_adapter/utils/month_shards.js +237 -0
- package/dist/modules/account_bots.d.ts +8 -6
- package/dist/modules/account_bots.js +112 -131
- package/dist/modules/account_orders.d.ts +49 -4
- package/dist/modules/account_orders.js +114 -49
- package/dist/modules/bitshares-native/chain_client.d.ts +1 -1
- package/dist/modules/bitshares-native/chain_client.js +14 -13
- package/dist/modules/bitshares-native/crypto/ecc_core.d.ts +1 -2
- package/dist/modules/bitshares-native/crypto/ecc_core.js +1 -1
- package/dist/modules/bitshares-native/resolvers.js +22 -25
- package/dist/modules/bitshares-native/serial/chain_constants.d.ts +1 -2
- package/dist/modules/bitshares-native/serial/chain_constants.js +1 -2
- package/dist/modules/bitshares-native/serial/types.js +22 -50
- package/dist/modules/bitshares-native/signing_client.d.ts +1 -1
- package/dist/modules/bot_defaults.d.ts +18 -3
- package/dist/modules/bot_defaults.js +34 -8
- package/dist/modules/bot_settings.d.ts +5 -1
- package/dist/modules/bot_settings.js +55 -21
- package/dist/modules/broadcast_failure.d.ts +2 -1
- package/dist/modules/chain_orders.d.ts +1 -1
- package/dist/modules/chain_orders.js +51 -96
- package/dist/modules/cli_start_onboarding.d.ts +2 -1
- package/dist/modules/config.js +6 -1
- package/dist/modules/constants.d.ts +14 -6
- package/dist/modules/constants.js +32 -6
- package/dist/modules/cr_planner.d.ts +1 -1
- package/dist/modules/cr_planner.js +1 -5
- package/dist/modules/credit_pricing.d.ts +2 -1
- package/dist/modules/credit_pricing.js +36 -40
- package/dist/modules/credit_runtime.d.ts +7 -0
- package/dist/modules/credit_runtime.js +45 -73
- package/dist/modules/daemon_node_health.d.ts +4 -3
- package/dist/modules/dexbot_class.d.ts +33 -17
- package/dist/modules/dexbot_class.js +113 -61
- package/dist/modules/dexbot_cow_runtime.d.ts +62 -181
- package/dist/modules/dexbot_cow_runtime.js +380 -69
- package/dist/modules/dexbot_credential_client.d.ts +1 -23
- package/dist/modules/dexbot_credential_client.js +2 -3
- package/dist/modules/dexbot_fill_runtime.d.ts +2 -3
- package/dist/modules/dexbot_fill_runtime.js +17 -7
- package/dist/modules/dexbot_maintenance_runtime.d.ts +36 -81
- package/dist/modules/dexbot_maintenance_runtime.js +137 -133
- package/dist/modules/dexbot_startup_runtime.d.ts +0 -1
- package/dist/modules/dexbot_startup_runtime.js +25 -14
- package/dist/modules/dexbot_state_recovery.js +16 -0
- package/dist/modules/general_settings.d.ts +1 -1
- package/dist/modules/graceful_shutdown.js +17 -11
- package/dist/modules/key_store.d.ts +0 -5
- package/dist/modules/key_store.js +1 -2
- package/dist/modules/lazy_shim.d.ts +11 -0
- package/dist/modules/lazy_shim.js +16 -0
- package/dist/modules/node_connect_policy.d.ts +3 -2
- package/dist/modules/node_failure_ledger.d.ts +6 -5
- package/dist/modules/order/accounting.js +11 -11
- package/dist/modules/order/export.js +2 -2
- package/dist/modules/order/format.d.ts +26 -3
- package/dist/modules/order/format.js +33 -3
- package/dist/modules/order/genesis_policy.d.ts +4 -4
- package/dist/modules/order/genesis_policy.js +6 -3
- package/dist/modules/order/grid.d.ts +26 -12
- package/dist/modules/order/grid.js +468 -80
- package/dist/modules/order/grid_reconcile.d.ts +1 -1
- package/dist/modules/order/grid_reconcile.js +5 -5
- package/dist/modules/order/grid_reconcile_internal.js +48 -40
- package/dist/modules/order/index.d.ts +35 -8
- package/dist/modules/order/logger.d.ts +1 -8
- package/dist/modules/order/logger.js +2 -11
- package/dist/modules/order/manager.d.ts +18 -15
- package/dist/modules/order/manager.js +91 -74
- package/dist/modules/order/strategy.d.ts +2 -2
- package/dist/modules/order/strategy.js +51 -21
- package/dist/modules/order/sync_engine.js +4 -0
- package/dist/modules/order/utils/math.d.ts +3 -3
- package/dist/modules/order/utils/math.js +38 -27
- package/dist/modules/order/utils/order.d.ts +58 -58
- package/dist/modules/order/utils/order.js +158 -137
- package/dist/modules/order/utils/system.d.ts +202 -35
- package/dist/modules/order/utils/system.js +409 -31
- package/dist/modules/order/utils/validate.js +28 -6
- package/dist/modules/order/utils/withPoolRef.d.ts +2 -1
- package/dist/modules/paths.js +32 -34
- package/dist/modules/runtime_settings.d.ts +3 -5
- package/dist/modules/runtime_settings.js +3 -3
- package/dist/modules/settings_merge.d.ts +2 -2
- package/dist/modules/socket_json_client.d.ts +2 -1
- package/dist/modules/types.d.ts +89 -30
- package/dist/modules/utils/errors.js +1 -3
- package/dist/modules/version_notice.d.ts +11 -10
- package/dist/pm2.d.ts +0 -1
- package/dist/pm2.js +56 -35
- package/dist/scripts/analyze-git.js +2 -15
- package/dist/scripts/analyze-orders.d.ts +1 -1
- package/dist/scripts/analyze-orders.js +4 -4
- package/dist/scripts/chart_command.js +2 -2
- package/dist/scripts/check_any.d.ts +4 -0
- package/dist/scripts/check_any.js +53 -21
- package/dist/scripts/diagnose-pool-history.js +1 -6
- package/dist/scripts/divergence-calc.js +6 -6
- package/dist/scripts/run-tests.js +0 -1
- package/dist/scripts/sync-version.js +0 -10
- package/dist/scripts/validate_bots.d.ts +1 -1
- package/dist/scripts/validate_bots.js +3 -3
- package/dist/unlock.js +7 -2
- package/docs/BITSHARES_ONBOARDING.md +8 -12
- package/docs/COPY_ON_WRITE_MASTER_PLAN.md +2 -3
- package/docs/COW_INVARIANTS.md +6 -6
- package/docs/DEXBOT_COMPARISON.md +7 -7
- package/docs/EVOLUTION.md +10 -8
- package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +8 -6
- package/docs/GRID_PRICE_INVARIANT.md +3 -3
- package/docs/GRID_RECALCULATION.md +4 -1
- package/docs/GRID_RECONCILE.md +4 -4
- package/docs/LIFECYCLE.md +11 -11
- package/docs/LOGGING.md +14 -0
- package/docs/MPA_CREDIT_USAGE.md +1 -1
- package/docs/ORDER_ENGINE_POST_1.0_RETROSPECTIVE.md +12 -4
- package/docs/README.md +3 -3
- package/docs/WORKFLOW.md +1 -0
- package/docs/architecture.md +25 -16
- package/docs/developer_guide.md +7 -2
- package/market_adapter/README.md +6 -4
- package/package.json +6 -9
- package/scripts/README.md +43 -38
- package/tests/README.md +26 -11
- package/dist/scripts/diagnose-kibana-candles.d.ts +0 -3
- package/dist/scripts/diagnose-kibana-candles.js +0 -82
- package/scripts/git-viewer.sh +0 -489
- package/scripts/postinstall.js +0 -16
package/scripts/git-viewer.sh
DELETED
|
@@ -1,489 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Git Viewer - Interactive tool for monitoring and navigating git changes
|
|
3
|
-
# This script provides a comprehensive view of uncommitted, committed, and pushed changes
|
|
4
|
-
# with an interactive menu system and fzf-based search/preview capabilities.
|
|
5
|
-
|
|
6
|
-
################################################################################
|
|
7
|
-
# DEPENDENCY CHECK SECTION
|
|
8
|
-
################################################################################
|
|
9
|
-
|
|
10
|
-
# check_dependencies: Verify and install required system tools
|
|
11
|
-
# Required packages:
|
|
12
|
-
# - delta: Enhanced diff viewer with syntax highlighting
|
|
13
|
-
# - fzf: Fuzzy finder for interactive selection
|
|
14
|
-
# - bat/batcat: Syntax-highlighted file viewer
|
|
15
|
-
# This function checks each dependency and installs missing packages
|
|
16
|
-
# using the appropriate package manager for the current OS.
|
|
17
|
-
check_dependencies() {
|
|
18
|
-
local missing_packages=()
|
|
19
|
-
|
|
20
|
-
# Check for delta - used for colorized diff output
|
|
21
|
-
if ! command -v delta &> /dev/null; then
|
|
22
|
-
missing_packages+=("git-delta")
|
|
23
|
-
fi
|
|
24
|
-
|
|
25
|
-
# Check for fzf - used for interactive file/commit selection
|
|
26
|
-
if ! command -v fzf &> /dev/null; then
|
|
27
|
-
missing_packages+=("fzf")
|
|
28
|
-
fi
|
|
29
|
-
|
|
30
|
-
# Check for batcat (Ubuntu) or bat (other distros) - used for file syntax highlighting
|
|
31
|
-
if ! command -v batcat &> /dev/null && ! command -v bat &> /dev/null; then
|
|
32
|
-
missing_packages+=("bat")
|
|
33
|
-
fi
|
|
34
|
-
|
|
35
|
-
# Install missing packages if any were found
|
|
36
|
-
if [ ${#missing_packages[@]} -gt 0 ]; then
|
|
37
|
-
echo "Installing missing dependencies: ${missing_packages[@]}"
|
|
38
|
-
|
|
39
|
-
if command -v apt-get &> /dev/null; then
|
|
40
|
-
sudo apt-get update -qq
|
|
41
|
-
sudo apt-get install -y -qq "${missing_packages[@]}"
|
|
42
|
-
elif command -v brew &> /dev/null; then
|
|
43
|
-
brew install "${missing_packages[@]}"
|
|
44
|
-
elif command -v dnf &> /dev/null; then
|
|
45
|
-
sudo dnf install -y "${missing_packages[@]}"
|
|
46
|
-
elif command -v pacman &> /dev/null; then
|
|
47
|
-
sudo pacman -Syu --noconfirm "${missing_packages[@]}"
|
|
48
|
-
else
|
|
49
|
-
echo "Warning: Could not detect package manager. Please install manually: ${missing_packages[@]}"
|
|
50
|
-
echo " apt-get: sudo apt-get install ${missing_packages[*]}"
|
|
51
|
-
echo " brew: brew install ${missing_packages[*]}"
|
|
52
|
-
return 0
|
|
53
|
-
fi
|
|
54
|
-
|
|
55
|
-
echo "Dependencies installed successfully!"
|
|
56
|
-
sleep 1
|
|
57
|
-
fi
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
# Run dependency check on script startup
|
|
61
|
-
check_dependencies
|
|
62
|
-
|
|
63
|
-
################################################################################
|
|
64
|
-
# TERMINAL & CLEANUP SECTION
|
|
65
|
-
################################################################################
|
|
66
|
-
|
|
67
|
-
# clear_screen: ANSI escape sequence to clear terminal and move cursor to home position
|
|
68
|
-
# Uses: ESC[2J (clear screen) + ESC[H (move cursor to 0,0)
|
|
69
|
-
clear_screen() {
|
|
70
|
-
printf "\033[2J\033[H"
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
# cleanup: Graceful exit handler called when user presses Ctrl+C or terminates script
|
|
74
|
-
# Resets terminal to normal mode and exits with status 0
|
|
75
|
-
cleanup() {
|
|
76
|
-
clear_screen
|
|
77
|
-
# Reset terminal to normal mode (in case any special terminal modes were enabled)
|
|
78
|
-
stty sane 2>/dev/null || true
|
|
79
|
-
echo "Exiting..."
|
|
80
|
-
exit 0
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
# Set up signal handlers for graceful shutdown on interrupt or termination signals
|
|
84
|
-
trap cleanup INT TERM
|
|
85
|
-
|
|
86
|
-
################################################################################
|
|
87
|
-
# MENU & DISPLAY SECTION
|
|
88
|
-
################################################################################
|
|
89
|
-
|
|
90
|
-
# show_menu: Display main navigation menu with available options
|
|
91
|
-
# Options:
|
|
92
|
-
# [1] View all changes - Show complete git status across all change categories
|
|
93
|
-
# [2] Search uncommitted - Interactive search through staged/unstaged/untracked files
|
|
94
|
-
# [3] Search committed - Interactive search through unpushed commits
|
|
95
|
-
# [4] Search pushed - Interactive search through remote commits
|
|
96
|
-
# [q] Quit - Exit the application
|
|
97
|
-
show_menu() {
|
|
98
|
-
echo ""
|
|
99
|
-
echo "═══════════════════════════════════════════════════════"
|
|
100
|
-
echo "CONTROLS:"
|
|
101
|
-
echo " [1] View all changes [2] Search uncommitted"
|
|
102
|
-
echo " [3] Search committed [4] Search pushed"
|
|
103
|
-
echo " [q] Quit"
|
|
104
|
-
echo "═══════════════════════════════════════════════════════"
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
# show_all_changes: Display comprehensive view of all git changes in three categories
|
|
108
|
-
# Categories displayed:
|
|
109
|
-
# 1. UNCOMMITTED: Changes not yet committed (staged, unstaged, untracked)
|
|
110
|
-
# 2. COMMITTED: Local commits not yet pushed to remote
|
|
111
|
-
# 3. PUSHED: Latest commits on the remote branch
|
|
112
|
-
# Uses delta for enhanced diff output and displays timestamp of last update
|
|
113
|
-
show_all_changes() {
|
|
114
|
-
clear_screen
|
|
115
|
-
echo "=== Complete Git Changes Monitor ==="
|
|
116
|
-
echo "Last update: $(date '+%Y-%m-%d %H:%M:%S')"
|
|
117
|
-
echo "=================================================="
|
|
118
|
-
echo ""
|
|
119
|
-
|
|
120
|
-
# Get current branch and derive remote branch name
|
|
121
|
-
current_branch=$(git rev-parse --abbrev-ref HEAD)
|
|
122
|
-
remote_branch="origin/$current_branch"
|
|
123
|
-
echo "Current branch: $current_branch | Remote: $remote_branch"
|
|
124
|
-
echo ""
|
|
125
|
-
|
|
126
|
-
# Section 1: Display uncommitted changes (staged, unstaged, untracked)
|
|
127
|
-
echo "========== 1. UNCOMMITTED (All changes not yet committed) =========="
|
|
128
|
-
echo "--- Staged changes ---"
|
|
129
|
-
git diff --staged | delta || echo "No staged changes"
|
|
130
|
-
echo ""
|
|
131
|
-
echo "--- Unstaged changes ---"
|
|
132
|
-
git diff | delta || echo "No unstaged changes"
|
|
133
|
-
echo ""
|
|
134
|
-
echo "--- Untracked files ---"
|
|
135
|
-
git ls-files --others --exclude-standard || echo "No untracked files"
|
|
136
|
-
|
|
137
|
-
echo ""
|
|
138
|
-
# Section 2: Display commits that exist locally but haven't been pushed to remote
|
|
139
|
-
echo "========== 2. COMMITTED (Local commits not yet pushed) =========="
|
|
140
|
-
echo "Commits:"
|
|
141
|
-
git log origin/$(git rev-parse --abbrev-ref HEAD)..HEAD --oneline 2>/dev/null || echo "No committed unpushed changes"
|
|
142
|
-
echo ""
|
|
143
|
-
echo "Diff:"
|
|
144
|
-
git diff origin/$(git rev-parse --abbrev-ref HEAD)..HEAD 2>/dev/null | delta || echo "No diff in unpushed commits"
|
|
145
|
-
|
|
146
|
-
echo ""
|
|
147
|
-
# Section 3: Display latest commits from the remote branch
|
|
148
|
-
echo "========== 3. PUSHED (On remote branch) =========="
|
|
149
|
-
echo "Latest pushed commits:"
|
|
150
|
-
git log origin/$(git rev-parse --abbrev-ref HEAD) --oneline -10 2>/dev/null || echo "Remote branch not found"
|
|
151
|
-
|
|
152
|
-
show_menu
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
################################################################################
|
|
156
|
-
# SEARCH UNCOMMITTED SECTION
|
|
157
|
-
################################################################################
|
|
158
|
-
|
|
159
|
-
# search_uncommitted: Interactive search and preview of uncommitted changes
|
|
160
|
-
# Displays:
|
|
161
|
-
# - Staged files
|
|
162
|
-
# - Unstaged files
|
|
163
|
-
# - Untracked files
|
|
164
|
-
# Uses fzf for fuzzy file selection with live preview via batcat/bat
|
|
165
|
-
# After selecting a file, user can toggle between:
|
|
166
|
-
# [f] Full file view - Show entire file with syntax highlighting
|
|
167
|
-
# [d] Diff view - Show only changes made to the file
|
|
168
|
-
# [q] Back - Return to file selection
|
|
169
|
-
# [b] Main menu - Return to main menu
|
|
170
|
-
search_uncommitted() {
|
|
171
|
-
clear_screen
|
|
172
|
-
echo "╔═══════════════════════════════════════════════════════╗"
|
|
173
|
-
echo "║ SEARCH MODE - Type to filter files"
|
|
174
|
-
echo "║ UP/DOWN arrows select | ENTER opens file | ESC back"
|
|
175
|
-
echo "╚═══════════════════════════════════════════════════════╝"
|
|
176
|
-
echo ""
|
|
177
|
-
|
|
178
|
-
# Gather all uncommitted files from three sources
|
|
179
|
-
staged=$(git diff --staged --name-only)
|
|
180
|
-
unstaged=$(git diff --name-only)
|
|
181
|
-
untracked=$(git ls-files --others --exclude-standard)
|
|
182
|
-
# Combine all file lists, remove empty lines, and deduplicate
|
|
183
|
-
files=$(echo -e "$staged\n$unstaged\n$untracked" | grep -v "^$" | sort -u)
|
|
184
|
-
|
|
185
|
-
# Handle case where no uncommitted files exist
|
|
186
|
-
if [ -z "$files" ]; then
|
|
187
|
-
echo "No uncommitted files"
|
|
188
|
-
sleep 2
|
|
189
|
-
show_all_changes
|
|
190
|
-
return
|
|
191
|
-
fi
|
|
192
|
-
|
|
193
|
-
# Loop to handle multiple file selections before returning to main menu
|
|
194
|
-
while true; do
|
|
195
|
-
# Use fzf to select file with preview window showing first 100 lines
|
|
196
|
-
# --preview uses batcat or fallback to head for file preview
|
|
197
|
-
# --preview-window=right:67% shows preview on right side with 67% width
|
|
198
|
-
# --bind 'esc:abort' allows ESC to exit fzf without selection
|
|
199
|
-
selected=$(echo "$files" | fzf --ansi --preview 'batcat --color=always --line-range :100 {} 2>/dev/null || head -100 {}' --preview-window=right:67% --bind 'esc:abort')
|
|
200
|
-
|
|
201
|
-
# If user pressed ESC, return to main menu
|
|
202
|
-
if [ -z "$selected" ]; then
|
|
203
|
-
show_all_changes
|
|
204
|
-
return
|
|
205
|
-
fi
|
|
206
|
-
|
|
207
|
-
# File was selected - enter file viewing mode
|
|
208
|
-
if [ -n "$selected" ]; then
|
|
209
|
-
view_mode="full" # Start in full file view mode
|
|
210
|
-
# Loop to allow user to toggle between full/diff views for same file
|
|
211
|
-
while true; do
|
|
212
|
-
clear_screen
|
|
213
|
-
echo "╔═══════════════════════════════════════════════════════╗"
|
|
214
|
-
echo "║ VIEWING: $selected"
|
|
215
|
-
echo "║ Display: $([ "$view_mode" = "diff" ] && echo "DIFF ONLY" || echo "FULL FILE")"
|
|
216
|
-
echo "╚═══════════════════════════════════════════════════════╝"
|
|
217
|
-
echo ""
|
|
218
|
-
echo "⚠️ DO NOT TYPE - Use SINGLE KEYS only:"
|
|
219
|
-
echo " [f]=Full [d]=Diff [q]=Back to search [b]=Main menu"
|
|
220
|
-
echo ""
|
|
221
|
-
echo "────────────────────────────────────────────────────────"
|
|
222
|
-
echo ""
|
|
223
|
-
|
|
224
|
-
# Display either diff or full file content based on current view mode
|
|
225
|
-
if [ "$view_mode" = "diff" ]; then
|
|
226
|
-
# Check if file is tracked in git
|
|
227
|
-
if git ls-files --error-unmatch "$selected" 2>/dev/null; then
|
|
228
|
-
# File is tracked - show diff of changes
|
|
229
|
-
git diff --color=always "$selected" 2>/dev/null | delta || echo "No changes in this file"
|
|
230
|
-
else
|
|
231
|
-
# File is untracked (new) - cannot show diff
|
|
232
|
-
echo "File is untracked (new file) - no diff to show"
|
|
233
|
-
fi
|
|
234
|
-
else
|
|
235
|
-
# Full file view mode - show entire file with syntax highlighting
|
|
236
|
-
batcat --color=always "$selected" 2>/dev/null || cat "$selected"
|
|
237
|
-
fi
|
|
238
|
-
|
|
239
|
-
echo ""
|
|
240
|
-
echo "════════════════════════════════════════════════════════"
|
|
241
|
-
# Read single keystroke without requiring Enter (non-blocking read)
|
|
242
|
-
read -n 1 -s key
|
|
243
|
-
|
|
244
|
-
# Handle user input
|
|
245
|
-
case $key in
|
|
246
|
-
f) view_mode="full" ;; # Switch to full file view
|
|
247
|
-
d) view_mode="diff" ;; # Switch to diff view
|
|
248
|
-
q) break ;; # Return to file selection
|
|
249
|
-
b) show_all_changes; return ;; # Return to main menu
|
|
250
|
-
esac
|
|
251
|
-
done
|
|
252
|
-
fi
|
|
253
|
-
done
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
################################################################################
|
|
257
|
-
# SEARCH COMMITTED SECTION
|
|
258
|
-
################################################################################
|
|
259
|
-
|
|
260
|
-
# search_committed: Interactive search and view of unpushed local commits
|
|
261
|
-
# Displays commits that exist locally but have not been pushed to the remote branch
|
|
262
|
-
# Uses fzf with commit preview to show commit details
|
|
263
|
-
# Allows user to view full commit diff with syntax highlighting
|
|
264
|
-
search_committed() {
|
|
265
|
-
current_branch=$(git rev-parse --abbrev-ref HEAD)
|
|
266
|
-
remote_branch="origin/$current_branch"
|
|
267
|
-
|
|
268
|
-
clear_screen
|
|
269
|
-
echo "╔═══════════════════════════════════════════════════════╗"
|
|
270
|
-
echo "║ SEARCH COMMITTED (UNPUSHED) ║"
|
|
271
|
-
echo "║ Use arrows to navigate | Enter to view full | Esc to back"
|
|
272
|
-
echo "╚═══════════════════════════════════════════════════════╝"
|
|
273
|
-
echo ""
|
|
274
|
-
|
|
275
|
-
# Get all commits that exist on local branch but not on remote
|
|
276
|
-
commits=$(git log $remote_branch..HEAD --oneline 2>/dev/null)
|
|
277
|
-
|
|
278
|
-
# Handle case where no unpushed commits exist
|
|
279
|
-
if [ -z "$commits" ]; then
|
|
280
|
-
echo "No unpushed commits"
|
|
281
|
-
sleep 2
|
|
282
|
-
show_all_changes
|
|
283
|
-
return
|
|
284
|
-
fi
|
|
285
|
-
|
|
286
|
-
# Loop to allow searching multiple commits
|
|
287
|
-
while true; do
|
|
288
|
-
# Use fzf to select commit with preview showing commit details
|
|
289
|
-
# Preview extracts commit hash from first field and shows git show output
|
|
290
|
-
selected=$(echo "$commits" | fzf --ansi --preview 'commit_hash=$(echo {} | awk "{print \$1}"); git show --color=always $commit_hash | head -100' --preview-window=right:67% --bind 'esc:abort')
|
|
291
|
-
|
|
292
|
-
# If user pressed ESC, return to main menu
|
|
293
|
-
if [ -z "$selected" ]; then
|
|
294
|
-
show_all_changes
|
|
295
|
-
return
|
|
296
|
-
fi
|
|
297
|
-
|
|
298
|
-
# Commit was selected - show full commit details
|
|
299
|
-
if [ -n "$selected" ]; then
|
|
300
|
-
# Extract commit hash from first field of selected line
|
|
301
|
-
commit_hash=$(echo "$selected" | awk '{print $1}')
|
|
302
|
-
|
|
303
|
-
clear_screen
|
|
304
|
-
echo "╔═══════════════════════════════════════════════════════╗"
|
|
305
|
-
echo "║ COMMIT: $commit_hash"
|
|
306
|
-
echo "║ Press [q] to go back, [b] to back to main menu"
|
|
307
|
-
echo "╚═══════════════════════════════════════════════════════╝"
|
|
308
|
-
echo ""
|
|
309
|
-
# Display full commit details with enhanced diff via delta
|
|
310
|
-
git show --color=always "$commit_hash" | delta
|
|
311
|
-
|
|
312
|
-
echo ""
|
|
313
|
-
echo "════════════════════════════════════════════════════════"
|
|
314
|
-
# Prompt for next action
|
|
315
|
-
read -n 1 -p "Press [q] to search again, [b] for main menu: " key
|
|
316
|
-
|
|
317
|
-
# Return to main menu if requested
|
|
318
|
-
if [ "$key" = "b" ]; then
|
|
319
|
-
show_all_changes
|
|
320
|
-
return
|
|
321
|
-
fi
|
|
322
|
-
fi
|
|
323
|
-
done
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
################################################################################
|
|
327
|
-
# SEARCH PUSHED SECTION
|
|
328
|
-
################################################################################
|
|
329
|
-
|
|
330
|
-
# search_pushed: Interactive search and view of pushed remote commits
|
|
331
|
-
# Displays latest 100 commits from the remote branch
|
|
332
|
-
# Uses fzf with commit preview to show commit details
|
|
333
|
-
# Similar to search_committed but operates on remote branch history
|
|
334
|
-
search_pushed() {
|
|
335
|
-
current_branch=$(git rev-parse --abbrev-ref HEAD)
|
|
336
|
-
remote_branch="origin/$current_branch"
|
|
337
|
-
|
|
338
|
-
clear_screen
|
|
339
|
-
echo "╔═══════════════════════════════════════════════════════╗"
|
|
340
|
-
echo "║ SEARCH PUSHED COMMITS (Latest 100) ║"
|
|
341
|
-
echo "║ Use arrows to navigate | Enter to view full | Esc to back"
|
|
342
|
-
echo "╚═══════════════════════════════════════════════════════╝"
|
|
343
|
-
echo ""
|
|
344
|
-
|
|
345
|
-
# Get latest 100 commits from remote branch
|
|
346
|
-
commits=$(git log $remote_branch --oneline -100 2>/dev/null)
|
|
347
|
-
|
|
348
|
-
# Handle case where no remote commits exist
|
|
349
|
-
if [ -z "$commits" ]; then
|
|
350
|
-
echo "No pushed commits found"
|
|
351
|
-
sleep 2
|
|
352
|
-
show_all_changes
|
|
353
|
-
return
|
|
354
|
-
fi
|
|
355
|
-
|
|
356
|
-
# Loop to allow searching multiple commits
|
|
357
|
-
while true; do
|
|
358
|
-
# Use fzf to select commit with preview showing commit details
|
|
359
|
-
selected=$(echo "$commits" | fzf --ansi --preview 'commit_hash=$(echo {} | awk "{print \$1}"); git show --color=always $commit_hash | head -100' --preview-window=right:67% --bind 'esc:abort')
|
|
360
|
-
|
|
361
|
-
# If user pressed ESC, return to main menu
|
|
362
|
-
if [ -z "$selected" ]; then
|
|
363
|
-
show_all_changes
|
|
364
|
-
return
|
|
365
|
-
fi
|
|
366
|
-
|
|
367
|
-
# Commit was selected - show full commit details
|
|
368
|
-
if [ -n "$selected" ]; then
|
|
369
|
-
# Extract commit hash from first field of selected line
|
|
370
|
-
commit_hash=$(echo "$selected" | awk '{print $1}')
|
|
371
|
-
|
|
372
|
-
clear_screen
|
|
373
|
-
echo "╔═══════════════════════════════════════════════════════╗"
|
|
374
|
-
echo "║ PUSHED COMMIT: $commit_hash"
|
|
375
|
-
echo "║ Press [q] to go back, [b] to back to main menu"
|
|
376
|
-
echo "╚═══════════════════════════════════════════════════════╝"
|
|
377
|
-
echo ""
|
|
378
|
-
# Display full commit details with enhanced diff via delta
|
|
379
|
-
git show --color=always "$commit_hash" | delta
|
|
380
|
-
|
|
381
|
-
echo ""
|
|
382
|
-
echo "════════════════════════════════════════════════════════"
|
|
383
|
-
# Prompt for next action
|
|
384
|
-
read -n 1 -p "Press [q] to search again, [b] for main menu: " key
|
|
385
|
-
|
|
386
|
-
# Return to main menu if requested
|
|
387
|
-
if [ "$key" = "b" ]; then
|
|
388
|
-
show_all_changes
|
|
389
|
-
return
|
|
390
|
-
fi
|
|
391
|
-
fi
|
|
392
|
-
done
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
################################################################################
|
|
396
|
-
# STATE DETECTION & AUTO-REFRESH SECTION
|
|
397
|
-
################################################################################
|
|
398
|
-
|
|
399
|
-
# get_local_state: Capture state of local working directory for change detection
|
|
400
|
-
# Returns a string representation of:
|
|
401
|
-
# - Staged changes statistics
|
|
402
|
-
# - Unstaged changes statistics
|
|
403
|
-
# - Untracked files list
|
|
404
|
-
# Used to detect if working directory has changed since last check
|
|
405
|
-
get_local_state() {
|
|
406
|
-
local state=""
|
|
407
|
-
state+="$(git diff --staged --stat 2>/dev/null)|||"
|
|
408
|
-
state+="$(git diff --stat 2>/dev/null)|||"
|
|
409
|
-
state+="$(git ls-files --others --exclude-standard 2>/dev/null)"
|
|
410
|
-
echo "$state"
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
# get_remote_state: Capture state of remote commits for change detection
|
|
414
|
-
# Returns a string representation of:
|
|
415
|
-
# - Unpushed commits (commits local but not on remote)
|
|
416
|
-
# - Latest 10 remote commits (to detect new pushed commits)
|
|
417
|
-
# Used to detect if remote branch has changed since last check
|
|
418
|
-
get_remote_state() {
|
|
419
|
-
current_branch=$(git rev-parse --abbrev-ref HEAD)
|
|
420
|
-
remote_branch="origin/$current_branch"
|
|
421
|
-
|
|
422
|
-
local state=""
|
|
423
|
-
state+="$(git log $remote_branch..HEAD --oneline 2>/dev/null)|||"
|
|
424
|
-
state+="$(git log $remote_branch --oneline -10 2>/dev/null)"
|
|
425
|
-
echo "$state"
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
################################################################################
|
|
429
|
-
# MAIN LOOP - INTERACTIVE MODE
|
|
430
|
-
################################################################################
|
|
431
|
-
|
|
432
|
-
# Display initial git status on script startup
|
|
433
|
-
show_all_changes
|
|
434
|
-
|
|
435
|
-
# Initialize state caches for detecting changes
|
|
436
|
-
previous_local_state=$(get_local_state)
|
|
437
|
-
previous_remote_state=$(get_remote_state)
|
|
438
|
-
last_update_time=$(date +%s)
|
|
439
|
-
last_remote_update_time=$(date +%s)
|
|
440
|
-
|
|
441
|
-
# Main event loop: monitor for user input and auto-refresh on changes
|
|
442
|
-
# Polling intervals:
|
|
443
|
-
# - Local changes: checked every 1 second
|
|
444
|
-
# - Remote changes: checked every 15 seconds (slower to reduce network traffic)
|
|
445
|
-
# User input: read with 1 second timeout to balance responsiveness and CPU usage
|
|
446
|
-
while true; do
|
|
447
|
-
current_time=$(date +%s)
|
|
448
|
-
|
|
449
|
-
# Check for keypress with 1 second timeout
|
|
450
|
-
# read -t 1 waits up to 1 second for input
|
|
451
|
-
# read -n 1 reads a single character
|
|
452
|
-
# Exit code 0 means key was pressed, non-zero means timeout
|
|
453
|
-
read -t 1 -n 1 action
|
|
454
|
-
|
|
455
|
-
if [ $? -eq 0 ]; then
|
|
456
|
-
# Key was pressed - handle menu navigation
|
|
457
|
-
case $action in
|
|
458
|
-
1) show_all_changes ;; # Show all changes overview
|
|
459
|
-
2) search_uncommitted ;; # Search uncommitted files
|
|
460
|
-
3) search_committed ;; # Search unpushed commits
|
|
461
|
-
4) search_pushed ;; # Search remote commits
|
|
462
|
-
q) cleanup ;; # Quit application
|
|
463
|
-
esac
|
|
464
|
-
else
|
|
465
|
-
# No key pressed - check for changes in working directory or remote
|
|
466
|
-
local_state=$(get_local_state)
|
|
467
|
-
|
|
468
|
-
# Check local changes every 1 second
|
|
469
|
-
if [ $((current_time - last_update_time)) -ge 1 ]; then
|
|
470
|
-
# If working directory state has changed, refresh display
|
|
471
|
-
if [ "$local_state" != "$previous_local_state" ]; then
|
|
472
|
-
show_all_changes
|
|
473
|
-
previous_local_state="$local_state"
|
|
474
|
-
fi
|
|
475
|
-
last_update_time=$current_time
|
|
476
|
-
fi
|
|
477
|
-
|
|
478
|
-
# Check remote changes every 15 seconds (less frequent to save resources)
|
|
479
|
-
if [ $((current_time - last_remote_update_time)) -ge 15 ]; then
|
|
480
|
-
remote_state=$(get_remote_state)
|
|
481
|
-
# If remote branch state has changed, refresh display
|
|
482
|
-
if [ "$remote_state" != "$previous_remote_state" ]; then
|
|
483
|
-
show_all_changes
|
|
484
|
-
previous_remote_state="$remote_state"
|
|
485
|
-
fi
|
|
486
|
-
last_remote_update_time=$current_time
|
|
487
|
-
fi
|
|
488
|
-
fi
|
|
489
|
-
done
|
package/scripts/postinstall.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
if (process.env.npm_config_global !== 'true') {
|
|
3
|
-
console.log('');
|
|
4
|
-
console.log('DEXBot2 installed locally. To use the `dexbot` command:');
|
|
5
|
-
console.log(' npm link # makes `dexbot` available globally');
|
|
6
|
-
console.log(' # or use: npx dexbot <cmd> # or: ./node_modules/.bin/dexbot <cmd>');
|
|
7
|
-
console.log('');
|
|
8
|
-
process.exit(0);
|
|
9
|
-
}
|
|
10
|
-
console.log('');
|
|
11
|
-
console.log('DEXBot2 installed! To get started:');
|
|
12
|
-
console.log(' dexbot key Set up master password');
|
|
13
|
-
console.log(' dexbot bot Create and manage bots');
|
|
14
|
-
console.log(' dexbot start Run credential daemon + bot');
|
|
15
|
-
console.log(' dexbot help Show all commands');
|
|
16
|
-
console.log('');
|