send-to-pi 1.0.0 → 1.0.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
@@ -4,6 +4,7 @@
4
4
 
5
5
  > Seamlessly bridge your web browser to the [Pi Coding Agent](https://github.com/earendil-works/pi-coding-agent). Send snippets, articles, or links directly into your Pi terminal prompt with one right-click.
6
6
 
7
+ [![npm version](https://img.shields.io/npm/v/send-to-pi.svg)](https://www.npmjs.com/package/send-to-pi)
7
8
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
8
9
  [![Node.js Version](https://img.shields.io/badge/Node.js-%3E%3D16-brightgreen.svg)](https://nodejs.org/)
9
10
  [![Platform](https://img.shields.io/badge/Platform-macOS%20%7C%20Windows%20%7C%20Linux-orange.svg)]()
@@ -62,10 +63,10 @@ sequenceDiagram
62
63
  You can install it directly via Pi's built-in package manager:
63
64
 
64
65
  ```bash
65
- pi install git:github.com/Wude-m/send-to-pi
66
+ pi install npm:send-to-pi
66
67
  ```
67
68
 
68
- *(Alternatively, you can manually copy `pi-extension/index.ts` into your `~/.pi/agent/extensions/send-to-pi.ts`)*
69
+ *(Or from GitHub: `pi install git:github.com/Wude-m/send-to-pi`)*
69
70
 
70
71
  ### Step 2: Start the Bridge Daemon
71
72
  The bridge daemon runs in the background on your machine:
@@ -83,9 +84,16 @@ npm start
83
84
  *(Tip: macOS users can run `bash scripts/start-mac.sh` to run in background. Windows users can double-click `scripts/start-win.vbs` for silent background execution.)*
84
85
 
85
86
  ### Step 3: Load the Chrome Extension
87
+ You don't need to hunt for the folder manually! Just run:
88
+
89
+ ```bash
90
+ npx send-to-pi extension
91
+ ```
92
+
93
+ This will print the exact folder path and **automatically open the extension directory in your file manager**. Then:
86
94
  1. Open Google Chrome or Microsoft Edge and navigate to `chrome://extensions/`.
87
95
  2. Toggle on **Developer mode** in the top-right corner.
88
- 3. Click **Load unpacked** and select the `chrome-extension` folder from this repository.
96
+ 3. Click **Load unpacked** and select the folder that just opened.
89
97
  4. You're all set!
90
98
 
91
99
  ---
package/README_CN.md CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  > 让你的网页浏览器与 [Pi 终端编程助手](https://github.com/earendil-works/pi-coding-agent) 无缝打通。在网页上选中文字、链接或页面,一键右键直达终端输入框,自动排版并预填上下文。
6
6
 
7
+ [![npm version](https://img.shields.io/npm/v/send-to-pi.svg)](https://www.npmjs.com/package/send-to-pi)
7
8
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
8
9
  [![Node.js Version](https://img.shields.io/badge/Node.js-%3E%3D16-brightgreen.svg)](https://nodejs.org/)
9
10
  [![Platform](https://img.shields.io/badge/Platform-macOS%20%7C%20Windows%20%7C%20Linux-orange.svg)]()
@@ -62,10 +63,10 @@ sequenceDiagram
62
63
  你可以直接使用 Pi 内置的包管理器一键安装:
63
64
 
64
65
  ```bash
65
- pi install git:github.com/Wude-m/send-to-pi
66
+ pi install npm:send-to-pi
66
67
  ```
67
68
 
68
- *(或者,你也可以手动将 `pi-extension/index.ts` 复制到本机 `~/.pi/agent/extensions/send-to-pi.ts`)*
69
+ *(或者通过 GitHub 安装: `pi install git:github.com/Wude-m/send-to-pi`)*
69
70
 
70
71
  ### 第二步:启动 Bridge 守护进程
71
72
  调度守护进程负责在后台监听浏览器请求并在需要时唤醒终端:
@@ -85,10 +86,16 @@ npm start
85
86
  > - **Windows 用户**:双击 `scripts/start-win.vbs` 即可无黑框后台静默运行。
86
87
 
87
88
  ### 第三步:加载 Chrome 浏览器扩展
88
- 1. 打开 Chrome 或 Edge 浏览器,在地址栏输入 `chrome://extensions/`;
89
+ 你完全不需要手动去翻找目录,只需在终端运行:
90
+
91
+ ```bash
92
+ npx send-to-pi extension
93
+ ```
94
+
95
+ 该命令会打印出扩展目录并**自动在系统文件管理器中打开该文件夹**。然后:
96
+ 1. 打开 Chrome 或 Edge 浏览器,访问 `chrome://extensions/`;
89
97
  2. 开启右上角的 **“开发者模式”**(Developer mode);
90
- 3. 点击左上角的 **“加载已解压的扩展程序”**(Load unpacked);
91
- 4. 选择本仓库的 `chrome-extension` 目录即可!
98
+ 3. 点击左上角的 **“加载已解压的扩展程序”**(Load unpacked),选择刚刚为你弹出的文件夹即可!
92
99
 
93
100
  ---
94
101
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "send-to-pi",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Send webpage snippets, URLs, or articles directly to your local Pi coding agent terminal.",
5
5
  "main": "server/src/index.js",
6
6
  "bin": {
@@ -9,6 +9,7 @@
9
9
  "scripts": {
10
10
  "start": "node server/src/index.js",
11
11
  "status": "node server/bin/send-to-pi.js status",
12
+ "extension": "node server/bin/send-to-pi.js extension",
12
13
  "test": "node server/bin/send-to-pi.js --help"
13
14
  },
14
15
  "keywords": [
@@ -48,6 +48,28 @@ if (command === 'status' || command === 'check') {
48
48
  });
49
49
 
50
50
  req.end();
51
+ } else if (command === 'extension' || command === 'ext' || command === 'open-extension') {
52
+ const path = require('path');
53
+ const { spawn } = require('child_process');
54
+ const extDir = path.resolve(__dirname, '../../chrome-extension');
55
+
56
+ console.log(`\n📦 Chrome Extension folder:`);
57
+ console.log(` ${extDir}\n`);
58
+ console.log(`👉 Quick steps to load into Chrome / Edge:`);
59
+ console.log(` 1. Open chrome://extensions/ in your browser`);
60
+ console.log(` 2. Toggle on "Developer mode" in the top-right corner`);
61
+ console.log(` 3. Click "Load unpacked" and select the folder opened above!\n`);
62
+
63
+ try {
64
+ if (process.platform === 'win32') {
65
+ spawn('explorer.exe', [extDir], { detached: true, stdio: 'ignore' }).unref();
66
+ } else if (process.platform === 'darwin') {
67
+ spawn('open', [extDir], { detached: true, stdio: 'ignore' }).unref();
68
+ } else {
69
+ spawn('xdg-open', [extDir], { detached: true, stdio: 'ignore' }).unref();
70
+ }
71
+ } catch (_e) {}
72
+ process.exit(0);
51
73
  } else if (command === 'help' || command === '--help' || command === '-h') {
52
74
  console.log(`
53
75
  Usage: send-to-pi [command] [options]
@@ -55,6 +77,7 @@ Usage: send-to-pi [command] [options]
55
77
  Commands:
56
78
  start Start the bridge daemon (default)
57
79
  status Check if the bridge daemon is running
80
+ extension Open the Chrome extension folder to load in browser
58
81
  help Show this help message
59
82
 
60
83
  Options via Environment Variables: