@visulima/vis 1.0.0-alpha.3 → 1.0.0-alpha.4
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/CHANGELOG.md +128 -24
- package/LICENSE.md +27 -0
- package/README.md +15 -9
- package/dist/audit-config.d.ts +24 -0
- package/dist/bin.js +777 -70
- package/dist/catalog.d.ts +16 -8
- package/dist/commands/add.d.ts +3 -0
- package/dist/commands/approve-builds.d.ts +3 -0
- package/dist/commands/audit.d.ts +23 -0
- package/dist/commands/clean.d.ts +3 -0
- package/dist/commands/create/discovery.d.ts +42 -0
- package/dist/commands/create/index.d.ts +13 -0
- package/dist/commands/create/prompts.d.ts +31 -0
- package/dist/commands/create/random-name.d.ts +15 -0
- package/dist/commands/create/templates/builtin.d.ts +15 -0
- package/dist/commands/create/templates/generator.d.ts +14 -0
- package/dist/commands/create/templates/index.d.ts +13 -0
- package/dist/commands/create/templates/monorepo.d.ts +16 -0
- package/dist/commands/create/templates/remote.d.ts +41 -0
- package/dist/commands/create/templates/types.d.ts +46 -0
- package/dist/commands/create/utils.d.ts +42 -0
- package/dist/commands/dedupe.d.ts +3 -0
- package/dist/commands/devcontainer.d.ts +3 -0
- package/dist/commands/dlx.d.ts +3 -0
- package/dist/commands/doctor.d.ts +15 -0
- package/dist/commands/exec.d.ts +3 -0
- package/dist/commands/implode.d.ts +3 -0
- package/dist/commands/init.d.ts +14 -0
- package/dist/commands/install.d.ts +3 -0
- package/dist/commands/link.d.ts +3 -0
- package/dist/commands/optimize.d.ts +38 -0
- package/dist/commands/pm.d.ts +3 -0
- package/dist/commands/remove.d.ts +3 -0
- package/dist/commands/sort-package-json.d.ts +3 -0
- package/dist/commands/unlink.d.ts +3 -0
- package/dist/commands/upgrade.d.ts +3 -0
- package/dist/commands/why.d.ts +3 -0
- package/dist/config.d.ts +38 -11
- package/dist/config.js +1 -1
- package/dist/native-binding.d.ts +151 -0
- package/dist/output.d.ts +40 -0
- package/dist/overrides.d.ts +82 -0
- package/dist/plugins/config-loader.d.ts +3 -0
- package/dist/plugins/post-command.d.ts +3 -0
- package/dist/plugins/security-enforcement.d.ts +3 -0
- package/dist/pm-runner.d.ts +23 -0
- package/dist/security.d.ts +64 -0
- package/dist/socket-security.d.ts +129 -0
- package/dist/tips.d.ts +41 -0
- package/dist/tui/components/CheckProgressApp.d.ts +6 -0
- package/dist/tui/components/CommandSummary.d.ts +17 -0
- package/dist/tui/components/Header.d.ts +13 -0
- package/dist/tui/components/OutputPanel.d.ts +16 -0
- package/dist/tui/components/QuitDialog.d.ts +15 -0
- package/dist/tui/components/TaskListPanel.d.ts +19 -0
- package/dist/tui/components/TaskRow.d.ts +12 -0
- package/dist/tui/components/TaskStore.d.ts +80 -0
- package/dist/tui/components/VisTaskRunnerApp.d.ts +17 -0
- package/dist/tui/components/devcontainer/DevcontainerStore.d.ts +66 -0
- package/dist/tui/components/devcontainer/VisDevcontainerApp.d.ts +9 -0
- package/dist/tui/components/devcontainer/catalogs/extensions.d.ts +8 -0
- package/dist/tui/components/devcontainer/catalogs/features.d.ts +8 -0
- package/dist/tui/components/devcontainer/catalogs/filters.d.ts +4 -0
- package/dist/tui/components/devcontainer/catalogs/mount-suggestions.d.ts +19 -0
- package/dist/tui/components/devcontainer/catalogs/templates.d.ts +8 -0
- package/dist/tui/components/devcontainer/devcontainer-io.d.ts +14 -0
- package/dist/tui/components/devcontainer/sections/DockerComposeSection.d.ts +11 -0
- package/dist/tui/components/devcontainer/sections/EnvironmentSection.d.ts +16 -0
- package/dist/tui/components/devcontainer/sections/ExtensionsSection.d.ts +11 -0
- package/dist/tui/components/devcontainer/sections/FeaturesSection.d.ts +11 -0
- package/dist/tui/components/devcontainer/sections/GeneralSection.d.ts +12 -0
- package/dist/tui/components/devcontainer/sections/LifecycleSection.d.ts +13 -0
- package/dist/tui/components/devcontainer/sections/MountsSection.d.ts +16 -0
- package/dist/tui/components/devcontainer/sections/PortsSection.d.ts +10 -0
- package/dist/tui/components/devcontainer/sections/PreviewPanel.d.ts +11 -0
- package/dist/tui/components/devcontainer/types.d.ts +53 -0
- package/dist/tui/components/devcontainer/validate.d.ts +16 -0
- package/dist/tui/components/graph/GraphStore.d.ts +42 -0
- package/dist/tui/components/graph/ProjectDetailPanel.d.ts +10 -0
- package/dist/tui/components/graph/ProjectListPanel.d.ts +20 -0
- package/dist/tui/components/graph/VisGraphApp.d.ts +8 -0
- package/dist/tui/components/optimize/OptimizeDetailPanel.d.ts +9 -0
- package/dist/tui/components/optimize/OptimizeListPanel.d.ts +16 -0
- package/dist/tui/components/optimize/OptimizeStore.d.ts +50 -0
- package/dist/tui/components/optimize/VisOptimizeApp.d.ts +8 -0
- package/dist/tui/components/optimize/constants.d.ts +7 -0
- package/dist/tui/components/update/PackageDetailPanel.d.ts +12 -0
- package/dist/tui/components/update/PackageListPanel.d.ts +18 -0
- package/dist/tui/components/update/UpdateStore.d.ts +62 -0
- package/dist/tui/components/update/VisUpdateApp.d.ts +11 -0
- package/dist/tui/dynamic-life-cycle.d.ts +21 -0
- package/dist/tui/formatting-utils.d.ts +17 -0
- package/dist/tui/pretty-time.d.ts +8 -0
- package/dist/tui/static-life-cycle.d.ts +22 -0
- package/dist/tui/status-utils.d.ts +20 -0
- package/dist/tui/symbols.d.ts +7 -0
- package/dist/tui/types.d.ts +11 -0
- package/dist/typosquats.d.ts +70 -0
- package/dist/upgrade-check.d.ts +30 -0
- package/dist/utils.d.ts +22 -0
- package/dist/workspace.d.ts +262 -5
- package/index.js +600 -0
- package/package.json +34 -11
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { OutdatedEntry } from "../../../catalog.d.ts";
|
|
2
|
+
import type { FilterType } from "./UpdateStore.d.ts";
|
|
3
|
+
interface PackageListPanelProps {
|
|
4
|
+
checkedEntries: Set<string>;
|
|
5
|
+
entries: OutdatedEntry[];
|
|
6
|
+
filterActive: boolean;
|
|
7
|
+
filterText: string;
|
|
8
|
+
filterType: FilterType;
|
|
9
|
+
focused: boolean;
|
|
10
|
+
groupedByCatalog: Map<string, OutdatedEntry[]>;
|
|
11
|
+
isDryRun: boolean;
|
|
12
|
+
scrollOffset: number;
|
|
13
|
+
selectedIndex: number;
|
|
14
|
+
totalEntries: number;
|
|
15
|
+
viewportHeight: number;
|
|
16
|
+
}
|
|
17
|
+
declare const PackageListPanel: ({ checkedEntries, entries, filterActive, filterText, filterType, focused, groupedByCatalog, isDryRun, scrollOffset, selectedIndex, totalEntries, viewportHeight, }: PackageListPanelProps) => React.JSX.Element;
|
|
18
|
+
export default PackageListPanel;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { AiAnalysisResult, AiRecommendation } from "../../../ai-analysis.d.ts";
|
|
2
|
+
import type { OutdatedEntry } from "../../../catalog.d.ts";
|
|
3
|
+
export type FilterType = "all" | "major" | "minor" | "patch" | "security";
|
|
4
|
+
export type UpdatePhase = "applying" | "browsing" | "done" | "error";
|
|
5
|
+
export interface UpdateState {
|
|
6
|
+
/** AI analysis result (null if not requested). */
|
|
7
|
+
aiResult: AiAnalysisResult | null;
|
|
8
|
+
/** Whether all visible entries are checked. */
|
|
9
|
+
allChecked: boolean;
|
|
10
|
+
/** Progress during apply phase. */
|
|
11
|
+
applyProgress: {
|
|
12
|
+
current: number;
|
|
13
|
+
total: number;
|
|
14
|
+
} | null;
|
|
15
|
+
/** Set of checked package names for selective apply. */
|
|
16
|
+
checkedEntries: Set<string>;
|
|
17
|
+
/** All outdated entries. */
|
|
18
|
+
entries: OutdatedEntry[];
|
|
19
|
+
/** Error message if apply failed. */
|
|
20
|
+
error: string | null;
|
|
21
|
+
/** Whether the text filter input is active. */
|
|
22
|
+
filterActive: boolean;
|
|
23
|
+
/** Current filter text (empty = no filter). */
|
|
24
|
+
filterText: string;
|
|
25
|
+
/** Filter by update type. */
|
|
26
|
+
filterType: FilterType;
|
|
27
|
+
/** Which panel has keyboard focus. */
|
|
28
|
+
focusedPanel: "detail" | "list";
|
|
29
|
+
/** Entries grouped by catalog name. */
|
|
30
|
+
groupedByCatalog: Map<string, OutdatedEntry[]>;
|
|
31
|
+
/** Current lifecycle phase. */
|
|
32
|
+
phase: UpdatePhase;
|
|
33
|
+
/** Currently highlighted entry index in the filtered list. */
|
|
34
|
+
selectedIndex: number;
|
|
35
|
+
}
|
|
36
|
+
type Listener = () => void;
|
|
37
|
+
export declare class UpdateStore {
|
|
38
|
+
#private;
|
|
39
|
+
constructor(entries: OutdatedEntry[], aiResult?: AiAnalysisResult | null);
|
|
40
|
+
getSnapshot: () => UpdateState;
|
|
41
|
+
subscribe: (listener: Listener) => () => void;
|
|
42
|
+
/** Get the currently filtered + visible entries. */
|
|
43
|
+
getFilteredEntries(): OutdatedEntry[];
|
|
44
|
+
/** Get AI recommendation for a specific package. */
|
|
45
|
+
getRecommendation(packageName: string): AiRecommendation | undefined;
|
|
46
|
+
/** Get the list of checked entries (for apply). */
|
|
47
|
+
getCheckedEntries(): OutdatedEntry[];
|
|
48
|
+
setSelectedIndex(index: number): void;
|
|
49
|
+
setFocusedPanel(panel: "detail" | "list"): void;
|
|
50
|
+
setFilterType(type: FilterType): void;
|
|
51
|
+
setFilter(text: string): void;
|
|
52
|
+
setFilterActive(active: boolean): void;
|
|
53
|
+
toggleCheck(packageName: string): void;
|
|
54
|
+
checkAll(): void;
|
|
55
|
+
uncheckAll(): void;
|
|
56
|
+
toggleAll(): void;
|
|
57
|
+
startApply(): void;
|
|
58
|
+
updateApplyProgress(current: number): void;
|
|
59
|
+
markDone(): void;
|
|
60
|
+
setError(error: string): void;
|
|
61
|
+
}
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { UpdateStore } from "./UpdateStore.d.ts";
|
|
3
|
+
interface VisUpdateAppProps {
|
|
4
|
+
/** 0 = no auto-exit (default), >0 = countdown seconds */
|
|
5
|
+
autoExitSeconds?: number;
|
|
6
|
+
changelogUrls?: Map<string, string>;
|
|
7
|
+
isDryRun: boolean;
|
|
8
|
+
store: UpdateStore;
|
|
9
|
+
}
|
|
10
|
+
declare const VisUpdateApp: ({ autoExitSeconds, changelogUrls, isDryRun, store }: VisUpdateAppProps) => React.JSX.Element;
|
|
11
|
+
export default VisUpdateApp;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { LifeCycleInterface, Task } from "@visulima/task-runner";
|
|
2
|
+
import { TaskStore } from "./components/TaskStore.d.ts";
|
|
3
|
+
interface DynamicOutputOptions {
|
|
4
|
+
args: {
|
|
5
|
+
parallel?: boolean | number;
|
|
6
|
+
targets: string[];
|
|
7
|
+
};
|
|
8
|
+
/** Auto-exit config: false = stay open, true = 3s countdown, number = custom seconds */
|
|
9
|
+
autoExit?: boolean | number;
|
|
10
|
+
projectNames: string[];
|
|
11
|
+
/** Registry of writable stdin entries keyed by task ID, for interactive input. */
|
|
12
|
+
stdinRegistry?: Map<string, import("./types").StdinEntry>;
|
|
13
|
+
tasks: Task[];
|
|
14
|
+
}
|
|
15
|
+
interface DynamicOutputResult {
|
|
16
|
+
lifeCycle: LifeCycleInterface;
|
|
17
|
+
renderIsDone: Promise<void>;
|
|
18
|
+
store: TaskStore;
|
|
19
|
+
}
|
|
20
|
+
export declare const createDynamicOutputRenderer: (options: DynamicOutputOptions) => DynamicOutputResult;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Task } from "@visulima/task-runner";
|
|
2
|
+
/**
|
|
3
|
+
* Formats a CLI flag for display output.
|
|
4
|
+
* @param leftPad Padding string
|
|
5
|
+
* @param flag The flag name
|
|
6
|
+
* @param value The flag value
|
|
7
|
+
*/
|
|
8
|
+
export declare const formatFlags: (leftPad: string, flag: string, value: unknown) => string;
|
|
9
|
+
/**
|
|
10
|
+
* Generates a human-readable description of the targets and projects being executed.
|
|
11
|
+
*
|
|
12
|
+
* Examples:
|
|
13
|
+
* - "target build for project my-app"
|
|
14
|
+
* - "targets build, test for 5 projects"
|
|
15
|
+
* - "target build for 3 projects and 2 tasks they depend on"
|
|
16
|
+
*/
|
|
17
|
+
export declare const formatTargetsAndProjects: (projectNames: string[], targets: string[], tasks: Task[]) => string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats a process.hrtime() tuple into a compact string like "1s 234ms".
|
|
3
|
+
*/
|
|
4
|
+
export declare const formatHrtime: (hrtime: [number, number]) => string;
|
|
5
|
+
/**
|
|
6
|
+
* Formats milliseconds into a compact string like "1s 300ms", "340ms", "1m 5s".
|
|
7
|
+
*/
|
|
8
|
+
export declare const formatMs: (ms: number) => string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { LifeCycleInterface, Task, TaskResult, TaskStatus } from "@visulima/task-runner";
|
|
2
|
+
interface StaticOutputOptions {
|
|
3
|
+
args: {
|
|
4
|
+
targets: string[];
|
|
5
|
+
};
|
|
6
|
+
projectNames: string[];
|
|
7
|
+
tasks: Task[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A lifecycle handler for CI environments that produces static, append-only output.
|
|
11
|
+
* No cursor manipulation — just linear log lines.
|
|
12
|
+
*/
|
|
13
|
+
export declare class StaticOutputLifeCycle implements LifeCycleInterface {
|
|
14
|
+
#private;
|
|
15
|
+
constructor(options: StaticOutputOptions);
|
|
16
|
+
startCommand(): void;
|
|
17
|
+
startTasks(tasks: Task[]): void;
|
|
18
|
+
endTasks(taskResults: TaskResult[]): void;
|
|
19
|
+
printTaskTerminalOutput(task: Task, status: TaskStatus, terminalOutput: string): void;
|
|
20
|
+
endCommand(): void;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TaskStatus } from "@visulima/task-runner";
|
|
2
|
+
export declare const isCacheStatus: (status: string) => boolean;
|
|
3
|
+
export interface StatusInfo {
|
|
4
|
+
color: string;
|
|
5
|
+
icon: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const getStatusInfo: (status: TaskStatus) => StatusInfo;
|
|
8
|
+
/**
|
|
9
|
+
* Returns the colored status icon as an ANSI string (for raw stdout writes).
|
|
10
|
+
*/
|
|
11
|
+
export declare const getStatusIcon: (status: TaskStatus) => string;
|
|
12
|
+
/**
|
|
13
|
+
* Returns a colored prefix string for a status (for raw stdout writes).
|
|
14
|
+
*/
|
|
15
|
+
export declare const getStatusPrefix: (status: TaskStatus) => string;
|
|
16
|
+
/**
|
|
17
|
+
* Logs task terminal output with formatting.
|
|
18
|
+
* Uses GitHub Actions grouping when available.
|
|
19
|
+
*/
|
|
20
|
+
export declare const logCommandOutputCI: (taskId: string, status: TaskStatus, output: string) => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a writable stdin entry for interactive PTY input.
|
|
3
|
+
*/
|
|
4
|
+
export interface StdinEntry {
|
|
5
|
+
/** Kill the child process/PTY. */
|
|
6
|
+
kill?: (signal?: string) => void;
|
|
7
|
+
/** Resize the child's PTY (only available for PTY-backed processes). */
|
|
8
|
+
resize?: (cols: number, rows: number) => void;
|
|
9
|
+
/** Write data to the child's stdin or PTY. */
|
|
10
|
+
write: (data: string) => void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typosquat detection for package names.
|
|
3
|
+
*
|
|
4
|
+
* Uses a curated blocklist of known typosquats (data/typosquats.json) and
|
|
5
|
+
* runtime heuristics (character substitution, transposition, omission) to
|
|
6
|
+
* warn users before they install a potentially malicious package.
|
|
7
|
+
*/
|
|
8
|
+
export type Blocklist = Record<string, string[]>;
|
|
9
|
+
export interface TyposquatMatch {
|
|
10
|
+
/** The package name that was checked. */
|
|
11
|
+
input: string;
|
|
12
|
+
/** The legitimate package this appears to be a typosquat of. */
|
|
13
|
+
legitimate: string;
|
|
14
|
+
/** How the match was detected: "blocklist" (exact match in JSON) or "heuristic" (generated variant). */
|
|
15
|
+
method: "blocklist" | "heuristic";
|
|
16
|
+
}
|
|
17
|
+
export interface TyposquatCheckResult {
|
|
18
|
+
/** Whether the operation should proceed. */
|
|
19
|
+
ok: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* The (possibly corrected) package names to use.
|
|
22
|
+
* When the user chooses "use suggested name", the typosquat names are
|
|
23
|
+
* replaced with their legitimate counterparts.
|
|
24
|
+
*/
|
|
25
|
+
packages: string[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Generates typosquat variants of a package name using common attack patterns:
|
|
29
|
+
* - Character omission (dropping one character)
|
|
30
|
+
* - Adjacent character transposition (swapping neighbors)
|
|
31
|
+
* - Character duplication (repeating one character)
|
|
32
|
+
* - Homoglyph / keyboard substitution
|
|
33
|
+
* - Separator manipulation (dash/dot/underscore swaps)
|
|
34
|
+
* - Common suffixes (-js, -node)
|
|
35
|
+
*
|
|
36
|
+
* Separators (`-`, `.`, `_`) are preserved during omission and duplication passes.
|
|
37
|
+
* Transposition is skipped when either character is a separator.
|
|
38
|
+
* Names shorter than 3 characters return an empty set.
|
|
39
|
+
* @param name The package name to generate variants for.
|
|
40
|
+
* @returns A set of unique variant strings (never includes the original name).
|
|
41
|
+
*/
|
|
42
|
+
export declare const generateVariants: (name: string) => Set<string>;
|
|
43
|
+
/**
|
|
44
|
+
* Check a single package name against the typosquat blocklist.
|
|
45
|
+
* Returns a match if the name is a known typosquat, or `undefined` if safe.
|
|
46
|
+
*/
|
|
47
|
+
export declare const checkTyposquat: (packageName: string) => TyposquatMatch | undefined;
|
|
48
|
+
/** Check multiple package names. Returns only the matches (empty if all safe). */
|
|
49
|
+
export declare const checkTyposquats: (packageNames: string[], allowlist?: string[]) => TyposquatMatch[];
|
|
50
|
+
/**
|
|
51
|
+
* Display typosquat warnings and prompt the user.
|
|
52
|
+
*
|
|
53
|
+
* Choices:
|
|
54
|
+
* - **S** (suggested): replace the typosquat names with the correct packages and continue
|
|
55
|
+
* - **y** (yes): continue with the original (potentially dangerous) names
|
|
56
|
+
* - **N** (no, default): abort the operation
|
|
57
|
+
*
|
|
58
|
+
* Non-interactive mode always aborts.
|
|
59
|
+
*/
|
|
60
|
+
export declare const runTyposquatCheck: (packageNames: string[], allowlist?: string[]) => Promise<TyposquatCheckResult>;
|
|
61
|
+
/**
|
|
62
|
+
* Scan package.json dependencies for potential typosquats.
|
|
63
|
+
*
|
|
64
|
+
* Unlike `runTyposquatCheck` (used by `add`), this cannot replace names because
|
|
65
|
+
* they live in package.json. It warns the user and asks whether to proceed.
|
|
66
|
+
*
|
|
67
|
+
* In non-interactive mode, always aborts.
|
|
68
|
+
* @returns `true` to proceed, `false` to abort.
|
|
69
|
+
*/
|
|
70
|
+
export declare const scanDepsForTyposquats: (cwd: string, allowlist?: string[]) => Promise<boolean>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Background upgrade check - non-intrusive update notification.
|
|
3
|
+
*
|
|
4
|
+
* Per vite-plus upgrade-check RFC:
|
|
5
|
+
* - Spawns async registry check while command runs (no latency impact)
|
|
6
|
+
* - Shows single-line notice at most once per 24 hours
|
|
7
|
+
* - Cached at ~/.vis/.upgrade-check.json
|
|
8
|
+
* - Skipped in CI, test, quiet, non-TTY, and excluded commands
|
|
9
|
+
* - 500ms timeout prevents network from delaying exit
|
|
10
|
+
*/
|
|
11
|
+
/** Commands that should NOT trigger upgrade checks. */
|
|
12
|
+
declare const EXCLUDED_COMMANDS: Set<string>;
|
|
13
|
+
/**
|
|
14
|
+
* Compares two semver version strings.
|
|
15
|
+
* Returns true if `latest` is newer than `current`.
|
|
16
|
+
*/
|
|
17
|
+
declare const isNewerVersion: (current: string, latest: string) => boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Determines if the upgrade check should run for this invocation.
|
|
20
|
+
*/
|
|
21
|
+
declare const shouldCheck: (command: string) => boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Runs the background upgrade check. Non-blocking.
|
|
24
|
+
*
|
|
25
|
+
* 1. Check if we need to query the registry (24h cooldown)
|
|
26
|
+
* 2. If yes, fetch latest version asynchronously
|
|
27
|
+
* 3. Return a promise that resolves with the check function to call after command
|
|
28
|
+
*/
|
|
29
|
+
declare const startUpgradeCheck: (currentVersion: string, command: string) => (() => void) | undefined;
|
|
30
|
+
export { EXCLUDED_COMMANDS, isNewerVersion, shouldCheck, startUpgradeCheck };
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utility for option parsing across command handlers.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Converts a CLI option value (which may be undefined, a single string,
|
|
6
|
+
* or an array of strings) into a normalized string array.
|
|
7
|
+
*/
|
|
8
|
+
declare const toStringArray: (value: unknown) => string[];
|
|
9
|
+
/**
|
|
10
|
+
* Safely extracts an error message from an unknown caught value.
|
|
11
|
+
* Handles Error instances, strings, and other types.
|
|
12
|
+
*/
|
|
13
|
+
declare const errorMessage: (error: unknown) => string;
|
|
14
|
+
/**
|
|
15
|
+
* Extracts the package name and optional version specifier from a CLI argument
|
|
16
|
+
* like "react", "react@19", "@scope/pkg@^2".
|
|
17
|
+
*/
|
|
18
|
+
declare const parsePackageArgument: (argument: string) => {
|
|
19
|
+
name: string;
|
|
20
|
+
versionSpec: string | undefined;
|
|
21
|
+
};
|
|
22
|
+
export { errorMessage, parsePackageArgument, toStringArray };
|
package/dist/workspace.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import type { ProjectGraph, TargetConfiguration, WorkspaceConfiguration } from "@visulima/task-runner";
|
|
1
|
+
import type { ConstraintsConfig, ProjectGraph, TargetConfiguration, WorkspaceConfiguration } from "@visulima/task-runner";
|
|
2
|
+
import type { Configuration as StagedConfig } from "lint-staged";
|
|
2
3
|
interface PackageJson {
|
|
4
|
+
bin?: Record<string, string> | string;
|
|
3
5
|
dependencies?: Record<string, string>;
|
|
4
6
|
devDependencies?: Record<string, string>;
|
|
5
7
|
name?: string;
|
|
6
8
|
peerDependencies?: Record<string, string>;
|
|
7
9
|
scripts?: Record<string, string>;
|
|
8
10
|
workspaces?: string[] | {
|
|
9
|
-
|
|
11
|
+
catalog?: Record<string, string>;
|
|
12
|
+
packages?: string[];
|
|
10
13
|
};
|
|
11
14
|
}
|
|
12
15
|
interface VisConfig {
|
|
@@ -19,18 +22,267 @@ interface VisConfig {
|
|
|
19
22
|
/** Use a specific provider instead of auto-detecting (e.g., `"claude"`, `"gemini"`). */
|
|
20
23
|
provider?: string;
|
|
21
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Project dependency constraints.
|
|
27
|
+
* Enforced after building the project graph, before running tasks.
|
|
28
|
+
*/
|
|
29
|
+
constraints?: ConstraintsConfig;
|
|
30
|
+
/**
|
|
31
|
+
* Configuration for the `vis create` scaffolding command.
|
|
32
|
+
* Controls template downloads (via giget), default options, and
|
|
33
|
+
* post-creation behavior.
|
|
34
|
+
*/
|
|
35
|
+
create?: {
|
|
36
|
+
/**
|
|
37
|
+
* Authorization token for downloading private repository templates.
|
|
38
|
+
* Passed as Bearer token to the git host API.
|
|
39
|
+
* Can also be set via GIGET_AUTH, GITHUB_TOKEN, or GH_TOKEN environment variables.
|
|
40
|
+
*/
|
|
41
|
+
auth?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Default editor to configure after scaffolding.
|
|
44
|
+
* When set, `vis create` automatically generates editor config files.
|
|
45
|
+
* @example "vscode"
|
|
46
|
+
*/
|
|
47
|
+
defaultEditor?: "vscode";
|
|
48
|
+
/**
|
|
49
|
+
* Default package manager for new standalone projects.
|
|
50
|
+
* When set, skips the PM selection prompt in interactive mode.
|
|
51
|
+
*/
|
|
52
|
+
defaultPm?: "bun" | "npm" | "pnpm" | "yarn";
|
|
53
|
+
/**
|
|
54
|
+
* Default giget provider for `owner/repo` shorthand inputs.
|
|
55
|
+
* @default "github"
|
|
56
|
+
*/
|
|
57
|
+
defaultProvider?: "bitbucket" | "github" | "gitlab" | "sourcehut";
|
|
58
|
+
/**
|
|
59
|
+
* Initialize a git repository after scaffolding standalone projects.
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
62
|
+
gitInit?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Install dependencies automatically after scaffolding.
|
|
65
|
+
* @default true
|
|
66
|
+
*/
|
|
67
|
+
install?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Prefer locally cached templates over re-downloading.
|
|
70
|
+
* Useful for offline development or slow connections.
|
|
71
|
+
* @default false
|
|
72
|
+
*/
|
|
73
|
+
preferOffline?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Custom template registry URL.
|
|
76
|
+
* When set, giget checks this registry for template metadata
|
|
77
|
+
* before falling back to direct provider resolution.
|
|
78
|
+
* Set to `false` to disable registry lookup entirely.
|
|
79
|
+
* @see https://github.com/unjs/giget#custom-registry
|
|
80
|
+
*/
|
|
81
|
+
registry?: false | string;
|
|
82
|
+
/**
|
|
83
|
+
* Named template aliases for quick access.
|
|
84
|
+
* Maps short names to full giget source strings.
|
|
85
|
+
* @example
|
|
86
|
+
* ```
|
|
87
|
+
* templates: {
|
|
88
|
+
* "react": "github:vitejs/vite/packages/create-vite/template-react-ts",
|
|
89
|
+
* "lib": "github:my-org/lib-template",
|
|
90
|
+
* "internal": "gitlab:company/templates/node-service",
|
|
91
|
+
* }
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
templates?: Record<string, string>;
|
|
95
|
+
};
|
|
22
96
|
/** Package override mappings applied during migration (e.g., `{ "lodash": "lodash-es" }`) */
|
|
23
97
|
overrides?: Record<string, string>;
|
|
24
|
-
/**
|
|
25
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Supply chain security settings.
|
|
100
|
+
* These settings are inspired by pnpm's security features and are applied
|
|
101
|
+
* universally across all package managers (pnpm, npm, yarn, bun).
|
|
102
|
+
*
|
|
103
|
+
* For pnpm users: these map directly to pnpm-workspace.yaml settings.
|
|
104
|
+
* For npm/yarn/bun users: vis enforces these at the vis layer since
|
|
105
|
+
* those package managers lack native support.
|
|
106
|
+
*/
|
|
107
|
+
security?: {
|
|
108
|
+
/**
|
|
109
|
+
* Map of package names/patterns to allow (true) or deny (false) build scripts.
|
|
110
|
+
* Packages not listed are denied by default.
|
|
111
|
+
* Equivalent to pnpm's `allowBuilds` setting.
|
|
112
|
+
* @example
|
|
113
|
+
* ```
|
|
114
|
+
* allowBuilds: {
|
|
115
|
+
* "esbuild": true,
|
|
116
|
+
* "core-js": false,
|
|
117
|
+
* "@prisma/client": true,
|
|
118
|
+
* }
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
allowBuilds?: Record<string, boolean>;
|
|
122
|
+
/**
|
|
123
|
+
* When true, prevents transitive dependencies from using exotic sources
|
|
124
|
+
* (git repositories, direct tarball URLs). Only direct dependencies may
|
|
125
|
+
* use such sources. Equivalent to pnpm's `blockExoticSubdeps`.
|
|
126
|
+
* @default false
|
|
127
|
+
*/
|
|
128
|
+
blockExoticSubdeps?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Minimum number of minutes that must pass after a version is published
|
|
131
|
+
* before vis will allow installation. Reduces risk of installing
|
|
132
|
+
* compromised packages that are typically discovered within hours.
|
|
133
|
+
* Equivalent to pnpm's `minimumReleaseAge`.
|
|
134
|
+
* @default 0
|
|
135
|
+
* @example 1440 // 24 hours
|
|
136
|
+
*/
|
|
137
|
+
minimumReleaseAge?: number;
|
|
138
|
+
/**
|
|
139
|
+
* Package names/patterns excluded from minimumReleaseAge check.
|
|
140
|
+
* Equivalent to pnpm's `minimumReleaseAgeExclude`.
|
|
141
|
+
* @example ["webpack", "react", "@myorg/*"]
|
|
142
|
+
*/
|
|
143
|
+
minimumReleaseAgeExclude?: string[];
|
|
144
|
+
/**
|
|
145
|
+
* Socket.dev security intelligence configuration.
|
|
146
|
+
* When enabled, vis fetches package security scores, alerts, and report
|
|
147
|
+
* data from the Socket.dev API during install, update, and check commands.
|
|
148
|
+
* @see https://socket.dev
|
|
149
|
+
*/
|
|
150
|
+
socket?: {
|
|
151
|
+
/**
|
|
152
|
+
* Packages whose low Socket.dev scores or alerts have been reviewed
|
|
153
|
+
* and explicitly accepted. These packages skip the confirmation
|
|
154
|
+
* prompt during `vis add` and show as "acknowledged" in `vis audit`.
|
|
155
|
+
*
|
|
156
|
+
* Key format: package name (`"lodash"`), name@version
|
|
157
|
+
* (`"lodash@4.17.21"`), or glob (`"@myorg/*"`).
|
|
158
|
+
* Unversioned keys match all versions of that package.
|
|
159
|
+
* @example
|
|
160
|
+
* ```
|
|
161
|
+
* acceptedRisks: {
|
|
162
|
+
* "some-risky-pkg": {
|
|
163
|
+
* reason: "Internal fork, low score expected",
|
|
164
|
+
* acceptedAt: "2026-03-15T10:00:00Z",
|
|
165
|
+
* acceptedScore: 0.25,
|
|
166
|
+
* },
|
|
167
|
+
* }
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
acceptedRisks?: Record<string, {
|
|
171
|
+
/** ISO 8601 timestamp when the risk was accepted. */
|
|
172
|
+
acceptedAt: string;
|
|
173
|
+
/** The overall Socket.dev score at the time of acceptance. */
|
|
174
|
+
acceptedScore: number;
|
|
175
|
+
/** User-provided reason for accepting the risk. */
|
|
176
|
+
reason: string;
|
|
177
|
+
}>;
|
|
178
|
+
/**
|
|
179
|
+
* Custom Socket.dev API token. Falls back to the public API token.
|
|
180
|
+
* Set via VIS_SOCKET_TOKEN environment variable or here.
|
|
181
|
+
*/
|
|
182
|
+
apiToken?: string;
|
|
183
|
+
/**
|
|
184
|
+
* Cache TTL in milliseconds for Socket.dev reports.
|
|
185
|
+
* @default 3_600_000 (1 hour)
|
|
186
|
+
*/
|
|
187
|
+
cacheTtlMs?: number;
|
|
188
|
+
/**
|
|
189
|
+
* Enable Socket.dev security scanning on install/update/check commands.
|
|
190
|
+
* @default false
|
|
191
|
+
*/
|
|
192
|
+
enabled?: boolean;
|
|
193
|
+
/**
|
|
194
|
+
* Minimum overall Socket.dev score (0–1) for a package to be
|
|
195
|
+
* accepted without a confirmation prompt during `vis add`.
|
|
196
|
+
* Packages scoring below this threshold trigger an interactive
|
|
197
|
+
* prompt asking the user to confirm. Set to 0 to disable.
|
|
198
|
+
* @default 0.4
|
|
199
|
+
*/
|
|
200
|
+
minimumScore?: number;
|
|
201
|
+
/**
|
|
202
|
+
* Request timeout in milliseconds for the Socket.dev API.
|
|
203
|
+
* @default 15_000 (15 seconds)
|
|
204
|
+
*/
|
|
205
|
+
timeoutMs?: number;
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* When true, installation will fail (exit non-zero) if any dependencies
|
|
209
|
+
* have unreviewed build scripts. Equivalent to pnpm's `strictDepBuilds`.
|
|
210
|
+
* @default false
|
|
211
|
+
*/
|
|
212
|
+
strictDepBuilds?: boolean;
|
|
213
|
+
/**
|
|
214
|
+
* Trust level checking for package publishing.
|
|
215
|
+
* - "off": No trust checking (default)
|
|
216
|
+
* - "no-downgrade": Fail if a package's trust level has decreased
|
|
217
|
+
* compared to previous releases (e.g., was published by trusted
|
|
218
|
+
* publisher, now only has provenance).
|
|
219
|
+
* Equivalent to pnpm's `trustPolicy`.
|
|
220
|
+
* @default "off"
|
|
221
|
+
*/
|
|
222
|
+
trustPolicy?: "no-downgrade" | "off";
|
|
223
|
+
/**
|
|
224
|
+
* Package selectors excluded from trust policy checks.
|
|
225
|
+
* Equivalent to pnpm's `trustPolicyExclude`.
|
|
226
|
+
* @example ["chokidar@4.0.3", "@babel/core@7.28.5"]
|
|
227
|
+
*/
|
|
228
|
+
trustPolicyExclude?: string[];
|
|
229
|
+
/**
|
|
230
|
+
* Ignore the trust policy check for packages published more than
|
|
231
|
+
* the specified number of minutes ago. Useful for older packages
|
|
232
|
+
* that pre-date provenance support.
|
|
233
|
+
* Equivalent to pnpm's `trustPolicyIgnoreAfter` (10.27+).
|
|
234
|
+
* @example 43200 // 30 days
|
|
235
|
+
*/
|
|
236
|
+
trustPolicyIgnoreAfter?: number;
|
|
237
|
+
/**
|
|
238
|
+
* Package names to skip during typosquat detection.
|
|
239
|
+
* Use this for internal packages or known-safe names that happen to
|
|
240
|
+
* look similar to popular packages.
|
|
241
|
+
* @example ["my-internal-axois", "@myorg/recat"]
|
|
242
|
+
*/
|
|
243
|
+
typosquatAllowlist?: string[];
|
|
244
|
+
};
|
|
245
|
+
/** sort-package-json command defaults */
|
|
246
|
+
sortPackageJson?: {
|
|
247
|
+
/** Alphabetize script commands (default: false) */
|
|
248
|
+
sortScripts?: boolean;
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
251
|
+
* Staged file patterns and commands (replaces lint-staged).
|
|
252
|
+
*
|
|
253
|
+
* Accepts all lint-staged config forms:
|
|
254
|
+
* - `string` or `string[]` commands
|
|
255
|
+
* - Sync/async functions returning `string | string[]`
|
|
256
|
+
* - `{ title, task }` objects for named side-effect tasks
|
|
257
|
+
* - Mixed arrays of strings and functions
|
|
258
|
+
* - A top-level generate-task function
|
|
259
|
+
*/
|
|
260
|
+
staged?: StagedConfig;
|
|
26
261
|
/** Target default configurations */
|
|
27
262
|
targetDefaults?: Record<string, Partial<TargetConfiguration>>;
|
|
28
263
|
/** Task runner options */
|
|
29
264
|
taskRunnerOptions?: Record<string, unknown>;
|
|
265
|
+
/** Terminal UI configuration */
|
|
266
|
+
tui?: {
|
|
267
|
+
/**
|
|
268
|
+
* Auto-exit the TUI after tasks complete.
|
|
269
|
+
* - `false`: Stay open until the user presses `q` (default)
|
|
270
|
+
* - `true`: Show quit dialog with 3-second countdown after completion
|
|
271
|
+
* - `number`: Show quit dialog with custom countdown in seconds
|
|
272
|
+
*/
|
|
273
|
+
autoExit?: boolean | number;
|
|
274
|
+
};
|
|
30
275
|
/** Update command defaults */
|
|
31
276
|
update?: {
|
|
32
277
|
exclude?: string[];
|
|
33
278
|
format?: "json" | "minimal" | "table";
|
|
279
|
+
/**
|
|
280
|
+
* Package names or glob patterns to permanently ignore during updates.
|
|
281
|
+
* Ignored packages are skipped and listed in the output so you know
|
|
282
|
+
* they were not checked.
|
|
283
|
+
* @example ["eslint", "@types/*"]
|
|
284
|
+
*/
|
|
285
|
+
ignore?: string[];
|
|
34
286
|
include?: string[];
|
|
35
287
|
install?: boolean;
|
|
36
288
|
prerelease?: boolean;
|
|
@@ -43,6 +295,10 @@ interface VisConfig {
|
|
|
43
295
|
* Supports simple patterns like "packages/*" and "packages/**".
|
|
44
296
|
*/
|
|
45
297
|
declare const resolveWorkspacePatterns: (workspaceRoot: string, patterns: string[]) => string[];
|
|
298
|
+
/**
|
|
299
|
+
* Reads workspace patterns from pnpm-workspace.yaml (simple parser).
|
|
300
|
+
*/
|
|
301
|
+
declare const readPnpmWorkspacePatterns: (workspaceRoot: string) => string[] | undefined;
|
|
46
302
|
/**
|
|
47
303
|
* Discovers all projects in the workspace and builds a WorkspaceConfiguration.
|
|
48
304
|
*/
|
|
@@ -55,4 +311,5 @@ declare const discoverWorkspace: (workspaceRoot: string, config?: VisConfig) =>
|
|
|
55
311
|
*/
|
|
56
312
|
declare const buildProjectGraph: (workspaceRoot: string, workspace: WorkspaceConfiguration) => ProjectGraph;
|
|
57
313
|
export type { PackageJson, VisConfig };
|
|
58
|
-
export { buildProjectGraph, discoverWorkspace, resolveWorkspacePatterns };
|
|
314
|
+
export { buildProjectGraph, discoverWorkspace, readPnpmWorkspacePatterns, resolveWorkspacePatterns };
|
|
315
|
+
export { type Configuration as StagedConfig } from "lint-staged";
|