@justestif/pk 0.5.0 → 0.5.1

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/index.js +8 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -36106,21 +36106,23 @@ import { mkdirSync as mkdirSync6 } from "fs";
36106
36106
  import path11 from "path";
36107
36107
  function piPluginScript(knowledgeDir) {
36108
36108
  return `// pk extension \u2014 auto-generated by pk init
36109
+ import { spawnSync } from 'node:child_process';
36109
36110
  import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';
36110
36111
 
36111
36112
  export default function (pi: ExtensionAPI) {
36112
- pi.on('before_agent_start', async (event) => {
36113
- const proc = Bun.spawnSync(['pk', 'prime'], {
36113
+ pi.on('before_agent_start', async (event, _ctx) => {
36114
+ const proc = spawnSync('pk', ['prime'], {
36114
36115
  env: { ...process.env, PK_KNOWLEDGE_DIR: '${knowledgeDir}' },
36116
+ encoding: 'utf-8',
36115
36117
  });
36116
- const output = proc.stdout?.toString().trim() ?? '';
36118
+ const output = proc.stdout?.trim() ?? '';
36117
36119
  return output
36118
36120
  ? { systemPrompt: output + '\\n\\n' + event.systemPrompt }
36119
36121
  : undefined;
36120
36122
  });
36121
36123
 
36122
- pi.on('tool_call', async (event) => {
36123
- if (event.tool === 'bash' && event.input?.command) {
36124
+ pi.on('tool_call', async (event, _ctx) => {
36125
+ if (event.toolName === 'bash' && event.input?.command) {
36124
36126
  event.input.command = 'export PK_KNOWLEDGE_DIR=${knowledgeDir}\\n' + event.input.command;
36125
36127
  }
36126
36128
  });
@@ -36202,7 +36204,7 @@ async function initializeProject(options2) {
36202
36204
  function skillTargetDir(harness, projectRoot) {
36203
36205
  switch (harness) {
36204
36206
  case "claude": {
36205
- return path12.join(os3.homedir(), ".claude", "skills", "pk");
36207
+ return path12.join(projectRoot, ".claude", "skills", "pk");
36206
36208
  }
36207
36209
  case "opencode":
36208
36210
  case "pi": {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justestif/pk",
3
3
  "type": "module",
4
- "version": "0.5.0",
4
+ "version": "0.5.1",
5
5
  "description": "Project knowledge — structured intake, search, and recall",
6
6
  "bin": {
7
7
  "pk": "dist/index.js"