Procházet zdrojové kódy

fmode-image v2.0: 纯ESM零依赖,6种模式,自动读Key,bin CJs兼容

FmodeAgent před 13 hodinami
rodič
revize
a1b63ac466
4 změnil soubory, kde provedl 29 přidání a 37 odebrání
  1. 17 0
      bin/fmode-image.js
  2. 0 32
      bin/fmode-image.mjs
  3. binární
      fmode-image-2.0.0.tgz
  4. 12 5
      package.json

+ 17 - 0
bin/fmode-image.js

@@ -0,0 +1,17 @@
+#!/usr/bin/env node
+const { spawnSync } = require('child_process');
+const path = require('path');
+const lib = path.resolve(__dirname, '..', 'lib', 'fmode-image.mjs');
+const args = process.argv.slice(2);
+if (!args.length || args[0] === '--help' || args[0] === '-h') {
+  console.log('fmode-image v2.0 - AI Architecture & Scene Image Generator');
+  console.log('');
+  console.log('Usage:');
+  console.log('  npx fmode-image --arch    "prompt"  Architecture Diagram  ¥0.5');
+  console.log('  npx fmode-image --app     "prompt"  App Interface         ¥0.5');
+  console.log('  npx fmode-image --scene   "prompt"  Scene Illustration    ¥0.3');
+  console.log('  npx fmode-image --slide   "prompt"  Full Slide            ¥0.5');
+  process.exit(0);
+}
+const r = spawnSync(process.execPath, [lib, ...args], { stdio: 'inherit' });
+process.exit(r.status ?? 0);

+ 0 - 32
bin/fmode-image.mjs

@@ -1,32 +0,0 @@
-#!/usr/bin/env node
-import { fileURLToPath } from 'node:url';
-import { dirname, join } from 'node:path';
-import { spawn } from 'node:child_process';
-
-const __dirname = dirname(fileURLToPath(import.meta.url));
-const libPath = join(__dirname, '..', 'lib', 'fmode-image.mjs');
-
-const args = process.argv.slice(2);
-if (!args.length || args[0] === '--help' || args[0] === '-h') {
-  const { MODES } = await import(libPath);
-  console.log(`
-fmode-image v2.0 — AI架构图和场景插图生成器
-
-用法:
-  npx fmode-image --arch    "prompt" [name]    架构图 ¥0.5
-  npx fmode-image --app     "prompt" [name]    应用界面 ¥0.5
-  npx fmode-image --scene   "prompt" [name]    场景插图 ¥0.3
-  npx fmode-image --slide   "prompt" [name]    整页PPT ¥0.5
-  npx fmode-image --explode "prompt" [name]    爆炸图 ¥0.5
-  npx fmode-image --detail  "prompt" [name]    细节图 ¥0.3
-
-可用模式:`);
-  for (const [m, c] of Object.entries(MODES)) {
-    console.log(`  ${m.padEnd(12)} ${c.size.padEnd(14)} ¥${c.cost.toFixed(1)}  ${c.desc}`);
-  }
-  console.log(`\n环境变量: FMODE_API_KEY(必设), SKILL_IMAGE_OUTPUT(默认当前目录)`);
-  process.exit(0);
-}
-
-const child = spawn(process.execPath, [libPath, ...args], { stdio: 'inherit', shell: false });
-child.on('exit', (code) => process.exit(code ?? 0));

binární
fmode-image-2.0.0.tgz


+ 12 - 5
package.json

@@ -1,8 +1,7 @@
 {
   "name": "fmode-image",
   "version": "2.0.0",
-  "description": "AI架构图和场景插图生成器。6种模式(--app/--arch/--scene/--slide),自动读API Key,零依赖纯ESM。",
-  "type": "module",
+  "description": "AI\u67b6\u6784\u56fe\u548c\u573a\u666f\u63d2\u56fe\u751f\u6210\u5668\u30026\u79cd\u6a21\u5f0f(--app/--arch/--scene/--slide)\uff0c\u81ea\u52a8\u8bfbAPI Key\uff0c\u96f6\u4f9d\u8d56\u7eafESM\u3002",
   "main": "./lib/fmode-image.mjs",
   "exports": {
     ".": {
@@ -11,7 +10,7 @@
     }
   },
   "bin": {
-    "fmode-image": "./bin/fmode-image.mjs"
+    "fmode-image": "./bin/fmode-image.js"
   },
   "files": [
     "lib/",
@@ -22,7 +21,15 @@
     "LICENSE",
     "skill-package-manifest.json"
   ],
-  "keywords": ["fmode", "image", "ai", "architecture", "diagram", "scene", "presentation"],
+  "keywords": [
+    "fmode",
+    "image",
+    "ai",
+    "architecture",
+    "diagram",
+    "scene",
+    "presentation"
+  ],
   "license": "MIT",
   "repository": {
     "type": "git",
@@ -35,4 +42,4 @@
   "engines": {
     "node": ">=18"
   }
-}
+}