- πΉ 1. Add-Ons Load After the Core Terminal
- πΉ 2. Add-Ons Register Command Functions
- πΉ 3. Add-Ons Provide Metadata for the Help System
- πΉ 4. Add-Ons Hook Into Terminal Events
- πΉ 5. Add-Ons Add Admin Settings Pages
- πΉ 6. Add-Ons Add REST API Logic (Optional)
- πΉ 7. Add-Ons Add Wallet / Web3 Logic (Not Allowed in Core)
- πΉ 8. Add-Ons Can Override Core Commands Safely
- πΉ 9. Add-Ons Can Provide Their Own Styling
- πΉ 10. Add-Ons Are Fully Independent
- π― Summary
Understanding the internal mechanics of how add-ons plug into the Cointacted Social Terminal.
Add-ons for the Social Terminal act as modular extensions that connect to the terminal at multiple levels:
- JavaScript command registry
- metadata system
- settings panels
- REST API
- wallet/Web3 layers (in add-ons only)
- event listeners
- UI enhancements
This article explains how that works behind the scenes.
πΉ 1. Add-Ons Load After the Core Terminal #
Every add-on script is enqueued like this:
wp_enqueue_script(
'my-addon',
plugin_dir_url(__FILE__) . 'js/addon.js',
['cointacted-social-terminal-js'], // dependency
'1.0',
true
);
This ensures:
- core terminal initializes first
- global object (
CointactedSocialTerminalTerminal) exists - registry and metadata containers exist
- wallet detection already ran
Once the add-on JS loads, it can immediately add commands or logic.
πΉ 2. Add-Ons Register Command Functions #
All command logic comes from the registry:
CointactedSocialTerminalTerminal.registry.mycommand = function(input) {
cointacted_social_terminal_append_line("Hello!", "system");
};
Commands added by add-ons:
- appear in
helpautomatically - behave like native commands
- support args, aliases, and groups
- are isolated from core code
The terminal treats them as first-class citizens.
πΉ 3. Add-Ons Provide Metadata for the Help System #
Metadata makes commands:
- appear under command groups
- searchable
- documented
- guest-safe or restricted
- visible or hidden
Add-ons register metadata like:
CointactedSocialTerminalTerminal.commands_meta.mycommand = {
group: "ADDON",
description: "My custom command.",
alias: ["mc"],
public: true
};
As soon as metadata is added, the help system updates itself.
πΉ 4. Add-Ons Hook Into Terminal Events #
The terminal dispatches an event whenever output is printed:
document.addEventListener(
'cointacted_social_terminal_output',
(e) => {
console.log("Output:", e.detail.text);
}
);
Add-ons use this to:
- trigger reward logging (Social Mining)
- detect wallet state changes
- track command usage
- build analytics
- create animations and effects
- sync behavior with external systems
This is one of the main extension points.
πΉ 5. Add-Ons Add Admin Settings Pages #
Most add-ons place their settings under:
WP Admin β Cointacted
Example:
add_submenu_page(
'cointacted-social-terminal',
'My Add-On Settings',
'My Add-On',
'manage_options',
'my-addon',
'my_addon_render_page'
);
This allows add-ons to provide:
- configuration
- API keys
- wallet settings
- integration toggles
- UX customizations
πΉ 6. Add-Ons Add REST API Logic (Optional) #
Command β REST β Terminal output
is the standard pattern for server-side actions.
Add-ons can register routes:
register_rest_route('cstaddon/v1', '/data', [
'methods' => 'GET',
'callback' => 'my_addon_get_data',
'permission_callback' => '__return_true'
]);
And call them from commands:
const res = await fetch('/wp-json/cstaddon/v1/data');
REST is required for:
- private user data
- server-side actions
- integrations with other plugins
- safe Web3 operations
- Social Mining logic
πΉ 7. Add-Ons Add Wallet / Web3 Logic (Not Allowed in Core) #
The core terminal only provides:
- wallet installed or not
- chain ID
- account (if unlocked)
Everything else β signing, RPC calls, contract interactions β lives in an add-on.
Add-ons can:
- request wallet connection
- sign messages
- make RPC calls
- read contracts
- write to contracts
- verify proofs
- submit claims
Example:
const balance = await ethereum.request({
method: "eth_getBalance",
params: [address, "latest"]
});
This keeps the core plugin 100% safe for WordPress.org.
πΉ 8. Add-Ons Can Override Core Commands Safely #
Add-ons can wrap or replace commands:
const old = CointactedSocialTerminalTerminal.registry.wallet;
CointactedSocialTerminalTerminal.registry.wallet = function(input) {
old(input);
append_line("Extended wallet infoβ¦", "wallet");
};
Overrides allow:
- customization
- expansions
- add-on synergy
- alternative implementations
πΉ 9. Add-Ons Can Provide Their Own Styling #
Optional CSS:
.cointacted-social-terminal__line--reward {
color: #00cc77;
font-weight: bold;
}
Add-ons can introduce:
- new output types
- terminal themes
- custom cursors
- enhanced UI
- animations
- dark/light variations
πΉ 10. Add-Ons Are Fully Independent #
Each add-on:
- loads independently
- registers independently
- adds commands independently
- adds settings independently
- can be activated or removed without breaking the core
The system gracefully merges:
- command groups
- command lists
- metadata
- event listeners
This is the key advantage of the architecture.
π― Summary #
Add-ons extend the terminal by:
β registering new commands #
β adding metadata groups, aliases, descriptions #
β connecting to REST, APIs, and Web3 #
β using output events #
β adding admin settings #
β overriding core behavior #
β adding UI or styling #
β integrating external plugins #
The architecture is flexible, modular, and extremely developer-friendly.