@riotprompt/riotplan 1.0.0 → 1.0.3

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/bin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { _ as createProgram } from "./cli-DmsyaX1E.js";
2
+ import { q as createProgram } from "./cli-BAr1IsMF.js";
3
3
  const program = createProgram();
4
4
  program.parse();
5
5
  //# sourceMappingURL=bin.js.map
@@ -64,20 +64,34 @@ const PLAN_CONVENTIONS = {
64
64
  };
65
65
  function parseDependenciesFromContent(content) {
66
66
  const dependencies = /* @__PURE__ */ new Set();
67
- const frontmatterMatch = content.match(
68
- /^---\n[\s\S]*?depends-on:\s*([^\n]+)\n[\s\S]*?---/
69
- );
70
- if (frontmatterMatch) {
71
- const nums = frontmatterMatch[1].match(/\d+/g);
72
- if (nums) {
73
- nums.forEach((n) => dependencies.add(parseInt(n)));
67
+ const frontmatterEnd = content.indexOf("---", 4);
68
+ if (content.startsWith("---\n") && frontmatterEnd > 0) {
69
+ const frontmatter = content.substring(4, frontmatterEnd);
70
+ const dependsOnMatch = frontmatter.match(/depends-on:\s*([^\n]+)/);
71
+ if (dependsOnMatch) {
72
+ const nums = dependsOnMatch[1].match(/\d+/g);
73
+ if (nums) {
74
+ nums.forEach((n) => dependencies.add(parseInt(n)));
75
+ }
74
76
  }
75
77
  }
76
- const depSectionMatch = content.match(
77
- /##\s+Dependencies\s*\n([\s\S]*?)(?=\n##|\n#\s|$)/i
78
- );
79
- if (depSectionMatch) {
80
- const section = depSectionMatch[1];
78
+ const lines = content.split("\n");
79
+ const sectionLines = [];
80
+ let inSection = false;
81
+ for (const line of lines) {
82
+ if (/^##\s+Dependencies$/i.test(line)) {
83
+ inSection = true;
84
+ continue;
85
+ }
86
+ if (inSection && /^#/.test(line)) {
87
+ break;
88
+ }
89
+ if (inSection) {
90
+ sectionLines.push(line);
91
+ }
92
+ }
93
+ if (sectionLines.length > 0) {
94
+ const section = sectionLines.join("\n");
81
95
  const bulletMatches = section.matchAll(
82
96
  /[-*]\s*(?:Step\s*)?(\d+)/gi
83
97
  );
@@ -887,12 +901,15 @@ function parseEvidenceFile(filename, content) {
887
901
  };
888
902
  }
889
903
  function parseFrontmatter(content) {
890
- const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---\n/);
891
- if (!frontmatterMatch) {
904
+ if (!content.startsWith("---\n")) {
905
+ return { frontmatter: {}, body: content };
906
+ }
907
+ const endMarker = content.indexOf("\n---\n", 4);
908
+ if (endMarker === -1) {
892
909
  return { frontmatter: {}, body: content };
893
910
  }
894
- const frontmatterStr = frontmatterMatch[1];
895
- const body = content.slice(frontmatterMatch[0].length);
911
+ const frontmatterStr = content.substring(4, endMarker);
912
+ const body = content.substring(endMarker + 5);
896
913
  const frontmatter = {};
897
914
  const lines = frontmatterStr.split("\n");
898
915
  let currentKey = null;
@@ -2019,12 +2036,22 @@ function parseFeedbackFile(filename, content) {
2019
2036
  };
2020
2037
  }
2021
2038
  function extractSection(content, sectionName) {
2022
- const regex = new RegExp(
2023
- `##\\s+${sectionName}\\s*\\n([\\s\\S]*?)(?=\\n##|$)`,
2024
- "i"
2025
- );
2026
- const match = content.match(regex);
2027
- return match ? match[1].trim() : void 0;
2039
+ const lines = content.split("\n");
2040
+ const sectionLines = [];
2041
+ let inSection = false;
2042
+ for (const line of lines) {
2043
+ if (new RegExp(`^##\\s+${sectionName}`, "i").test(line)) {
2044
+ inSection = true;
2045
+ continue;
2046
+ }
2047
+ if (inSection && /^##/.test(line)) {
2048
+ break;
2049
+ }
2050
+ if (inSection) {
2051
+ sectionLines.push(line);
2052
+ }
2053
+ }
2054
+ return sectionLines.length > 0 ? sectionLines.join("\n").trim() : void 0;
2028
2055
  }
2029
2056
  function formatDate$3(date, format) {
2030
2057
  if (!date) return "-";
@@ -2176,11 +2203,23 @@ function generateStatus$2(plan, options = {}) {
2176
2203
  } = options;
2177
2204
  let existingNotes;
2178
2205
  if (preserveNotes && existingContent) {
2179
- const notesMatch = existingContent.match(
2180
- /## Notes\s*\n([\s\S]*?)(?=\n---|\n##|$)/
2181
- );
2182
- if (notesMatch) {
2183
- existingNotes = notesMatch[1].trim();
2206
+ const lines = existingContent.split("\n");
2207
+ const noteLines = [];
2208
+ let inNotes = false;
2209
+ for (const line of lines) {
2210
+ if (/^## Notes$/i.test(line)) {
2211
+ inNotes = true;
2212
+ continue;
2213
+ }
2214
+ if (inNotes && (/^##/.test(line) || /^---/.test(line))) {
2215
+ break;
2216
+ }
2217
+ if (inNotes) {
2218
+ noteLines.push(line);
2219
+ }
2220
+ }
2221
+ if (noteLines.length > 0) {
2222
+ existingNotes = noteLines.join("\n").trim();
2184
2223
  }
2185
2224
  }
2186
2225
  let content = `# ${plan.metadata.name} Status
@@ -4235,9 +4274,15 @@ JSON structure:
4235
4274
  function parsePlanResponse(content, _stepCount) {
4236
4275
  try {
4237
4276
  let jsonContent = content.trim();
4238
- const codeBlockMatch = jsonContent.match(/```(?:json)?\s*([\s\S]*?)\s*```/);
4239
- if (codeBlockMatch) {
4240
- jsonContent = codeBlockMatch[1].trim();
4277
+ const startMarker = jsonContent.indexOf("```");
4278
+ if (startMarker !== -1) {
4279
+ const endMarker = jsonContent.indexOf("```", startMarker + 3);
4280
+ if (endMarker !== -1) {
4281
+ jsonContent = jsonContent.substring(startMarker + 3, endMarker).trim();
4282
+ if (jsonContent.startsWith("json")) {
4283
+ jsonContent = jsonContent.substring(4).trim();
4284
+ }
4285
+ }
4241
4286
  }
4242
4287
  const firstBrace = jsonContent.indexOf("{");
4243
4288
  const lastBrace = jsonContent.lastIndexOf("}");
@@ -4910,8 +4955,11 @@ async function loadInitialPrompt(planPath, planName) {
4910
4955
  try {
4911
4956
  const promptPath = join(planPath, `${planName}-prompt.md`);
4912
4957
  const content = await readFile(promptPath, "utf-8");
4913
- const match = content.match(/---\n\n([\s\S]+)$/);
4914
- return match ? match[1].trim() : content;
4958
+ const separatorIndex = content.indexOf("---\n\n");
4959
+ if (separatorIndex !== -1) {
4960
+ return content.substring(separatorIndex + 5).trim();
4961
+ }
4962
+ return content;
4915
4963
  } catch {
4916
4964
  return null;
4917
4965
  }
@@ -5675,10 +5723,17 @@ async function loadStatusMap(planPath) {
5675
5723
  try {
5676
5724
  const statusPath = join(planPath, "STATUS.md");
5677
5725
  const content = await readFile(statusPath, "utf-8");
5678
- const tableMatch = content.match(/\|\s*Step\s*\|\s*Name\s*\|\s*Status[\s\S]*?(?=\n##|\n\n##|$)/i);
5679
- if (tableMatch) {
5680
- const lines = tableMatch[0].split("\n");
5681
- for (const line of lines) {
5726
+ const lines = content.split("\n");
5727
+ let inTable = false;
5728
+ for (const line of lines) {
5729
+ if (/\|\s*Step\s*\|\s*Name\s*\|\s*Status/i.test(line)) {
5730
+ inTable = true;
5731
+ continue;
5732
+ }
5733
+ if (inTable && (/^##/.test(line) || line.trim() === "")) {
5734
+ break;
5735
+ }
5736
+ if (inTable && line.includes("|")) {
5682
5737
  const match = line.match(/\|\s*(\d+)\s*\|[^|]+\|\s*([^|]+)\|/);
5683
5738
  if (match) {
5684
5739
  const stepNum = parseInt(match[1]);
@@ -5722,11 +5777,25 @@ function analyzeStep(stepNum, content, markedStatus) {
5722
5777
  }
5723
5778
  function extractAcceptanceCriteria(content, stepNum) {
5724
5779
  const criteria = [];
5725
- const sectionMatch = content.match(/##\s*Acceptance\s+Criteria([\s\S]*?)(?=\n##|$)/i);
5726
- if (!sectionMatch) {
5780
+ const lines = content.split("\n");
5781
+ const sectionLines = [];
5782
+ let inSection = false;
5783
+ for (const line of lines) {
5784
+ if (/^##\s*Acceptance\s+Criteria$/i.test(line)) {
5785
+ inSection = true;
5786
+ continue;
5787
+ }
5788
+ if (inSection && /^##/.test(line)) {
5789
+ break;
5790
+ }
5791
+ if (inSection) {
5792
+ sectionLines.push(line);
5793
+ }
5794
+ }
5795
+ if (sectionLines.length === 0) {
5727
5796
  return criteria;
5728
5797
  }
5729
- const sectionContent = sectionMatch[1];
5798
+ const sectionContent = sectionLines.join("\n");
5730
5799
  const checkboxRegex = /^[-*]\s*\[([x ])\]\s*(.+)$/gim;
5731
5800
  let match;
5732
5801
  while ((match = checkboxRegex.exec(sectionContent)) !== null) {
@@ -6114,76 +6183,76 @@ function createProgram() {
6114
6183
  return program;
6115
6184
  }
6116
6185
  export {
6117
- registerPlanCommands as $,
6118
- skipStep as A,
6119
- failStep as B,
6120
- parseDependenciesFromContent as C,
6121
- parseDependenciesFromFile as D,
6122
- parseAllDependencies as E,
6123
- buildDependencyGraph as F,
6124
- buildDependencyGraphFromMap as G,
6125
- validateDependencies as H,
6126
- findCriticalPath as I,
6127
- computeExecutionOrder as J,
6128
- getReadySteps as K,
6129
- getBlockedSteps as L,
6130
- getDependencyChain as M,
6131
- updateStepDependencies as N,
6132
- listTemplates as O,
6186
+ removeStep as $,
6187
+ getTemplate as A,
6188
+ BasicTemplate as B,
6189
+ CRITERIA_PATTERNS as C,
6190
+ hasAnalysis as D,
6191
+ initCommand as E,
6192
+ FeatureTemplate as F,
6193
+ insertStep as G,
6194
+ HEALTH_THRESHOLDS as H,
6195
+ listFeedback as I,
6196
+ listTemplates as J,
6197
+ listTemplatesByCategory as K,
6198
+ loadAmendmentPrompts as L,
6199
+ MigrationTemplate as M,
6200
+ loadAnalysis as N,
6201
+ loadElaborationPrompts as O,
6133
6202
  PLAN_CONVENTIONS as P,
6134
- getTemplate as Q,
6135
- registerTemplate as R,
6136
- listTemplatesByCategory as S,
6137
- searchTemplatesByTag as T,
6138
- applyTemplate as U,
6139
- BasicTemplate as V,
6140
- FeatureTemplate as W,
6141
- RefactoringTemplate as X,
6142
- MigrationTemplate as Y,
6143
- SprintTemplate as Z,
6144
- createProgram as _,
6203
+ moveStep as Q,
6204
+ RefactoringTemplate as R,
6205
+ SprintTemplate as S,
6206
+ parseAllDependencies as T,
6207
+ parseCriteria as U,
6208
+ parseCriteriaFromContent as V,
6209
+ parseDependenciesFromContent as W,
6210
+ parseDependenciesFromFile as X,
6211
+ registerPlanCommands as Y,
6212
+ registerRenderCommands as Z,
6213
+ registerTemplate as _,
6145
6214
  renderToJson as a,
6146
- initCommand as a0,
6147
- validateCommand as a1,
6148
- archiveCommand as a2,
6149
- templateCommand as a3,
6150
- templateListCommand as a4,
6151
- templateShowCommand as a5,
6152
- templateUseCommand as a6,
6153
- registerRenderCommands as a7,
6154
- renderCommand as a8,
6155
- PRIORITY_WEIGHTS as a9,
6156
- CRITERIA_PATTERNS as aa,
6157
- HEALTH_THRESHOLDS as ab,
6158
- parseCriteria as ac,
6159
- parseCriteriaFromContent as ad,
6160
- getCriteriaSummary as ae,
6161
- checkCoverage as af,
6162
- checkCompletion as ag,
6215
+ renderCommand as a0,
6216
+ saveAmendmentPrompt as a1,
6217
+ saveElaborationPrompt as a2,
6218
+ saveInitialPrompt as a3,
6219
+ searchTemplatesByTag as a4,
6220
+ skipStep as a5,
6221
+ startStep as a6,
6222
+ templateCommand as a7,
6223
+ templateListCommand as a8,
6224
+ templateShowCommand as a9,
6225
+ templateUseCommand as aa,
6226
+ unblockStep as ab,
6227
+ updateStatus as ac,
6228
+ updateStepDependencies as ad,
6229
+ validateCommand as ae,
6230
+ validateDependencies as af,
6231
+ validatePlan as ag,
6163
6232
  renderToMarkdown as b,
6164
- createPlan as c,
6165
- saveElaborationPrompt as d,
6166
- saveAmendmentPrompt as e,
6167
- loadElaborationPrompts as f,
6168
- loadAmendmentPrompts as g,
6169
- createAnalysisDirectory as h,
6170
- loadAnalysis as i,
6171
- hasAnalysis as j,
6172
- createFeedback as k,
6233
+ PRIORITY_WEIGHTS as c,
6234
+ applyTemplate as d,
6235
+ archiveCommand as e,
6236
+ blockStep as f,
6237
+ buildDependencyGraph as g,
6238
+ buildDependencyGraphFromMap as h,
6239
+ checkCompletion as i,
6240
+ checkCoverage as j,
6241
+ completeStep as k,
6173
6242
  loadPlan as l,
6174
- listFeedback as m,
6175
- getFeedback as n,
6176
- generateStatus$2 as o,
6177
- insertStep as p,
6178
- removeStep as q,
6243
+ computeExecutionOrder as m,
6244
+ createAnalysisDirectory as n,
6245
+ createFeedback as o,
6246
+ createPlan as p,
6247
+ createProgram as q,
6179
6248
  renderToHtml as r,
6180
- saveInitialPrompt as s,
6181
- moveStep as t,
6182
- updateStatus as u,
6183
- validatePlan as v,
6184
- blockStep as w,
6185
- unblockStep as x,
6186
- completeStep as y,
6187
- startStep as z
6249
+ failStep as s,
6250
+ findCriticalPath as t,
6251
+ generateStatus$2 as u,
6252
+ getBlockedSteps as v,
6253
+ getCriteriaSummary as w,
6254
+ getDependencyChain as x,
6255
+ getFeedback as y,
6256
+ getReadySteps as z
6188
6257
  };
6189
- //# sourceMappingURL=cli-DmsyaX1E.js.map
6258
+ //# sourceMappingURL=cli-BAr1IsMF.js.map