mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-11 15:53:17 +08:00
fix: [Feature] 为工作区命令增加 /ws、/wsl 和 /workspaces 别名 (#88)
This commit is contained in:
parent
959e5b9ad2
commit
65c1c55f1a
14 changed files with 35 additions and 13 deletions
|
|
@ -4068,7 +4068,7 @@ test('compact card action contains session lookup failures', async () => {
|
|||
});
|
||||
|
||||
test('Feishu list and status command failures share one safe classified format', async () => {
|
||||
for (const command of ['/sessionlist', '/workspacelist', '/status']) {
|
||||
for (const command of ['/sessionlist', '/workspacelist', '/workspaces', '/wsl', '/status']) {
|
||||
const fixture = stateFixture();
|
||||
const sent = [];
|
||||
const status = bridgeStatus();
|
||||
|
|
@ -4085,7 +4085,7 @@ test('Feishu list and status command failures share one safe classified format',
|
|||
ensureRunning: async () => true,
|
||||
};
|
||||
if (command === '/sessionlist') harness.listWorkspaceSessions = async () => { throw providerFailure(); };
|
||||
if (command === '/workspacelist') harness.listWorkspaces = async () => { throw providerFailure(); };
|
||||
if (['/workspacelist', '/workspaces', '/wsl'].includes(command)) harness.listWorkspaces = async () => { throw providerFailure(); };
|
||||
if (command === '/status') harness.ensureRunning = async () => { throw providerFailure(); };
|
||||
const bridge = new FeishuHarnessBridge({
|
||||
client: textClient(async ({ text }) => sent.push(text)),
|
||||
|
|
|
|||
|
|
@ -962,6 +962,9 @@ test('/workspace command supports fresh list numbers, preserves paths, and retur
|
|||
assert.match((await runWorkspaceCommand('/workspace 2', harness)).message, /workspacelist/);
|
||||
assert.deepEqual(switched, [alternateWorkspace, alternateWorkspace, defaultWorkspace]);
|
||||
|
||||
assert.match((await runWorkspaceCommand(`/WS ${alternateWorkspace}`, harness)).message, new RegExp(alternateWorkspace));
|
||||
assert.equal(await runWorkspaceCommand('/wsnope /tmp', harness), null);
|
||||
|
||||
const invalidHarness = {
|
||||
async switchWorkspace() {
|
||||
const error = new Error('工作区路径不存在。');
|
||||
|
|
@ -1018,8 +1021,14 @@ test('/workspacelist returns existing absolute paths with the current workspace
|
|||
assert.equal(result.messages.join(''), result.message);
|
||||
assert.equal(listCalls, 1);
|
||||
|
||||
for (const alias of ['/wsl', '/WORKSPACES']) {
|
||||
assert.equal((await runWorkspaceCommand(` ${alias} `, harness)).message, result.message);
|
||||
}
|
||||
assert.match((await runWorkspaceCommand('/wsl extra', harness)).message, /用法/);
|
||||
assert.equal(await runWorkspaceCommand('/workspacesnope', harness), null);
|
||||
|
||||
assert.match((await runWorkspaceCommand('/workspacelist extra', harness)).message, /用法/);
|
||||
assert.equal(listCalls, 1);
|
||||
assert.equal(listCalls, 3);
|
||||
assert.match((await runWorkspaceCommand('/workspacelist', {})).message, /暂不支持/);
|
||||
assert.match((await runWorkspaceCommand('/workspacelist', {
|
||||
async listWorkspaces() { throw new Error('private host detail'); },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue