@ferchy/n8n-nodes-aimc-toolkit 0.1.6 → 0.1.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/README.md CHANGED
@@ -182,7 +182,7 @@ Extracts clean text/markdown from PDFs, images, and common document formats usin
182
182
 
183
183
  **Requirements**
184
184
  - Python 3 installed
185
- - Docling installed: `pip install docling`
185
+ - Docling installed: `pip install docling` (or enable Auto-install)
186
186
 
187
187
  **Input modes**
188
188
  - Binary (from n8n)
@@ -194,6 +194,10 @@ Extracts clean text/markdown from PDFs, images, and common document formats usin
194
194
  - JSON (structured output when available)
195
195
  - Plain Text (markdown stripped)
196
196
 
197
+ **Auto-install**
198
+ Turn on **Auto-install Docling** to run `pip install docling` the first time the node runs.
199
+ Python must already be installed in your n8n environment.
200
+
197
201
  **Example**
198
202
  ```
199
203
  Input Mode: Binary
@@ -64,6 +64,34 @@ async function ensureDoclingAvailable(pythonPath) {
64
64
  throw new Error(message);
65
65
  }
66
66
  }
67
+ async function installDocling(pythonPath, packages, timeoutMs) {
68
+ const packageList = packages
69
+ .split(',')
70
+ .map((pkg) => pkg.trim())
71
+ .filter(Boolean);
72
+ if (!packageList.length) {
73
+ return;
74
+ }
75
+ const strategies = [
76
+ ['-m', 'pip', 'install', '--user', ...packageList],
77
+ ['-m', 'pip', 'install', '--user', '--break-system-packages', ...packageList],
78
+ ['-m', 'pip', 'install', '--user', '--force-reinstall', ...packageList],
79
+ ];
80
+ for (const args of strategies) {
81
+ try {
82
+ await execFileAsync(pythonPath, args, {
83
+ timeout: timeoutMs,
84
+ maxBuffer: 5 * 1024 * 1024,
85
+ });
86
+ doclingChecked = null;
87
+ return;
88
+ }
89
+ catch {
90
+ // Try next strategy.
91
+ }
92
+ }
93
+ throw new Error('Failed to install docling with pip.');
94
+ }
67
95
  async function createTempDir() {
68
96
  return fs.promises.mkdtemp(path.join(os.tmpdir(), 'aimc-docling-'));
69
97
  }
@@ -149,6 +177,20 @@ class AimcDocling {
149
177
  default: 'python3',
150
178
  description: 'Path to Python binary with docling installed.',
151
179
  },
180
+ {
181
+ displayName: 'Auto-install Docling',
182
+ name: 'autoInstall',
183
+ type: 'boolean',
184
+ default: false,
185
+ description: 'Install docling with pip on first run if missing.',
186
+ },
187
+ {
188
+ displayName: 'Python Packages',
189
+ name: 'pythonPackages',
190
+ type: 'string',
191
+ default: 'docling',
192
+ description: 'Comma-separated packages to install when auto-install is enabled.',
193
+ },
152
194
  {
153
195
  displayName: 'Timeout (Seconds)',
154
196
  name: 'timeoutSeconds',
@@ -173,6 +215,8 @@ class AimcDocling {
173
215
  const inputUrl = this.getNodeParameter('inputUrl', index, '');
174
216
  const outputFormat = this.getNodeParameter('outputFormat', index, 'markdown');
175
217
  const pythonPath = this.getNodeParameter('pythonPath', index, 'python3');
218
+ const autoInstall = this.getNodeParameter('autoInstall', index, false);
219
+ const pythonPackages = this.getNodeParameter('pythonPackages', index, 'docling');
176
220
  const timeoutSeconds = this.getNodeParameter('timeoutSeconds', index, 120);
177
221
  let tempDir = null;
178
222
  let source = '';
@@ -198,6 +242,9 @@ class AimcDocling {
198
242
  source = inputUrl;
199
243
  }
200
244
  try {
245
+ if (autoInstall) {
246
+ await installDocling(pythonPath, pythonPackages, Math.max(30, timeoutSeconds) * 1000);
247
+ }
201
248
  await ensureDoclingAvailable(pythonPath);
202
249
  }
203
250
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ferchy/n8n-nodes-aimc-toolkit",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "AIMC Toolkit nodes for n8n: code execution and media operations.",
5
5
  "license": "MIT",
6
6
  "author": "Ferchy",