Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0b32ca4

Browse files
authored
feat(cli): promote init to top-level command (#398)
allagents init <path> is now available directly at the root, removing the workspace namespace for the most common entry point. workspace init is preserved as a backward-compatible alias.
1 parent ddd8b0b commit 0b32ca4

6 files changed

Lines changed: 12 additions & 11 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ AllAgents keeps your AI tooling (skills, agents, hooks, MCP servers) in one work
1212

1313
```bash
1414
# Create a workspace from a shared template
15-
npx allagents workspace init my-workspace --from myorg/templates/nodejs
15+
npx allagents init my-workspace --from myorg/templates/nodejs
1616
cd my-workspace
1717

1818
# Install plugins
@@ -89,7 +89,7 @@ clients:
8989
9090
| Command | Description |
9191
|---|---|
92-
| `allagents workspace init <path>` | Create a workspace (optionally `--from owner/repo`) |
92+
| `allagents init <path>` | Create a workspace (optionally `--from owner/repo`) |
9393
| `allagents update` | Sync all plugins to workspace |
9494
| `allagents plugin install <spec>` | Install a plugin |
9595
| `allagents plugin uninstall <spec>` | Remove a plugin |

src/cli/commands/workspace.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ const repoCmd = conciseSubcommands({
675675
// workspace subcommands group
676676
// =============================================================================
677677

678-
export { syncCmd };
678+
export { syncCmd, initCmd };
679679

680680
export const workspaceCmd = conciseSubcommands({
681681
name: 'workspace',

src/cli/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { run } from 'cmd-ts';
44
import { conciseSubcommands } from './help.js';
5-
import { workspaceCmd, syncCmd } from './commands/workspace.js';
5+
import { workspaceCmd, syncCmd, initCmd } from './commands/workspace.js';
66
import { pluginCmd } from './commands/plugin.js';
77
import { mcpCmd } from './commands/mcp.js';
88
import { selfCmd } from './commands/self.js';
@@ -28,6 +28,7 @@ const app = conciseSubcommands({
2828
'For AI agents: use --agent-help for machine-readable help, or --json for structured output',
2929
version: packageJson.version,
3030
cmds: {
31+
init: initCmd,
3132
update: syncCmd,
3233
workspace: workspaceCmd,
3334
plugin: pluginCmd,

src/cli/metadata/workspace.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import type { AgentCommandMeta } from '../help.js';
22

33
export const initMeta: AgentCommandMeta = {
4-
command: 'workspace init',
4+
command: 'init',
55
description: 'Create new workspace and sync plugins',
66
whenToUse: 'When starting a new project or adding allagents to an existing repo for the first time',
77
examples: [
8-
'allagents workspace init',
9-
'allagents workspace init ./my-project',
10-
'allagents workspace init --from ../template-workspace/.allagents/workspace.yaml',
11-
'allagents workspace init --client claude,copilot,cursor',
8+
'allagents init',
9+
'allagents init ./my-project',
10+
'allagents init --from ../template-workspace/.allagents/workspace.yaml',
11+
'allagents init --client claude,copilot,cursor',
1212
],
1313
expectedOutput:
1414
'Creates .allagents/workspace.yaml and syncs plugins. Shows sync results per plugin. Exit 0 on success, exit 1 on failure.',

tests/e2e/cli-enriched-help.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { updateMeta } from '../../src/cli/metadata/self.js';
88
* All command metadata objects that must have enriched help.
99
*/
1010
const allCommandMetas: { name: string; meta: CommandMeta }[] = [
11-
{ name: 'workspace init', meta: initMeta },
11+
{ name: 'init', meta: initMeta },
1212
{ name: 'update', meta: syncMeta },
1313
{ name: 'workspace status', meta: statusMeta },
1414
{ name: 'plugin install', meta: pluginInstallMeta },

tests/unit/cli/agent-help.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ describe('agent command metadata', () => {
7575
test('all expected commands are present', () => {
7676
const names = allCommands.map((c) => c.command).sort();
7777
expect(names).toEqual([
78+
'init',
7879
'plugin install',
7980
'plugin list',
8081
'plugin marketplace add',
@@ -90,7 +91,6 @@ describe('agent command metadata', () => {
9091
'skill remove',
9192
'skill search',
9293
'update',
93-
'workspace init',
9494
'workspace status',
9595
]);
9696
});

0 commit comments

Comments
 (0)