kigumi 0.12.0 → 0.13.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/README.md CHANGED
@@ -115,20 +115,61 @@ The doctor command checks for:
115
115
 
116
116
  Useful after upgrading Kigumi CLI, switching tiers (Free↔Pro), or encountering import errors.
117
117
 
118
- ### Upgrading
118
+ ### `status`
119
119
 
120
- When a new version of Kigumi CLI is released, run:
120
+ Show your project's current configuration at a glance:
121
121
 
122
122
  ```bash
123
- # 1. Check for issues — auto-fixes config and shows upgrade instructions
124
- npx kigumi doctor
123
+ npx kigumi status
124
+ ```
125
+
126
+ ### `upgrade`
127
+
128
+ When a new version of Kigumi CLI is released, see what changed and update your project:
129
+
130
+ ```bash
131
+ npx kigumi upgrade # Show upgrade guide and update version
132
+ npx kigumi upgrade --dry-run # Preview changes without modifying config
133
+ ```
134
+
135
+ The upgrade command shows:
136
+
137
+ - **Version comparison** — your pinned version vs. the CLI version
138
+ - **Web Awesome version changes** — whether the underlying WA dependency changed
139
+ - **Breaking changes** — what changed and how to migrate
140
+ - **Recommended actions** — step-by-step instructions
141
+
142
+ ### `diff`
143
+
144
+ Compare your installed components against the current templates to see what's changed:
125
145
 
126
- # 2. Follow the doctor's output to update Web Awesome if needed
146
+ ```bash
147
+ npx kigumi diff # Diff all installed components
148
+ npx kigumi diff button card # Diff specific components
149
+ ```
150
+
151
+ Useful before running `--overwrite` to understand which files have local modifications.
152
+
153
+ ### Version Pinning
154
+
155
+ Kigumi tracks which CLI version generated your project in `kigumi.config.json`. This ensures you stay on a compatible version and don't accidentally upgrade Web Awesome.
127
156
 
128
- # 3. Regenerate all components from updated templates
129
- npx kigumi add --all --overwrite
157
+ ```bash
158
+ # Pin your project to the current CLI version
159
+ npx kigumi upgrade
160
+
161
+ # Use a specific CLI version (matches your project)
162
+ npx kigumi@0.12.0 add button
163
+
164
+ # Check your pinned version
165
+ npx kigumi status
130
166
  ```
131
167
 
168
+ When the CLI version doesn't match your project:
169
+
170
+ - **Minor mismatch** (e.g., 0.11 → 0.12): warning, continues normally
171
+ - **Major mismatch** (e.g., 0.x → 1.x): hard error with instructions to upgrade or use the matching version
172
+
132
173
  ### `registry`
133
174
 
134
175
  Manage community component and theme registries:
@@ -4,7 +4,7 @@ import {
4
4
  WEB_AWESOME_FREE_PACKAGE,
5
5
  detectTierSync,
6
6
  getWebAwesomePackage
7
- } from "./chunk-3ENVKW5V.js";
7
+ } from "./chunk-VFMTPOZY.js";
8
8
 
9
9
  // src/output/console.ts
10
10
  import * as p from "@clack/prompts";
@@ -366,6 +366,7 @@ var KigumiError = class extends Error {
366
366
  if (code >= 400 && code < 500) return 4;
367
367
  if (code >= 500 && code < 600) return 5;
368
368
  if (code >= 600 && code < 700) return 6;
369
+ if (code >= 700 && code < 800) return 7;
369
370
  return 1;
370
371
  }
371
372
  /**
@@ -816,6 +817,29 @@ var DependencyInstallError = class extends KigumiError {
816
817
  }
817
818
  };
818
819
 
820
+ // src/errors/version.ts
821
+ var VersionMismatchError = class extends KigumiError {
822
+ constructor(configVersion, cliVersion) {
823
+ super(
824
+ 700 /* VERSION_MISMATCH */,
825
+ `CLI version ${cliVersion} does not match project version ${configVersion}`,
826
+ { configVersion, cliVersion },
827
+ [
828
+ {
829
+ title: "Use the matching CLI version",
830
+ steps: [`npx kigumi@${configVersion} add <component>`]
831
+ },
832
+ {
833
+ title: "Or upgrade your project to the current CLI version",
834
+ steps: [`npx kigumi@${cliVersion} upgrade`]
835
+ }
836
+ ]
837
+ );
838
+ this.configVersion = configVersion;
839
+ this.cliVersion = cliVersion;
840
+ }
841
+ };
842
+
819
843
  // src/errors/index.ts
820
844
  function handleError(error, output) {
821
845
  const kigumiError = error instanceof KigumiError ? error : UnknownError.from(error);
@@ -1107,7 +1131,9 @@ var installedComponentSchema = z.object({
1107
1131
  source: z.enum(["builtin", "community"]),
1108
1132
  registryUrl: z.string().optional(),
1109
1133
  registryVersion: z.string().optional(),
1110
- installedAt: z.string().optional()
1134
+ installedAt: z.string().optional(),
1135
+ /** Kigumi CLI version that generated this component */
1136
+ kigumiVersion: z.string().optional()
1111
1137
  });
1112
1138
  var installedThemeSchema = z.object({
1113
1139
  source: z.enum(["builtin", "community"]),
@@ -1130,7 +1156,9 @@ var kigumiConfigSchema = z.object({
1130
1156
  /** Provenance tracking for installed components */
1131
1157
  installedComponents: z.record(z.string(), installedComponentSchema).optional(),
1132
1158
  /** Provenance tracking for installed themes */
1133
- installedThemes: z.record(z.string(), installedThemeSchema).optional()
1159
+ installedThemes: z.record(z.string(), installedThemeSchema).optional(),
1160
+ /** Kigumi CLI version that initialized/last upgraded this project */
1161
+ kigumiVersion: z.string().optional()
1134
1162
  });
1135
1163
  var DEFAULT_CONFIG2 = {
1136
1164
  framework: "react",
@@ -1380,6 +1408,7 @@ export {
1380
1408
  FrameworkMismatchError,
1381
1409
  CircularDependencyError,
1382
1410
  PreFlightCheckError,
1411
+ VersionMismatchError,
1383
1412
  handleError,
1384
1413
  FRAMEWORKS,
1385
1414
  frameworkSchema,
@@ -3,6 +3,9 @@ import fs2 from "fs-extra";
3
3
  import path2 from "path";
4
4
 
5
5
  // src/constants.ts
6
+ import { readFileSync } from "fs";
7
+ import { dirname, join } from "path";
8
+ import { fileURLToPath } from "url";
6
9
  var WEB_AWESOME_FREE_PACKAGE = "@awesome.me/webawesome";
7
10
  var WEB_AWESOME_PRO_PACKAGE = "@awesome.me/webawesome-pro";
8
11
  var WEB_AWESOME_SCOPE = "@awesome.me";
@@ -20,6 +23,12 @@ var GITHUB_RAW_BASE_URL = "https://raw.githubusercontent.com";
20
23
  var KIGUMI_CACHE_DIR = ".kigumi/cache";
21
24
  var REGISTRY_CACHE_TTL_MS = 36e5;
22
25
  var REGISTRY_FILE_NAME = "registry.json";
26
+ var __constants_filename = fileURLToPath(import.meta.url);
27
+ var __constants_dirname = dirname(__constants_filename);
28
+ var __cliPackageJson = JSON.parse(
29
+ readFileSync(join(__constants_dirname, "..", "package.json"), "utf-8")
30
+ );
31
+ var CLI_VERSION = __cliPackageJson.version;
23
32
 
24
33
  // src/utils/token.ts
25
34
  import fs from "fs-extra";
@@ -218,6 +227,7 @@ export {
218
227
  KIGUMI_CACHE_DIR,
219
228
  REGISTRY_CACHE_TTL_MS,
220
229
  REGISTRY_FILE_NAME,
230
+ CLI_VERSION,
221
231
  detectProTokenSync,
222
232
  getTokenSourceSync,
223
233
  describeTokenSource,