@polterware/polter 0.3.1 → 0.4.0

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/api.js CHANGED
@@ -7,6 +7,8 @@ import {
7
7
  executePipeline,
8
8
  features,
9
9
  findPipelineByName,
10
+ findProcessesByCwd,
11
+ findRunningByCommand,
10
12
  generateProcessId,
11
13
  getAllPipelines,
12
14
  getCommandById,
@@ -17,6 +19,7 @@ import {
17
19
  getFlagsForTool,
18
20
  getMcpStatusInfo,
19
21
  getProcessOutput,
22
+ getToolDisplayName,
20
23
  getToolInfo,
21
24
  installMcpServerSilent,
22
25
  isProcessRunning,
@@ -33,7 +36,7 @@ import {
33
36
  stopProcess,
34
37
  toolFlags,
35
38
  translateCommand
36
- } from "./chunk-7MIUDIAI.js";
39
+ } from "./chunk-YNOZDU75.js";
37
40
  export {
38
41
  allCommands,
39
42
  applyActions,
@@ -42,6 +45,8 @@ export {
42
45
  executePipeline,
43
46
  features,
44
47
  findPipelineByName,
48
+ findProcessesByCwd,
49
+ findRunningByCommand,
45
50
  generateProcessId,
46
51
  getAllPipelines,
47
52
  getCommandById,
@@ -52,6 +57,7 @@ export {
52
57
  getFlagsForTool,
53
58
  getMcpStatusInfo,
54
59
  getProcessOutput,
60
+ getToolDisplayName,
55
61
  getToolInfo,
56
62
  installMcpServerSilent,
57
63
  isProcessRunning,
@@ -675,8 +675,7 @@ var gitCommands = [
675
675
 
676
676
  // src/data/commands/pkg.ts
677
677
  var pkgCommands = [
678
- // Build & Publish
679
- { id: "pkg:build", tool: "pkg", base: ["run", "build"], label: "build", hint: "Run build script" },
678
+ // Publish & Version
680
679
  { id: "pkg:publish", tool: "pkg", base: ["publish"], label: "publish", hint: "Publish package to registry" },
681
680
  { id: "pkg:pack", tool: "pkg", base: ["pack"], label: "pack", hint: "Create tarball from package" },
682
681
  { id: "pkg:version:patch", tool: "pkg", base: ["version", "patch"], label: "version patch", hint: "Bump patch version" },
@@ -695,8 +694,7 @@ var pkgCommands = [
695
694
  // Registry & Config
696
695
  { id: "pkg:config:list", tool: "pkg", base: ["config", "list"], label: "config list", hint: "Show config" },
697
696
  { id: "pkg:whoami", tool: "pkg", base: ["whoami"], label: "whoami", hint: "Show logged-in user" },
698
- // Scripts & Info
699
- { id: "pkg:run", tool: "pkg", base: ["run"], label: "run", hint: "Run a package script" },
697
+ // Info & Registry
700
698
  { id: "pkg:info", tool: "pkg", base: ["info"], label: "info", hint: "Show package info" },
701
699
  { id: "pkg:search", tool: "pkg", base: ["search"], label: "search", hint: "Search packages in registry" },
702
700
  { id: "pkg:init", tool: "pkg", base: ["init"], label: "init", hint: "Initialize a new package.json" }
@@ -863,8 +861,6 @@ var features = [
863
861
  "pkg:outdated",
864
862
  "pkg:audit",
865
863
  "pkg:ls",
866
- "pkg:build",
867
- "pkg:run",
868
864
  "pkg:publish",
869
865
  "pkg:pack",
870
866
  "pkg:version:patch",
@@ -1003,11 +999,13 @@ function runCommand(execution, args, cwd = process.cwd(), options) {
1003
999
  const text = data.toString();
1004
1000
  stdout += text;
1005
1001
  if (!options?.quiet) process.stdout.write(text);
1002
+ options?.onData?.(stdout, stderr);
1006
1003
  });
1007
1004
  child.stderr?.on("data", (data) => {
1008
1005
  const text = data.toString();
1009
1006
  stderr += text;
1010
1007
  if (!options?.quiet) process.stderr.write(text);
1008
+ options?.onData?.(stdout, stderr);
1011
1009
  });
1012
1010
  child.on("error", (err) => {
1013
1011
  resolve3({
@@ -1183,6 +1181,20 @@ function execCapture(command) {
1183
1181
  }
1184
1182
 
1185
1183
  // src/lib/toolResolver.ts
1184
+ function getToolDisplayName(toolId, cwd = process.cwd()) {
1185
+ if (toolId === "pkg") {
1186
+ const mgr = detectPkgManager(cwd);
1187
+ return mgr.id;
1188
+ }
1189
+ const names = {
1190
+ supabase: "supabase",
1191
+ gh: "github",
1192
+ vercel: "vercel",
1193
+ git: "git",
1194
+ pkg: "npm"
1195
+ };
1196
+ return names[toolId];
1197
+ }
1186
1198
  function resolveToolCommand(toolId, cwd = process.cwd()) {
1187
1199
  if (toolId === "supabase") {
1188
1200
  const resolved = resolveSupabaseCommand(cwd);
@@ -1492,6 +1504,20 @@ function removeProcess(id) {
1492
1504
  }
1493
1505
  registry.delete(id);
1494
1506
  }
1507
+ function findProcessesByCwd(cwd) {
1508
+ const normalized = cwd.replace(/\/+$/, "");
1509
+ return Array.from(registry.values()).filter((proc) => proc.cwd.replace(/\/+$/, "") === normalized).map(toProcessInfo);
1510
+ }
1511
+ function findRunningByCommand(cwd, command, args) {
1512
+ const normalized = cwd.replace(/\/+$/, "");
1513
+ const argsStr = args.join(" ");
1514
+ for (const proc of registry.values()) {
1515
+ if (proc.cwd.replace(/\/+$/, "") === normalized && proc.status === "running" && proc.command === command && proc.args.join(" ") === argsStr) {
1516
+ return toProcessInfo(proc);
1517
+ }
1518
+ }
1519
+ return void 0;
1520
+ }
1495
1521
  function toProcessInfo(proc) {
1496
1522
  const now = Date.now();
1497
1523
  const start = proc.startedAt.getTime();
@@ -2190,6 +2216,7 @@ export {
2190
2216
  detectPkgManager,
2191
2217
  translateCommand,
2192
2218
  resolvePkgArgs,
2219
+ getToolDisplayName,
2193
2220
  resolveToolCommand,
2194
2221
  getToolInfo,
2195
2222
  getToolLinkInfo,
@@ -2200,6 +2227,8 @@ export {
2200
2227
  getProcessOutput,
2201
2228
  isProcessRunning,
2202
2229
  removeProcess,
2230
+ findProcessesByCwd,
2231
+ findRunningByCommand,
2203
2232
  executePipeline,
2204
2233
  findNearestPackageRoot,
2205
2234
  getProjectConfigPath,