@qazuor/claude-code-config 0.3.0 → 0.3.1
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 +4 -1
- package/dist/bin.cjs +139 -51
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +139 -51
- package/dist/bin.js.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +9 -2
package/dist/bin.js
CHANGED
|
@@ -9,11 +9,11 @@ var __export = (target, all) => {
|
|
|
9
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
// node_modules/.pnpm/tsup@8.5.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js
|
|
12
|
+
// node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js
|
|
13
13
|
import path from "path";
|
|
14
14
|
import { fileURLToPath } from "url";
|
|
15
15
|
var init_esm_shims = __esm({
|
|
16
|
-
"node_modules/.pnpm/tsup@8.5.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js"() {
|
|
16
|
+
"node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js"() {
|
|
17
17
|
"use strict";
|
|
18
18
|
}
|
|
19
19
|
});
|
|
@@ -203,6 +203,7 @@ var init_fs = __esm({
|
|
|
203
203
|
|
|
204
204
|
// src/bin.ts
|
|
205
205
|
init_esm_shims();
|
|
206
|
+
import { createRequire } from "module";
|
|
206
207
|
|
|
207
208
|
// src/cli/index.ts
|
|
208
209
|
init_esm_shims();
|
|
@@ -4800,9 +4801,9 @@ async function readPackageJson(projectPath) {
|
|
|
4800
4801
|
return null;
|
|
4801
4802
|
}
|
|
4802
4803
|
}
|
|
4803
|
-
async function writePackageJson(projectPath,
|
|
4804
|
+
async function writePackageJson(projectPath, packageJson2) {
|
|
4804
4805
|
const packageJsonPath = joinPath(projectPath, "package.json");
|
|
4805
|
-
const content = `${JSON.stringify(
|
|
4806
|
+
const content = `${JSON.stringify(packageJson2, null, 2)}
|
|
4806
4807
|
`;
|
|
4807
4808
|
await writeFile(packageJsonPath, content);
|
|
4808
4809
|
}
|
|
@@ -4882,13 +4883,13 @@ async function updatePackageJson(projectPath, changes, options = {}) {
|
|
|
4882
4883
|
skippedDevDependencies: []
|
|
4883
4884
|
};
|
|
4884
4885
|
try {
|
|
4885
|
-
let
|
|
4886
|
-
if (!
|
|
4886
|
+
let packageJson2 = await readPackageJson(projectPath);
|
|
4887
|
+
if (!packageJson2) {
|
|
4887
4888
|
if (!createIfMissing) {
|
|
4888
4889
|
result.error = "package.json not found and createIfMissing is false";
|
|
4889
4890
|
return result;
|
|
4890
4891
|
}
|
|
4891
|
-
|
|
4892
|
+
packageJson2 = createMinimalPackageJson({
|
|
4892
4893
|
name: changes.metadata?.name,
|
|
4893
4894
|
description: changes.metadata?.description,
|
|
4894
4895
|
author: typeof changes.metadata?.author === "string" ? changes.metadata.author : void 0,
|
|
@@ -4898,46 +4899,46 @@ async function updatePackageJson(projectPath, changes, options = {}) {
|
|
|
4898
4899
|
}
|
|
4899
4900
|
if (backup2 && !dryRun && !result.created) {
|
|
4900
4901
|
const backupPath = joinPath(projectPath, "package.json.backup");
|
|
4901
|
-
await writeFile(backupPath, JSON.stringify(
|
|
4902
|
+
await writeFile(backupPath, JSON.stringify(packageJson2, null, 2));
|
|
4902
4903
|
}
|
|
4903
4904
|
if (changes.metadata) {
|
|
4904
|
-
if (changes.metadata.name && !
|
|
4905
|
-
|
|
4905
|
+
if (changes.metadata.name && !packageJson2.name) {
|
|
4906
|
+
packageJson2.name = changes.metadata.name;
|
|
4906
4907
|
result.modified = true;
|
|
4907
4908
|
}
|
|
4908
|
-
if (changes.metadata.description && !
|
|
4909
|
-
|
|
4909
|
+
if (changes.metadata.description && !packageJson2.description) {
|
|
4910
|
+
packageJson2.description = changes.metadata.description;
|
|
4910
4911
|
result.modified = true;
|
|
4911
4912
|
}
|
|
4912
|
-
if (changes.metadata.author && !
|
|
4913
|
-
|
|
4913
|
+
if (changes.metadata.author && !packageJson2.author) {
|
|
4914
|
+
packageJson2.author = changes.metadata.author;
|
|
4914
4915
|
result.modified = true;
|
|
4915
4916
|
}
|
|
4916
|
-
if (changes.metadata.license && !
|
|
4917
|
-
|
|
4917
|
+
if (changes.metadata.license && !packageJson2.license) {
|
|
4918
|
+
packageJson2.license = changes.metadata.license;
|
|
4918
4919
|
result.modified = true;
|
|
4919
4920
|
}
|
|
4920
|
-
if (changes.metadata.repository && !
|
|
4921
|
-
|
|
4921
|
+
if (changes.metadata.repository && !packageJson2.repository) {
|
|
4922
|
+
packageJson2.repository = changes.metadata.repository;
|
|
4922
4923
|
result.modified = true;
|
|
4923
4924
|
}
|
|
4924
|
-
if (changes.metadata.type && !
|
|
4925
|
-
|
|
4925
|
+
if (changes.metadata.type && !packageJson2.type) {
|
|
4926
|
+
packageJson2.type = changes.metadata.type;
|
|
4926
4927
|
result.modified = true;
|
|
4927
4928
|
}
|
|
4928
|
-
if (changes.metadata.engines && !
|
|
4929
|
-
|
|
4929
|
+
if (changes.metadata.engines && !packageJson2.engines) {
|
|
4930
|
+
packageJson2.engines = changes.metadata.engines;
|
|
4930
4931
|
result.modified = true;
|
|
4931
4932
|
}
|
|
4932
|
-
if (changes.metadata.packageManager && !
|
|
4933
|
-
|
|
4933
|
+
if (changes.metadata.packageManager && !packageJson2.packageManager) {
|
|
4934
|
+
packageJson2.packageManager = changes.metadata.packageManager;
|
|
4934
4935
|
result.modified = true;
|
|
4935
4936
|
}
|
|
4936
4937
|
}
|
|
4937
4938
|
if (changes.scripts) {
|
|
4938
|
-
|
|
4939
|
+
packageJson2.scripts = packageJson2.scripts || {};
|
|
4939
4940
|
for (const [name, command] of Object.entries(changes.scripts)) {
|
|
4940
|
-
const exists = name in
|
|
4941
|
+
const exists = name in packageJson2.scripts;
|
|
4941
4942
|
if (exists) {
|
|
4942
4943
|
if (scriptsMerge === "skip-existing") {
|
|
4943
4944
|
result.skippedScripts.push(name);
|
|
@@ -4948,15 +4949,15 @@ async function updatePackageJson(projectPath, changes, options = {}) {
|
|
|
4948
4949
|
continue;
|
|
4949
4950
|
}
|
|
4950
4951
|
}
|
|
4951
|
-
|
|
4952
|
+
packageJson2.scripts[name] = command;
|
|
4952
4953
|
result.addedScripts.push(name);
|
|
4953
4954
|
result.modified = true;
|
|
4954
4955
|
}
|
|
4955
4956
|
}
|
|
4956
4957
|
if (changes.dependencies) {
|
|
4957
|
-
|
|
4958
|
+
packageJson2.dependencies = packageJson2.dependencies || {};
|
|
4958
4959
|
for (const [name, version] of Object.entries(changes.dependencies)) {
|
|
4959
|
-
const exists = name in
|
|
4960
|
+
const exists = name in packageJson2.dependencies;
|
|
4960
4961
|
if (exists) {
|
|
4961
4962
|
if (dependenciesMerge === "skip-existing") {
|
|
4962
4963
|
result.skippedDependencies.push(name);
|
|
@@ -4967,15 +4968,15 @@ async function updatePackageJson(projectPath, changes, options = {}) {
|
|
|
4967
4968
|
continue;
|
|
4968
4969
|
}
|
|
4969
4970
|
}
|
|
4970
|
-
|
|
4971
|
+
packageJson2.dependencies[name] = version;
|
|
4971
4972
|
result.addedDependencies.push(name);
|
|
4972
4973
|
result.modified = true;
|
|
4973
4974
|
}
|
|
4974
4975
|
}
|
|
4975
4976
|
if (changes.devDependencies) {
|
|
4976
|
-
|
|
4977
|
+
packageJson2.devDependencies = packageJson2.devDependencies || {};
|
|
4977
4978
|
for (const [name, version] of Object.entries(changes.devDependencies)) {
|
|
4978
|
-
const exists = name in
|
|
4979
|
+
const exists = name in packageJson2.devDependencies;
|
|
4979
4980
|
if (exists) {
|
|
4980
4981
|
if (dependenciesMerge === "skip-existing") {
|
|
4981
4982
|
result.skippedDevDependencies.push(name);
|
|
@@ -4986,13 +4987,13 @@ async function updatePackageJson(projectPath, changes, options = {}) {
|
|
|
4986
4987
|
continue;
|
|
4987
4988
|
}
|
|
4988
4989
|
}
|
|
4989
|
-
|
|
4990
|
+
packageJson2.devDependencies[name] = version;
|
|
4990
4991
|
result.addedDevDependencies.push(name);
|
|
4991
4992
|
result.modified = true;
|
|
4992
4993
|
}
|
|
4993
4994
|
}
|
|
4994
4995
|
if (!dryRun && (result.created || result.modified)) {
|
|
4995
|
-
await writePackageJson(projectPath,
|
|
4996
|
+
await writePackageJson(projectPath, packageJson2);
|
|
4996
4997
|
}
|
|
4997
4998
|
result.success = true;
|
|
4998
4999
|
return result;
|
|
@@ -5936,7 +5937,7 @@ async function detectProject(projectPath) {
|
|
|
5936
5937
|
};
|
|
5937
5938
|
}
|
|
5938
5939
|
signals.push({ file: "package.json", exists: true, indicates: "Node.js project" });
|
|
5939
|
-
const
|
|
5940
|
+
const packageJson2 = await readJson(packageJsonPath).catch(() => ({}));
|
|
5940
5941
|
const packageManager = await detectPackageManager(projectPath);
|
|
5941
5942
|
if (packageManager) {
|
|
5942
5943
|
signals.push({
|
|
@@ -5945,11 +5946,11 @@ async function detectProject(projectPath) {
|
|
|
5945
5946
|
indicates: `${packageManager} package manager`
|
|
5946
5947
|
});
|
|
5947
5948
|
}
|
|
5948
|
-
const typeResult = await detectProjectType(projectPath,
|
|
5949
|
+
const typeResult = await detectProjectType(projectPath, packageJson2);
|
|
5949
5950
|
const projectType = typeResult.type;
|
|
5950
5951
|
signals.push(...typeResult.signals);
|
|
5951
5952
|
const confidence = projectType && packageManager ? "high" : projectType || packageManager ? "medium" : "low";
|
|
5952
|
-
const suggestedBundles = suggestBundles(projectType,
|
|
5953
|
+
const suggestedBundles = suggestBundles(projectType, packageJson2);
|
|
5953
5954
|
return {
|
|
5954
5955
|
detected: true,
|
|
5955
5956
|
projectType,
|
|
@@ -5973,10 +5974,10 @@ async function detectPackageManager(projectPath) {
|
|
|
5973
5974
|
}
|
|
5974
5975
|
return void 0;
|
|
5975
5976
|
}
|
|
5976
|
-
async function detectProjectType(projectPath,
|
|
5977
|
+
async function detectProjectType(projectPath, packageJson2) {
|
|
5977
5978
|
const signals = [];
|
|
5978
|
-
const deps = { ...
|
|
5979
|
-
if (await pathExists(joinPath(projectPath, "turbo.json")) || await pathExists(joinPath(projectPath, "pnpm-workspace.yaml")) ||
|
|
5979
|
+
const deps = { ...packageJson2.dependencies, ...packageJson2.devDependencies };
|
|
5980
|
+
if (await pathExists(joinPath(projectPath, "turbo.json")) || await pathExists(joinPath(projectPath, "pnpm-workspace.yaml")) || packageJson2.workspaces) {
|
|
5980
5981
|
signals.push({ file: "turbo.json/pnpm-workspace.yaml", exists: true, indicates: "monorepo" });
|
|
5981
5982
|
return { type: "monorepo", signals };
|
|
5982
5983
|
}
|
|
@@ -6003,8 +6004,8 @@ async function detectProjectType(projectPath, packageJson) {
|
|
|
6003
6004
|
}
|
|
6004
6005
|
return { type: "node", signals };
|
|
6005
6006
|
}
|
|
6006
|
-
function suggestBundles(projectType,
|
|
6007
|
-
const deps = { ...
|
|
6007
|
+
function suggestBundles(projectType, packageJson2) {
|
|
6008
|
+
const deps = { ...packageJson2.dependencies, ...packageJson2.devDependencies };
|
|
6008
6009
|
const suggestedBundles = [];
|
|
6009
6010
|
const hasHono = deps.hono || deps["@hono/node-server"];
|
|
6010
6011
|
const hasExpress = deps.express;
|
|
@@ -6087,8 +6088,8 @@ function suggestBundles(projectType, packageJson) {
|
|
|
6087
6088
|
}
|
|
6088
6089
|
async function getProjectName(projectPath) {
|
|
6089
6090
|
try {
|
|
6090
|
-
const
|
|
6091
|
-
return
|
|
6091
|
+
const packageJson2 = await readJson(joinPath(projectPath, "package.json"));
|
|
6092
|
+
return packageJson2.name;
|
|
6092
6093
|
} catch {
|
|
6093
6094
|
const parts = projectPath.split("/");
|
|
6094
6095
|
return parts[parts.length - 1];
|
|
@@ -6096,8 +6097,8 @@ async function getProjectName(projectPath) {
|
|
|
6096
6097
|
}
|
|
6097
6098
|
async function getProjectDescription(projectPath) {
|
|
6098
6099
|
try {
|
|
6099
|
-
const
|
|
6100
|
-
return
|
|
6100
|
+
const packageJson2 = await readJson(joinPath(projectPath, "package.json"));
|
|
6101
|
+
return packageJson2.description;
|
|
6101
6102
|
} catch {
|
|
6102
6103
|
return void 0;
|
|
6103
6104
|
}
|
|
@@ -10110,7 +10111,7 @@ async function promptBashPermissions(defaults) {
|
|
|
10110
10111
|
async function promptWebPermissions(defaults) {
|
|
10111
10112
|
logger.newline();
|
|
10112
10113
|
logger.info(colors.bold("\u{1F310} Web Operations"));
|
|
10113
|
-
const
|
|
10114
|
+
const fetch2 = await confirm({
|
|
10114
10115
|
message: "Allow WebFetch (fetch web pages)?",
|
|
10115
10116
|
default: defaults?.fetch ?? true
|
|
10116
10117
|
});
|
|
@@ -10119,7 +10120,7 @@ async function promptWebPermissions(defaults) {
|
|
|
10119
10120
|
default: defaults?.search ?? true
|
|
10120
10121
|
});
|
|
10121
10122
|
return {
|
|
10122
|
-
fetch,
|
|
10123
|
+
fetch: fetch2,
|
|
10123
10124
|
search
|
|
10124
10125
|
};
|
|
10125
10126
|
}
|
|
@@ -13259,7 +13260,7 @@ program.addCommand(createConfigureCommand());
|
|
|
13259
13260
|
init_esm_shims();
|
|
13260
13261
|
import chalk3 from "chalk";
|
|
13261
13262
|
import figlet from "figlet";
|
|
13262
|
-
function showBanner() {
|
|
13263
|
+
function showBanner(version) {
|
|
13263
13264
|
const bannerText = figlet.textSync("Qazuor", {
|
|
13264
13265
|
font: "Standard",
|
|
13265
13266
|
horizontalLayout: "default",
|
|
@@ -13285,18 +13286,105 @@ function showBanner() {
|
|
|
13285
13286
|
return colors2[colorIndex](line);
|
|
13286
13287
|
}).join("\n");
|
|
13287
13288
|
console.log(coloredBanner);
|
|
13288
|
-
|
|
13289
|
+
const versionText = version ? chalk3.cyan(` v${version}`) : "";
|
|
13290
|
+
console.log(chalk3.gray(" Claude Code Configuration & Project Setup") + versionText);
|
|
13289
13291
|
console.log(chalk3.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
13290
13292
|
console.log();
|
|
13291
13293
|
}
|
|
13292
13294
|
|
|
13295
|
+
// src/lib/utils/version-check.ts
|
|
13296
|
+
init_esm_shims();
|
|
13297
|
+
import chalk4 from "chalk";
|
|
13298
|
+
var PACKAGE_NAME = "@qazuor/claude-code-config";
|
|
13299
|
+
var NPM_REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}/latest`;
|
|
13300
|
+
var CHECK_TIMEOUT_MS = 3e3;
|
|
13301
|
+
function compareVersions(a, b) {
|
|
13302
|
+
const partsA = a.replace(/^v/, "").split(".").map(Number);
|
|
13303
|
+
const partsB = b.replace(/^v/, "").split(".").map(Number);
|
|
13304
|
+
for (let i = 0; i < Math.max(partsA.length, partsB.length); i++) {
|
|
13305
|
+
const numA = partsA[i] || 0;
|
|
13306
|
+
const numB = partsB[i] || 0;
|
|
13307
|
+
if (numA > numB) return 1;
|
|
13308
|
+
if (numA < numB) return -1;
|
|
13309
|
+
}
|
|
13310
|
+
return 0;
|
|
13311
|
+
}
|
|
13312
|
+
async function fetchLatestVersion() {
|
|
13313
|
+
try {
|
|
13314
|
+
const controller = new AbortController();
|
|
13315
|
+
const timeoutId = setTimeout(() => controller.abort(), CHECK_TIMEOUT_MS);
|
|
13316
|
+
const response = await fetch(NPM_REGISTRY_URL, {
|
|
13317
|
+
signal: controller.signal,
|
|
13318
|
+
headers: {
|
|
13319
|
+
Accept: "application/json"
|
|
13320
|
+
}
|
|
13321
|
+
});
|
|
13322
|
+
clearTimeout(timeoutId);
|
|
13323
|
+
if (!response.ok) {
|
|
13324
|
+
return null;
|
|
13325
|
+
}
|
|
13326
|
+
const data = await response.json();
|
|
13327
|
+
return data.version || null;
|
|
13328
|
+
} catch {
|
|
13329
|
+
return null;
|
|
13330
|
+
}
|
|
13331
|
+
}
|
|
13332
|
+
async function checkForUpdates(currentVersion) {
|
|
13333
|
+
try {
|
|
13334
|
+
const latestVersion = await fetchLatestVersion();
|
|
13335
|
+
if (!latestVersion) {
|
|
13336
|
+
return;
|
|
13337
|
+
}
|
|
13338
|
+
if (compareVersions(latestVersion, currentVersion) > 0) {
|
|
13339
|
+
displayUpdateNotification(currentVersion, latestVersion);
|
|
13340
|
+
}
|
|
13341
|
+
} catch {
|
|
13342
|
+
}
|
|
13343
|
+
}
|
|
13344
|
+
function displayUpdateNotification(currentVersion, latestVersion) {
|
|
13345
|
+
const boxWidth = 50;
|
|
13346
|
+
const border = chalk4.yellow("\u2502");
|
|
13347
|
+
const topBorder = chalk4.yellow(`\u256D${"\u2500".repeat(boxWidth)}\u256E`);
|
|
13348
|
+
const bottomBorder = chalk4.yellow(`\u2570${"\u2500".repeat(boxWidth)}\u256F`);
|
|
13349
|
+
const padLine = (text, rawLength) => {
|
|
13350
|
+
const padding = boxWidth - rawLength;
|
|
13351
|
+
const leftPad = Math.floor(padding / 2);
|
|
13352
|
+
const rightPad = padding - leftPad;
|
|
13353
|
+
return border + " ".repeat(leftPad) + text + " ".repeat(rightPad) + border;
|
|
13354
|
+
};
|
|
13355
|
+
const emptyLine = border + " ".repeat(boxWidth) + border;
|
|
13356
|
+
const updateText = "Update available!";
|
|
13357
|
+
const versionText = `${chalk4.gray(currentVersion)} \u2192 ${chalk4.green(latestVersion)}`;
|
|
13358
|
+
const versionRawLength = currentVersion.length + " \u2192 ".length + latestVersion.length;
|
|
13359
|
+
const commandText = `npm i -g ${PACKAGE_NAME}`;
|
|
13360
|
+
const runText = `Run: ${chalk4.cyan(commandText)}`;
|
|
13361
|
+
const runRawLength = "Run: ".length + commandText.length;
|
|
13362
|
+
console.log();
|
|
13363
|
+
console.log(topBorder);
|
|
13364
|
+
console.log(emptyLine);
|
|
13365
|
+
console.log(padLine(chalk4.yellow.bold(updateText), updateText.length));
|
|
13366
|
+
console.log(padLine(versionText, versionRawLength));
|
|
13367
|
+
console.log(emptyLine);
|
|
13368
|
+
console.log(padLine(runText, runRawLength));
|
|
13369
|
+
console.log(emptyLine);
|
|
13370
|
+
console.log(bottomBorder);
|
|
13371
|
+
console.log();
|
|
13372
|
+
}
|
|
13373
|
+
function startBackgroundVersionCheck(currentVersion) {
|
|
13374
|
+
return checkForUpdates(currentVersion);
|
|
13375
|
+
}
|
|
13376
|
+
|
|
13293
13377
|
// src/bin.ts
|
|
13378
|
+
var require2 = createRequire(import.meta.url);
|
|
13379
|
+
var packageJson = require2("../package.json");
|
|
13380
|
+
var VERSION3 = packageJson.version;
|
|
13294
13381
|
setupGracefulCancellation();
|
|
13295
13382
|
var args = process.argv.slice(2);
|
|
13296
13383
|
var showBannerCommands = ["init", "help", "--help", "-h", ""];
|
|
13297
13384
|
var shouldShowBanner = args.length === 0 || showBannerCommands.includes(args[0] || "");
|
|
13298
13385
|
if (shouldShowBanner) {
|
|
13299
|
-
showBanner();
|
|
13386
|
+
showBanner(VERSION3);
|
|
13387
|
+
void startBackgroundVersionCheck(VERSION3);
|
|
13300
13388
|
}
|
|
13301
13389
|
program.parse(process.argv);
|
|
13302
13390
|
//# sourceMappingURL=bin.js.map
|