runtrim 0.1.5 → 0.1.7

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.
Files changed (2) hide show
  1. package/dist-cli/runtrim.js +47 -102
  2. package/package.json +2 -1
@@ -29,104 +29,6 @@ import fs9 from "fs";
29
29
  import path9 from "path";
30
30
  import { execa as execa3 } from "execa";
31
31
 
32
- // package.json
33
- var package_default = {
34
- name: "runtrim",
35
- version: "0.1.4",
36
- description: "CLI guard layer that scopes AI coding runs before they waste tokens.",
37
- license: "MIT",
38
- author: "RunTrim",
39
- homepage: "https://runtrim.dev",
40
- repository: {
41
- type: "git",
42
- url: "git+https://github.com/michelpronkk-oss/rtrim.git"
43
- },
44
- bugs: {
45
- url: "https://github.com/michelpronkk-oss/rtrim/issues"
46
- },
47
- keywords: [
48
- "cli",
49
- "ai-coding",
50
- "codex",
51
- "claude",
52
- "cursor",
53
- "developer-tools",
54
- "prompt-guard"
55
- ],
56
- bin: {
57
- runtrim: "dist-cli/runtrim.cjs"
58
- },
59
- files: [
60
- "dist-cli",
61
- "README.md",
62
- "LICENSE",
63
- "package.json"
64
- ],
65
- scripts: {
66
- dev: "next dev",
67
- build: "next build",
68
- "build:web": "next build",
69
- "build:cli": "tsup --config tsup.config.ts && node scripts/fix-cli-runtime.mjs",
70
- "build:all": "npm run build:cli && npm run build:web",
71
- start: "next start",
72
- lint: "eslint",
73
- runtrim: "tsx cli/runtrim.ts",
74
- "runtrim:build": "npm run build:cli"
75
- },
76
- dependencies: {
77
- "@radix-ui/react-accordion": "^1.2.12",
78
- "@radix-ui/react-avatar": "^1.1.11",
79
- "@radix-ui/react-dialog": "^1.1.15",
80
- "@radix-ui/react-dropdown-menu": "^2.1.16",
81
- "@radix-ui/react-label": "^2.1.8",
82
- "@radix-ui/react-progress": "^1.1.8",
83
- "@radix-ui/react-select": "^2.2.6",
84
- "@radix-ui/react-separator": "^1.1.8",
85
- "@radix-ui/react-slot": "^1.2.4",
86
- "@radix-ui/react-switch": "^1.2.6",
87
- "@radix-ui/react-tabs": "^1.1.13",
88
- "@radix-ui/react-tooltip": "^1.2.8",
89
- "@supabase/supabase-js": "^2.57.4",
90
- chalk: "^5.6.2",
91
- "class-variance-authority": "^0.7.1",
92
- clipboardy: "^5.3.1",
93
- clsx: "^2.1.1",
94
- commander: "^14.0.3",
95
- execa: "^9.6.1",
96
- "fast-glob": "^3.3.3",
97
- "framer-motion": "^12.38.0",
98
- "lucide-react": "^1.11.0",
99
- motion: "^12.38.0",
100
- nanoid: "^5.1.9",
101
- next: "16.2.4",
102
- "next-themes": "^0.4.6",
103
- ora: "^9.4.0",
104
- prompts: "^2.4.2",
105
- "radix-ui": "^1.4.3",
106
- react: "19.2.4",
107
- "react-dom": "19.2.4",
108
- resend: "^6.12.2",
109
- shadcn: "^4.5.0",
110
- sonner: "^2.0.7",
111
- "tailwind-merge": "^3.5.0",
112
- "tw-animate-css": "^1.4.0",
113
- zod: "^4.3.6"
114
- },
115
- devDependencies: {
116
- "@tailwindcss/postcss": "^4",
117
- "@types/node": "^20",
118
- "@types/prompts": "^2.4.9",
119
- "@types/react": "^19",
120
- "@types/react-dom": "^19",
121
- eslint: "^9",
122
- "eslint-config-next": "16.2.4",
123
- tailwindcss: "^4",
124
- tsup: "^8.5.1",
125
- tsx: "^4.21.0",
126
- typescript: "^5"
127
- }
128
- };
129
-
130
32
  // src/lib/runtrim-config.ts
131
33
  import fs from "fs";
132
34
  import path from "path";
@@ -3315,6 +3217,49 @@ var SECTION = "-------------------------------------------------";
3315
3217
  var OUTPUT_PREVIEW_MAX = 1600;
3316
3218
  var STANDARD_RATE_PER_MILLION = 3;
3317
3219
  var EXPENSIVE_RATE_PER_MILLION = 30;
3220
+ function resolveCliLauncherPath() {
3221
+ var _a2;
3222
+ const invokedPath = (_a2 = process.argv[1]) == null ? void 0 : _a2.trim();
3223
+ if (invokedPath) {
3224
+ const absolute = path9.resolve(invokedPath);
3225
+ if (fs9.existsSync(absolute)) return absolute;
3226
+ }
3227
+ const localFallback = path9.resolve(process.cwd(), "dist-cli", "runtrim.cjs");
3228
+ if (fs9.existsSync(localFallback)) return localFallback;
3229
+ return null;
3230
+ }
3231
+ function resolveCliRuntimeDir() {
3232
+ const launcher = resolveCliLauncherPath();
3233
+ if (launcher) return path9.dirname(launcher);
3234
+ return process.cwd();
3235
+ }
3236
+ function resolveCliVersion() {
3237
+ var _a2, _b;
3238
+ const cliDir = resolveCliRuntimeDir();
3239
+ const candidates = [
3240
+ path9.resolve(cliDir, "..", "package.json"),
3241
+ path9.resolve(cliDir, "package.json"),
3242
+ path9.resolve(process.cwd(), "package.json")
3243
+ ];
3244
+ for (const packageJsonPath of candidates) {
3245
+ try {
3246
+ const raw = fs9.readFileSync(packageJsonPath, "utf-8");
3247
+ const parsed = JSON.parse(raw);
3248
+ if (parsed.version && parsed.version.trim()) return parsed.version.trim();
3249
+ } catch (e) {
3250
+ }
3251
+ }
3252
+ try {
3253
+ const fromNodeExecArgv = process.execArgv.find((arg) => arg.startsWith("--runtrim-version="));
3254
+ if (fromNodeExecArgv) {
3255
+ const v = (_a2 = fromNodeExecArgv.split("=")[1]) == null ? void 0 : _a2.trim();
3256
+ if (v) return v;
3257
+ }
3258
+ } catch (e) {
3259
+ }
3260
+ const envVersion = (_b = process.env.npm_package_version) == null ? void 0 : _b.trim();
3261
+ return envVersion || "0.0.0";
3262
+ }
3318
3263
  function parseEstimatedNumber3(value) {
3319
3264
  if (!value) return 0;
3320
3265
  const n = parseFloat(value.replace(/[^\d.]/g, ""));
@@ -3812,8 +3757,8 @@ async function runPrepareTask(task, options) {
3812
3757
  }
3813
3758
  }
3814
3759
  async function tryLaunchPanelMonitorDetached(cwd) {
3815
- var _a2;
3816
- const entry = path9.join(__dirname, "runtrim.cjs");
3760
+ var _a2, _b;
3761
+ const entry = (_a2 = resolveCliLauncherPath()) != null ? _a2 : path9.resolve(cwd, "dist-cli", "runtrim.cjs");
3817
3762
  if (!fs9.existsSync(entry)) return false;
3818
3763
  try {
3819
3764
  const child = execa3(process.execPath, [entry, "panel", "--monitor"], {
@@ -3822,13 +3767,13 @@ async function tryLaunchPanelMonitorDetached(cwd) {
3822
3767
  stdio: "ignore",
3823
3768
  windowsHide: true
3824
3769
  });
3825
- (_a2 = child.unref) == null ? void 0 : _a2.call(child);
3770
+ (_b = child.unref) == null ? void 0 : _b.call(child);
3826
3771
  return true;
3827
3772
  } catch (e) {
3828
3773
  return false;
3829
3774
  }
3830
3775
  }
3831
- program.name("runtrim").description("CLI guard layer for AI coding runs").version(package_default.version);
3776
+ program.name("runtrim").description("CLI guard layer for AI coding runs").version(resolveCliVersion());
3832
3777
  var commandStartAt = Date.now();
3833
3778
  program.hook("preAction", async () => {
3834
3779
  commandStartAt = Date.now();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runtrim",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "CLI guard layer that scopes AI coding runs before they waste tokens.",
5
5
  "license": "MIT",
6
6
  "author": "RunTrim",
@@ -54,6 +54,7 @@
54
54
  "@radix-ui/react-switch": "^1.2.6",
55
55
  "@radix-ui/react-tabs": "^1.1.13",
56
56
  "@radix-ui/react-tooltip": "^1.2.8",
57
+ "@supabase/ssr": "^0.10.2",
57
58
  "@supabase/supabase-js": "^2.57.4",
58
59
  "chalk": "^5.6.2",
59
60
  "class-variance-authority": "^0.7.1",