findTicketFile (ticket-workflow.ts)

ClawRecipes · files

Locates file path for ticket from thread ID in markdown store.

// Source: https://github.com/JIGGAI/ClawRecipes | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import fs from "node:fs/promises";
import path from "node:path";

import { ensureLaneDir } from "./lanes";
import { findTicketFile as findTicketFileFromFinder } from "./ticket-finder";

function patchTicketFields(
  md: string,
  opts: { ownerSafe: string; status: string }
): string {
  let out = md;
  if (out.match(/^Owner:\s.*$/m)) out = out.replace(/^Owner:\s.*$/m, `Owner: ${opts.ownerSafe}`);
  else out = out.replace(/^(# .+\n)/, `$1\nOwner: ${opts.ownerSafe}\n`);

  if (out.match(/^Status:\s.*$/m)) out = out.replace(/^Status:\s.*$/m, `Status: ${opts.status}`);
  else out = out.rep

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key