@pluginfinity/cli 0.3.8 → 0.3.10
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/cli/run.js +8 -9
- package/commands/logs.js +3 -4
- package/main.js +3 -4
- package/package.json +9 -8
- package/version.js +1 -1
package/cli/run.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { program } from "./program.js";
|
|
2
2
|
import { CliRuntime } from "@effected/cli";
|
|
3
|
-
import { CurrentDistribution, distributionSuffix } from "@effected/engine";
|
|
4
3
|
import { ToolDiscoveryLive } from "@pluginfinity/engine";
|
|
5
4
|
import { Effect } from "effect";
|
|
6
5
|
|
|
@@ -9,30 +8,30 @@ import { Effect } from "effect";
|
|
|
9
8
|
* Run `args` through the program under `CliRuntime.main`.
|
|
10
9
|
*
|
|
11
10
|
* @remarks
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* `CliRuntime.main` provides `distribution` as `CurrentDistribution`, so the
|
|
12
|
+
* program and the engine read the same value, and appends its `via` suffix to
|
|
13
|
+
* the `--version` line.
|
|
14
14
|
*/
|
|
15
|
-
const run = (args, options) =>
|
|
16
|
-
const distribution = yield* CurrentDistribution;
|
|
15
|
+
const run = (args, options) => {
|
|
17
16
|
const deps = {
|
|
18
17
|
version: options.version,
|
|
19
18
|
cwd: options.cwd,
|
|
20
19
|
nodeVersion: options.nodeVersion,
|
|
21
20
|
stateHome: options.stateHome
|
|
22
21
|
};
|
|
23
|
-
return
|
|
22
|
+
return CliRuntime.main(program(args, deps).pipe(Effect.provide(options.tools ?? ToolDiscoveryLive)), {
|
|
24
23
|
platform: options.platform,
|
|
24
|
+
distribution: options.distribution ?? null,
|
|
25
25
|
helpOnUsageError: "stderr",
|
|
26
26
|
env: {
|
|
27
27
|
audienceEnvVar: "PLUGINFINITY_AUDIENCE",
|
|
28
|
-
...options.stderrIsTerminal === void 0 ? {} : { stderrIsTerminal: options.stderrIsTerminal },
|
|
29
28
|
log: {
|
|
30
29
|
envVar: "PLUGINFINITY_LOG_LEVEL",
|
|
31
30
|
argv: args
|
|
32
31
|
},
|
|
33
|
-
formatter: { formatVersion: (name, version) => `${name} v${version}
|
|
32
|
+
formatter: { formatVersion: (name, version) => `${name} v${version}` }
|
|
34
33
|
}
|
|
35
34
|
});
|
|
36
|
-
}
|
|
35
|
+
};
|
|
37
36
|
|
|
38
37
|
export { run };
|
package/commands/logs.js
CHANGED
|
@@ -5,7 +5,7 @@ import { Command, Flag } from "effect/cli";
|
|
|
5
5
|
import { CurrentDistribution } from "@effected/engine";
|
|
6
6
|
import { Audience } from "@effected/env";
|
|
7
7
|
import { configPluginNames, listLogPlugins, logRoot, parseLogLine, readLog, readLogFrom } from "@pluginfinity/engine";
|
|
8
|
-
import { Console, Context, Effect, FileSystem, Option } from "effect";
|
|
8
|
+
import { Console, Context, Effect, FileSystem, Option, Schedule } from "effect";
|
|
9
9
|
|
|
10
10
|
// src/commands/logs.ts
|
|
11
11
|
/** A follow that never stops by itself, checking twice a second. */
|
|
@@ -24,14 +24,13 @@ const resolvePlugins = (launch, explicit) => explicit.length > 0 ? Effect.succee
|
|
|
24
24
|
/** Print lines appended to the followed files until `stop` completes, checking every `interval`. */
|
|
25
25
|
const follow = (tails, control, print) => Effect.gen(function* () {
|
|
26
26
|
const offsets = new Map(tails.map((tail) => [tail.path, tail.offset]));
|
|
27
|
-
yield* Effect.
|
|
27
|
+
yield* Effect.repeat(Effect.gen(function* () {
|
|
28
28
|
for (const tail of tails) {
|
|
29
29
|
const next = yield* readLogFrom(tail.path, offsets.get(tail.path) ?? 0);
|
|
30
30
|
offsets.set(tail.path, next.offset);
|
|
31
31
|
for (const line of next.lines) yield* print(tail, line);
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
}));
|
|
33
|
+
}), Schedule.spaced(control.interval));
|
|
35
34
|
}).pipe((loop) => Effect.raceFirst(loop, control.stop));
|
|
36
35
|
/** `pluginfinity logs`: read the logs plugins write under the XDG state directory. */
|
|
37
36
|
const logsCommand = (launch) => Command.make("logs", {
|
package/main.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { CurrentFollow, DEFAULT_FOLLOW } from "./commands/logs.js";
|
|
2
2
|
import { run } from "./cli/run.js";
|
|
3
3
|
import { CLI_VERSION } from "./version.js";
|
|
4
|
-
import {
|
|
5
|
-
import { Cause, Effect, Exit, Option, Runtime } from "effect";
|
|
4
|
+
import { Cause, Effect, Exit, Runtime } from "effect";
|
|
6
5
|
import { homedir } from "node:os";
|
|
7
6
|
import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
|
|
8
7
|
import * as NodeServices from "@effect/platform-node/NodeServices";
|
|
@@ -31,8 +30,8 @@ const main = (options = {}) => {
|
|
|
31
30
|
nodeVersion: process.versions.node,
|
|
32
31
|
stateHome,
|
|
33
32
|
platform: NodeServices.layer,
|
|
34
|
-
|
|
35
|
-
}).pipe(Effect.provideService(
|
|
33
|
+
distribution: options.distribution
|
|
34
|
+
}).pipe(Effect.provideService(CurrentFollow, {
|
|
36
35
|
...DEFAULT_FOLLOW,
|
|
37
36
|
onStart: () => {
|
|
38
37
|
following = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluginfinity/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The pluginfinity command-line front end. Install the pluginfinity package to get the pluginfinity bin.",
|
|
6
6
|
"keywords": [
|
|
@@ -41,15 +41,16 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@effect/platform-node": "^4.0.6",
|
|
44
|
-
"@effected/cli": "^0.
|
|
45
|
-
"@effected/commands": "^0.
|
|
46
|
-
"@effected/
|
|
47
|
-
"@effected/
|
|
48
|
-
"@effected/
|
|
44
|
+
"@effected/cli": "^0.23.0",
|
|
45
|
+
"@effected/commands": "^0.17.0",
|
|
46
|
+
"@effected/config-file": "^0.21.0",
|
|
47
|
+
"@effected/engine": "^0.9.0",
|
|
48
|
+
"@effected/env": "^0.6.0",
|
|
49
|
+
"@effected/glob": "^0.15.0",
|
|
49
50
|
"@effected/semver": "^0.18.0",
|
|
50
|
-
"@effected/walker": "^0.
|
|
51
|
+
"@effected/walker": "^0.21.0",
|
|
51
52
|
"@pluginfinity/core": "0.3.0",
|
|
52
|
-
"@pluginfinity/engine": "0.3.
|
|
53
|
+
"@pluginfinity/engine": "0.3.8",
|
|
53
54
|
"@pluginfinity/targets": "0.3.0",
|
|
54
55
|
"effect": "^4.0.6",
|
|
55
56
|
"jiti": "^2.6.1"
|