markwell 0.1.3 → 0.1.5
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/dist/cli/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from "commander";
|
|
3
|
-
import fs, {
|
|
3
|
+
import fs, { cpSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
4
|
import fsp from "node:fs/promises";
|
|
5
5
|
import path, { dirname, isAbsolute, join, resolve } from "node:path";
|
|
6
6
|
import readline from "node:readline";
|
|
@@ -316,7 +316,7 @@ function parseVttTimestamp(line) {
|
|
|
316
316
|
};
|
|
317
317
|
}
|
|
318
318
|
function parseVttContent(content) {
|
|
319
|
-
const lines = content.split("\n");
|
|
319
|
+
const lines = content.replace(/\r\n/g, "\n").split("\n");
|
|
320
320
|
const cues = [];
|
|
321
321
|
let i = 0;
|
|
322
322
|
while (i < lines.length && !lines[i].includes("-->")) i++;
|
|
@@ -385,7 +385,7 @@ const vttIngest = {
|
|
|
385
385
|
* sequential number, then timestamp line with -->
|
|
386
386
|
*/
|
|
387
387
|
function isSrtFormat(head) {
|
|
388
|
-
const lines = head.trim().split("\n");
|
|
388
|
+
const lines = head.trim().replace(/\r\n/g, "\n").split("\n");
|
|
389
389
|
if (lines.length < 2) return false;
|
|
390
390
|
if (!/^\d+$/.test(lines[0].trim())) return false;
|
|
391
391
|
return /\d{2}:\d{2}:\d{2},\d{3}\s*-->\s*\d{2}:\d{2}:\d{2},\d{3}/.test(lines[1]);
|
|
@@ -399,7 +399,7 @@ function normalizeTimestamp(ts) {
|
|
|
399
399
|
}
|
|
400
400
|
function parseSrtContent(content) {
|
|
401
401
|
const cues = [];
|
|
402
|
-
const blocks = content.trim().split(/\n\n+/);
|
|
402
|
+
const blocks = content.replace(/\r\n/g, "\n").trim().split(/\n\n+/);
|
|
403
403
|
for (const block of blocks) {
|
|
404
404
|
const lines = block.trim().split("\n");
|
|
405
405
|
if (lines.length < 3) continue;
|
|
@@ -1452,7 +1452,7 @@ async function renderViaCli(content, theme, format) {
|
|
|
1452
1452
|
*/
|
|
1453
1453
|
function parseTranscriptMarkdown(content) {
|
|
1454
1454
|
const cues = [];
|
|
1455
|
-
const lines = content.split("\n");
|
|
1455
|
+
const lines = content.replace(/\r\n/g, "\n").split("\n");
|
|
1456
1456
|
let i = 0;
|
|
1457
1457
|
while (i < lines.length) {
|
|
1458
1458
|
const tsMatch = lines[i].match(/\*\*\[(\d{2}:\d{2}:\d{2}\.\d{3})\s*-->\s*(\d{2}:\d{2}:\d{2}\.\d{3})\]\*\*\s*(.*)/);
|
|
@@ -1731,11 +1731,26 @@ function registerConvertCommand(program) {
|
|
|
1731
1731
|
program.command("convert").description("Convert files to or from Markdown").argument("<file-or-glob>", "File path or glob pattern to convert").option("--to <format>", "Export format(s): docx, pptx, pdf, xlsx, vtt, srt, etc.").option("-o, --output <path>", "Output file or directory path").option("--force", "Overwrite existing files without prompting").option("--dry-run", "Show what would be done without writing files").option("--verbose", "Show detailed processing information").option("--theme <name-or-path>", "Theme name or path to .markwell.yaml").action(async (fileOrGlob, opts) => {
|
|
1732
1732
|
if (opts.verbose) setVerbose(true);
|
|
1733
1733
|
const registry = getRegistry();
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1734
|
+
let files;
|
|
1735
|
+
const resolved = path.resolve(fileOrGlob);
|
|
1736
|
+
try {
|
|
1737
|
+
if ((await fsp.stat(resolved)).isFile()) files = [resolved];
|
|
1738
|
+
else {
|
|
1739
|
+
error(`"${fileOrGlob}" is a directory, not a file. Use a glob pattern (e.g. "${fileOrGlob}/*.docx") to convert files in a directory.`);
|
|
1740
|
+
process.exitCode = 1;
|
|
1741
|
+
return;
|
|
1742
|
+
}
|
|
1743
|
+
} catch (statErr) {
|
|
1744
|
+
const pattern = fg.convertPathToPattern(fileOrGlob);
|
|
1745
|
+
files = await fg(pattern, { absolute: true });
|
|
1746
|
+
if (files.length === 0) {
|
|
1747
|
+
const code = statErr.code;
|
|
1748
|
+
if (code === "EACCES" || code === "EPERM") error(`Permission denied: "${fileOrGlob}"`);
|
|
1749
|
+
else if (code === "ENOENT" && !fg.isDynamicPattern(pattern)) error(`File not found: "${fileOrGlob}"`);
|
|
1750
|
+
else error(`No files found matching "${fileOrGlob}"`);
|
|
1751
|
+
process.exitCode = 1;
|
|
1752
|
+
return;
|
|
1753
|
+
}
|
|
1739
1754
|
}
|
|
1740
1755
|
let succeeded = 0;
|
|
1741
1756
|
let failed = 0;
|
|
@@ -2226,30 +2241,29 @@ function printObject(obj, indent) {
|
|
|
2226
2241
|
|
|
2227
2242
|
//#endregion
|
|
2228
2243
|
//#region src/cli/commands/install-skills.ts
|
|
2229
|
-
function
|
|
2230
|
-
const devPath = join(import.meta.dirname, "
|
|
2244
|
+
function getSkillSourceDir() {
|
|
2245
|
+
const devPath = join(import.meta.dirname, "../../src/skills/markwell");
|
|
2231
2246
|
if (existsSync(devPath)) return devPath;
|
|
2232
|
-
const distPath = join(import.meta.dirname, "
|
|
2247
|
+
const distPath = join(import.meta.dirname, "../skills/markwell");
|
|
2233
2248
|
if (existsSync(distPath)) return distPath;
|
|
2234
|
-
return
|
|
2249
|
+
return distPath;
|
|
2235
2250
|
}
|
|
2236
2251
|
function registerInstallSkillsCommand(program) {
|
|
2237
2252
|
program.command("install-skills").description("Install Claude Code skill file").option("--global", "Install to ~/.claude/ instead of project .claude/").action((opts) => {
|
|
2238
|
-
const
|
|
2239
|
-
if (!existsSync(
|
|
2253
|
+
const sourceDir = getSkillSourceDir();
|
|
2254
|
+
if (!existsSync(join(sourceDir, "SKILL.md"))) {
|
|
2240
2255
|
console.error("Skill template not found. Package may be corrupted.");
|
|
2241
2256
|
process.exitCode = 1;
|
|
2242
2257
|
return;
|
|
2243
2258
|
}
|
|
2244
2259
|
let targetDir;
|
|
2245
|
-
if (opts.global) targetDir = join(homedir(), ".claude", "
|
|
2246
|
-
else targetDir = join(process.cwd(), ".claude", "
|
|
2247
|
-
const targetPath = join(targetDir, "markwell.md");
|
|
2260
|
+
if (opts.global) targetDir = join(homedir(), ".claude", "skills", "markwell");
|
|
2261
|
+
else targetDir = join(process.cwd(), ".claude", "skills", "markwell");
|
|
2248
2262
|
if (!existsSync(targetDir)) mkdirSync(targetDir, { recursive: true });
|
|
2249
|
-
|
|
2263
|
+
cpSync(sourceDir, targetDir, { recursive: true });
|
|
2250
2264
|
const location = opts.global ? "global (~/.claude/)" : "project (.claude/)";
|
|
2251
2265
|
console.log(`Installed markwell skill to ${location}`);
|
|
2252
|
-
console.log(` ${
|
|
2266
|
+
console.log(` ${join(targetDir, "SKILL.md")}`);
|
|
2253
2267
|
});
|
|
2254
2268
|
}
|
|
2255
2269
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markwell",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Convert documents to and from Markdown. The source from which polished documents flow.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cli/index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"node": ">=20"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
|
-
"build": "tsdown &&
|
|
18
|
+
"build": "tsdown && node -e \"const fs=require('fs');fs.cpSync('src/themes','dist/themes',{recursive:true});fs.cpSync('src/skills','dist/skills',{recursive:true})\"",
|
|
19
19
|
"dev": "tsdown --watch",
|
|
20
20
|
"test": "vitest run",
|
|
21
21
|
"test:watch": "vitest",
|