mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-08-13 22:37:29 +00:00
Scaffold LogicSRC and CommandBoard plugins
This commit is contained in:
parent
59927e140c
commit
5c9ea821f6
67 changed files with 5958 additions and 0 deletions
52
packages/tui/src/index.ts
Normal file
52
packages/tui/src/index.ts
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
import { createPluginRegistry } from "@logicsrc/plugin-core";
|
||||
import { coinPayPlugin } from "@logicsrc/plugin-coinpay";
|
||||
import { sh1ptPlugin } from "@logicsrc/plugin-sh1pt";
|
||||
import { uGigPlugin } from "@logicsrc/plugin-ugig";
|
||||
|
||||
export interface TuiState {
|
||||
did: string;
|
||||
board: string;
|
||||
reputation: number;
|
||||
balance: string;
|
||||
}
|
||||
|
||||
const defaultState: TuiState = {
|
||||
did: "anthony.coinpay",
|
||||
board: "/gigs",
|
||||
reputation: 98,
|
||||
balance: "$42"
|
||||
};
|
||||
|
||||
export function renderTui(state: Partial<TuiState> = {}) {
|
||||
const view = { ...defaultState, ...state };
|
||||
const registry = createPluginRegistry([coinPayPlugin, uGigPlugin, sh1ptPlugin]);
|
||||
const plugins = registry.snapshot().plugins;
|
||||
|
||||
return [
|
||||
"┌─ CommandBoard.run ──────────────────────────────────────────┐",
|
||||
`│ DID: ${pad(view.did, 17)} Board: ${pad(view.board, 7)} Rep: ${String(view.reputation).padEnd(3)} Balance: ${pad(view.balance, 6)} │`,
|
||||
"├───────────────┬─────────────────────────────────────────────┤",
|
||||
"│ Boards │ Feed │",
|
||||
"│ > /gigs │ [TASK] QA checkout flow - 25 USDC │",
|
||||
"│ /agents │ [POST] New agent plugin idea │",
|
||||
"│ /qa │ [RUN] qa-agent completed task_123 │",
|
||||
"│ /jobs │ [uGig] Senior AI Engineer remote │",
|
||||
"│ /projects │ [sh1pt] Release action published │",
|
||||
"├───────────────┴─────────────────────────────────────────────┤",
|
||||
"│ Plugins: " + plugins.map((plugin) => `${plugin.name} ${plugin.enabled ? "enabled" : "disabled"}`).join(" | ").padEnd(50) + " │",
|
||||
"│ Enter: open p: post t: task a: agents w: wallet q: quit │",
|
||||
"└─────────────────────────────────────────────────────────────┘"
|
||||
].join("\n");
|
||||
}
|
||||
|
||||
export function renderPluginStatus() {
|
||||
const registry = createPluginRegistry([coinPayPlugin, uGigPlugin, sh1ptPlugin]);
|
||||
return registry
|
||||
.snapshot()
|
||||
.plugins.map((plugin) => `${plugin.id.padEnd(8)} ${plugin.enabled ? "enabled" : "disabled"} ${plugin.type.join(", ")}`)
|
||||
.join("\n");
|
||||
}
|
||||
|
||||
function pad(value: string, width: number) {
|
||||
return value.length >= width ? value.slice(0, width) : value.padEnd(width);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue