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

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,6 +13094,8 @@ 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
13101
  return resolve3(__dirname3, "..", "managed", ...segments);
@@ -13631,21 +13653,53 @@ async function validateMemoryHealth(cwd, memoryConfig) {
13631
13653
  ok: hasGitignoreEntry,
13632
13654
  detail: hasGitignoreEntry ? ".gitignore covers .pourkit/icm/" : ".gitignore does not cover .pourkit/icm/"
13633
13655
  });
13656
+ const memoryDbPath = resolve3(cwd, ".pourkit", "icm", "memories.db");
13657
+ const hasMemoryDb = existsSync18(memoryDbPath);
13658
+ checks.push({
13659
+ name: "icm-db-exists",
13660
+ ok: hasMemoryDb,
13661
+ detail: hasMemoryDb ? ".pourkit/icm/memories.db exists" : ".pourkit/icm/memories.db is missing"
13662
+ });
13634
13663
  const shapeValid = memoryConfig.enabled === true && memoryConfig.provider === "icm";
13635
13664
  checks.push({
13636
13665
  name: "config-memory-shape",
13637
13666
  ok: shapeValid,
13638
13667
  detail: shapeValid ? "memory: { enabled: true, provider: icm }" : `invalid memory config: enabled=${memoryConfig.enabled}, provider=${memoryConfig.provider}`
13639
13668
  });
13669
+ const staleAgentFiles = ["AGENTS.md", "CLAUDE.md"].filter((fileName) => {
13670
+ const filePath = resolve3(cwd, fileName);
13671
+ if (!existsSync18(filePath)) return false;
13672
+ const content = readFileSync18(filePath, "utf-8");
13673
+ const managedBlock = extractManagedBlockContent(content);
13674
+ return managedBlock !== null && hasBareIcmMemoryCommand(managedBlock);
13675
+ });
13676
+ checks.push({
13677
+ name: "agent-memory-instructions",
13678
+ ok: staleAgentFiles.length === 0,
13679
+ detail: staleAgentFiles.length === 0 ? "managed agent memory instructions avoid bare ICM commands" : `stale bare ICM commands found in ${staleAgentFiles.join(", ")}`
13680
+ });
13640
13681
  checks.push({
13641
13682
  name: "docker-image-advisory",
13642
13683
  ok: true,
13643
13684
  detail: "advisory only"
13644
13685
  });
13645
13686
  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.";
13687
+ 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
13688
  return { ok, enabled: true, checks, recommendation };
13648
13689
  }
13690
+ function hasBareIcmMemoryCommand(content) {
13691
+ return /(^|\n)\s*icm\s+(recall|recall-context|store|update|health|topics)\b/.test(
13692
+ content
13693
+ ) || /`icm\s+(recall|recall-context|store|update|health|topics)\b/.test(content);
13694
+ }
13695
+ function extractManagedBlockContent(content) {
13696
+ const beginIdx = content.indexOf(MANAGED_BLOCK_BEGIN_MARKER);
13697
+ if (beginIdx === -1) return null;
13698
+ const contentStart = beginIdx + MANAGED_BLOCK_BEGIN_MARKER.length;
13699
+ const endIdx = content.indexOf(MANAGED_BLOCK_END_MARKER, contentStart);
13700
+ if (endIdx === -1) return null;
13701
+ return content.slice(contentStart, endIdx);
13702
+ }
13649
13703
  async function runDoctorCommand(options) {
13650
13704
  const repoRootPath = options.cwd ?? process.cwd();
13651
13705
  const schemaDir = localSchemaDir(repoRootPath);
@@ -16074,11 +16128,11 @@ function createCliProgram(version) {
16074
16128
  return program;
16075
16129
  }
16076
16130
  async function resolveCliVersion() {
16077
- if (isPackageVersion("0.0.0-next-20260624074234")) {
16078
- return "0.0.0-next-20260624074234";
16131
+ if (isPackageVersion("0.0.0-next-20260625065443")) {
16132
+ return "0.0.0-next-20260625065443";
16079
16133
  }
16080
- if (isReleaseVersion("0.0.0-next-20260624074234")) {
16081
- return "0.0.0-next-20260624074234";
16134
+ if (isReleaseVersion("0.0.0-next-20260625065443")) {
16135
+ return "0.0.0-next-20260625065443";
16082
16136
  }
16083
16137
  try {
16084
16138
  const root = repoRoot();