@lifeaitools/rdc-skills 0.17.1 → 0.19.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/.claude-plugin/plugin.json +1 -1
- package/lib/catalog.mjs +16 -9
- package/package.json +1 -1
- package/scripts/install-rdc-skills.js +69 -4
- package/tests/mcp.test.mjs +11 -0
- package/skills/rdc-convert/SKILL.md +0 -127
package/lib/catalog.mjs
CHANGED
|
@@ -43,18 +43,25 @@ function readFrontmatter(skillMdPath) {
|
|
|
43
43
|
|
|
44
44
|
/** Map a raw skills_meta entry + SKILL.md frontmatter into a compact catalog row. */
|
|
45
45
|
function toCatalogEntry(name, meta, frontmatter) {
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
const fm = frontmatter || {};
|
|
47
|
+
const description = fm.description || meta.description || '';
|
|
48
|
+
// triggers/usage/slash/etc. may live in skills_meta OR the SKILL.md frontmatter.
|
|
49
|
+
// Fall back to frontmatter so a skill not (yet) registered in skills_meta stays
|
|
50
|
+
// searchable — these fields are what `rdc_skill_search` routes on.
|
|
51
|
+
const metaTriggers = Array.isArray(meta.triggers) && meta.triggers.length ? meta.triggers : null;
|
|
52
|
+
const fmTriggers = Array.isArray(fm.triggers) ? fm.triggers : [];
|
|
53
|
+
const slash = meta.slash || fm.slash || `rdc:${name}`;
|
|
49
54
|
return {
|
|
50
55
|
name,
|
|
51
|
-
slash
|
|
52
|
-
category: meta.category || 'tooling',
|
|
56
|
+
slash,
|
|
57
|
+
category: meta.category || fm.category || 'tooling',
|
|
53
58
|
summary: description,
|
|
54
|
-
when_to_use:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
when_to_use: metaTriggers || fmTriggers,
|
|
60
|
+
// usage falls back to the slash form so every skill carries an invocation hint.
|
|
61
|
+
usage: meta.usage || fm.usage || slash,
|
|
62
|
+
args: meta.args || fm.args || { positional: [], flags: [] },
|
|
63
|
+
requires: Array.isArray(meta.requires) ? meta.requires
|
|
64
|
+
: Array.isArray(fm.requires) ? fm.requires : [],
|
|
58
65
|
};
|
|
59
66
|
}
|
|
60
67
|
|
package/package.json
CHANGED
|
@@ -52,9 +52,19 @@ const codexIdx = args.indexOf('--codex-root');
|
|
|
52
52
|
const codexRoot = codexIdx >= 0
|
|
53
53
|
? path.resolve(args[codexIdx + 1])
|
|
54
54
|
: (() => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
// Auto-detect the consuming project's .agents tree so a plain `install`
|
|
56
|
+
// refreshes Codex without needing --codex-root. Check, in order: an
|
|
57
|
+
// explicit --project-root, the current working directory, then the
|
|
58
|
+
// regen-root sibling of this repo. First one with a `.agents` wins.
|
|
59
|
+
const candidates = [
|
|
60
|
+
projectRootArg ? path.resolve(projectRootArg) : null,
|
|
61
|
+
process.cwd(),
|
|
62
|
+
path.resolve(repoRoot, '..', 'regen-root'),
|
|
63
|
+
].filter(Boolean);
|
|
64
|
+
for (const c of candidates) {
|
|
65
|
+
if (fs.existsSync(path.join(c, '.agents'))) return c;
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
58
68
|
})();
|
|
59
69
|
const codexSkillDirIdx = args.indexOf('--codex-skill-dir');
|
|
60
70
|
const explicitCodexSkillDir = codexSkillDirIdx >= 0
|
|
@@ -117,7 +127,13 @@ function copyDirRecursive(src, dst) {
|
|
|
117
127
|
const s = path.join(src, entry.name);
|
|
118
128
|
const d = path.join(dst, entry.name);
|
|
119
129
|
if (entry.isDirectory()) copyDirRecursive(s, d);
|
|
120
|
-
else
|
|
130
|
+
else {
|
|
131
|
+
// Atomic write (temp + rename) so a live Claude Code / Codex session never
|
|
132
|
+
// reads a half-written skill file when the installer runs over a live box.
|
|
133
|
+
const tmp = `${d}.tmp-${process.pid}`;
|
|
134
|
+
fs.copyFileSync(s, tmp);
|
|
135
|
+
fs.renameSync(tmp, d);
|
|
136
|
+
}
|
|
121
137
|
}
|
|
122
138
|
}
|
|
123
139
|
|
|
@@ -507,6 +523,46 @@ function addCodexTarget(targets, label, targetDir) {
|
|
|
507
523
|
targets.push({ label, targetDir: resolved });
|
|
508
524
|
}
|
|
509
525
|
|
|
526
|
+
// Register the rdc-skills MCP endpoint at the USER/GLOBAL level for every client
|
|
527
|
+
// so all Claude Code projects and all Codex sessions can reach the skills via MCP
|
|
528
|
+
// (not just where a project .mcp.json exists). Idempotent + non-fatal. Mirrors the
|
|
529
|
+
// existing clauth/codeflow entries exactly. claude.ai web still needs the one-time
|
|
530
|
+
// connector add in its UI (no programmatic API).
|
|
531
|
+
function registerMcpEndpoints() {
|
|
532
|
+
const MCP_URL = 'https://rdc-skills.regendevcorp.com/mcp';
|
|
533
|
+
const out = [];
|
|
534
|
+
|
|
535
|
+
// Claude Code — user-level ~/.claude.json mcpServers (covers EVERY project).
|
|
536
|
+
try {
|
|
537
|
+
const claudeJson = path.join(os.homedir(), '.claude.json');
|
|
538
|
+
if (fs.existsSync(claudeJson)) {
|
|
539
|
+
const data = readJson(claudeJson);
|
|
540
|
+
if (!data.mcpServers || typeof data.mcpServers !== 'object') data.mcpServers = {};
|
|
541
|
+
const cur = data.mcpServers['rdc-skills'];
|
|
542
|
+
if (!cur || cur.url !== MCP_URL) {
|
|
543
|
+
data.mcpServers['rdc-skills'] = { type: 'http', url: MCP_URL };
|
|
544
|
+
writeJson(claudeJson, data, 2);
|
|
545
|
+
out.push('claude(~/.claude.json)');
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
} catch (e) { out.push(`claude WARN:${e.message}`); }
|
|
549
|
+
|
|
550
|
+
// Codex — append [mcp_servers.rdc-skills] to ~/.codex/config.toml if absent.
|
|
551
|
+
try {
|
|
552
|
+
const codexToml = path.join(os.homedir(), '.codex', 'config.toml');
|
|
553
|
+
if (fs.existsSync(codexToml)) {
|
|
554
|
+
const toml = fs.readFileSync(codexToml, 'utf8');
|
|
555
|
+
if (!/\[mcp_servers\.rdc-skills\]/.test(toml)) {
|
|
556
|
+
const block = `\n[mcp_servers.rdc-skills]\nurl = '${MCP_URL}'\n`;
|
|
557
|
+
fs.writeFileSync(codexToml, toml.replace(/\s*$/, '\n') + block);
|
|
558
|
+
out.push('codex(~/.codex/config.toml)');
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
} catch (e) { out.push(`codex WARN:${e.message}`); }
|
|
562
|
+
|
|
563
|
+
return out;
|
|
564
|
+
}
|
|
565
|
+
|
|
510
566
|
function findCodexTargets() {
|
|
511
567
|
const targets = [];
|
|
512
568
|
if (codexRoot) {
|
|
@@ -918,6 +974,15 @@ async function main() {
|
|
|
918
974
|
info('[2.5] Codex — skipped (no Codex skill dirs found; use --codex-root or --codex-skill-dir)');
|
|
919
975
|
}
|
|
920
976
|
|
|
977
|
+
// 2.6. Register the rdc-skills MCP endpoint globally (Claude Code + Codex) so
|
|
978
|
+
// EVERY agent can reach the skills via MCP, not only where a project .mcp.json exists.
|
|
979
|
+
const mcpReg = registerMcpEndpoints();
|
|
980
|
+
if (mcpReg.length > 0) {
|
|
981
|
+
ok(`[2.6] MCP — registered rdc-skills endpoint: ${mcpReg.join(', ')}`);
|
|
982
|
+
} else {
|
|
983
|
+
info('[2.6] MCP — rdc-skills endpoint already registered (claude + codex)');
|
|
984
|
+
}
|
|
985
|
+
|
|
921
986
|
// 2.7. Symlinks in regen-root/.claude/skills/ (FS MCP + claude.ai access)
|
|
922
987
|
if (codexRoot) {
|
|
923
988
|
const skillsLinkDir = path.join(codexRoot, '.claude', 'skills');
|
package/tests/mcp.test.mjs
CHANGED
|
@@ -94,6 +94,17 @@ function unitTests() {
|
|
|
94
94
|
check('unit: search ranks exact name first', searchSkills('deploy')[0]?.name === 'deploy');
|
|
95
95
|
check('unit: empty search returns []', searchSkills('').length === 0);
|
|
96
96
|
|
|
97
|
+
// Searchability gate — the dimension the first "100% coverage" missed. Every
|
|
98
|
+
// catalog entry MUST carry triggers + usage (frontmatter or skills_meta) so
|
|
99
|
+
// rdc_skill_search can route to it. Caught by an audit: brochurify-suite skills
|
|
100
|
+
// had frontmatter triggers the loader ignored → invisible to search.
|
|
101
|
+
check('unit: every skill has non-empty triggers (searchable)',
|
|
102
|
+
cat.every((s) => Array.isArray(s.when_to_use) && s.when_to_use.length > 0),
|
|
103
|
+
cat.filter((s) => !s.when_to_use?.length).map((s) => s.name).join(',') || 'all good');
|
|
104
|
+
check('unit: every skill has a non-empty usage string',
|
|
105
|
+
cat.every((s) => s.usage && s.usage.length > 0),
|
|
106
|
+
cat.filter((s) => !s.usage).map((s) => s.name).join(',') || 'all good');
|
|
107
|
+
|
|
97
108
|
// cloud-rewrite contract
|
|
98
109
|
const sample = '```bash\n_T=$(curl -s http://127.0.0.1:52437/v/coolify-api)\npm2 restart app\n```';
|
|
99
110
|
const rw = toCloudBody(sample);
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: rdc-convert
|
|
3
|
-
version: 0.1.0
|
|
4
|
-
description: |
|
|
5
|
-
Convert Office documents to/from Markdown with the build-corpus CLI: .docx/.pptx/.ppt → Markdown (Word OMML equations become KaTeX-readable TeX; tables, images, headings preserved), and Markdown → Word (.docx) where inline $...$ and display $$...$$ LaTeX become NATIVE Office Math (OMML) that Word renders as real equations. Use this skill whenever the user asks to convert a Word/PowerPoint document to Markdown, build a Markdown corpus from Office files, turn Markdown into a .docx (optionally with a .dotx template), or "open the report" to edit. Install build-corpus straight from GitHub and run it in the session.
|
|
6
|
-
triggers:
|
|
7
|
-
- "convert this docx to markdown"
|
|
8
|
-
- "convert to word"
|
|
9
|
-
- "docx to markdown"
|
|
10
|
-
- "pptx to markdown"
|
|
11
|
-
- "markdown to docx"
|
|
12
|
-
- "build a markdown corpus"
|
|
13
|
-
- "render the equations to word"
|
|
14
|
-
- "build-corpus"
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
# rdc-convert — Office ↔ Markdown conversion (build-corpus)
|
|
18
|
-
|
|
19
|
-
`build-corpus` is a Python CLI that converts between Office documents and Markdown.
|
|
20
|
-
This is a self-contained skill: install the tool from GitHub into the current
|
|
21
|
-
session and run `build-corpus`. No local checkout or other rdc skill is required.
|
|
22
|
-
|
|
23
|
-
## When to Use
|
|
24
|
-
- `.docx` / `.pptx` / `.ppt` → Markdown — preserves Word OMML equations (as
|
|
25
|
-
KaTeX-readable TeX), tables, images, headings, and lists.
|
|
26
|
-
- Markdown → Word (`.docx`) — inline `$...$` and display `$$...$$` LaTeX are
|
|
27
|
-
converted to **native OMML** Word renders as real equations; optional `.dotx`
|
|
28
|
-
template via `--word-template`.
|
|
29
|
-
- Build a Markdown corpus from a folder of Office files (recursive, one pass).
|
|
30
|
-
- Inline a Markdown file's images as data URIs, or rehost them to R2/S3.
|
|
31
|
-
|
|
32
|
-
## When NOT to Use
|
|
33
|
-
- Rendering a folder/HTML/zip into a print-ready **PDF** brochure (that is a
|
|
34
|
-
separate brochure pipeline).
|
|
35
|
-
- Rasterizing HTML/JSX/SVG to images — build-corpus is a format converter, not a
|
|
36
|
-
render engine; it flags those and a separate render step handles them.
|
|
37
|
-
|
|
38
|
-
## Install & Run (install from GitHub — it is the source of truth)
|
|
39
|
-
|
|
40
|
-
The published PyPI/npm packages lag GitHub. Install from the repository to get the
|
|
41
|
-
current behavior (native LaTeX→OMML, the fidelity report, the escaped-currency fix):
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
pip install "git+https://github.com/LIFEAI/build-corpus.git@feat/dual-package-ubuntu"
|
|
45
|
-
# once merged to main, drop the @branch:
|
|
46
|
-
# pip install "git+https://github.com/LIFEAI/build-corpus.git"
|
|
47
|
-
build-corpus --help
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
This installs the `build-corpus` command and its dependencies (latex2mathml,
|
|
51
|
-
mathml2omml, python-docx, Pillow, omml2latex). Notes:
|
|
52
|
-
- Debian/Ubuntu externally-managed Python (PEP 668): add `--break-system-packages`,
|
|
53
|
-
use a venv, or `pipx install "git+https://github.com/LIFEAI/build-corpus.git@feat/dual-package-ubuntu"`.
|
|
54
|
-
- S3/R2 image upload: append `[s3]` to the package spec.
|
|
55
|
-
- Legacy `.ppt` input also needs LibreOffice (`soffice`) on PATH (`apt install libreoffice`).
|
|
56
|
-
`.docx`/`.pptx` need nothing extra.
|
|
57
|
-
|
|
58
|
-
## Command Reference
|
|
59
|
-
|
|
60
|
-
```
|
|
61
|
-
build-corpus <input> [input ...] [options]
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
`<input>` — one or more `.md`, `.docx`, `.pptx`, or `.ppt` files or directories.
|
|
65
|
-
|
|
66
|
-
| Flag | Values / default | Effect |
|
|
67
|
-
|------|------------------|--------|
|
|
68
|
-
| `--out <dir>` | path | Output directory for the converted tree. |
|
|
69
|
-
| `--out-same-dir` | — | Write `.md`, `.assets`, and reports beside each source file. |
|
|
70
|
-
| `--to` | `auto` \| `markdown` \| `word` (default `auto`) | Output target. `auto` infers from a single-file input. |
|
|
71
|
-
| `--images` | `assets` \| `base64` \| `s3` (default `assets`) | Image handling. |
|
|
72
|
-
| `--equations` | `tex` \| `image` (default `tex`) | docx→md: OMML → KaTeX TeX, or rendered images (debug). |
|
|
73
|
-
| `--inline-images` | — | Emit `<name>.inline.md` with images embedded as data URIs. |
|
|
74
|
-
| `--word-template <file>` | `.docx`/`.dotx` | Template for Markdown → Word exports. |
|
|
75
|
-
| `--move-sources` | — | After a successful convert, move sources into a `sources/` folder. |
|
|
76
|
-
| `--config <file>` | JSON | Conversion/output/S3 defaults (CLI flags override). |
|
|
77
|
-
|
|
78
|
-
S3/R2 (only with `--images s3`): `--s3-bucket`, `--s3-public-base-url`,
|
|
79
|
-
`--s3-prefix`, `--s3-endpoint-url` (required for R2), `--s3-region` (`auto` for R2),
|
|
80
|
-
`--s3-access-key-id`, `--s3-secret-access-key`, `--s3-cache-control`, `--s3-acl`.
|
|
81
|
-
|
|
82
|
-
## Equations (real in both directions)
|
|
83
|
-
- **docx → markdown** (`--equations`): `tex` converts Word OMML equations to
|
|
84
|
-
KaTeX-readable TeX (default); `image` renders them as images (debug only).
|
|
85
|
-
- **markdown → word** (`--to word`): inline `$...$` and display `$$...$$` LaTeX are
|
|
86
|
-
converted to **native OMML** (`\sum`, `\int`, `\frac`, `\Delta`, `\rightarrow`,
|
|
87
|
-
`\leq`, …). Escaped currency like `\$252.3B` is kept as literal text, never mistaken
|
|
88
|
-
for math. Unparseable fragments fall back to Cambria-Math text and are flagged in the
|
|
89
|
-
report. Fence display math with `$$` on their own lines, no blank lines inside.
|
|
90
|
-
|
|
91
|
-
## Fidelity report (md → word)
|
|
92
|
-
Each md→word export writes `export-report.json` (and a batch report) so you can
|
|
93
|
-
confirm nothing was silently dropped or changed:
|
|
94
|
-
- **`fidelity_ok`** — top-level ship gate (`true` only when every row matches and no
|
|
95
|
-
equation fell back).
|
|
96
|
-
- **`reconciliation`** — input vs output per type (`tables`, `equations`
|
|
97
|
-
{in/out_omml/fell_back}, `images` {in/out/failed}, `code_blocks`, `headings`, `links`).
|
|
98
|
-
- **`issues`** — `{ type, line, source|target, reason }` per problem.
|
|
99
|
-
- **`text_fixups`** — markdown escapes the engine resolved (e.g. `currency_unescaped`).
|
|
100
|
-
- A one-line **stdout digest** for a quick glance.
|
|
101
|
-
|
|
102
|
-
Image-failure `reason` values: `missing-file`, `unsupported-on-platform` (EMF/WMF —
|
|
103
|
-
install LibreOffice), `unsupported-format` (.html/.jsx — route to a render pipeline),
|
|
104
|
-
`svg-needs-rasterization` / `mislabeled-svg` (rasterize the SVG to PNG and repoint),
|
|
105
|
-
`skipped-remote`.
|
|
106
|
-
|
|
107
|
-
## Examples
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
build-corpus input.docx --out out # docx → markdown
|
|
111
|
-
build-corpus deck.pptx --out out # pptx → markdown
|
|
112
|
-
build-corpus ./word-files --out ./markdown # whole folder, recursive
|
|
113
|
-
build-corpus ./word-files --out-same-dir # write beside each source
|
|
114
|
-
build-corpus input.md --to word --out out # markdown → Word (LaTeX → OMML)
|
|
115
|
-
build-corpus input.md --to word --word-template custom.dotx --out out
|
|
116
|
-
build-corpus report.md --inline-images # → report.inline.md
|
|
117
|
-
build-corpus input.docx --images s3 --config build-corpus.config.json
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
## Boundaries
|
|
121
|
-
- Does not commit, deploy, or upload outputs (except images when `--images s3`).
|
|
122
|
-
- Does not modify source documents unless `--move-sources` is passed.
|
|
123
|
-
- Does not rasterize HTML/JSX/SVG — flags them for an external render step.
|
|
124
|
-
|
|
125
|
-
## Reference
|
|
126
|
-
- Source (install from here): `github.com/LIFEAI/build-corpus`
|
|
127
|
-
- Packages (currently lag GitHub): PyPI `build-corpus`, npm `regen-mde`.
|