@puzzmo/cli 1.0.25 → 1.0.27

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.
@@ -58,11 +58,10 @@ const buildAgentCmd = (agent: string, prompt: string): { cmd: string; args: stri
58
58
  return { cmd: agent, args: [prompt] }
59
59
  }
60
60
 
61
- /** Fetches skill instructions from the MCP server, then builds a self-contained prompt for the agent */
62
- const buildPrompt = async (skillName: string, gameDir: string): Promise<string> => {
63
- const instructions = await fetchSkillPrompt(skillName, gameDir)
64
- if (instructions) return `${instructions}\n\nThe game source is in the current directory.`
65
- return `Run the skill "${skillName}". The game source is in the current directory.`
61
+ /** Fetches step instructions from the MCP server and wraps them as an agent prompt */
62
+ const buildPrompt = async (stepName: string, gameDir: string, repoContext: string): Promise<string> => {
63
+ const instructions = await fetchSkillPrompt(stepName, gameDir)
64
+ return `Follow these instructions. The game source is in the current directory.\n\n${repoContext}\n\n${instructions}`
66
65
  }
67
66
 
68
67
  class PipelineTUI {
@@ -79,6 +78,7 @@ class PipelineTUI {
79
78
  constructor(
80
79
  private agent: string,
81
80
  private gameDir: string,
81
+ private repoContext: string,
82
82
  ) {
83
83
  this.states = skillsPipeline.map(() => "pending")
84
84
  this.logsDir = path.join(gameDir, ".puzzmo", "logs")
@@ -115,7 +115,7 @@ class PipelineTUI {
115
115
 
116
116
  // Sidebar header
117
117
  buf += moveTo(2, 1)
118
- buf += "│ " + bold("Migration Pipeline") + " ".repeat(Math.max(0, sidebarWidth - 21)) + "│"
118
+ buf += "│ " + bold("Migration Steps") + " ".repeat(Math.max(0, sidebarWidth - 18)) + "│"
119
119
 
120
120
  // Output panel header
121
121
  const headerLabel = this.done ? "Done" : `${skillsPipeline[this.currentStep]?.name ?? ""} ${dim(`(${this.phase})`)}`
@@ -399,7 +399,17 @@ class PipelineTUI {
399
399
  this.phase = "agent"
400
400
  this.render()
401
401
 
402
- const prompt = await buildPrompt(skill.name, this.gameDir)
402
+ let prompt: string
403
+ try {
404
+ prompt = await buildPrompt(skill.name, this.gameDir, this.repoContext)
405
+ } catch (e: any) {
406
+ this.appendOutput(`Failed to fetch instructions: ${e.message}`)
407
+ this.writeSkillLog(skill.name)
408
+ this.states[stepIndex] = "failed"
409
+ this.render()
410
+ return false
411
+ }
412
+
403
413
  let success = await this.runAgent(prompt)
404
414
 
405
415
  if (!success) {
@@ -420,7 +430,7 @@ class PipelineTUI {
420
430
  const buildResult = this.runCmd("npx vite build")
421
431
  if (!buildResult.success) {
422
432
  this.appendOutput("Asking agent to fix...")
423
- const fixPrompt = `The vite build failed after running skill ${skill.name}. Fix the build errors:\n\n${buildResult.output}`
433
+ const fixPrompt = `The vite build failed after the "${skill.name}" step. Fix the build errors:\n\n${buildResult.output}`
424
434
  await this.runAgent(fixPrompt)
425
435
 
426
436
  const retry = this.runCmd("npx vite build")
@@ -436,7 +446,7 @@ class PipelineTUI {
436
446
  this.phase = "commit"
437
447
  this.render()
438
448
  this.runCmd("git add -A")
439
- const commitResult = this.runCmd(`git commit -m "skill: ${skill.name}"`)
449
+ const commitResult = this.runCmd(`git commit -m "step: ${skill.name}"`)
440
450
  if (commitResult.success) this.appendOutput("Committed.")
441
451
  else this.appendOutput("No changes to commit.")
442
452
 
@@ -503,7 +513,7 @@ class PipelineTUI {
503
513
  }
504
514
 
505
515
  /** Render the pipeline TUI and wait for it to complete */
506
- export const runPipelineTUI = async (agent: string, gameDir: string): Promise<void> => {
507
- const tui = new PipelineTUI(agent, gameDir)
516
+ export const runPipelineTUI = async (agent: string, gameDir: string, repoContext: string): Promise<void> => {
517
+ const tui = new PipelineTUI(agent, gameDir, repoContext)
508
518
  await tui.run()
509
519
  }