@justestif/pk 0.2.0 → 0.2.2
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/README.md +3 -4
- package/dist/index.js +16 -36
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,10 +30,10 @@ Non-interactive:
|
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
32
|
pk init my-project --harness claude
|
|
33
|
-
pk init my-project --harness claude,
|
|
33
|
+
pk init my-project --harness claude,cursor # multiple harnesses
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
Available harnesses: `claude` (Claude Code
|
|
36
|
+
Available harnesses: `claude` (Claude Code & Claude Desktop), `cursor` (Cursor), `gemini` (Gemini CLI), `codex` (Codex), `opencode` (OpenCode).
|
|
37
37
|
|
|
38
38
|
`pk init` does three things:
|
|
39
39
|
|
|
@@ -43,8 +43,7 @@ Available harnesses: `claude` (Claude Code), `omp` (Oh My Pi), `cursor` (Cursor)
|
|
|
43
43
|
|
|
44
44
|
| Harness | Files written |
|
|
45
45
|
|---|---|
|
|
46
|
-
| `claude` | `.mcp.json`, `CLAUDE.md`, `.claude/hooks/pk-eval.ts`, `.claude/settings.json` |
|
|
47
|
-
| `omp` | `.omp/mcp.json`, `AGENTS.md`, `.omp/extensions/pk-eval.ts` |
|
|
46
|
+
| `claude` | `.mcp.json`, `CLAUDE.md`, `.claude/hooks/pk-eval.ts`, `.claude/settings.json` | (also works for Claude Desktop) |
|
|
48
47
|
| `cursor` | `.cursor/mcp.json`, `.cursor/rules/pk.mdc`, `.cursor/hooks/pk-eval.sh`, `.cursor/hooks.json` |
|
|
49
48
|
| `gemini` | `.gemini/settings.json`, `GEMINI.md`, `.gemini/hooks/pk-eval.sh` |
|
|
50
49
|
| `codex` | `.codex/config.toml`, `AGENTS.md`, `.codex/hooks/pk-eval.sh`, `.codex/hooks.json` |
|
package/dist/index.js
CHANGED
|
@@ -17713,7 +17713,7 @@ var {
|
|
|
17713
17713
|
var package_default = {
|
|
17714
17714
|
name: "@justestif/pk",
|
|
17715
17715
|
type: "module",
|
|
17716
|
-
version: "0.2.
|
|
17716
|
+
version: "0.2.2",
|
|
17717
17717
|
description: "Project knowledge \u2014 structured intake, search, and recall",
|
|
17718
17718
|
bin: {
|
|
17719
17719
|
pk: "dist/index.js"
|
|
@@ -34113,7 +34113,6 @@ ${c2}
|
|
|
34113
34113
|
// src/commands/init.ts
|
|
34114
34114
|
var HARNESSES = [
|
|
34115
34115
|
{ hint: ".mcp.json + CLAUDE.md + forced-eval hook", label: "Claude Code", value: "claude" },
|
|
34116
|
-
{ hint: ".omp/mcp.json + AGENTS.md + forced-eval hook", label: "Oh My Pi", value: "omp" },
|
|
34117
34116
|
{ hint: ".cursor/mcp.json + .cursor/rules/pk.mdc + hook", label: "Cursor", value: "cursor" },
|
|
34118
34117
|
{ hint: ".gemini/settings.json + GEMINI.md + hook", label: "Gemini CLI", value: "gemini" },
|
|
34119
34118
|
{ hint: ".codex/config.toml + AGENTS.md + hook", label: "Codex", value: "codex" },
|
|
@@ -34122,7 +34121,6 @@ var HARNESSES = [
|
|
|
34122
34121
|
var HARNESS_VALUES = new Set(HARNESSES.map((h2) => h2.value));
|
|
34123
34122
|
var HARNESS_ACTIVATION = {
|
|
34124
34123
|
claude: "start a new Claude Code session in this project",
|
|
34125
|
-
omp: "restart your Oh My Pi session",
|
|
34126
34124
|
cursor: "restart Cursor for changes to take effect",
|
|
34127
34125
|
gemini: "restart your Gemini CLI session",
|
|
34128
34126
|
codex: "restart Codex for MCP to connect",
|
|
@@ -34179,14 +34177,6 @@ async function writeClaudeConfig(projectRoot, _name, knowledgeDir) {
|
|
|
34179
34177
|
cfg.mcpServers = servers;
|
|
34180
34178
|
await writeJson(cfgPath, cfg);
|
|
34181
34179
|
}
|
|
34182
|
-
async function writeOmpConfig(projectRoot, _name, knowledgeDir) {
|
|
34183
|
-
const cfgPath = path7.join(projectRoot, ".omp", "mcp.json");
|
|
34184
|
-
const cfg = await readJson(cfgPath);
|
|
34185
|
-
const servers = cfg.mcpServers ?? {};
|
|
34186
|
-
servers.pk = pkMcpEntry(knowledgeDir);
|
|
34187
|
-
cfg.mcpServers = servers;
|
|
34188
|
-
await writeJson(cfgPath, cfg);
|
|
34189
|
-
}
|
|
34190
34180
|
var PK_SECTION_START = "<!-- pk:start -->";
|
|
34191
34181
|
var PK_SECTION_END = "<!-- pk:end -->";
|
|
34192
34182
|
var PK_INSTRUCTION = `## pk \u2014 project knowledge
|
|
@@ -34246,29 +34236,26 @@ async function writeClaudeHook(projectRoot) {
|
|
|
34246
34236
|
const hooks = settings.hooks ?? {};
|
|
34247
34237
|
const ups = hooks.UserPromptSubmit ?? [];
|
|
34248
34238
|
const hookCmd = `bun run ${hookPath}`;
|
|
34249
|
-
|
|
34250
|
-
|
|
34239
|
+
const wrappedHook = {
|
|
34240
|
+
matcher: "",
|
|
34241
|
+
hooks: [
|
|
34242
|
+
{
|
|
34243
|
+
type: "command",
|
|
34244
|
+
command: hookCmd
|
|
34245
|
+
}
|
|
34246
|
+
]
|
|
34247
|
+
};
|
|
34248
|
+
const hasPkEval = (entry) => typeof entry === "object" && entry !== null && ("hooks" in entry) && Array.isArray(entry.hooks) && entry.hooks.some((hook) => typeof hook === "object" && hook !== null && ("type" in hook) && hook.type === "command" && ("command" in hook) && hook.command === hookCmd);
|
|
34249
|
+
if (!ups.some(hasPkEval)) {
|
|
34250
|
+
ups.push(wrappedHook);
|
|
34251
|
+
}
|
|
34252
|
+
if (!ups.some(hasPkEval)) {
|
|
34253
|
+
ups.push(wrappedHook);
|
|
34251
34254
|
}
|
|
34252
34255
|
hooks.UserPromptSubmit = ups;
|
|
34253
34256
|
settings.hooks = hooks;
|
|
34254
34257
|
await writeJson(settingsPath, settings);
|
|
34255
34258
|
}
|
|
34256
|
-
function ompHookScript() {
|
|
34257
|
-
return `// pk forced-eval hook \u2014 auto-generated by pk init
|
|
34258
|
-
import type {HookAPI} from '@oh-my-pi/pi-coding-agent/extensibility/hooks';
|
|
34259
|
-
|
|
34260
|
-
export default function (pi: HookAPI) {
|
|
34261
|
-
pi.on('before_agent_start', (event: {systemPrompt?: string}) => ({
|
|
34262
|
-
systemPrompt: ${JSON.stringify(FORCED_EVAL_PROMPT)} + '\\n\\n' + (event.systemPrompt ?? ''),
|
|
34263
|
-
}));
|
|
34264
|
-
}
|
|
34265
|
-
`;
|
|
34266
|
-
}
|
|
34267
|
-
async function writeOmpHook(projectRoot) {
|
|
34268
|
-
const hookPath = path7.join(projectRoot, ".omp", "extensions", "pk-eval.ts");
|
|
34269
|
-
mkdirSync4(path7.dirname(hookPath), { recursive: true });
|
|
34270
|
-
await Bun.write(hookPath, ompHookScript());
|
|
34271
|
-
}
|
|
34272
34259
|
async function writeCursorConfig(projectRoot, _name, knowledgeDir) {
|
|
34273
34260
|
const cfgPath = path7.join(projectRoot, ".cursor", "mcp.json");
|
|
34274
34261
|
const cfg = await readJson(cfgPath);
|
|
@@ -34434,7 +34421,6 @@ function skillTargetDir(harness, projectRoot) {
|
|
|
34434
34421
|
case "claude": {
|
|
34435
34422
|
return path7.join(os3.homedir(), ".claude", "skills", "pk");
|
|
34436
34423
|
}
|
|
34437
|
-
case "omp":
|
|
34438
34424
|
case "cursor":
|
|
34439
34425
|
case "gemini":
|
|
34440
34426
|
case "opencode": {
|
|
@@ -34485,12 +34471,6 @@ async function applyHarness(harness, ctx) {
|
|
|
34485
34471
|
await writeClaudeHook(projectRoot);
|
|
34486
34472
|
break;
|
|
34487
34473
|
}
|
|
34488
|
-
case "omp": {
|
|
34489
|
-
await writeOmpConfig(projectRoot, name, knowledgeDir);
|
|
34490
|
-
await writeAgentsMd(projectRoot);
|
|
34491
|
-
await writeOmpHook(projectRoot);
|
|
34492
|
-
break;
|
|
34493
|
-
}
|
|
34494
34474
|
case "cursor": {
|
|
34495
34475
|
await writeCursorConfig(projectRoot, name, knowledgeDir);
|
|
34496
34476
|
await writeCursorRules(projectRoot);
|