@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.
- package/dist/index.js +8 -6
- 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 =
|
|
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?.
|
|
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.
|
|
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(
|
|
36207
|
+
return path12.join(projectRoot, ".claude", "skills", "pk");
|
|
36206
36208
|
}
|
|
36207
36209
|
case "opencode":
|
|
36208
36210
|
case "pi": {
|