worktree-add 1.3.9 → 1.3.11
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/cli/format-diverged-branch-message.d.ts +8 -0
- package/dist/cli/format-diverged-branch-message.d.ts.map +1 -0
- package/dist/cli/format-diverged-branch-message.js +20 -0
- package/dist/cli/format-diverged-branch-message.js.map +1 -0
- package/dist/cli/open-worktree-apps.js +3 -3
- package/dist/cli/open-worktree-apps.js.map +1 -1
- package/dist/cli/run-worktree-add.d.ts.map +1 -1
- package/dist/cli/run-worktree-add.js +6 -17
- package/dist/cli/run-worktree-add.js.map +1 -1
- package/dist/cli.d.ts +0 -8
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -9
- package/dist/cli.js.map +1 -1
- package/dist/git/create-worktree.d.ts +0 -3
- package/dist/git/create-worktree.d.ts.map +1 -1
- package/dist/git/create-worktree.js +27 -20
- package/dist/git/create-worktree.js.map +1 -1
- package/dist/git/fetch-remote-branch.d.ts.map +1 -1
- package/dist/git/fetch-remote-branch.js +2 -10
- package/dist/git/fetch-remote-branch.js.map +1 -1
- package/dist/git/git.d.ts +0 -51
- package/dist/git/git.d.ts.map +1 -1
- package/dist/git/git.js +2 -55
- package/dist/git/git.js.map +1 -1
- package/dist/git/worktree-discovery.d.ts +0 -12
- package/dist/git/worktree-discovery.d.ts.map +1 -1
- package/dist/git/worktree-discovery.js +33 -32
- package/dist/git/worktree-discovery.js.map +1 -1
- package/dist/output/create-status-logger.d.ts +1 -0
- package/dist/output/create-status-logger.d.ts.map +1 -1
- package/dist/output/create-status-logger.js +5 -0
- package/dist/output/create-status-logger.js.map +1 -1
- package/dist/project/install-commands.d.ts +2 -13
- package/dist/project/install-commands.d.ts.map +1 -1
- package/dist/project/install-commands.js +2 -12
- package/dist/project/install-commands.js.map +1 -1
- package/dist/project/next.d.ts +0 -5
- package/dist/project/next.d.ts.map +1 -1
- package/dist/project/next.js +0 -5
- package/dist/project/next.js.map +1 -1
- package/dist/project/package-manager-commands.d.ts +2 -6
- package/dist/project/package-manager-commands.d.ts.map +1 -1
- package/dist/project/package-manager-commands.js +2 -6
- package/dist/project/package-manager-commands.js.map +1 -1
- package/dist/project/package-manager-name.d.ts +6 -0
- package/dist/project/package-manager-name.d.ts.map +1 -0
- package/dist/project/package-manager-name.js +5 -0
- package/dist/project/package-manager-name.js.map +1 -0
- package/dist/project/package-manager.d.ts +0 -8
- package/dist/project/package-manager.d.ts.map +1 -1
- package/dist/project/package-manager.js +3 -18
- package/dist/project/package-manager.js.map +1 -1
- package/dist/project/setup.d.ts +0 -8
- package/dist/project/setup.d.ts.map +1 -1
- package/dist/project/setup.js +2 -11
- package/dist/project/setup.js.map +1 -1
- package/dist/worktree/destination-directory.d.ts +0 -8
- package/dist/worktree/destination-directory.d.ts.map +1 -1
- package/dist/worktree/destination-directory.js +58 -50
- package/dist/worktree/destination-directory.js.map +1 -1
- package/dist/worktree/file-patterns.d.ts +0 -5
- package/dist/worktree/file-patterns.d.ts.map +1 -1
- package/dist/worktree/file-patterns.js +0 -6
- package/dist/worktree/file-patterns.js.map +1 -1
- package/dist/worktree/untracked-file-copy.d.ts +0 -8
- package/dist/worktree/untracked-file-copy.d.ts.map +1 -1
- package/dist/worktree/untracked-file-copy.js +2 -10
- package/dist/worktree/untracked-file-copy.js.map +1 -1
- package/package.json +5 -5
- package/dist/output/get-status-logger.d.ts +0 -3
- package/dist/output/get-status-logger.d.ts.map +0 -1
- package/dist/output/get-status-logger.js +0 -13
- package/dist/output/get-status-logger.js.map +0 -1
|
@@ -1,29 +1,60 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* destination-directory.ts
|
|
3
|
-
*
|
|
4
|
-
* Utilities for managing worktree directories
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Cross-platform trash functionality using the trash package.
|
|
8
|
-
*
|
|
9
|
-
* Platform-specific behavior:
|
|
10
|
-
* - macOS: Uses Finder's trash (~/.Trash)
|
|
11
|
-
* - Windows: Uses Recycle Bin
|
|
12
|
-
* - Linux: Uses freedesktop.org trash specification (~/.local/share/Trash)
|
|
13
|
-
*
|
|
14
|
-
* Note: On headless/CI systems, the trash directory is still created but
|
|
15
|
-
* may not be visible in a GUI. Files can be recovered by navigating to
|
|
16
|
-
* the platform-specific trash location.
|
|
17
|
-
*/
|
|
18
1
|
import path from "node:path";
|
|
19
2
|
import trash from "trash";
|
|
20
3
|
import { fileExists, confirm, exitWithMessage, git } from "../git/git.js";
|
|
21
|
-
import {
|
|
4
|
+
import { fallbackStatusLogger } from "../output/create-status-logger.js";
|
|
5
|
+
function getPromptRefusal({ interactive, isCi, isTty }) {
|
|
6
|
+
if (isCi && interactive && !isTty) {
|
|
7
|
+
return { type: "ci-interactive-without-tty" };
|
|
8
|
+
}
|
|
9
|
+
if (!interactive) {
|
|
10
|
+
return { type: "non-interactive", ciHint: isCi ? " (CI is enabled)" : "" };
|
|
11
|
+
}
|
|
12
|
+
if (!isTty) {
|
|
13
|
+
return { type: "stdin-not-tty" };
|
|
14
|
+
}
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
function promptRefusalLines(directoryName, refusal) {
|
|
18
|
+
switch (refusal.type) {
|
|
19
|
+
case "ci-interactive-without-tty": {
|
|
20
|
+
return [
|
|
21
|
+
`Directory '${directoryName}' already exists, and CI mode is enabled.`,
|
|
22
|
+
"Interactive prompts are disabled in CI.",
|
|
23
|
+
"Re-run with --yes to move the directory to trash, or remove it manually.",
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
case "non-interactive": {
|
|
27
|
+
return [
|
|
28
|
+
`Directory '${directoryName}' already exists${refusal.ciHint}.`,
|
|
29
|
+
"Refusing to prompt in non-interactive mode.",
|
|
30
|
+
"Re-run with --interactive to confirm, or --yes to move it to trash.",
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
case "stdin-not-tty": {
|
|
34
|
+
return [
|
|
35
|
+
`Directory '${directoryName}' already exists, but stdin is not a TTY.`,
|
|
36
|
+
"Re-run with --yes to move it to trash, or remove it manually.",
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
default: {
|
|
40
|
+
const exhaustive = refusal;
|
|
41
|
+
return exhaustive;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function formatPromptRefusal(directoryName, refusal) {
|
|
46
|
+
return promptRefusalLines(directoryName, refusal).join("\n");
|
|
47
|
+
}
|
|
48
|
+
function formatDryRunPromptRefusal(directoryName, refusal) {
|
|
49
|
+
// Dry run collapses the refusal onto one prefixed line, so lowercase the leading word.
|
|
50
|
+
const inlined = promptRefusalLines(directoryName, refusal).join(" ");
|
|
51
|
+
return `Dry run: ${inlined.charAt(0).toLowerCase()}${inlined.slice(1)}`;
|
|
52
|
+
}
|
|
22
53
|
export async function handleExistingDirectory(destinationDirectory, options = {}) {
|
|
23
54
|
if (!(await fileExists(destinationDirectory))) {
|
|
24
55
|
return true;
|
|
25
56
|
}
|
|
26
|
-
const logger =
|
|
57
|
+
const logger = options.logger ?? fallbackStatusLogger;
|
|
27
58
|
const dryRun = options.dryRun ?? false;
|
|
28
59
|
const assumeYes = options.assumeYes ?? false;
|
|
29
60
|
const interactive = options.interactive ?? false;
|
|
@@ -31,45 +62,23 @@ export async function handleExistingDirectory(destinationDirectory, options = {}
|
|
|
31
62
|
const ciValue = process.env.CI?.toLowerCase();
|
|
32
63
|
const isCi = ciValue === "true" || ciValue === "1";
|
|
33
64
|
const directoryName = path.basename(destinationDirectory);
|
|
65
|
+
const promptRefusal = assumeYes ? undefined : getPromptRefusal({ interactive, isCi, isTty });
|
|
34
66
|
if (dryRun) {
|
|
67
|
+
if (promptRefusal !== undefined) {
|
|
68
|
+
logger.warn(formatDryRunPromptRefusal(directoryName, promptRefusal));
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
35
71
|
if (!assumeYes) {
|
|
36
|
-
// Explicit --interactive in CI without a TTY can't prompt; call it out.
|
|
37
|
-
if (isCi && interactive && !isTty) {
|
|
38
|
-
logger.warn(`Dry run: directory '${directoryName}' already exists, and CI mode is enabled. Interactive prompts are disabled in CI. Re-run with --yes to move the directory to trash, or remove it manually.`);
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
if (!interactive) {
|
|
42
|
-
const ciHint = isCi ? " (CI is enabled)" : "";
|
|
43
|
-
logger.warn(`Dry run: directory '${directoryName}' already exists${ciHint}. Refusing to prompt in non-interactive mode. Re-run with --interactive to confirm, or --yes to move it to trash.`);
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
if (!isTty) {
|
|
47
|
-
logger.warn(`Dry run: directory '${directoryName}' already exists, but stdin is not a TTY. Re-run with --yes to move it to trash, or remove it manually.`);
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
72
|
logger.step(`Would prompt to move existing directory '${directoryName}' to trash`);
|
|
51
73
|
return false;
|
|
52
74
|
}
|
|
53
75
|
logger.step(`Would move existing directory '${directoryName}' to trash`);
|
|
54
76
|
return true;
|
|
55
77
|
}
|
|
78
|
+
if (promptRefusal !== undefined) {
|
|
79
|
+
exitWithMessage(formatPromptRefusal(directoryName, promptRefusal));
|
|
80
|
+
}
|
|
56
81
|
if (!assumeYes) {
|
|
57
|
-
// Explicit --interactive in CI without a TTY can't prompt; call it out.
|
|
58
|
-
if (isCi && interactive && !isTty) {
|
|
59
|
-
exitWithMessage(`Directory '${directoryName}' already exists, and CI mode is enabled.\n` +
|
|
60
|
-
"Interactive prompts are disabled in CI.\n" +
|
|
61
|
-
"Re-run with --yes to move the directory to trash, or remove it manually.");
|
|
62
|
-
}
|
|
63
|
-
if (!interactive) {
|
|
64
|
-
const ciHint = isCi ? " (CI is enabled)" : "";
|
|
65
|
-
exitWithMessage(`Directory '${directoryName}' already exists${ciHint}.\n` +
|
|
66
|
-
"Refusing to prompt in non-interactive mode.\n" +
|
|
67
|
-
"Re-run with --interactive to confirm, or --yes to move it to trash.");
|
|
68
|
-
}
|
|
69
|
-
if (!isTty) {
|
|
70
|
-
exitWithMessage(`Directory '${directoryName}' already exists, but stdin is not a TTY.\n` +
|
|
71
|
-
"Re-run with --yes to move it to trash, or remove it manually.");
|
|
72
|
-
}
|
|
73
82
|
const proceed = await confirm(`Directory '${directoryName}' already exists. Move to trash and recreate? (You can restore it from your system trash if needed)`);
|
|
74
83
|
if (!proceed) {
|
|
75
84
|
console.error("Operation cancelled.");
|
|
@@ -97,7 +106,6 @@ export async function handleExistingDirectory(destinationDirectory, options = {}
|
|
|
97
106
|
const details = error instanceof Error ? (error.stack ?? error.message) : String(error);
|
|
98
107
|
logger.detail(`Error checking for existing worktree registration: ${details}`);
|
|
99
108
|
}
|
|
100
|
-
// Move the existing directory to trash
|
|
101
109
|
logger.step(`Moving existing directory '${directoryName}' to trash...`);
|
|
102
110
|
try {
|
|
103
111
|
await trash(destinationDirectory);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"destination-directory.js","sourceRoot":"","sources":["../../src/worktree/destination-directory.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"destination-directory.js","sourceRoot":"","sources":["../../src/worktree/destination-directory.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAE1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAoBzE,SAAS,gBAAgB,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAe;IACjE,IAAI,IAAI,IAAI,WAAW,IAAI,CAAC,KAAK,EAAE,CAAC;QAClC,OAAO,EAAE,IAAI,EAAE,4BAA4B,EAAE,CAAC;IAChD,CAAC;IAED,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,M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ACb,oDAAoD,aAAa,wCAAwC,CAC1G,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* file-patterns.ts
|
|
3
|
-
*
|
|
4
|
-
* Shared utilities for worktree file selection
|
|
5
|
-
*/
|
|
6
1
|
export declare const EXTRA_IGNORED_PATTERNS: string[];
|
|
7
2
|
export declare const globToRegExp: (globPattern: string) => RegExp;
|
|
8
3
|
export declare const toPosixPath: (value: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-patterns.d.ts","sourceRoot":"","sources":["../../src/worktree/file-patterns.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"file-patterns.d.ts","sourceRoot":"","sources":["../../src/worktree/file-patterns.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,EAAE,MAAM,EAiB1C,CAAC;AAKF,eAAO,MAAM,YAAY,gBAAiB,MAAM,KAAG,MAyBlD,CAAC;AAEF,eAAO,MAAM,WAAW,UAAW,MAAM,KAAG,MAAqC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-patterns.js","sourceRoot":"","sources":["../../src/worktree/file-patterns.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"file-patterns.js","sourceRoot":"","sources":["../../src/worktree/file-patterns.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAa;IAC9C,iBAAiB;IACjB,UAAU;IACV,UAAU;IACV,YAAY;IACZ,SAAS;IACT,UAAU;IACV,kBAAkB;IAClB,WAAW;IACX,WAAW;IACX,aAAa;IACb,UAAU;IACV,SAAS;IACT,gBAAgB;IAChB,kBAAkB;IAClB,WAAW,EAAE,OAAO;IACpB,eAAe,EAAE,OAAO;CACzB,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,KAAa,EAAU,EAAE,CAChD,KAA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
-
*
|
|
4
|
-
* Utilities for copying untracked files to worktrees
|
|
5
|
-
*/
|
|
6
1
|
import type { StatusLogger } from "../output/create-status-logger.js";
|
|
7
|
-
/**
|
|
8
|
-
* Copy untracked files from source to destination, excluding ignored patterns
|
|
9
|
-
*/
|
|
10
2
|
export declare function copyUntrackedFiles(repoRoot: string, destinationDirectory: string, options?: {
|
|
11
3
|
dryRun?: boolean;
|
|
12
4
|
logger?: StatusLogger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"untracked-file-copy.d.ts","sourceRoot":"","sources":["../../src/worktree/untracked-file-copy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"untracked-file-copy.d.ts","sourceRoot":"","sources":["../../src/worktree/untracked-file-copy.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAGtE,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,MAAM,EAChB,oBAAoB,EAAE,MAAM,EAC5B,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,YAAY,CAAA;CAAE,GACpD,OAAO,CAAC,IAAI,CAAC,CAiFf"}
|
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* untracked-file-copy.ts
|
|
3
|
-
*
|
|
4
|
-
* Utilities for copying untracked files to worktrees
|
|
5
|
-
*/
|
|
6
1
|
import * as fs from "node:fs/promises";
|
|
7
2
|
import path from "node:path";
|
|
8
3
|
import { git } from "../git/git.js";
|
|
9
4
|
import { EXTRA_IGNORED_PATTERNS, globToRegExp, toPosixPath } from "./file-patterns.js";
|
|
10
|
-
import {
|
|
11
|
-
/**
|
|
12
|
-
* Copy untracked files from source to destination, excluding ignored patterns
|
|
13
|
-
*/
|
|
5
|
+
import { fallbackStatusLogger } from "../output/create-status-logger.js";
|
|
14
6
|
export async function copyUntrackedFiles(repoRoot, destinationDirectory, options) {
|
|
15
|
-
const logger =
|
|
7
|
+
const logger = options?.logger ?? fallbackStatusLogger;
|
|
16
8
|
const dryRun = options?.dryRun ?? false;
|
|
17
9
|
const extraIgnoredRegexes = EXTRA_IGNORED_PATTERNS.map((pattern) => globToRegExp(pattern));
|
|
18
10
|
const untrackedEntries = new Set();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"untracked-file-copy.js","sourceRoot":"","sources":["../../src/worktree/untracked-file-copy.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"untracked-file-copy.js","sourceRoot":"","sources":["../../src/worktree/untracked-file-copy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,QAAgB,EAChB,oBAA4B,EAC5B,OAAqD;IAErD,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,oBAAoB,CAAC;IACvD,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,KAAK,CAAC;IACxC,MAAM,mBAAmB,GAAG,sBAAsB,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;IAE3F,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAU,CAAC;IAC3C,mGAAmG;IACnG,4DAA4D;IAC5D,MAAM,cAAc,GAAG;QACrB,GAAG,GAAG,CACJ,UAAU,EACV,UAAU,EACV,oBAAoB,EACpB,aAAa,EACb,IAAI,EAAE,yCAAyC;QAC/C,EAAE,GAAG,EAAE,QAAQ,EAAE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,EAAE;aAC/B,IAAI,CAAC,eAAe,CAAC;aACrB,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC;aAChB,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;YACxB,IACE,KAAK;gBACL,OAAO,KAAK,KAAK,QAAQ;gBACzB,MAAM,IAAI,KAAK;gBACd,KAA+B,CAAC,IAAI,KAAK,QAAQ,EAClD,CAAC;gBACD,OAAO,KAAK,CAAC;YACf,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC,CAAC,CAAC;QACL,IAAI,iBAAiB,EAAE,CAAC;YACtB,MAAM,CAAC,MAAM,CAAC,WAAW,YAAY,gCAAgC,CAAC,CAAC;YACvE,SAAS;QACX,CAAC;QACD,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,CAAC,MAAM,CAAC,cAAc,YAAY,EAAE,CAAC,CAAC;YAC5C,SAAS;QACX,CAAC;QACD,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACnE,MAAM,EAAE,CAAC,EAAE,CAAC,UAAU,EAAE,eAAe,EAAE;YACvC,SAAS,EAAE,IAAI;YACf,YAAY,EAAE,KAAK;SACpB,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,UAAU,YAAY,EAAE,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "worktree-add",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.11",
|
|
4
4
|
"description": "Create a Git worktree next to your current repo for a branch, copy useful local files, install deps, and open it in your apps.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -59,17 +59,17 @@
|
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@total-typescript/ts-reset": "^0.6.1",
|
|
62
|
-
"@types/node": "^25.9.
|
|
62
|
+
"@types/node": "^25.9.3",
|
|
63
63
|
"@typescript/native-preview": "beta",
|
|
64
64
|
"@vitest/coverage-v8": "^4.1.8",
|
|
65
|
-
"fta-check": "^1.5.
|
|
65
|
+
"fta-check": "^1.5.4",
|
|
66
66
|
"fta-cli": "^3.0.0",
|
|
67
67
|
"knip": "^6.16.1",
|
|
68
68
|
"oxfmt": "^0.54.0",
|
|
69
69
|
"oxlint": "^1.69.0",
|
|
70
|
-
"oxlint-config-j4k": "^2.7.
|
|
70
|
+
"oxlint-config-j4k": "^2.7.4",
|
|
71
71
|
"oxlint-tsgolint": "^0.23.0",
|
|
72
|
-
"semantic-release": "^25.0.
|
|
72
|
+
"semantic-release": "^25.0.5",
|
|
73
73
|
"vitest": "^4.1.8"
|
|
74
74
|
},
|
|
75
75
|
"engines": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-status-logger.d.ts","sourceRoot":"","sources":["../../src/output/get-status-logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAY9D,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,GAAG,YAAY,CAE9E"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// Fallback logger only emits warnings so important signals aren't dropped.
|
|
2
|
-
const fallbackLogger = {
|
|
3
|
-
step() { },
|
|
4
|
-
success() { },
|
|
5
|
-
detail() { },
|
|
6
|
-
warn(message) {
|
|
7
|
-
console.error(message);
|
|
8
|
-
},
|
|
9
|
-
};
|
|
10
|
-
export function getStatusLogger(logger) {
|
|
11
|
-
return logger ?? fallbackLogger;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=get-status-logger.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-status-logger.js","sourceRoot":"","sources":["../../src/output/get-status-logger.ts"],"names":[],"mappings":"AAEA,2EAA2E;AAC3E,MAAM,cAAc,GAAiB;IACnC,IAAI,KAAI,CAAC;IACT,OAAO,KAAI,CAAC;IACZ,MAAM,KAAI,CAAC;IACX,IAAI,CAAC,OAAe;QAClB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;CACF,CAAC;AAEF,MAAM,UAAU,eAAe,CAAC,MAAgC;IAC9D,OAAO,MAAM,IAAI,cAAc,CAAC;AAClC,CAAC"}
|