@orchagent/cli 0.3.36 → 0.3.37

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.
@@ -78,6 +78,13 @@ async function getConfigValue(key) {
78
78
  }
79
79
  }
80
80
  }
81
+ async function unsetConfigValue(key) {
82
+ if (!isValidKey(key)) {
83
+ throw new errors_1.CliError(`Unknown config key: ${key}. Supported keys: ${SUPPORTED_KEYS.join(', ')}`);
84
+ }
85
+ await (0, config_1.unsetConfigKey)(key);
86
+ process.stdout.write(`Unset ${key}\n`);
87
+ }
81
88
  async function listConfigValues() {
82
89
  const config = await (0, config_1.loadConfig)();
83
90
  process.stdout.write('CLI Configuration:\n\n');
@@ -123,6 +130,12 @@ function registerConfigCommand(program) {
123
130
  .action(async (key) => {
124
131
  await getConfigValue(key);
125
132
  });
133
+ config
134
+ .command('unset <key>')
135
+ .description('Remove a configuration value (restore to default)')
136
+ .action(async (key) => {
137
+ await unsetConfigValue(key);
138
+ });
126
139
  config
127
140
  .command('list')
128
141
  .description('List all configuration values')
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.extractCount = extractCount;
6
7
  exports.registerSecurityCommand = registerSecurityCommand;
7
8
  const promises_1 = __importDefault(require("fs/promises"));
8
9
  const chalk_1 = __importDefault(require("chalk"));
@@ -61,6 +62,14 @@ function riskLevelColor(level) {
61
62
  return level;
62
63
  }
63
64
  }
65
+ /** Extract count from summary value (handles both flat numbers and {total, leaked} objects). */
66
+ function extractCount(value) {
67
+ if (typeof value === 'number')
68
+ return value;
69
+ if (value && typeof value === 'object' && 'leaked' in value)
70
+ return value.leaked;
71
+ return 0;
72
+ }
64
73
  function formatSummaryOutput(result) {
65
74
  process.stdout.write('\n');
66
75
  process.stdout.write(chalk_1.default.bold('Security Scan Results\n'));
@@ -78,8 +87,8 @@ function formatSummaryOutput(result) {
78
87
  process.stdout.write(chalk_1.default.bold('By Severity:\n'));
79
88
  const severityOrder = ['critical', 'high', 'medium', 'low'];
80
89
  for (const sev of severityOrder) {
81
- const count = result.summary.by_severity[sev];
82
- if (count && count > 0) {
90
+ const count = extractCount(result.summary.by_severity[sev]);
91
+ if (count > 0) {
83
92
  process.stdout.write(` ${severityColor(sev)}: ${count}\n`);
84
93
  }
85
94
  }
@@ -88,7 +97,8 @@ function formatSummaryOutput(result) {
88
97
  // Breakdown by category
89
98
  if (Object.keys(result.summary.by_category).length > 0) {
90
99
  process.stdout.write(chalk_1.default.bold('By Category:\n'));
91
- for (const [cat, count] of Object.entries(result.summary.by_category)) {
100
+ for (const [cat, rawCount] of Object.entries(result.summary.by_category)) {
101
+ const count = extractCount(rawCount);
92
102
  if (count > 0) {
93
103
  process.stdout.write(` ${cat}: ${count}\n`);
94
104
  }
@@ -293,7 +303,8 @@ function generateMarkdownReport(result) {
293
303
  if (Object.keys(result.summary.by_severity).length > 0) {
294
304
  lines.push('### By Severity');
295
305
  lines.push('');
296
- for (const [sev, count] of Object.entries(result.summary.by_severity)) {
306
+ for (const [sev, rawCount] of Object.entries(result.summary.by_severity)) {
307
+ const count = extractCount(rawCount);
297
308
  if (count > 0) {
298
309
  lines.push(`- ${sev.toUpperCase()}: ${count}`);
299
310
  }
@@ -303,7 +314,8 @@ function generateMarkdownReport(result) {
303
314
  if (Object.keys(result.summary.by_category).length > 0) {
304
315
  lines.push('### By Category');
305
316
  lines.push('');
306
- for (const [cat, count] of Object.entries(result.summary.by_category)) {
317
+ for (const [cat, rawCount] of Object.entries(result.summary.by_category)) {
318
+ const count = extractCount(rawCount);
307
319
  if (count > 0) {
308
320
  lines.push(`- ${cat}: ${count}`);
309
321
  }
@@ -47,6 +47,7 @@ exports.getDefaultScope = getDefaultScope;
47
47
  exports.setDefaultScope = setDefaultScope;
48
48
  exports.getDefaultProvider = getDefaultProvider;
49
49
  exports.setDefaultProvider = setDefaultProvider;
50
+ exports.unsetConfigKey = unsetConfigKey;
50
51
  const promises_1 = __importDefault(require("fs/promises"));
51
52
  const path_1 = __importDefault(require("path"));
52
53
  const os_1 = __importDefault(require("os"));
@@ -152,3 +153,21 @@ async function setDefaultProvider(provider) {
152
153
  config.default_provider = provider;
153
154
  await saveConfig(config);
154
155
  }
156
+ /**
157
+ * Remove a config key, restoring it to "not set" state.
158
+ * Maps CLI key names (kebab-case) to ConfigFile properties.
159
+ */
160
+ const CONFIG_KEY_MAP = {
161
+ 'default-format': 'default_formats',
162
+ 'default-scope': 'default_scope',
163
+ 'default-provider': 'default_provider',
164
+ };
165
+ async function unsetConfigKey(cliKey) {
166
+ const configProp = CONFIG_KEY_MAP[cliKey];
167
+ if (!configProp) {
168
+ throw new Error(`Unknown config key: ${cliKey}`);
169
+ }
170
+ const config = await loadConfig();
171
+ delete config[configProp];
172
+ await saveConfig(config);
173
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orchagent/cli",
3
- "version": "0.3.36",
3
+ "version": "0.3.37",
4
4
  "description": "Command-line interface for the orchagent AI agent marketplace",
5
5
  "license": "MIT",
6
6
  "author": "orchagent <hello@orchagent.io>",