paldefender-cli
v1.0.3
Published
A high-performance CLI for managing PalDefender REST API servers with dynamic method discovery.
Maintainers
Readme
PalDefender CLI (pd-cli)
A high-performance, type-safe Command Line Interface for managing PalDefender REST API servers. pd-cli features a "Hybrid" input system, allowing you to use simple space-separated lists or complex JSON for administrative actions.
📦 Installation
Option 1: NPM (Recommended)
npm install -g paldefender-cliOption 2: Standalone Binaries (GitHub Releases)
Download pre-compiled binaries for Windows, Linux, or MacOS.
Note for Unix (Linux/Mac): You must run
chmod +x pd-clibefore executing.
Option 3: Compile Binaries yourself
Clone this repo and prep (You must have git, node, and npm installed on your machine)
git clone https://github.com/PalLink/pd-cli-ts.git
cd pd-cli-ts
npm install
# build
# Linux:
./build-bins.sh
# Windows (Powershell):
.\build-bins.ps1
# Windows (CMD):
build-bins.batYou now have a "build" directory with the bins inside. Open it and run the correct one for your system.
⚙️ Configuration
- Interactive Setup: Run
pd-cli configureto save your host and admin token. - Connectivity Check: Run
pd-cli test-connectionto verify your credentials and server status. - Reset: Run
pd-cli clear-configto wipe stored credentials.
🛠 Usage
For a detailed walkthrough of the repository files and common CLI commands, see USAGE.md.
🔍 Discovery & Lookup
| Command | Description | Example |
| :--- | :--- | :--- |
| getPlayers | List all players | pd-cli getPlayers |
| getGuilds | List all guilds | pd-cli getGuilds |
| getPlayer | Detailed player profile | pd-cli getPlayer "ID" |
| getPals | List a player's Pals | pd-cli getPals "ID" |
| getItems | View player inventory | pd-cli getItems "ID" |
| findPlayerByName | Search by exact name | pd-cli findPlayerByName "Glitch" |
💬 Player Messaging
| Command | Description | Example |
| :--- | :--- | :--- |
| sendPlayerMessageUserId | Default PlayerChat to one player (UserID) | pd-cli sendPlayerMessageUserId "USERID" "Hello" |
| sendPlayerMessageUserIDs | Default PlayerChat to many players (UserIDs) | pd-cli sendPlayerMessageUserIDs "USERID1,USERID2" "Hello" |
| sendPlayerChatUserId | PlayerChat to one player | pd-cli sendPlayerChatUserId "USERID" "Hello" |
| sendPlayerGlobalChatUserIDs | PlayerGlobalChat to many players | pd-cli sendPlayerGlobalChatUserIDs "USERID1,USERID2" "Event starts now" |
| sendPlayerGuildChatUserId | PlayerGuildChat to one player | pd-cli sendPlayerGuildChatUserId "USERID" "Guild update" |
| sendPlayerLogImportantUserIDs | PlayerLogImportant to many players | pd-cli sendPlayerLogImportantUserIDs "USERID1,USERID2" "Server restart soon" |
All SendType commands now support explicit suffix variants:
...UserIdfor oneUserID...UserIDsfor comma-separatedUserIDs
Examples:
sendPlayerChatUserId,sendPlayerChatUserIDssendPlayerGlobalChatUserId,sendPlayerGlobalChatUserIDssendPlayerGuildChatUserId,sendPlayerGuildChatUserIDssendPlayerLogNormalUserId,sendPlayerLogNormalUserIDssendPlayerLogImportantUserId,sendPlayerLogImportantUserIDssendPlayerLogVeryImportantUserId,sendPlayerLogVeryImportantUserIDs
🛠 Administrative "Give" Actions
These commands support Hybrid Logic: pass a list of names for quantity 1, or a JSON string for specific counts.
Items
# List format (Quantity 1 each)
pd-cli giveItems "ID" Stone Wood
# JSON format (Specific counts) - Requires "ItemID"
pd-cli giveItems "ID" '[{"ItemID": "Stone", "Count": 100}]'Pals
# List format (Level 1)
pd-cli givePals "ID" Anubis Lamball
# JSON format (Specific Level)
pd-cli givePals "ID" '{"PalName": "Anubis", "Level": 50}'Eggs
# You must supply EggID AND either PalID or PalTemplate
# List format
pd-cli givePalEggs "ID" PalEgg_Dark_01 PalEgg_Fire_05
# JSON format
pd-cli givePalEggs "ID" '["PalEgg_Dark_05"]'📈 Progression & Tech
| Command | Example |
| :--- | :--- |
| giveProgression | pd-cli giveProgression "ID" '{"EXP": 5000, "Lifmunks": 10, "AncientTechnologyPoints": 2, "TechnologyPoints": 4}' |
| giveRecipeMaterials | pd-cli giveRecipeMaterials "ID" PalSphere 5 |
| learnTech | pd-cli learnTech "ID" Unlock_Sphere_Tier_01 |
| forgetTech | pd-cli forgetTech "ID" All (Resets tree) |
💡 Important: Windows CMD vs PowerShell/Linux
Windows CMD does not support single quotes (') for JSON. You must use double quotes and escape the internal quotes with a backslash (\").
CMD Usage:
pd-cli.exe giveItems "ID" "[{\"ItemID\": \"Stone\", \"Count\": 10}]"PowerShell / Linux / MacOS Usage:
pd-cli giveItems "ID" '[{"ItemID": "Stone", "Count": 10}]'🚀 Key Features
- Hybrid Input: Choose between simple string lists or structured JSON.
- Auto-Discovery: CLI stays in sync with the
paldefender-rest-clientlibrary. - Formatted Output: Results are displayed in clean, readable boxes with status spinners.
- No-Node Binaries: Use the standalone executables if you don't want to install Node.js.
📜 License
MIT © PalLink
