codebyplan 1.2.0 → 1.3.0

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.
Files changed (2) hide show
  1. package/dist/cli.js +30 -6
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -14,7 +14,7 @@ var VERSION, PACKAGE_NAME;
14
14
  var init_version = __esm({
15
15
  "src/lib/version.ts"() {
16
16
  "use strict";
17
- VERSION = "1.2.0";
17
+ VERSION = "1.3.0";
18
18
  PACKAGE_NAME = "codebyplan";
19
19
  }
20
20
  });
@@ -296,21 +296,45 @@ var init_hook_registry = __esm({
296
296
  });
297
297
 
298
298
  // src/lib/variables.ts
299
+ function splitFrontmatter(content) {
300
+ const fmMatch = content.match(/^(---\s*\n[\s\S]*?\n---\n?)([\s\S]*)$/);
301
+ if (fmMatch) {
302
+ return { frontmatter: fmMatch[1], body: fmMatch[2] };
303
+ }
304
+ if (content.startsWith("#!/") || content.startsWith("# @")) {
305
+ const lines = content.split("\n");
306
+ let headerEnd = 0;
307
+ for (let i = 0; i < lines.length; i++) {
308
+ if (lines[i].startsWith("#") || lines[i].startsWith("#!/") || lines[i].trim() === "") {
309
+ headerEnd = i + 1;
310
+ } else {
311
+ break;
312
+ }
313
+ }
314
+ return {
315
+ frontmatter: lines.slice(0, headerEnd).join("\n") + "\n",
316
+ body: lines.slice(headerEnd).join("\n")
317
+ };
318
+ }
319
+ return { frontmatter: "", body: content };
320
+ }
299
321
  function substituteVariables(content, repoData) {
300
322
  if (!content.includes("{{")) return content;
301
- let result = content;
323
+ const { frontmatter, body } = splitFrontmatter(content);
324
+ let result = body;
302
325
  for (const [name, resolver] of Object.entries(TEMPLATE_VARIABLES)) {
303
326
  const placeholder = `{{${name}}}`;
304
327
  if (result.includes(placeholder)) {
305
328
  result = result.replaceAll(placeholder, resolver(repoData));
306
329
  }
307
330
  }
308
- return result;
331
+ return frontmatter + result;
309
332
  }
310
333
  function escapeRegex(str) {
311
334
  return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
312
335
  }
313
336
  function reverseSubstituteVariables(content, repoData) {
337
+ const { frontmatter, body } = splitFrontmatter(content);
314
338
  const entries = [];
315
339
  for (const [name, resolver] of Object.entries(TEMPLATE_VARIABLES)) {
316
340
  const value = resolver(repoData);
@@ -318,7 +342,7 @@ function reverseSubstituteVariables(content, repoData) {
318
342
  entries.push([value, `{{${name}}}`]);
319
343
  }
320
344
  entries.sort((a, b) => b[0].length - a[0].length);
321
- let result = content;
345
+ let result = body;
322
346
  for (const [value, placeholder] of entries) {
323
347
  if (value.length < 8) {
324
348
  const pattern = new RegExp(`\\b${escapeRegex(value)}\\b`, "g");
@@ -327,7 +351,7 @@ function reverseSubstituteVariables(content, repoData) {
327
351
  result = result.replaceAll(value, placeholder);
328
352
  }
329
353
  }
330
- return result;
354
+ return frontmatter + result;
331
355
  }
332
356
  var TEMPLATE_VARIABLES;
333
357
  var init_variables = __esm({
@@ -2780,7 +2804,7 @@ function getLocalFilePath(claudeDir, projectPath, remote) {
2780
2804
  }
2781
2805
  function getSyncVersion() {
2782
2806
  try {
2783
- return "1.2.0";
2807
+ return "1.3.0";
2784
2808
  } catch {
2785
2809
  return "unknown";
2786
2810
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codebyplan",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "CLI for CodeByPlan — AI-powered development planning and tracking",
5
5
  "type": "module",
6
6
  "bin": {
@@ -33,7 +33,7 @@
33
33
  "repository": {
34
34
  "type": "git",
35
35
  "url": "https://github.com/codebyplan/codebyplan.git",
36
- "directory": "packages/codebyplan"
36
+ "directory": "packages/codebyplan-package"
37
37
  },
38
38
  "license": "MIT",
39
39
  "publishConfig": {