@pourkit/cli 0.0.0-next-20260624074234 → 0.0.0-next-20260625073725

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/cli.js CHANGED
@@ -10634,9 +10634,9 @@ Recall before substantial work: before starting non-trivial planning or implemen
10634
10634
 
10635
10635
  Capture durable knowledge: store concise reusable observations when a durable resolved error, design decision, user preference, significant outcome, or long-session progress summary is discovered. Do not store trivial details, raw logs, transcripts, tool output, git status, prompt dumps, secrets, or ephemeral state.
10636
10636
 
10637
- Database path: use \`$POURKIT_ICM_DB\` when set, otherwise use \`.pourkit/icm/memories.db\`. The Pourkit Memory Store is repo-scoped; do not use a global ICM database or topic naming as the isolation boundary.
10637
+ Database path: host CLI commands must pass \`--db .pourkit/icm/memories.db\` from the repository root. Pourkit-launched Docker runs set \`$POURKIT_ICM_DB\` to the mounted container DB path for runtime plumbing. The Pourkit Memory Store is repo-scoped; do not use a global ICM database or topic naming as the isolation boundary.
10638
10638
 
10639
- CLI fallback: when MCP memory tools are unavailable, recall with \`icm --db "$POURKIT_ICM_DB" recall "<query>"\` or \`icm --db .pourkit/icm/memories.db recall "<query>"\`, and store durable observations with \`icm --db "$POURKIT_ICM_DB" store -c "<concise reusable observation>"\` or \`icm --db .pourkit/icm/memories.db store -c "<concise reusable observation>"\`.
10639
+ CLI fallback: when MCP memory tools are unavailable, recall with \`icm --db .pourkit/icm/memories.db recall "<query>"\`, and store durable observations with \`icm --db .pourkit/icm/memories.db store -c "<concise reusable observation>"\`.
10640
10640
 
10641
10641
  Memory is advisory only. Never treat memory as a replacement for reading current repository files, Run Context, artifacts, or verification output. When memory conflicts with current source or canonical state, current source and canonical state win.
10642
10642
 
@@ -10648,17 +10648,17 @@ You MUST use it actively. Not optional.
10648
10648
 
10649
10649
  ### Recall (before starting work)
10650
10650
  \`\`\`bash
10651
- icm recall "query" # search memories
10652
- icm recall "query" -t "topic-name" # filter by topic
10653
- icm recall-context "query" --limit 5 # formatted for prompt injection
10651
+ icm --db .pourkit/icm/memories.db recall "query" # search memories
10652
+ icm --db .pourkit/icm/memories.db recall "query" -t "topic-name" # filter by topic
10653
+ icm --db .pourkit/icm/memories.db recall-context "query" --limit 5 # formatted for prompt injection
10654
10654
  \`\`\`
10655
10655
 
10656
10656
  ### Store \u2014 MANDATORY triggers
10657
- You MUST call \`icm store\` when ANY of the following happens:
10658
- 1. **Error resolved** \u2192 \`icm store -t errors-resolved -c "description" -i high -k "keyword1,keyword2"\`
10659
- 2. **Architecture/design decision** \u2192 \`icm store -t decisions-{project} -c "description" -i high\`
10660
- 3. **User preference discovered** \u2192 \`icm store -t preferences -c "description" -i critical\`
10661
- 4. **Significant task completed** \u2192 \`icm store -t context-{project} -c "summary of work done" -i high\`
10657
+ You MUST call \`icm --db .pourkit/icm/memories.db store\` when ANY of the following happens:
10658
+ 1. **Error resolved** \u2192 \`icm --db .pourkit/icm/memories.db store -t errors-resolved -c "description" -i high -k "keyword1,keyword2"\`
10659
+ 2. **Architecture/design decision** \u2192 \`icm --db .pourkit/icm/memories.db store -t decisions-{project} -c "description" -i high\`
10660
+ 3. **User preference discovered** \u2192 \`icm --db .pourkit/icm/memories.db store -t preferences -c "description" -i critical\`
10661
+ 4. **Significant task completed** \u2192 \`icm --db .pourkit/icm/memories.db store -t context-{project} -c "summary of work done" -i high\`
10662
10662
  5. **Conversation exceeds ~20 tool calls without a store** \u2192 store a progress summary
10663
10663
 
10664
10664
  Do this BEFORE responding to the user. Not after. Not later. Immediately.
@@ -10667,9 +10667,9 @@ Do NOT store: trivial details, info already in CLAUDE.md, ephemeral state (build
10667
10667
 
10668
10668
  ### Other commands
10669
10669
  \`\`\`bash
10670
- icm update <id> -c "updated content" # edit memory in-place
10671
- icm health # topic hygiene audit
10672
- icm topics # list all topics
10670
+ icm --db .pourkit/icm/memories.db update <id> -c "updated content" # edit memory in-place
10671
+ icm --db .pourkit/icm/memories.db health # topic hygiene audit
10672
+ icm --db .pourkit/icm/memories.db topics # list all topics
10673
10673
  \`\`\`
10674
10674
  <!-- icm:end -->`;
10675
10675
  }
@@ -12837,9 +12837,13 @@ Init applied: ${result.applied} operations applied, ${result.skipped} skipped.`
12837
12837
 
12838
12838
  // commands/memory-init.ts
12839
12839
  import { existsSync as existsSync17, mkdirSync as mkdirSync8, readFileSync as readFileSync17, writeFileSync as writeFileSync5 } from "fs";
12840
+ import { execFile as execFile3 } from "child_process";
12840
12841
  import { join as join17 } from "path";
12842
+ import { promisify as promisify3 } from "util";
12843
+ var execFileAsync3 = promisify3(execFile3);
12841
12844
  async function runMemoryInitCommand(options) {
12842
12845
  const cwd = options.cwd ?? process.cwd();
12846
+ const execCommand = options.execCommand ?? execFileAsync3;
12843
12847
  const configPath = join17(cwd, ".pourkit", "config.json");
12844
12848
  if (!existsSync17(configPath)) {
12845
12849
  return {
@@ -12872,7 +12876,21 @@ async function runMemoryInitCommand(options) {
12872
12876
  const next = { ...raw, memory };
12873
12877
  writeFileSync5(configPath, JSON.stringify(next, null, 2) + "\n");
12874
12878
  }
12875
- mkdirSync8(join17(cwd, ".pourkit", "icm"), { recursive: true });
12879
+ const memoryDir = join17(cwd, ".pourkit", "icm");
12880
+ const memoryDbPath = join17(memoryDir, "memories.db");
12881
+ mkdirSync8(memoryDir, { recursive: true });
12882
+ let dbInitialized = false;
12883
+ let warning;
12884
+ try {
12885
+ await execCommand(
12886
+ "icm",
12887
+ ["--db", memoryDbPath, "recall", "pourkit memory init smoke"],
12888
+ { cwd }
12889
+ );
12890
+ dbInitialized = true;
12891
+ } catch {
12892
+ warning = "ICM is not available or could not initialize .pourkit/icm/memories.db. Install ICM and run `pourkit doctor` to verify repo-scoped memory setup.";
12893
+ }
12876
12894
  const gitignorePath = join17(cwd, ".gitignore");
12877
12895
  updateManagedBlockSync(gitignorePath, generateGitignoreBlock());
12878
12896
  const managed = await generateManagedAgentInstructions({
@@ -12893,7 +12911,9 @@ async function runMemoryInitCommand(options) {
12893
12911
  return {
12894
12912
  ok: true,
12895
12913
  alreadyEnabled,
12896
- message: alreadyEnabled ? "Memory is already enabled. Refreshed repo-scoped memory setup." : "Memory enabled. Run `pourkit doctor` to verify setup."
12914
+ dbInitialized,
12915
+ warning,
12916
+ message: `${alreadyEnabled ? "Memory is already enabled. Refreshed repo-scoped memory setup." : "Memory enabled. Run `pourkit doctor` to verify setup."}${warning ? ` ${warning}` : ""}`
12897
12917
  };
12898
12918
  }
12899
12919
  function updateManagedBlockSync(filePath, content) {
@@ -13074,9 +13094,14 @@ function localSchemaDir(repoRoot2) {
13074
13094
  return resolve3(repoRoot2, ".pourkit/schema");
13075
13095
  }
13076
13096
  var MANAGED_BLOCK_BEGIN2 = "<!-- BEGIN POURKIT MANAGED BLOCK -->\n";
13097
+ var MANAGED_BLOCK_BEGIN_MARKER = MANAGED_BLOCK_BEGIN2.trim();
13098
+ var MANAGED_BLOCK_END_MARKER = "<!-- END POURKIT MANAGED BLOCK -->";
13077
13099
  var OLD_DOCS_PATH_PATTERN = ".pourkit/docs/agents/";
13078
13100
  function resolvePackagedManagedPath(...segments) {
13079
- return resolve3(__dirname3, "..", "managed", ...segments);
13101
+ const bundledPath = resolve3(__dirname3, "managed", ...segments);
13102
+ const sourcePath = resolve3(__dirname3, "..", "managed", ...segments);
13103
+ const candidates = [bundledPath, sourcePath];
13104
+ return candidates.find((candidate) => existsSync18(candidate)) ?? bundledPath;
13080
13105
  }
13081
13106
  function resolvePackagedManagedDocPath(docName) {
13082
13107
  return resolvePackagedManagedPath("docs", "agents", docName);
@@ -13631,21 +13656,53 @@ async function validateMemoryHealth(cwd, memoryConfig) {
13631
13656
  ok: hasGitignoreEntry,
13632
13657
  detail: hasGitignoreEntry ? ".gitignore covers .pourkit/icm/" : ".gitignore does not cover .pourkit/icm/"
13633
13658
  });
13659
+ const memoryDbPath = resolve3(cwd, ".pourkit", "icm", "memories.db");
13660
+ const hasMemoryDb = existsSync18(memoryDbPath);
13661
+ checks.push({
13662
+ name: "icm-db-exists",
13663
+ ok: hasMemoryDb,
13664
+ detail: hasMemoryDb ? ".pourkit/icm/memories.db exists" : ".pourkit/icm/memories.db is missing"
13665
+ });
13634
13666
  const shapeValid = memoryConfig.enabled === true && memoryConfig.provider === "icm";
13635
13667
  checks.push({
13636
13668
  name: "config-memory-shape",
13637
13669
  ok: shapeValid,
13638
13670
  detail: shapeValid ? "memory: { enabled: true, provider: icm }" : `invalid memory config: enabled=${memoryConfig.enabled}, provider=${memoryConfig.provider}`
13639
13671
  });
13672
+ const staleAgentFiles = ["AGENTS.md", "CLAUDE.md"].filter((fileName) => {
13673
+ const filePath = resolve3(cwd, fileName);
13674
+ if (!existsSync18(filePath)) return false;
13675
+ const content = readFileSync18(filePath, "utf-8");
13676
+ const managedBlock = extractManagedBlockContent(content);
13677
+ return managedBlock !== null && hasBareIcmMemoryCommand(managedBlock);
13678
+ });
13679
+ checks.push({
13680
+ name: "agent-memory-instructions",
13681
+ ok: staleAgentFiles.length === 0,
13682
+ detail: staleAgentFiles.length === 0 ? "managed agent memory instructions avoid bare ICM commands" : `stale bare ICM commands found in ${staleAgentFiles.join(", ")}`
13683
+ });
13640
13684
  checks.push({
13641
13685
  name: "docker-image-advisory",
13642
13686
  ok: true,
13643
13687
  detail: "advisory only"
13644
13688
  });
13645
13689
  const ok = checks.filter((c) => c.name !== "docker-image-advisory").every((c) => c.ok);
13646
- const recommendation = ok ? null : "Run `pourkit memory init` to repair ICM memory setup, install ICM on PATH for host planning, or rebuild the sandbox image for Docker runs.";
13690
+ const recommendation = ok ? null : "Run `pourkit memory init` or `pourkit sync workflow-pack` to repair ICM memory setup, install ICM on PATH for host planning, or rebuild the sandbox image for Docker runs.";
13647
13691
  return { ok, enabled: true, checks, recommendation };
13648
13692
  }
13693
+ function hasBareIcmMemoryCommand(content) {
13694
+ return /(^|\n)\s*icm\s+(recall|recall-context|store|update|health|topics)\b/.test(
13695
+ content
13696
+ ) || /`icm\s+(recall|recall-context|store|update|health|topics)\b/.test(content);
13697
+ }
13698
+ function extractManagedBlockContent(content) {
13699
+ const beginIdx = content.indexOf(MANAGED_BLOCK_BEGIN_MARKER);
13700
+ if (beginIdx === -1) return null;
13701
+ const contentStart = beginIdx + MANAGED_BLOCK_BEGIN_MARKER.length;
13702
+ const endIdx = content.indexOf(MANAGED_BLOCK_END_MARKER, contentStart);
13703
+ if (endIdx === -1) return null;
13704
+ return content.slice(contentStart, endIdx);
13705
+ }
13649
13706
  async function runDoctorCommand(options) {
13650
13707
  const repoRootPath = options.cwd ?? process.cwd();
13651
13708
  const schemaDir = localSchemaDir(repoRootPath);
@@ -13800,8 +13857,10 @@ var OVERRIDES_DIR = ".pourkit/overrides";
13800
13857
  var MANAGED_BLOCK_BEGIN3 = "<!-- BEGIN POURKIT MANAGED BLOCK -->\n";
13801
13858
  var MANAGED_BLOCK_END2 = "\n<!-- END POURKIT MANAGED BLOCK -->";
13802
13859
  function resolvePackagedManagedPath2(...segments) {
13803
- const candidates = [resolve4(__dirname4, "..", "managed", ...segments)];
13804
- return candidates[0];
13860
+ const bundledPath = resolve4(__dirname4, "managed", ...segments);
13861
+ const sourcePath = resolve4(__dirname4, "..", "managed", ...segments);
13862
+ const candidates = [bundledPath, sourcePath];
13863
+ return candidates.find((candidate) => existsSync19(candidate)) ?? bundledPath;
13805
13864
  }
13806
13865
  function resolvePackagedManagedDocPath2(docName) {
13807
13866
  return resolvePackagedManagedPath2("docs", "agents", docName);
@@ -16074,11 +16133,11 @@ function createCliProgram(version) {
16074
16133
  return program;
16075
16134
  }
16076
16135
  async function resolveCliVersion() {
16077
- if (isPackageVersion("0.0.0-next-20260624074234")) {
16078
- return "0.0.0-next-20260624074234";
16136
+ if (isPackageVersion("0.0.0-next-20260625073725")) {
16137
+ return "0.0.0-next-20260625073725";
16079
16138
  }
16080
- if (isReleaseVersion("0.0.0-next-20260624074234")) {
16081
- return "0.0.0-next-20260624074234";
16139
+ if (isReleaseVersion("0.0.0-next-20260625073725")) {
16140
+ return "0.0.0-next-20260625073725";
16082
16141
  }
16083
16142
  try {
16084
16143
  const root = repoRoot();