@krtclcdy/tersio 2.4.1 → 2.6.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.
@@ -0,0 +1,148 @@
1
+ // /tersio unified root command — routes every tersio capability through one
2
+ // namespaced entrypoint. Aliases (/caveman, /rtk, /combo, /ai-addons) keep
3
+ // working: this router drives the same shared bridge + session entries the
4
+ // sibling extensions restore from, then reloads so their local mirrors sync
5
+ // (same mechanism /combo already uses to drive its siblings).
6
+ import { COMBO_LEVELS, activeModesSummary, getSharedComboState, normalizeComboLevel, normalizeMode, reconcileSharedComboEntries, sessionEntries, setSharedComboLevel, setSharedComboMode, } from '../shared/session-state.js';
7
+ import { appendUsage, readUsage } from '../shared/usage-ledger.js';
8
+ import { checkAddonsSummary, runAddonUpdate } from '../ai-addons-updater/index.js';
9
+ const HELP = [
10
+ '/tersio caveman lite|full|ultra|wenyan|off — terse-reply mode',
11
+ '/tersio combo off|medium|balanced|max — preset for all three modes',
12
+ '/tersio rtk on|off — compact shell output',
13
+ '/tersio ponytail off|lite|full|ultra|review — minimal code',
14
+ '/tersio status — active modes + combo level',
15
+ '/tersio check — add-on version check',
16
+ '/tersio update <ponytail|rtk|caveman|all> [--dry-run]',
17
+ '/tersio gain — savings summary + dashboard hint',
18
+ '/tersio usage — ledger report for this machine',
19
+ '/tersio help — this table',
20
+ 'aliases (still work): /caveman /rtk /combo /ai-addons',
21
+ ].join('\n');
22
+ function statusLine() {
23
+ const s = getSharedComboState();
24
+ const level = s.level === 'custom' ? 'INACTIVE' : s.level.toUpperCase();
25
+ return `tersio — caveman=${s.caveman.toUpperCase()} · rtk=${s.rtk.toUpperCase()} · ponytail=${s.ponytail.toUpperCase()} (combo ${level})`;
26
+ }
27
+ function usageSummary() {
28
+ const rows = readUsage();
29
+ if (rows.length === 0)
30
+ return 'tersio usage: no ledger yet — run commands first.';
31
+ const byKind = {};
32
+ for (const r of rows)
33
+ byKind[r.kind] = (byKind[r.kind] ?? 0) + 1;
34
+ const parts = Object.entries(byKind).map(([k, n]) => `${k}×${n}`);
35
+ const last = new Date(rows[rows.length - 1].ts).toISOString();
36
+ return `tersio usage: ${rows.length} rows (${parts.join(', ')}), last write ${last}.`;
37
+ }
38
+ export default function tersioCommandsExtension(pi) {
39
+ pi.setLabel?.('Tersio unified root command');
40
+ async function reload(ctx) {
41
+ if (ctx?.reload)
42
+ await ctx.reload();
43
+ }
44
+ pi.registerCommand?.('tersio', {
45
+ description: 'Tersio root: caveman|combo|rtk|ponytail|status|check|update|gain|usage|help',
46
+ handler: async (args, ctx) => {
47
+ const parts = String(args || '').trim().toLowerCase().split(/\s+/).filter(Boolean);
48
+ const [sub, rest] = [parts[0], parts.slice(1).join(' ')];
49
+ appendUsage('command', `/tersio ${parts.join(' ')}`.trim());
50
+ if (!sub || sub === 'status') {
51
+ if (ctx?.hasUI)
52
+ reconcileSharedComboEntries(sessionEntries(ctx));
53
+ ctx?.ui?.notify?.(statusLine(), 'info');
54
+ return;
55
+ }
56
+ if (sub === 'help') {
57
+ ctx?.ui?.notify?.(HELP, 'info');
58
+ return;
59
+ }
60
+ if (sub === 'caveman') {
61
+ const mode = normalizeMode('caveman', rest);
62
+ if (!mode) {
63
+ ctx?.ui?.notify?.('Usage: /tersio caveman [lite|full|ultra|wenyan|off|status]', 'warning');
64
+ return;
65
+ }
66
+ pi.appendEntry?.('caveman-mode', { mode });
67
+ setSharedComboMode('caveman', mode);
68
+ appendUsage('toggle', `caveman=${mode}`);
69
+ ctx?.ui?.notify?.(`Caveman ${mode} on — Active: ${activeModesSummary(getSharedComboState())}.`, 'info');
70
+ await reload(ctx);
71
+ return;
72
+ }
73
+ if (sub === 'rtk') {
74
+ if (!rest || rest === 'status') {
75
+ const on = getSharedComboState().rtk === 'on';
76
+ ctx?.ui?.notify?.(`RTK: ${on ? 'on' : 'off'}`, 'info');
77
+ return;
78
+ }
79
+ if (!['on', 'off'].includes(rest)) {
80
+ ctx?.ui?.notify?.('Usage: /tersio rtk [on|off|status]', 'warning');
81
+ return;
82
+ }
83
+ const enabled = rest === 'on';
84
+ pi.appendEntry?.('rtk-mode', { enabled });
85
+ setSharedComboMode('rtk', enabled);
86
+ appendUsage('toggle', `rtk=${rest}`);
87
+ ctx?.ui?.notify?.(`RTK ${rest} — Active: ${activeModesSummary(getSharedComboState())}.`, 'info');
88
+ await reload(ctx);
89
+ return;
90
+ }
91
+ if (sub === 'ponytail') {
92
+ const mode = normalizeMode('ponytail', rest);
93
+ if (!mode) {
94
+ ctx?.ui?.notify?.('Usage: /tersio ponytail [off|lite|full|ultra|review|status]', 'warning');
95
+ return;
96
+ }
97
+ pi.appendEntry?.('ponytail-mode', { mode });
98
+ setSharedComboMode('ponytail', mode);
99
+ appendUsage('toggle', `ponytail=${mode}`);
100
+ ctx?.ui?.notify?.(`Ponytail ${mode} — Active: ${activeModesSummary(getSharedComboState())}.`, 'info');
101
+ await reload(ctx);
102
+ return;
103
+ }
104
+ if (sub === 'combo') {
105
+ if (!rest || rest === 'status') {
106
+ if (ctx?.hasUI)
107
+ reconcileSharedComboEntries(sessionEntries(ctx));
108
+ ctx?.ui?.notify?.(statusLine(), 'info');
109
+ return;
110
+ }
111
+ const level = normalizeComboLevel(rest);
112
+ if (!level) {
113
+ ctx?.ui?.notify?.('Unknown combo level. Use: off | medium | balanced | max', 'warning');
114
+ return;
115
+ }
116
+ const modes = COMBO_LEVELS[level];
117
+ pi.appendEntry?.('caveman-mode', { mode: modes.caveman });
118
+ pi.appendEntry?.('rtk-mode', { enabled: modes.rtk === 'on' });
119
+ pi.appendEntry?.('ponytail-mode', { mode: modes.ponytail });
120
+ pi.appendEntry?.('combo-level', { level });
121
+ setSharedComboLevel(level);
122
+ appendUsage('toggle', `combo=${level}`);
123
+ ctx?.ui?.notify?.(`Combo ${level} on — ${activeModesSummary(getSharedComboState())} active for this session.`, 'info');
124
+ await reload(ctx);
125
+ return;
126
+ }
127
+ if (sub === 'check') {
128
+ await checkAddonsSummary(ctx);
129
+ return;
130
+ }
131
+ if (sub === 'update') {
132
+ const dryRun = parts.includes('--dry-run');
133
+ const target = parts.filter((p) => p !== '--dry-run' && p !== 'update' && p !== 'tersio').join(' ');
134
+ if (!target) {
135
+ ctx?.ui?.notify?.('Usage: /tersio update <ponytail|rtk|caveman|all> [--dry-run]', 'warning');
136
+ return;
137
+ }
138
+ await runAddonUpdate(pi, ctx, target, dryRun);
139
+ return;
140
+ }
141
+ if (sub === 'gain' || sub === 'usage') {
142
+ ctx?.ui?.notify?.(`${usageSummary()}\nFull dashboard: run \`tersio dashboard --open\` in a shell.`, 'info');
143
+ return;
144
+ }
145
+ ctx?.ui?.notify?.(`Unknown subcommand: ${sub}.\n${HELP}`, 'warning');
146
+ },
147
+ });
148
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krtclcdy/tersio",
3
- "version": "2.4.1",
3
+ "version": "2.6.0",
4
4
  "description": "✂️ Token-saving OMP add-ons: terse Caveman replies, compact RTK shell output, lean Ponytail code calls — one-command combo presets.",
5
5
  "keywords": [
6
6
  "omp",
@@ -60,6 +60,13 @@
60
60
  "extensions": [
61
61
  "./extensions/ai-addons-updater/index.js"
62
62
  ]
63
+ },
64
+ "tersio": {
65
+ "description": "Unified /tersio root command (caveman, combo, rtk, ponytail, status, check, update, gain, usage)",
66
+ "default": true,
67
+ "extensions": [
68
+ "./extensions/tersio-commands/index.js"
69
+ ]
63
70
  }
64
71
  },
65
72
  "settings": {
@@ -107,10 +114,13 @@
107
114
  },
108
115
  "files": [
109
116
  "tersio.js",
117
+ "cli/**/*.js",
118
+ "cli/dashboard.html",
119
+ "cli/brand.webp",
110
120
  "extensions/**/*.js"
111
121
  ],
112
122
  "scripts": {
113
- "clean": "rm -f tersio.js extensions/**/*.js",
123
+ "clean": "rm -f tersio.js cli/*.js extensions/**/*.js",
114
124
  "build": "tsc",
115
125
  "prepublishOnly": "npm run build",
116
126
  "check": "tsc --noEmit",