stratal 0.0.15 → 0.0.17
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 +4 -0
- package/dist/{application-Du0d8O_e.d.mts → application-DfPtIzxF.d.mts} +66 -5
- package/dist/application-DfPtIzxF.d.mts.map +1 -0
- package/dist/{base-email.provider-CNwsPbwm.mjs → base-email.provider-DypUAfWm.mjs} +1 -1
- package/dist/{base-email.provider-CNwsPbwm.mjs.map → base-email.provider-DypUAfWm.mjs.map} +1 -1
- package/dist/bin/cloudflare-workers-loader.mjs +0 -0
- package/dist/bin/quarry.mjs +12 -57
- package/dist/bin/quarry.mjs.map +1 -1
- package/dist/cache/index.d.mts +2 -2
- package/dist/cache/index.mjs +10 -10
- package/dist/colors-Y7WIFXs7.mjs +16 -0
- package/dist/colors-Y7WIFXs7.mjs.map +1 -0
- package/dist/{command-DG_u5ob2.mjs → command-B1CPgsrU.mjs} +14 -10
- package/dist/{command-DG_u5ob2.mjs.map → command-B1CPgsrU.mjs.map} +1 -1
- package/dist/{command-DcebcSrL.d.mts → command-TnkPYWta.d.mts} +2 -2
- package/dist/{command-DcebcSrL.d.mts.map → command-TnkPYWta.d.mts.map} +1 -1
- package/dist/config/index.d.mts +2 -2
- package/dist/config/index.mjs +10 -10
- package/dist/consumer-registry-Bymm6ff4.d.mts +142 -0
- package/dist/consumer-registry-Bymm6ff4.d.mts.map +1 -0
- package/dist/cron/index.d.mts +3 -116
- package/dist/cron/index.d.mts.map +1 -1
- package/dist/cron/index.mjs +3 -4
- package/dist/{cron-manager-BRh86QCS.mjs → cron-manager-CFBamKKk.mjs} +3 -3
- package/dist/{cron-manager-BRh86QCS.mjs.map → cron-manager-CFBamKKk.mjs.map} +1 -1
- package/dist/cron-manager-D7imGwUT.d.mts +117 -0
- package/dist/cron-manager-D7imGwUT.d.mts.map +1 -0
- package/dist/di/index.d.mts +1 -1
- package/dist/di/index.mjs +2 -3
- package/dist/email/index.d.mts +3 -3
- package/dist/email/index.mjs +16 -15
- package/dist/email/index.mjs.map +1 -1
- package/dist/{en-uVIaxFXR.mjs → en-DaewN8hc.mjs} +1 -1
- package/dist/{en-uVIaxFXR.mjs.map → en-DaewN8hc.mjs.map} +1 -1
- package/dist/errors/index.d.mts +1 -1
- package/dist/errors/index.mjs +2 -3
- package/dist/{errors-CtCi1wn6.mjs → errors-DSKapqD8.mjs} +4 -4
- package/dist/{errors-CtCi1wn6.mjs.map → errors-DSKapqD8.mjs.map} +1 -1
- package/dist/errors-DuAR5Wke.mjs +67 -0
- package/dist/errors-DuAR5Wke.mjs.map +1 -0
- package/dist/events/index.d.mts +2 -2
- package/dist/events/index.mjs +2 -3
- package/dist/{events-CXl-o1Ad.mjs → events-CvUSgEuN.mjs} +2 -3
- package/dist/{events-CXl-o1Ad.mjs.map → events-CvUSgEuN.mjs.map} +1 -1
- package/dist/{gateway-context-90CQEQDR.mjs → gateway-context-CNOLkLUC.mjs} +4 -4
- package/dist/{gateway-context-90CQEQDR.mjs.map → gateway-context-CNOLkLUC.mjs.map} +1 -1
- package/dist/guards/index.d.mts +3 -3
- package/dist/guards/index.mjs +1 -1
- package/dist/{guards-DMbsAxSX.mjs → guards-DUk_Kzst.mjs} +1 -1
- package/dist/{guards-DMbsAxSX.mjs.map → guards-DUk_Kzst.mjs.map} +1 -1
- package/dist/i18n/index.d.mts +3 -3
- package/dist/i18n/index.mjs +16 -15
- package/dist/i18n/messages/en/index.d.mts +1 -1
- package/dist/i18n/messages/en/index.mjs +1 -1
- package/dist/i18n/validation/index.d.mts +1 -1
- package/dist/i18n/validation/index.mjs +1 -1
- package/dist/{i18n.module-qNrpIVts.mjs → i18n.module-Dn9SrFdS.mjs} +212 -162
- package/dist/i18n.module-Dn9SrFdS.mjs.map +1 -0
- package/dist/{index-D69rxo8H.d.mts → index-BFCxSp_f.d.mts} +85 -76
- package/dist/index-BFCxSp_f.d.mts.map +1 -0
- package/dist/{index-H-Su81aK.d.mts → index-DGRe6Yoa.d.mts} +5 -144
- package/dist/index-DGRe6Yoa.d.mts.map +1 -0
- package/dist/{index-CSuHOJc3.d.mts → index-D_w_Rmtd.d.mts} +1 -1
- package/dist/{index-CSuHOJc3.d.mts.map → index-D_w_Rmtd.d.mts.map} +1 -1
- package/dist/{index-Cfkie8JM.d.mts → index-Dp6A5ywM.d.mts} +1 -1
- package/dist/{index-Cfkie8JM.d.mts.map → index-Dp6A5ywM.d.mts.map} +1 -1
- package/dist/{index-CpAN9ENH.d.mts → index-NGxg-KP_.d.mts} +5 -5
- package/dist/{index-CpAN9ENH.d.mts.map → index-NGxg-KP_.d.mts.map} +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +20 -19
- package/dist/{is-command-MZDCH-0T.mjs → is-command-DJVI6wEJ.mjs} +2 -2
- package/dist/{is-command-MZDCH-0T.mjs.map → is-command-DJVI6wEJ.mjs.map} +1 -1
- package/dist/{is-seeder-BN9Ej1r7.mjs → is-seeder-D5MIEcdz.mjs} +1 -1
- package/dist/{is-seeder-BN9Ej1r7.mjs.map → is-seeder-D5MIEcdz.mjs.map} +1 -1
- package/dist/logger/index.d.mts +1 -1
- package/dist/logger/index.mjs +1 -2
- package/dist/{logger-BR1-s1Um.mjs → logger-CGT91VY6.mjs} +170 -4
- package/dist/logger-CGT91VY6.mjs.map +1 -0
- package/dist/middleware/index.d.mts +1 -1
- package/dist/middleware/index.mjs +4 -5
- package/dist/{middleware-iRhNjsPH.mjs → middleware-Bl-b5pkt.mjs} +3 -3
- package/dist/{middleware-iRhNjsPH.mjs.map → middleware-Bl-b5pkt.mjs.map} +1 -1
- package/dist/module/index.d.mts +3 -118
- package/dist/module/index.d.mts.map +1 -1
- package/dist/module/index.mjs +10 -10
- package/dist/module-registry-CmjBX6ol.d.mts +121 -0
- package/dist/module-registry-CmjBX6ol.d.mts.map +1 -0
- package/dist/{module-BH7t7BGG.mjs → module-tUtyVJ5E.mjs} +9 -8
- package/dist/module-tUtyVJ5E.mjs.map +1 -0
- package/dist/openapi/index.d.mts +54 -54
- package/dist/openapi/index.d.mts.map +1 -1
- package/dist/openapi/index.mjs +16 -15
- package/dist/openapi-tools.service-B3TxYKoQ.mjs +197 -0
- package/dist/openapi-tools.service-B3TxYKoQ.mjs.map +1 -0
- package/dist/openapi.service-DGnX3Fc4.d.mts +58 -0
- package/dist/openapi.service-DGnX3Fc4.d.mts.map +1 -0
- package/dist/quarry/index.d.mts +118 -29
- package/dist/quarry/index.d.mts.map +1 -1
- package/dist/quarry/index.mjs +9 -6
- package/dist/quarry-registry-B2rkO-JS.mjs +683 -0
- package/dist/quarry-registry-B2rkO-JS.mjs.map +1 -0
- package/dist/queue/index.d.mts +2 -1
- package/dist/queue/index.mjs +11 -11
- package/dist/{queue.module-BdXWUvIM.mjs → queue.module-BtI8f4Jo.mjs} +4 -4
- package/dist/{queue.module-BdXWUvIM.mjs.map → queue.module-BtI8f4Jo.mjs.map} +1 -1
- package/dist/{resend.provider-CQT5be5E.mjs → resend.provider-bXMEkdRJ.mjs} +4 -5
- package/dist/{resend.provider-CQT5be5E.mjs.map → resend.provider-bXMEkdRJ.mjs.map} +1 -1
- package/dist/router/index.d.mts +1 -1
- package/dist/router/index.mjs +15 -14
- package/dist/{router-context-BLn4PrRG.mjs → router-context-D9R1v2Ac.mjs} +7 -4
- package/dist/router-context-D9R1v2Ac.mjs.map +1 -0
- package/dist/s3-storage.provider-CttzNnDR.mjs +335 -0
- package/dist/s3-storage.provider-CttzNnDR.mjs.map +1 -0
- package/dist/seeder/index.d.mts +4 -4
- package/dist/seeder/index.mjs +6 -6
- package/dist/{seeder-DatfjJvU.mjs → seeder-R7RXJC35.mjs} +20 -17
- package/dist/seeder-R7RXJC35.mjs.map +1 -0
- package/dist/{smtp.provider-Cj7BUFbJ.mjs → smtp.provider-DrbHQztF.mjs} +4 -5
- package/dist/{smtp.provider-Cj7BUFbJ.mjs.map → smtp.provider-DrbHQztF.mjs.map} +1 -1
- package/dist/storage/index.d.mts +6 -465
- package/dist/storage/index.d.mts.map +1 -1
- package/dist/storage/index.mjs +14 -13
- package/dist/storage/providers/index.d.mts +272 -0
- package/dist/storage/providers/index.d.mts.map +1 -0
- package/dist/storage/providers/index.mjs +5 -0
- package/dist/{storage-BtcfgibD.mjs → storage-CZKHOhci.mjs} +35 -411
- package/dist/storage-CZKHOhci.mjs.map +1 -0
- package/dist/storage-provider.interface-0IqcdhBf.d.mts +197 -0
- package/dist/storage-provider.interface-0IqcdhBf.d.mts.map +1 -0
- package/dist/{stratal-Cm0Yy8v4.mjs → stratal-D5smIU1y.mjs} +22 -12
- package/dist/stratal-D5smIU1y.mjs.map +1 -0
- package/dist/{types-Cu4jkeiH.d.mts → types-DahElfUw.d.mts} +1 -1
- package/dist/types-DahElfUw.d.mts.map +1 -0
- package/dist/usage-generator-CVIsENuE.mjs +158 -0
- package/dist/usage-generator-CVIsENuE.mjs.map +1 -0
- package/dist/{validation-Dbt-snjx.mjs → validation-DQTC259A.mjs} +4 -4
- package/dist/{validation-Dbt-snjx.mjs.map → validation-DQTC259A.mjs.map} +1 -1
- package/dist/websocket/index.d.mts +2 -2
- package/dist/websocket/index.mjs +4 -5
- package/dist/workers/index.d.mts +1 -1
- package/dist/workers/index.mjs +20 -19
- package/dist/workers/index.mjs.map +1 -1
- package/package.json +15 -14
- package/dist/application-Du0d8O_e.d.mts.map +0 -1
- package/dist/decorate-D5j-d9_z.mjs +0 -171
- package/dist/decorate-D5j-d9_z.mjs.map +0 -1
- package/dist/i18n.module-qNrpIVts.mjs.map +0 -1
- package/dist/index-D69rxo8H.d.mts.map +0 -1
- package/dist/index-H-Su81aK.d.mts.map +0 -1
- package/dist/logger-BR1-s1Um.mjs.map +0 -1
- package/dist/module-BH7t7BGG.mjs.map +0 -1
- package/dist/quarry-registry-BPmKVjhG.mjs +0 -302
- package/dist/quarry-registry-BPmKVjhG.mjs.map +0 -1
- package/dist/router-context-BLn4PrRG.mjs.map +0 -1
- package/dist/seeder-DatfjJvU.mjs.map +0 -1
- package/dist/storage-BtcfgibD.mjs.map +0 -1
- package/dist/stratal-Cm0Yy8v4.mjs.map +0 -1
- package/dist/types-Cu4jkeiH.d.mts.map +0 -1
- package/dist/types-N84Ak6YT.d.mts +0 -64
- package/dist/types-N84Ak6YT.d.mts.map +0 -1
- package/dist/usage-generator-BTZDk5zx.mjs +0 -75
- package/dist/usage-generator-BTZDk5zx.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -80,6 +80,10 @@ Stratal provides [Agent Skills](https://agentskills.io) for AI coding assistants
|
|
|
80
80
|
npx skills add strataljs/stratal
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
+
| Skill | Description |
|
|
84
|
+
|---|---|
|
|
85
|
+
| `stratal` | Build Cloudflare Workers apps with the Stratal framework — modules, DI, controllers, routing, OpenAPI, queues, cron, events, seeders, CLI, auth, database, RBAC, testing, and more |
|
|
86
|
+
|
|
83
87
|
## Quick Start
|
|
84
88
|
|
|
85
89
|
Define a module with a controller and wire it up as a Cloudflare Worker:
|
|
@@ -1,12 +1,73 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { l as LogLevel } from "./index-
|
|
3
|
-
import { r as CommandResult, t as CommandInput } from "./types-N84Ak6YT.mjs";
|
|
1
|
+
import { Et as RouterContext, Lt as VersioningOptions, U as HonoApp, Ut as StratalEnv, at as DynamicModule, en as Container, lt as ModuleClass } from "./index-BFCxSp_f.mjs";
|
|
2
|
+
import { l as LogLevel } from "./index-Dp6A5ywM.mjs";
|
|
4
3
|
|
|
5
4
|
//#region src/execution-context.d.ts
|
|
6
5
|
interface StratalExecutionContext {
|
|
7
6
|
waitUntil(promise: Promise<unknown>): void;
|
|
8
7
|
}
|
|
9
8
|
//#endregion
|
|
9
|
+
//#region src/quarry/types.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* Flat input object for programmatic command invocation.
|
|
12
|
+
*/
|
|
13
|
+
type CommandInput = Record<string, unknown>;
|
|
14
|
+
/**
|
|
15
|
+
* Result of a command execution.
|
|
16
|
+
*/
|
|
17
|
+
interface CommandResult {
|
|
18
|
+
exitCode: number;
|
|
19
|
+
output: string[];
|
|
20
|
+
errors: string[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* User-facing Quarry interface. Only exposes the `call()` method.
|
|
24
|
+
*
|
|
25
|
+
* Inject via `@inject(DI_TOKENS.Quarry)` and type as `Quarry`.
|
|
26
|
+
*/
|
|
27
|
+
interface Quarry {
|
|
28
|
+
call(name: string, input?: CommandInput): Promise<CommandResult>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Internal mutable state stored on Command instances via Symbol key.
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
interface CommandInternals {
|
|
35
|
+
inputs: CommandInput;
|
|
36
|
+
output: string[];
|
|
37
|
+
errors: string[];
|
|
38
|
+
exitCode: number;
|
|
39
|
+
quarry: Quarry | null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A parsed argument from a Laravel-style signature string.
|
|
43
|
+
*/
|
|
44
|
+
interface ParsedArgument {
|
|
45
|
+
name: string;
|
|
46
|
+
required: boolean;
|
|
47
|
+
default?: string;
|
|
48
|
+
description?: string;
|
|
49
|
+
isArray: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A parsed option from a Laravel-style signature string.
|
|
53
|
+
*/
|
|
54
|
+
interface ParsedOption {
|
|
55
|
+
name: string;
|
|
56
|
+
alias?: string;
|
|
57
|
+
isFlag: boolean;
|
|
58
|
+
isArray: boolean;
|
|
59
|
+
default?: string;
|
|
60
|
+
description?: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Fully parsed command signature.
|
|
64
|
+
*/
|
|
65
|
+
interface ParsedSignature {
|
|
66
|
+
name: string;
|
|
67
|
+
arguments: ParsedArgument[];
|
|
68
|
+
options: ParsedOption[];
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
10
71
|
//#region src/application.d.ts
|
|
11
72
|
interface ApplicationConfig {
|
|
12
73
|
/** Root application module */
|
|
@@ -112,5 +173,5 @@ declare class Application {
|
|
|
112
173
|
private registerCoreServices;
|
|
113
174
|
}
|
|
114
175
|
//#endregion
|
|
115
|
-
export { StratalExecutionContext as i, ApplicationConfig as n, ApplicationOptions as r, Application as t };
|
|
116
|
-
//# sourceMappingURL=application-
|
|
176
|
+
export { CommandInternals as a, ParsedOption as c, StratalExecutionContext as d, CommandInput as i, ParsedSignature as l, ApplicationConfig as n, CommandResult as o, ApplicationOptions as r, ParsedArgument as s, Application as t, Quarry as u };
|
|
177
|
+
//# sourceMappingURL=application-DfPtIzxF.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application-DfPtIzxF.d.mts","names":[],"sources":["../src/execution-context.ts","../src/quarry/types.ts","../src/application.ts"],"mappings":";;;;UAAiB,uBAAA;EACf,SAAA,CAAU,OAAA,EAAS,OAAA;AAAA;;;;;;KCET,YAAA,GAAe,MAAA;ADH3B;;;AAAA,UCQiB,aAAA;EACf,QAAA;EACA,MAAA;EACA,MAAA;AAAA;;;;;AARF;UAgBiB,MAAA;EACf,IAAA,CAAK,IAAA,UAAc,KAAA,GAAQ,YAAA,GAAe,OAAA,CAAQ,aAAA;AAAA;;AAZpD;;;UAmBiB,gBAAA;EACf,MAAA,EAAQ,YAAA;EACR,MAAA;EACA,MAAA;EACA,QAAA;EACA,MAAA,EAAQ,MAAA;AAAA;;;;UAMO,cAAA;EACf,IAAA;EACA,QAAA;EACA,OAAA;EACA,WAAA;EACA,OAAA;AAAA;;;;UAMe,YAAA;EACf,IAAA;EACA,KAAA;EACA,MAAA;EACA,OAAA;EACA,OAAA;EACA,WAAA;AAAA;;;;UAMe,eAAA;EACf,IAAA;EACA,SAAA,EAAW,cAAA;EACX,OAAA,EAAS,YAAA;AAAA;;;UC1BM,iBAAA;EFrCL;EEuCV,MAAA,EAAQ,WAAA,GAAc,aAAA;EFvCa;EEyCnC,OAAA;IACE,KAAA,GAAQ,QAAA;IACR,SAAA;EAAA;EDzCoB;;;;EC+CtB,UAAA,GAAa,iBAAA;AAAA;AAAA,UAGE,kBAAA,SAA2B,iBAAA;EAC1C,GAAA,EAAK,UAAA;EACL,GAAA,EAAK,uBAAA;AAAA;;;;ADpCP;;;;;;;;;;;;;;;;AAQA;cCmDa,WAAA;;;;UAIH,UAAA;EAAA,QAEA,OAAA;EAAA,QACA,cAAA;EAAA,QACA,gBAAA;EAAA,QACA,WAAA;EAAA,QACA,MAAA;EAAA,QACA,WAAA;EAAA,SAEC,GAAA,EAAK,UAAA;EAAA,iBACG,SAAA;;IAEH,GAAA;IAAK,GAAA;IAAA,GAAQ;EAAA,GAAU,kBAAA;;;;MA+BjC,SAAA,CAAA,GAAa,SAAA;EDpFjB;;;EAAA,IC2FI,IAAA,CAAA,GAAQ,OAAA;EAIN,UAAA,CAAA,GAAc,OAAA;EDvFL;;;ECmIf,OAAA,GAAA,CAAW,KAAA,WAAgB,CAAA;EDlI3B;;;EC+IM,WAAA,CAAY,KAAA,EAAO,YAAA,EAAc,SAAA,WAAoB,OAAA;ED3I3D;;;EC+JM,eAAA,CAAgB,UAAA,EAAY,mBAAA,GAAsB,OAAA;EDxJzC;;;ECyKf,uBAAA,CAAwB,MAAA,YAAgB,aAAA;EAQlC,QAAA,CAAA,GAAY,OAAA;ED/KlB;;;EC8LM,aAAA,CAAc,IAAA,UAAc,KAAA,GAAQ,YAAA,GAAe,OAAA,CAAQ,aAAA;EAAA,QAOzD,gBAAA;EAAA,QA0BA,eAAA;EAAA,QASA,sBAAA;EAAA,QAOA,gBAAA;;AAxQV;;UAkRU,sBAAA;EAhRA;;;EAAA,QAqSA,qBAAA;EA3RsB;;;EAAA,QA+StB,oBAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-email.provider-
|
|
1
|
+
{"version":3,"file":"base-email.provider-DypUAfWm.mjs","names":[],"sources":["../src/email/providers/base-email.provider.ts"],"sourcesContent":["import type { ResolvedEmailMessage } from '../contracts'\nimport type { EmailBatchSendResult, EmailSendResult, IEmailProvider } from './email-provider.interface'\n\n/**\n * Base Email Provider\n *\n * Abstract base class for email providers.\n * Provides shared implementation of sendBatch() to reduce code duplication.\n */\nexport abstract class BaseEmailProvider implements IEmailProvider {\n /**\n * Send a single email - must be implemented by concrete providers\n */\n abstract send(message: ResolvedEmailMessage): Promise<EmailSendResult>\n\n /**\n * Send multiple emails in a batch\n *\n * Default implementation sends emails sequentially.\n * Concrete providers can override for optimized batch sending.\n */\n async sendBatch(messages: ResolvedEmailMessage[]): Promise<EmailBatchSendResult> {\n const results: EmailSendResult[] = []\n let successful = 0\n let failed = 0\n\n for (const message of messages) {\n try {\n const result = await this.send(message)\n results.push(result)\n successful++\n }\n catch (error) {\n results.push({\n messageId: '',\n accepted: false,\n metadata: {\n error: error instanceof Error ? error.message : 'Unknown error',\n },\n })\n failed++\n }\n }\n\n return {\n total: messages.length,\n successful,\n failed,\n results,\n }\n }\n}\n"],"mappings":";;;;;;;AASA,IAAsB,oBAAtB,MAAkE;;;;;;;CAYhE,MAAM,UAAU,UAAiE;EAC/E,MAAM,UAA6B,EAAE;EACrC,IAAI,aAAa;EACjB,IAAI,SAAS;AAEb,OAAK,MAAM,WAAW,SACpB,KAAI;GACF,MAAM,SAAS,MAAM,KAAK,KAAK,QAAQ;AACvC,WAAQ,KAAK,OAAO;AACpB;WAEK,OAAO;AACZ,WAAQ,KAAK;IACX,WAAW;IACX,UAAU;IACV,UAAU,EACR,OAAO,iBAAiB,QAAQ,MAAM,UAAU,iBACjD;IACF,CAAC;AACF;;AAIJ,SAAO;GACL,OAAO,SAAS;GAChB;GACA;GACA;GACD"}
|
|
File without changes
|
package/dist/bin/quarry.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import { dirname, join, resolve } from "node:path";
|
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
|
7
7
|
import { Command, Option } from "clipanion";
|
|
8
8
|
//#region src/bin/commands/dynamic-command.ts
|
|
9
|
+
/** Create Clipanion command classes from Quarry-registered commands. */
|
|
9
10
|
function createDynamicCommands(quarry, parseSignature, app) {
|
|
10
11
|
const commands = [];
|
|
11
12
|
for (const entry of quarry.list()) {
|
|
@@ -13,6 +14,7 @@ function createDynamicCommands(quarry, parseSignature, app) {
|
|
|
13
14
|
const signature = parseSignature(commandClass.command);
|
|
14
15
|
const paths = [entry.name.split(" ")];
|
|
15
16
|
if (commandClass.aliases) for (const alias of commandClass.aliases) paths.push(alias.split(" "));
|
|
17
|
+
if (entry.name === "help") paths.push([]);
|
|
16
18
|
class DynCmd extends Command {
|
|
17
19
|
static paths = paths;
|
|
18
20
|
static usage = commandClass.description ? Command.Usage({ description: commandClass.description }) : void 0;
|
|
@@ -43,65 +45,21 @@ function createDynamicCommands(quarry, parseSignature, app) {
|
|
|
43
45
|
});
|
|
44
46
|
for (const opt of signature.options) {
|
|
45
47
|
const optName = opt.alias ? `-${opt.alias},--${opt.name}` : `--${opt.name}`;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
const optDescParts = [];
|
|
49
|
+
if (opt.description) optDescParts.push(opt.description);
|
|
50
|
+
if (opt.default !== void 0) optDescParts.push(`(default: ${opt.default})`);
|
|
51
|
+
const optDesc = optDescParts.length > 0 ? optDescParts.join(" ") : void 0;
|
|
52
|
+
if (opt.isFlag) proto[opt.name] = Option.Boolean(optName, { description: optDesc });
|
|
53
|
+
else if (opt.isArray) if (opt.default !== void 0) proto[opt.name] = Option.Array(optName, [opt.default], { description: optDesc });
|
|
54
|
+
else proto[opt.name] = Option.Array(optName, { description: optDesc });
|
|
55
|
+
else if (opt.default !== void 0) proto[opt.name] = Option.String(optName, opt.default, { description: optDesc });
|
|
56
|
+
else proto[opt.name] = Option.String(optName, { description: optDesc });
|
|
49
57
|
}
|
|
50
58
|
commands.push(DynCmd);
|
|
51
59
|
}
|
|
52
60
|
return commands;
|
|
53
61
|
}
|
|
54
62
|
//#endregion
|
|
55
|
-
//#region src/bin/commands/help-command.ts
|
|
56
|
-
function createHelpCommand() {
|
|
57
|
-
class HelpCommand extends Command {
|
|
58
|
-
static paths = [["help"]];
|
|
59
|
-
static usage = Command.Usage({ description: "Show help for a command" });
|
|
60
|
-
commandPath = Option.Rest();
|
|
61
|
-
execute() {
|
|
62
|
-
const commandName = this.commandPath.join(" ");
|
|
63
|
-
if (this.help || !commandName) {
|
|
64
|
-
this.context.stdout.write(this.cli.usage());
|
|
65
|
-
return Promise.resolve(0);
|
|
66
|
-
}
|
|
67
|
-
try {
|
|
68
|
-
const command = this.cli.process(this.commandPath);
|
|
69
|
-
this.context.stdout.write(this.cli.usage(command, { detailed: true }));
|
|
70
|
-
return Promise.resolve(0);
|
|
71
|
-
} catch {
|
|
72
|
-
this.context.stderr.write(`Unknown command: ${commandName}\n`);
|
|
73
|
-
return Promise.resolve(1);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return HelpCommand;
|
|
78
|
-
}
|
|
79
|
-
//#endregion
|
|
80
|
-
//#region src/bin/commands/list-command.ts
|
|
81
|
-
function createListCommand(quarry) {
|
|
82
|
-
class ListCommand extends Command {
|
|
83
|
-
static paths = [["list"]];
|
|
84
|
-
static usage = Command.Usage({ description: "List all registered commands" });
|
|
85
|
-
execute() {
|
|
86
|
-
const commands = quarry.list();
|
|
87
|
-
if (commands.length === 0) {
|
|
88
|
-
this.context.stdout.write("No registered commands.\n");
|
|
89
|
-
return Promise.resolve(0);
|
|
90
|
-
}
|
|
91
|
-
this.context.stdout.write("\nRegistered commands:\n\n");
|
|
92
|
-
const maxName = Math.max(...commands.map((c) => c.name.length));
|
|
93
|
-
for (const cmd of commands) {
|
|
94
|
-
const aliasStr = cmd.aliases.length > 0 ? ` (${cmd.aliases.join(", ")})` : "";
|
|
95
|
-
const desc = cmd.description ?? "";
|
|
96
|
-
this.context.stdout.write(` ${cmd.name.padEnd(maxName + 4)}${desc}${aliasStr}\n`);
|
|
97
|
-
}
|
|
98
|
-
this.context.stdout.write("\n");
|
|
99
|
-
return Promise.resolve(0);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return ListCommand;
|
|
103
|
-
}
|
|
104
|
-
//#endregion
|
|
105
63
|
//#region src/bin/quarry.ts
|
|
106
64
|
const require = createRequire(import.meta.url);
|
|
107
65
|
register(pathToFileURL(join(dirname(require.resolve("@swc-node/register")), "esm/esm.mjs")), pathToFileURL("./"));
|
|
@@ -138,15 +96,12 @@ async function main() {
|
|
|
138
96
|
]);
|
|
139
97
|
app = await Stratal.resolveApplication();
|
|
140
98
|
const quarry = app.container.resolve(DI_TOKENS.Quarry);
|
|
141
|
-
const {
|
|
99
|
+
const { Cli } = await import("clipanion");
|
|
142
100
|
const cli = new Cli({
|
|
143
101
|
binaryName: "quarry",
|
|
144
102
|
binaryLabel: "Quarry CLI",
|
|
145
103
|
binaryVersion: require("../../package.json").version
|
|
146
104
|
});
|
|
147
|
-
cli.register(Builtins.HelpCommand);
|
|
148
|
-
cli.register(createListCommand(quarry));
|
|
149
|
-
cli.register(createHelpCommand());
|
|
150
105
|
for (const cmd of createDynamicCommands(quarry, parseSignature, app)) cli.register(cmd);
|
|
151
106
|
await cli.runExit(process.argv.slice(2), { ...Cli.defaultContext });
|
|
152
107
|
} finally {
|
package/dist/bin/quarry.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quarry.mjs","names":[],"sources":["../../src/bin/commands/dynamic-command.ts","../../src/bin/commands/help-command.ts","../../src/bin/commands/list-command.ts","../../src/bin/quarry.ts"],"sourcesContent":["import { Command, type CommandClass, Option, type Usage } from 'clipanion'\n\nimport type { Application } from 'stratal'\nimport type { QuarryRegistry } from 'stratal/quarry'\nimport type { ParsedSignature } from 'stratal/quarry'\n\nexport function createDynamicCommands(\n quarry: QuarryRegistry,\n parseSignature: (command: string) => ParsedSignature,\n app: Application,\n) {\n const commands: CommandClass[] = []\n\n for (const entry of quarry.list()) {\n const commandClass = quarry.get(entry.name)! as unknown as { command: string; description?: string; aliases?: string[] }\n const signature = parseSignature(commandClass.command)\n\n const paths: string[][] = [entry.name.split(' ')]\n if (commandClass.aliases) {\n for (const alias of commandClass.aliases) {\n paths.push(alias.split(' '))\n }\n }\n\n class DynCmd extends Command {\n static override paths = paths\n static override usage: Usage | undefined = commandClass.description\n ? Command.Usage({ description: commandClass.description })\n : undefined\n\n async execute(): Promise<number> {\n const input: Record<string, unknown> = {}\n\n for (const arg of signature.arguments) {\n const value = (this as Record<string, unknown>)[arg.name]\n if (value !== undefined) input[arg.name] = value\n }\n\n for (const opt of signature.options) {\n const value = (this as Record<string, unknown>)[opt.name]\n if (value !== undefined) input[opt.name] = value\n }\n\n const result = await app.handleCommand(entry.name, input)\n\n for (const line of result.output) {\n this.context.stdout.write(line + '\\n')\n }\n\n for (const err of result.errors) {\n this.context.stderr.write(err + '\\n')\n }\n\n return result.exitCode\n }\n }\n\n // Define Clipanion options/arguments as class property defaults\n const proto = DynCmd.prototype as unknown as Record<string, unknown>\n for (const arg of signature.arguments) {\n if (arg.isArray) {\n proto[arg.name] = Option.Rest({ name: arg.name, required: arg.required ? 1 : 0 })\n } else {\n proto[arg.name] = Option.String({ name: arg.name, required: arg.required })\n }\n }\n\n for (const opt of signature.options) {\n const optName = opt.alias ? `-${opt.alias},--${opt.name}` : `--${opt.name}`\n\n if (opt.isFlag) {\n proto[opt.name] = Option.Boolean(optName, { description: opt.description })\n } else if (opt.isArray) {\n proto[opt.name] = Option.Array(optName, { description: opt.description })\n } else {\n proto[opt.name] = Option.String(optName, { description: opt.description })\n }\n }\n\n commands.push(DynCmd)\n }\n\n return commands\n}\n","import { Command, Option, type Usage } from 'clipanion'\n\nexport function createHelpCommand() {\n class HelpCommand extends Command {\n static override paths = [['help']]\n static override usage: Usage = Command.Usage({ description: 'Show help for a command' })\n\n commandPath = Option.Rest()\n\n execute(): Promise<number> {\n const commandName = this.commandPath.join(' ')\n\n if (this.help || !commandName) {\n this.context.stdout.write(this.cli.usage())\n return Promise.resolve(0)\n }\n\n try {\n const command = this.cli.process(this.commandPath)\n this.context.stdout.write(this.cli.usage(command, { detailed: true }))\n return Promise.resolve(0)\n } catch {\n this.context.stderr.write(`Unknown command: ${commandName}\\n`)\n return Promise.resolve(1)\n }\n }\n }\n\n return HelpCommand\n}\n","import { Command, type Usage } from 'clipanion'\n\nimport type { QuarryRegistry } from 'stratal/quarry'\n\nexport function createListCommand(quarry: QuarryRegistry) {\n class ListCommand extends Command {\n static override paths = [['list']]\n static override usage: Usage = Command.Usage({ description: 'List all registered commands' })\n\n execute(): Promise<number> {\n const commands = quarry.list()\n\n if (commands.length === 0) {\n this.context.stdout.write('No registered commands.\\n')\n return Promise.resolve(0)\n }\n\n this.context.stdout.write('\\nRegistered commands:\\n\\n')\n\n const maxName = Math.max(...commands.map((c) => c.name.length))\n for (const cmd of commands) {\n const aliasStr = cmd.aliases.length > 0 ? ` (${cmd.aliases.join(', ')})` : ''\n const desc = cmd.description ?? ''\n this.context.stdout.write(` ${cmd.name.padEnd(maxName + 4)}${desc}${aliasStr}\\n`)\n }\n\n this.context.stdout.write('\\n')\n return Promise.resolve(0)\n }\n }\n\n return ListCommand\n}\n","import 'reflect-metadata'\n\nimport { existsSync } from 'node:fs'\nimport { createRequire, register } from 'node:module'\nimport { dirname, join, resolve } from 'node:path'\nimport { pathToFileURL } from 'node:url'\nimport type { QuarryRegistry } from 'stratal/quarry'\n\nimport { type Application } from '../application'\nimport { createDynamicCommands } from './commands/dynamic-command'\nimport { createHelpCommand } from './commands/help-command'\nimport { createListCommand } from './commands/list-command'\n\nconst require = createRequire(import.meta.url)\n\n// Register @swc-node/register for TypeScript + decorator support\nconst swcRegisterPath = join(dirname(require.resolve('@swc-node/register')), 'esm/esm.mjs')\nregister(pathToFileURL(swcRegisterPath), pathToFileURL('./'))\n\n// Register cloudflare:workers virtual module loader\nregister(new URL('./cloudflare-workers-loader.mjs', import.meta.url), pathToFileURL('./'))\n\nconst DEFAULT_ENTRY = './src/index.ts'\n\n// Determine entry file: if first arg looks like a file path, use it; otherwise use default\nconst firstArg = process.argv[2]\nlet entryFile = DEFAULT_ENTRY\n\nif (firstArg && (firstArg.includes('/') || firstArg.includes('\\\\') || /\\.(ts|js|mts|mjs)$/.test(firstArg))) {\n entryFile = firstArg\n // Remove the entry file from argv so Clipanion sees: [node, script, command, ...options]\n process.argv.splice(2, 1)\n}\n\n// Resolve and validate the entry file\nconst entryPath = resolve(process.cwd(), entryFile)\n\nif (!existsSync(entryPath)) {\n console.error(`Error: Entry file not found: ${entryFile}`)\n console.error('')\n console.error('Create src/index.ts with a default Stratal export, or specify a custom path:')\n console.error(' npx quarry ./path/to/entry.ts <command> [options]')\n process.exit(1)\n}\n\nasync function main(): Promise<void> {\n const cwdRequire = createRequire(join(process.cwd(), 'package.json'))\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n const { getPlatformProxy } = await import(cwdRequire.resolve('wrangler')) as typeof import('wrangler')\n const { env, ctx, dispose } = await getPlatformProxy()\n\n let app: Application | undefined\n try {\n // Store platform proxy on globalThis so the cloudflare:workers virtual module can read it\n (globalThis as Record<string, unknown>).__stratalPlatformProxy = {\n env,\n waitUntil: ctx.waitUntil.bind(ctx),\n }\n\n // Import user's entry file — triggers `new Stratal(...)` + full Application init\n await import(pathToFileURL(entryPath).href)\n\n // Parallel import of stratal modules\n const [\n { Stratal },\n { DI_TOKENS },\n { parseSignature },\n ] = await Promise.all([\n import('stratal'),\n import('stratal/di'),\n import('stratal/quarry'),\n ])\n\n app = await Stratal.resolveApplication()\n const quarry = app.container.resolve<QuarryRegistry>(DI_TOKENS.Quarry)\n\n // Build Clipanion CLI\n const { Builtins, Cli } = await import('clipanion')\n const pkg = require('../../package.json') as { version: string }\n\n const cli = new Cli({\n binaryName: 'quarry',\n binaryLabel: 'Quarry CLI',\n binaryVersion: pkg.version,\n })\n\n cli.register(Builtins.HelpCommand)\n cli.register(createListCommand(quarry))\n cli.register(createHelpCommand())\n\n for (const cmd of createDynamicCommands(quarry, parseSignature, app)) {\n cli.register(cmd)\n }\n\n await cli.runExit(process.argv.slice(2), { ...Cli.defaultContext })\n } finally {\n await app?.shutdown()\n await dispose()\n }\n}\n\nmain().catch((error: unknown) => {\n console.error('Fatal error:', error instanceof Error ? error.message : String(error))\n process.exit(1)\n})\n"],"mappings":";;;;;;;;AAMA,SAAgB,sBACd,QACA,gBACA,KACA;CACA,MAAM,WAA2B,EAAE;AAEnC,MAAK,MAAM,SAAS,OAAO,MAAM,EAAE;EACjC,MAAM,eAAe,OAAO,IAAI,MAAM,KAAK;EAC3C,MAAM,YAAY,eAAe,aAAa,QAAQ;EAEtD,MAAM,QAAoB,CAAC,MAAM,KAAK,MAAM,IAAI,CAAC;AACjD,MAAI,aAAa,QACf,MAAK,MAAM,SAAS,aAAa,QAC/B,OAAM,KAAK,MAAM,MAAM,IAAI,CAAC;EAIhC,MAAM,eAAe,QAAQ;GAC3B,OAAgB,QAAQ;GACxB,OAAgB,QAA2B,aAAa,cACpD,QAAQ,MAAM,EAAE,aAAa,aAAa,aAAa,CAAC,GACxD,KAAA;GAEJ,MAAM,UAA2B;IAC/B,MAAM,QAAiC,EAAE;AAEzC,SAAK,MAAM,OAAO,UAAU,WAAW;KACrC,MAAM,QAAS,KAAiC,IAAI;AACpD,SAAI,UAAU,KAAA,EAAW,OAAM,IAAI,QAAQ;;AAG7C,SAAK,MAAM,OAAO,UAAU,SAAS;KACnC,MAAM,QAAS,KAAiC,IAAI;AACpD,SAAI,UAAU,KAAA,EAAW,OAAM,IAAI,QAAQ;;IAG7C,MAAM,SAAS,MAAM,IAAI,cAAc,MAAM,MAAM,MAAM;AAEzD,SAAK,MAAM,QAAQ,OAAO,OACxB,MAAK,QAAQ,OAAO,MAAM,OAAO,KAAK;AAGxC,SAAK,MAAM,OAAO,OAAO,OACvB,MAAK,QAAQ,OAAO,MAAM,MAAM,KAAK;AAGvC,WAAO,OAAO;;;EAKlB,MAAM,QAAQ,OAAO;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M,SAAS;;;AAInB,MAAM,CAAC,OAAO,UAAmB;AAC/B,SAAQ,MAAM,gBAAgB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;AACrF,SAAQ,KAAK,EAAE;EACf"}
|
|
1
|
+
{"version":3,"file":"quarry.mjs","names":[],"sources":["../../src/bin/commands/dynamic-command.ts","../../src/bin/quarry.ts"],"sourcesContent":["import { Command, type CommandClass, Option, type Usage } from 'clipanion'\n\nimport type { Application } from 'stratal'\nimport type { ParsedSignature, QuarryRegistry } from 'stratal/quarry'\n\n/** Create Clipanion command classes from Quarry-registered commands. */\nexport function createDynamicCommands(\n quarry: QuarryRegistry,\n parseSignature: (command: string) => ParsedSignature,\n app: Application,\n) {\n const commands: CommandClass[] = []\n\n for (const entry of quarry.list()) {\n const commandClass = quarry.get(entry.name)! as unknown as { command: string; description?: string; aliases?: string[] }\n const signature = parseSignature(commandClass.command)\n\n const paths: string[][] = [entry.name.split(' ')]\n if (commandClass.aliases) {\n for (const alias of commandClass.aliases) {\n paths.push(alias.split(' '))\n }\n }\n\n // Allow bare `npx quarry` (no arguments) to invoke the help command\n if (entry.name === 'help') {\n paths.push([])\n }\n\n class DynCmd extends Command {\n static override paths = paths\n static override usage: Usage | undefined = commandClass.description\n ? Command.Usage({ description: commandClass.description })\n : undefined\n\n async execute(): Promise<number> {\n const input: Record<string, unknown> = {}\n\n for (const arg of signature.arguments) {\n const value = (this as Record<string, unknown>)[arg.name]\n if (value !== undefined) input[arg.name] = value\n }\n\n for (const opt of signature.options) {\n const value = (this as Record<string, unknown>)[opt.name]\n if (value !== undefined) input[opt.name] = value\n }\n\n const result = await app.handleCommand(entry.name, input)\n\n for (const line of result.output) {\n this.context.stdout.write(line + '\\n')\n }\n\n for (const err of result.errors) {\n this.context.stderr.write(err + '\\n')\n }\n\n return result.exitCode\n }\n }\n\n // Define Clipanion options/arguments as class property defaults\n const proto = DynCmd.prototype as unknown as Record<string, unknown>\n for (const arg of signature.arguments) {\n if (arg.isArray) {\n proto[arg.name] = Option.Rest({ name: arg.name, required: arg.required ? 1 : 0 })\n } else {\n proto[arg.name] = Option.String({ name: arg.name, required: arg.required })\n }\n }\n\n for (const opt of signature.options) {\n const optName = opt.alias ? `-${opt.alias},--${opt.name}` : `--${opt.name}`\n const optDescParts: string[] = []\n if (opt.description) optDescParts.push(opt.description)\n if (opt.default !== undefined) optDescParts.push(`(default: ${opt.default})`)\n const optDesc = optDescParts.length > 0 ? optDescParts.join(' ') : undefined\n\n if (opt.isFlag) {\n proto[opt.name] = Option.Boolean(optName, { description: optDesc })\n } else if (opt.isArray) {\n if (opt.default !== undefined) {\n proto[opt.name] = Option.Array(optName, [opt.default], { description: optDesc })\n } else {\n proto[opt.name] = Option.Array(optName, { description: optDesc })\n }\n } else {\n if (opt.default !== undefined) {\n proto[opt.name] = Option.String(optName, opt.default, { description: optDesc })\n } else {\n proto[opt.name] = Option.String(optName, { description: optDesc })\n }\n }\n }\n\n commands.push(DynCmd)\n }\n\n return commands\n}\n","import 'reflect-metadata'\n\nimport { existsSync } from 'node:fs'\nimport { createRequire, register } from 'node:module'\nimport { dirname, join, resolve } from 'node:path'\nimport { pathToFileURL } from 'node:url'\nimport type { QuarryRegistry } from 'stratal/quarry'\n\nimport { type Application } from '../application'\nimport { createDynamicCommands } from './commands/dynamic-command'\n\nconst require = createRequire(import.meta.url)\n\n// Register @swc-node/register for TypeScript + decorator support\nconst swcRegisterPath = join(dirname(require.resolve('@swc-node/register')), 'esm/esm.mjs')\nregister(pathToFileURL(swcRegisterPath), pathToFileURL('./'))\n\n// Register cloudflare:workers virtual module loader\nregister(new URL('./cloudflare-workers-loader.mjs', import.meta.url), pathToFileURL('./'))\n\nconst DEFAULT_ENTRY = './src/index.ts'\n\n// Determine entry file: if first arg looks like a file path, use it; otherwise use default\nconst firstArg = process.argv[2]\nlet entryFile = DEFAULT_ENTRY\n\nif (firstArg && (firstArg.includes('/') || firstArg.includes('\\\\') || /\\.(ts|js|mts|mjs)$/.test(firstArg))) {\n entryFile = firstArg\n // Remove the entry file from argv so Clipanion sees: [node, script, command, ...options]\n process.argv.splice(2, 1)\n}\n\n// Resolve and validate the entry file\nconst entryPath = resolve(process.cwd(), entryFile)\n\nif (!existsSync(entryPath)) {\n console.error(`Error: Entry file not found: ${entryFile}`)\n console.error('')\n console.error('Create src/index.ts with a default Stratal export, or specify a custom path:')\n console.error(' npx quarry ./path/to/entry.ts <command> [options]')\n process.exit(1)\n}\n\nasync function main(): Promise<void> {\n const cwdRequire = createRequire(join(process.cwd(), 'package.json'))\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n const { getPlatformProxy } = await import(cwdRequire.resolve('wrangler')) as typeof import('wrangler')\n const { env, ctx, dispose } = await getPlatformProxy()\n\n let app: Application | undefined\n try {\n // Store platform proxy on globalThis so the cloudflare:workers virtual module can read it\n (globalThis as Record<string, unknown>).__stratalPlatformProxy = {\n env,\n waitUntil: ctx.waitUntil.bind(ctx),\n }\n\n // Import user's entry file — triggers `new Stratal(...)` + full Application init\n await import(pathToFileURL(entryPath).href)\n\n // Parallel import of stratal modules\n const [\n { Stratal },\n { DI_TOKENS },\n { parseSignature },\n ] = await Promise.all([\n import('stratal'),\n import('stratal/di'),\n import('stratal/quarry'),\n ])\n\n app = await Stratal.resolveApplication()\n const quarry = app.container.resolve<QuarryRegistry>(DI_TOKENS.Quarry)\n\n // Build Clipanion CLI\n const { Cli } = await import('clipanion')\n const pkg = require('../../package.json') as { version: string }\n\n const cli = new Cli({\n binaryName: 'quarry',\n binaryLabel: 'Quarry CLI',\n binaryVersion: pkg.version,\n })\n\n for (const cmd of createDynamicCommands(quarry, parseSignature, app)) {\n cli.register(cmd)\n }\n\n await cli.runExit(process.argv.slice(2), { ...Cli.defaultContext })\n } finally {\n await app?.shutdown()\n await dispose()\n }\n}\n\nmain().catch((error: unknown) => {\n console.error('Fatal error:', error instanceof Error ? error.message : String(error))\n process.exit(1)\n})\n"],"mappings":";;;;;;;;;AAMA,SAAgB,sB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,MAAM,gBAAgB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;AACrF,SAAQ,KAAK,EAAE;EACf"}
|
package/dist/cache/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as LoggerService } from "../index-
|
|
1
|
+
import { Ut as StratalEnv, s as ApplicationError } from "../index-BFCxSp_f.mjs";
|
|
2
|
+
import { i as LoggerService } from "../index-Dp6A5ywM.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/cache/cache.module.d.ts
|
|
5
5
|
/**
|
package/dist/cache/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { S as ApplicationError, b as ERROR_CODES } from "../errors-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import "../
|
|
6
|
-
import "../
|
|
7
|
-
import "../
|
|
8
|
-
import "../
|
|
9
|
-
import "../
|
|
10
|
-
import "../
|
|
1
|
+
import { S as ApplicationError, b as ERROR_CODES } from "../errors-DSKapqD8.mjs";
|
|
2
|
+
import { a as __decorate, d as Transient, g as DI_TOKENS, o as __decorateParam, s as __decorateMetadata, u as LOGGER_TOKENS } from "../logger-CGT91VY6.mjs";
|
|
3
|
+
import { r as Module } from "../module-tUtyVJ5E.mjs";
|
|
4
|
+
import "../events-CvUSgEuN.mjs";
|
|
5
|
+
import "../middleware-Bl-b5pkt.mjs";
|
|
6
|
+
import "../router-context-D9R1v2Ac.mjs";
|
|
7
|
+
import "../colors-Y7WIFXs7.mjs";
|
|
8
|
+
import "../command-B1CPgsrU.mjs";
|
|
9
|
+
import "../is-command-DJVI6wEJ.mjs";
|
|
10
|
+
import "../is-seeder-D5MIEcdz.mjs";
|
|
11
11
|
import { inject } from "tsyringe";
|
|
12
12
|
//#region src/cache/cache.tokens.ts
|
|
13
13
|
const CACHE_TOKENS = { CacheService: Symbol.for("stratal:cache:service") };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/quarry/colors.ts
|
|
2
|
+
/** Minimal ANSI color helpers that respect the `NO_COLOR` convention. */
|
|
3
|
+
const isEnabled = () => typeof process !== "undefined" ? !process.env.NO_COLOR : true;
|
|
4
|
+
/** Create an ANSI formatter that wraps text with the given open/close SGR codes. */
|
|
5
|
+
const code = (open, close) => (s) => isEnabled() ? `\x1b[${open}m${s}\x1b[${close}m` : s;
|
|
6
|
+
const bold = code(1, 22);
|
|
7
|
+
const dim = code(2, 22);
|
|
8
|
+
const cyan = code(36, 39);
|
|
9
|
+
const green = code(32, 39);
|
|
10
|
+
const red = code(31, 39);
|
|
11
|
+
const yellow = code(33, 39);
|
|
12
|
+
const dimWhite = (s) => isEnabled() ? `\x1b[2;37m${s}\x1b[22;39m` : s;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { green as a, dimWhite as i, cyan as n, red as o, dim as r, yellow as s, bold as t };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=colors-Y7WIFXs7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors-Y7WIFXs7.mjs","names":[],"sources":["../src/quarry/colors.ts"],"sourcesContent":["/** Minimal ANSI color helpers that respect the `NO_COLOR` convention. */\nconst isEnabled = () => typeof process !== 'undefined' ? !process.env.NO_COLOR : true\n\n/** Create an ANSI formatter that wraps text with the given open/close SGR codes. */\nconst code = (open: number, close: number) => (s: string) =>\n isEnabled() ? `\\x1b[${open}m${s}\\x1b[${close}m` : s\n\nexport const bold = code(1, 22)\nexport const dim = code(2, 22)\nexport const cyan = code(36, 39)\nexport const green = code(32, 39)\nexport const red = code(31, 39)\nexport const yellow = code(33, 39)\nexport const dimWhite = (s: string) =>\n isEnabled() ? `\\x1b[2;37m${s}\\x1b[22;39m` : s\n"],"mappings":";;AACA,MAAM,kBAAkB,OAAO,YAAY,cAAc,CAAC,QAAQ,IAAI,WAAW;;AAGjF,MAAM,QAAQ,MAAc,WAAmB,MAC7C,WAAW,GAAG,QAAQ,KAAK,GAAG,EAAE,OAAO,MAAM,KAAK;AAEpD,MAAa,OAAO,KAAK,GAAG,GAAG;AAC/B,MAAa,MAAM,KAAK,GAAG,GAAG;AAC9B,MAAa,OAAO,KAAK,IAAI,GAAG;AAChC,MAAa,QAAQ,KAAK,IAAI,GAAG;AACjC,MAAa,MAAM,KAAK,IAAI,GAAG;AAC/B,MAAa,SAAS,KAAK,IAAI,GAAG;AAClC,MAAa,YAAY,MACvB,WAAW,GAAG,aAAa,EAAE,eAAe"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { a as green, n as cyan, o as red, r as dim, s as yellow, t as bold } from "./colors-Y7WIFXs7.mjs";
|
|
1
2
|
import "reflect-metadata";
|
|
2
3
|
//#region src/quarry/constants.ts
|
|
3
4
|
/**
|
|
@@ -134,19 +135,19 @@ var Command = class {
|
|
|
134
135
|
}
|
|
135
136
|
/** Write an informational message to output */
|
|
136
137
|
info(message) {
|
|
137
|
-
this[COMMAND_INTERNALS].output.push(message);
|
|
138
|
+
this[COMMAND_INTERNALS].output.push(cyan(message));
|
|
138
139
|
}
|
|
139
140
|
/** Write a success message to output */
|
|
140
141
|
success(message) {
|
|
141
|
-
this[COMMAND_INTERNALS].output.push(message);
|
|
142
|
+
this[COMMAND_INTERNALS].output.push(`${green(bold("✔"))} ${green(message)}`);
|
|
142
143
|
}
|
|
143
144
|
/** Write a warning message to output */
|
|
144
145
|
warn(message) {
|
|
145
|
-
this[COMMAND_INTERNALS].output.push(
|
|
146
|
+
this[COMMAND_INTERNALS].output.push(`${yellow(bold("⚠"))} ${yellow(message)}`);
|
|
146
147
|
}
|
|
147
148
|
/** Write an error message to errors */
|
|
148
149
|
error(message) {
|
|
149
|
-
this[COMMAND_INTERNALS].errors.push(message);
|
|
150
|
+
this[COMMAND_INTERNALS].errors.push(red(message));
|
|
150
151
|
}
|
|
151
152
|
/** Write a plain line to output */
|
|
152
153
|
line(message) {
|
|
@@ -158,7 +159,7 @@ var Command = class {
|
|
|
158
159
|
}
|
|
159
160
|
/** Write a comment-style line to output */
|
|
160
161
|
comment(message) {
|
|
161
|
-
this[COMMAND_INTERNALS].output.push(`// ${message}`);
|
|
162
|
+
this[COMMAND_INTERNALS].output.push(dim(`// ${message}`));
|
|
162
163
|
}
|
|
163
164
|
/** Write a formatted table to output */
|
|
164
165
|
table(headers, rows) {
|
|
@@ -167,13 +168,13 @@ var Command = class {
|
|
|
167
168
|
return Math.max(h.length, maxRow);
|
|
168
169
|
});
|
|
169
170
|
const formatRow = (cells) => cells.map((cell, i) => cell.padEnd(colWidths[i])).join(" ");
|
|
170
|
-
this[COMMAND_INTERNALS].output.push(formatRow(headers));
|
|
171
|
-
this[COMMAND_INTERNALS].output.push(colWidths.map((w) => "-".repeat(w)).join(" "));
|
|
171
|
+
this[COMMAND_INTERNALS].output.push(bold(formatRow(headers)));
|
|
172
|
+
this[COMMAND_INTERNALS].output.push(dim(colWidths.map((w) => "-".repeat(w)).join(" ")));
|
|
172
173
|
for (const row of rows) this[COMMAND_INTERNALS].output.push(formatRow(row));
|
|
173
174
|
}
|
|
174
175
|
/** Write an error message and set exit code */
|
|
175
176
|
fail(message, exitCode = 1) {
|
|
176
|
-
this[COMMAND_INTERNALS].errors.push(message);
|
|
177
|
+
this[COMMAND_INTERNALS].errors.push(`${red(bold("✖"))} ${red(message)}`);
|
|
177
178
|
this[COMMAND_INTERNALS].exitCode = exitCode;
|
|
178
179
|
}
|
|
179
180
|
/**
|
|
@@ -183,10 +184,13 @@ var Command = class {
|
|
|
183
184
|
async call(name, input) {
|
|
184
185
|
const internals = this[COMMAND_INTERNALS];
|
|
185
186
|
if (!internals.quarry) throw new CommandError("Cannot call commands: Quarry reference not set");
|
|
186
|
-
|
|
187
|
+
const result = await internals.quarry.call(name, input);
|
|
188
|
+
internals.output.push(...result.output);
|
|
189
|
+
internals.errors.push(...result.errors);
|
|
190
|
+
return result;
|
|
187
191
|
}
|
|
188
192
|
};
|
|
189
193
|
//#endregion
|
|
190
194
|
export { CommandError as n, COMMAND_INTERNALS as r, Command as t };
|
|
191
195
|
|
|
192
|
-
//# sourceMappingURL=command-
|
|
196
|
+
//# sourceMappingURL=command-B1CPgsrU.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-DG_u5ob2.mjs","names":[],"sources":["../src/quarry/constants.ts","../src/quarry/errors/command.error.ts","../src/quarry/command.ts"],"sourcesContent":["/**\n * Symbol key for storing internal mutable state on Command instances.\n * Keeps internal state hidden from user-facing autocomplete.\n */\nexport const COMMAND_INTERNALS = Symbol.for('stratal:command:internals')\n","/**\n * User-facing command error with a plain English message.\n *\n * Quarry catches this in `call()` and puts the message into `CommandResult.errors`.\n * Does NOT extend `ApplicationError` (which requires i18n keys + error codes).\n * Not routed through GlobalErrorHandler.\n */\nexport class CommandError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'CommandError'\n }\n}\n","import 'reflect-metadata'\n\nimport { COMMAND_INTERNALS } from './constants'\nimport { CommandError } from './errors/command.error'\nimport type { CommandInput, CommandInternals, CommandResult } from './types'\n\n/**\n * Abstract base class for Quarry commands.\n *\n * Subclasses define a static `command` signature string and implement `handle()`.\n *\n * @example\n * ```typescript\n * export class GreetCommand extends Command {\n * static command = 'greet {name : The name to greet} {--loud}'\n * static description = 'Greet someone'\n *\n * async handle(): Promise<void> {\n * const name = this.string('name')\n * const loud = this.boolean('loud')\n * this.info(loud ? `HELLO, ${name.toUpperCase()}!` : `Hello, ${name}!`)\n * }\n * }\n * ```\n */\nexport abstract class Command {\n /**\n * Laravel-style command signature string.\n *\n * **Command names:**\n * - `'greet'` — flat command (`quarry greet`)\n * - `'task add'` — subcommand hierarchy via spaces (`quarry task add`)\n * - `'task:add'` — namespaced flat command via colons (`quarry task:add`)\n *\n * **Arguments:**\n * - `{name}` — required argument\n * - `{name?}` — optional argument\n * - `{name=default}` — argument with default value\n * - `{name*}` — array/variadic argument\n * - `{name : description}` — argument with description\n *\n * **Options:**\n * - `{--flag}` — boolean flag\n * - `{--name=}` — option that accepts a value\n * - `{--name=default}` — option with default value\n * - `{--name=*}` — array option (multiple values)\n * - `{--A|name}` — option with single-char alias\n * - `{--name= : description}` — option with description\n *\n * @example\n * ```typescript\n * // Namespaced flat command: `quarry users:create ...`\n * static command = 'users:create {email : The user email} {--A|admin} {--R|role= : Assign a role}'\n *\n * // Subcommand hierarchy: `quarry users create ...`\n * static command = 'users create {email : The user email} {--A|admin} {--R|role= : Assign a role}'\n * ```\n */\n static command: string\n /** Human-readable description */\n static description?: string\n /** Alternative command names */\n static aliases?: string[];\n\n [COMMAND_INTERNALS]: CommandInternals\n\n constructor() {\n this[COMMAND_INTERNALS] = {\n inputs: {},\n output: [],\n errors: [],\n exitCode: 0,\n quarry: null,\n }\n }\n\n /**\n * Implement this method with the command's logic.\n * Return a number to set the exit code, or void for exit code 0.\n */\n // eslint-disable-next-line @typescript-eslint/no-invalid-void-type\n abstract handle(): number | void | Promise<number | void>\n\n // ── Input Accessors ──────────────────────────────────────────────\n\n /**\n * Get an input value with generic type.\n */\n input<T>(name: string): T {\n return this[COMMAND_INTERNALS].inputs[name] as T\n }\n\n /**\n * Get a string input. Throws CommandError if present but not a string.\n */\n string(name: string): string {\n const value = this[COMMAND_INTERNALS].inputs[name]\n if (value === undefined || value === null) {\n return ''\n }\n if (typeof value !== 'string') {\n throw new CommandError(`Input \"${name}\" expected a string, got ${typeof value}`)\n }\n return value\n }\n\n /**\n * Get a boolean input. Throws CommandError if present but not a boolean.\n */\n boolean(name: string): boolean {\n const value = this[COMMAND_INTERNALS].inputs[name]\n if (value === undefined || value === null) {\n return false\n }\n if (typeof value !== 'boolean') {\n throw new CommandError(`Input \"${name}\" expected a boolean, got ${typeof value}`)\n }\n return value\n }\n\n /**\n * Get a number input. Coerces strings to numbers. Throws CommandError on NaN.\n */\n number(name: string): number {\n const value = this[COMMAND_INTERNALS].inputs[name]\n if (value === undefined || value === null) {\n return 0\n }\n const num = typeof value === 'string' ? Number(value) : value\n if (typeof num !== 'number' || Number.isNaN(num)) {\n throw new CommandError(`Input \"${name}\" expected a number, got ${typeof value}`)\n }\n return num\n }\n\n /**\n * Get an array input. Throws CommandError if present but not an array.\n */\n array(name: string): string[] {\n const value = this[COMMAND_INTERNALS].inputs[name]\n if (value === undefined || value === null) {\n return []\n }\n if (!Array.isArray(value)) {\n throw new CommandError(`Input \"${name}\" expected an array, got ${typeof value}`)\n }\n return value as string[]\n }\n\n // ── Output Helpers ───────────────────────────────────────────────\n\n /** Write an informational message to output */\n info(message: string): void {\n this[COMMAND_INTERNALS].output.push(message)\n }\n\n /** Write a success message to output */\n success(message: string): void {\n this[COMMAND_INTERNALS].output.push(message)\n }\n\n /** Write a warning message to output */\n warn(message: string): void {\n this[COMMAND_INTERNALS].output.push(`Warning: ${message}`)\n }\n\n /** Write an error message to errors */\n error(message: string): void {\n this[COMMAND_INTERNALS].errors.push(message)\n }\n\n /** Write a plain line to output */\n line(message?: string): void {\n this[COMMAND_INTERNALS].output.push(message ?? '')\n }\n\n /** Write an empty line to output */\n newLine(): void {\n this[COMMAND_INTERNALS].output.push('')\n }\n\n /** Write a comment-style line to output */\n comment(message: string): void {\n this[COMMAND_INTERNALS].output.push(`// ${message}`)\n }\n\n /** Write a formatted table to output */\n table(headers: string[], rows: string[][]): void {\n const colWidths = headers.map((h, i) => {\n const maxRow = rows.reduce((max, row) => Math.max(max, (row[i] ?? '').length), 0)\n return Math.max(h.length, maxRow)\n })\n\n const formatRow = (cells: string[]) =>\n cells.map((cell, i) => cell.padEnd(colWidths[i])).join(' ')\n\n this[COMMAND_INTERNALS].output.push(formatRow(headers))\n this[COMMAND_INTERNALS].output.push(colWidths.map((w) => '-'.repeat(w)).join(' '))\n for (const row of rows) {\n this[COMMAND_INTERNALS].output.push(formatRow(row))\n }\n }\n\n /** Write an error message and set exit code */\n fail(message: string, exitCode = 1): void {\n this[COMMAND_INTERNALS].errors.push(message)\n this[COMMAND_INTERNALS].exitCode = exitCode\n }\n\n // ── Command Calling ──────────────────────────────────────────────\n\n /**\n * Call another command from within this command.\n * Delegates to Quarry.call() via internal reference.\n */\n async call(name: string, input?: CommandInput): Promise<CommandResult> {\n const internals = this[COMMAND_INTERNALS]\n if (!internals.quarry) {\n throw new CommandError('Cannot call commands: Quarry reference not set')\n }\n return internals.quarry.call(name, input)\n }\n}\n"],"mappings":";;;;;;AAIA,MAAa,oBAAoB,OAAO,IAAI,4BAA4B;;;;;;;;;;ACGxE,IAAa,eAAb,cAAkC,MAAM;CACtC,YAAY,SAAiB;AAC3B,QAAM,QAAQ;AACd,OAAK,OAAO;;;;;;;;;;;;;;;;;;;;;;;;ACehB,IAAsB,UAAtB,MAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiC5B,OAAO;;CAEP,OAAO;;CAEP,OAAO;CAEP,CAAC;CAED,cAAc;AACZ,OAAK,qBAAqB;GACxB,QAAQ,EAAE;GACV,QAAQ,EAAE;GACV,QAAQ,EAAE;GACV,UAAU;GACV,QAAQ;GACT;;;;;CAeH,MAAS,MAAiB;AACxB,SAAO,KAAK,mBAAmB,OAAO;;;;;CAMxC,OAAO,MAAsB;EAC3B,MAAM,QAAQ,KAAK,mBAAmB,OAAO;AAC7C,MAAI,UAAU,KAAA,KAAa,UAAU,KACnC,QAAO;AAET,MAAI,OAAO,UAAU,SACnB,OAAM,IAAI,aAAa,UAAU,KAAK,2BAA2B,OAAO,QAAQ;AAElF,SAAO;;;;;CAMT,QAAQ,MAAuB;EAC7B,MAAM,QAAQ,KAAK,mBAAmB,OAAO;AAC7C,MAAI,UAAU,KAAA,KAAa,UAAU,KACnC,QAAO;AAET,MAAI,OAAO,UAAU,UACnB,OAAM,IAAI,aAAa,UAAU,KAAK,4BAA4B,OAAO,QAAQ;AAEnF,SAAO;;;;;CAMT,OAAO,MAAsB;EAC3B,MAAM,QAAQ,KAAK,mBAAmB,OAAO;AAC7C,MAAI,UAAU,KAAA,KAAa,UAAU,KACnC,QAAO;EAET,MAAM,MAA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AO,KAAK,UAAU,KAAK,MAAM,IAAI,OAAO,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC;AACnF,OAAK,MAAM,OAAO,KAChB,MAAK,mBAAmB,OAAO,KAAK,UAAU,IAAI,CAAC;;;CAKvD,KAAK,SAAiB,WAAW,GAAS;AACxC,OAAK,mBAAmB,OAAO,KAAK,QAAQ;AAC5C,OAAK,mBAAmB,WAAW;;;;;;CASrC,MAAM,KAAK,MAAc,OAA8C;EACrE,MAAM,YAAY,KAAK;AACvB,MAAI,CAAC,UAAU,OACb,OAAM,IAAI,aAAa,iDAAiD;AAE1E,SAAO,UAAU,OAAO,KAAK,MAAM,MAAM"}
|
|
1
|
+
{"version":3,"file":"command-B1CPgsrU.mjs","names":[],"sources":["../src/quarry/constants.ts","../src/quarry/errors/command.error.ts","../src/quarry/command.ts"],"sourcesContent":["/**\n * Symbol key for storing internal mutable state on Command instances.\n * Keeps internal state hidden from user-facing autocomplete.\n */\nexport const COMMAND_INTERNALS = Symbol.for('stratal:command:internals')\n","/**\n * User-facing command error with a plain English message.\n *\n * Quarry catches this in `call()` and puts the message into `CommandResult.errors`.\n * Does NOT extend `ApplicationError` (which requires i18n keys + error codes).\n * Not routed through GlobalErrorHandler.\n */\nexport class CommandError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'CommandError'\n }\n}\n","import 'reflect-metadata'\n\nimport { bold, cyan, dim, green, red, yellow } from './colors'\nimport { COMMAND_INTERNALS } from './constants'\nimport { CommandError } from './errors/command.error'\nimport type { CommandInput, CommandInternals, CommandResult } from './types'\n\n/**\n * Abstract base class for Quarry commands.\n *\n * Subclasses define a static `command` signature string and implement `handle()`.\n *\n * @example\n * ```typescript\n * export class GreetCommand extends Command {\n * static command = 'greet {name : The name to greet} {--loud}'\n * static description = 'Greet someone'\n *\n * async handle(): Promise<void> {\n * const name = this.string('name')\n * const loud = this.boolean('loud')\n * this.info(loud ? `HELLO, ${name.toUpperCase()}!` : `Hello, ${name}!`)\n * }\n * }\n * ```\n */\nexport abstract class Command {\n /**\n * Laravel-style command signature string.\n *\n * **Command names:**\n * - `'greet'` — flat command (`quarry greet`)\n * - `'task add'` — subcommand hierarchy via spaces (`quarry task add`)\n * - `'task:add'` — namespaced flat command via colons (`quarry task:add`)\n *\n * **Arguments:**\n * - `{name}` — required argument\n * - `{name?}` — optional argument\n * - `{name=default}` — argument with default value\n * - `{name*}` — array/variadic argument\n * - `{name : description}` — argument with description\n *\n * **Options:**\n * - `{--flag}` — boolean flag\n * - `{--name=}` — option that accepts a value\n * - `{--name=default}` — option with default value\n * - `{--name=*}` — array option (multiple values)\n * - `{--A|name}` — option with single-char alias\n * - `{--name= : description}` — option with description\n *\n * @example\n * ```typescript\n * // Namespaced flat command: `quarry users:create ...`\n * static command = 'users:create {email : The user email} {--A|admin} {--R|role= : Assign a role}'\n *\n * // Subcommand hierarchy: `quarry users create ...`\n * static command = 'users create {email : The user email} {--A|admin} {--R|role= : Assign a role}'\n * ```\n */\n static command: string\n /** Human-readable description */\n static description?: string\n /** Alternative command names */\n static aliases?: string[];\n\n [COMMAND_INTERNALS]: CommandInternals\n\n constructor() {\n this[COMMAND_INTERNALS] = {\n inputs: {},\n output: [],\n errors: [],\n exitCode: 0,\n quarry: null,\n }\n }\n\n /**\n * Implement this method with the command's logic.\n * Return a number to set the exit code, or void for exit code 0.\n */\n // eslint-disable-next-line @typescript-eslint/no-invalid-void-type\n abstract handle(): number | void | Promise<number | void>\n\n // ── Input Accessors ──────────────────────────────────────────────\n\n /**\n * Get an input value with generic type.\n */\n input<T>(name: string): T {\n return this[COMMAND_INTERNALS].inputs[name] as T\n }\n\n /**\n * Get a string input. Throws CommandError if present but not a string.\n */\n string(name: string): string {\n const value = this[COMMAND_INTERNALS].inputs[name]\n if (value === undefined || value === null) {\n return ''\n }\n if (typeof value !== 'string') {\n throw new CommandError(`Input \"${name}\" expected a string, got ${typeof value}`)\n }\n return value\n }\n\n /**\n * Get a boolean input. Throws CommandError if present but not a boolean.\n */\n boolean(name: string): boolean {\n const value = this[COMMAND_INTERNALS].inputs[name]\n if (value === undefined || value === null) {\n return false\n }\n if (typeof value !== 'boolean') {\n throw new CommandError(`Input \"${name}\" expected a boolean, got ${typeof value}`)\n }\n return value\n }\n\n /**\n * Get a number input. Coerces strings to numbers. Throws CommandError on NaN.\n */\n number(name: string): number {\n const value = this[COMMAND_INTERNALS].inputs[name]\n if (value === undefined || value === null) {\n return 0\n }\n const num = typeof value === 'string' ? Number(value) : value\n if (typeof num !== 'number' || Number.isNaN(num)) {\n throw new CommandError(`Input \"${name}\" expected a number, got ${typeof value}`)\n }\n return num\n }\n\n /**\n * Get an array input. Throws CommandError if present but not an array.\n */\n array(name: string): string[] {\n const value = this[COMMAND_INTERNALS].inputs[name]\n if (value === undefined || value === null) {\n return []\n }\n if (!Array.isArray(value)) {\n throw new CommandError(`Input \"${name}\" expected an array, got ${typeof value}`)\n }\n return value as string[]\n }\n\n // ── Output Helpers ───────────────────────────────────────────────\n\n /** Write an informational message to output */\n info(message: string): void {\n this[COMMAND_INTERNALS].output.push(cyan(message))\n }\n\n /** Write a success message to output */\n success(message: string): void {\n this[COMMAND_INTERNALS].output.push(`${green(bold('✔'))} ${green(message)}`)\n }\n\n /** Write a warning message to output */\n warn(message: string): void {\n this[COMMAND_INTERNALS].output.push(`${yellow(bold('⚠'))} ${yellow(message)}`)\n }\n\n /** Write an error message to errors */\n error(message: string): void {\n this[COMMAND_INTERNALS].errors.push(red(message))\n }\n\n /** Write a plain line to output */\n line(message?: string): void {\n this[COMMAND_INTERNALS].output.push(message ?? '')\n }\n\n /** Write an empty line to output */\n newLine(): void {\n this[COMMAND_INTERNALS].output.push('')\n }\n\n /** Write a comment-style line to output */\n comment(message: string): void {\n this[COMMAND_INTERNALS].output.push(dim(`// ${message}`))\n }\n\n /** Write a formatted table to output */\n table(headers: string[], rows: string[][]): void {\n const colWidths = headers.map((h, i) => {\n const maxRow = rows.reduce((max, row) => Math.max(max, (row[i] ?? '').length), 0)\n return Math.max(h.length, maxRow)\n })\n\n const formatRow = (cells: string[]) =>\n cells.map((cell, i) => cell.padEnd(colWidths[i])).join(' ')\n\n this[COMMAND_INTERNALS].output.push(bold(formatRow(headers)))\n this[COMMAND_INTERNALS].output.push(dim(colWidths.map((w) => '-'.repeat(w)).join(' ')))\n for (const row of rows) {\n this[COMMAND_INTERNALS].output.push(formatRow(row))\n }\n }\n\n /** Write an error message and set exit code */\n fail(message: string, exitCode = 1): void {\n this[COMMAND_INTERNALS].errors.push(`${red(bold('✖'))} ${red(message)}`)\n this[COMMAND_INTERNALS].exitCode = exitCode\n }\n\n // ── Command Calling ──────────────────────────────────────────────\n\n /**\n * Call another command from within this command.\n * Delegates to Quarry.call() via internal reference.\n */\n async call(name: string, input?: CommandInput): Promise<CommandResult> {\n const internals = this[COMMAND_INTERNALS]\n if (!internals.quarry) {\n throw new CommandError('Cannot call commands: Quarry reference not set')\n }\n const result = await internals.quarry.call(name, input)\n\n // Forward child output/errors into parent (like Clipanion context switches)\n internals.output.push(...result.output)\n internals.errors.push(...result.errors)\n\n return result\n }\n}\n"],"mappings":";;;;;;;AAIA,MAAa,oBAAoB,OAAO,IAAI,4BAA4B;;;;;;;;;;ACGxE,IAAa,eAAb,cAAkC,MAAM;CACtC,YAAY,SAAiB;AAC3B,QAAM,QAAQ;AACd,OAAK,OAAO;;;;;;;;;;;;;;;;;;;;;;;;ACgBhB,IAAsB,UAAtB,MAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiC5B,OAAO;;CAEP,OAAO;;CAEP,OAAO;CAEP,CAAC;CAED,cAAc;AACZ,OAAK,qBAAqB;GACxB,QAAQ,EAAE;GACV,QAAQ,EAAE;GACV,QAAQ,EAAE;GACV,UAAU;GACV,QAAQ;GACT;;;;;CAeH,MAAS,MAAiB;AACxB,SAAO,KAAK,mBAAmB,OAAO;;;;;CAMxC,OAAO,MAAsB;EAC3B,MAAM,QAAQ,KAAK,mBAAmB,OAAO;AAC7C,MAAI,UA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|
|
|
1
|
-
import {
|
|
1
|
+
import { a as CommandInternals, i as CommandInput, o as CommandResult } from "./application-DfPtIzxF.mjs";
|
|
2
2
|
//#region src/quarry/constants.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Symbol key for storing internal mutable state on Command instances.
|
|
@@ -117,4 +117,4 @@ declare abstract class Command {
|
|
|
117
117
|
}
|
|
118
118
|
//#endregion
|
|
119
119
|
export { Command as t };
|
|
120
|
-
//# sourceMappingURL=command-
|
|
120
|
+
//# sourceMappingURL=command-TnkPYWta.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-
|
|
1
|
+
{"version":3,"file":"command-TnkPYWta.d.mts","names":[],"sources":["../src/quarry/constants.ts","../src/quarry/command.ts"],"mappings":";;;;;;cAIa,iBAAA;;;;AAAb;;;;;;;;ACsBA;;;;;;;;;;uBAAsB,OAAA;EA8LmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA,OA7JhD,OAAA;EA4HC;EAAA,OA1HD,WAAA;EA+HD;EAAA,OA7HC,OAAA;EAAA,CAEN,iBAAA,GAAoB,gBAAA;;EA4IC;;;;EAAA,SA3Hb,MAAA,CAAA,mBAA0B,OAAA;EAsIa;;;EA/HhD,KAAA,GAAA,CAAS,IAAA,WAAe,CAAA;;;;EAOxB,MAAA,CAAO,IAAA;;;;EAcP,OAAA,CAAQ,IAAA;;;;EAcR,MAAA,CAAO,IAAA;;;;EAeP,KAAA,CAAM,IAAA;;EAcN,IAAA,CAAK,OAAA;;EAKL,OAAA,CAAQ,OAAA;;EAKR,IAAA,CAAK,OAAA;;EAKL,KAAA,CAAM,OAAA;;EAKN,IAAA,CAAK,OAAA;;EAKL,OAAA,CAAA;;EAKA,OAAA,CAAQ,OAAA;;EAKR,KAAA,CAAM,OAAA,YAAmB,IAAA;;EAiBzB,IAAA,CAAK,OAAA,UAAiB,QAAA;;;;;EAWhB,IAAA,CAAK,IAAA,UAAc,KAAA,GAAQ,YAAA,GAAe,OAAA,CAAQ,aAAA;AAAA"}
|
package/dist/config/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as z } from "../index-
|
|
1
|
+
import { at as DynamicModule, ft as OnInitialize, st as FactoryProvider, ut as ModuleContext } from "../index-BFCxSp_f.mjs";
|
|
2
|
+
import { o as z } from "../index-NGxg-KP_.mjs";
|
|
3
3
|
import { InjectionToken } from "tsyringe";
|
|
4
4
|
|
|
5
5
|
//#region src/config/config.tokens.d.ts
|
package/dist/config/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { S as ApplicationError, b as ERROR_CODES, s as Scope } from "../errors-
|
|
2
|
-
import {
|
|
3
|
-
import "../
|
|
4
|
-
import
|
|
5
|
-
import "../
|
|
6
|
-
import "../
|
|
7
|
-
import "../
|
|
8
|
-
import "../
|
|
9
|
-
import "../
|
|
10
|
-
import "../
|
|
1
|
+
import { S as ApplicationError, b as ERROR_CODES, s as Scope } from "../errors-DSKapqD8.mjs";
|
|
2
|
+
import { a as __decorate, d as Transient, g as DI_TOKENS } from "../logger-CGT91VY6.mjs";
|
|
3
|
+
import { r as Module } from "../module-tUtyVJ5E.mjs";
|
|
4
|
+
import "../events-CvUSgEuN.mjs";
|
|
5
|
+
import "../middleware-Bl-b5pkt.mjs";
|
|
6
|
+
import "../router-context-D9R1v2Ac.mjs";
|
|
7
|
+
import "../colors-Y7WIFXs7.mjs";
|
|
8
|
+
import "../command-B1CPgsrU.mjs";
|
|
9
|
+
import "../is-command-DJVI6wEJ.mjs";
|
|
10
|
+
import "../is-seeder-D5MIEcdz.mjs";
|
|
11
11
|
//#region src/config/config.tokens.ts
|
|
12
12
|
const CONFIG_TOKENS = { ConfigService: Symbol.for("stratal:config:service") };
|
|
13
13
|
//#endregion
|