adamantite 0.14.2 → 0.16.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/index.js CHANGED
@@ -6,29 +6,40 @@ import { hideBin } from "yargs/helpers";
6
6
  import process3 from "node:process";
7
7
  import { log } from "@clack/prompts";
8
8
  import { Fault as Fault3 } from "faultier";
9
- import { ok as ok3, safeTry as safeTry2 } from "neverthrow";
9
+ import { ok as ok3, safeTry as safeTry3 } from "neverthrow";
10
10
  import { dlxCommand } from "nypm";
11
11
 
12
12
  // src/helpers/packages/biome.ts
13
13
  import { readFile as readFile2, writeFile } from "node:fs/promises";
14
14
  import { join as join2 } from "node:path";
15
15
  import { Fault as Fault2 } from "faultier";
16
- import { err as err2, fromPromise as fromPromise2, ok as ok2, safeTry } from "neverthrow";
16
+ import { err as err2, fromPromise as fromPromise2, ok as ok2, safeTry as safeTry2 } from "neverthrow";
17
17
 
18
18
  // src/utils.ts
19
- import { execSync } from "node:child_process";
19
+ import { spawnSync } from "node:child_process";
20
20
  import { access, readFile } from "node:fs/promises";
21
21
  import { join } from "node:path";
22
22
  import process2 from "node:process";
23
23
  import defu from "defu";
24
24
  import { Fault } from "faultier";
25
25
  import { parse } from "jsonc-parser";
26
- import { err, fromPromise, fromThrowable, ok } from "neverthrow";
26
+ import { err, fromPromise, fromThrowable, ok, safeTry } from "neverthrow";
27
27
  import { detectPackageManager } from "nypm";
28
28
  function defineCommand(input) {
29
29
  return input;
30
30
  }
31
- var runCommand = fromThrowable(execSync, (error) => Fault.wrap(error).withTag("FAILED_TO_RUN_COMMAND"));
31
+ var runCommand = (command) => {
32
+ const result = spawnSync(command, {
33
+ stdio: "inherit",
34
+ shell: true,
35
+ maxBuffer: 100 * 1024 * 1024
36
+ });
37
+ if (result.error || result.status !== 0) {
38
+ const message = result.error?.message ?? "An unknown error occurred while running the command";
39
+ return err(Fault.wrap(result.error ?? new Error(message)).withTag("FAILED_TO_RUN_COMMAND").withDebug(`Failed to run command: ${message}`));
40
+ }
41
+ return ok(result);
42
+ };
32
43
  var getPackageManagerName = () => fromPromise(detectPackageManager(process2.cwd()), () => "Failed to detect package manager").andThen((result) => result ? ok(result.name) : err("Failed to resolve package manager")).mapErr((message) => Fault.create("NO_PACKAGE_MANAGER").withDescription(message, "We're unable to detect the package manager used in this project. Please ensure you have a package.json file in the current directory."));
33
44
  var checkIfExists = (path) => fromPromise(access(path), () => new Error("File not found")).match(() => true, () => false);
34
45
  var parseJson = (content) => {
@@ -39,27 +50,32 @@ var parseJson = (content) => {
39
50
  }
40
51
  return ok(parsed);
41
52
  };
53
+ var WORKSPACE_PREFIX_REGEX = /^workspace:/;
54
+ var RANGE_PREFIX_REGEX = /^[\^~]/;
55
+ var normalizeDependencyVersion = (specifier) => specifier.trim().replace(WORKSPACE_PREFIX_REGEX, "").replace(RANGE_PREFIX_REGEX, "");
42
56
  var mergeConfig = fromThrowable(defu, (error) => Fault.wrap(error).withTag("FAILED_TO_MERGE_CONFIG").withDescription("Failed to merge configuration", "We're unable to merge the configuration files."));
43
57
  var readPackageJson = (cwd = process2.cwd()) => fromPromise(readFile(join(cwd, "package.json"), "utf-8"), (error) => Fault.wrap(error).withTag("FAILED_TO_READ_FILE").withDescription("Failed to read package.json", "We're unable to read the package.json file in the current directory.").withContext({ path: join(cwd, "package.json") })).andThen((content) => parseJson(content)).andThen((parsed) => ok(parsed));
44
- function getTitle() {
45
- const terminalWidth = process2.stdout.columns || 80;
46
- if (terminalWidth >= 120) {
47
- return `
48
- █████ █████ ███ █████
49
- ░░███ ░░███ ░░░ ░░███
50
- ██████ ███████ ██████ █████████████ ██████ ████████ ███████ ████ ███████ ██████
51
- ░░░░░███ ███░░███ ░░░░░███ ░░███░░███░░███ ░░░░░███ ░░███░░███ ░░░███░ ░░███ ░░░███░ ███░░███
52
- ███████ ░███ ░███ ███████ ░███ ░███ ░███ ███████ ░███ ░███ ░███ ░███ ░███ ░███████
53
- ███░░███ ░███ ░███ ███░░███ ░███ ░███ ░███ ███░░███ ░███ ░███ ░███ ███ ░███ ░███ ███░███░░░
54
- ░░████████░░████████░░████████ █████░███ █████░░████████ ████ █████ ░░█████ █████ ░░█████ ░░██████
55
- ░░░░░░░░ ░░░░░░░░ ░░░░░░░░ ░░░░░ ░░░ ░░░░░ ░░░░░░░░ ░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░░
56
- `;
58
+ var checkIsMonorepo = () => safeTry(async function* () {
59
+ const pnpmWorkspace = await checkIfExists(join(process2.cwd(), "pnpm-workspace.yaml"));
60
+ if (pnpmWorkspace) {
61
+ return ok(true);
57
62
  }
58
- return `
59
- ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
60
- ┃ ADAMANTITE ┃
61
- ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
63
+ const packageJson = yield* readPackageJson();
64
+ return ok(packageJson?.workspaces !== undefined);
65
+ });
66
+ var TITLE = `
67
+ o ooooooooo o oooo oooo o oooo oooo ooooooooooo ooooo ooooooooooo ooooooooooo
68
+ 888 888 88o 888 8888o 888 888 8888o 88 88 888 88 888 88 888 88 888 88
69
+ 8 88 888 888 8 88 88 888o8 88 8 88 88 888o88 888 888 888 888ooo8
70
+ 8oooo88 888 888 8oooo88 88 888 88 8oooo88 88 8888 888 888 888 888 oo
71
+ o88o o888o o888ooo88 o88o o888o o88o 8 o88o o88o o888o o88o 88 o888o o888o o888o o888ooo8888
62
72
  `;
73
+ function printTitle() {
74
+ const columns = TITLE.split(`
75
+ `).reduce((max, line) => Math.max(max, line.trim().length), 0);
76
+ if (process2.stdout.columns && process2.stdout.columns >= columns) {
77
+ console.log(TITLE);
78
+ }
63
79
  }
64
80
 
65
81
  // src/helpers/packages/biome.ts
@@ -79,7 +95,7 @@ var biome = {
79
95
  return { path: null };
80
96
  },
81
97
  create: () => fromPromise2(writeFile(join2(process.cwd(), "biome.jsonc"), JSON.stringify({ ...biome.config, extends: ["adamantite"] }, null, 2)), (error) => Fault2.wrap(error).withTag("FAILED_TO_WRITE_FILE").withDescription("Failed to write Biome configuration", "We're unable to write the Biome configuration to the current directory.")),
82
- update: () => safeTry(async function* () {
98
+ update: () => safeTry2(async function* () {
83
99
  const exists = await biome.exists();
84
100
  if (!exists.path) {
85
101
  return err2(Fault2.create("FILE_NOT_FOUND").withDescription("No `biome.jsonc` or `biome.json` found", "We're unable to find a Biome configuration in the current directory."));
@@ -106,7 +122,7 @@ var biome = {
106
122
  // src/commands/check.ts
107
123
  var check_default = defineCommand({
108
124
  command: "check [files..]",
109
- describe: "Run Biome linter and check files for issues",
125
+ describe: "Find issues in code using Biome",
110
126
  builder: (yargs) => yargs.positional("files", {
111
127
  describe: "Specific files to lint (optional)",
112
128
  type: "string",
@@ -115,7 +131,7 @@ var check_default = defineCommand({
115
131
  type: "boolean",
116
132
  description: "Show summary of lint results"
117
133
  }),
118
- handler: async (argv) => safeTry2(async function* () {
134
+ handler: (argv) => safeTry3(async function* () {
119
135
  const packageManager = yield* getPackageManagerName();
120
136
  const args = ["check"];
121
137
  if (argv.summary) {
@@ -125,8 +141,8 @@ var check_default = defineCommand({
125
141
  args.push(...argv.files);
126
142
  }
127
143
  const command = dlxCommand(packageManager, biome.name, { args });
128
- yield* runCommand(command, { stdio: "inherit" });
129
- return ok3(undefined);
144
+ const result = yield* runCommand(command);
145
+ return ok3(result);
130
146
  }).match(() => {
131
147
  process3.exit(0);
132
148
  }, (error) => {
@@ -140,10 +156,89 @@ var check_default = defineCommand({
140
156
  // src/commands/ci.ts
141
157
  import process4 from "node:process";
142
158
  import { log as log2 } from "@clack/prompts";
143
- import { Fault as Fault4 } from "faultier";
144
- import { ok as ok4, safeTry as safeTry3 } from "neverthrow";
159
+ import { Fault as Fault5 } from "faultier";
160
+ import { ok as ok5, safeTry as safeTry5 } from "neverthrow";
145
161
  import { dlxCommand as dlxCommand2 } from "nypm";
146
162
 
163
+ // src/helpers/packages/oxfmt.ts
164
+ import { readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
165
+ import { join as join3 } from "node:path";
166
+ import { Fault as Fault4 } from "faultier";
167
+ import { err as err3, fromPromise as fromPromise3, ok as ok4, safeTry as safeTry4 } from "neverthrow";
168
+ // presets/oxfmt.json
169
+ var oxfmt_default = {
170
+ arrowParens: "always",
171
+ bracketSameLine: false,
172
+ bracketSpacing: true,
173
+ embeddedLanguageFormatting: "auto",
174
+ endOfLine: "lf",
175
+ experimentalSortImports: {
176
+ groups: [
177
+ ["value-builtin", "type-import"],
178
+ ["value-external"],
179
+ ["type-internal"],
180
+ ["value-internal"],
181
+ ["type-subpath"],
182
+ ["value-subpath"],
183
+ ["type-parent", "type-sibling", "type-index"],
184
+ ["value-parent", "value-sibling", "value-index"],
185
+ ["unknown"]
186
+ ],
187
+ ignoreCase: true,
188
+ newlinesBetween: false,
189
+ partitionByNewline: true,
190
+ order: "asc",
191
+ partitionByComment: true,
192
+ sortSideEffects: false
193
+ },
194
+ insertFinalNewline: true,
195
+ jsxSingleQuote: false,
196
+ objectWrap: "preserve",
197
+ printWidth: 100,
198
+ quoteProps: "as-needed",
199
+ semi: false,
200
+ singleAttributePerLine: false,
201
+ singleQuote: false,
202
+ tabWidth: 2,
203
+ trailingComma: "es5",
204
+ useTabs: false
205
+ };
206
+
207
+ // src/helpers/packages/oxfmt.ts
208
+ var oxfmt = {
209
+ name: "oxfmt",
210
+ version: "0.20.0",
211
+ config: {
212
+ $schema: "./node_modules/oxfmt/configuration_schema.json",
213
+ ...oxfmt_default
214
+ },
215
+ exists: async () => {
216
+ if (await checkIfExists(join3(process.cwd(), ".oxfmtrc.jsonc"))) {
217
+ return { path: join3(process.cwd(), ".oxfmtrc.jsonc") };
218
+ }
219
+ if (await checkIfExists(join3(process.cwd(), ".oxfmtrc.json"))) {
220
+ return { path: join3(process.cwd(), ".oxfmtrc.json") };
221
+ }
222
+ return { path: null };
223
+ },
224
+ create: () => fromPromise3(writeFile2(join3(process.cwd(), ".oxfmtrc.jsonc"), JSON.stringify(oxfmt.config, null, 2)), (error) => Fault4.wrap(error).withTag("FAILED_TO_WRITE_FILE").withDescription("Failed to write oxfmt configuration", "We're unable to write the oxfmt configuration to the current directory.")),
225
+ update: () => safeTry4(async function* () {
226
+ const exists = await oxfmt.exists();
227
+ if (!exists.path) {
228
+ return err3(Fault4.create("FILE_NOT_FOUND").withDescription("No `.oxfmtrc.jsonc` or `.oxfmtrc.json` found", "We're unable to find an oxfmt configuration in the current directory."));
229
+ }
230
+ const oxfmtFile = yield* fromPromise3(readFile3(exists.path, "utf-8"), (error) => Fault4.wrap(error).withTag("FAILED_TO_READ_FILE").withDescription("Failed to read oxfmt configuration", "We're unable to read the oxfmt configuration from the current directory."));
231
+ const existingConfig = yield* parseJson(oxfmtFile);
232
+ if (!existingConfig || Object.keys(existingConfig).length === 0) {
233
+ return err3(Fault4.create("INVALID_OXFMT_CONFIG").withDescription("Invalid oxfmt configuration", "The oxfmt configuration file is empty or invalid.").withContext({ path: exists.path }));
234
+ }
235
+ const mergedConfig = yield* mergeConfig(existingConfig, oxfmt.config);
236
+ mergedConfig.$schema = oxfmt.config.$schema;
237
+ yield* fromPromise3(writeFile2(exists.path, JSON.stringify(mergedConfig, null, 2)), (error) => Fault4.wrap(error).withTag("FAILED_TO_WRITE_FILE").withDescription("Failed to write oxfmt configuration", "We're unable to write the oxfmt configuration to the current directory.").withContext({ path: exists.path }));
238
+ return ok4();
239
+ })
240
+ };
241
+
147
242
  // src/helpers/packages/sherif.ts
148
243
  var sherif = {
149
244
  name: "sherif",
@@ -161,7 +256,7 @@ var ci_default = defineCommand({
161
256
  type: "boolean",
162
257
  description: "Use GitHub reporter"
163
258
  }),
164
- handler: async (argv) => safeTry3(async function* () {
259
+ handler: (argv) => safeTry5(async function* () {
165
260
  const packageManager = yield* getPackageManagerName();
166
261
  const tools = [
167
262
  {
@@ -169,6 +264,13 @@ var ci_default = defineCommand({
169
264
  args: ["ci", ...argv.github ? ["--reporter", "github"] : []]
170
265
  }
171
266
  ];
267
+ const oxfmtConfig = await oxfmt.exists();
268
+ if (oxfmtConfig.path) {
269
+ tools.push({
270
+ package: oxfmt.name,
271
+ args: ["--check"]
272
+ });
273
+ }
172
274
  if (argv.monorepo) {
173
275
  tools.push({ package: sherif.name, args: [] });
174
276
  }
@@ -176,15 +278,13 @@ var ci_default = defineCommand({
176
278
  const command = dlxCommand2(packageManager, tool.package, {
177
279
  args: tool.args
178
280
  });
179
- yield* runCommand(command, {
180
- stdio: "inherit"
181
- });
281
+ yield* runCommand(command);
182
282
  }
183
- return ok4(undefined);
283
+ return ok5();
184
284
  }).match(() => {
185
285
  process4.exit(0);
186
286
  }, (error) => {
187
- if (Fault4.isFault(error) && error.tag === "NO_PACKAGE_MANAGER") {
287
+ if (Fault5.isFault(error) && error.tag === "NO_PACKAGE_MANAGER") {
188
288
  log2.error(error.flatten());
189
289
  }
190
290
  process4.exit(1);
@@ -194,12 +294,12 @@ var ci_default = defineCommand({
194
294
  // src/commands/fix.ts
195
295
  import process5 from "node:process";
196
296
  import { log as log3 } from "@clack/prompts";
197
- import { Fault as Fault5 } from "faultier";
198
- import { ok as ok5, safeTry as safeTry4 } from "neverthrow";
297
+ import { Fault as Fault6 } from "faultier";
298
+ import { ok as ok6, safeTry as safeTry6 } from "neverthrow";
199
299
  import { dlxCommand as dlxCommand3 } from "nypm";
200
300
  var fix_default = defineCommand({
201
301
  command: "fix [files..]",
202
- describe: "Run Biome linter and fix issues in files",
302
+ describe: "Fix issues in code using Biome",
203
303
  builder: (yargs) => yargs.positional("files", {
204
304
  describe: "Specific files to fix (optional)",
205
305
  type: "string",
@@ -208,7 +308,7 @@ var fix_default = defineCommand({
208
308
  type: "boolean",
209
309
  description: "Apply unsafe fixes"
210
310
  }),
211
- handler: async (argv) => safeTry4(async function* () {
311
+ handler: (argv) => safeTry6(async function* () {
212
312
  const packageManager = yield* getPackageManagerName();
213
313
  const args = ["check", "--write"];
214
314
  if (argv.unsafe) {
@@ -218,262 +318,389 @@ var fix_default = defineCommand({
218
318
  args.push(...argv.files);
219
319
  }
220
320
  const command = dlxCommand3(packageManager, biome.name, { args });
221
- yield* runCommand(command, {
222
- stdio: "inherit"
223
- });
224
- return ok5(undefined);
321
+ yield* runCommand(command);
322
+ return ok6();
225
323
  }).match(() => {
226
324
  process5.exit(0);
227
325
  }, (error) => {
228
- if (Fault5.isFault(error) && error.tag === "NO_PACKAGE_MANAGER") {
326
+ if (Fault6.isFault(error) && error.tag === "NO_PACKAGE_MANAGER") {
229
327
  log3.error(error.flatten());
230
328
  }
231
329
  process5.exit(1);
232
330
  })
233
331
  });
234
332
 
235
- // src/commands/init.ts
236
- import { writeFile as writeFile4 } from "node:fs/promises";
237
- import { join as join5 } from "node:path";
333
+ // src/commands/format.ts
238
334
  import process6 from "node:process";
239
- import { cancel, confirm, intro, isCancel, log as log4, multiselect, outro, spinner } from "@clack/prompts";
240
- import { Fault as Fault8 } from "faultier";
241
- import { err as err3, fromPromise as fromPromise5, fromSafePromise, ok as ok8, safeTry as safeTry7 } from "neverthrow";
335
+ import { log as log4 } from "@clack/prompts";
336
+ import { Fault as Fault7 } from "faultier";
337
+ import { ok as ok7, safeTry as safeTry7 } from "neverthrow";
338
+ import { dlxCommand as dlxCommand4 } from "nypm";
339
+ var format_default = defineCommand({
340
+ command: "format [files..]",
341
+ describe: "Format files using oxfmt",
342
+ builder: (yargs) => yargs.positional("files", {
343
+ describe: "Specific files to format (optional)",
344
+ type: "string",
345
+ array: true
346
+ }).option("check", {
347
+ type: "boolean",
348
+ description: "Check if files are formatted without writing"
349
+ }),
350
+ handler: (argv) => safeTry7(async function* () {
351
+ const packageManager = yield* getPackageManagerName();
352
+ const args = [];
353
+ if (argv.check) {
354
+ args.push("--check");
355
+ }
356
+ if (argv.files && argv.files.length > 0) {
357
+ args.push(...argv.files);
358
+ }
359
+ const command = dlxCommand4(packageManager, oxfmt.name, { args });
360
+ const result = yield* runCommand(command);
361
+ return ok7(result);
362
+ }).match(() => {
363
+ process6.exit(0);
364
+ }, (error) => {
365
+ if (Fault7.isFault(error) && error.tag === "NO_PACKAGE_MANAGER") {
366
+ log4.error(error.flatten());
367
+ }
368
+ process6.exit(1);
369
+ })
370
+ });
371
+
372
+ // src/commands/init.ts
373
+ import { writeFile as writeFile5 } from "node:fs/promises";
374
+ import { join as join6 } from "node:path";
375
+ import process7 from "node:process";
376
+ import * as p from "@clack/prompts";
377
+ import { Fault as Fault10 } from "faultier";
378
+ import { err as err4, fromPromise as fromPromise6, fromSafePromise, ok as ok10, safeTry as safeTry10 } from "neverthrow";
242
379
  import { addDevDependency } from "nypm";
243
380
 
244
381
  // src/helpers/editors/vscode.ts
245
- import { mkdir, readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
246
- import { join as join3 } from "node:path";
247
- import { Fault as Fault6 } from "faultier";
248
- import { fromPromise as fromPromise3, ok as ok6, safeTry as safeTry5 } from "neverthrow";
382
+ import { mkdir, readFile as readFile4, writeFile as writeFile3 } from "node:fs/promises";
383
+ import { join as join4 } from "node:path";
384
+ import { Fault as Fault8 } from "faultier";
385
+ import { fromPromise as fromPromise4, ok as ok8, safeTry as safeTry8 } from "neverthrow";
249
386
  var vscode = {
250
387
  config: {
251
388
  "typescript.tsdk": "node_modules/typescript/lib",
252
389
  "editor.formatOnSave": true,
253
390
  "editor.formatOnPaste": true,
254
391
  "editor.codeActionsOnSave": {
255
- "source.organizeImports.biome": "explicit",
256
392
  "source.fixAll.biome": "explicit"
257
393
  },
258
394
  "[javascript][typescript][javascriptreact][typescriptreact][json][jsonc][css][graphql]": {
259
- "editor.defaultFormatter": "biomejs.biome"
395
+ "editor.defaultFormatter": "oxc.oxc-vscode"
260
396
  }
261
397
  },
262
- exists: () => checkIfExists(join3(process.cwd(), ".vscode", "settings.json")),
263
- create: () => safeTry5(async function* () {
264
- const vscodePath = join3(process.cwd(), ".vscode");
265
- yield* fromPromise3(mkdir(vscodePath, { recursive: true }), (error) => Fault6.wrap(error).withTag("FAILED_TO_CREATE_DIRECTORY").withDescription("Failed to create .vscode directory", "We're unable to create the .vscode directory in the current directory.").withContext({ path: vscodePath }));
266
- yield* fromPromise3(writeFile2(join3(vscodePath, "settings.json"), JSON.stringify(vscode.config, null, 2)), (error) => Fault6.wrap(error).withTag("FAILED_TO_WRITE_FILE").withDescription("Failed to write .vscode/settings.json", "We're unable to write the .vscode/settings.json file in the current directory."));
267
- return ok6();
398
+ exists: () => checkIfExists(join4(process.cwd(), ".vscode", "settings.json")),
399
+ create: () => safeTry8(async function* () {
400
+ const vscodePath = join4(process.cwd(), ".vscode");
401
+ yield* fromPromise4(mkdir(vscodePath, { recursive: true }), (error) => Fault8.wrap(error).withTag("FAILED_TO_CREATE_DIRECTORY").withDescription("Failed to create .vscode directory", "We're unable to create the .vscode directory in the current directory.").withContext({ path: vscodePath }));
402
+ yield* fromPromise4(writeFile3(join4(vscodePath, "settings.json"), JSON.stringify(vscode.config, null, 2)), (error) => Fault8.wrap(error).withTag("FAILED_TO_WRITE_FILE").withDescription("Failed to write .vscode/settings.json", "We're unable to write the .vscode/settings.json file in the current directory."));
403
+ return ok8();
268
404
  }),
269
- update: () => safeTry5(async function* () {
270
- const vscodePath = join3(process.cwd(), ".vscode", "settings.json");
271
- const vscodeFile = yield* fromPromise3(readFile3(vscodePath, "utf-8"), (error) => Fault6.wrap(error).withTag("FAILED_TO_READ_FILE").withDescription("Failed to read .vscode/settings.json", "We're unable to read the .vscode/settings.json file in the current directory.").withContext({ path: vscodePath }));
405
+ update: () => safeTry8(async function* () {
406
+ const vscodePath = join4(process.cwd(), ".vscode", "settings.json");
407
+ const vscodeFile = yield* fromPromise4(readFile4(vscodePath, "utf-8"), (error) => Fault8.wrap(error).withTag("FAILED_TO_READ_FILE").withDescription("Failed to read .vscode/settings.json", "We're unable to read the .vscode/settings.json file in the current directory.").withContext({ path: vscodePath }));
272
408
  const existingConfig = yield* parseJson(vscodeFile);
273
409
  const newConfig = yield* mergeConfig(vscode.config, existingConfig);
274
- yield* fromPromise3(writeFile2(join3(process.cwd(), ".vscode", "settings.json"), JSON.stringify(newConfig, null, 2)), (error) => Fault6.wrap(error).withTag("FAILED_TO_WRITE_FILE").withDescription("Failed to write .vscode/settings.json", "We're unable to write the .vscode/settings.json file in the current directory.").withContext({ path: vscodePath }));
275
- return ok6();
410
+ yield* fromPromise4(writeFile3(join4(process.cwd(), ".vscode", "settings.json"), JSON.stringify(newConfig, null, 2)), (error) => Fault8.wrap(error).withTag("FAILED_TO_WRITE_FILE").withDescription("Failed to write .vscode/settings.json", "We're unable to write the .vscode/settings.json file in the current directory.").withContext({ path: vscodePath }));
411
+ return ok8();
276
412
  })
277
413
  };
278
414
 
279
415
  // src/helpers/tsconfig.ts
280
- import { readFile as readFile4, writeFile as writeFile3 } from "node:fs/promises";
281
- import { join as join4 } from "node:path";
282
- import { Fault as Fault7 } from "faultier";
283
- import { fromPromise as fromPromise4, ok as ok7, safeTry as safeTry6 } from "neverthrow";
416
+ import { readFile as readFile5, writeFile as writeFile4 } from "node:fs/promises";
417
+ import { join as join5 } from "node:path";
418
+ import { Fault as Fault9 } from "faultier";
419
+ import { fromPromise as fromPromise5, ok as ok9, safeTry as safeTry9 } from "neverthrow";
284
420
  var tsconfig = {
285
- config: { extends: "adamantite/tsconfig" },
286
- exists: () => checkIfExists(join4(process.cwd(), "tsconfig.json")),
287
- create: () => fromPromise4(writeFile3(join4(process.cwd(), "tsconfig.json"), JSON.stringify(tsconfig.config, null, 2)), (error) => Fault7.wrap(error).withTag("FAILED_TO_WRITE_FILE").withDescription("Failed to write tsconfig.json", "We're unable to write the tsconfig.json file in the current directory.")),
288
- update: () => safeTry6(async function* () {
289
- const tsconfigFile = yield* fromPromise4(readFile4(join4(process.cwd(), "tsconfig.json"), "utf-8"), (error) => Fault7.wrap(error).withTag("FAILED_TO_READ_FILE").withDescription("Failed to read tsconfig.json", "We're unable to read the tsconfig.json file in the current directory."));
421
+ config: { extends: "adamantite/typescript" },
422
+ exists: () => checkIfExists(join5(process.cwd(), "tsconfig.json")),
423
+ create: () => fromPromise5(writeFile4(join5(process.cwd(), "tsconfig.json"), JSON.stringify(tsconfig.config, null, 2)), (error) => Fault9.wrap(error).withTag("FAILED_TO_WRITE_FILE").withDescription("Failed to write tsconfig.json", "We're unable to write the tsconfig.json file in the current directory.")),
424
+ update: () => safeTry9(async function* () {
425
+ const tsconfigFile = yield* fromPromise5(readFile5(join5(process.cwd(), "tsconfig.json"), "utf-8"), (error) => Fault9.wrap(error).withTag("FAILED_TO_READ_FILE").withDescription("Failed to read tsconfig.json", "We're unable to read the tsconfig.json file in the current directory."));
290
426
  const existingConfig = yield* parseJson(tsconfigFile);
291
427
  const newConfig = yield* mergeConfig(tsconfig.config, existingConfig);
292
- yield* fromPromise4(writeFile3(join4(process.cwd(), "tsconfig.json"), JSON.stringify(newConfig, null, 2)), (error) => Fault7.wrap(error).withTag("FAILED_TO_WRITE_FILE").withDescription("Failed to write tsconfig.json", "We're unable to write the tsconfig.json file in the current directory."));
293
- return ok7();
428
+ yield* fromPromise5(writeFile4(join5(process.cwd(), "tsconfig.json"), JSON.stringify(newConfig, null, 2)), (error) => Fault9.wrap(error).withTag("FAILED_TO_WRITE_FILE").withDescription("Failed to write tsconfig.json", "We're unable to write the tsconfig.json file in the current directory."));
429
+ return ok9();
294
430
  })
295
431
  };
296
432
 
297
433
  // src/commands/init.ts
434
+ var installDependencies = (packages) => safeTry10(async function* () {
435
+ const s = p.spinner();
436
+ s.start("Installing dependencies...");
437
+ const isMonorepo = yield* checkIsMonorepo();
438
+ for (const pkg of packages) {
439
+ yield* fromPromise6(addDevDependency(pkg, { silent: true, workspace: isMonorepo }), (error) => Fault10.wrap(error).withTag("FAILED_TO_INSTALL_DEPENDENCY").withMessage(`Failed to install ${pkg}`));
440
+ }
441
+ s.stop("Dependencies installed.");
442
+ return ok10();
443
+ });
444
+ var setupBiomeConfig = () => safeTry10(async function* () {
445
+ const spinner2 = p.spinner();
446
+ spinner2.start("Setting up Biome config...");
447
+ const biomePath = await biome.exists();
448
+ if (biomePath.path) {
449
+ spinner2.message(`Found \`${biomePath.path}\`, updating...`);
450
+ yield* biome.update();
451
+ spinner2.stop("Biome config updated successfully.");
452
+ } else {
453
+ spinner2.message("`.biome.jsonc` or `.biome.json` not found, creating...");
454
+ yield* biome.create();
455
+ spinner2.stop("Biome config created successfully.");
456
+ }
457
+ return ok10();
458
+ });
459
+ var setupOxfmtConfig = () => safeTry10(async function* () {
460
+ const spinner2 = p.spinner();
461
+ spinner2.start("Setting up oxfmt config...");
462
+ const oxfmtPath = await oxfmt.exists();
463
+ if (oxfmtPath.path) {
464
+ spinner2.message(`Found \`${oxfmtPath.path}\`, updating...`);
465
+ yield* oxfmt.update();
466
+ spinner2.stop("oxfmt config updated successfully.");
467
+ } else {
468
+ spinner2.message("`.oxfmtrc.jsonc` or `.oxfmtrc.json` not found, creating...");
469
+ yield* oxfmt.create();
470
+ spinner2.stop("oxfmt config created successfully.");
471
+ }
472
+ return ok10();
473
+ });
474
+ var addScripts = (scripts) => safeTry10(async function* () {
475
+ const cwd = process7.cwd();
476
+ const packageJson = yield* readPackageJson();
477
+ const spinner2 = p.spinner();
478
+ spinner2.start("Adding scripts to your `package.json`...");
479
+ if (!packageJson.scripts) {
480
+ packageJson.scripts = {};
481
+ }
482
+ for (const script of scripts) {
483
+ switch (script) {
484
+ case "check":
485
+ packageJson.scripts.check = "adamantite check";
486
+ break;
487
+ case "fix":
488
+ packageJson.scripts.fix = "adamantite fix";
489
+ break;
490
+ case "format":
491
+ packageJson.scripts.format = "adamantite format";
492
+ break;
493
+ case "typecheck":
494
+ packageJson.scripts.typecheck = "tsc --noEmit";
495
+ break;
496
+ case "check:monorepo":
497
+ packageJson.scripts["check:monorepo"] = "adamantite monorepo";
498
+ break;
499
+ case "fix:monorepo":
500
+ packageJson.scripts["fix:monorepo"] = "adamantite monorepo --fix";
501
+ break;
502
+ default:
503
+ return err4(Fault10.create("UNKNOWN_SCRIPT").withContext({ script }));
504
+ }
505
+ }
506
+ yield* fromPromise6(writeFile5(join6(cwd, "package.json"), JSON.stringify(packageJson, null, 2)), (error) => Fault10.wrap(error).withTag("FAILED_TO_WRITE_FILE").withDescription("Failed to write package.json", "We're unable to update the package.json file.").withContext({ path: join6(cwd, "package.json") }));
507
+ spinner2.stop("Scripts added to your `package.json`");
508
+ return ok10();
509
+ });
510
+ var setupTypescript = () => safeTry10(async function* () {
511
+ const spinner2 = p.spinner();
512
+ spinner2.start("Setting up TypeScript config...");
513
+ if (await tsconfig.exists()) {
514
+ spinner2.message("`tsconfig.json` found, updating...");
515
+ yield* tsconfig.update();
516
+ spinner2.stop("`tsconfig.json` updated successfully");
517
+ } else {
518
+ spinner2.message("`tsconfig.json` not found, creating...");
519
+ yield* tsconfig.create();
520
+ spinner2.stop("`tsconfig.json` created successfully");
521
+ }
522
+ return ok10();
523
+ });
524
+ var setupEditors = (editors) => safeTry10(async function* () {
525
+ if (editors.includes("vscode")) {
526
+ const spinner2 = p.spinner();
527
+ spinner2.start("Checking for `.vscode/settings.json`...");
528
+ if (await vscode.exists()) {
529
+ spinner2.message("`.vscode/settings.json` found, updating...");
530
+ yield* vscode.update();
531
+ spinner2.stop("`.vscode/settings.json` updated with Adamantite preset.");
532
+ } else {
533
+ spinner2.message("`.vscode/settings.json` not found, creating...");
534
+ yield* vscode.create();
535
+ spinner2.stop("`.vscode/settings.json` created with Adamantite preset.");
536
+ }
537
+ }
538
+ if (editors.includes("zed")) {}
539
+ return ok10();
540
+ });
298
541
  var init_default = defineCommand({
299
542
  command: "init",
300
543
  describe: "Initialize Adamantite in the current directory",
301
544
  builder: (yargs) => yargs,
302
- handler: async () => {
303
- const cwd = process6.cwd();
304
- return safeTry7(async function* () {
305
- let packageJson = yield* readPackageJson();
306
- intro(getTitle());
307
- const hasPnpmWorkspace = await checkIfExists(join5(process6.cwd(), "pnpm-workspace.yaml"));
308
- const isMonorepo = packageJson.workspaces !== undefined || hasPnpmWorkspace;
309
- const shouldInstallScripts = yield* fromSafePromise(confirm({
310
- message: "Do you want to add the `check` and `fix` scripts to your `package.json`?"
311
- }));
312
- if (isCancel(shouldInstallScripts)) {
313
- return err3(Fault8.create("OPERATION_CANCELLED"));
314
- }
315
- let shouldInstallMonorepoScripts = false;
316
- if (isMonorepo) {
317
- const shouldInstallMonorepoScriptsResponse = yield* fromSafePromise(confirm({
318
- message: "We've detected a monorepo setup in your project. Would you like to install monorepo linting scripts?"
319
- }));
320
- if (isCancel(shouldInstallMonorepoScriptsResponse)) {
321
- return err3(Fault8.create("OPERATION_CANCELLED"));
322
- }
323
- shouldInstallMonorepoScripts = shouldInstallMonorepoScriptsResponse;
324
- }
325
- const shouldInstallTypeScriptPreset = yield* fromSafePromise(confirm({
326
- message: "Adamantite provides a TypeScript preset to enforce strict type-safety. Would you like to install it?"
327
- }));
328
- if (isCancel(shouldInstallTypeScriptPreset)) {
329
- return err3(Fault8.create("OPERATION_CANCELLED"));
330
- }
331
- const selectedEditors = yield* fromSafePromise(multiselect({
332
- message: "Which editors do you want to configure (recommended)?",
333
- options: [
334
- { label: "VSCode / Cursor / Windsurf", value: "vscode" },
335
- { label: "Zed (coming soon)", value: "zed" }
336
- ],
337
- required: false
338
- }));
339
- if (isCancel(selectedEditors)) {
340
- return err3(Fault8.create("OPERATION_CANCELLED"));
341
- }
342
- const installingDependencies = spinner();
343
- installingDependencies.start("Installing dependencies...");
344
- yield* fromPromise5(addDevDependency("adamantite"), (error) => Fault8.wrap(error).withTag("FAILED_TO_INSTALL_DEPENDENCY").withMessage("Failed to install Adamantite"));
345
- yield* fromPromise5(addDevDependency(`${biome.name}@${biome.version}`), (error) => Fault8.wrap(error).withTag("FAILED_TO_INSTALL_DEPENDENCY").withMessage("Failed to install Biome"));
346
- if (shouldInstallMonorepoScripts) {
347
- yield* fromPromise5(addDevDependency(`${sherif.name}@${sherif.version}`), (error) => Fault8.wrap(error).withTag("FAILED_TO_INSTALL_DEPENDENCY").withMessage("Failed to install Sherif"));
348
- }
349
- installingDependencies.stop("Dependencies installed successfully");
350
- const settingUpBiomeConfig = spinner();
351
- settingUpBiomeConfig.start("Setting up Biome config...");
352
- const biomePath = await biome.exists();
353
- if (biomePath.path) {
354
- settingUpBiomeConfig.message("Biome config found, updating...");
355
- yield* biome.update();
356
- settingUpBiomeConfig.stop("Biome config updated successfully");
357
- } else {
358
- settingUpBiomeConfig.message("Biome config not found, creating...");
359
- yield* biome.create();
360
- settingUpBiomeConfig.stop("Biome config created successfully");
361
- }
362
- if (shouldInstallScripts) {
363
- const addingScripts = spinner();
364
- packageJson = yield* readPackageJson();
365
- addingScripts.start("Adding scripts to your `package.json`...");
366
- if (!packageJson.scripts) {
367
- packageJson.scripts = {};
368
- }
369
- packageJson.scripts.check = "adamantite check";
370
- packageJson.scripts.fix = "adamantite fix";
371
- if (shouldInstallMonorepoScripts) {
372
- packageJson.scripts["lint:monorepo"] = "adamantite monorepo";
373
- }
374
- yield* fromPromise5(writeFile4(join5(cwd, "package.json"), JSON.stringify(packageJson, null, 2)), (error) => Fault8.wrap(error).withTag("FAILED_TO_WRITE_FILE").withDescription("Failed to write package.json", "We're unable to update the package.json file.").withContext({ path: join5(cwd, "package.json") }));
375
- addingScripts.stop("Scripts added to your `package.json`");
376
- }
377
- if (shouldInstallTypeScriptPreset) {
378
- const settingUpTypeScriptConfig = spinner();
379
- settingUpTypeScriptConfig.start("Setting up TypeScript config...");
380
- if (await tsconfig.exists()) {
381
- settingUpTypeScriptConfig.message("`tsconfig.json` found, updating...");
382
- yield* tsconfig.update();
383
- settingUpTypeScriptConfig.stop("`tsconfig.json` updated successfully");
384
- } else {
385
- settingUpTypeScriptConfig.message("`tsconfig.json` not found, creating...");
386
- yield* tsconfig.create();
387
- settingUpTypeScriptConfig.stop("`tsconfig.json` created successfully");
388
- }
389
- }
390
- if (selectedEditors.length > 0) {
391
- const settingUpEditorConfig = spinner();
392
- settingUpEditorConfig.start("Setting up editor config...");
393
- if (selectedEditors.includes("vscode")) {
394
- const settingUpVSCodeConfig = spinner();
395
- settingUpVSCodeConfig.start("Setting up VSCode config...");
396
- if (await vscode.exists()) {
397
- settingUpVSCodeConfig.message("VSCode settings found, updating...");
398
- yield* vscode.update();
399
- settingUpVSCodeConfig.stop("VSCode settings updated with Adamantite preset");
400
- } else {
401
- settingUpVSCodeConfig.message("VSCode settings not found, creating...");
402
- yield* vscode.create();
403
- settingUpVSCodeConfig.stop("VSCode settings created with Adamantite preset");
404
- }
405
- }
406
- if (selectedEditors.includes("zed")) {
407
- log4.warning("Zed configuration coming soon...");
545
+ handler: () => safeTry10(async function* () {
546
+ const packageManager = yield* getPackageManagerName();
547
+ printTitle();
548
+ p.intro("\uD83D\uDCA0 adamantite init");
549
+ p.log.info(`Detected package manager: ${packageManager}`);
550
+ const isMonorepo = yield* checkIsMonorepo();
551
+ if (isMonorepo) {
552
+ p.log.info("We've detected a monorepo setup in your project.");
553
+ }
554
+ const scripts = yield* fromSafePromise(p.multiselect({
555
+ message: "Which scripts do you want to add to your `package.json`?",
556
+ options: [
557
+ {
558
+ label: "check - find issues in code using Biome",
559
+ value: "check",
560
+ hint: "recommended"
561
+ },
562
+ {
563
+ label: "fix - fix code issues using Biome",
564
+ value: "fix",
565
+ hint: "recommended"
566
+ },
567
+ {
568
+ label: "format - code formatting using oxfmt",
569
+ value: "format",
570
+ hint: "recommended"
571
+ },
572
+ {
573
+ label: "typecheck - type-check your code using strict TypeScript preset",
574
+ value: "typecheck",
575
+ hint: "extends the `adamantite/typescript` preset in your `tsconfig.json`"
576
+ },
577
+ {
578
+ label: "check:monorepo - check for monorepo-specific issues using Sherif",
579
+ value: "check:monorepo",
580
+ hint: isMonorepo ? undefined : "available for monorepo projects",
581
+ disabled: !isMonorepo
582
+ },
583
+ {
584
+ label: "fix:monorepo - fix monorepo-specific issues using Sherif",
585
+ value: "fix:monorepo",
586
+ hint: isMonorepo ? undefined : "available for monorepo projects",
587
+ disabled: !isMonorepo
408
588
  }
409
- settingUpEditorConfig.stop("Editor config set up successfully");
410
- }
411
- return ok8();
412
- }).match(() => {
413
- outro("\uD83D\uDCA0 Adamantite initialized successfully!");
414
- process6.exit(0);
415
- }, (error) => {
416
- if (Fault8.isFault(error) && error.tag === "OPERATION_CANCELLED") {
417
- cancel("You've cancelled the initialization process.");
418
- process6.exit(0);
419
- return;
420
- }
421
- if (Fault8.isFault(error)) {
422
- log4.error(error.flatten());
423
- } else {
424
- log4.error(String(error));
425
- }
426
- cancel("Failed to initialize Adamantite");
427
- process6.exit(1);
428
- });
429
- }
589
+ ]
590
+ }));
591
+ if (p.isCancel(scripts)) {
592
+ return err4(Fault10.create("OPERATION_CANCELLED"));
593
+ }
594
+ const editors = yield* fromSafePromise(p.multiselect({
595
+ message: "Which editors do you want to configure? (optional)",
596
+ options: [
597
+ { label: "VSCode / Cursor / Windsurf", value: "vscode" },
598
+ { label: "Zed", value: "zed", disabled: true, hint: "coming soon" }
599
+ ],
600
+ required: false
601
+ }));
602
+ if (p.isCancel(editors)) {
603
+ return err4(Fault10.create("OPERATION_CANCELLED"));
604
+ }
605
+ const hasBiome = scripts.includes("check") || scripts.includes("fix");
606
+ const hasOxfmt = scripts.includes("format");
607
+ const hasSherif = scripts.includes("check:monorepo") || scripts.includes("fix:monorepo");
608
+ const hasTypecheck = scripts.includes("typecheck");
609
+ const dependencies = ["adamantite"];
610
+ if (hasBiome) {
611
+ dependencies.push(`${biome.name}@${biome.version}`);
612
+ }
613
+ if (hasOxfmt) {
614
+ dependencies.push(`${oxfmt.name}@${oxfmt.version}`);
615
+ }
616
+ if (hasSherif) {
617
+ dependencies.push(`${sherif.name}@${sherif.version}`);
618
+ }
619
+ if (hasTypecheck) {
620
+ dependencies.push("typescript");
621
+ }
622
+ yield* installDependencies(dependencies);
623
+ if (hasOxfmt) {
624
+ yield* setupOxfmtConfig();
625
+ }
626
+ if (hasBiome) {
627
+ yield* setupBiomeConfig();
628
+ }
629
+ yield* addScripts(scripts);
630
+ if (hasTypecheck) {
631
+ yield* setupTypescript();
632
+ }
633
+ yield* setupEditors(editors);
634
+ return ok10();
635
+ }).match(() => {
636
+ p.outro("\uD83D\uDCA0 Adamantite initialized successfully!");
637
+ process7.exit(0);
638
+ }, (error) => {
639
+ if (Fault10.isFault(error) && error.tag === "OPERATION_CANCELLED") {
640
+ p.cancel("You've cancelled the initialization process.");
641
+ process7.exit(0);
642
+ }
643
+ if (!Fault10.isFault(error)) {
644
+ p.log.error(`An unexpected error occurred: ${String(error)}`);
645
+ p.cancel("Failed to initialize Adamantite");
646
+ process7.exit(1);
647
+ }
648
+ p.log.error(error.flatten());
649
+ p.cancel("Failed to initialize Adamantite");
650
+ process7.exit(1);
651
+ })
430
652
  });
431
653
 
432
654
  // src/commands/monorepo.ts
433
- import process7 from "node:process";
434
- import { log as log5 } from "@clack/prompts";
435
- import { Fault as Fault9 } from "faultier";
436
- import { ok as ok9, safeTry as safeTry8 } from "neverthrow";
437
- import { dlxCommand as dlxCommand4 } from "nypm";
655
+ import process8 from "node:process";
656
+ import { log as log6 } from "@clack/prompts";
657
+ import { Fault as Fault11 } from "faultier";
658
+ import { ok as ok11, safeTry as safeTry11 } from "neverthrow";
659
+ import { dlxCommand as dlxCommand5 } from "nypm";
438
660
  var monorepo_default = defineCommand({
439
661
  command: "monorepo",
440
- describe: "Lint and automatically fix monorepo-specific issues using Sherif",
441
- builder: (yargs) => yargs,
442
- handler: async () => safeTry8(async function* () {
662
+ describe: "Find and fix monorepo-specific issues using Sherif",
663
+ builder: (yargs) => yargs.option("fix", {
664
+ type: "boolean",
665
+ description: "Automatically fix issues"
666
+ }),
667
+ handler: (argv) => safeTry11(async function* () {
443
668
  const packageManager = yield* getPackageManagerName();
444
- const args = ["--fix"];
445
- const command = dlxCommand4(packageManager, sherif.name, { args });
446
- yield* runCommand(command, {
447
- stdio: "inherit"
448
- });
449
- return ok9(undefined);
669
+ const args = [];
670
+ if (argv.fix) {
671
+ args.push("--fix");
672
+ }
673
+ const command = dlxCommand5(packageManager, sherif.name, { args });
674
+ yield* runCommand(command);
675
+ return ok11(undefined);
450
676
  }).match(() => {
451
- process7.exit(0);
677
+ process8.exit(0);
452
678
  }, (error) => {
453
- if (Fault9.isFault(error) && error.tag === "NO_PACKAGE_MANAGER") {
454
- log5.error(error.flatten());
679
+ if (Fault11.isFault(error) && error.tag === "NO_PACKAGE_MANAGER") {
680
+ log6.error(error.flatten());
455
681
  }
456
- process7.exit(1);
682
+ process8.exit(1);
457
683
  })
458
684
  });
459
685
 
460
686
  // src/commands/update.ts
461
- import process8 from "node:process";
462
- import { cancel as cancel2, confirm as confirm2, intro as intro2, isCancel as isCancel2, log as log6, outro as outro2, spinner as spinner2 } from "@clack/prompts";
463
- import { Fault as Fault10 } from "faultier";
464
- import { err as err4, fromPromise as fromPromise6, fromSafePromise as fromSafePromise2, ok as ok10, safeTry as safeTry9 } from "neverthrow";
687
+ import process9 from "node:process";
688
+ import { cancel as cancel2, confirm, intro as intro2, isCancel as isCancel2, log as log7, outro as outro2, spinner as spinner2 } from "@clack/prompts";
689
+ import { Fault as Fault12 } from "faultier";
690
+ import { err as err5, fromPromise as fromPromise7, fromSafePromise as fromSafePromise2, ok as ok12, safeTry as safeTry12 } from "neverthrow";
465
691
  import { addDevDependency as addDevDependency2 } from "nypm";
466
692
  var update_default = defineCommand({
467
693
  command: "update",
468
694
  describe: "Update adamantite dependencies to latest compatible versions",
469
695
  builder: (yargs) => yargs,
470
- handler: async () => safeTry9(async function* () {
696
+ handler: async () => safeTry12(async function* () {
471
697
  const packageJson = yield* readPackageJson();
472
- intro2(getTitle());
698
+ printTitle();
699
+ intro2("\uD83D\uDCA0 adamantite update");
473
700
  const updates = [];
474
- for (const pkg of [biome, sherif]) {
701
+ for (const pkg of [biome, oxfmt, sherif]) {
475
702
  const dependency = packageJson.devDependencies?.[pkg.name];
476
- if (dependency && dependency !== pkg.version) {
703
+ if (dependency && normalizeDependencyVersion(dependency) !== pkg.version) {
477
704
  updates.push({
478
705
  name: pkg.name,
479
706
  currentVersion: dependency,
@@ -483,55 +710,54 @@ var update_default = defineCommand({
483
710
  }
484
711
  }
485
712
  if (updates.length === 0) {
486
- log6.success("All adamantite dependencies are already up to date!");
487
- return ok10("no-updates");
713
+ log7.success("All adamantite dependencies are already up to date!");
714
+ return ok12("no-updates");
488
715
  }
489
- log6.message("The following dependencies will be updated:");
490
- log6.message("");
716
+ log7.message("The following dependencies will be updated:");
717
+ log7.message("");
491
718
  for (const dep of updates) {
492
- log6.message(` ${dep.name}: ${dep.currentVersion} → ${dep.targetVersion}`);
719
+ log7.message(` ${dep.name}: ${dep.currentVersion} → ${dep.targetVersion}`);
493
720
  }
494
- log6.message("");
495
- const shouldUpdate = yield* fromSafePromise2(confirm2({
721
+ log7.message("");
722
+ const shouldUpdate = yield* fromSafePromise2(confirm({
496
723
  message: "Do you want to proceed with these updates?"
497
724
  }));
498
725
  if (isCancel2(shouldUpdate)) {
499
- return err4(Fault10.create("OPERATION_CANCELLED"));
726
+ return err5(Fault12.create("OPERATION_CANCELLED"));
500
727
  }
501
728
  if (!shouldUpdate) {
502
- return ok10("cancelled");
729
+ return ok12("cancelled");
503
730
  }
504
731
  const s = spinner2();
505
732
  s.start("Updating dependencies...");
506
733
  for (const dep of updates) {
507
- yield* fromPromise6(addDevDependency2(`${dep.name}@${dep.targetVersion}`), (error) => Fault10.wrap(error).withTag("FAILED_TO_INSTALL_DEPENDENCY").withMessage(`Failed to update ${dep.name}`));
734
+ yield* fromPromise7(addDevDependency2(`${dep.name}@${dep.targetVersion}`), (error) => Fault12.wrap(error).withTag("FAILED_TO_INSTALL_DEPENDENCY").withMessage(`Failed to update ${dep.name}`));
508
735
  }
509
736
  s.stop("Dependencies updated successfully");
510
- return ok10("updated");
737
+ return ok12("updated");
511
738
  }).match((value) => {
512
739
  if (value === "no-updates") {
513
- outro2("\uD83D\uDCA0 No updates needed");
740
+ outro2(" No updates needed");
514
741
  } else if (value === "cancelled") {
515
- outro2("\uD83D\uDCA0 Update cancelled");
742
+ outro2("⚠️ Update cancelled");
516
743
  } else if (value === "updated") {
517
- outro2("\uD83D\uDCA0 Dependencies updated successfully!");
744
+ outro2(" Dependencies updated successfully!");
518
745
  }
519
- process8.exit(0);
746
+ process9.exit(0);
520
747
  }, (error) => {
521
- if (Fault10.isFault(error) && error.tag === "OPERATION_CANCELLED") {
748
+ if (Fault12.isFault(error) && error.tag === "OPERATION_CANCELLED") {
522
749
  cancel2("You've cancelled the update process.");
523
- process8.exit(0);
524
- return;
750
+ process9.exit(0);
525
751
  }
526
- if (Fault10.isFault(error)) {
527
- log6.error(error.flatten());
752
+ if (Fault12.isFault(error)) {
753
+ log7.error(error.flatten());
528
754
  } else {
529
- log6.error(String(error));
755
+ log7.error(String(error));
530
756
  }
531
757
  cancel2("Failed to update dependencies");
532
- process8.exit(1);
758
+ process9.exit(1);
533
759
  })
534
760
  });
535
761
 
536
762
  // src/index.ts
537
- yargs(hideBin(process.argv)).scriptName("adamantite").version("0.14.2").command(check_default).command(ci_default).command(fix_default).command(init_default).command(monorepo_default).command(update_default).demandCommand(1).strict().help().parse();
763
+ yargs(hideBin(process.argv)).scriptName("adamantite").version("0.16.0").command(check_default).command(ci_default).command(fix_default).command(format_default).command(init_default).command(monorepo_default).command(update_default).demandCommand(1).strict().help().parse();