@0xdevabir/enhance 0.1.3 → 0.1.4

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/index.js +19 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@
3
3
  // src/cli/index.ts
4
4
  import { Command } from "commander";
5
5
  import { createInterface } from "readline";
6
+ import { createRequire } from "module";
6
7
  import ora from "ora";
7
8
  import chalk3 from "chalk";
8
9
 
@@ -73,10 +74,10 @@ async function readPackageJson(root) {
73
74
  // src/scanner/frameworks.ts
74
75
  import { stat } from "fs/promises";
75
76
  import { join as join2 } from "path";
76
- async function detectStack(pkg, root) {
77
+ async function detectStack(pkg2, root) {
77
78
  const deps = {
78
- ...pkg["dependencies"] ?? {},
79
- ...pkg["devDependencies"] ?? {}
79
+ ...pkg2["dependencies"] ?? {},
80
+ ...pkg2["devDependencies"] ?? {}
80
81
  };
81
82
  const has = (name) => name in deps;
82
83
  const frameworks = [];
@@ -204,11 +205,11 @@ async function readTsConfig(root) {
204
205
 
205
206
  // src/scanner/index.ts
206
207
  async function scanProject(root) {
207
- const [pkg, structure] = await Promise.all([
208
+ const [pkg2, structure] = await Promise.all([
208
209
  readPackageJson(root),
209
210
  scanFolderStructure(root)
210
211
  ]);
211
- const safePkg = pkg ?? {};
212
+ const safePkg = pkg2 ?? {};
212
213
  const [stack] = await Promise.all([
213
214
  detectStack(safePkg, root),
214
215
  readTsConfig(root)
@@ -1372,8 +1373,10 @@ async function fileExists(path) {
1372
1373
  }
1373
1374
 
1374
1375
  // src/cli/index.ts
1376
+ var require2 = createRequire(import.meta.url);
1377
+ var pkg = require2("../package.json");
1375
1378
  var program = new Command();
1376
- program.name("enhance").description("AI prompt middleware \u2014 upgrades vague prompts into production-quality AI instructions").version("0.1.0");
1379
+ program.name("enhance").description("AI prompt middleware \u2014 upgrades vague prompts into production-quality AI instructions").version(pkg.version);
1377
1380
  program.command("setup").description("Install the /enhance slash command for Claude Code, OpenCode, and Codex CLI").option("--force", "Overwrite existing installations").option("--all", "Install for all supported tools even if not detected in PATH").action(async (opts) => {
1378
1381
  await runSetup(opts);
1379
1382
  });
@@ -1530,7 +1533,9 @@ function printColoredPreview(prompt) {
1530
1533
  "Project Context": chalk3.blue,
1531
1534
  "Task": chalk3.yellow,
1532
1535
  "Requirements": chalk3.green,
1533
- "Recent Changes": chalk3.cyan,
1536
+ "Assumptions": chalk3.cyan,
1537
+ "Watch out for": chalk3.red,
1538
+ "Recent Changes": chalk3.dim,
1534
1539
  "Relevant Code": chalk3.dim,
1535
1540
  "Code": chalk3.dim,
1536
1541
  "Expected Output": chalk3.white
@@ -1542,10 +1547,16 @@ function printColoredPreview(prompt) {
1542
1547
  console.log(chalk3.dim(`Total: ~${totalTokens} tokens
1543
1548
  `));
1544
1549
  for (const section of sections) {
1550
+ const sectionTokens = Math.ceil(section.length / CHARS_PER_TOKEN2);
1551
+ const versionMatch = section.trim().match(/^(📍.+)/);
1552
+ if (versionMatch && !section.match(/^## /m)) {
1553
+ console.log(chalk3.bold.cyan(versionMatch[1]) + chalk3.dim(` (~${sectionTokens} tok)`));
1554
+ console.log();
1555
+ continue;
1556
+ }
1545
1557
  const headerMatch = section.match(/^## (.+)/m);
1546
1558
  const headerName = headerMatch?.[1]?.trim() ?? "Section";
1547
1559
  const colorFn = SECTION_COLORS[headerName] ?? chalk3.white;
1548
- const sectionTokens = Math.ceil(section.length / CHARS_PER_TOKEN2);
1549
1560
  console.log(colorFn(chalk3.bold(`## ${headerName}`)) + chalk3.dim(` (~${sectionTokens} tok)`));
1550
1561
  const body = section.replace(/^## .+\n?/, "").trim();
1551
1562
  if (body) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xdevabir/enhance",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "AI prompt middleware — intelligently rewrites developer prompts before sending to coding agents",
5
5
  "bin": {
6
6
  "enhance": "./bin/enhance.js"