intools-cli 1.0.6 → 1.0.7

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/PLUGIN_API.md CHANGED
@@ -215,7 +215,7 @@ const text = await window.intools.clipboard.readText()
215
215
  | 方法 | 环境 | 说明 |
216
216
  |------|------|------|
217
217
  | `readFile(path, encoding?)` | R/B | 读取文件 → `Buffer | string` |
218
- | `writeFile(path, data, encoding?)` | R/B | 写入文件 |
218
+ | `writeFile(path, data, encoding?)` | R/B | 写入文件 (`data`: `string \| Buffer \| ArrayBuffer`) |
219
219
  | `exists(path)` | R/B | 检查是否存在 → `boolean` |
220
220
  | `unlink(path)` | R/B | 删除文件 |
221
221
  | `readdir(path)` | R/B | 读取目录 → `string[]` |
@@ -281,10 +281,10 @@ const text = await window.intools.clipboard.readText()
281
281
 
282
282
  | 方法 | 环境 | 说明 |
283
283
  |------|------|------|
284
- | `request(options)` | R/B | 发起请求 → `HttpResponse` |
284
+ | `request(options)` | R/B | 发起请求 (`body`: `string \| object \| Buffer \| ArrayBuffer`) → `HttpResponse` |
285
285
  | `get(url, headers?)` | R/B | GET 请求 |
286
- | `post(url, body?, headers?)` | R/B | POST 请求 |
287
- | `put(url, body?, headers?)` | R/B | PUT 请求 |
286
+ | `post(url, body?, headers?)` | R/B | POST 请求 (`body`: `string \| object \| Buffer \| ArrayBuffer`) |
287
+ | `put(url, body?, headers?)` | R/B | PUT 请求 (`body`: `string \| object \| Buffer \| ArrayBuffer`) |
288
288
  | `delete(url, headers?)` | R/B | DELETE 请求 |
289
289
 
290
290
  **HttpRequestOptions**: `url`, `method`, `headers`, `body`, `timeout`
@@ -332,7 +332,7 @@ const text = await window.intools.clipboard.readText()
332
332
  | 方法 | 环境 | 说明 |
333
333
  |------|------|------|
334
334
  | `hideMainWindowPasteText(text)` | R/B | 粘贴文本到焦点应用 |
335
- | `hideMainWindowPasteImage(image)` | R/B | 粘贴图片到焦点应用 |
335
+ | `hideMainWindowPasteImage(image)` | R/B | 粘贴图片到焦点应用 (`image`: `Path \| Buffer \| DataURL \| ArrayBuffer`) |
336
336
  | `hideMainWindowPasteFile(paths)` | R/B | 粘贴文件到焦点应用 |
337
337
  | `hideMainWindowTypeString(text)` | R/B | 模拟键入文本 |
338
338
  | `simulateKeyboardTap(key, ...modifiers)` | R/B | 模拟按键 |
@@ -489,7 +489,7 @@ const text = await window.intools.clipboard.readText()
489
489
  |------|------|------|
490
490
  | `isEncryptionAvailable()` | R/B | 检查加密可用性 |
491
491
  | `encryptString(plainText)` | R/B | 加密字符串 → `Buffer` |
492
- | `decryptString(encrypted)` | R/B | 解密字符串 → `string` |
492
+ | `decryptString(encrypted)` | R/B | 解密字符串 (`encrypted`: `Buffer \| ArrayBuffer`) → `string` |
493
493
 
494
494
  ---
495
495
 
@@ -55,6 +55,14 @@ async function createBasicProject(targetDir, name) {
55
55
  const mainTs = (0, basic_1.buildBasicMain)(name);
56
56
  fs.writeFileSync(path.join(targetDir, 'src/main.ts'), mainTs);
57
57
  console.log(chalk_1.default.green(' ✓ src/main.ts'));
58
+ // 创建 .gitignore
59
+ const gitignore = (0, basic_1.buildGitignore)();
60
+ fs.writeFileSync(path.join(targetDir, '.gitignore'), gitignore);
61
+ console.log(chalk_1.default.green(' ✓ .gitignore'));
62
+ // 创建 README.md
63
+ const readme = (0, basic_1.buildBasicReadme)(name);
64
+ fs.writeFileSync(path.join(targetDir, 'README.md'), readme);
65
+ console.log(chalk_1.default.green(' ✓ README.md'));
58
66
  // 复制 API 参考文档
59
67
  const apiDocSrc = path.join(__dirname, '../../..', 'PLUGIN_API.md');
60
68
  if (fs.existsSync(apiDocSrc)) {
@@ -54,6 +54,8 @@ async function createReactProject(targetDir, name) {
54
54
  createBackendMain(targetDir, name);
55
55
  createReactUI(targetDir, name);
56
56
  createIntoolsTypes(targetDir);
57
+ createGitignore(targetDir);
58
+ createReadme(targetDir, name);
57
59
  // 复制 API 参考文档
58
60
  const apiDocSrc = path.join(__dirname, '../../..', 'PLUGIN_API.md');
59
61
  if (fs.existsSync(apiDocSrc)) {
@@ -110,3 +112,13 @@ function createIntoolsTypes(targetDir) {
110
112
  fs.writeFileSync(path.join(targetDir, 'src/types/intools.d.ts'), typesDts);
111
113
  console.log(chalk_1.default.green(' ✓ src/types/intools.d.ts'));
112
114
  }
115
+ function createGitignore(targetDir) {
116
+ const gitignore = (0, react_1.buildGitignore)();
117
+ fs.writeFileSync(path.join(targetDir, '.gitignore'), gitignore);
118
+ console.log(chalk_1.default.green(' ✓ .gitignore'));
119
+ }
120
+ function createReadme(targetDir, name) {
121
+ const readme = (0, react_1.buildReactReadme)(name);
122
+ fs.writeFileSync(path.join(targetDir, 'README.md'), readme);
123
+ console.log(chalk_1.default.green(' ✓ README.md'));
124
+ }
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildBasicManifest = buildBasicManifest;
4
4
  exports.buildBasicPackageJson = buildBasicPackageJson;
5
5
  exports.buildBasicMain = buildBasicMain;
6
+ exports.buildGitignore = buildGitignore;
7
+ exports.buildBasicReadme = buildBasicReadme;
6
8
  function buildBasicManifest(name) {
7
9
  return {
8
10
  id: name,
@@ -93,3 +95,68 @@ const plugin = { onLoad, onUnload, onEnable, onDisable, run }
93
95
  export default plugin
94
96
  `;
95
97
  }
98
+ function buildGitignore() {
99
+ return `node_modules
100
+ dist
101
+ .DS_Store
102
+ *.log
103
+ `;
104
+ }
105
+ function buildBasicReadme(name) {
106
+ return `# ${name}
107
+
108
+ 插件描述
109
+
110
+ ## 功能特性
111
+
112
+ - 功能 1
113
+ - 功能 2
114
+ - 功能 3
115
+
116
+ ## 触发方式
117
+
118
+ - \`${name}\` - 主功能
119
+
120
+ ## 开发
121
+
122
+ ### 安装依赖
123
+
124
+ \`\`\`bash
125
+ npm install
126
+ \`\`\`
127
+
128
+ ### 开发模式
129
+
130
+ \`\`\`bash
131
+ npm run dev
132
+ \`\`\`
133
+
134
+ ### 构建
135
+
136
+ \`\`\`bash
137
+ npm run build
138
+ \`\`\`
139
+
140
+ ### 打包
141
+
142
+ \`\`\`bash
143
+ npm run pack
144
+ \`\`\`
145
+
146
+ ## 项目结构
147
+
148
+ \`\`\`
149
+ ${name}/
150
+ ├── manifest.json # 插件配置
151
+ ├── package.json
152
+ ├── src/
153
+ │ └── main.ts # 后端入口
154
+ ├── dist/ # 构建输出
155
+ └── icon.png # 插件图标
156
+ \`\`\`
157
+
158
+ ## 许可证
159
+
160
+ MIT License
161
+ `;
162
+ }
@@ -10,6 +10,8 @@ exports.buildMainTsx = buildMainTsx;
10
10
  exports.buildAppTsx = buildAppTsx;
11
11
  exports.buildStylesCss = buildStylesCss;
12
12
  exports.buildUseIntools = buildUseIntools;
13
+ exports.buildGitignore = buildGitignore;
14
+ exports.buildReactReadme = buildReactReadme;
13
15
  exports.buildIntoolsTypes = buildIntoolsTypes;
14
16
  function buildReactManifest(name) {
15
17
  return {
@@ -676,6 +678,82 @@ export function useIntools(pluginId?: string) {
676
678
  }
677
679
  `;
678
680
  }
681
+ function buildGitignore() {
682
+ return `node_modules
683
+ dist
684
+ ui
685
+ .DS_Store
686
+ *.log
687
+ `;
688
+ }
689
+ function buildReactReadme(name) {
690
+ return `# ${name}
691
+
692
+ 插件描述
693
+
694
+ ## 功能特性
695
+
696
+ - 功能 1
697
+ - 功能 2
698
+ - 功能 3
699
+
700
+ ## 触发方式
701
+
702
+ - \`${name}\` - 主功能
703
+
704
+ ## 开发
705
+
706
+ ### 安装依赖
707
+
708
+ \`\`\`bash
709
+ npm install
710
+ \`\`\`
711
+
712
+ ### 开发模式
713
+
714
+ \`\`\`bash
715
+ npm run dev
716
+ \`\`\`
717
+
718
+ ### 构建
719
+
720
+ \`\`\`bash
721
+ npm run build
722
+ \`\`\`
723
+
724
+ ### 打包
725
+
726
+ \`\`\`bash
727
+ npm run pack
728
+ \`\`\`
729
+
730
+ ## 项目结构
731
+
732
+ \`\`\`
733
+ ${name}/
734
+ ├── manifest.json # 插件配置
735
+ ├── package.json
736
+ ├── src/
737
+ │ ├── main.ts # 后端入口
738
+ │ ├── ui/
739
+ │ │ ├── App.tsx # 主应用
740
+ │ │ ├── main.tsx # UI 入口
741
+ │ │ ├── index.html # HTML 模板
742
+ │ │ ├── styles.css # 全局样式
743
+ │ │ ├── hooks/
744
+ │ │ │ └── useIntools.ts # InTools API Hook
745
+ │ │ └── types/
746
+ │ │ └── intools.d.ts # 类型定义
747
+ ├── dist/ # 后端构建输出
748
+ ├── ui/ # UI 构建输出
749
+ └── icon.png # 插件图标
750
+ \`\`\`
751
+
752
+ ## 许可证
753
+
754
+ MIT License
755
+ `;
756
+ }
679
757
  function buildIntoolsTypes() {
680
758
  return `// InTools API 类型定义
681
759
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intools-cli",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "InTools 插件开发 CLI 工具",
5
5
  "main": "dist/index.js",
6
6
  "files": [