palmier 0.1.8 → 0.1.9

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.
@@ -1,8 +1,12 @@
1
1
  import { randomUUID } from "crypto";
2
2
  import { execSync } from "child_process";
3
3
  import * as fs from "fs";
4
+ import * as path from "path";
5
+ import { fileURLToPath } from "url";
4
6
  import { StringCodec } from "nats";
5
7
  import { loadConfig } from "../config.js";
8
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
+ const TASK_GENERATION_PROMPT = fs.readFileSync(path.join(__dirname, "task-generation.md"), "utf-8");
6
10
  import { connectNats } from "../nats-client.js";
7
11
  import { listTasks, parseTaskFile, writeTaskFile, getTaskDir } from "../task.js";
8
12
  import { installTaskTimer, removeTaskTimer, getTaskStatus } from "../systemd.js";
@@ -144,8 +148,10 @@ export async function serveCommand() {
144
148
  }
145
149
  case "task.generate": {
146
150
  const params = request.params;
151
+ const fullPrompt = TASK_GENERATION_PROMPT + params.prompt;
147
152
  try {
148
- const output = execSync(`claude -p "${params.prompt.replace(/"/g, '\\"')}"`, {
153
+ const output = execSync("claude -p -", {
154
+ input: fullPrompt,
149
155
  encoding: "utf-8",
150
156
  cwd: config.projectRoot,
151
157
  timeout: 120_000,
@@ -0,0 +1,21 @@
1
+ You are a specification writer for a personal computer AI agent. Given a task description, produce a detailed Markdown specification document that the agent can later follow to execute the task. **Do not execute any part of the task yourself.**
2
+
3
+ The specification must include the following sections:
4
+
5
+ ### 1. Summary
6
+ What the task accomplishes
7
+
8
+ ### 2. Steps
9
+ A numbered sequence of concrete, unambiguous actions.
10
+ Use sub-steps for complex actions. Include conditional branches where behavior may vary (e.g., "If file exists, do A; otherwise, do B").
11
+
12
+ ### 3. Edge Cases & Risks
13
+ Anything that could go wrong and how to handle it:
14
+ - Common failure modes
15
+ - Platform-specific differences
16
+ - Race conditions or timing issues
17
+ - Data loss risks and mitigation
18
+
19
+ Format the entire document as Markdown with proper headings, code blocks for commands, and tables where appropriate.
20
+
21
+ **Task description:**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "palmier",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Palmier agent CLI - provisions, executes tasks, and serves NATS RPC",
5
5
  "license": "ISC",
6
6
  "author": "Hongxu Cai",
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "scripts": {
14
14
  "dev": "tsx src/index.ts",
15
- "build": "tsc",
15
+ "build": "tsc && node -e \"require('fs').cpSync('src/commands/task-generation.md','dist/commands/task-generation.md')\"",
16
16
  "start": "node dist/index.js"
17
17
  },
18
18
  "dependencies": {
@@ -1,8 +1,16 @@
1
1
  import { randomUUID } from "crypto";
2
2
  import { execSync } from "child_process";
3
3
  import * as fs from "fs";
4
+ import * as path from "path";
5
+ import { fileURLToPath } from "url";
4
6
  import { StringCodec } from "nats";
5
7
  import { loadConfig } from "../config.js";
8
+
9
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
10
+ const TASK_GENERATION_PROMPT = fs.readFileSync(
11
+ path.join(__dirname, "task-generation.md"),
12
+ "utf-8",
13
+ );
6
14
  import { connectNats } from "../nats-client.js";
7
15
  import { listTasks, parseTaskFile, writeTaskFile, getTaskDir } from "../task.js";
8
16
  import { installTaskTimer, removeTaskTimer, getTaskStatus } from "../systemd.js";
@@ -185,9 +193,11 @@ export async function serveCommand(): Promise<void> {
185
193
 
186
194
  case "task.generate": {
187
195
  const params = request.params as { prompt: string };
196
+ const fullPrompt = TASK_GENERATION_PROMPT + params.prompt;
188
197
 
189
198
  try {
190
- const output = execSync(`claude -p "${params.prompt.replace(/"/g, '\\"')}"`, {
199
+ const output = execSync("claude -p -", {
200
+ input: fullPrompt,
191
201
  encoding: "utf-8",
192
202
  cwd: config.projectRoot,
193
203
  timeout: 120_000,
@@ -0,0 +1,21 @@
1
+ You are a specification writer for a personal computer AI agent. Given a task description, produce a detailed Markdown specification document that the agent can later follow to execute the task. **Do not execute any part of the task yourself.**
2
+
3
+ The specification must include the following sections:
4
+
5
+ ### 1. Summary
6
+ What the task accomplishes
7
+
8
+ ### 2. Steps
9
+ A numbered sequence of concrete, unambiguous actions.
10
+ Use sub-steps for complex actions. Include conditional branches where behavior may vary (e.g., "If file exists, do A; otherwise, do B").
11
+
12
+ ### 3. Edge Cases & Risks
13
+ Anything that could go wrong and how to handle it:
14
+ - Common failure modes
15
+ - Platform-specific differences
16
+ - Race conditions or timing issues
17
+ - Data loss risks and mitigation
18
+
19
+ Format the entire document as Markdown with proper headings, code blocks for commands, and tables where appropriate.
20
+
21
+ **Task description:**