@codefast/cli 0.3.7-canary.0 → 0.3.12

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.
Files changed (120) hide show
  1. package/README.md +60 -299
  2. package/dist/bin.d.ts +3 -0
  3. package/dist/bin.d.ts.map +1 -0
  4. package/dist/bin.js +5 -0
  5. package/dist/commands/arrange.d.ts +3 -0
  6. package/dist/commands/arrange.d.ts.map +1 -0
  7. package/dist/commands/arrange.js +114 -0
  8. package/dist/commands/mirror.d.ts +4 -0
  9. package/dist/commands/mirror.d.ts.map +1 -0
  10. package/dist/commands/mirror.js +63 -0
  11. package/dist/lib/arrange/analyze.d.ts +4 -0
  12. package/dist/lib/arrange/analyze.d.ts.map +1 -0
  13. package/dist/lib/arrange/analyze.js +105 -0
  14. package/dist/lib/arrange/ast/collectors-cn.d.ts +10 -0
  15. package/dist/lib/arrange/ast/collectors-cn.d.ts.map +1 -0
  16. package/dist/lib/arrange/ast/collectors-cn.js +84 -0
  17. package/dist/lib/arrange/ast/collectors-jsx.d.ts +4 -0
  18. package/dist/lib/arrange/ast/collectors-jsx.d.ts.map +1 -0
  19. package/dist/lib/arrange/ast/collectors-jsx.js +18 -0
  20. package/dist/lib/arrange/ast/collectors-tv.d.ts +13 -0
  21. package/dist/lib/arrange/ast/collectors-tv.d.ts.map +1 -0
  22. package/dist/lib/arrange/ast/collectors-tv.js +273 -0
  23. package/dist/lib/arrange/ast/targets.d.ts +8 -0
  24. package/dist/lib/arrange/ast/targets.d.ts.map +1 -0
  25. package/dist/lib/arrange/ast/targets.js +143 -0
  26. package/dist/lib/arrange/ast/utils.d.ts +36 -0
  27. package/dist/lib/arrange/ast/utils.d.ts.map +1 -0
  28. package/dist/lib/arrange/ast/utils.js +138 -0
  29. package/dist/lib/arrange/constants.d.ts +68 -0
  30. package/dist/lib/arrange/constants.d.ts.map +1 -0
  31. package/dist/lib/arrange/constants.js +179 -0
  32. package/dist/lib/arrange/errors.d.ts +14 -0
  33. package/dist/lib/arrange/errors.d.ts.map +1 -0
  34. package/dist/lib/arrange/errors.js +16 -0
  35. package/dist/lib/arrange/formatters.d.ts +16 -0
  36. package/dist/lib/arrange/formatters.d.ts.map +1 -0
  37. package/dist/lib/arrange/formatters.js +57 -0
  38. package/dist/lib/arrange/group-file.d.ts +4 -0
  39. package/dist/lib/arrange/group-file.d.ts.map +1 -0
  40. package/dist/lib/arrange/group-file.js +115 -0
  41. package/dist/lib/arrange/grouping.d.ts +41 -0
  42. package/dist/lib/arrange/grouping.d.ts.map +1 -0
  43. package/dist/lib/arrange/grouping.js +280 -0
  44. package/dist/lib/arrange/imports.d.ts +6 -0
  45. package/dist/lib/arrange/imports.d.ts.map +1 -0
  46. package/dist/lib/arrange/imports.js +74 -0
  47. package/dist/lib/arrange/report.d.ts +4 -0
  48. package/dist/lib/arrange/report.d.ts.map +1 -0
  49. package/dist/lib/arrange/report.js +37 -0
  50. package/dist/lib/arrange/run-target.d.ts +4 -0
  51. package/dist/lib/arrange/run-target.d.ts.map +1 -0
  52. package/dist/lib/arrange/run-target.js +28 -0
  53. package/dist/lib/arrange/tokenizer.d.ts +37 -0
  54. package/dist/lib/arrange/tokenizer.d.ts.map +1 -0
  55. package/dist/lib/arrange/tokenizer.js +390 -0
  56. package/dist/lib/arrange/types.d.ts +104 -0
  57. package/dist/lib/arrange/types.d.ts.map +1 -0
  58. package/dist/lib/arrange/types.js +7 -0
  59. package/dist/lib/arrange/walk.d.ts +4 -0
  60. package/dist/lib/arrange/walk.d.ts.map +1 -0
  61. package/dist/lib/arrange/walk.js +34 -0
  62. package/dist/lib/arrange.d.ts +41 -0
  63. package/dist/lib/arrange.d.ts.map +1 -0
  64. package/dist/lib/arrange.js +38 -0
  65. package/dist/lib/infra/fs-contract.d.ts +28 -0
  66. package/dist/lib/infra/fs-contract.d.ts.map +1 -0
  67. package/dist/lib/infra/fs-contract.js +1 -0
  68. package/dist/lib/infra/node-io.d.ts +4 -0
  69. package/dist/lib/infra/node-io.d.ts.map +1 -0
  70. package/dist/lib/infra/node-io.js +27 -0
  71. package/dist/lib/mirror/config.d.ts +7 -0
  72. package/dist/lib/mirror/config.d.ts.map +1 -0
  73. package/dist/lib/mirror/config.js +146 -0
  74. package/dist/lib/mirror/constants.d.ts +10 -0
  75. package/dist/lib/mirror/constants.d.ts.map +1 -0
  76. package/dist/lib/mirror/constants.js +13 -0
  77. package/dist/lib/mirror/engine.d.ts +12 -0
  78. package/dist/lib/mirror/engine.d.ts.map +1 -0
  79. package/dist/lib/mirror/engine.js +248 -0
  80. package/dist/lib/mirror/errors.d.ts +10 -0
  81. package/dist/lib/mirror/errors.d.ts.map +1 -0
  82. package/dist/lib/mirror/errors.js +12 -0
  83. package/dist/lib/mirror/package-filter.d.ts +8 -0
  84. package/dist/lib/mirror/package-filter.d.ts.map +1 -0
  85. package/dist/lib/mirror/package-filter.js +33 -0
  86. package/dist/lib/mirror/reporter.d.ts +24 -0
  87. package/dist/lib/mirror/reporter.d.ts.map +1 -0
  88. package/dist/lib/mirror/reporter.js +126 -0
  89. package/dist/lib/mirror/sync.d.ts +4 -0
  90. package/dist/lib/mirror/sync.d.ts.map +1 -0
  91. package/dist/lib/mirror/sync.js +135 -0
  92. package/dist/lib/mirror/types.d.ts +81 -0
  93. package/dist/lib/mirror/types.d.ts.map +1 -0
  94. package/dist/lib/mirror/types.js +1 -0
  95. package/dist/lib/mirror/update-pkg.d.ts +13 -0
  96. package/dist/lib/mirror/update-pkg.d.ts.map +1 -0
  97. package/dist/lib/mirror/update-pkg.js +39 -0
  98. package/dist/lib/mirror/workspace-packages.d.ts +26 -0
  99. package/dist/lib/mirror/workspace-packages.d.ts.map +1 -0
  100. package/dist/lib/mirror/workspace-packages.js +160 -0
  101. package/dist/lib/mirror.d.ts +7 -0
  102. package/dist/lib/mirror.d.ts.map +1 -0
  103. package/dist/lib/mirror.js +5 -0
  104. package/dist/lib/repo-root.d.ts +7 -0
  105. package/dist/lib/repo-root.d.ts.map +1 -0
  106. package/dist/lib/repo-root.js +23 -0
  107. package/dist/lib/shared/utils.d.ts +9 -0
  108. package/dist/lib/shared/utils.d.ts.map +1 -0
  109. package/dist/lib/shared/utils.js +12 -0
  110. package/dist/program.d.ts +4 -0
  111. package/dist/program.d.ts.map +1 -0
  112. package/dist/program.js +38 -0
  113. package/package.json +42 -53
  114. package/CHANGELOG.md +0 -15
  115. package/dist/cjs/index.cjs +0 -2
  116. package/dist/cjs/src/index.d.ts +0 -3
  117. package/dist/cjs/src/index.d.ts.map +0 -1
  118. package/dist/esm/index.js +0 -2
  119. package/dist/esm/src/index.d.ts +0 -3
  120. package/dist/esm/src/index.d.ts.map +0 -1
@@ -0,0 +1,7 @@
1
+ import type { CliFs } from "#lib/infra/fs-contract";
2
+ /**
3
+ * Resolve the monorepo root (directory containing `pnpm-workspace.yaml`).
4
+ * Tries the compiled package location first, then `process.cwd()`.
5
+ */
6
+ export declare function findRepoRoot(fs: CliFs): string;
7
+ //# sourceMappingURL=repo-root.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo-root.d.ts","sourceRoot":"","sources":["../../src/lib/repo-root.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAEpD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,KAAK,GAAG,MAAM,CAoB9C"}
@@ -0,0 +1,23 @@
1
+ import path from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+ /**
4
+ * Resolve the monorepo root (directory containing `pnpm-workspace.yaml`).
5
+ * Tries the compiled package location first, then `process.cwd()`.
6
+ */
7
+ export function findRepoRoot(fs) {
8
+ const candidates = [path.dirname(fileURLToPath(import.meta.url)), process.cwd()];
9
+ for (const start of candidates) {
10
+ let dir = path.resolve(start);
11
+ for (;;) {
12
+ if (fs.existsSync(path.join(dir, "pnpm-workspace.yaml"))) {
13
+ return dir;
14
+ }
15
+ const parent = path.dirname(dir);
16
+ if (parent === dir) {
17
+ break;
18
+ }
19
+ dir = parent;
20
+ }
21
+ }
22
+ throw new Error(`Could not locate monorepo root (missing pnpm-workspace.yaml). Searched from: ${candidates.join(", ")}`);
23
+ }
@@ -0,0 +1,9 @@
1
+ import type { Dirent } from "node:fs";
2
+ /**
3
+ * Narrow `fs.promises.readdir` overload result to `Dirent[]` when `withFileTypes: true`.
4
+ * Accepts both historical checks (`isFile` / `isDirectory`) in one guard.
5
+ * Returning `true` for an empty array is intentional: callers treat empty lists
6
+ * the same regardless of the element type, so `[]` is safely accepted as `Dirent[]`.
7
+ */
8
+ export declare function isDirentList(x: string[] | Dirent[]): x is Dirent[];
9
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/shared/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,CAAC,IAAI,MAAM,EAAE,CAIlE"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Narrow `fs.promises.readdir` overload result to `Dirent[]` when `withFileTypes: true`.
3
+ * Accepts both historical checks (`isFile` / `isDirectory`) in one guard.
4
+ * Returning `true` for an empty array is intentional: callers treat empty lists
5
+ * the same regardless of the element type, so `[]` is safely accepted as `Dirent[]`.
6
+ */
7
+ export function isDirentList(x) {
8
+ if (x.length === 0)
9
+ return true;
10
+ const first = x[0];
11
+ return typeof first === "object" && first !== null && "isFile" in first && "isDirectory" in first;
12
+ }
@@ -0,0 +1,4 @@
1
+ import { Command } from "commander";
2
+ export declare function createProgram(): Command;
3
+ export declare function runCli(argv: string[]): Promise<number>;
4
+ //# sourceMappingURL=program.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBpC,wBAAgB,aAAa,IAAI,OAAO,CAcvC;AAED,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAK5D"}
@@ -0,0 +1,38 @@
1
+ import { readFileSync } from "node:fs";
2
+ import path from "node:path";
3
+ import process from "node:process";
4
+ import { fileURLToPath } from "node:url";
5
+ import { Command } from "commander";
6
+ import { registerArrangeCommand } from "#commands/arrange";
7
+ import { registerMirrorCommand } from "#commands/mirror";
8
+ function readVersion() {
9
+ try {
10
+ const dir = path.dirname(fileURLToPath(import.meta.url));
11
+ const pkgPath = path.join(dir, "..", "package.json");
12
+ const raw = readFileSync(pkgPath, "utf-8");
13
+ const pkgVersion = JSON.parse(raw).version;
14
+ return typeof pkgVersion === "string" && pkgVersion.length > 0 ? pkgVersion : "unknown";
15
+ }
16
+ catch {
17
+ return "unknown";
18
+ }
19
+ }
20
+ export function createProgram() {
21
+ const program = new Command();
22
+ program
23
+ .name("codefast")
24
+ .description("Codefast monorepo developer CLI")
25
+ .version(readVersion())
26
+ .option("--no-color", "Disable ANSI color output")
27
+ .configureHelp({ sortSubcommands: true })
28
+ .showHelpAfterError("(use --help for usage)");
29
+ registerMirrorCommand(program);
30
+ registerArrangeCommand(program);
31
+ return program;
32
+ }
33
+ export async function runCli(argv) {
34
+ const program = createProgram();
35
+ await program.parseAsync(argv, { from: "node" });
36
+ const code = process.exitCode ?? 0;
37
+ return typeof code === "number" ? code : Number(code) || 0;
38
+ }
package/package.json CHANGED
@@ -1,88 +1,77 @@
1
1
  {
2
2
  "name": "@codefast/cli",
3
- "version": "0.3.7-canary.0",
4
- "description": "Command line interface tools for CodeFast development",
3
+ "version": "0.3.12",
4
+ "description": "Developer CLI for the Codefast monorepo (mirror, arrange)",
5
5
  "keywords": [
6
6
  "cli",
7
- "command-line",
8
- "tools",
9
- "typescript",
7
+ "codefast",
10
8
  "monorepo",
11
- "development"
9
+ "tailwind",
10
+ "tailwindcss",
11
+ "typescript"
12
12
  ],
13
13
  "homepage": "https://github.com/codefastlabs/codefast/tree/main/packages/cli#readme",
14
14
  "bugs": {
15
15
  "url": "https://github.com/codefastlabs/codefast/issues"
16
16
  },
17
+ "license": "MIT",
18
+ "author": "Vuong Phan <mr.thevuong@gmail.com>",
17
19
  "repository": {
18
20
  "type": "git",
19
21
  "url": "git+https://github.com/codefastlabs/codefast.git",
20
22
  "directory": "packages/cli"
21
23
  },
22
- "license": "MIT",
23
- "author": "Vuong Phan <mr.thevuong@gmail.com>",
24
- "sideEffects": false,
25
- "type": "module",
26
- "exports": {
27
- ".": {
28
- "import": {
29
- "default": "./dist/esm/index.js",
30
- "types": "./dist/esm/index.d.ts"
31
- },
32
- "require": {
33
- "default": "./dist/cjs/index.cjs",
34
- "types": "./dist/cjs/index.d.cts"
35
- }
36
- }
37
- },
38
- "main": "./dist/cjs/index.cjs",
39
- "module": "./dist/esm/index.js",
40
- "types": "./dist/esm/index.d.ts",
41
24
  "bin": {
42
- "codefast": "./dist/esm/index.js"
25
+ "codefast": "./dist/bin.js"
43
26
  },
44
27
  "files": [
45
28
  "dist",
46
- "CHANGELOG.md",
29
+ "LICENSE",
47
30
  "README.md",
48
- "LICENSE"
31
+ "package.json"
49
32
  ],
33
+ "type": "module",
34
+ "imports": {
35
+ "#*": [
36
+ "./dist/*.js",
37
+ "./dist/*/index.js",
38
+ "./dist/*",
39
+ "./src/*.ts",
40
+ "./src/*.tsx",
41
+ "./src/*/index.ts",
42
+ "./src/*/index.tsx",
43
+ "./src/*"
44
+ ]
45
+ },
46
+ "publishConfig": {
47
+ "access": "public"
48
+ },
50
49
  "dependencies": {
51
- "chalk": "^5.3.0",
52
- "commander": "^14.0.0",
53
- "fast-glob": "^3.3.2",
54
- "inversify": "^7.6.1",
55
- "reflect-metadata": "^0.2.2",
56
- "ts-morph": "^26.0.0",
57
- "zod": "^4.0.10"
50
+ "commander": "^14.0.3",
51
+ "picomatch": "^4.0.4",
52
+ "typescript": "^6.0.2",
53
+ "yaml": "^2.8.3"
58
54
  },
59
55
  "devDependencies": {
60
- "@rslib/core": "^0.11.0",
61
- "@swc/core": "^1.13.2",
56
+ "@swc/core": "^1.15.24",
62
57
  "@swc/jest": "^0.2.39",
63
58
  "@types/jest": "^30.0.0",
64
- "@types/node": "^24.1.0",
65
- "eslint": "^9.32.0",
66
- "jest": "^30.0.5",
67
- "jiti": "^2.5.1",
68
- "ts-node": "^10.9.2",
69
- "typescript": "^5.8.3",
70
- "@codefast/eslint-config": "0.3.7-canary.0",
71
- "@codefast/typescript-config": "0.3.7-canary.0"
59
+ "@types/node": "^25.6.0",
60
+ "@types/picomatch": "^4.0.3",
61
+ "@typescript/native-preview": "7.0.0-dev.20260411.1",
62
+ "jest": "^30.3.0",
63
+ "@codefast/typescript-config": "0.3.12"
72
64
  },
73
- "publishConfig": {
74
- "access": "public"
65
+ "engines": {
66
+ "node": ">=24.0.0"
75
67
  },
76
68
  "scripts": {
77
- "build": "rslib build",
69
+ "build": "rm -rf dist && tsgo -p tsconfig.build.json",
70
+ "check-types": "tsgo --noEmit",
78
71
  "clean": "rm -rf dist",
79
- "dev": "rslib build --watch",
80
- "lint": "TIMING=1 eslint --max-warnings 0 .",
81
- "lint:fix": "TIMING=1 eslint --max-warnings 0 --fix .",
82
72
  "test": "jest",
83
73
  "test:coverage": "jest --coverage",
84
74
  "test:coverage:ci": "jest --coverage --ci",
85
- "test:watch": "jest --watch",
86
- "type-check": "tsc --noEmit"
75
+ "test:watch": "jest --watch"
87
76
  }
88
77
  }
package/CHANGELOG.md DELETED
@@ -1,15 +0,0 @@
1
- # @codefast/cli
2
-
3
- ## 0.3.7-canary.0
4
-
5
- ### Patch Changes
6
-
7
- - [`e66e9ac`](https://github.com/codefastlabs/codefast/commit/e66e9ac1186a94cb30d83d7125d4991ee91c7a41) Thanks [@thevuong](https://github.com/thevuong)! - refactor: improve readability and naming consistency across multiple packages
8
-
9
- - [`161717d`](https://github.com/codefastlabs/codefast/commit/161717db82457444b793bad252099084ef490085) Thanks [@thevuong](https://github.com/thevuong)! - feat(eslint-config): strengthen unicorn and TypeScript rule configurations
10
-
11
- - [`dea11de`](https://github.com/codefastlabs/codefast/commit/dea11deef4cab04a9ed2cd411251f6ad939acba6) Thanks [@thevuong](https://github.com/thevuong)! - chore(ui): integrate `tw-animate-css` and enhance animation easing consistency
12
-
13
- - [`2f0fd79`](https://github.com/codefastlabs/codefast/commit/2f0fd791d1505279a9c8570f8f3fddcf058d64ee) Thanks [@thevuong](https://github.com/thevuong)! - chore: reorder imports for consistency and clarity
14
-
15
- - [`728b150`](https://github.com/codefastlabs/codefast/commit/728b1503583d1f130c2f0abd503343dd8c802ee6) Thanks [@thevuong](https://github.com/thevuong)! - chore(tests): remove obsolete test files for core use cases and adapters
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_exports__={};function main(){console.log("Hello, world!")}for(var __webpack_i__ in main(),__webpack_exports__)exports[__webpack_i__]=__webpack_exports__[__webpack_i__];Object.defineProperty(exports,"__esModule",{value:!0});
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":""}
package/dist/esm/index.js DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- console.log("Hello, world!");
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":""}