loadouts 0.2.5 → 0.3.0
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/bundled/embedded/opencode/loadouts-runtime.tsx +14461 -0
- package/bundled/embedded/pi/loadouts-runtime.ts +14638 -0
- package/bundled/extensions/loadouts-runtime/index.ts +14638 -0
- package/bundled/extensions/loadouts-runtime/package.json +6 -0
- package/bundled/loadouts/opencode-runtime.yaml +7 -0
- package/bundled/loadouts/pi-runtime.yaml +5 -0
- package/bundled/opencode/commands/loadouts.md +3 -0
- package/bundled/opencode/plugins/loadouts-runtime-tui.tsx +14461 -0
- package/bundled/opencode/plugins/loadouts-runtime.ts +533 -0
- package/bundled/opencode/tui.jsonc +5 -0
- package/dist/builtins/agent-transforms.d.ts.map +1 -1
- package/dist/builtins/agent-transforms.js +1 -0
- package/dist/builtins/agent-transforms.js.map +1 -1
- package/dist/builtins/index.d.ts.map +1 -1
- package/dist/builtins/index.js +6 -0
- package/dist/builtins/index.js.map +1 -1
- package/dist/builtins/kinds/extension-dir.d.ts +3 -0
- package/dist/builtins/kinds/extension-dir.d.ts.map +1 -0
- package/dist/builtins/kinds/extension-dir.js +8 -0
- package/dist/builtins/kinds/extension-dir.js.map +1 -0
- package/dist/builtins/kinds/opencode-command.d.ts +3 -0
- package/dist/builtins/kinds/opencode-command.d.ts.map +1 -0
- package/dist/builtins/kinds/opencode-command.js +8 -0
- package/dist/builtins/kinds/opencode-command.js.map +1 -0
- package/dist/builtins/kinds/opencode-plugin.js +1 -1
- package/dist/builtins/kinds/opencode-plugin.js.map +1 -1
- package/dist/builtins/kinds/opencode-tui-config.d.ts +3 -0
- package/dist/builtins/kinds/opencode-tui-config.d.ts.map +1 -0
- package/dist/builtins/kinds/opencode-tui-config.js +8 -0
- package/dist/builtins/kinds/opencode-tui-config.js.map +1 -0
- package/dist/builtins/tools/opencode.d.ts.map +1 -1
- package/dist/builtins/tools/opencode.js +9 -0
- package/dist/builtins/tools/opencode.js.map +1 -1
- package/dist/builtins/tools/pi.d.ts.map +1 -1
- package/dist/builtins/tools/pi.js +2 -1
- package/dist/builtins/tools/pi.js.map +1 -1
- package/dist/cli/commands/activate.d.ts.map +1 -1
- package/dist/cli/commands/activate.js +7 -0
- package/dist/cli/commands/activate.js.map +1 -1
- package/dist/cli/commands/diff.d.ts +10 -0
- package/dist/cli/commands/diff.d.ts.map +1 -1
- package/dist/cli/commands/diff.js +71 -30
- package/dist/cli/commands/diff.js.map +1 -1
- package/dist/cli/commands/info.d.ts +10 -0
- package/dist/cli/commands/info.d.ts.map +1 -1
- package/dist/cli/commands/info.js +45 -1
- package/dist/cli/commands/info.js.map +1 -1
- package/dist/cli/commands/list.d.ts +18 -0
- package/dist/cli/commands/list.d.ts.map +1 -1
- package/dist/cli/commands/list.js +27 -0
- package/dist/cli/commands/list.js.map +1 -1
- package/dist/cli/commands/status.d.ts +10 -0
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +100 -2
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/sync.d.ts.map +1 -1
- package/dist/cli/commands/sync.js +6 -0
- package/dist/cli/commands/sync.js.map +1 -1
- package/dist/cli/commands/tui.d.ts +3 -0
- package/dist/cli/commands/tui.d.ts.map +1 -0
- package/dist/cli/commands/tui.js +20 -0
- package/dist/cli/commands/tui.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/core/render.d.ts.map +1 -1
- package/dist/core/render.js +48 -7
- package/dist/core/render.js.map +1 -1
- package/dist/core/resolve.d.ts +1 -1
- package/dist/core/resolve.d.ts.map +1 -1
- package/dist/core/resolve.js +2 -2
- package/dist/core/resolve.js.map +1 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/integrations/opencode-runtime/bridge.d.ts +17 -0
- package/dist/integrations/opencode-runtime/bridge.d.ts.map +1 -0
- package/dist/integrations/opencode-runtime/bridge.js +60 -0
- package/dist/integrations/opencode-runtime/bridge.js.map +1 -0
- package/dist/integrations/opencode-runtime/command.d.ts +4 -0
- package/dist/integrations/opencode-runtime/command.d.ts.map +1 -0
- package/dist/integrations/opencode-runtime/command.js +200 -0
- package/dist/integrations/opencode-runtime/command.js.map +1 -0
- package/dist/integrations/opencode-runtime/index.d.ts +6 -0
- package/dist/integrations/opencode-runtime/index.d.ts.map +1 -0
- package/dist/integrations/opencode-runtime/index.js +5 -0
- package/dist/integrations/opencode-runtime/index.js.map +1 -0
- package/dist/integrations/opencode-runtime/plugin.d.ts +59 -0
- package/dist/integrations/opencode-runtime/plugin.d.ts.map +1 -0
- package/dist/integrations/opencode-runtime/plugin.js +238 -0
- package/dist/integrations/opencode-runtime/plugin.js.map +1 -0
- package/dist/integrations/opencode-runtime/state.d.ts +8 -0
- package/dist/integrations/opencode-runtime/state.d.ts.map +1 -0
- package/dist/integrations/opencode-runtime/state.js +27 -0
- package/dist/integrations/opencode-runtime/state.js.map +1 -0
- package/dist/integrations/opencode-runtime/types.d.ts +38 -0
- package/dist/integrations/opencode-runtime/types.d.ts.map +1 -0
- package/dist/integrations/opencode-runtime/types.js +2 -0
- package/dist/integrations/opencode-runtime/types.js.map +1 -0
- package/dist/lib/gitignore.d.ts.map +1 -1
- package/dist/lib/gitignore.js +2 -0
- package/dist/lib/gitignore.js.map +1 -1
- package/dist/tui/core/actions.d.ts +9 -0
- package/dist/tui/core/actions.d.ts.map +1 -0
- package/dist/tui/core/actions.js +70 -0
- package/dist/tui/core/actions.js.map +1 -0
- package/dist/tui/core/data.d.ts +41 -0
- package/dist/tui/core/data.d.ts.map +1 -0
- package/dist/tui/core/data.js +150 -0
- package/dist/tui/core/data.js.map +1 -0
- package/dist/tui/core/host.d.ts +21 -0
- package/dist/tui/core/host.d.ts.map +1 -0
- package/dist/tui/core/host.js +2 -0
- package/dist/tui/core/host.js.map +1 -0
- package/dist/tui/core/intent.d.ts +80 -0
- package/dist/tui/core/intent.d.ts.map +1 -0
- package/dist/tui/core/intent.js +2 -0
- package/dist/tui/core/intent.js.map +1 -0
- package/dist/tui/core/keymap.d.ts +15 -0
- package/dist/tui/core/keymap.d.ts.map +1 -0
- package/dist/tui/core/keymap.js +36 -0
- package/dist/tui/core/keymap.js.map +1 -0
- package/dist/tui/core/model.d.ts +53 -0
- package/dist/tui/core/model.d.ts.map +1 -0
- package/dist/tui/core/model.js +33 -0
- package/dist/tui/core/model.js.map +1 -0
- package/dist/tui/core/theme.d.ts +15 -0
- package/dist/tui/core/theme.d.ts.map +1 -0
- package/dist/tui/core/theme.js +11 -0
- package/dist/tui/core/theme.js.map +1 -0
- package/dist/tui/core/update.d.ts +8 -0
- package/dist/tui/core/update.d.ts.map +1 -0
- package/dist/tui/core/update.js +192 -0
- package/dist/tui/core/update.js.map +1 -0
- package/dist/tui/core/view.d.ts +4 -0
- package/dist/tui/core/view.d.ts.map +1 -0
- package/dist/tui/core/view.js +150 -0
- package/dist/tui/core/view.js.map +1 -0
- package/dist/tui/core/viewspec.d.ts +44 -0
- package/dist/tui/core/viewspec.d.ts.map +1 -0
- package/dist/tui/core/viewspec.js +2 -0
- package/dist/tui/core/viewspec.js.map +1 -0
- package/dist/tui/hosts/_probe/embed-entry.d.ts +5 -0
- package/dist/tui/hosts/_probe/embed-entry.d.ts.map +1 -0
- package/dist/tui/hosts/_probe/embed-entry.js +8 -0
- package/dist/tui/hosts/_probe/embed-entry.js.map +1 -0
- package/dist/tui/hosts/pi/embed-entry.d.ts +3 -0
- package/dist/tui/hosts/pi/embed-entry.d.ts.map +1 -0
- package/dist/tui/hosts/pi/embed-entry.js +219 -0
- package/dist/tui/hosts/pi/embed-entry.js.map +1 -0
- package/dist/tui/hosts/pi/inject.d.ts +32 -0
- package/dist/tui/hosts/pi/inject.d.ts.map +1 -0
- package/dist/tui/hosts/pi/inject.js +53 -0
- package/dist/tui/hosts/pi/inject.js.map +1 -0
- package/dist/tui/hosts/standalone.d.ts +2 -0
- package/dist/tui/hosts/standalone.d.ts.map +1 -0
- package/dist/tui/hosts/standalone.js +145 -0
- package/dist/tui/hosts/standalone.js.map +1 -0
- package/dist/tui/skins/pi-tui/input.d.ts +5 -0
- package/dist/tui/skins/pi-tui/input.d.ts.map +1 -0
- package/dist/tui/skins/pi-tui/input.js +38 -0
- package/dist/tui/skins/pi-tui/input.js.map +1 -0
- package/dist/tui/skins/pi-tui/pi-theme-adapter.d.ts +4 -0
- package/dist/tui/skins/pi-tui/pi-theme-adapter.d.ts.map +1 -0
- package/dist/tui/skins/pi-tui/pi-theme-adapter.js +27 -0
- package/dist/tui/skins/pi-tui/pi-theme-adapter.js.map +1 -0
- package/dist/tui/skins/pi-tui/render.d.ts +35 -0
- package/dist/tui/skins/pi-tui/render.d.ts.map +1 -0
- package/dist/tui/skins/pi-tui/render.js +154 -0
- package/dist/tui/skins/pi-tui/render.js.map +1 -0
- package/dist/tui/skins/pi-tui/theme.d.ts +10 -0
- package/dist/tui/skins/pi-tui/theme.d.ts.map +1 -0
- package/dist/tui/skins/pi-tui/theme.js +58 -0
- package/dist/tui/skins/pi-tui/theme.js.map +1 -0
- package/docs/authoring.md +53 -1
- package/docs/commands.md +4 -0
- package/docs/compatibility.md +7 -7
- package/docs/concepts.md +4 -2
- package/docs/runtime.md +36 -1
- package/docs/troubleshooting.md +18 -1
- package/docs/tui-architecture.md +501 -0
- package/package.json +11 -2
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
2
|
+
import { intentFromPiTuiInput } from "./input.js";
|
|
3
|
+
import { toPiTuiTheme } from "./theme.js";
|
|
4
|
+
export class PiTuiDashboard {
|
|
5
|
+
spec;
|
|
6
|
+
theme;
|
|
7
|
+
onIntent;
|
|
8
|
+
constructor(options) {
|
|
9
|
+
this.spec = options.spec;
|
|
10
|
+
this.theme = toPiTuiTheme(options.theme);
|
|
11
|
+
this.onIntent = options.onIntent;
|
|
12
|
+
}
|
|
13
|
+
setSpec(spec) {
|
|
14
|
+
this.spec = spec;
|
|
15
|
+
}
|
|
16
|
+
setTheme(theme) {
|
|
17
|
+
this.theme = toPiTuiTheme(theme);
|
|
18
|
+
}
|
|
19
|
+
render(width) {
|
|
20
|
+
return renderDashboard(this.spec, width, this.theme);
|
|
21
|
+
}
|
|
22
|
+
handleInput(data) {
|
|
23
|
+
const intent = intentFromPiTuiInput(data, this.spec);
|
|
24
|
+
if (intent)
|
|
25
|
+
this.onIntent?.(intent);
|
|
26
|
+
}
|
|
27
|
+
invalidate() { }
|
|
28
|
+
}
|
|
29
|
+
export class PiTuiOverlay {
|
|
30
|
+
spec;
|
|
31
|
+
theme;
|
|
32
|
+
onIntent;
|
|
33
|
+
constructor(spec, theme, onIntent) {
|
|
34
|
+
this.spec = spec;
|
|
35
|
+
this.theme = toPiTuiTheme(theme);
|
|
36
|
+
this.onIntent = onIntent;
|
|
37
|
+
}
|
|
38
|
+
setSpec(spec) {
|
|
39
|
+
this.spec = spec;
|
|
40
|
+
}
|
|
41
|
+
setTheme(theme) {
|
|
42
|
+
this.theme = toPiTuiTheme(theme);
|
|
43
|
+
}
|
|
44
|
+
render(width) {
|
|
45
|
+
return renderOverlay(this.spec, width, this.theme);
|
|
46
|
+
}
|
|
47
|
+
handleInput(data) {
|
|
48
|
+
const intent = intentFromPiTuiInput(data);
|
|
49
|
+
if (intent)
|
|
50
|
+
this.onIntent?.(intent);
|
|
51
|
+
}
|
|
52
|
+
invalidate() { }
|
|
53
|
+
}
|
|
54
|
+
export function renderDashboard(spec, width, theme = toPiTuiTheme()) {
|
|
55
|
+
const safeWidth = Math.max(1, width);
|
|
56
|
+
if (safeWidth < 42)
|
|
57
|
+
return renderNarrow(spec, safeWidth, theme);
|
|
58
|
+
const gap = 1;
|
|
59
|
+
const leftWidth = clamp(Math.floor(safeWidth * 0.52), 34, Math.min(64, safeWidth - 24));
|
|
60
|
+
const rightWidth = Math.max(12, safeWidth - leftWidth - gap);
|
|
61
|
+
const left = renderLeft(spec, leftWidth, theme);
|
|
62
|
+
const right = renderDetail(spec, rightWidth, theme);
|
|
63
|
+
const bodyHeight = Math.max(left.length, right.length);
|
|
64
|
+
const lines = [];
|
|
65
|
+
for (let i = 0; i < bodyHeight; i++) {
|
|
66
|
+
lines.push(fit(`${left[i] ?? blank(leftWidth)} ${right[i] ?? blank(rightWidth)}`, safeWidth));
|
|
67
|
+
}
|
|
68
|
+
lines.push(fit(spanLine(spec.footer.equipped, theme), safeWidth));
|
|
69
|
+
lines.push(fit(spec.footer.keys.map((key) => theme.color.dim(`[${key.key}]`) + theme.color.muted(key.label)).join(" "), safeWidth));
|
|
70
|
+
return lines.map((line) => fit(line, safeWidth));
|
|
71
|
+
}
|
|
72
|
+
function renderLeft(spec, width, theme) {
|
|
73
|
+
const lines = [topBorder(" LOADOUTS ", width, theme)];
|
|
74
|
+
for (const pane of spec.panes) {
|
|
75
|
+
lines.push(boxLine(theme.color.accent(`> ${pane.title}`), width, theme));
|
|
76
|
+
if (pane.rows.length === 0) {
|
|
77
|
+
lines.push(boxLine(theme.color.dim(" -- empty --"), width, theme));
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
for (const row of pane.rows) {
|
|
81
|
+
const glyph = theme.color[row.glyph.style](row.glyph.char);
|
|
82
|
+
const cursor = row.selected ? theme.color.accent(">") : " ";
|
|
83
|
+
const text = `${cursor} ${glyph} ${spanLine(row.spans, theme)}`;
|
|
84
|
+
lines.push(boxLine(row.selected ? theme.selected(padTo(text, width - 4)) : text, width, theme));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
lines.push(bottomBorder(width, theme));
|
|
88
|
+
return lines;
|
|
89
|
+
}
|
|
90
|
+
function renderDetail(spec, width, theme) {
|
|
91
|
+
const detail = spec.detail;
|
|
92
|
+
const lines = [topBorder(` ${detail?.title ?? "Detail"} `, width, theme)];
|
|
93
|
+
if (!detail) {
|
|
94
|
+
lines.push(boxLine(theme.color.dim("No detail"), width, theme));
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
for (const block of detail.blocks)
|
|
98
|
+
lines.push(boxLine(spanLine(block, theme), width, theme));
|
|
99
|
+
}
|
|
100
|
+
lines.push(bottomBorder(width, theme));
|
|
101
|
+
return lines;
|
|
102
|
+
}
|
|
103
|
+
function renderNarrow(spec, width, theme) {
|
|
104
|
+
const lines = [fit(theme.color.accent("LOADOUTS"), width)];
|
|
105
|
+
for (const pane of spec.panes) {
|
|
106
|
+
lines.push(fit(theme.color.accent(`> ${pane.title}`), width));
|
|
107
|
+
for (const row of pane.rows) {
|
|
108
|
+
const glyph = theme.color[row.glyph.style](row.glyph.char);
|
|
109
|
+
const cursor = row.selected ? ">" : " ";
|
|
110
|
+
lines.push(fit(`${cursor} ${glyph} ${spanLine(row.spans, theme)}`, width));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
lines.push(fit(spanLine(spec.footer.equipped, theme), width));
|
|
114
|
+
return lines;
|
|
115
|
+
}
|
|
116
|
+
export function renderOverlay(overlay, width, theme) {
|
|
117
|
+
const boxWidth = clamp(width, 24, Math.min(82, width));
|
|
118
|
+
const lines = [topBorder(` ${overlay.title} `, boxWidth, theme)];
|
|
119
|
+
for (const line of overlay.lines)
|
|
120
|
+
lines.push(boxLine(spanLine(line, theme), boxWidth, theme));
|
|
121
|
+
lines.push(boxLine(theme.color.dim("esc to close"), boxWidth, theme));
|
|
122
|
+
lines.push(bottomBorder(boxWidth, theme));
|
|
123
|
+
return lines.map((line) => fit(line, boxWidth));
|
|
124
|
+
}
|
|
125
|
+
function spanLine(spans, theme) {
|
|
126
|
+
return spans.map((span) => theme.color[span.style ?? "text"](span.text)).join("");
|
|
127
|
+
}
|
|
128
|
+
function topBorder(title, width, theme) {
|
|
129
|
+
const inner = Math.max(0, width - 2);
|
|
130
|
+
const clippedTitle = truncateToWidth(title, inner, "", false);
|
|
131
|
+
const rest = Math.max(0, inner - visibleWidth(clippedTitle));
|
|
132
|
+
return theme.color.border(`+${clippedTitle}${"-".repeat(rest)}+`);
|
|
133
|
+
}
|
|
134
|
+
function bottomBorder(width, theme) {
|
|
135
|
+
return theme.color.border(`+${"-".repeat(Math.max(0, width - 2))}+`);
|
|
136
|
+
}
|
|
137
|
+
function boxLine(line, width, theme) {
|
|
138
|
+
const inner = Math.max(0, width - 4);
|
|
139
|
+
return fit(`${theme.color.border("| ")}${fit(line, inner)}${theme.color.border(" |")}`, width);
|
|
140
|
+
}
|
|
141
|
+
function fit(line, width) {
|
|
142
|
+
return truncateToWidth(line, Math.max(0, width), "...", true);
|
|
143
|
+
}
|
|
144
|
+
function padTo(line, width) {
|
|
145
|
+
const clipped = truncateToWidth(line, Math.max(0, width), "...");
|
|
146
|
+
return clipped + " ".repeat(Math.max(0, width - visibleWidth(clipped)));
|
|
147
|
+
}
|
|
148
|
+
function blank(width) {
|
|
149
|
+
return " ".repeat(Math.max(0, width));
|
|
150
|
+
}
|
|
151
|
+
function clamp(value, min, max) {
|
|
152
|
+
return Math.max(min, Math.min(max, value));
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../../../src/tui/skins/pi-tui/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAkB,MAAM,wBAAwB,CAAC;AAIvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,YAAY,EAAmB,MAAM,YAAY,CAAC;AAQ3D,MAAM,OAAO,cAAc;IACjB,IAAI,CAAW;IACf,KAAK,CAAa;IAClB,QAAQ,CAA4B;IAE5C,YAAY,OAAkC;QAC5C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QA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AE,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;IACjE,OAAO,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC1E,CAAC;AAED,SAAS,KAAK,CAAC,KAAa;IAC1B,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AACxC,CAAC;AAED,SAAS,KAAK,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW;IACpD,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type StyleToken, type ThemeTokens } from "../../core/theme.js";
|
|
2
|
+
export type ColorFn = (text: string) => string;
|
|
3
|
+
export interface PiTuiTheme {
|
|
4
|
+
color: Record<StyleToken, ColorFn>;
|
|
5
|
+
selected: ColorFn;
|
|
6
|
+
background: ColorFn;
|
|
7
|
+
}
|
|
8
|
+
export declare function defaultPiTuiTokens(): ThemeTokens;
|
|
9
|
+
export declare function toPiTuiTheme(tokens?: ThemeTokens): PiTuiTheme;
|
|
10
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../src/tui/skins/pi-tui/theme.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAE5F,MAAM,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;AAE/C,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;CACrB;AAeD,wBAAgB,kBAAkB,IAAI,WAAW,CAOhD;AAED,wBAAgB,YAAY,CAAC,MAAM,GAAE,WAAkC,GAAG,UAAU,CAgCnF"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { defaultThemeTokens } from "../../core/theme.js";
|
|
3
|
+
const identity = (text) => text;
|
|
4
|
+
const DEFAULT_COLORS = {
|
|
5
|
+
text: "#d7dae0",
|
|
6
|
+
muted: "#8f98a8",
|
|
7
|
+
dim: "#5f6878",
|
|
8
|
+
accent: "#8bd5ff",
|
|
9
|
+
success: "#9ece6a",
|
|
10
|
+
error: "#ff6b7a",
|
|
11
|
+
warning: "#e0af68",
|
|
12
|
+
border: "#3b4261",
|
|
13
|
+
};
|
|
14
|
+
export function defaultPiTuiTokens() {
|
|
15
|
+
return {
|
|
16
|
+
...defaultThemeTokens,
|
|
17
|
+
...DEFAULT_COLORS,
|
|
18
|
+
background: "#11131a",
|
|
19
|
+
selectedBackground: "#27324a",
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export function toPiTuiTheme(tokens = defaultPiTuiTokens()) {
|
|
23
|
+
if (process.env.NO_COLOR) {
|
|
24
|
+
return {
|
|
25
|
+
color: {
|
|
26
|
+
text: identity,
|
|
27
|
+
muted: identity,
|
|
28
|
+
dim: identity,
|
|
29
|
+
accent: identity,
|
|
30
|
+
success: identity,
|
|
31
|
+
error: identity,
|
|
32
|
+
warning: identity,
|
|
33
|
+
border: identity,
|
|
34
|
+
},
|
|
35
|
+
selected: identity,
|
|
36
|
+
background: identity,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
color: {
|
|
41
|
+
text: colorFn(tokens.text, DEFAULT_COLORS.text),
|
|
42
|
+
muted: colorFn(tokens.muted, DEFAULT_COLORS.muted),
|
|
43
|
+
dim: colorFn(tokens.dim, DEFAULT_COLORS.dim),
|
|
44
|
+
accent: colorFn(tokens.accent, DEFAULT_COLORS.accent),
|
|
45
|
+
success: colorFn(tokens.success, DEFAULT_COLORS.success),
|
|
46
|
+
error: colorFn(tokens.error, DEFAULT_COLORS.error),
|
|
47
|
+
warning: colorFn(tokens.warning, DEFAULT_COLORS.warning),
|
|
48
|
+
border: colorFn(tokens.border, DEFAULT_COLORS.border),
|
|
49
|
+
},
|
|
50
|
+
selected: tokens.selectedBackground ? chalk.bgHex(tokens.selectedBackground) : chalk.bgHex("#27324a"),
|
|
51
|
+
background: tokens.background ? chalk.bgHex(tokens.background) : identity,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function colorFn(value, fallback) {
|
|
55
|
+
const color = value && value.startsWith("#") ? value : fallback;
|
|
56
|
+
return chalk.hex(color);
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../../../src/tui/skins/pi-tui/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAqC,MAAM,qBAAqB,CAAC;AAU5F,MAAM,QAAQ,GAAY,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC;AAEzC,MAAM,cAAc,GAA+B;IACjD,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,SAAS;IAChB,GAAG,EAAE,SAAS;IACd,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,SAAS;CAClB,CAAC;AAEF,MAAM,UAAU,kBAAkB;IAChC,OAAO;QACL,GAAG,kBAAkB;QACrB,GAAG,cAAc;QACjB,UAAU,EAAE,SAAS;QACrB,kBAAkB,EAAE,SAAS;KAC9B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU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,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ;KAC1E,CAAC;AACJ,CAAC;AAED,SAAS,OAAO,CAAC,KAAyB,EAAE,QAAgB;IAC1D,MAAM,KAAK,GAAG,KAAK,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;IAChE,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC"}
|
package/docs/authoring.md
CHANGED
|
@@ -219,7 +219,7 @@ include:
|
|
|
219
219
|
|
|
220
220
|
---
|
|
221
221
|
|
|
222
|
-
## OpenCode Config And Plugins
|
|
222
|
+
## OpenCode Config, Commands, And Plugins
|
|
223
223
|
|
|
224
224
|
OpenCode-specific artifacts live under `.loadouts/opencode/` and only render when included in a loadout that targets `opencode`.
|
|
225
225
|
|
|
@@ -234,6 +234,16 @@ OpenCode-specific artifacts live under `.loadouts/opencode/` and only render whe
|
|
|
234
234
|
|
|
235
235
|
Project scope renders this to `opencode.jsonc`. Global scope renders it to `~/.config/opencode/opencode.jsonc`. This is whole-file ownership; if you do not include this artifact, loadouts does not touch your OpenCode config file.
|
|
236
236
|
|
|
237
|
+
**Slash commands:**
|
|
238
|
+
```md
|
|
239
|
+
<!-- .loadouts/opencode/commands/loadouts.md -->
|
|
240
|
+
# /loadouts
|
|
241
|
+
|
|
242
|
+
Arguments: `$ARGUMENTS`
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Project scope renders this to `.opencode/commands/loadouts.md`. Global scope renders it to `~/.config/opencode/commands/loadouts.md`.
|
|
246
|
+
|
|
237
247
|
**Local plugins:**
|
|
238
248
|
```ts
|
|
239
249
|
// .loadouts/opencode/plugins/notify.ts
|
|
@@ -252,11 +262,53 @@ Project scope renders this to `.opencode/plugins/notify.ts`. Global scope render
|
|
|
252
262
|
```yaml
|
|
253
263
|
include:
|
|
254
264
|
- opencode/opencode.jsonc
|
|
265
|
+
- opencode/commands/loadouts.md
|
|
255
266
|
- opencode/plugins/notify.ts
|
|
256
267
|
```
|
|
257
268
|
|
|
258
269
|
NPM plugins belong in the managed `opencode.json(c)` `plugin` array. Local plugin source files belong in `.loadouts/opencode/plugins/`.
|
|
259
270
|
|
|
271
|
+
**TUI plugins:**
|
|
272
|
+
|
|
273
|
+
OpenCode TUI plugins are local plugin modules loaded from `tui.json(c)`. They are useful for user-facing UI that should not be added to chat or model-visible prompt context.
|
|
274
|
+
|
|
275
|
+
```tsx
|
|
276
|
+
// .loadouts/opencode/plugins/status-popup.tsx
|
|
277
|
+
/** @jsxImportSource @opentui/solid */
|
|
278
|
+
|
|
279
|
+
import type { TuiPlugin, TuiPluginModule } from "@opencode-ai/plugin/tui";
|
|
280
|
+
|
|
281
|
+
const tui: TuiPlugin = async (api) => {
|
|
282
|
+
api.keymap.registerLayer({
|
|
283
|
+
commands: [
|
|
284
|
+
{
|
|
285
|
+
name: "status_popup_open",
|
|
286
|
+
title: "Open status popup",
|
|
287
|
+
category: "Plugin",
|
|
288
|
+
namespace: "palette",
|
|
289
|
+
slashName: "status-popup",
|
|
290
|
+
run() {
|
|
291
|
+
api.ui.dialog.setSize("medium");
|
|
292
|
+
api.ui.dialog.replace(() => <box border paddingLeft={2}>TUI-only popup</box>);
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
],
|
|
296
|
+
});
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
export default { id: "status-popup", tui } satisfies TuiPluginModule & { id: string };
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
```jsonc
|
|
303
|
+
// .loadouts/opencode/tui.jsonc
|
|
304
|
+
{
|
|
305
|
+
"$schema": "https://opencode.ai/tui.json",
|
|
306
|
+
"plugin": ["./plugins/status-popup.tsx"]
|
|
307
|
+
}
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
Project scope renders this config to `.opencode/tui.jsonc`. Global scope renders it to `~/.config/opencode/tui.jsonc`. This is whole-file ownership; if you already manage `tui.jsonc`, add the plugin entry there instead of including this artifact.
|
|
311
|
+
|
|
260
312
|
---
|
|
261
313
|
|
|
262
314
|
## Custom Kinds
|
package/docs/commands.md
CHANGED
|
@@ -52,12 +52,16 @@ Compile a runtime bundle for inspection (no filesystem activation). Defaults to
|
|
|
52
52
|
loadouts runtime # Compile default loadout
|
|
53
53
|
loadouts runtime base backend # Compile multiple loadouts
|
|
54
54
|
loadouts runtime base --tool cursor # Target a different tool
|
|
55
|
+
loadouts runtime base -l # Force local/project scope
|
|
56
|
+
loadouts runtime base -g # Force global scope
|
|
55
57
|
loadouts runtime base --json # Output RuntimeBundle JSON only
|
|
56
58
|
loadouts runtime base --system-block # Output renderRuntimeSystemBlock(bundle) only
|
|
57
59
|
```
|
|
58
60
|
|
|
59
61
|
See `docs/runtime.md` for architecture, OpenCode-first integration flow, and per-tool capability flags.
|
|
60
62
|
|
|
63
|
+
For OpenCode runtime plugin integrations, this is exposed as `/loadouts activate|a|use ...`, `/loadouts list|ls`, `/loadouts info`, and `/loadouts clear`. The bundled fallback command omits `$ARGUMENTS` to reduce model-visible command noise, and runtime JSON/intermediate plugin output should stay hidden. User-visible slash command acknowledgment text may still be model-mediated by OpenCode even when plugin state handling is deterministic.
|
|
64
|
+
|
|
61
65
|
### `loadouts diff [name]`
|
|
62
66
|
Preview what would change if a loadout were applied.
|
|
63
67
|
```bash
|
package/docs/compatibility.md
CHANGED
|
@@ -4,13 +4,13 @@ Current built-in rendering targets for canonical artifacts.
|
|
|
4
4
|
|
|
5
5
|
## Artifact Paths (Project Scope)
|
|
6
6
|
|
|
7
|
-
| Tool | Rule | Skill | Agent | Instruction |
|
|
8
|
-
|
|
9
|
-
| Claude Code | `.claude/rules/<name>.md` | `.claude/skills/<name>/` | `.claude/agents/<name>.md` | `CLAUDE.md` (generated wrapper to `AGENTS.md`) |
|
|
10
|
-
| Cursor | `.cursor/rules/<name>.mdc` | `.cursor/skills/<name>/` | `.cursor/agents/<name>.md` | `AGENTS.md` |
|
|
11
|
-
| OpenCode | `.opencode/rules/<name>.md` | `.opencode/skills/<name>/` | `.opencode/agents/<name>.md` | `AGENTS.md` |
|
|
12
|
-
| Codex | - (no rule target) | `.agents/skills/<name>/` | `.codex/agents/<name>.toml` | `AGENTS.md` |
|
|
13
|
-
| Pi | - (no native rule target) | `.pi/skills/<name>/` | - | `AGENTS.md` |
|
|
7
|
+
| Tool | Rule | Skill | Agent | Instruction | Extra Artifacts |
|
|
8
|
+
|------|------|-------|-------|-------------|-----------------|
|
|
9
|
+
| Claude Code | `.claude/rules/<name>.md` | `.claude/skills/<name>/` | `.claude/agents/<name>.md` | `CLAUDE.md` (generated wrapper to `AGENTS.md`) | - |
|
|
10
|
+
| Cursor | `.cursor/rules/<name>.mdc` | `.cursor/skills/<name>/` | `.cursor/agents/<name>.md` | `AGENTS.md` | - |
|
|
11
|
+
| OpenCode | `.opencode/rules/<name>.md` | `.opencode/skills/<name>/` | `.opencode/agents/<name>.md` | `AGENTS.md` | `.opencode/commands/<name>.md`, `.opencode/plugins/<name>.{ts,tsx,js}`, `.opencode/tui.json(c)`, `opencode.json(c)` |
|
|
12
|
+
| Codex | - (no rule target) | `.agents/skills/<name>/` | `.codex/agents/<name>.toml` | `AGENTS.md` | - |
|
|
13
|
+
| Pi | - (no native rule target) | `.pi/skills/<name>/` | - | `AGENTS.md` | - |
|
|
14
14
|
|
|
15
15
|
Global scope uses each tool's configured global base path. Instruction files may render to home-level `AGENTS.md` or `CLAUDE.md` paths depending on the tool.
|
|
16
16
|
|
package/docs/concepts.md
CHANGED
|
@@ -79,7 +79,9 @@ include:
|
|
|
79
79
|
| `prompt` | file | Slash command templates |
|
|
80
80
|
| `extension` | directory | Runtime code extensions |
|
|
81
81
|
| `theme` | file | UI theme configuration |
|
|
82
|
+
| `opencode-command` | file | OpenCode slash command markdown |
|
|
82
83
|
| `opencode-config` | file | Whole-file OpenCode runtime configuration |
|
|
84
|
+
| `opencode-tui-config` | file | Whole-file OpenCode TUI configuration |
|
|
83
85
|
| `opencode-plugin` | file | Local OpenCode plugin modules |
|
|
84
86
|
|
|
85
87
|
## Supported Tools
|
|
@@ -88,9 +90,9 @@ include:
|
|
|
88
90
|
|------|-------|--------|--------|--------------|-----------------|
|
|
89
91
|
| Claude Code | `.claude/rules/*.md` | `.claude/skills/` | `.claude/agents/*.md` | `CLAUDE.md` | — |
|
|
90
92
|
| Cursor | `.cursor/rules/*.mdc` | `.cursor/skills/` | `.cursor/agents/*.md` | `AGENTS.md` | — |
|
|
91
|
-
| OpenCode | `.opencode/rules/*.md` | `.opencode/skills/` | `.opencode/agents/*.md` | `AGENTS.md` | `opencode.json(c)`, `.opencode/plugins
|
|
93
|
+
| OpenCode | `.opencode/rules/*.md` | `.opencode/skills/` | `.opencode/agents/*.md` | `AGENTS.md` | `opencode.json(c)`, `.opencode/tui.json(c)`, `.opencode/plugins/`, `.opencode/commands/*.md` |
|
|
92
94
|
| Codex | — | `.agents/skills/` | `.codex/agents/*.toml` | `AGENTS.md` | — |
|
|
93
|
-
| Pi |
|
|
95
|
+
| Pi | — | `.pi/skills/` | — | `AGENTS.md` | `.pi/prompts/*.md`, `.pi/extensions/`, `.pi/themes/` |
|
|
94
96
|
|
|
95
97
|
## Sources (Cross-Project Config)
|
|
96
98
|
|
package/docs/runtime.md
CHANGED
|
@@ -43,6 +43,37 @@ Recommended integration pattern:
|
|
|
43
43
|
- Inject `instructions` and `rules` into model/system context.
|
|
44
44
|
- Register `skills[*].path` for discovery only.
|
|
45
45
|
|
|
46
|
+
### Slash Command UX (`/loadouts`)
|
|
47
|
+
|
|
48
|
+
The OpenCode runtime path is designed around a deterministic plugin-backed slash command:
|
|
49
|
+
|
|
50
|
+
```text
|
|
51
|
+
/loadouts activate base
|
|
52
|
+
/loadouts a base -l
|
|
53
|
+
/loadouts a release -g
|
|
54
|
+
/loadouts list
|
|
55
|
+
/loadouts info base
|
|
56
|
+
/loadouts clear
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Expected behavior:
|
|
60
|
+
|
|
61
|
+
- The server plugin maps `/loadouts activate|a|use <names...>` to `loadouts runtime ...` (or equivalent runtime adapter path) and computes session runtime state deterministically.
|
|
62
|
+
- The TUI plugin listens for server plugin events and renders status/results in a TUI-only dialog that is not appended to chat and is not visible to the assistant.
|
|
63
|
+
- `-l/--local` and `-g/--global` are supported as direct scope selectors for runtime compilation.
|
|
64
|
+
- Runtime JSON and intermediate plugin outputs stay hidden from the model-facing response.
|
|
65
|
+
- The server and TUI plugins share persisted runtime state through `~/.cache/loadouts/opencode-runtime/<cwd-hash>.json`; the server plugin uses that state during system-message injection.
|
|
66
|
+
- A bundled scaffold loadout (`opencode-runtime`) renders `.opencode/plugins/loadouts-runtime.ts`, `.opencode/plugins/loadouts-runtime-tui.tsx`, and `.opencode/tui.jsonc`.
|
|
67
|
+
|
|
68
|
+
### Known OpenCode Runtime Semantics
|
|
69
|
+
|
|
70
|
+
- The runtime plugin's `command.execute.before` hook is deterministic for parsing `/loadouts` arguments and updating runtime state.
|
|
71
|
+
- In interactive OpenCode, the server plugin owns `/loadouts` command handling and the TUI plugin owns user-visible feedback. If the TUI plugin is not loaded, the server plugin remains the headless/fallback path.
|
|
72
|
+
- OpenCode may still route server slash command text through model-facing flows when the TUI plugin is absent. Treat user-visible server acknowledgment text as host-dependent.
|
|
73
|
+
- OpenCode loads server plugins and TUI plugins at startup. Restart OpenCode after changing or activating runtime plugin or TUI config artifacts.
|
|
74
|
+
- The plugin bridge shells out to `loadouts runtime ...`. Ensure the `loadouts` binary available on OpenCode's `PATH` includes runtime support.
|
|
75
|
+
- The bundled TUI config is whole-file managed like other Loadouts config artifacts. Existing unmanaged `.opencode/tui.jsonc` files are protected by normal shadowing; add `./plugins/loadouts-runtime-tui.tsx` to your existing TUI config if needed.
|
|
76
|
+
|
|
46
77
|
## Tool Capability Matrix (Runtime v1)
|
|
47
78
|
|
|
48
79
|
The bundle always includes resolved instructions, rules, and skill references. Capability flags tell consumers what should be treated as native runtime behavior for each tool.
|
|
@@ -67,6 +98,10 @@ For filesystem-first tools, use standard `activate/sync` as the primary path and
|
|
|
67
98
|
|
|
68
99
|
## Reference Scaffold
|
|
69
100
|
|
|
70
|
-
-
|
|
101
|
+
- Bundled OpenCode server runtime plugin: `bundled/opencode/plugins/loadouts-runtime.ts`
|
|
102
|
+
- Bundled OpenCode TUI runtime plugin: `bundled/opencode/plugins/loadouts-runtime-tui.tsx`
|
|
103
|
+
- Bundled OpenCode TUI config: `bundled/opencode/tui.jsonc`
|
|
104
|
+
- Bundled scaffold loadout: `bundled/loadouts/opencode-runtime.yaml`
|
|
105
|
+
- Historical/reference plugin scaffold: `docs/examples/opencode-runtime-plugin.ts`
|
|
71
106
|
- Core compiler implementation: `src/core/runtime.ts`
|
|
72
107
|
- CLI command surface: `src/cli/commands/runtime.ts`
|
package/docs/troubleshooting.md
CHANGED
|
@@ -51,7 +51,24 @@ loadouts sync # Re-render if needed
|
|
|
51
51
|
|
|
52
52
|
**Cursor:** Rules need `.mdc` extension — loadouts handles this automatically. Restart Cursor if rules don't appear immediately.
|
|
53
53
|
|
|
54
|
-
**OpenCode:** Rules render to `.opencode/rules
|
|
54
|
+
**OpenCode:** Rules render to `.opencode/rules/`, commands to `.opencode/commands/`, local plugins to `.opencode/plugins/`, and NPM plugins are configured with the `plugin` array in `opencode.json(c)`.
|
|
55
|
+
|
|
56
|
+
### `/loadouts` not working in OpenCode runtime
|
|
57
|
+
|
|
58
|
+
If `/loadouts` exists but does not activate runtime behavior, verify the full chain:
|
|
59
|
+
|
|
60
|
+
1. Runtime artifacts are rendered in the expected scope:
|
|
61
|
+
- Local server plugin: `.opencode/plugins/loadouts-runtime.ts`
|
|
62
|
+
- Local TUI plugin/config: `.opencode/plugins/loadouts-runtime-tui.tsx` and `.opencode/tui.jsonc`
|
|
63
|
+
- Global server plugin: `~/.config/opencode/plugins/loadouts-runtime.ts`
|
|
64
|
+
- Global TUI plugin/config: `~/.config/opencode/plugins/loadouts-runtime-tui.tsx` and `~/.config/opencode/tui.jsonc`
|
|
65
|
+
2. Runtime scaffold is active in the same scope (`loadouts info -l` or `loadouts info -g`).
|
|
66
|
+
3. Restart OpenCode after activation or plugin/TUI config changes (startup-time plugin loading).
|
|
67
|
+
4. Check the `loadouts` binary on OpenCode's `PATH` supports runtime:
|
|
68
|
+
```bash
|
|
69
|
+
loadouts runtime base --tool opencode --json
|
|
70
|
+
```
|
|
71
|
+
5. In interactive OpenCode, the server plugin owns `/loadouts` and the TUI plugin listens for server events to render a user-only dialog. If command acknowledgment text looks model-generated, the TUI plugin is probably not loaded; the deterministic fallback is still server plugin state update and runtime system injection.
|
|
55
72
|
|
|
56
73
|
**Claude Code:** Verify rules exist in `.claude/rules/`. May require restarting the session.
|
|
57
74
|
|