Skip to content

Commit 3c8ea5a

Browse files
committed
Merge ruma-pro workflow layer
1 parent 5c28bc2 commit 3c8ea5a

9 files changed

Lines changed: 1154 additions & 114 deletions

File tree

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
- 四个风格层:`neutral``high-agency``hardline``RuMa / PUA`
4141
- 三端安装:`Codex``Claude Code``OpenClaw`
4242
- 独立的 `pua` skill 包:主 `SKILL.md` + references + `/pua` prompt 入口
43+
- `ruma-pro` 风格的组合层:Quick Compose、16 格核心矩阵、命令行入口
4344
- 一个可浏览模式库的 Web 门面
4445
- `Playwright` 冒烟测试和本地 autopilot loop
4546

@@ -158,12 +159,27 @@ npm run check
158159
当前冒烟覆盖包括:
159160

160161
- 模式卡片和 modal 全量点击
162+
- Quick Compose 下拉组合与复制
163+
- 核心 workflow 16 宫格切换
161164
- flavor / adapter 切换
162165
- benchmark 展示
163166
- 移动端布局
164167
- `Codex / Claude Code / OpenClaw` 安装脚本复制行为
165168
- `pua` skill 的 references、agents 元数据和 prompt 同步行为
166169

170+
## CLI
171+
172+
```bash
173+
npm run cli:list
174+
npm run cli:matrix
175+
npm run cli:random
176+
node ./bin/ruma-runtime.mjs compose ship hardline
177+
node ./bin/ruma-runtime.mjs install pua codex
178+
node ./bin/ruma-runtime.mjs qa
179+
```
180+
181+
这个层是把桌面 `ruma-pro` 里真正有用的产品能力并进当前仓库:不用开页面也能快速列模式、看 4 x 4 核心矩阵、随机抽组合或直接生成 prompt。
182+
167183
## 自主巡检
168184

169185
```bash

automation/backlog.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# RuMa Runtime Backlog
22

3-
- [ ] Add a dedicated benchmark section with before/after agent behaviors.
4-
- [ ] Generate screenshots into `automation/reports/screenshots`.
5-
- [ ] Add a locale toggle for Chinese and English labels.
3+
- [x] Add a dedicated benchmark section with before/after agent behaviors.
4+
- [x] Generate screenshots into `automation/reports/screenshots`.
5+
- [x] Add a locale toggle for Chinese and English labels.
66
- [x] Install the local `ruma-runtime` skill into Codex automatically from this project via `npm run install:codex`.
77
- [x] Split the local `pua` skill into a modular pack with references, client installers, and prompt sync.
8+
- [x] Fold the useful `ruma-pro` ideas into the main repo: CLI, quick composer, and 4 x 4 matrix.

bin/ruma-runtime.mjs

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
#!/usr/bin/env node
2+
3+
import { spawnSync } from "node:child_process";
4+
import { dirname, resolve } from "node:path";
5+
import { fileURLToPath } from "node:url";
6+
import {
7+
buildPrompt,
8+
flavors,
9+
getFlavorById,
10+
getModeById,
11+
modes,
12+
workflowMatrix
13+
} from "../src/data/library.js";
14+
15+
const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
16+
17+
const help = () => {
18+
console.log(`RuMa Runtime CLI
19+
20+
Usage:
21+
ruma-runtime list
22+
ruma-runtime matrix
23+
ruma-runtime random
24+
ruma-runtime compose <modeId> <flavorId>
25+
ruma-runtime install [bundle] [target]
26+
ruma-runtime qa`);
27+
};
28+
29+
const printList = () => {
30+
console.log("Flavors:");
31+
for (const flavor of flavors) {
32+
console.log(`- ${flavor.id}: ${flavor.name} | ${flavor.strapline}`);
33+
}
34+
35+
console.log("\nModes:");
36+
for (const mode of modes) {
37+
console.log(`- ${mode.id}: ${mode.title} | ${mode.summary}`);
38+
}
39+
};
40+
41+
const printMatrix = () => {
42+
console.log("Core workflow matrix:");
43+
for (const combo of workflowMatrix) {
44+
console.log(`- ${combo.modeId} + ${combo.flavorId}: ${combo.title}`);
45+
}
46+
};
47+
48+
const printRandom = () => {
49+
const combo = workflowMatrix[Math.floor(Math.random() * workflowMatrix.length)];
50+
const mode = getModeById(combo.modeId);
51+
const flavor = getFlavorById(combo.flavorId);
52+
console.log(`Random combo: ${combo.modeId} + ${combo.flavorId}`);
53+
console.log(`${mode.title} / ${flavor.name}`);
54+
console.log(`\n${buildPrompt(mode, flavor)}`);
55+
};
56+
57+
const printCompose = (modeId, flavorId) => {
58+
const mode = getModeById(modeId);
59+
const flavor = getFlavorById(flavorId);
60+
61+
if (!mode || !flavor) {
62+
console.error(`Unknown mode/flavor: ${modeId} ${flavorId}`);
63+
process.exit(1);
64+
}
65+
66+
console.log(buildPrompt(mode, flavor));
67+
};
68+
69+
const runCommand = (command, args) =>
70+
spawnSync(command, args, {
71+
cwd: root,
72+
stdio: "inherit",
73+
shell: process.platform === "win32"
74+
});
75+
76+
const installBundle = (bundle = "ruma-runtime", target = "all") => {
77+
const result = runCommand("node", [resolve(root, "scripts", "install-agent-skill.mjs"), target, bundle]);
78+
process.exitCode = result.status ?? 1;
79+
};
80+
81+
const runQa = () => {
82+
const build = runCommand("npm", ["run", "build"]);
83+
if (build.status !== 0) {
84+
process.exitCode = build.status ?? 1;
85+
return;
86+
}
87+
88+
const test = runCommand("npm", ["run", "test"]);
89+
process.exitCode = test.status ?? 1;
90+
};
91+
92+
const [command, ...args] = process.argv.slice(2);
93+
94+
switch (command) {
95+
case "list":
96+
printList();
97+
break;
98+
case "matrix":
99+
printMatrix();
100+
break;
101+
case "random":
102+
printRandom();
103+
break;
104+
case "compose":
105+
printCompose(args[0], args[1]);
106+
break;
107+
case "install":
108+
installBundle(args[0], args[1]);
109+
break;
110+
case "qa":
111+
runQa();
112+
break;
113+
case "help":
114+
case undefined:
115+
help();
116+
break;
117+
default:
118+
console.error(`Unknown command: ${command}`);
119+
help();
120+
process.exitCode = 1;
121+
}

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@
33
"version": "0.1.0",
44
"private": true,
55
"type": "module",
6+
"bin": {
7+
"ruma-runtime": "./bin/ruma-runtime.mjs"
8+
},
69
"scripts": {
710
"dev": "vite --host 127.0.0.1 --port 4173",
811
"build": "vite build",
912
"preview": "vite preview --host 127.0.0.1 --port 4173",
13+
"cli:list": "node ./bin/ruma-runtime.mjs list",
14+
"cli:matrix": "node ./bin/ruma-runtime.mjs matrix",
15+
"cli:random": "node ./bin/ruma-runtime.mjs random",
1016
"install:runtime:codex": "node ./scripts/install-codex-skill.mjs",
1117
"install:runtime:claude": "node ./scripts/install-agent-skill.mjs claude ruma-runtime",
1218
"install:runtime:openclaw": "node ./scripts/install-agent-skill.mjs openclaw ruma-runtime",

src/data/library.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,3 +625,24 @@ export const benchmarks = [
625625
outcome: "结果:会话从低效内耗变成稳定收敛,用户看到的是恢复路径而不是情绪波动。"
626626
}
627627
];
628+
629+
const coreWorkflowIds = new Set(["diagnose", "recover", "ship", "audit"]);
630+
631+
export const buildPrompt = (mode, flavor) =>
632+
`${flavor.intro}\n\n${mode.prompt}\n\n## 交付契约\n${mode.outputContract}\n\n${flavor.outro}`;
633+
634+
export const getModeById = (modeId) => modes.find((mode) => mode.id === modeId);
635+
636+
export const getFlavorById = (flavorId) => flavors.find((flavor) => flavor.id === flavorId);
637+
638+
export const coreWorkflowModes = modes.filter((mode) => coreWorkflowIds.has(mode.id));
639+
640+
export const workflowMatrix = coreWorkflowModes.flatMap((mode) =>
641+
flavors.map((flavor) => ({
642+
id: `${mode.id}:${flavor.id}`,
643+
modeId: mode.id,
644+
flavorId: flavor.id,
645+
title: `${mode.title} / ${flavor.name}`,
646+
summary: `${mode.summary} + ${flavor.strapline}`
647+
}))
648+
);

0 commit comments

Comments
 (0)