pacework 1.4.1 → 1.4.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.
@@ -3135,7 +3135,10 @@ async function runExecutor(run, state) {
3135
3135
  const skillInstall = gitAvailable
3136
3136
  ? installSkills(worktreePath, run.skills, { log: (line) => runLogger.info("runner.run.skills", line) })
3137
3137
  : { installed: [], skipped: [], cleanup() {} }
3138
- const skillsSection = skillsPromptSection((run.skills ?? []).filter((skill) => skillInstall.installed.includes(skill.slug)))
3138
+ const skillsSection = skillsPromptSection(
3139
+ (run.skills ?? []).filter((skill) => skillInstall.installed.includes(skill.slug)),
3140
+ { purpose: isReviewRun(run) ? "review" : "build" },
3141
+ )
3139
3142
  const prompt = [
3140
3143
  buildPrompt(run, branch, worktreePath, { localCheckoutMode, gitAvailable, workspaceContext, runLimitsText }),
3141
3144
  skillsSection,
@@ -48,9 +48,42 @@ export const SERVICES = {
48
48
  },
49
49
  }
50
50
 
51
- /** The install command a repository's lockfile implies, or null when there is none to run. */
51
+ const JS_INSTALL = {
52
+ pnpm: "pnpm install --frozen-lockfile",
53
+ yarn: "yarn install --frozen-lockfile",
54
+ }
55
+
56
+ /** The package manager package.json declares ("pnpm@11.14.0+sha…" → "pnpm"), or null. */
57
+ function declaredPackageManager(dir) {
58
+ try {
59
+ const pkg = JSON.parse(fs.readFileSync(path.join(dir, "package.json"), "utf8"))
60
+ const name = String(pkg.packageManager ?? "").split("@")[0]
61
+ return JS_INSTALL[name] ? name : null
62
+ } catch {
63
+ return null
64
+ }
65
+ }
66
+
67
+ /**
68
+ * The install command a repository's lockfile implies, or null when there is none to run.
69
+ *
70
+ * The package manager package.json declares wins over a stray lockfile of another
71
+ * one. A repository that keeps its lockfiles one level down (frontend/, backend/)
72
+ * installs in each of those folders.
73
+ */
52
74
  export function detectSetupCommand(dir) {
53
75
  const has = (file) => fs.existsSync(path.join(dir, file))
76
+ const declared = declaredPackageManager(dir)
77
+ if (declared) {
78
+ const lockfile = declared === "pnpm" ? "pnpm-lock.yaml" : "yarn.lock"
79
+ if (has(lockfile)) return `corepack enable && ${JS_INSTALL[declared]}`
80
+ const folders = fs.readdirSync(dir, { withFileTypes: true })
81
+ .filter((entry) => entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules")
82
+ .map((entry) => entry.name)
83
+ .filter((name) => fs.existsSync(path.join(dir, name, lockfile)))
84
+ .sort()
85
+ if (folders.length) return `corepack enable && ${folders.map((name) => `(cd ${name} && ${JS_INSTALL[declared]})`).join(" && ")}`
86
+ }
54
87
  if (has("pnpm-lock.yaml")) return "corepack enable && pnpm install --frozen-lockfile"
55
88
  if (has("yarn.lock")) return "corepack enable && yarn install --frozen-lockfile"
56
89
  if (has("bun.lockb") || has("bun.lock")) return "npx -y bun install --frozen-lockfile"
package/lib/skills.mjs CHANGED
@@ -108,12 +108,24 @@ export function installSkills(checkout, skills, { log = () => {} } = {}) {
108
108
  }
109
109
  }
110
110
 
111
+ /**
112
+ * The skill every run of a kind starts from, when the agent has it: it is how
113
+ * that work is done here and says when to use the others. Left to "when it fits",
114
+ * agents skipped it in most runs.
115
+ */
116
+ export const ENTRY_SKILLS = { build: "work-an-issue", review: "code-review" }
117
+
111
118
  /** The skills section of the agent's prompt; empty when there are none. */
112
- export function skillsPromptSection(skills) {
119
+ export function skillsPromptSection(skills, { purpose = "build" } = {}) {
113
120
  const list = (Array.isArray(skills) ? skills : []).filter((skill) => SLUG.test(String(skill?.slug ?? "")))
114
121
  if (!list.length) return ""
122
+ const entry = ENTRY_SKILLS[purpose]
123
+ const start = entry && list.some((skill) => skill.slug === entry)
124
+ ? [`Start by reading the ${entry} skill's SKILL.md and follow it through this run; it says which of the others to use and when.`]
125
+ : []
115
126
  return [
116
127
  "Skills: this checkout has skills for you in .claude/skills and .agents/skills (one folder each, SKILL.md inside).",
128
+ ...start,
117
129
  "Read a skill's SKILL.md when its description fits the task, and follow it:",
118
130
  ...list.map((skill) => `- ${skill.slug}: ${String(skill.description ?? "").replace(/\s+/g, " ").trim()}`),
119
131
  "These files are not part of the repository; do not commit or edit them.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pacework",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "description": "pacework CLI: connect this machine as a runner for pacework AI agents",
5
5
  "type": "module",
6
6
  "bin": {