update to smartconfig

This commit is contained in:
2026-03-24 16:10:51 +00:00
parent eda67395fe
commit d0d922e53b
41 changed files with 425 additions and 2091 deletions

View File

@@ -8,23 +8,23 @@ import { runFormatter, type ICheckResult } from '../mod_format/index.js';
export { ReleaseConfig, CommitConfig };
/**
* Format npmextra.json with diff preview
* Format .smartconfig.json with diff preview
* Shows diff first, asks for confirmation, then applies
*/
async function formatNpmextraWithDiff(): Promise<void> {
async function formatSmartconfigWithDiff(): Promise<void> {
// Check for diffs first
const checkResult = await runFormatter('npmextra', {
const checkResult = await runFormatter('smartconfig', {
checkOnly: true,
showDiff: true,
}) as ICheckResult | void;
if (checkResult && checkResult.hasDiff) {
const shouldApply = await plugins.smartinteract.SmartInteract.getCliConfirmation(
'Apply formatting changes to npmextra.json?',
'Apply formatting changes to .smartconfig.json?',
true
);
if (shouldApply) {
await runFormatter('npmextra', { silent: true });
await runFormatter('smartconfig', { silent: true });
}
}
}
@@ -187,7 +187,7 @@ async function handleAdd(url?: string): Promise<void> {
if (added) {
await config.save();
plugins.logger.log('success', `Added registry: ${url}`);
await formatNpmextraWithDiff();
await formatSmartconfigWithDiff();
} else {
plugins.logger.log('warn', `Registry already exists: ${url}`);
}
@@ -223,7 +223,7 @@ async function handleRemove(url?: string): Promise<void> {
if (removed) {
await config.save();
plugins.logger.log('success', `Removed registry: ${url}`);
await formatNpmextraWithDiff();
await formatSmartconfigWithDiff();
} else {
plugins.logger.log('warn', `Registry not found: ${url}`);
}
@@ -250,7 +250,7 @@ async function handleClear(): Promise<void> {
config.clearRegistries();
await config.save();
plugins.logger.log('success', 'All registries cleared.');
await formatNpmextraWithDiff();
await formatSmartconfigWithDiff();
} else {
plugins.logger.log('info', 'Operation cancelled.');
}
@@ -290,7 +290,7 @@ async function handleAccessLevel(level?: string): Promise<void> {
config.setAccessLevel(level as 'public' | 'private');
await config.save();
plugins.logger.log('success', `Access level set to: ${level}`);
await formatNpmextraWithDiff();
await formatSmartconfigWithDiff();
}
/**
@@ -350,7 +350,7 @@ async function handleCommitInteractive(config: CommitConfig): Promise<void> {
await config.save();
plugins.logger.log('success', 'Commit configuration updated');
await formatNpmextraWithDiff();
await formatSmartconfigWithDiff();
}
/**
@@ -368,7 +368,7 @@ async function handleCommitSetting(config: CommitConfig, setting: string, value?
await config.save();
plugins.logger.log('success', `Set ${setting} to ${boolValue}`);
await formatNpmextraWithDiff();
await formatSmartconfigWithDiff();
}
/**