@mono-labs/cli 0.0.214 → 0.0.215

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.
@@ -15,7 +15,6 @@ const OUTPUT_PATH = node_path_1.default.join(REPO_ROOT, 'docs');
15
15
  const OUTPUT_README = node_path_1.default.join(OUTPUT_PATH, 'command-line.md');
16
16
  async function ensureParentDir(filePath) {
17
17
  const dir = node_path_1.default.dirname(filePath);
18
- console.log(`[ensureParentDir] Ensuring directory:`, dir);
19
18
  await node_fs_1.promises.mkdir(dir, { recursive: true });
20
19
  }
21
20
  // ---------- utils ----------
@@ -23,11 +22,9 @@ async function exists(p) {
23
22
  try {
24
23
  await node_fs_1.promises.access(p);
25
24
  // Log existence check
26
- console.log(`[exists] Path exists:`, p);
27
25
  return true;
28
26
  }
29
27
  catch {
30
- console.log(`[exists] Path does NOT exist:`, p);
31
28
  return false;
32
29
  }
33
30
  }
@@ -38,22 +35,17 @@ function toPosix(p) {
38
35
  return p.split(node_path_1.default.sep).join('/');
39
36
  }
40
37
  async function readJson(filePath) {
41
- console.log(`[readJson] Reading JSON file:`, filePath);
42
38
  const raw = await node_fs_1.promises.readFile(filePath, 'utf8');
43
39
  try {
44
40
  const parsed = JSON.parse(raw);
45
- console.log(`[readJson] Successfully parsed:`, filePath);
46
41
  return parsed;
47
42
  }
48
43
  catch (err) {
49
- console.error(`[readJson] Failed to parse JSON:`, filePath, err);
50
44
  throw err;
51
45
  }
52
46
  }
53
47
  async function listDir(dir) {
54
- console.log(`[listDir] Listing directory:`, dir);
55
48
  const entries = await node_fs_1.promises.readdir(dir, { withFileTypes: true });
56
- console.log(`[listDir] Found ${entries.length} entries in:`, dir);
57
49
  return entries;
58
50
  }
59
51
  function normalizeWorkspacePatterns(workspacesField) {
@@ -85,25 +77,20 @@ function matchSegment(patternSeg, name) {
85
77
  return regex.test(name);
86
78
  }
87
79
  async function expandWorkspacePattern(root, pattern) {
88
- console.log(`[expandWorkspacePattern] Expanding pattern:`, pattern, `from root:`, root);
89
80
  const segs = toPosix(pattern).split('/').filter(Boolean);
90
81
  async function expandFrom(dir, segIndex) {
91
- console.log(`[expandFrom] Directory:`, dir, `Segment index:`, segIndex);
92
82
  if (segIndex >= segs.length)
93
83
  return [dir];
94
84
  const seg = segs[segIndex];
95
- console.log(`[expandFrom] Segment:`, seg);
96
85
  if (seg === '**') {
97
86
  const results = [];
98
87
  results.push(...(await expandFrom(dir, segIndex + 1)));
99
88
  const entries = await node_fs_1.promises
100
89
  .readdir(dir, { withFileTypes: true })
101
90
  .catch(() => []);
102
- console.log(`[expandFrom] '**' entries in ${dir}:`, entries.map((e) => e.name));
103
91
  for (const e of entries) {
104
92
  if (!e.isDirectory())
105
93
  continue;
106
- console.log(`[expandFrom] Recursing into subdir:`, node_path_1.default.join(dir, e.name));
107
94
  results.push(...(await expandFrom(node_path_1.default.join(dir, e.name), segIndex)));
108
95
  }
109
96
  return results;
@@ -111,45 +98,34 @@ async function expandWorkspacePattern(root, pattern) {
111
98
  const entries = await node_fs_1.promises
112
99
  .readdir(dir, { withFileTypes: true })
113
100
  .catch(() => []);
114
- console.log(`[expandFrom] Entries in ${dir}:`, entries.map((e) => e.name));
115
101
  const results = [];
116
102
  for (const e of entries) {
117
103
  if (!e.isDirectory())
118
104
  continue;
119
105
  if (!matchSegment(seg, e.name))
120
106
  continue;
121
- console.log(`[expandFrom] Matched segment '${seg}' with directory:`, e.name);
122
107
  results.push(...(await expandFrom(node_path_1.default.join(dir, e.name), segIndex + 1)));
123
108
  }
124
109
  return results;
125
110
  }
126
111
  const dirs = await expandFrom(root, 0);
127
- console.log(`[expandWorkspacePattern] Expanded directories:`, dirs);
128
112
  const pkgDirs = [];
129
113
  for (const d of dirs) {
130
114
  const pkgPath = node_path_1.default.join(d, 'package.json');
131
115
  if (await exists(pkgPath)) {
132
- console.log(`[expandWorkspacePattern] Found package.json:`, pkgPath);
133
116
  pkgDirs.push(d);
134
117
  }
135
- else {
136
- console.log(`[expandWorkspacePattern] No package.json in:`, d);
137
- }
138
118
  }
139
- console.log(`[expandWorkspacePattern] Final package directories:`, pkgDirs);
140
119
  return [...new Set(pkgDirs)];
141
120
  }
142
121
  async function findWorkspacePackageDirs(repoRoot, workspacePatterns) {
143
- console.log(`[findWorkspacePackageDirs] repoRoot:`, repoRoot, `workspacePatterns:`, workspacePatterns);
144
122
  const dirs = [];
145
123
  for (const pat of workspacePatterns) {
146
- console.log(`[findWorkspacePackageDirs] Expanding pattern:`, pat);
147
124
  const expanded = await expandWorkspacePattern(repoRoot, pat);
148
- console.log(`[findWorkspacePackageDirs] Expanded dirs for pattern '${pat}':`, expanded);
125
+ dirs.push(...expanded);
149
126
  dirs.push(...expanded);
150
127
  }
151
128
  const uniqueDirs = [...new Set(dirs)];
152
- console.log(`[findWorkspacePackageDirs] Final unique package dirs:`, uniqueDirs);
153
129
  return uniqueDirs;
154
130
  }
155
131
  // ---------- .mono parsing ----------
@@ -162,11 +138,9 @@ async function readMonoConfig() {
162
138
  }
163
139
  try {
164
140
  const config = await readJson(configPath);
165
- console.log(`[readMonoConfig] Loaded mono config.`);
166
141
  return { path: configPath, config };
167
142
  }
168
143
  catch (err) {
169
- console.error(`[readMonoConfig] Failed to load mono config:`, err);
170
144
  return null;
171
145
  }
172
146
  }
@@ -174,9 +148,7 @@ function commandNameFromFile(filePath) {
174
148
  return node_path_1.default.basename(filePath).replace(/\.json$/i, '');
175
149
  }
176
150
  async function readMonoCommands() {
177
- console.log(`[readMonoCommands] Reading mono commands from:`, MONO_DIR);
178
151
  if (!(await exists(MONO_DIR))) {
179
- console.log(`[readMonoCommands] Mono directory does not exist.`);
180
152
  return [];
181
153
  }
182
154
  const entries = await listDir(MONO_DIR);
@@ -184,18 +156,15 @@ async function readMonoCommands() {
184
156
  .filter((e) => e.isFile() && e.name.toLowerCase().endsWith('.json'))
185
157
  .map((e) => node_path_1.default.join(MONO_DIR, e.name))
186
158
  .filter((p) => node_path_1.default.basename(p).toLowerCase() !== 'config.json');
187
- console.log(`[readMonoCommands] Found JSON files:`, jsonFiles);
188
159
  const commands = [];
189
160
  for (const file of jsonFiles) {
190
161
  try {
191
- console.log(`[readMonoCommands] Reading command file:`, file);
192
162
  const j = await readJson(file);
193
163
  commands.push({
194
164
  name: commandNameFromFile(file),
195
165
  file,
196
166
  json: j,
197
167
  });
198
- console.log(`[readMonoCommands] Successfully loaded command:`, commandNameFromFile(file));
199
168
  }
200
169
  catch (err) {
201
170
  console.error(`[readMonoCommands] Failed to load command file:`, file, err);
@@ -203,7 +172,6 @@ async function readMonoCommands() {
203
172
  }
204
173
  }
205
174
  commands.sort((a, b) => a.name.localeCompare(b.name));
206
- console.log(`[readMonoCommands] Final sorted commands:`, commands.map((c) => c.name));
207
175
  return commands;
208
176
  }
209
177
  function parseOptionsSchema(optionsObj) {
@@ -450,12 +418,10 @@ async function main() {
450
418
  const monoConfig = await readMonoConfig();
451
419
  const monoCommands = await readMonoCommands();
452
420
  const pkgDirs = await findWorkspacePackageDirs(REPO_ROOT, workspacePatterns);
453
- console.log(`[main] Package directories found:`, pkgDirs);
454
421
  const packages = [];
455
422
  for (const dir of pkgDirs) {
456
423
  try {
457
424
  const pkgPath = node_path_1.default.join(dir, 'package.json');
458
- console.log(`[main] Reading package.json:`, pkgPath);
459
425
  const pj = await readJson(pkgPath);
460
426
  packages.push({
461
427
  name: pj.name ||
@@ -464,7 +430,6 @@ async function main() {
464
430
  dir,
465
431
  scripts: pj.scripts || {},
466
432
  });
467
- console.log(`[main] Loaded package:`, pj.name || dir);
468
433
  }
469
434
  catch (err) {
470
435
  console.error(`[main] Failed to load package.json for:`, dir, err);
@@ -473,7 +438,7 @@ async function main() {
473
438
  }
474
439
  const parts = [];
475
440
  parts.push(`# ⚙️ Command Line Reference
476
-
441
+
477
442
  > Generated by \`scripts/generate-readme.mjs\`.
478
443
  > Update \`.mono/config.json\`, \`.mono/*.json\`, and workspace package scripts to change this output.
479
444
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mono-labs/cli",
3
- "version": "0.0.214",
3
+ "version": "0.0.215",
4
4
  "description": "A CLI tool for building and deploying projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/types.d.ts",
@@ -13,7 +13,6 @@ const OUTPUT_README = path.join(OUTPUT_PATH, 'command-line.md');
13
13
 
14
14
  async function ensureParentDir(filePath: string): Promise<void> {
15
15
  const dir = path.dirname(filePath);
16
- console.log(`[ensureParentDir] Ensuring directory:`, dir);
17
16
  await fs.mkdir(dir, { recursive: true });
18
17
  }
19
18
 
@@ -22,10 +21,9 @@ async function exists(p: string): Promise<boolean> {
22
21
  try {
23
22
  await fs.access(p);
24
23
  // Log existence check
25
- console.log(`[exists] Path exists:`, p);
24
+
26
25
  return true;
27
26
  } catch {
28
- console.log(`[exists] Path does NOT exist:`, p);
29
27
  return false;
30
28
  }
31
29
  }
@@ -36,21 +34,18 @@ function toPosix(p: string): string {
36
34
  return p.split(path.sep).join('/');
37
35
  }
38
36
  async function readJson<T = any>(filePath: string): Promise<T> {
39
- console.log(`[readJson] Reading JSON file:`, filePath);
40
37
  const raw = await fs.readFile(filePath, 'utf8');
41
38
  try {
42
39
  const parsed = JSON.parse(raw);
43
- console.log(`[readJson] Successfully parsed:`, filePath);
40
+
44
41
  return parsed;
45
42
  } catch (err) {
46
- console.error(`[readJson] Failed to parse JSON:`, filePath, err);
47
43
  throw err;
48
44
  }
49
45
  }
50
46
  async function listDir(dir: string): Promise<Dirent[]> {
51
- console.log(`[listDir] Listing directory:`, dir);
52
47
  const entries = await fs.readdir(dir, { withFileTypes: true });
53
- console.log(`[listDir] Found ${entries.length} entries in:`, dir);
48
+
54
49
  return entries;
55
50
  }
56
51
  function normalizeWorkspacePatterns(workspacesField: unknown): string[] {
@@ -86,19 +81,11 @@ async function expandWorkspacePattern(
86
81
  root: string,
87
82
  pattern: string
88
83
  ): Promise<string[]> {
89
- console.log(
90
- `[expandWorkspacePattern] Expanding pattern:`,
91
- pattern,
92
- `from root:`,
93
- root
94
- );
95
84
  const segs = toPosix(pattern).split('/').filter(Boolean);
96
85
 
97
86
  async function expandFrom(dir: string, segIndex: number): Promise<string[]> {
98
- console.log(`[expandFrom] Directory:`, dir, `Segment index:`, segIndex);
99
87
  if (segIndex >= segs.length) return [dir];
100
88
  const seg = segs[segIndex];
101
- console.log(`[expandFrom] Segment:`, seg);
102
89
 
103
90
  if (seg === '**') {
104
91
  const results: string[] = [];
@@ -106,16 +93,10 @@ async function expandWorkspacePattern(
106
93
  const entries = await fs
107
94
  .readdir(dir, { withFileTypes: true })
108
95
  .catch(() => []);
109
- console.log(
110
- `[expandFrom] '**' entries in ${dir}:`,
111
- entries.map((e) => e.name)
112
- );
96
+
113
97
  for (const e of entries) {
114
98
  if (!e.isDirectory()) continue;
115
- console.log(
116
- `[expandFrom] Recursing into subdir:`,
117
- path.join(dir, e.name)
118
- );
99
+
119
100
  results.push(...(await expandFrom(path.join(dir, e.name), segIndex)));
120
101
  }
121
102
  return results;
@@ -124,36 +105,27 @@ async function expandWorkspacePattern(
124
105
  const entries = await fs
125
106
  .readdir(dir, { withFileTypes: true })
126
107
  .catch(() => []);
127
- console.log(
128
- `[expandFrom] Entries in ${dir}:`,
129
- entries.map((e) => e.name)
130
- );
108
+
131
109
  const results: string[] = [];
132
110
  for (const e of entries) {
133
111
  if (!e.isDirectory()) continue;
134
112
  if (!matchSegment(seg, e.name)) continue;
135
- console.log(
136
- `[expandFrom] Matched segment '${seg}' with directory:`,
137
- e.name
138
- );
113
+
139
114
  results.push(...(await expandFrom(path.join(dir, e.name), segIndex + 1)));
140
115
  }
141
116
  return results;
142
117
  }
143
118
 
144
119
  const dirs = await expandFrom(root, 0);
145
- console.log(`[expandWorkspacePattern] Expanded directories:`, dirs);
120
+
146
121
  const pkgDirs: string[] = [];
147
122
  for (const d of dirs) {
148
123
  const pkgPath = path.join(d, 'package.json');
149
124
  if (await exists(pkgPath)) {
150
- console.log(`[expandWorkspacePattern] Found package.json:`, pkgPath);
151
125
  pkgDirs.push(d);
152
- } else {
153
- console.log(`[expandWorkspacePattern] No package.json in:`, d);
154
126
  }
155
127
  }
156
- console.log(`[expandWorkspacePattern] Final package directories:`, pkgDirs);
128
+
157
129
  return [...new Set(pkgDirs)];
158
130
  }
159
131
 
@@ -161,27 +133,13 @@ async function findWorkspacePackageDirs(
161
133
  repoRoot: string,
162
134
  workspacePatterns: string[]
163
135
  ): Promise<string[]> {
164
- console.log(
165
- `[findWorkspacePackageDirs] repoRoot:`,
166
- repoRoot,
167
- `workspacePatterns:`,
168
- workspacePatterns
169
- );
170
136
  const dirs: string[] = [];
171
137
  for (const pat of workspacePatterns) {
172
- console.log(`[findWorkspacePackageDirs] Expanding pattern:`, pat);
173
138
  const expanded = await expandWorkspacePattern(repoRoot, pat);
174
- console.log(
175
- `[findWorkspacePackageDirs] Expanded dirs for pattern '${pat}':`,
176
- expanded
177
- );
139
+ dirs.push(...expanded);
178
140
  dirs.push(...expanded);
179
141
  }
180
142
  const uniqueDirs = [...new Set(dirs)];
181
- console.log(
182
- `[findWorkspacePackageDirs] Final unique package dirs:`,
183
- uniqueDirs
184
- );
185
143
  return uniqueDirs;
186
144
  }
187
145
 
@@ -195,10 +153,8 @@ async function readMonoConfig(): Promise<MonoConfig | null> {
195
153
  }
196
154
  try {
197
155
  const config = await readJson<any>(configPath);
198
- console.log(`[readMonoConfig] Loaded mono config.`);
199
156
  return { path: configPath, config };
200
157
  } catch (err) {
201
- console.error(`[readMonoConfig] Failed to load mono config:`, err);
202
158
  return null;
203
159
  }
204
160
  }
@@ -208,9 +164,7 @@ function commandNameFromFile(filePath: string): string {
208
164
  }
209
165
 
210
166
  async function readMonoCommands(): Promise<MonoCommand[]> {
211
- console.log(`[readMonoCommands] Reading mono commands from:`, MONO_DIR);
212
167
  if (!(await exists(MONO_DIR))) {
213
- console.log(`[readMonoCommands] Mono directory does not exist.`);
214
168
  return [];
215
169
  }
216
170
  const entries = await listDir(MONO_DIR);
@@ -220,21 +174,15 @@ async function readMonoCommands(): Promise<MonoCommand[]> {
220
174
  .map((e) => path.join(MONO_DIR, e.name))
221
175
  .filter((p) => path.basename(p).toLowerCase() !== 'config.json');
222
176
 
223
- console.log(`[readMonoCommands] Found JSON files:`, jsonFiles);
224
177
  const commands: MonoCommand[] = [];
225
178
  for (const file of jsonFiles) {
226
179
  try {
227
- console.log(`[readMonoCommands] Reading command file:`, file);
228
180
  const j = await readJson<any>(file);
229
181
  commands.push({
230
182
  name: commandNameFromFile(file),
231
183
  file,
232
184
  json: j,
233
185
  });
234
- console.log(
235
- `[readMonoCommands] Successfully loaded command:`,
236
- commandNameFromFile(file)
237
- );
238
186
  } catch (err) {
239
187
  console.error(
240
188
  `[readMonoCommands] Failed to load command file:`,
@@ -246,10 +194,7 @@ async function readMonoCommands(): Promise<MonoCommand[]> {
246
194
  }
247
195
 
248
196
  commands.sort((a, b) => a.name.localeCompare(b.name));
249
- console.log(
250
- `[readMonoCommands] Final sorted commands:`,
251
- commands.map((c) => c.name)
252
- );
197
+
253
198
  return commands;
254
199
  }
255
200
 
@@ -601,12 +546,10 @@ async function main(): Promise<void> {
601
546
  const monoCommands = await readMonoCommands();
602
547
 
603
548
  const pkgDirs = await findWorkspacePackageDirs(REPO_ROOT, workspacePatterns);
604
- console.log(`[main] Package directories found:`, pkgDirs);
605
549
  const packages: PackageInfo[] = [];
606
550
  for (const dir of pkgDirs) {
607
551
  try {
608
552
  const pkgPath = path.join(dir, 'package.json');
609
- console.log(`[main] Reading package.json:`, pkgPath);
610
553
  const pj = await readJson<any>(pkgPath);
611
554
  packages.push({
612
555
  name:
@@ -616,7 +559,6 @@ async function main(): Promise<void> {
616
559
  dir,
617
560
  scripts: pj.scripts || {},
618
561
  });
619
- console.log(`[main] Loaded package:`, pj.name || dir);
620
562
  } catch (err) {
621
563
  console.error(`[main] Failed to load package.json for:`, dir, err);
622
564
  // skip
@@ -625,7 +567,7 @@ async function main(): Promise<void> {
625
567
 
626
568
  const parts: string[] = [];
627
569
  parts.push(`# ⚙️ Command Line Reference
628
-
570
+
629
571
  > Generated by \`scripts/generate-readme.mjs\`.
630
572
  > Update \`.mono/config.json\`, \`.mono/*.json\`, and workspace package scripts to change this output.
631
573