docs: add copilot-instructions.md and file-level comments

- Create .github/copilot-instructions.md with project coding standards,
  architecture overview, threading model, and key rules for AI sessions
- Add module description comments to app.cpp, rpc_client.cpp, rpc_worker.cpp,
  embedded_daemon.cpp, xmrig_manager.cpp, console_tab.cpp, settings.cpp
- Add ASCII connection state diagram to app_network.cpp
- Remove /.github/ from .gitignore so instructions file is tracked
This commit is contained in:
2026-04-04 11:14:31 -05:00
parent ca199ef195
commit 096f8ee90e
10 changed files with 221 additions and 2 deletions

View File

@@ -1,6 +1,9 @@
// DragonX Wallet - ImGui Edition
// Copyright 2024-2026 The Hush Developers
// Released under the GPLv3
//
// app.cpp — Main application: init, shutdown, ImGui render loop, NavPage
// dispatch, dialog rendering, and frame-level state management.
#include "app.h"
#include "config/version.h"

View File

@@ -2,8 +2,32 @@
// Copyright 2024-2026 The Hush Developers
// Released under the GPLv3
//
// app_network.cpp — RPC connection, data refresh, and network operations
// app_network.cpp — RPC connection, data refresh, and network operations.
// Split from app.cpp for maintainability.
//
// Connection state machine:
//
// [Disconnected]
// │
// ▼ tryConnect() every 5s
// Auto-detect DRAGONX.conf (host, port, rpcuser, rpcpassword)
// │
// ├─ no config found ──► start embedded daemon ──► retry
// │
// ▼ post async rpc_->connect() to worker_
// [Connecting]
// │
// ├─ success ──► onConnected() ──► [Connected]
// │ │
// │ ▼ refreshData() every 5s
// │ [Running]
// │ │
// │ ├─ RPC error ──► onDisconnected()
// │ │ │
// ├─ auth 401 ──► .cookie auth ──► retry│ ▼
// │ │ [Disconnected]
// └─ failure ──► onDisconnected(reason) ┘
// may restart daemon
#include "app.h"
#include "rpc/rpc_client.h"

View File

@@ -1,6 +1,9 @@
// DragonX Wallet - ImGui Edition
// Copyright 2024-2026 The Hush Developers
// Released under the GPLv3
//
// settings.cpp — JSON settings persistence. Loads/saves user preferences
// to ~/.config/ObsidianDragon/settings.json (Linux/macOS) or %APPDATA% (Windows).
#include "settings.h"
#include "version.h"

View File

@@ -1,6 +1,9 @@
// DragonX Wallet - ImGui Edition
// Copyright 2024-2026 The Hush Developers
// Released under the GPLv3
//
// embedded_daemon.cpp — Manages the dragonxd child process lifecycle:
// binary discovery, process spawn, stdout/stderr monitoring, crash recovery.
#include "embedded_daemon.h"
#include "../config/version.h"

View File

@@ -1,6 +1,9 @@
// DragonX Wallet - ImGui Edition
// Copyright 2024-2026 The Hush Developers
// Released under the GPLv3
//
// xmrig_manager.cpp — Pool mining process management via xmrig-hac.
// Spawns xmrig, monitors via HTTP API, tracks hashrate and shares.
#include "xmrig_manager.h"
#include "../resources/embedded_resources.h"

View File

@@ -1,6 +1,9 @@
// DragonX Wallet - ImGui Edition
// Copyright 2024-2026 The Hush Developers
// Released under the GPLv3
//
// rpc_client.cpp — JSON-RPC client over HTTPS using libcurl.
// All calls are blocking; run on RPCWorker threads, never on main thread.
#include "rpc_client.h"
#include "../config/version.h"

View File

@@ -1,6 +1,9 @@
// DragonX Wallet - ImGui Edition
// Copyright 2024-2026 The Hush Developers
// Released under the GPLv3
//
// rpc_worker.cpp — Background work queue. Executes WorkFn on its own thread,
// returns MainCb callbacks drained each frame on the main thread.
#include "rpc_worker.h"
#include <cstdio>

View File

@@ -1,6 +1,9 @@
// DragonX Wallet - ImGui Edition
// Copyright 2024-2026 The Hush Developers
// Released under the GPLv3
//
// console_tab.cpp — Interactive RPC console with command history,
// tab completion, daemon log display, and color-coded output.
#include "console_tab.h"
#include "../material/colors.h"