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AAM,8DAGb,GAAG,WAAW,IACjB,GAAG,UAAU,EAAS,CAAE,WAAW,UAE/B,GAAG,SAAS,UAAU,EAAkB,EAAc,QAC5D,QAAQ,IAAI,MAAM,wEACpB,CAAE,MAAO,GACP,QAAQ,IAAI,IAAI,wDAAyD,EAAI,QAC/E,CACF,CAGA,iBACQ,cASN,IAAI,QARoB,oBAEtB,QAAQ,IAAI,IAAI,qBAChB,QAAQ,KAAK,UAGT,6BACN,QAAQ,IAAI,KAAK,6CAEjB,IAEE,GADA,QAAa,iBACR,EAAK,OAAQ,MAAM,IAAI,MAAM,gCACpC,CAAE,MAAO,GACP,QAAQ,IAAI,IAAI,6BAA8B,EAAI,SAClD,QAAQ,KAAK,EACf,CACA,IAAK,MAAM,KAAQ,QACX,YAAY,GAEpB,QAAQ,IAAI,KAAK,MAAM,yCACxB,EAtBD","file":"/npm/windsurf-task-manager@1.1.3/windsurf-task-manager-workflow.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/windsurf-task-manager@1.1.3/windsurf-task-manager-workflow.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","#!/usr/bin/env node\n\n// windsurf-task-manager-workflow.js\n// CLI script to fetch docs from a remote GitHub repo, print README instructions, and copy docs after user confirmation\n\nconst fs = require('fs')\nconst path = require('path')\nconst https = require('https')\nconst readline = require('readline')\nconst { cyan, yellow, green, red, bold } = require('colorette')\nconst marked = require('marked')\n\n// marked-terminal v7+ is ESM-only. Use require and .default for CJS compatibility.\nconst TerminalRenderer = require('marked-terminal').default || require('marked-terminal')\n\nconst REMOTE_REPO = 'edsadr/windsurf-task-manager-workflow'\n// Use the correct branch ref for raw URLs\nconst RAW_BASE = `https://raw.githubusercontent.com/${REMOTE_REPO}/refs/heads/master`\nconst REMOTE_WORKFLOWS_PATH = 'workflows' // remote workflows directory\nconst LOCAL_WORKFLOWS_DIR = '.windsurf/workflows' // local workflows directory\nconst LOCAL_DEST = process.cwd()\n\n// Helper to fetch a remote file as string\nfunction fetchRemoteFile(url) {\n  return new Promise((resolve, reject) => {\n    https.get(url, res => {\n      if (res.statusCode !== 200) {\n        reject(new Error(`Failed to fetch ${url} (status ${res.statusCode})`))\n        return\n      }\n      let data = ''\n      res.on('data', chunk => { data += chunk })\n      res.on('end', () => resolve(data))\n    }).on('error', reject)\n  })\n}\n\n// Helper to fetch remote directory listing via GitHub API\nfunction fetchDocsList() {\n  const apiUrl = `https://api.github.com/repos/${REMOTE_REPO}/contents/${REMOTE_WORKFLOWS_PATH}?ref=master`\n  return new Promise((resolve, reject) => {\n    https.get(apiUrl, {\n      headers: { 'User-Agent': 'fetch-remote-docs-script' }\n    }, res => {\n      if (res.statusCode !== 200) {\n        reject(new Error(`Failed to fetch docs list (status ${res.statusCode})`))\n        return\n      }\n      let data = ''\n      res.on('data', chunk => { data += chunk })\n      res.on('end', () => {\n        try {\n          const files = JSON.parse(data)\n          resolve(files.filter(f => f.type === 'file'))\n        } catch (e) {\n          reject(e)\n        }\n      })\n    }).on('error', reject)\n  })\n}\n\n// Print README instructions\nasync function printReadme() {\n  // Use the correct URL for the README\n  const readmeUrl = `${RAW_BASE}/README.md`\n  try {\n    const readme = await fetchRemoteFile(readmeUrl)\n    // Render markdown to terminal-friendly output using marked-terminal\n    marked.setOptions({\n      renderer: new TerminalRenderer(),\n      mangle: false,\n      headerIds: false\n    })\n    const rendered = marked.parse(readme)\n    console.log(rendered)\n    console.log(bold(cyan('\\n--- End of Instructions ---\\n')))\n  } catch (err) {\n    console.log(red('Could not fetch remote README.md:'), err.message)\n  }\n}\n\n// Ask user for confirmation\nfunction askConfirmation() {\n  return new Promise(resolve => {\n    const rl = readline.createInterface({ input: process.stdin, output: process.stdout })\n    rl.question(bold(green('Continue copying docs to this folder? [y/N]: ')), answer => {\n      rl.close()\n      resolve(answer.trim().toLowerCase() === 'y')\n    })\n  })\n}\n\n// Download and write a file\nasync function downloadDoc(file) {\n  const localDir = LOCAL_WORKFLOWS_DIR\n  // Ensure local workflows directory exists\n  if (!fs.existsSync(localDir)) {\n    fs.mkdirSync(localDir, { recursive: true })\n  }\n  // Use the correct raw URL for workflows\n  const url = `${RAW_BASE}/${REMOTE_WORKFLOWS_PATH}/${file.name}`\n  const dest = path.join(localDir, file.name)\n  try {\n    const data = await fetchRemoteFile(url)\n    fs.writeFileSync(dest, data)\n    console.log(green(`Copied: ${LOCAL_WORKFLOWS_DIR}/${file.name}`))\n  } catch (err) {\n    console.log(red(`Failed to copy ${file.name}: ${err.message}`))\n  }\n}\n\n// Extract the workflow instructions section from README.md and write to .windsurf/workflows/instructions.md in the current working directory\nasync function copyInstructionsFromReadme () {\n  // Read README.md from the script's directory\n  const readmePath = path.join(__dirname, 'README.md')\n  // Write instructions.md to the docs/ subdirectory of the current working directory\n  const docsDir = path.join(process.cwd(), 'docs')\n  const instructionsPath = path.join(docsDir, 'instructions.md')\n  try {\n    const content = await fs.promises.readFile(readmePath, 'utf8')\n    const lines = content.split(/\\r?\\n/)\n    // Find the start of the workflow section\n    const startIdx = lines.findIndex(line => line.trim().startsWith('## Windsurf Task Manager Workflow'))\n    if (startIdx === -1) throw new Error('Workflow section not found in README.md')\n    // Find the end of the workflow section: next major header or EOF\n    let endIdx = lines.findIndex((line, i) => i > startIdx && line.startsWith('## '))\n    if (endIdx === -1) {\n      endIdx = lines.length\n    }\n    const instructions = lines.slice(startIdx, endIdx).join('\\n').trim()\n    if (!instructions) {\n      throw new Error('No instructions found in the workflow section of README.md')\n    }\n    // Ensure docs directory exists in cwd\n    if (!fs.existsSync(docsDir)) {\n      fs.mkdirSync(docsDir, { recursive: true })\n    }\n    await fs.promises.writeFile(instructionsPath, instructions, 'utf8')\n    console.log(green(`Instructions copied to docs/instructions.md in the current directory`))\n  } catch (err) {\n    console.log(red('Failed to extract/write instructions from README.md:'), err.message)\n  }\n}\n\n// Main logic\n(async () => {\n  await printReadme()\n  const confirmed = await askConfirmation()\n  if (!confirmed) {\n    console.log(red('Aborted by user.'))\n    process.exit(1)\n  }\n  // Copy instructions from local README.md to workflows/instructions.md\n  await copyInstructionsFromReadme()\n  console.log(cyan('\\nFetching workflows from remote repo...'))\n  let docs\n  try {\n    docs = await fetchDocsList()\n    if (!docs.length) throw new Error('No docs found in remote repo.')\n  } catch (err) {\n    console.log(red('Error fetching docs list:'), err.message)\n    process.exit(1)\n  }\n  for (const file of docs) {\n    await downloadDoc(file)\n  }\n  console.log(bold(green('\\nAll workflows copied successfully!')))\n})()\n"]}