@p4code/cli 0.0.42 → 0.0.43
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/dist/bin.mjs +43 -8
- package/package.json +1 -1
package/dist/bin.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import * as Console from "effect/Console";
|
|
|
7
7
|
import * as Effect from "effect/Effect";
|
|
8
8
|
import * as Layer from "effect/Layer";
|
|
9
9
|
import { Argument, Command, Flag, GlobalFlag, Prompt } from "effect/unstable/cli";
|
|
10
|
+
import * as CliError from "effect/unstable/cli/CliError";
|
|
10
11
|
import { FetchHttpClient, Headers, HttpBody, HttpClient, HttpClientError, HttpClientRequest, HttpClientResponse, HttpRouter, HttpServer, HttpServerRequest, HttpServerRespondable, HttpServerResponse } from "effect/unstable/http";
|
|
11
12
|
import * as Context from "effect/Context";
|
|
12
13
|
import * as NodeOS from "node:os";
|
|
@@ -232,7 +233,7 @@ const make$71 = () => {
|
|
|
232
233
|
const layer$67 = Layer.sync(NetService, make$71);
|
|
233
234
|
//#endregion
|
|
234
235
|
//#region package.json
|
|
235
|
-
var version = "0.0.
|
|
236
|
+
var version = "0.0.43";
|
|
236
237
|
//#endregion
|
|
237
238
|
//#region src/config.ts
|
|
238
239
|
/**
|
|
@@ -24226,6 +24227,7 @@ const make$51 = Effect.fn("cloud.boot_service.make")(function* (input) {
|
|
|
24226
24227
|
});
|
|
24227
24228
|
const activateLaunchAgent = Effect.gen(function* () {
|
|
24228
24229
|
yield* runStep("unloading the previous service", "launchctl", ["bootout", serviceTarget]).pipe(Effect.ignore);
|
|
24230
|
+
yield* runStep("enabling the service", "launchctl", ["enable", serviceTarget]).pipe(Effect.ignore);
|
|
24229
24231
|
yield* runStep("loading the service", "launchctl", [
|
|
24230
24232
|
"bootstrap",
|
|
24231
24233
|
guiDomain,
|
|
@@ -44371,14 +44373,15 @@ const checkClaudeProviderStatus = Effect.fn("checkClaudeProviderStatus")(functio
|
|
|
44371
44373
|
const versionProbe = yield* runClaudeCommand(claudeSettings, ["--version"], resolvedEnvironment).pipe(Effect.timeoutOption(DEFAULT_TIMEOUT_MS), Effect.result);
|
|
44372
44374
|
if (Result.isFailure(versionProbe)) {
|
|
44373
44375
|
const error = versionProbe.failure;
|
|
44374
|
-
|
|
44376
|
+
const missing = isCommandMissingCause(error);
|
|
44377
|
+
yield* (missing ? Effect.logDebug : Effect.logWarning)("Claude Agent CLI health check failed.", { errorTag: error._tag });
|
|
44375
44378
|
return buildServerProvider({
|
|
44376
44379
|
presentation: CLAUDE_PRESENTATION,
|
|
44377
44380
|
enabled: claudeSettings.enabled,
|
|
44378
44381
|
checkedAt,
|
|
44379
44382
|
models: allModels,
|
|
44380
44383
|
probe: {
|
|
44381
|
-
installed: !
|
|
44384
|
+
installed: !missing,
|
|
44382
44385
|
version: null,
|
|
44383
44386
|
status: "error",
|
|
44384
44387
|
auth: { status: "unknown" },
|
|
@@ -73561,14 +73564,15 @@ const checkCursorProviderStatus = Effect.fn("checkCursorProviderStatus")(functio
|
|
|
73561
73564
|
const aboutProbe = yield* runCursorAboutCommand(cursorSettings, environment).pipe(Effect.timeoutOption(ABOUT_TIMEOUT_MS), Effect.result);
|
|
73562
73565
|
if (Result.isFailure(aboutProbe)) {
|
|
73563
73566
|
const error = aboutProbe.failure;
|
|
73564
|
-
|
|
73567
|
+
const missing = isCommandMissingCause(error);
|
|
73568
|
+
yield* (missing ? Effect.logDebug : Effect.logWarning)("Cursor Agent CLI health check failed.", { errorTag: error._tag });
|
|
73565
73569
|
return buildServerProvider({
|
|
73566
73570
|
presentation: CURSOR_PRESENTATION,
|
|
73567
73571
|
enabled: cursorSettings.enabled,
|
|
73568
73572
|
checkedAt,
|
|
73569
73573
|
models: fallbackModels,
|
|
73570
73574
|
probe: {
|
|
73571
|
-
installed: !
|
|
73575
|
+
installed: !missing,
|
|
73572
73576
|
version: null,
|
|
73573
73577
|
status: "error",
|
|
73574
73578
|
auth: { status: "unknown" },
|
|
@@ -76205,14 +76209,15 @@ const checkGrokProviderStatus = Effect.fn("checkGrokProviderStatus")(function* (
|
|
|
76205
76209
|
const versionResult = yield* runGrokVersionCommand(grokSettings, environment).pipe(Effect.timeoutOption(VERSION_PROBE_TIMEOUT_MS), Effect.result);
|
|
76206
76210
|
if (Result.isFailure(versionResult)) {
|
|
76207
76211
|
const error = versionResult.failure;
|
|
76208
|
-
|
|
76212
|
+
const missing = isCommandMissingCause(error);
|
|
76213
|
+
yield* (missing ? Effect.logDebug : Effect.logWarning)("Grok CLI health check failed.", { errorTag: error._tag });
|
|
76209
76214
|
return buildServerProvider({
|
|
76210
76215
|
presentation: GROK_PRESENTATION,
|
|
76211
76216
|
enabled: grokSettings.enabled,
|
|
76212
76217
|
checkedAt,
|
|
76213
76218
|
models: fallbackModels,
|
|
76214
76219
|
probe: {
|
|
76215
|
-
installed: !
|
|
76220
|
+
installed: !missing,
|
|
76216
76221
|
version: null,
|
|
76217
76222
|
status: "error",
|
|
76218
76223
|
auth: { status: "unknown" },
|
|
@@ -82690,7 +82695,37 @@ const makeCli = () => Command.make("p4c", { ...sharedServerCommandFlags }).pipe(
|
|
|
82690
82695
|
skillsCommand
|
|
82691
82696
|
]));
|
|
82692
82697
|
const cli = makeCli();
|
|
82693
|
-
|
|
82698
|
+
/**
|
|
82699
|
+
* A one-line message for an expected failure, without the stack.
|
|
82700
|
+
*
|
|
82701
|
+
* Every domain error here is a `Schema.TaggedErrorClass` with a `message`
|
|
82702
|
+
* getter written for a person — "Background setup failed while loading the
|
|
82703
|
+
* service (exit code 5)" — and the surrounding command has usually already
|
|
82704
|
+
* printed the log path that holds the detail. Appending twenty frames of
|
|
82705
|
+
* bundled `dist/bin.mjs` to that adds nothing anybody can act on.
|
|
82706
|
+
*/
|
|
82707
|
+
const describeExpectedFailure = (error) => {
|
|
82708
|
+
const message = error?.message;
|
|
82709
|
+
if (typeof message === "string" && message.trim().length > 0) return message;
|
|
82710
|
+
return String(error);
|
|
82711
|
+
};
|
|
82712
|
+
/**
|
|
82713
|
+
* Expected failures print their message; defects keep their stack.
|
|
82714
|
+
*
|
|
82715
|
+
* The distinction is Effect's own, and it is the right one: a typed failure is
|
|
82716
|
+
* a condition the code anticipated and described, so a trace through a
|
|
82717
|
+
* bundled file is noise. A defect is a bug, and there the trace is the only
|
|
82718
|
+
* thing worth having.
|
|
82719
|
+
*
|
|
82720
|
+
* `CliError` is re-raised rather than handled, because `runMain` already
|
|
82721
|
+
* renders usage and validation failures better than a bare message would —
|
|
82722
|
+
* catching them here would replace "unknown flag --foo, did you mean --force"
|
|
82723
|
+
* with one flat line.
|
|
82724
|
+
*/
|
|
82725
|
+
const reportFailuresWithoutStacks = (effect) => effect.pipe(Effect.catchIf((error) => !CliError.isCliError(error), (error) => Console.error(describeExpectedFailure(error)).pipe(Effect.andThen(Effect.sync(() => {
|
|
82726
|
+
process.exitCode = 1;
|
|
82727
|
+
})))));
|
|
82728
|
+
if (import.meta.main) reportUpdateAvailable.pipe(Effect.andThen(Command.run(cli, { version })), reportFailuresWithoutStacks, Effect.scoped, Effect.provide(CliRuntimeLayer), NodeRuntime.runMain);
|
|
82694
82729
|
//#endregion
|
|
82695
82730
|
export { cli, makeCli };
|
|
82696
82731
|
|