inventive-ui 0.0.5 → 0.0.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.
package/dist/index.js CHANGED
@@ -190,7 +190,7 @@ var BANNER_COMPACT = [
190
190
  var FULL_BANNER_WIDTH = 101;
191
191
  function resolveCliVersion() {
192
192
  try {
193
- return true ? "0.0.5" : "1.0.0";
193
+ return true ? "0.0.7" : "1.0.0";
194
194
  } catch {
195
195
  return "1.0.0";
196
196
  }
@@ -1963,9 +1963,9 @@ var BUILD_BLOCK = ` /**
1963
1963
  */
1964
1964
  build: {
1965
1965
  safelist: [],
1966
- packageSafelist: false,
1967
1966
  includeShadeMatrix: false,
1968
1967
  includeThemePresets: true,
1968
+ includeThemeGrayScale: true,
1969
1969
  resolvePalettePatterns: true,
1970
1970
  includeArbitraryScan: true,
1971
1971
  writeFiles: false,
@@ -1975,9 +1975,9 @@ var BUILD_BLOCK = ` /**
1975
1975
  `;
1976
1976
  var BUILD_DEFAULT_ENTRIES = [
1977
1977
  ["safelist", "[]"],
1978
- ["packageSafelist", "false"],
1979
1978
  ["includeShadeMatrix", "false"],
1980
1979
  ["includeThemePresets", "true"],
1980
+ ["includeThemeGrayScale", "true"],
1981
1981
  ["resolvePalettePatterns", "true"],
1982
1982
  ["includeArbitraryScan", "true"],
1983
1983
  ["writeFiles", "false"],
@@ -2770,6 +2770,8 @@ var IUI_CACHE_GITIGNORE_LINES = [
2770
2770
  "",
2771
2771
  "# IUI disposable cache (.iui/generated/ stays committed)",
2772
2772
  `${IUI_DIR}/${IUI_CACHE_SEGMENT}/`,
2773
+ `${IUI_DIR}/${IUI_CACHE_SEGMENT}/${IUI_CACHE_FILES.slotState}`,
2774
+ `${IUI_DIR}/${IUI_CACHE_SEGMENT}/${IUI_CACHE_FILES.slotLock}`,
2773
2775
  `${IUI_DIR}/slot-registration-state.json`,
2774
2776
  `${IUI_DIR}/slot-registration.lock`,
2775
2777
  `${IUI_DIR}/classes.cache.json`,
@@ -3412,16 +3414,56 @@ function ensureComponentConfig(manifest, cwd = process.cwd(), options = {}) {
3412
3414
  function isInsideProject(cwd = process.cwd()) {
3413
3415
  return findIuiProjectRoot(cwd) !== null;
3414
3416
  }
3417
+ function normalizeGitRemoteUrl(url) {
3418
+ let value = url.trim();
3419
+ if (value.startsWith("git@")) {
3420
+ value = value.replace(/^git@([^:]+):/, "https://$1/");
3421
+ }
3422
+ return value.replace(/\.git$/, "");
3423
+ }
3424
+ function readPackageRepositoryUrl(cwd) {
3425
+ let dir = path10.resolve(cwd);
3426
+ const fsRoot = path10.parse(dir).root;
3427
+ while (true) {
3428
+ const pkgPath = path10.join(dir, "package.json");
3429
+ if (fs8.existsSync(pkgPath)) {
3430
+ try {
3431
+ const pkg = fs8.readJsonSync(pkgPath);
3432
+ const repo = pkg.repository;
3433
+ if (typeof repo === "string" && repo.trim()) {
3434
+ return normalizeGitRemoteUrl(repo);
3435
+ }
3436
+ if (repo && typeof repo === "object" && typeof repo.url === "string" && repo.url.trim()) {
3437
+ return normalizeGitRemoteUrl(repo.url);
3438
+ }
3439
+ } catch {
3440
+ }
3441
+ }
3442
+ if (dir === fsRoot) break;
3443
+ dir = path10.dirname(dir);
3444
+ }
3445
+ return null;
3446
+ }
3415
3447
  function detectRepoUrl(cwd = process.cwd()) {
3416
3448
  try {
3417
- const gitConfigPath = path10.join(cwd, ".git", "config");
3418
- if (!fs8.existsSync(gitConfigPath)) return cwd;
3419
- const gitConfig = fs8.readFileSync(gitConfigPath, "utf-8");
3420
- const match = gitConfig.match(/url\s*=\s*(.+)/);
3421
- return match?.[1]?.trim() ?? cwd;
3449
+ let dir = path10.resolve(cwd);
3450
+ const fsRoot = path10.parse(dir).root;
3451
+ while (true) {
3452
+ const gitConfigPath = path10.join(dir, ".git", "config");
3453
+ if (fs8.existsSync(gitConfigPath)) {
3454
+ const gitConfig = fs8.readFileSync(gitConfigPath, "utf-8");
3455
+ const originMatch = gitConfig.match(
3456
+ /\[remote "origin"\][\s\S]*?url\s*=\s*([^\s#]+)/
3457
+ );
3458
+ const remoteUrl = originMatch?.[1] ?? gitConfig.match(/url\s*=\s*([^\s#]+)/)?.[1];
3459
+ if (remoteUrl) return normalizeGitRemoteUrl(remoteUrl);
3460
+ }
3461
+ if (dir === fsRoot) break;
3462
+ dir = path10.dirname(dir);
3463
+ }
3422
3464
  } catch {
3423
- return cwd;
3424
3465
  }
3466
+ return readPackageRepositoryUrl(cwd) ?? "unknown";
3425
3467
  }
3426
3468
  function hasPackageJson(cwd = process.cwd()) {
3427
3469
  return fs8.existsSync(path10.join(cwd, "package.json"));
@@ -6260,7 +6302,6 @@ function readWorkspaceManifest(iuiRoot2) {
6260
6302
  function writeWorkspaceManifest(iuiRoot2, packageDirs) {
6261
6303
  const unique = [...new Set(packageDirs.map((dir) => path21.resolve(dir)))];
6262
6304
  atomicWriteJson(workspaceManifestPath(iuiRoot2), {
6263
- iuiRoot: iuiRoot2,
6264
6305
  packages: unique.map((dir) => path21.relative(iuiRoot2, dir) || "."),
6265
6306
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
6266
6307
  });
@@ -7818,8 +7859,13 @@ function checkCompileFirstReadiness(cwd = process.cwd(), _options = {}) {
7818
7859
  "Framework applies default scanDirs/scanPackages \u2014 merge other build flags from docs/01-compile-first-guide.md or run a fresh iui init"
7819
7860
  );
7820
7861
  } else {
7821
- if (!/packageSafelist\s*:\s*false/.test(configContent)) {
7822
- warnings.push("iui.config.ts build.packageSafelist should be false (scan-first)");
7862
+ if (/packageSafelist\s*:\s*false/.test(configContent)) {
7863
+ warnings.push(
7864
+ "iui.config.ts build.packageSafelist is false \u2014 package compile.safelist contracts from scanPackages will not merge"
7865
+ );
7866
+ hints.push(
7867
+ "Remove packageSafelist: false to use Framework default (true) so @inventive-ui/components compile.safelist is included"
7868
+ );
7823
7869
  }
7824
7870
  if (!/includeShadeMatrix\s*:\s*false/.test(configContent)) {
7825
7871
  warnings.push("iui.config.ts build.includeShadeMatrix should be false unless you need the full compose() matrix");
@@ -7827,6 +7873,11 @@ function checkCompileFirstReadiness(cwd = process.cwd(), _options = {}) {
7827
7873
  if (!/includeThemePresets\s*:\s*true/.test(configContent)) {
7828
7874
  warnings.push("iui.config.ts build.includeThemePresets should be true");
7829
7875
  }
7876
+ if (!/includeThemeGrayScale\s*:\s*true/.test(configContent)) {
7877
+ warnings.push(
7878
+ "iui.config.ts build.includeThemeGrayScale should be true (pre-expand theme gray gray-2\u202698 utilities)"
7879
+ );
7880
+ }
7830
7881
  if (!/resolvePalettePatterns\s*:\s*true/.test(configContent)) {
7831
7882
  warnings.push("iui.config.ts build.resolvePalettePatterns should be true");
7832
7883
  }
@@ -7949,7 +8000,7 @@ function checkCompileFirstReadiness(cwd = process.cwd(), _options = {}) {
7949
8000
  `Do not import .generated style-map files into the browser (${path24.relative(cwd, file)})`
7950
8001
  );
7951
8002
  hints.push(
7952
- "Keep style maps on the scanner path (default src/.iui, or override build.scanDirs) \u2014 see Framework compile-first docs"
8003
+ "Keep style maps on the scanner path (default src + .iui/generated, or override build.scanDirs) \u2014 see Framework compile-first docs"
7953
8004
  );
7954
8005
  break;
7955
8006
  }
@@ -7976,6 +8027,58 @@ function checkCompileFirstReadiness(cwd = process.cwd(), _options = {}) {
7976
8027
  }
7977
8028
  return { warnings, hints };
7978
8029
  }
8030
+ function checkMetadataPortability(cwd = process.cwd()) {
8031
+ const warnings = [];
8032
+ const hints = [];
8033
+ const iuiPath = path24.join(cwd, IUI_DIR);
8034
+ const projectPath = path24.join(iuiPath, "project.json");
8035
+ if (fs19.existsSync(projectPath)) {
8036
+ try {
8037
+ const meta = fs19.readJsonSync(projectPath);
8038
+ const repoUrl = meta.repoUrl ?? "";
8039
+ if (/^[A-Za-z]:[\\/]/.test(repoUrl) || repoUrl.startsWith("/") && !repoUrl.startsWith("//") || repoUrl.startsWith("file:")) {
8040
+ warnings.push("project.json repoUrl is a local filesystem path \u2014 use a git remote URL");
8041
+ hints.push("Edit .iui/project.json or re-init from a git checkout");
8042
+ }
8043
+ } catch {
8044
+ }
8045
+ }
8046
+ const workspacePath = path24.join(iuiPath, "workspace.json");
8047
+ if (fs19.existsSync(workspacePath)) {
8048
+ try {
8049
+ const ws = fs19.readJsonSync(workspacePath);
8050
+ if (ws.iuiRoot) {
8051
+ warnings.push("workspace.json contains deprecated iuiRoot \u2014 remove it (root is implicit)");
8052
+ }
8053
+ for (const pkg of ws.packages ?? []) {
8054
+ if (/^[A-Za-z]:[\\/]/.test(pkg) || path24.isAbsolute(pkg)) {
8055
+ warnings.push(`workspace.json packages entry is absolute: ${pkg}`);
8056
+ hints.push("packages should be relative paths from the IUI root");
8057
+ }
8058
+ }
8059
+ } catch {
8060
+ }
8061
+ }
8062
+ const scanCachePath = iuiCacheFile(cwd, "scan");
8063
+ if (fs19.existsSync(scanCachePath)) {
8064
+ try {
8065
+ const cache = fs19.readJsonSync(scanCachePath);
8066
+ const absoluteKeys = Object.keys(cache.files ?? {}).filter(
8067
+ (key) => /^[A-Za-z]:[\\/]/.test(key) || key.startsWith("/") && !key.startsWith("//")
8068
+ );
8069
+ if (absoluteKeys.length > 0) {
8070
+ warnings.push(
8071
+ `scan.cache.json has ${absoluteKeys.length} machine-specific absolute path key(s)`
8072
+ );
8073
+ hints.push(
8074
+ "Delete .iui/cache/scan.cache.json and restart dev \u2014 Framework 1.0.89+ uses project-relative keys"
8075
+ );
8076
+ }
8077
+ } catch {
8078
+ }
8079
+ }
8080
+ return { warnings, hints };
8081
+ }
7979
8082
  function checkAssetBoundBindings(cwd = process.cwd()) {
7980
8083
  const assetsPath = path24.join(cwd, ASSETS_CONFIG_FILE);
7981
8084
  if (!fs19.existsSync(assetsPath)) {
@@ -8089,6 +8192,7 @@ function runConfigTierDiagnostics(targetCwd, opts, counters, options = {}) {
8089
8192
  }
8090
8193
  if (opts?.fix === true && includePackageJson) {
8091
8194
  ensureProjectConfig(targetCwd);
8195
+ ensureGitignoreHasIuiBuildCache(targetCwd);
8092
8196
  if (projectHasViteTooling(targetCwd)) {
8093
8197
  ensureInventiveUiViteConfig(targetCwd);
8094
8198
  }
@@ -8150,6 +8254,17 @@ function runConfigTierDiagnostics(targetCwd, opts, counters, options = {}) {
8150
8254
  }
8151
8255
  }
8152
8256
  }
8257
+ const metadataPortability = checkMetadataPortability(targetCwd);
8258
+ if (metadataPortability.warnings.length === 0) {
8259
+ pass("IUI metadata and scan cache use portable paths");
8260
+ } else {
8261
+ for (const warning2 of metadataPortability.warnings) {
8262
+ warn(warning2);
8263
+ }
8264
+ for (const hint2 of metadataPortability.hints) {
8265
+ hint(hint2);
8266
+ }
8267
+ }
8153
8268
  const compileFirst = checkCompileFirstReadiness(targetCwd, {
8154
8269
  strict: process.env.IUI_DOCTOR_STRICT === "1"
8155
8270
  });
@@ -8621,7 +8736,7 @@ async function updateCommand(opts = {}) {
8621
8736
  const auth = await ensureAuthSession();
8622
8737
  await ensureLicenseSession();
8623
8738
  const inProject = isInsideProject();
8624
- const currentCliVersion = true ? "0.0.5" : "unknown";
8739
+ const currentCliVersion = true ? "0.0.7" : "unknown";
8625
8740
  const latestCliVersion = await fetchLatestCliVersion(auth.token);
8626
8741
  const cliUpdateAvailable = latestCliVersion !== null && isVersionGreater(latestCliVersion, currentCliVersion);
8627
8742
  if (latestCliVersion && cliUpdateAvailable) {
@@ -8903,7 +9018,7 @@ var AUTH_EXEMPT_COMMANDS = /* @__PURE__ */ new Set([
8903
9018
  "doctor",
8904
9019
  "list"
8905
9020
  ]);
8906
- program.name("iui").description("The official CLI for the Inventive UI Design System").version(true ? "0.0.5" : "1.0.0").option("-C, --cwd <dir>", "Run as if started in the given directory").option("-q, --quiet", "Minimal output (also respects IUI_QUIET=1)").option("--no-color", "Disable ANSI colors");
9021
+ program.name("iui").description("The official CLI for the Inventive UI Design System").version(true ? "0.0.7" : "1.0.0").option("-C, --cwd <dir>", "Run as if started in the given directory").option("-q, --quiet", "Minimal output (also respects IUI_QUIET=1)").option("--no-color", "Disable ANSI colors");
8907
9022
  program.command("login").description("Authenticate with GitHub and link your license").option("-f, --force", "Force re-authentication and register this device").option("--bootstrap", "After login, run optional setup prompts").action((opts) => loginCommand(opts));
8908
9023
  program.command("logout").description("Remove stored credentials").action(logoutCommand);
8909
9024
  program.command("whoami").description("Show authenticated identity and license details").action(whoamiCommand);