inventive-ui 0.0.6 → 0.0.8

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.6" : "1.0.0";
193
+ return true ? "0.0.8" : "1.0.0";
194
194
  } catch {
195
195
  return "1.0.0";
196
196
  }
@@ -1963,7 +1963,6 @@ var BUILD_BLOCK = ` /**
1963
1963
  */
1964
1964
  build: {
1965
1965
  safelist: [],
1966
- packageSafelist: false,
1967
1966
  includeShadeMatrix: false,
1968
1967
  includeThemePresets: true,
1969
1968
  includeThemeGrayScale: true,
@@ -1976,7 +1975,6 @@ var BUILD_BLOCK = ` /**
1976
1975
  `;
1977
1976
  var BUILD_DEFAULT_ENTRIES = [
1978
1977
  ["safelist", "[]"],
1979
- ["packageSafelist", "false"],
1980
1978
  ["includeShadeMatrix", "false"],
1981
1979
  ["includeThemePresets", "true"],
1982
1980
  ["includeThemeGrayScale", "true"],
@@ -2772,6 +2770,8 @@ var IUI_CACHE_GITIGNORE_LINES = [
2772
2770
  "",
2773
2771
  "# IUI disposable cache (.iui/generated/ stays committed)",
2774
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}`,
2775
2775
  `${IUI_DIR}/slot-registration-state.json`,
2776
2776
  `${IUI_DIR}/slot-registration.lock`,
2777
2777
  `${IUI_DIR}/classes.cache.json`,
@@ -3414,16 +3414,56 @@ function ensureComponentConfig(manifest, cwd = process.cwd(), options = {}) {
3414
3414
  function isInsideProject(cwd = process.cwd()) {
3415
3415
  return findIuiProjectRoot(cwd) !== null;
3416
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
+ }
3417
3447
  function detectRepoUrl(cwd = process.cwd()) {
3418
3448
  try {
3419
- const gitConfigPath = path10.join(cwd, ".git", "config");
3420
- if (!fs8.existsSync(gitConfigPath)) return cwd;
3421
- const gitConfig = fs8.readFileSync(gitConfigPath, "utf-8");
3422
- const match = gitConfig.match(/url\s*=\s*(.+)/);
3423
- 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
+ }
3424
3464
  } catch {
3425
- return cwd;
3426
3465
  }
3466
+ return readPackageRepositoryUrl(cwd) ?? "unknown";
3427
3467
  }
3428
3468
  function hasPackageJson(cwd = process.cwd()) {
3429
3469
  return fs8.existsSync(path10.join(cwd, "package.json"));
@@ -6262,7 +6302,6 @@ function readWorkspaceManifest(iuiRoot2) {
6262
6302
  function writeWorkspaceManifest(iuiRoot2, packageDirs) {
6263
6303
  const unique = [...new Set(packageDirs.map((dir) => path21.resolve(dir)))];
6264
6304
  atomicWriteJson(workspaceManifestPath(iuiRoot2), {
6265
- iuiRoot: iuiRoot2,
6266
6305
  packages: unique.map((dir) => path21.relative(iuiRoot2, dir) || "."),
6267
6306
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
6268
6307
  });
@@ -7820,8 +7859,13 @@ function checkCompileFirstReadiness(cwd = process.cwd(), _options = {}) {
7820
7859
  "Framework applies default scanDirs/scanPackages \u2014 merge other build flags from docs/01-compile-first-guide.md or run a fresh iui init"
7821
7860
  );
7822
7861
  } else {
7823
- if (!/packageSafelist\s*:\s*false/.test(configContent)) {
7824
- 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
+ );
7825
7869
  }
7826
7870
  if (!/includeShadeMatrix\s*:\s*false/.test(configContent)) {
7827
7871
  warnings.push("iui.config.ts build.includeShadeMatrix should be false unless you need the full compose() matrix");
@@ -7956,7 +8000,7 @@ function checkCompileFirstReadiness(cwd = process.cwd(), _options = {}) {
7956
8000
  `Do not import .generated style-map files into the browser (${path24.relative(cwd, file)})`
7957
8001
  );
7958
8002
  hints.push(
7959
- "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"
7960
8004
  );
7961
8005
  break;
7962
8006
  }
@@ -7983,6 +8027,58 @@ function checkCompileFirstReadiness(cwd = process.cwd(), _options = {}) {
7983
8027
  }
7984
8028
  return { warnings, hints };
7985
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
+ }
7986
8082
  function checkAssetBoundBindings(cwd = process.cwd()) {
7987
8083
  const assetsPath = path24.join(cwd, ASSETS_CONFIG_FILE);
7988
8084
  if (!fs19.existsSync(assetsPath)) {
@@ -8096,6 +8192,7 @@ function runConfigTierDiagnostics(targetCwd, opts, counters, options = {}) {
8096
8192
  }
8097
8193
  if (opts?.fix === true && includePackageJson) {
8098
8194
  ensureProjectConfig(targetCwd);
8195
+ ensureGitignoreHasIuiBuildCache(targetCwd);
8099
8196
  if (projectHasViteTooling(targetCwd)) {
8100
8197
  ensureInventiveUiViteConfig(targetCwd);
8101
8198
  }
@@ -8157,6 +8254,17 @@ function runConfigTierDiagnostics(targetCwd, opts, counters, options = {}) {
8157
8254
  }
8158
8255
  }
8159
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
+ }
8160
8268
  const compileFirst = checkCompileFirstReadiness(targetCwd, {
8161
8269
  strict: process.env.IUI_DOCTOR_STRICT === "1"
8162
8270
  });
@@ -8628,7 +8736,7 @@ async function updateCommand(opts = {}) {
8628
8736
  const auth = await ensureAuthSession();
8629
8737
  await ensureLicenseSession();
8630
8738
  const inProject = isInsideProject();
8631
- const currentCliVersion = true ? "0.0.6" : "unknown";
8739
+ const currentCliVersion = true ? "0.0.8" : "unknown";
8632
8740
  const latestCliVersion = await fetchLatestCliVersion(auth.token);
8633
8741
  const cliUpdateAvailable = latestCliVersion !== null && isVersionGreater(latestCliVersion, currentCliVersion);
8634
8742
  if (latestCliVersion && cliUpdateAvailable) {
@@ -8910,7 +9018,7 @@ var AUTH_EXEMPT_COMMANDS = /* @__PURE__ */ new Set([
8910
9018
  "doctor",
8911
9019
  "list"
8912
9020
  ]);
8913
- program.name("iui").description("The official CLI for the Inventive UI Design System").version(true ? "0.0.6" : "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.8" : "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");
8914
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));
8915
9023
  program.command("logout").description("Remove stored credentials").action(logoutCommand);
8916
9024
  program.command("whoami").description("Show authenticated identity and license details").action(whoamiCommand);