@forge-ts/cli 0.13.0 → 0.15.0
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/chunk-7UPSAG3L.js +44 -0
- package/dist/chunk-7UPSAG3L.js.map +1 -0
- package/dist/chunk-CINQWGH7.js +344 -0
- package/dist/chunk-CINQWGH7.js.map +1 -0
- package/dist/chunk-ZFFY4AQX.js +73 -0
- package/dist/chunk-ZFFY4AQX.js.map +1 -0
- package/dist/index.d.ts +246 -1
- package/dist/index.js +646 -161
- package/dist/index.js.map +1 -1
- package/dist/init-project-5DESIZ73.js +14 -0
- package/dist/init-project-5DESIZ73.js.map +1 -0
- package/dist/logger-MMBBZG6U.js +8 -0
- package/dist/logger-MMBBZG6U.js.map +1 -0
- package/dist/output-OSCHMPOX.js +10 -0
- package/dist/output-OSCHMPOX.js.map +1 -0
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -521,6 +521,134 @@ declare const checkCommand: citty.CommandDef<{
|
|
|
521
521
|
};
|
|
522
522
|
}>;
|
|
523
523
|
|
|
524
|
+
/**
|
|
525
|
+
* Status of a single doctor check.
|
|
526
|
+
* @public
|
|
527
|
+
*/
|
|
528
|
+
type DoctorCheckStatus = "pass" | "warn" | "error" | "info";
|
|
529
|
+
/**
|
|
530
|
+
* Result of a single doctor check.
|
|
531
|
+
*
|
|
532
|
+
* @public
|
|
533
|
+
*/
|
|
534
|
+
interface DoctorCheckResult {
|
|
535
|
+
/** Name of the check. */
|
|
536
|
+
name: string;
|
|
537
|
+
/** Status of the check. */
|
|
538
|
+
status: DoctorCheckStatus;
|
|
539
|
+
/** Human-readable message. */
|
|
540
|
+
message: string;
|
|
541
|
+
/** Whether this issue can be auto-fixed with --fix. */
|
|
542
|
+
fixable: boolean;
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Result of the `doctor` command.
|
|
546
|
+
*
|
|
547
|
+
* @example
|
|
548
|
+
* ```typescript
|
|
549
|
+
* import { runDoctor } from "@forge-ts/cli/commands/doctor";
|
|
550
|
+
* const output = await runDoctor({ cwd: process.cwd() });
|
|
551
|
+
* console.log(output.data.summary.passed); // number of passed checks
|
|
552
|
+
* ```
|
|
553
|
+
* @public
|
|
554
|
+
*/
|
|
555
|
+
interface DoctorResult {
|
|
556
|
+
/** Whether all checks passed without errors. */
|
|
557
|
+
success: boolean;
|
|
558
|
+
/** Individual check results. */
|
|
559
|
+
checks: DoctorCheckResult[];
|
|
560
|
+
/** Summary counts. */
|
|
561
|
+
summary: {
|
|
562
|
+
passed: number;
|
|
563
|
+
warnings: number;
|
|
564
|
+
errors: number;
|
|
565
|
+
info: number;
|
|
566
|
+
};
|
|
567
|
+
/** Files that were fixed (only populated when --fix is used). */
|
|
568
|
+
fixed: string[];
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Arguments for the `doctor` command.
|
|
572
|
+
* @internal
|
|
573
|
+
*/
|
|
574
|
+
interface DoctorArgs {
|
|
575
|
+
/** Project root directory (default: cwd). */
|
|
576
|
+
cwd?: string;
|
|
577
|
+
/** Auto-fix resolvable issues. */
|
|
578
|
+
fix?: boolean;
|
|
579
|
+
/** MVI verbosity level for structured output. */
|
|
580
|
+
mvi?: string;
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Runs the doctor integrity check flow.
|
|
584
|
+
*
|
|
585
|
+
* Checks:
|
|
586
|
+
* 1. forge-ts.config.ts — exists and loadable
|
|
587
|
+
* 2. tsdoc.json — exists and extends @forge-ts/tsdoc-config
|
|
588
|
+
* 3. @forge-ts/tsdoc-config — installed in node_modules
|
|
589
|
+
* 4. TypeScript — installed
|
|
590
|
+
* 5. tsconfig.json — exists and has strict mode
|
|
591
|
+
* 6. biome.json — exists (informational)
|
|
592
|
+
* 7. .forge-lock.json — exists, valid, matches config
|
|
593
|
+
* 8. .forge-audit.jsonl — exists and event count
|
|
594
|
+
* 9. .forge-bypass.json — exists and active bypasses
|
|
595
|
+
* 10. Git hooks — forge-ts check in pre-commit
|
|
596
|
+
*
|
|
597
|
+
* @param args - CLI arguments for the doctor command.
|
|
598
|
+
* @returns A typed `CommandOutput<DoctorResult>`.
|
|
599
|
+
* @example
|
|
600
|
+
* ```typescript
|
|
601
|
+
* import { runDoctor } from "@forge-ts/cli/commands/doctor";
|
|
602
|
+
* const output = await runDoctor({ cwd: process.cwd(), fix: false });
|
|
603
|
+
* console.log(output.data.summary); // { passed: 7, warnings: 2, errors: 1, info: 0 }
|
|
604
|
+
* ```
|
|
605
|
+
* @public
|
|
606
|
+
*/
|
|
607
|
+
declare function runDoctor(args: DoctorArgs): Promise<CommandOutput<DoctorResult>>;
|
|
608
|
+
/**
|
|
609
|
+
* Citty command definition for `forge-ts doctor`.
|
|
610
|
+
*
|
|
611
|
+
* Performs project integrity checks and optionally auto-fixes
|
|
612
|
+
* resolvable issues with `--fix`.
|
|
613
|
+
*
|
|
614
|
+
* @example
|
|
615
|
+
* ```typescript
|
|
616
|
+
* import { doctorCommand } from "@forge-ts/cli/commands/doctor";
|
|
617
|
+
* // Registered as a top-level subcommand of `forge-ts`
|
|
618
|
+
* ```
|
|
619
|
+
* @public
|
|
620
|
+
*/
|
|
621
|
+
declare const doctorCommand: citty.CommandDef<{
|
|
622
|
+
readonly cwd: {
|
|
623
|
+
readonly type: "string";
|
|
624
|
+
readonly description: "Project root directory";
|
|
625
|
+
};
|
|
626
|
+
readonly fix: {
|
|
627
|
+
readonly type: "boolean";
|
|
628
|
+
readonly description: "Auto-fix resolvable issues";
|
|
629
|
+
readonly default: false;
|
|
630
|
+
};
|
|
631
|
+
readonly json: {
|
|
632
|
+
readonly type: "boolean";
|
|
633
|
+
readonly description: "Output as LAFS JSON envelope";
|
|
634
|
+
readonly default: false;
|
|
635
|
+
};
|
|
636
|
+
readonly human: {
|
|
637
|
+
readonly type: "boolean";
|
|
638
|
+
readonly description: "Output as formatted text";
|
|
639
|
+
readonly default: false;
|
|
640
|
+
};
|
|
641
|
+
readonly quiet: {
|
|
642
|
+
readonly type: "boolean";
|
|
643
|
+
readonly description: "Suppress non-essential output";
|
|
644
|
+
readonly default: false;
|
|
645
|
+
};
|
|
646
|
+
readonly mvi: {
|
|
647
|
+
readonly type: "string";
|
|
648
|
+
readonly description: "MVI verbosity level: minimal, standard, full";
|
|
649
|
+
};
|
|
650
|
+
}>;
|
|
651
|
+
|
|
524
652
|
/**
|
|
525
653
|
* The `forge-ts docs dev` command — starts a local doc preview server.
|
|
526
654
|
*
|
|
@@ -766,6 +894,123 @@ declare const initHooksCommand: citty.CommandDef<{
|
|
|
766
894
|
};
|
|
767
895
|
}>;
|
|
768
896
|
|
|
897
|
+
/**
|
|
898
|
+
* Detected project environment from Step 1 of the init flow.
|
|
899
|
+
*
|
|
900
|
+
* @public
|
|
901
|
+
*/
|
|
902
|
+
interface InitProjectEnvironment {
|
|
903
|
+
/** Whether package.json exists. */
|
|
904
|
+
packageJsonExists: boolean;
|
|
905
|
+
/** Whether tsconfig.json exists. */
|
|
906
|
+
tsconfigExists: boolean;
|
|
907
|
+
/** Whether biome.json or biome.jsonc exists. */
|
|
908
|
+
biomeDetected: boolean;
|
|
909
|
+
/** TypeScript version from dependencies, or null if not found. */
|
|
910
|
+
typescriptVersion: string | null;
|
|
911
|
+
/** Detected hook manager. */
|
|
912
|
+
hookManager: "husky" | "lefthook" | "none";
|
|
913
|
+
/** Whether the project is a monorepo. */
|
|
914
|
+
monorepo: boolean;
|
|
915
|
+
/** Monorepo type if detected. */
|
|
916
|
+
monorepoType: "pnpm" | "npm/yarn" | null;
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* Result of the `init` (project setup) command.
|
|
920
|
+
*
|
|
921
|
+
* @example
|
|
922
|
+
* ```typescript
|
|
923
|
+
* import { runInitProject } from "@forge-ts/cli/commands/init-project";
|
|
924
|
+
* const output = await runInitProject({ cwd: process.cwd() });
|
|
925
|
+
* console.log(output.data.created); // list of created files
|
|
926
|
+
* ```
|
|
927
|
+
* @public
|
|
928
|
+
*/
|
|
929
|
+
interface InitProjectResult {
|
|
930
|
+
/** Whether the init succeeded. */
|
|
931
|
+
success: boolean;
|
|
932
|
+
/** Files that were created. */
|
|
933
|
+
created: string[];
|
|
934
|
+
/** Files that already existed and were skipped. */
|
|
935
|
+
skipped: string[];
|
|
936
|
+
/** Warning messages collected during init. */
|
|
937
|
+
warnings: string[];
|
|
938
|
+
/** Detected project environment. */
|
|
939
|
+
environment: InitProjectEnvironment;
|
|
940
|
+
/** Next steps for the user. */
|
|
941
|
+
nextSteps: string[];
|
|
942
|
+
}
|
|
943
|
+
/**
|
|
944
|
+
* Arguments for the `init` (project setup) command.
|
|
945
|
+
* @internal
|
|
946
|
+
*/
|
|
947
|
+
interface InitProjectArgs {
|
|
948
|
+
/** Project root directory (default: cwd). */
|
|
949
|
+
cwd?: string;
|
|
950
|
+
/** MVI verbosity level for structured output. */
|
|
951
|
+
mvi?: string;
|
|
952
|
+
}
|
|
953
|
+
/**
|
|
954
|
+
* Runs the full project init flow.
|
|
955
|
+
*
|
|
956
|
+
* Steps:
|
|
957
|
+
* 1. Detect project environment
|
|
958
|
+
* 2. Write forge-ts.config.ts (if not exists)
|
|
959
|
+
* 3. Write tsdoc.json (if not exists)
|
|
960
|
+
* 4. Validate tsconfig.json strictness
|
|
961
|
+
* 5. Validate package.json
|
|
962
|
+
* 6. Report summary
|
|
963
|
+
*
|
|
964
|
+
* @param args - CLI arguments for the init command.
|
|
965
|
+
* @returns A typed `CommandOutput<InitProjectResult>`.
|
|
966
|
+
* @example
|
|
967
|
+
* ```typescript
|
|
968
|
+
* import { runInitProject } from "@forge-ts/cli/commands/init-project";
|
|
969
|
+
* const output = await runInitProject({ cwd: process.cwd() });
|
|
970
|
+
* console.log(output.data.created); // ["forge-ts.config.ts", "tsdoc.json"]
|
|
971
|
+
* ```
|
|
972
|
+
* @public
|
|
973
|
+
*/
|
|
974
|
+
declare function runInitProject(args: InitProjectArgs): Promise<CommandOutput<InitProjectResult>>;
|
|
975
|
+
/**
|
|
976
|
+
* Citty command definition for `forge-ts init` (bare — full project setup).
|
|
977
|
+
*
|
|
978
|
+
* Detects the project environment, writes default configuration files,
|
|
979
|
+
* validates tsconfig/package.json, and reports a summary.
|
|
980
|
+
*
|
|
981
|
+
* @example
|
|
982
|
+
* ```typescript
|
|
983
|
+
* import { initProjectCommand } from "@forge-ts/cli/commands/init-project";
|
|
984
|
+
* // Registered as the default handler for `forge-ts init`
|
|
985
|
+
* ```
|
|
986
|
+
* @public
|
|
987
|
+
*/
|
|
988
|
+
declare const initProjectCommand: citty.CommandDef<{
|
|
989
|
+
readonly cwd: {
|
|
990
|
+
readonly type: "string";
|
|
991
|
+
readonly description: "Project root directory";
|
|
992
|
+
};
|
|
993
|
+
readonly json: {
|
|
994
|
+
readonly type: "boolean";
|
|
995
|
+
readonly description: "Output as LAFS JSON envelope";
|
|
996
|
+
readonly default: false;
|
|
997
|
+
};
|
|
998
|
+
readonly human: {
|
|
999
|
+
readonly type: "boolean";
|
|
1000
|
+
readonly description: "Output as formatted text";
|
|
1001
|
+
readonly default: false;
|
|
1002
|
+
};
|
|
1003
|
+
readonly quiet: {
|
|
1004
|
+
readonly type: "boolean";
|
|
1005
|
+
readonly description: "Suppress non-essential output";
|
|
1006
|
+
readonly default: false;
|
|
1007
|
+
};
|
|
1008
|
+
readonly mvi: {
|
|
1009
|
+
readonly type: "string";
|
|
1010
|
+
readonly description: "MVI verbosity level: minimal, standard, full";
|
|
1011
|
+
};
|
|
1012
|
+
}>;
|
|
1013
|
+
|
|
769
1014
|
/**
|
|
770
1015
|
* Typed result for the `lock` command.
|
|
771
1016
|
* @public
|
|
@@ -1128,4 +1373,4 @@ declare function createLogger(options?: {
|
|
|
1128
1373
|
colors?: boolean;
|
|
1129
1374
|
}): Logger;
|
|
1130
1375
|
|
|
1131
|
-
export { type AuditResult, type BuildResult, type BuildStep, type BypassCreateResult, type BypassStatusResult, type CheckFileError, type CheckFileGroup, type CheckFileWarning, type CheckPage, type CheckResult, type CheckRuleCount, type CheckTriage, type CommandOutput, type ForgeCliError, type ForgeCliWarning, type HookManager, type InitDocsResult, type InitHooksResult, type LockResult, type Logger, type OutputFlags, type PrepublishResult, type TestFailure, type TestResult, type UnlockResult, auditCommand, buildCommand, bypassCommand, checkCommand, createLogger, docsDevCommand, emitResult, initDocsCommand, initHooksCommand, lockCommand, prepublishCommand, resolveExitCode, runBypassCreate, runBypassStatus, runDocsDev, runInitHooks, runLock, runPrepublish, runUnlock, testCommand, unlockCommand };
|
|
1376
|
+
export { type AuditResult, type BuildResult, type BuildStep, type BypassCreateResult, type BypassStatusResult, type CheckFileError, type CheckFileGroup, type CheckFileWarning, type CheckPage, type CheckResult, type CheckRuleCount, type CheckTriage, type CommandOutput, type DoctorCheckResult, type DoctorCheckStatus, type DoctorResult, type ForgeCliError, type ForgeCliWarning, type HookManager, type InitDocsResult, type InitHooksResult, type InitProjectEnvironment, type InitProjectResult, type LockResult, type Logger, type OutputFlags, type PrepublishResult, type TestFailure, type TestResult, type UnlockResult, auditCommand, buildCommand, bypassCommand, checkCommand, createLogger, docsDevCommand, doctorCommand, emitResult, initDocsCommand, initHooksCommand, initProjectCommand, lockCommand, prepublishCommand, resolveExitCode, runBypassCreate, runBypassStatus, runDocsDev, runDoctor, runInitHooks, runInitProject, runLock, runPrepublish, runUnlock, testCommand, unlockCommand };
|