feat(tasks): manage markdown loops from scheduled tasks

This commit is contained in:
Bohdan Triapitsyn
2026-08-09 21:43:16 +03:00
parent ce6912fe40
commit e13b4526c6
20 changed files with 322 additions and 34 deletions
@@ -40,7 +40,7 @@
import fs from 'fs';
import os from 'os';
import path from 'path';
import { parseMdFile, getAncestors, findWorktreeRoot } from '../opencode/shared.js';
import { parseMdFile, writeMdFile, getAncestors, findWorktreeRoot } from '../opencode/shared.js';
import { MAX_TASK_NAME_LENGTH } from '../projects/project-config.js';
const LOOP_DIR_NAME = 'loops';
@@ -140,6 +140,15 @@ export const parseLoopDefinition = (filePath) => {
};
};
export const setLoopFileEnabled = (filePath, enabled) => {
if (!parseLoopDefinition(filePath)) {
return false;
}
const { frontmatter, body } = parseMdFile(filePath);
writeMdFile(filePath, { ...frontmatter, enabled: Boolean(enabled) }, body);
return true;
};
const walkLoopMdFiles = (rootDir) => {
if (!rootDir || !fs.existsSync(rootDir)) {
return [];