pi-ssh-remote 0.1.0 → 0.1.1

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.
package/README.md CHANGED
@@ -17,8 +17,7 @@ pi install npm:pi-ssh-remote
17
17
  ## Use
18
18
 
19
19
  ```text
20
- /remote config ssh ssh USER@HOST -p PORT
21
- /remote # connect
20
+ /remote ssh USER@HOST -p PORT # save and connect
22
21
  /remote cd /remote/project
23
22
  /remote status
24
23
  /remote off # return to local tools
package/README.zh-CN.md CHANGED
@@ -17,8 +17,7 @@ pi install npm:pi-ssh-remote
17
17
  ## 使用
18
18
 
19
19
  ```text
20
- /remote config ssh ssh USER@HOST -p PORT
21
- /remote # 连接
20
+ /remote ssh USER@HOST -p PORT # 保存并连接
22
21
  /remote cd /remote/project
23
22
  /remote status
24
23
  /remote off # 返回本地工具
package/index.ts CHANGED
@@ -542,7 +542,7 @@ export default function sshRemoteExtension(pi: ExtensionAPI) {
542
542
  if (remote) return remote;
543
543
  if (credentialCache.resume) return reconnectRemote();
544
544
  const command = lastCommand || activeSshCommand();
545
- if (!command) throw new Error("No SSH endpoint configured; use /remote config ssh ssh USER@HOST -p PORT");
545
+ if (!command) throw new Error("No SSH endpoint configured; use /remote ssh USER@HOST -p PORT");
546
546
  const state = await connectInteractive(command, ctx, configuredCwd(command));
547
547
  if (!state) throw new Error("SSH remote connection was cancelled or failed");
548
548
  return state;
@@ -735,7 +735,7 @@ export default function sshRemoteExtension(pi: ExtensionAPI) {
735
735
  });
736
736
 
737
737
  pi.registerCommand("remote", {
738
- description: "Connect over SSH and manage endpoints: /remote | config | config ssh COMMAND | use USER@HOST:PORT | config cwd PATH | forward [MAPPINGS] | unforward | exec COMMAND | cd PATH | status | reload | off | forget",
738
+ description: "Connect over SSH and manage endpoints: /remote | ssh USER@HOST [-p PORT] | config | use USER@HOST:PORT | config cwd PATH | forward [MAPPINGS] | unforward | exec COMMAND | cd PATH | status | reload | off | forget",
739
739
  handler: async (args, ctx) => {
740
740
  const input = args.trim().replace(/^\/?remote(?:\s+|$)/i, "").trim();
741
741
  const action = input.toLowerCase();
@@ -748,13 +748,14 @@ export default function sshRemoteExtension(pi: ExtensionAPI) {
748
748
  ctx.ui.notify(`SSH remote configuration: ${REMOTE_CONFIG_FILE}\n${rows.join("\n") || "No saved endpoints"}`, "info");
749
749
  return;
750
750
  }
751
- if (/^config\s+ssh\s+/i.test(input)) {
752
- const command = input.replace(/^config\s+ssh\s+/i, "").trim();
751
+ if (/^ssh\s+/i.test(input)) {
752
+ const sshArguments = input.replace(/^ssh\s+/i, "").trim();
753
+ const command = `ssh ${sshArguments}`;
753
754
  try { parseSshCommand(command); }
754
755
  catch (error) { ctx.ui.notify((error as Error).message, "error"); return; }
755
756
  saveEndpointConfig(command, {}, true);
756
757
  lastCommand = command;
757
- ctx.ui.notify(`SSH endpoint saved and selected: ${parseSshCommand(command).label}`, "info");
758
+ await connectInteractive(command, ctx);
758
759
  return;
759
760
  }
760
761
  if (/^(?:config\s+)?use\s+/i.test(input)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-ssh-remote",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Persistent remote SSH workspaces for Pi.",
5
5
  "type": "module",
6
6
  "author": "Yutong Bian",