poe-code 3.0.384-beta.1 → 3.0.385

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-code",
3
- "version": "3.0.384-beta.1",
3
+ "version": "3.0.385",
4
4
  "description": "CLI tool to configure Poe API for developer workflows.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -21,8 +21,7 @@ function addUsage(total, usage) {
21
21
  })
22
22
  };
23
23
  }
24
- async function requirePlan(fs, cwd, planPath) {
25
- const absolutePath = path.resolve(cwd, planPath);
24
+ async function requirePlan(fs, absolutePath, planPath) {
26
25
  try {
27
26
  const stats = await fs.stat(absolutePath);
28
27
  if (!stats.isFile()) {
@@ -33,6 +32,12 @@ async function requirePlan(fs, cwd, planPath) {
33
32
  throw new Error(`Plan file not found: ${planPath}`, { cause: error });
34
33
  }
35
34
  }
35
+ function resolvePlanPath(cwd, homeDir, planPath) {
36
+ if (planPath.startsWith("~/")) {
37
+ return path.join(homeDir, planPath.slice(2));
38
+ }
39
+ return path.resolve(cwd, planPath);
40
+ }
36
41
  function validateInlineConfig(prompt, followups) {
37
42
  if ((prompt === undefined) !== (followups === undefined)) {
38
43
  throw new Error("prompt and followups must be provided together.");
@@ -62,7 +67,7 @@ function resolveModel(value) {
62
67
  }
63
68
  return trimmed;
64
69
  }
65
- function resolvePlanPaths(options) {
70
+ function resolvePlanPaths(options, cwd, homeDir) {
66
71
  if (options.planPaths.length === 0) {
67
72
  throw new Error("Provide at least one plan path.");
68
73
  }
@@ -74,7 +79,7 @@ function resolvePlanPaths(options) {
74
79
  const planPaths = options.planPaths.map((planPath) => planPath.trim());
75
80
  const seen = new Map();
76
81
  for (const planPath of planPaths) {
77
- const resolvedPath = path.resolve(options.cwd ?? process.cwd(), planPath);
82
+ const resolvedPath = resolvePlanPath(cwd, homeDir, planPath);
78
83
  const duplicate = seen.get(resolvedPath);
79
84
  if (duplicate !== undefined) {
80
85
  throw new Error(`Duplicate plan path: ${duplicate}`);
@@ -91,9 +96,9 @@ export async function runGaslight(options) {
91
96
  const agent = requireNonEmptyString(options.agent, "agent");
92
97
  const model = resolveModel(options.model);
93
98
  validateInlineConfig(options.prompt, options.followups);
94
- const planPaths = resolvePlanPaths(options);
99
+ const planPaths = resolvePlanPaths(options, cwd, homeDir);
95
100
  for (const planPath of planPaths) {
96
- await requirePlan(fs, cwd, planPath);
101
+ await requirePlan(fs, resolvePlanPath(cwd, homeDir, planPath), planPath);
97
102
  }
98
103
  const config = options.prompt !== undefined && options.followups !== undefined
99
104
  ? { prompt: options.prompt.trim(), followups: options.followups.map((value) => value.trim()) }