protoml-parser
Version:
ProtoML is a lightweight, declarative markup language designed for writing and structuring meeting protocols, notes and task lists in a human-readable and machine-parseable format.
99 lines (73 loc) • 1.91 kB
JavaScript
const fs = require("fs");
const path = require("path");
function ensureDir(dir) {
fs.mkdirSync(dir, { recursive: true });
}
function writeIfMissing(filePath, content) {
if (!fs.existsSync(filePath)) {
fs.writeFileSync(filePath, content);
}
}
function scaffoldMeeting(target = process.cwd()) {
const targetDir = path.resolve(target);
ensureDir(targetDir);
const meetingPath = path.join(targetDir, "meeting.pml");
writeIfMissing(meetingPath, ` "_tags.pml"
"Meeting Protocol - {{date}}"
:01.01.2026
=pt1:Jane Doe,jane,jane@example.com
=0:Status update
-[ ] Prepare notes =pt1 =0 =important
- Starter meeting created by scaffold.
"Minutes"
# Team Meeting
## Participants
@=pt1
## Topic
@=0
`);
const tagsPath = path.join(targetDir, "_tags.pml");
writeIfMissing(tagsPath, ` "Shared Tags"
=important:Important
=normal:Normal
`);
return { targetDir, files: [meetingPath, tagsPath] };
}
function initProject(target = process.cwd()) {
const targetDir = path.resolve(target);
ensureDir(targetDir);
ensureDir(path.join(targetDir, "meetings"));
ensureDir(path.join(targetDir, "macros"));
const tagsPath = path.join(targetDir, "_tags.pml");
writeIfMissing(tagsPath, ` "Project Tags"
=important:Important
=review:Needs review
- "meetings/main.pml"
`);
const meetingPath = path.join(targetDir, "meetings", "main.pml");
writeIfMissing(meetingPath, ` "../_tags.pml"
"Project Protocol - {{date}}"
:01.01.2026
=pt1:Jane Doe,jane,jane@example.com
=0:Initial setup
-[ ] Review project structure =pt1 =0 =important
"Kickoff"
# Project Kickoff
@=0
`);
return { targetDir, files: [tagsPath, meetingPath] };
}
module.exports = {
scaffoldMeeting,
initProject,
};