@nevermorelove/ompp 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ForeverInLaw
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # ompp
2
+
3
+ Mode presets for the [omp](https://github.com/can1357/oh-my-pi) coding agent.
4
+
5
+ omp loads every skill, prompt file, and MCP server it can find on your machine, every session. With 80 skills installed, the system prompt carries 80 descriptions even when three would do, and switching personas means renaming `SYSTEM.md` by hand.
6
+
7
+ ompp gives each kind of work a name and a folder. Launch a session in a mode and it starts with only what that work needs.
8
+
9
+ ## Install
10
+
11
+ ```sh
12
+ git clone git@github.com:ForeverInLaw/ompp.git
13
+ cd ompp
14
+ npm install -g .
15
+ ```
16
+
17
+ Node 18 or newer, that is the whole requirement. bun works too. After install, `ompp` is on your PATH. To update, `git pull` and install again.
18
+
19
+ ## Usage
20
+
21
+ ```sh
22
+ ompp arrow-key picker, then launches omp
23
+ ompp pentest launch in a mode
24
+ ompp writing -p "..." mode plus any omp flags
25
+ ompp list print mode names
26
+ ompp pentest --dry-run show the omp command line instead of running it
27
+ ```
28
+
29
+ Before launch it prints one line to stderr, `[ompp] mode: pentest`, so you always know where you are.
30
+
31
+ ## What a mode is
32
+
33
+ A folder under `modes/`. Every file is optional, whatever exists gets wired into the launch flags.
34
+
35
+ ```
36
+ modes/pentest/
37
+ config.yml settings overlay
38
+ system.md full system prompt replacement
39
+ append.md prompt addendum, used when system.md is absent
40
+ skills/ skills only this mode sees
41
+ .mcp.json MCP servers only this mode gets
42
+ prompts/ commands/ rules/ hooks/ tools/ also load from the mode folder
43
+ ```
44
+
45
+ | File | omp flag | What goes in it |
46
+ | --- | --- | --- |
47
+ | `config.yml` | `--config` | Any OMP setting. `modelRoles.default`, `defaultThinkingLevel`, `tools.approvalMode`, the `skills.includeSkills` glob allowlist and friends. |
48
+ | `system.md` | `--system-prompt` | Replaces the prompt whole. The default omp instructions, your global `SYSTEM.md`, and the built-in tool policy are gone. Write what you need. |
49
+ | `append.md` | `--append-system-prompt` | Rides on top of your normal prompt. This is what most modes want. |
50
+ | the folder itself | `--plugin-dir` | omp treats the mode folder as a plugin root, so `skills/` and `.mcp.json` inside it load too. |
51
+
52
+ A new mode is `mkdir modes/<name>` plus files. No manifest, no code. The wrapper reads the folder, so it never needs to change when you add modes. `modes/general` is a working example to copy from.
53
+
54
+ ## Precedence
55
+
56
+ Your flags beat the mode.
57
+
58
+ `ompp pentest --model anthropic/claude-sonnet-4-5` runs Sonnet even when the mode's `config.yml` says otherwise. An explicit `--system-prompt` on the command line disables the mode's prompt file for that run. Later `--config` overlays win too, so single keys can be overridden ad hoc.
59
+
60
+ `append.md` stacks on omp's default prompt plus your global `~/.omp/agent/SYSTEM.md` if you have one. A mode with `system.md` replaces all of it.
61
+
62
+ ## Limits worth knowing
63
+
64
+ MCP servers can be added by a mode but never removed. omp has no launch-time MCP filter, so a mode that wants fewer servers than your global `mcp.json` provides has to live with them. This is the one gap that would need an omp extension to close.
65
+
66
+ Mode-local `skills/` are additive as well. To have fewer skills, set `skills.includeSkills` in the mode's `config.yml`. The allowlist filters every discovered skill, global ones included.
67
+
68
+ The picker needs a TTY. Piped or otherwise headless stdin gets a numbered prompt instead.
69
+
70
+ ## Environment
71
+
72
+ - `OMPP_MODES_DIR`, where modes live. Default is `modes/` next to the script.
73
+ - `OMPP_OMP_BIN`, which omp to launch. Default is omp from PATH.
package/modes/.gitkeep ADDED
File without changes
@@ -0,0 +1,3 @@
1
+ # General
2
+
3
+ Answer directly and briefly. No preamble, no restating the question.
@@ -0,0 +1,8 @@
1
+ modelRoles:
2
+ default: crusoe/zai-org/GLM-5.3:max
3
+ defaultThinkingLevel: high
4
+ skills:
5
+ includeSkills:
6
+ - unslop
7
+ - tdd
8
+ - diagnosing-bugs
package/ompp.js ADDED
@@ -0,0 +1,359 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * ompp — mode presets for the omp coding agent.
4
+ *
5
+ * A mode is a folder under modes/. Whatever the folder contains gets wired
6
+ * into the omp launch flags:
7
+ *
8
+ * config.yml | config.yaml -> --config (settings overlay)
9
+ * system.md -> --system-prompt (replaces default prompt)
10
+ * append.md -> --append-system-prompt (used when system.md is absent)
11
+ * skills/ .mcp.json prompts/ commands/ rules/ hooks/ tools/
12
+ * -> --plugin-dir (mode-local skills and MCP)
13
+ *
14
+ * Every file is optional. Everything after the mode name goes to omp as-is;
15
+ * user flags win over the mode.
16
+ */
17
+ "use strict";
18
+
19
+ const fs = require("fs");
20
+ const path = require("path");
21
+ const { spawn } = require("child_process");
22
+
23
+ const MODES_DIR = process.env.OMPP_MODES_DIR || path.join(__dirname, "modes");
24
+ const CONFIG_NAMES = ["config.yml", "config.yaml"];
25
+ const PLUGIN_ARTIFACTS = [
26
+ "skills",
27
+ ".mcp.json",
28
+ "prompts",
29
+ "commands",
30
+ "rules",
31
+ "hooks",
32
+ "tools",
33
+ ];
34
+
35
+ function firstExisting(dir, names) {
36
+ for (const n of names) {
37
+ const p = path.join(dir, n);
38
+ if (fs.existsSync(p)) return p;
39
+ }
40
+ return null;
41
+ }
42
+
43
+ function discoverModes() {
44
+ const modes = [];
45
+ const skipped = [];
46
+ if (!fs.existsSync(MODES_DIR)) return { modes, skipped };
47
+ const entries = fs
48
+ .readdirSync(MODES_DIR, { withFileTypes: true })
49
+ .filter((e) => e.isDirectory())
50
+ .map((e) => e.name)
51
+ .sort();
52
+ for (const name of entries) {
53
+ if (name.startsWith(".") || name.startsWith("_")) continue;
54
+ const dir = path.join(MODES_DIR, name);
55
+ const hasSomething = firstExisting(dir, [
56
+ ...CONFIG_NAMES,
57
+ "system.md",
58
+ "append.md",
59
+ ...PLUGIN_ARTIFACTS,
60
+ ]);
61
+ if (hasSomething) modes.push(name);
62
+ else skipped.push(name);
63
+ }
64
+ return { modes, skipped };
65
+ }
66
+
67
+ function buildArgv(modeDir, userArgs) {
68
+ const args = [];
69
+ // An explicit user flag replaces the mode's counterpart instead of racing it.
70
+ const userHas = (flag) =>
71
+ userArgs.some((a) => a === flag || a.startsWith(flag + "="));
72
+
73
+ const cfg = firstExisting(modeDir, CONFIG_NAMES);
74
+ if (cfg) args.push("--config", cfg);
75
+
76
+ const systemMd = path.join(modeDir, "system.md");
77
+ const appendMd = path.join(modeDir, "append.md");
78
+ if (fs.existsSync(systemMd) && !userHas("--system-prompt")) {
79
+ args.push("--system-prompt", systemMd);
80
+ } else if (fs.existsSync(appendMd) && !userHas("--append-system-prompt")) {
81
+ args.push("--append-system-prompt", appendMd);
82
+ }
83
+
84
+ if (firstExisting(modeDir, PLUGIN_ARTIFACTS)) {
85
+ args.push("--plugin-dir", modeDir);
86
+ }
87
+
88
+ args.push(...userArgs);
89
+ return args;
90
+ }
91
+
92
+ function resolveBin() {
93
+ const override = process.env.OMPP_OMP_BIN;
94
+ if (override) {
95
+ const needsShell =
96
+ process.platform === "win32" && /\.(cmd|bat)$/i.test(override);
97
+ return { bin: override, shell: needsShell };
98
+ }
99
+ if (process.platform !== "win32") return { bin: "omp", shell: false };
100
+ // Windows: Node's spawn does no PATHEXT resolution, find omp ourselves.
101
+ const exts = (process.env.PATHEXT || ".exe;.cmd;.bat")
102
+ .split(";")
103
+ .filter(Boolean);
104
+ const pathDirs = (process.env.PATH || "").split(path.delimiter);
105
+ for (const dir of pathDirs) {
106
+ const d = dir.replace(/^"|"$/g, "");
107
+ if (!d) continue;
108
+ for (const ext of exts) {
109
+ const cand = path.join(d, "omp" + ext.toLowerCase());
110
+ if (!fs.existsSync(cand)) continue;
111
+ return {
112
+ bin: cand,
113
+ shell: /\.(cmd|bat)$/i.test(cand),
114
+ };
115
+ }
116
+ }
117
+ return { bin: "omp", shell: true }; // last resort: let the shell find it
118
+ }
119
+
120
+ function winQuote(s) {
121
+ if (!/[\s"]/ .test(s)) return s;
122
+ return '"' + s.replace(/"/g, '""') + '"';
123
+ }
124
+
125
+
126
+ function usage() {
127
+ console.log(`ompp — mode presets for the omp coding agent
128
+
129
+ Usage:
130
+ ompp pick a mode interactively, then launch omp
131
+ ompp <mode> [args...] launch omp in a mode; everything after <mode>
132
+ is passed to omp unchanged and wins over the mode
133
+ ompp list list available modes
134
+
135
+ A mode is a folder under modes/. All files are optional:
136
+ config.yml settings overlay: model, thinking level,
137
+ skills.includeSkills allowlist, approval mode, ...
138
+ system.md replaces the system prompt entirely
139
+ append.md appended to the system prompt (unless system.md exists)
140
+ skills/ mode-local skills (SKILL.md needs a description)
141
+ .mcp.json mode-local MCP servers, added on top of global ones
142
+ prompts/ commands/ rules/ hooks/ tools/ also load from the mode folder
143
+
144
+ Flags:
145
+ --dry-run print the omp command line instead of launching
146
+ -h, --help this help
147
+ -v, --version version
148
+
149
+ Environment:
150
+ OMPP_MODES_DIR modes directory (default: modes/ next to this script)
151
+ OMPP_OMP_BIN omp executable to launch (default: omp from PATH)`);
152
+ }
153
+
154
+ function pickInteractive(modes) {
155
+ return new Promise((resolve, reject) => {
156
+ const stdin = process.stdin;
157
+ let idx = 0;
158
+ let settled = false;
159
+
160
+ const finish = (value) => {
161
+ if (settled) return;
162
+ settled = true;
163
+ stdin.removeListener("data", onData);
164
+ stdin.setRawMode(false);
165
+ process.stdout.write("\u001b[?25h"); // show cursor
166
+ if (value === null) reject(new Error("mode selection cancelled"));
167
+ else resolve(value);
168
+ };
169
+
170
+ const render = (first) => {
171
+ if (!first) process.stdout.write(`\u001b[${modes.length}A`);
172
+ const body = modes
173
+ .map((m, i) => (i === idx ? "> " + m : " " + m))
174
+ .map((l) => "\u001b[2K" + l)
175
+ .join("\n");
176
+ process.stdout.write("\u001b[?25l" + body + "\n");
177
+ };
178
+
179
+ function onData(buf) {
180
+ // A single read can carry several keys (arrow + Enter glued together,
181
+ // a paste). Walk key by key instead of matching the whole chunk.
182
+ const s = buf.toString();
183
+ let i = 0;
184
+ while (i < s.length) {
185
+ const ch = s[i];
186
+ if (ch === "\u001b") {
187
+ const seq = s.slice(i);
188
+ if (seq.startsWith("\u001b[A") || seq.startsWith("\u001b[B") ||
189
+ seq.startsWith("\u001b[C") || seq.startsWith("\u001b[D")) {
190
+ if (seq.startsWith("\u001b[A")) {
191
+ idx = (idx - 1 + modes.length) % modes.length;
192
+ render(false);
193
+ } else if (seq.startsWith("\u001b[B")) {
194
+ idx = (idx + 1) % modes.length;
195
+ render(false);
196
+ } // C/D: left/right, ignore
197
+ i += 3;
198
+ continue;
199
+ }
200
+ if (seq.length === 1) {
201
+ // Bare escape with nothing after it in this chunk: cancel.
202
+ finish(null);
203
+ process.exit(0);
204
+ }
205
+ i++; // unknown or split sequence, skip the escape byte
206
+ continue;
207
+ }
208
+ if (ch === "\r" || ch === "\n") return finish(modes[idx]);
209
+ if (ch === "\u0003") {
210
+ // Ctrl+C: restore the terminal and bail like a shell would.
211
+ finish(null);
212
+ process.exit(130);
213
+ }
214
+ if (ch === "q") {
215
+ finish(null);
216
+ process.exit(0);
217
+ }
218
+ if (ch === "j") {
219
+ idx = (idx + 1) % modes.length;
220
+ render(false);
221
+ }
222
+ if (ch === "k") {
223
+ idx = (idx - 1 + modes.length) % modes.length;
224
+ render(false);
225
+ }
226
+ i++;
227
+ }
228
+ }
229
+
230
+ stdin.setRawMode(true);
231
+ stdin.resume();
232
+ stdin.on("data", onData);
233
+ render(true);
234
+ });
235
+ }
236
+
237
+ function pickByNumber(modes) {
238
+ return new Promise((resolve, reject) => {
239
+ const readline = require("readline");
240
+ const rl = readline.createInterface({ input: process.stdin });
241
+ process.stdout.write("Select a mode:\n");
242
+ modes.forEach((m, i) => process.stdout.write(` ${i + 1}. ${m}\n`));
243
+ process.stdout.write(`Choice [1-${modes.length}]: `);
244
+ rl.once("line", (line) => {
245
+ rl.close();
246
+ const n = parseInt(line.trim(), 10);
247
+ if (n >= 1 && n <= modes.length) resolve(modes[n - 1]);
248
+ else reject(new Error(`"${line.trim()}" is not a valid choice`));
249
+ });
250
+ rl.once("close", () => {
251
+ reject(new Error("no mode selected"));
252
+ });
253
+ });
254
+ }
255
+
256
+ async function main() {
257
+ const argv = process.argv.slice(2);
258
+
259
+ if (argv[0] === "list") {
260
+ const { modes, skipped } = discoverModes();
261
+ if (!modes.length) {
262
+ console.error(
263
+ `[ompp] no modes found in ${MODES_DIR}. Create modes/<name>/ with at least one mode file.`,
264
+ );
265
+ return 1;
266
+ }
267
+ for (const m of modes) console.log(m);
268
+ if (skipped.length) {
269
+ console.error(
270
+ `[ompp] skipped folders without recognized files: ${skipped.join(", ")}`,
271
+ );
272
+ }
273
+ return 0;
274
+ }
275
+
276
+ if (["-h", "--help", "help"].includes(argv[0])) {
277
+ usage();
278
+ return 0;
279
+ }
280
+ if (["-v", "--version", "version"].includes(argv[0])) {
281
+ console.log(require("./package.json").version);
282
+ return 0;
283
+ }
284
+
285
+ const dryRun = argv.includes("--dry-run");
286
+ const rest = argv.filter((a) => a !== "--dry-run");
287
+
288
+ const { modes, skipped } = discoverModes();
289
+ if (skipped.length) {
290
+ console.error(
291
+ `[ompp] skipped folders without recognized files: ${skipped.join(", ")}`,
292
+ );
293
+ }
294
+ if (!modes.length) {
295
+ console.error(
296
+ `[ompp] no modes found in ${MODES_DIR}. Create modes/<name>/ with at least one mode file.`,
297
+ );
298
+ return 1;
299
+ }
300
+
301
+ let mode = null;
302
+ let userArgs = rest;
303
+ if (rest.length && !rest[0].startsWith("-")) {
304
+ const candidate = rest[0];
305
+ if (modes.includes(candidate)) {
306
+ mode = candidate;
307
+ userArgs = rest.slice(1);
308
+ } else {
309
+ console.error(`[ompp] unknown mode "${candidate}"`);
310
+ console.error(`[ompp] available: ${modes.join(", ")}`);
311
+ return 1;
312
+ }
313
+ } else {
314
+ try {
315
+ mode = process.stdin.isTTY
316
+ ? await pickInteractive(modes)
317
+ : await pickByNumber(modes);
318
+ } catch (err) {
319
+ console.error(`[ompp] ${err.message}`);
320
+ return 1;
321
+ }
322
+ }
323
+
324
+ const modeDir = path.join(MODES_DIR, mode);
325
+ const args = buildArgv(modeDir, userArgs);
326
+ const { bin, shell } = resolveBin();
327
+
328
+ if (dryRun) {
329
+ console.error(`[ompp] mode: ${mode}`);
330
+ console.error(`[ompp] omp: ${bin}${shell ? " (shell)" : ""}`);
331
+ console.error(`[ompp] argv: ${JSON.stringify(args)}`);
332
+ return 0;
333
+ }
334
+
335
+ console.error(`[ompp] mode: ${mode}`);
336
+ const child = shell
337
+ ? spawn([winQuote(bin), ...args.map(winQuote)].join(" "), {
338
+ stdio: "inherit",
339
+ shell: true,
340
+ })
341
+ : spawn(bin, args, { stdio: "inherit" });
342
+ child.on("error", (err) => {
343
+ console.error(`[ompp] failed to start omp: ${err.message}`);
344
+ process.exitCode = 1;
345
+ });
346
+ child.on("exit", (code, signal) => {
347
+ process.exitCode = code ?? (signal ? 1 : 0);
348
+ });
349
+ return 0;
350
+ }
351
+
352
+ main()
353
+ .then((code) => {
354
+ if (code) process.exitCode = code;
355
+ })
356
+ .catch((err) => {
357
+ console.error(`[ompp] ${err.stack || err.message}`);
358
+ process.exitCode = 1;
359
+ });
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@nevermorelove/ompp",
3
+ "version": "0.1.0",
4
+ "description": "Mode presets for the omp coding agent: one folder per mode, zero config code.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/ForeverInLaw/ompp.git"
8
+ },
9
+ "bin": {
10
+ "ompp": "ompp.js"
11
+ },
12
+ "files": [
13
+ "ompp.js",
14
+ "modes/"
15
+ ],
16
+ "engines": {
17
+ "node": ">=18"
18
+ },
19
+ "keywords": [
20
+ "omp",
21
+ "oh-my-pi",
22
+ "coding-agent",
23
+ "presets",
24
+ "cli"
25
+ ],
26
+ "author": "ForeverInLaw",
27
+ "license": "MIT"
28
+ }