mirror of
https://github.com/qwibitai/nanoclaw.git
synced 2026-06-04 10:14:47 +08:00
refactor(cli): use spaces in custom operation keys
Operation keys like 'config get' read naturally and crud.ts normalizes spaces to dashes for the registry name. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -279,7 +279,7 @@ export function registerResource(def: ResourceDef): void {
|
||||
if (def.customOperations) {
|
||||
for (const [verb, op] of Object.entries(def.customOperations)) {
|
||||
register({
|
||||
name: `${def.plural}-${verb}`,
|
||||
name: `${def.plural}-${verb.replace(/ /g, '-')}`,
|
||||
description: op.description,
|
||||
access: op.access,
|
||||
resource: def.plural,
|
||||
|
||||
@@ -54,7 +54,7 @@ registerResource({
|
||||
{
|
||||
name: 'agent_provider',
|
||||
type: 'string',
|
||||
description: 'Deprecated — use `ncl groups config-update --provider`. Kept for backwards compat.',
|
||||
description: 'Deprecated — use `ncl groups config update --provider`. Kept for backwards compat.',
|
||||
updatable: false,
|
||||
default: null,
|
||||
},
|
||||
@@ -62,7 +62,7 @@ registerResource({
|
||||
],
|
||||
operations: { list: 'open', get: 'open', create: 'approval', update: 'approval', delete: 'approval' },
|
||||
customOperations: {
|
||||
'config-get': {
|
||||
'config get': {
|
||||
access: 'open',
|
||||
description: 'Show the container config for a group. Use --id <group-id>.',
|
||||
handler: async (args) => {
|
||||
@@ -73,7 +73,7 @@ registerResource({
|
||||
return presentConfig(row);
|
||||
},
|
||||
},
|
||||
'config-update': {
|
||||
'config update': {
|
||||
access: 'approval',
|
||||
description:
|
||||
'Update container config scalar fields. Use --id <group-id> and any of: --provider, --model, --effort, --image-tag, --assistant-name, --max-messages-per-prompt.',
|
||||
@@ -110,7 +110,7 @@ registerResource({
|
||||
return presentConfig(updated);
|
||||
},
|
||||
},
|
||||
'config-add-mcp-server': {
|
||||
'config add-mcp-server': {
|
||||
access: 'approval',
|
||||
description:
|
||||
'Add an MCP server to a group. Use --id <group-id> --name <server-name> --command <cmd> [--args <json-array>] [--env <json-object>].',
|
||||
@@ -137,7 +137,7 @@ registerResource({
|
||||
return { added: name, servers };
|
||||
},
|
||||
},
|
||||
'config-remove-mcp-server': {
|
||||
'config remove-mcp-server': {
|
||||
access: 'approval',
|
||||
description: 'Remove an MCP server from a group. Use --id <group-id> --name <server-name>.',
|
||||
handler: async (args) => {
|
||||
@@ -158,7 +158,7 @@ registerResource({
|
||||
return { removed: name };
|
||||
},
|
||||
},
|
||||
'config-add-package': {
|
||||
'config add-package': {
|
||||
access: 'approval',
|
||||
description: 'Add a package to a group. Use --id <group-id> and --apt <pkg> or --npm <pkg>.',
|
||||
handler: async (args) => {
|
||||
@@ -193,7 +193,7 @@ registerResource({
|
||||
return { added: { apt: apt || null, npm: npm || null } };
|
||||
},
|
||||
},
|
||||
'config-remove-package': {
|
||||
'config remove-package': {
|
||||
access: 'approval',
|
||||
description: 'Remove a package from a group. Use --id <group-id> and --apt <pkg> or --npm <pkg>.',
|
||||
handler: async (args) => {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Used by:
|
||||
* - self-mod approval handlers (after config change)
|
||||
* - ncl config-update (after CLI config change)
|
||||
* - ncl groups config update (after CLI config change)
|
||||
*/
|
||||
import { killContainer } from './container-runner.js';
|
||||
import { getSessionsByAgentGroup } from './db/sessions.js';
|
||||
|
||||
Reference in New Issue
Block a user