@happlyui/cli 0.1.2 → 0.1.3
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 +79 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -188907,6 +188907,68 @@ function getInstallCommand(packageManager, packages, dev) {
|
|
|
188907
188907
|
}
|
|
188908
188908
|
}
|
|
188909
188909
|
|
|
188910
|
+
// src/utils/env.ts
|
|
188911
|
+
function isNonInteractive() {
|
|
188912
|
+
if (isAIAgent()) {
|
|
188913
|
+
return true;
|
|
188914
|
+
}
|
|
188915
|
+
if (isCI()) {
|
|
188916
|
+
return true;
|
|
188917
|
+
}
|
|
188918
|
+
if (!process.stdin.isTTY) {
|
|
188919
|
+
return true;
|
|
188920
|
+
}
|
|
188921
|
+
return false;
|
|
188922
|
+
}
|
|
188923
|
+
function isAIAgent() {
|
|
188924
|
+
const env2 = process.env;
|
|
188925
|
+
if (env2.CLAUDECODE === "1" || env2.CLAUDE_CODE_ENTRYPOINT) {
|
|
188926
|
+
return true;
|
|
188927
|
+
}
|
|
188928
|
+
if (env2.CURSOR_TRACE_ID || env2.CURSOR_EDITOR) {
|
|
188929
|
+
return true;
|
|
188930
|
+
}
|
|
188931
|
+
if (env2.GITHUB_COPILOT_CLI) {
|
|
188932
|
+
return true;
|
|
188933
|
+
}
|
|
188934
|
+
if (env2.AIDER_MODEL || env2.AIDER) {
|
|
188935
|
+
return true;
|
|
188936
|
+
}
|
|
188937
|
+
if (env2.CODEIUM_API_KEY || env2.WINDSURF_EDITOR) {
|
|
188938
|
+
return true;
|
|
188939
|
+
}
|
|
188940
|
+
if (env2.AWS_TOOLKIT_TELEMETRY_OPTOUT !== undefined && env2.VSCODE_PID) {
|
|
188941
|
+
return true;
|
|
188942
|
+
}
|
|
188943
|
+
if (env2.AI_AGENT || env2.AI_ASSISTANT || env2.CODING_AGENT) {
|
|
188944
|
+
return true;
|
|
188945
|
+
}
|
|
188946
|
+
return false;
|
|
188947
|
+
}
|
|
188948
|
+
function isCI() {
|
|
188949
|
+
const env2 = process.env;
|
|
188950
|
+
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);
|
|
188951
|
+
}
|
|
188952
|
+
function getAgentName() {
|
|
188953
|
+
const env2 = process.env;
|
|
188954
|
+
if (env2.CLAUDECODE === "1" || env2.CLAUDE_CODE_ENTRYPOINT) {
|
|
188955
|
+
return "Claude Code";
|
|
188956
|
+
}
|
|
188957
|
+
if (env2.CURSOR_TRACE_ID || env2.CURSOR_EDITOR) {
|
|
188958
|
+
return "Cursor";
|
|
188959
|
+
}
|
|
188960
|
+
if (env2.GITHUB_COPILOT_CLI) {
|
|
188961
|
+
return "GitHub Copilot";
|
|
188962
|
+
}
|
|
188963
|
+
if (env2.AIDER_MODEL || env2.AIDER) {
|
|
188964
|
+
return "Aider";
|
|
188965
|
+
}
|
|
188966
|
+
if (env2.CODEIUM_API_KEY || env2.WINDSURF_EDITOR) {
|
|
188967
|
+
return "Windsurf/Codeium";
|
|
188968
|
+
}
|
|
188969
|
+
return null;
|
|
188970
|
+
}
|
|
188971
|
+
|
|
188910
188972
|
// src/commands/init.ts
|
|
188911
188973
|
init_types();
|
|
188912
188974
|
var UTILS_TEMPLATE = `import { type ClassValue, clsx } from "clsx";
|
|
@@ -188985,10 +189047,18 @@ var CSS_TEMPLATE = `@tailwind base;
|
|
|
188985
189047
|
`;
|
|
188986
189048
|
async function init(options) {
|
|
188987
189049
|
const cwd = options.cwd || process.cwd();
|
|
189050
|
+
const nonInteractive = isNonInteractive();
|
|
189051
|
+
const agentName = getAgentName();
|
|
189052
|
+
const useDefaults = options.defaults || options.yes || nonInteractive;
|
|
188988
189053
|
logger.break();
|
|
188989
189054
|
logger.log(logger.bold("HapplyUI") + " - Initialize your project");
|
|
189055
|
+
if (agentName) {
|
|
189056
|
+
logger.info(`Detected: ${logger.highlight(agentName)} (using defaults)`);
|
|
189057
|
+
} else if (nonInteractive && !options.yes) {
|
|
189058
|
+
logger.info("Non-interactive mode detected (using defaults)");
|
|
189059
|
+
}
|
|
188990
189060
|
logger.break();
|
|
188991
|
-
if (isInitialized(cwd) && !
|
|
189061
|
+
if (isInitialized(cwd) && !useDefaults) {
|
|
188992
189062
|
const { overwrite } = await import_prompts.default({
|
|
188993
189063
|
type: "confirm",
|
|
188994
189064
|
name: "overwrite",
|
|
@@ -189011,8 +189081,14 @@ async function init(options) {
|
|
|
189011
189081
|
}
|
|
189012
189082
|
logger.break();
|
|
189013
189083
|
let config;
|
|
189014
|
-
if (
|
|
189084
|
+
if (useDefaults) {
|
|
189015
189085
|
config = createDefaultConfig(projectInfo);
|
|
189086
|
+
if (options.baseColor && BASE_COLORS.includes(options.baseColor)) {
|
|
189087
|
+
config.tailwind.baseColor = options.baseColor;
|
|
189088
|
+
}
|
|
189089
|
+
if (options.cssVariables === false) {
|
|
189090
|
+
config.tailwind.cssVariables = false;
|
|
189091
|
+
}
|
|
189016
189092
|
} else {
|
|
189017
189093
|
const responses = await import_prompts.default([
|
|
189018
189094
|
{
|
|
@@ -189344,7 +189420,7 @@ function pascalCase(str) {
|
|
|
189344
189420
|
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
189345
189421
|
var program2 = new Command;
|
|
189346
189422
|
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);
|
|
189423
|
+
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
189424
|
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
189425
|
program2.command("list").description("List all available components").option("-c, --cwd <path>", "Working directory", process.cwd()).action(async (options) => {
|
|
189350
189426
|
const { getAvailableComponents: getAvailableComponents2 } = await Promise.resolve().then(() => (init_registry(), exports_registry));
|