@finch.app/minitools 0.1.5 → 0.1.6
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 +19 -19
- package/bin/minitools.mjs +18 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
# @finch.app/minitools
|
|
2
2
|
|
|
3
|
-
CLI shim for installing Finch
|
|
3
|
+
CLI shim for installing Finch mini tools to the correct location.
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
# Install from npm
|
|
9
|
-
npx @finch.app/minitools add @scope/finch-
|
|
9
|
+
npx @finch.app/minitools add @scope/finch-mini-tool-example
|
|
10
10
|
|
|
11
|
-
# Install a local
|
|
12
|
-
npx @finch.app/minitools add ./my-
|
|
11
|
+
# Install a local mini tool directory
|
|
12
|
+
npx @finch.app/minitools add ./my-tool
|
|
13
13
|
|
|
14
14
|
# Install from a zip file (local or URL)
|
|
15
|
-
npx @finch.app/minitools add ./my-
|
|
15
|
+
npx @finch.app/minitools add ./my-tool.zip
|
|
16
16
|
npx @finch.app/minitools add https://github.com/user/repo/archive/refs/heads/main.zip
|
|
17
17
|
|
|
18
18
|
# Install to the current project
|
|
19
|
-
npx @finch.app/minitools add @finch/
|
|
19
|
+
npx @finch.app/minitools add @finch.app/mcp-client --cwd
|
|
20
20
|
|
|
21
21
|
# Install to a specific project path
|
|
22
|
-
npx @finch.app/minitools add @finch/
|
|
22
|
+
npx @finch.app/minitools add @finch.app/mcp-client --cwd /path/to/project
|
|
23
23
|
|
|
24
24
|
# Install globally (~/.finch/extensions/)
|
|
25
|
-
npx @finch.app/minitools add @finch/
|
|
25
|
+
npx @finch.app/minitools add @finch.app/mcp-client --global
|
|
26
26
|
|
|
27
|
-
# List installed
|
|
27
|
+
# List installed mini tools (id, version, enabled/disabled, name, path)
|
|
28
28
|
npx @finch.app/minitools list
|
|
29
29
|
npx @finch.app/minitools list --global
|
|
30
30
|
|
|
31
|
-
# Remove an
|
|
32
|
-
npx @finch.app/minitools remove mcp
|
|
31
|
+
# Remove an mini tool
|
|
32
|
+
npx @finch.app/minitools remove mcp-client
|
|
33
33
|
|
|
34
34
|
# Show install paths
|
|
35
35
|
npx @finch.app/minitools where
|
|
36
36
|
|
|
37
|
-
# Validate an
|
|
38
|
-
npx @finch.app/minitools doctor ./my-
|
|
37
|
+
# Validate an mini tool package
|
|
38
|
+
npx @finch.app/minitools doctor ./my-tool
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
## Install locations
|
|
@@ -49,24 +49,24 @@ npx @finch.app/minitools doctor ./my-extension
|
|
|
49
49
|
|
|
50
50
|
The default workspace path is read from `~/.finch/workspace.json#finchHomeDir`.
|
|
51
51
|
|
|
52
|
-
##
|
|
52
|
+
## Mini tool package
|
|
53
53
|
|
|
54
|
-
A Finch
|
|
54
|
+
A Finch mini tool is an npm-style package with `package.json#finch`:
|
|
55
55
|
|
|
56
56
|
```json
|
|
57
57
|
{
|
|
58
|
-
"name": "my-
|
|
58
|
+
"name": "my-tool",
|
|
59
59
|
"version": "1.0.0",
|
|
60
60
|
"type": "module",
|
|
61
61
|
"main": "dist/index.js",
|
|
62
62
|
"finch": {
|
|
63
63
|
"manifestVersion": 1,
|
|
64
|
-
"id": "my-
|
|
65
|
-
"displayName": "My
|
|
64
|
+
"id": "my-tool",
|
|
65
|
+
"displayName": "My Tool",
|
|
66
66
|
"main": "dist/index.js",
|
|
67
67
|
"activationEvents": ["onStartup"]
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
`add` installs the
|
|
72
|
+
`add` installs the mini tool but does not enable or grant permissions. Open Finch → Toolcase → Tools to review permissions and enable it.
|
package/bin/minitools.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* @finch.app/
|
|
3
|
+
* @finch.app/minitools — install Finch extensions to the correct location.
|
|
4
4
|
*
|
|
5
5
|
* Zero npm dependencies. npm sources are fetched with `npm install --ignore-scripts`
|
|
6
6
|
* so third-party install scripts never run during CLI install.
|
|
@@ -15,6 +15,15 @@ import { spawnSync } from 'node:child_process';
|
|
|
15
15
|
import { randomUUID } from 'node:crypto';
|
|
16
16
|
|
|
17
17
|
const LOCK_FILE = '.plugins-lock.json';
|
|
18
|
+
const LEGACY_NPM_PACKAGE_RENAMES = new Map([
|
|
19
|
+
['@finch.app/mcp-bridge', '@finch.app/mcp-client'],
|
|
20
|
+
]);
|
|
21
|
+
|
|
22
|
+
function normalizeInstallSource(source) {
|
|
23
|
+
if (source?.type !== 'npm' || typeof source.package !== 'string') return source;
|
|
24
|
+
const nextPackage = LEGACY_NPM_PACKAGE_RENAMES.get(source.package);
|
|
25
|
+
return nextPackage ? { ...source, package: nextPackage } : source;
|
|
26
|
+
}
|
|
18
27
|
|
|
19
28
|
function finchRuntimeHome() {
|
|
20
29
|
return process.env.FINCH_RUNTIME_HOME ?? join(homedir(), '.finch');
|
|
@@ -331,8 +340,10 @@ function cmdList(opts) {
|
|
|
331
340
|
console.log(`No extensions installed in ${dir}`);
|
|
332
341
|
return;
|
|
333
342
|
}
|
|
343
|
+
const pluginState = normalizePluginState(readJson(pluginsStatePath(), {}));
|
|
334
344
|
for (const p of plugins) {
|
|
335
|
-
|
|
345
|
+
const status = pluginState[p.info.id]?.enabled ? 'enabled' : 'disabled';
|
|
346
|
+
console.log(`${p.info.id}\t${p.info.version}\t${status}\t${p.info.displayName}\t${p.path}`);
|
|
336
347
|
}
|
|
337
348
|
}
|
|
338
349
|
|
|
@@ -451,8 +462,9 @@ function cmdDoctor(src = '.') {
|
|
|
451
462
|
const pkg = readPackageJson(abs);
|
|
452
463
|
const manifest = pkg?.finch ?? {};
|
|
453
464
|
// Surface recommended manifest metadata that's missing (non-fatal).
|
|
454
|
-
const recommended = ['name', 'description'
|
|
465
|
+
const recommended = ['name', 'description'];
|
|
455
466
|
const missing = recommended.filter((k) => manifest[k] == null);
|
|
467
|
+
if (manifest.miniToolType == null && manifest.extensionType == null) missing.push('miniToolType');
|
|
456
468
|
if (missing.length) console.log(` hint: manifest 建议补充字段: ${missing.join(', ')}`);
|
|
457
469
|
if (manifest.permissions) {
|
|
458
470
|
const p = manifest.permissions;
|
|
@@ -477,7 +489,7 @@ async function cmdUpdate(id, opts) {
|
|
|
477
489
|
const dir = targetDir(opts);
|
|
478
490
|
const target = join(dir, id);
|
|
479
491
|
if (!existsSync(target)) throw new Error(`extension not found: ${id}`);
|
|
480
|
-
let source = readLock(dir)[id];
|
|
492
|
+
let source = normalizeInstallSource(readLock(dir)[id]);
|
|
481
493
|
if (!source) {
|
|
482
494
|
// No install record — this happens for bundled first-party extensions that
|
|
483
495
|
// were deployed by copying (e.g. the MCP bridge), not via `add`. Fall back to
|
|
@@ -486,7 +498,7 @@ async function cmdUpdate(id, opts) {
|
|
|
486
498
|
const pkg = readPackageJson(target);
|
|
487
499
|
const pkgName = typeof pkg?.name === 'string' ? pkg.name.trim() : '';
|
|
488
500
|
if (pkgName) {
|
|
489
|
-
source = { type: 'npm', package: pkgName };
|
|
501
|
+
source = normalizeInstallSource({ type: 'npm', package: pkgName });
|
|
490
502
|
} else {
|
|
491
503
|
throw new Error(`no install record for "${id}"; reinstall it with \`add\` to enable updates.`);
|
|
492
504
|
}
|
|
@@ -554,7 +566,7 @@ function parseArgs(argv) {
|
|
|
554
566
|
}
|
|
555
567
|
|
|
556
568
|
function help() {
|
|
557
|
-
console.log(`npx @finch.app/
|
|
569
|
+
console.log(`npx @finch.app/minitools\n\nUsage:\n add <npm-package|local-path|url.zip> [--global]\n update <id> [--global]\n list [--global]\n remove <id> [--global]\n enable <id>\n disable <id>\n where\n doctor [path]\n\nInstall locations:\n default workspace.json#finchHomeDir/.finch/extensions/ (personal — default)\n --global ~/.finch/extensions/ (global)\n\nThere is no project/--cwd scope — extensions only install to personal or global.\n`);
|
|
558
570
|
}
|
|
559
571
|
|
|
560
572
|
(async () => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finch.app/minitools",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "CLI shim for installing Finch
|
|
3
|
+
"version": "0.1.6",
|
|
4
|
+
"description": "CLI shim for installing Finch mini tools to the correct location.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"finch-minitools": "bin/minitools.mjs"
|