flower-trellis 0.3.1-beta.0 → 0.3.1-beta.1

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/package.json +1 -1
  2. package/src/cli.js +35 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flower-trellis",
3
- "version": "0.3.1-beta.0",
3
+ "version": "0.3.1-beta.1",
4
4
  "description": "一键安装/升级 Trellis 并自动融合 skill-garden 强化包(默认 Claude + agents)",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
+ import chalk from "chalk";
3
4
  import { flowerVersion, trellisVersion } from "./lib/versions.js";
4
5
  import { selectVariant } from "./lib/variant.js";
5
6
  import { readManifest } from "./lib/manifest.js";
@@ -13,22 +14,50 @@ import { runTrellis } from "./lib/trellis-runner.js";
13
14
  * - 其它子命令 → 兜底透传给 trellis(覆盖现有及未来命令)。
14
15
  */
15
16
 
16
- /** 打印版本:flower-trellis 自身 + 捆绑的 Trellis;若在 Trellis 项目内附带项目版本。 */
17
+ /**
18
+ * 格式化版本行。
19
+ * @param {string} label 版本标签
20
+ * @param {string} version 版本号
21
+ * @param {{indent?: boolean, muted?: boolean}} options 显示选项
22
+ * @returns {string}
23
+ */
24
+ function versionLine(label, version, options = {}) {
25
+ const prefix = options.indent ? " " : "";
26
+ const labelWidth = options.indent ? 14 : 16;
27
+ const paddedLabel = label.padEnd(labelWidth);
28
+ const styledLabel = options.muted ? chalk.gray(paddedLabel) : chalk.hex("#ff6fb5").bold(paddedLabel);
29
+ return `${prefix}${styledLabel}${version}`;
30
+ }
31
+
32
+ /** 打印版本:flower-trellis 自身 + 项目版本 + 捆绑的 Trellis。 */
17
33
  function printVersion(cwd) {
18
- console.log(`flower-trellis ${flowerVersion()}`);
19
- console.log(`trellis (bundled) ${trellisVersion()}`);
34
+ console.log(versionLine("flower-trellis", flowerVersion()));
35
+
36
+ const projectRows = [];
20
37
  try {
21
38
  if (fs.existsSync(path.join(cwd, ".trellis", ".version"))) {
22
39
  const { version } = selectVariant(cwd);
23
- if (version) console.log(`project .trellis ${version}`);
40
+ if (version) projectRows.push([".trellis", version]);
24
41
  }
25
- // 项目里 flower 上次铺包时戳入的自身版本(来自 .flower-manifest.json);
42
+ // 项目里 flower 上次铺包时戳入的自身版本(来自 .trellis/.flower-manifest.json);
26
43
  // 与首行「当前工具版本」对比即可看出该项目是否需要重新 update。
27
44
  const mf = readManifest(cwd);
28
- if (mf && mf.flowerVersion) console.log(`project flower ${mf.flowerVersion}`);
45
+ if (mf && mf.flowerVersion) projectRows.unshift(["flower", mf.flowerVersion]);
29
46
  } catch {
30
47
  // 忽略:版本读取失败不应影响 -v 输出
31
48
  }
49
+
50
+ if (projectRows.length) {
51
+ console.log("");
52
+ console.log(chalk.gray("project"));
53
+ for (const [label, version] of projectRows) {
54
+ console.log(versionLine(label, version, { indent: true, muted: true }));
55
+ }
56
+ }
57
+
58
+ console.log("");
59
+ console.log(chalk.gray("bundled"));
60
+ console.log(versionLine("trellis", trellisVersion(), { indent: true, muted: true }));
32
61
  }
33
62
 
34
63
  function printHelp() {