@happlyui/cli 0.1.2 → 0.1.4

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/dist/index.js +85 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -187362,6 +187362,9 @@ var {
187362
187362
  Help
187363
187363
  } = import__.default;
187364
187364
 
187365
+ // src/index.ts
187366
+ import { createRequire as createRequire2 } from "module";
187367
+
187365
187368
  // src/commands/init.ts
187366
187369
  var import_prompts = __toESM(require_prompts3(), 1);
187367
187370
 
@@ -188907,6 +188910,68 @@ function getInstallCommand(packageManager, packages, dev) {
188907
188910
  }
188908
188911
  }
188909
188912
 
188913
+ // src/utils/env.ts
188914
+ function isNonInteractive() {
188915
+ if (isAIAgent()) {
188916
+ return true;
188917
+ }
188918
+ if (isCI()) {
188919
+ return true;
188920
+ }
188921
+ if (!process.stdin.isTTY) {
188922
+ return true;
188923
+ }
188924
+ return false;
188925
+ }
188926
+ function isAIAgent() {
188927
+ const env2 = process.env;
188928
+ if (env2.CLAUDECODE === "1" || env2.CLAUDE_CODE_ENTRYPOINT) {
188929
+ return true;
188930
+ }
188931
+ if (env2.CURSOR_TRACE_ID || env2.CURSOR_EDITOR) {
188932
+ return true;
188933
+ }
188934
+ if (env2.GITHUB_COPILOT_CLI) {
188935
+ return true;
188936
+ }
188937
+ if (env2.AIDER_MODEL || env2.AIDER) {
188938
+ return true;
188939
+ }
188940
+ if (env2.CODEIUM_API_KEY || env2.WINDSURF_EDITOR) {
188941
+ return true;
188942
+ }
188943
+ if (env2.AWS_TOOLKIT_TELEMETRY_OPTOUT !== undefined && env2.VSCODE_PID) {
188944
+ return true;
188945
+ }
188946
+ if (env2.AI_AGENT || env2.AI_ASSISTANT || env2.CODING_AGENT) {
188947
+ return true;
188948
+ }
188949
+ return false;
188950
+ }
188951
+ function isCI() {
188952
+ const env2 = process.env;
188953
+ return !!(env2.CI || env2.CONTINUOUS_INTEGRATION || env2.GITHUB_ACTIONS || env2.GITLAB_CI || env2.CIRCLECI || env2.TRAVIS || env2.JENKINS_URL || env2.BUILDKITE || env2.DRONE || env2.CODEBUILD_BUILD_ID || env2.TF_BUILD);
188954
+ }
188955
+ function getAgentName() {
188956
+ const env2 = process.env;
188957
+ if (env2.CLAUDECODE === "1" || env2.CLAUDE_CODE_ENTRYPOINT) {
188958
+ return "Claude Code";
188959
+ }
188960
+ if (env2.CURSOR_TRACE_ID || env2.CURSOR_EDITOR) {
188961
+ return "Cursor";
188962
+ }
188963
+ if (env2.GITHUB_COPILOT_CLI) {
188964
+ return "GitHub Copilot";
188965
+ }
188966
+ if (env2.AIDER_MODEL || env2.AIDER) {
188967
+ return "Aider";
188968
+ }
188969
+ if (env2.CODEIUM_API_KEY || env2.WINDSURF_EDITOR) {
188970
+ return "Windsurf/Codeium";
188971
+ }
188972
+ return null;
188973
+ }
188974
+
188910
188975
  // src/commands/init.ts
188911
188976
  init_types();
188912
188977
  var UTILS_TEMPLATE = `import { type ClassValue, clsx } from "clsx";
@@ -188985,10 +189050,18 @@ var CSS_TEMPLATE = `@tailwind base;
188985
189050
  `;
188986
189051
  async function init(options) {
188987
189052
  const cwd = options.cwd || process.cwd();
189053
+ const nonInteractive = isNonInteractive();
189054
+ const agentName = getAgentName();
189055
+ const useDefaults = options.defaults || options.yes || nonInteractive;
188988
189056
  logger.break();
188989
189057
  logger.log(logger.bold("HapplyUI") + " - Initialize your project");
189058
+ if (agentName) {
189059
+ logger.info(`Detected: ${logger.highlight(agentName)} (using defaults)`);
189060
+ } else if (nonInteractive && !options.yes) {
189061
+ logger.info("Non-interactive mode detected (using defaults)");
189062
+ }
188990
189063
  logger.break();
188991
- if (isInitialized(cwd) && !options.yes) {
189064
+ if (isInitialized(cwd) && !useDefaults) {
188992
189065
  const { overwrite } = await import_prompts.default({
188993
189066
  type: "confirm",
188994
189067
  name: "overwrite",
@@ -189011,8 +189084,14 @@ async function init(options) {
189011
189084
  }
189012
189085
  logger.break();
189013
189086
  let config;
189014
- if (options.defaults || options.yes) {
189087
+ if (useDefaults) {
189015
189088
  config = createDefaultConfig(projectInfo);
189089
+ if (options.baseColor && BASE_COLORS.includes(options.baseColor)) {
189090
+ config.tailwind.baseColor = options.baseColor;
189091
+ }
189092
+ if (options.cssVariables === false) {
189093
+ config.tailwind.cssVariables = false;
189094
+ }
189016
189095
  } else {
189017
189096
  const responses = await import_prompts.default([
189018
189097
  {
@@ -189342,9 +189421,11 @@ function pascalCase(str) {
189342
189421
 
189343
189422
  // src/index.ts
189344
189423
  var import_picocolors2 = __toESM(require_picocolors(), 1);
189424
+ var require2 = createRequire2(import.meta.url);
189425
+ var { version } = require2("../package.json");
189345
189426
  var program2 = new Command;
189346
- program2.name("happlyui").description("Add HapplyUI components to your project").version("0.0.1");
189347
- program2.command("init").description("Initialize your project with HapplyUI").option("-c, --cwd <path>", "Working directory", process.cwd()).option("-y, --yes", "Skip prompts and use defaults").option("--defaults", "Use default configuration").action(init);
189427
+ program2.name("happlyui").description("Add HapplyUI components to your project").version(version);
189428
+ program2.command("init").description("Initialize your project with HapplyUI").option("-c, --cwd <path>", "Working directory", process.cwd()).option("-y, --yes", "Skip prompts and use defaults").option("--defaults", "Use default configuration").option("--base-color <color>", "Base color theme (slate, gray, zinc, neutral, stone)").option("--no-css-variables", "Disable CSS variables for colors").action(init);
189348
189429
  program2.command("add").description("Add components to your project").argument("[components...]", "Components to add").option("-c, --cwd <path>", "Working directory", process.cwd()).option("-y, --yes", "Skip prompts").option("-o, --overwrite", "Overwrite existing files").option("-a, --all", "Add all available components").option("-p, --path <path>", "Custom path for components").action(add);
189349
189430
  program2.command("list").description("List all available components").option("-c, --cwd <path>", "Working directory", process.cwd()).action(async (options) => {
189350
189431
  const { getAvailableComponents: getAvailableComponents2 } = await Promise.resolve().then(() => (init_registry(), exports_registry));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happlyui/cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Add HapplyUI components to your project",
5
5
  "type": "module",
6
6
  "bin": {