@visulima/vis 1.0.0-alpha.8 → 1.0.0-alpha.9
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 +90 -57
- package/LICENSE.md +44 -1
- package/README.md +56 -0
- package/dist/bin.js +1 -1003
- package/dist/config.d.ts +1073 -68
- package/dist/config.js +1 -1
- package/dist/generate/index.d.ts +155 -30
- package/dist/packem_chunks/handler.js +1 -0
- package/dist/packem_chunks/handler10.js +1 -0
- package/dist/packem_chunks/handler11.js +1 -0
- package/dist/packem_chunks/handler12.js +153 -0
- package/dist/packem_chunks/handler13.js +1 -0
- package/dist/packem_chunks/handler14.js +3 -0
- package/dist/packem_chunks/handler15.js +1 -0
- package/dist/packem_chunks/handler16.js +2 -0
- package/dist/packem_chunks/handler17.js +7 -0
- package/dist/packem_chunks/handler18.js +1 -0
- package/dist/packem_chunks/handler19.js +19 -0
- package/dist/packem_chunks/handler2.js +1 -0
- package/dist/packem_chunks/handler20.js +428 -0
- package/dist/packem_chunks/handler21.js +22 -0
- package/dist/packem_chunks/handler22.js +3 -0
- package/dist/packem_chunks/handler23.js +5 -0
- package/dist/packem_chunks/handler24.js +1 -0
- package/dist/packem_chunks/handler25.js +20 -0
- package/dist/packem_chunks/handler26.js +1 -0
- package/dist/packem_chunks/handler27.js +1 -0
- package/dist/packem_chunks/handler28.js +1 -0
- package/dist/packem_chunks/handler29.js +2 -0
- package/dist/packem_chunks/handler3.js +2 -0
- package/dist/packem_chunks/handler30.js +22 -0
- package/dist/packem_chunks/handler31.js +1 -0
- package/dist/packem_chunks/handler32.js +1 -0
- package/dist/packem_chunks/handler33.js +37 -0
- package/dist/packem_chunks/handler34.js +3 -0
- package/dist/packem_chunks/handler35.js +23 -0
- package/dist/packem_chunks/handler36.js +5 -0
- package/dist/packem_chunks/handler37.js +27 -0
- package/dist/packem_chunks/handler38.js +1 -0
- package/dist/packem_chunks/handler39.js +2 -0
- package/dist/packem_chunks/handler4.js +5 -0
- package/dist/packem_chunks/handler40.js +1 -0
- package/dist/packem_chunks/handler41.js +5 -0
- package/dist/packem_chunks/handler42.js +1 -0
- package/dist/packem_chunks/handler43.js +24 -0
- package/dist/packem_chunks/handler44.js +3 -0
- package/dist/packem_chunks/handler45.js +1 -0
- package/dist/packem_chunks/handler5.js +4 -0
- package/dist/packem_chunks/handler6.js +2 -0
- package/dist/packem_chunks/handler7.js +24 -0
- package/dist/packem_chunks/handler8.js +6 -0
- package/dist/packem_chunks/handler9.js +8 -0
- package/dist/packem_shared/VisUpdateApp-BBx3idMI.js +1 -0
- package/dist/packem_shared/ai-analysis-DDqXRFxY.js +67 -0
- package/dist/packem_shared/bin-BaZZ32BK.js +93 -0
- package/dist/packem_shared/cache-directory-DL8hfXeG.js +1 -0
- package/dist/packem_shared/catalog-CuSpuB_R.js +12 -0
- package/dist/packem_shared/dependency-scan-BoLG2Fez.js +1 -0
- package/dist/packem_shared/docker-BcfqH4Av.js +2 -0
- package/dist/packem_shared/flakiness-DSIHZGBT.js +1 -0
- package/dist/packem_shared/otelPlugin-DxyvBcXO.js +1 -0
- package/dist/packem_shared/runtime-check-CGHal8SO.js +1 -0
- package/dist/packem_shared/selectors-CfH9ZY08.js +3 -0
- package/dist/packem_shared/symbols-CIMw60-G.js +1 -0
- package/dist/packem_shared/toolchain-C3ZG0o_X.js +5 -0
- package/dist/packem_shared/typosquats-Bpq4zcWL.js +1 -0
- package/dist/packem_shared/utils-DrNg0XTR.js +1 -0
- package/index.js +555 -727
- package/package.json +27 -19
- package/schemas/project.schema.json +1 -1
- package/schemas/vis-config.schema.json +47 -1
- package/dist/ai-analysis.d.ts +0 -26
- package/dist/ai-cache.d.ts +0 -21
- package/dist/ai-types.d.ts +0 -16
- package/dist/audit-config.d.ts +0 -24
- package/dist/bin.d.ts +0 -1
- package/dist/cache-directory.d.ts +0 -73
- package/dist/catalog.d.ts +0 -136
- package/dist/codeowners.d.ts +0 -30
- package/dist/commands/action-graph.d.ts +0 -8
- package/dist/commands/add.d.ts +0 -3
- package/dist/commands/affected.d.ts +0 -3
- package/dist/commands/ai.d.ts +0 -3
- package/dist/commands/analyze.d.ts +0 -3
- package/dist/commands/approve-builds.d.ts +0 -3
- package/dist/commands/audit.d.ts +0 -23
- package/dist/commands/cache.d.ts +0 -86
- package/dist/commands/check.d.ts +0 -3
- package/dist/commands/ci.d.ts +0 -19
- package/dist/commands/clean.d.ts +0 -3
- package/dist/commands/create/discovery.d.ts +0 -42
- package/dist/commands/create/index.d.ts +0 -13
- package/dist/commands/create/prompts.d.ts +0 -31
- package/dist/commands/create/random-name.d.ts +0 -15
- package/dist/commands/create/templates/builtin.d.ts +0 -15
- package/dist/commands/create/templates/generator.d.ts +0 -14
- package/dist/commands/create/templates/index.d.ts +0 -13
- package/dist/commands/create/templates/monorepo.d.ts +0 -16
- package/dist/commands/create/templates/remote.d.ts +0 -41
- package/dist/commands/create/templates/types.d.ts +0 -46
- package/dist/commands/create/utils.d.ts +0 -42
- package/dist/commands/dedupe.d.ts +0 -3
- package/dist/commands/devcontainer.d.ts +0 -3
- package/dist/commands/dlx.d.ts +0 -3
- package/dist/commands/docker.d.ts +0 -22
- package/dist/commands/doctor.d.ts +0 -15
- package/dist/commands/exec.d.ts +0 -3
- package/dist/commands/generate.d.ts +0 -10
- package/dist/commands/graph.d.ts +0 -3
- package/dist/commands/hook/constants.d.ts +0 -13
- package/dist/commands/hook/index.d.ts +0 -3
- package/dist/commands/hook/install.d.ts +0 -7
- package/dist/commands/hook/list.d.ts +0 -28
- package/dist/commands/hook/migrate.d.ts +0 -30
- package/dist/commands/hook/prek-builtins.d.ts +0 -8
- package/dist/commands/hook/prek.d.ts +0 -129
- package/dist/commands/hook/run.d.ts +0 -21
- package/dist/commands/hook/uninstall.d.ts +0 -3
- package/dist/commands/hook/validate.d.ts +0 -17
- package/dist/commands/ignore-helpers.d.ts +0 -157
- package/dist/commands/ignore.d.ts +0 -17
- package/dist/commands/implode.d.ts +0 -3
- package/dist/commands/info.d.ts +0 -3
- package/dist/commands/init.d.ts +0 -14
- package/dist/commands/install.d.ts +0 -3
- package/dist/commands/link.d.ts +0 -3
- package/dist/commands/list.d.ts +0 -3
- package/dist/commands/migrate/backup.d.ts +0 -8
- package/dist/commands/migrate/constants.d.ts +0 -16
- package/dist/commands/migrate/deps.d.ts +0 -32
- package/dist/commands/migrate/gitleaks.d.ts +0 -29
- package/dist/commands/migrate/index.d.ts +0 -3
- package/dist/commands/migrate/json.d.ts +0 -22
- package/dist/commands/migrate/kingfisher.d.ts +0 -14
- package/dist/commands/migrate/lint-staged.d.ts +0 -62
- package/dist/commands/migrate/moon.d.ts +0 -5
- package/dist/commands/migrate/nano-staged.d.ts +0 -30
- package/dist/commands/migrate/nx.d.ts +0 -12
- package/dist/commands/migrate/prompt.d.ts +0 -2
- package/dist/commands/migrate/secretlint.d.ts +0 -14
- package/dist/commands/migrate/shared.d.ts +0 -29
- package/dist/commands/migrate/turborepo.d.ts +0 -11
- package/dist/commands/migrate/types.d.ts +0 -27
- package/dist/commands/migrate/verify.d.ts +0 -12
- package/dist/commands/optimize.d.ts +0 -38
- package/dist/commands/pm.d.ts +0 -3
- package/dist/commands/remove.d.ts +0 -3
- package/dist/commands/run.d.ts +0 -16
- package/dist/commands/sbom.d.ts +0 -10
- package/dist/commands/secrets.d.ts +0 -3
- package/dist/commands/sort-package-json.d.ts +0 -3
- package/dist/commands/staged.d.ts +0 -10
- package/dist/commands/status.d.ts +0 -3
- package/dist/commands/sync.d.ts +0 -16
- package/dist/commands/task-why.d.ts +0 -3
- package/dist/commands/unlink.d.ts +0 -3
- package/dist/commands/update.d.ts +0 -3
- package/dist/commands/upgrade.d.ts +0 -3
- package/dist/commands/why.d.ts +0 -3
- package/dist/docker.d.ts +0 -73
- package/dist/flakiness.d.ts +0 -40
- package/dist/generate/discover.d.ts +0 -29
- package/dist/generate/loader.d.ts +0 -15
- package/dist/generate/moon-adapter/filename-interp.d.ts +0 -42
- package/dist/generate/moon-adapter/filters.d.ts +0 -22
- package/dist/generate/moon-adapter/frontmatter.d.ts +0 -39
- package/dist/generate/moon-adapter/index.d.ts +0 -19
- package/dist/generate/moon-adapter/tera-subset.d.ts +0 -85
- package/dist/generate/moon-adapter/util.d.ts +0 -14
- package/dist/generate/prompts.d.ts +0 -25
- package/dist/generate/remote.d.ts +0 -43
- package/dist/generate/runner.d.ts +0 -37
- package/dist/generate/types.d.ts +0 -152
- package/dist/hooks.d.ts +0 -118
- package/dist/native-binding.d.ts +0 -158
- package/dist/output.d.ts +0 -40
- package/dist/overrides.d.ts +0 -82
- package/dist/package-manager.d.ts +0 -23
- package/dist/packem_shared/otelPlugin-CJLkguJ8.js +0 -1
- package/dist/plugins/config-loader.d.ts +0 -3
- package/dist/plugins/otel.d.ts +0 -63
- package/dist/plugins/post-command.d.ts +0 -3
- package/dist/plugins/security-enforcement.d.ts +0 -3
- package/dist/pm-runner.d.ts +0 -44
- package/dist/run-report.d.ts +0 -40
- package/dist/runtime-check.d.ts +0 -27
- package/dist/sbom/cyclonedx.d.ts +0 -39
- package/dist/sbom/installed-package.d.ts +0 -49
- package/dist/sbom/license.d.ts +0 -31
- package/dist/sbom/lockfile.d.ts +0 -34
- package/dist/sbom/purl.d.ts +0 -25
- package/dist/sbom/resolve-specifier.d.ts +0 -24
- package/dist/sbom/types.d.ts +0 -196
- package/dist/secrets/baseline.d.ts +0 -20
- package/dist/secrets/format.d.ts +0 -14
- package/dist/secrets/git.d.ts +0 -6
- package/dist/secrets/spinner.d.ts +0 -9
- package/dist/security.d.ts +0 -64
- package/dist/selectors.d.ts +0 -81
- package/dist/shell-history.d.ts +0 -16
- package/dist/socket-security.d.ts +0 -129
- package/dist/staged/cli-parse.d.ts +0 -18
- package/dist/staged/config.d.ts +0 -14
- package/dist/staged/errors/apply-empty-commit-error.d.ts +0 -4
- package/dist/staged/errors/config-error.d.ts +0 -4
- package/dist/staged/errors/get-backup-stash-error.d.ts +0 -4
- package/dist/staged/errors/git-error.d.ts +0 -6
- package/dist/staged/errors/index.d.ts +0 -12
- package/dist/staged/errors/restore-original-state-error.d.ts +0 -4
- package/dist/staged/errors/staged-error.d.ts +0 -8
- package/dist/staged/errors/task-error.d.ts +0 -6
- package/dist/staged/git/diff.d.ts +0 -76
- package/dist/staged/git/exec.d.ts +0 -43
- package/dist/staged/git/index.d.ts +0 -77
- package/dist/staged/git/stash.d.ts +0 -37
- package/dist/staged/index.d.ts +0 -13
- package/dist/staged/match.d.ts +0 -12
- package/dist/staged/renderer/index.d.ts +0 -9
- package/dist/staged/renderer/ink/index.d.ts +0 -4
- package/dist/staged/renderer/plain.d.ts +0 -12
- package/dist/staged/tasks/build.d.ts +0 -13
- package/dist/staged/tasks/exec.d.ts +0 -56
- package/dist/staged/tasks/run.d.ts +0 -26
- package/dist/staged/types.d.ts +0 -173
- package/dist/target-discovery.d.ts +0 -59
- package/dist/target-options.d.ts +0 -261
- package/dist/tips.d.ts +0 -41
- package/dist/tui/components/CheckProgressApp.d.ts +0 -6
- package/dist/tui/components/CommandSummary.d.ts +0 -17
- package/dist/tui/components/Header.d.ts +0 -13
- package/dist/tui/components/OutputPanel.d.ts +0 -17
- package/dist/tui/components/QuitDialog.d.ts +0 -15
- package/dist/tui/components/TaskListPanel.d.ts +0 -19
- package/dist/tui/components/TaskRow.d.ts +0 -12
- package/dist/tui/components/TaskStore.d.ts +0 -80
- package/dist/tui/components/VisTaskRunnerApp.d.ts +0 -17
- package/dist/tui/components/devcontainer/DevcontainerStore.d.ts +0 -66
- package/dist/tui/components/devcontainer/VisDevcontainerApp.d.ts +0 -9
- package/dist/tui/components/devcontainer/catalogs/extensions.d.ts +0 -8
- package/dist/tui/components/devcontainer/catalogs/features.d.ts +0 -8
- package/dist/tui/components/devcontainer/catalogs/filters.d.ts +0 -4
- package/dist/tui/components/devcontainer/catalogs/mount-suggestions.d.ts +0 -19
- package/dist/tui/components/devcontainer/catalogs/templates.d.ts +0 -8
- package/dist/tui/components/devcontainer/devcontainer-io.d.ts +0 -14
- package/dist/tui/components/devcontainer/sections/DockerComposeSection.d.ts +0 -11
- package/dist/tui/components/devcontainer/sections/EnvironmentSection.d.ts +0 -16
- package/dist/tui/components/devcontainer/sections/ExtensionsSection.d.ts +0 -11
- package/dist/tui/components/devcontainer/sections/FeaturesSection.d.ts +0 -11
- package/dist/tui/components/devcontainer/sections/GeneralSection.d.ts +0 -12
- package/dist/tui/components/devcontainer/sections/LifecycleSection.d.ts +0 -13
- package/dist/tui/components/devcontainer/sections/MountsSection.d.ts +0 -16
- package/dist/tui/components/devcontainer/sections/PortsSection.d.ts +0 -10
- package/dist/tui/components/devcontainer/sections/PreviewPanel.d.ts +0 -11
- package/dist/tui/components/devcontainer/types.d.ts +0 -53
- package/dist/tui/components/devcontainer/validate.d.ts +0 -16
- package/dist/tui/components/graph/GraphStore.d.ts +0 -42
- package/dist/tui/components/graph/ProjectDetailPanel.d.ts +0 -10
- package/dist/tui/components/graph/ProjectListPanel.d.ts +0 -20
- package/dist/tui/components/graph/VisGraphApp.d.ts +0 -8
- package/dist/tui/components/optimize/OptimizeDetailPanel.d.ts +0 -9
- package/dist/tui/components/optimize/OptimizeListPanel.d.ts +0 -16
- package/dist/tui/components/optimize/OptimizeStore.d.ts +0 -50
- package/dist/tui/components/optimize/VisOptimizeApp.d.ts +0 -8
- package/dist/tui/components/optimize/constants.d.ts +0 -7
- package/dist/tui/components/update/PackageDetailPanel.d.ts +0 -12
- package/dist/tui/components/update/PackageListPanel.d.ts +0 -21
- package/dist/tui/components/update/UpdateStore.d.ts +0 -62
- package/dist/tui/components/update/VisUpdateApp.d.ts +0 -18
- package/dist/tui/dynamic-life-cycle.d.ts +0 -22
- package/dist/tui/formatting-utils.d.ts +0 -17
- package/dist/tui/pretty-time.d.ts +0 -8
- package/dist/tui/static-life-cycle.d.ts +0 -28
- package/dist/tui/status-utils.d.ts +0 -20
- package/dist/tui/symbols.d.ts +0 -7
- package/dist/tui/types.d.ts +0 -11
- package/dist/typosquats.d.ts +0 -70
- package/dist/upgrade-check.d.ts +0 -30
- package/dist/utils.d.ts +0 -22
- package/dist/watch.d.ts +0 -65
- package/dist/workspace.d.ts +0 -675
package/dist/security.d.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Supply chain security for package management commands.
|
|
3
|
-
*
|
|
4
|
-
* Ports pnpm's security features (minimumReleaseAge, trustPolicy,
|
|
5
|
-
* allowBuilds, blockExoticSubdeps, strictDepBuilds) to work universally
|
|
6
|
-
* across all package managers.
|
|
7
|
-
*
|
|
8
|
-
* Support matrix for build script enforcement:
|
|
9
|
-
* - pnpm v10+: Native `allowBuilds` in pnpm-workspace.yaml (vis validates config)
|
|
10
|
-
* - bun: Native `trustedDependencies` in package.json (vis validates config)
|
|
11
|
-
* - npm: NO native allowlist. vis adds --ignore-scripts and runs approved scripts manually
|
|
12
|
-
* - yarn: NO native allowlist. vis checks enableScripts in .yarnrc.yml
|
|
13
|
-
*/
|
|
14
|
-
import type { VisConfig } from "./workspace.d.ts";
|
|
15
|
-
type PackageManagerName = "bun" | "npm" | "pnpm" | "yarn";
|
|
16
|
-
interface SecurityCheckResult {
|
|
17
|
-
errors: string[];
|
|
18
|
-
warnings: string[];
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Checks the vis config for recommended security settings.
|
|
22
|
-
*
|
|
23
|
-
* When `defineConfig()` or `loadVisConfig()` is used, secure defaults are already
|
|
24
|
-
* merged. This function validates the *final* config (defaults + user overrides)
|
|
25
|
-
* and flags remaining gaps — primarily `allowBuilds`, which must be user-supplied.
|
|
26
|
-
*/
|
|
27
|
-
declare const checkSecurityConfig: (config: VisConfig, packageManager: string) => SecurityCheckResult;
|
|
28
|
-
/**
|
|
29
|
-
* Emits a single-line security summary warning before PM commands.
|
|
30
|
-
* Skipped in CI unless VIS_SECURITY_WARNINGS=1.
|
|
31
|
-
*/
|
|
32
|
-
declare const emitSecurityWarnings: (config: VisConfig, packageManager: string) => void;
|
|
33
|
-
/**
|
|
34
|
-
* Prints the full security audit report, including active settings and warnings.
|
|
35
|
-
*/
|
|
36
|
-
declare const printSecurityReport: (config: VisConfig, packageManager: string) => void;
|
|
37
|
-
/**
|
|
38
|
-
* Reports which vis security settings would map to pnpm-workspace.yaml.
|
|
39
|
-
*/
|
|
40
|
-
declare const previewPnpmSync: (config: VisConfig) => string[];
|
|
41
|
-
/**
|
|
42
|
-
* Scans node_modules for packages with install scripts that aren't approved.
|
|
43
|
-
*/
|
|
44
|
-
declare const scanUnapprovedBuildScripts: (cwd: string, allowBuilds: Record<string, boolean>) => string[];
|
|
45
|
-
interface EnforcementResult {
|
|
46
|
-
extraArgs: string[];
|
|
47
|
-
postInstallPackages: string[];
|
|
48
|
-
scriptsBlockedByDefault: boolean;
|
|
49
|
-
warnings: string[];
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Determines enforcement actions needed before install/add/update.
|
|
53
|
-
*/
|
|
54
|
-
declare const enforceScriptSecurity: (pm: PackageManagerName, workspaceRoot: string, config: VisConfig) => EnforcementResult;
|
|
55
|
-
/**
|
|
56
|
-
* Syncs vis security.allowBuilds to native PM config format.
|
|
57
|
-
*/
|
|
58
|
-
declare const syncAllowBuildsToNativeConfig: (pm: PackageManagerName, workspaceRoot: string, allowBuilds: Record<string, boolean>) => string[];
|
|
59
|
-
/**
|
|
60
|
-
* Runs postinstall scripts for approved packages after --ignore-scripts install.
|
|
61
|
-
*/
|
|
62
|
-
declare const runApprovedScripts: (workspaceRoot: string, patterns: string[]) => void;
|
|
63
|
-
export type { EnforcementResult, PackageManagerName, SecurityCheckResult };
|
|
64
|
-
export { checkSecurityConfig, emitSecurityWarnings, enforceScriptSecurity, previewPnpmSync, printSecurityReport, runApprovedScripts, scanUnapprovedBuildScripts, syncAllowBuildsToNativeConfig, };
|
package/dist/selectors.d.ts
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import type { WorkspaceConfiguration } from "@visulima/task-runner";
|
|
2
|
-
/**
|
|
3
|
-
* Parsed form of a target selector.
|
|
4
|
-
*
|
|
5
|
-
* vis accepts moon-style target syntax alongside the simple `<target>`
|
|
6
|
-
* and `--projects` form:
|
|
7
|
-
*
|
|
8
|
-
* :build → run `build` on every project
|
|
9
|
-
* ~:build → run `build` on the project closest to cwd
|
|
10
|
-
* #frontend:build → run `build` on every project tagged `frontend`
|
|
11
|
-
* my-pkg:build → run `build` on the single project `my-pkg`
|
|
12
|
-
* build → run `build` on every project (legacy form)
|
|
13
|
-
*/
|
|
14
|
-
export interface ParsedSelector {
|
|
15
|
-
/** Selector kind — used by commands for richer diagnostics. */
|
|
16
|
-
kind: "all" | "closest" | "project" | "tag";
|
|
17
|
-
/** Projects the selector resolves to (before further filtering). */
|
|
18
|
-
projects?: string[];
|
|
19
|
-
/** The tag, when `kind === "tag"`. */
|
|
20
|
-
tag?: string;
|
|
21
|
-
/** The target name. */
|
|
22
|
-
target: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Parses a target selector string into its component parts.
|
|
26
|
-
* @param input Raw selector string (e.g. `:build`, `~:test`, `#tag:lint`, `pkg:build`, or bare `build`).
|
|
27
|
-
* @returns The parsed selector, or `undefined` if `input` is empty.
|
|
28
|
-
*/
|
|
29
|
-
export declare const parseTargetSelector: (input: string) => Omit<ParsedSelector, "projects"> | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* Resolves a selector string against a workspace to produce a concrete
|
|
32
|
-
* list of project names and the target to run.
|
|
33
|
-
* @param input Raw selector string.
|
|
34
|
-
* @param workspace The discovered workspace configuration.
|
|
35
|
-
* @param cwd Current working directory (used for `~:` closest resolution).
|
|
36
|
-
* @param workspaceRoot Absolute path to the workspace root.
|
|
37
|
-
* @returns An object with `projects` (candidate names) and `target`.
|
|
38
|
-
* @throws If the selector is invalid or `~:` finds no matching project.
|
|
39
|
-
*/
|
|
40
|
-
export declare const resolveSelector: (input: string, workspace: WorkspaceConfiguration, cwd: string, workspaceRoot: string) => Promise<{
|
|
41
|
-
projects: string[];
|
|
42
|
-
target: string;
|
|
43
|
-
}>;
|
|
44
|
-
/**
|
|
45
|
-
* A single parsed query clause. e.g. `language=typescript` or
|
|
46
|
-
* `tag!=deprecated`.
|
|
47
|
-
*/
|
|
48
|
-
interface QueryClause {
|
|
49
|
-
field: string;
|
|
50
|
-
op: "!=" | "=";
|
|
51
|
-
value: string;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Parsed query — a list of clauses combined with either AND or OR.
|
|
55
|
-
* Groups are not supported; all clauses are combined with the same
|
|
56
|
-
* top-level operator.
|
|
57
|
-
*/
|
|
58
|
-
interface ParsedQuery {
|
|
59
|
-
clauses: QueryClause[];
|
|
60
|
-
op: "&&" | "||";
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Parses a query string into a structured predicate.
|
|
64
|
-
*
|
|
65
|
-
* Grammar: `<field>=<value>` or `<field>!=<value>` clauses joined by
|
|
66
|
-
* `&&` (all must match) or `||` (any must match). Mixing operators is
|
|
67
|
-
* not supported and throws.
|
|
68
|
-
* @param input Raw query string, e.g. `"language=typescript && tag=lib"`.
|
|
69
|
-
* @returns The parsed query, or `undefined` if the input is empty.
|
|
70
|
-
* @throws On mixed `&&` / `||` or malformed clauses.
|
|
71
|
-
*/
|
|
72
|
-
export declare const parseQuery: (input: string) => ParsedQuery | undefined;
|
|
73
|
-
/**
|
|
74
|
-
* Filters project names by a query string.
|
|
75
|
-
* @param projectNames Candidate project names to filter.
|
|
76
|
-
* @param workspace The workspace configuration (projects must carry vis metadata).
|
|
77
|
-
* @param query A query string, or `undefined` / empty to skip filtering.
|
|
78
|
-
* @returns The subset of `projectNames` that match the query.
|
|
79
|
-
*/
|
|
80
|
-
export declare const filterProjectsByQuery: (projectNames: string[], workspace: WorkspaceConfiguration, query: string | undefined) => string[];
|
|
81
|
-
export {};
|
package/dist/shell-history.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Best-effort append of a command string to the user's shell history
|
|
3
|
-
* file so bare `vis run` followed by an interactive pick shows up in
|
|
4
|
-
* the terminal history — up-arrow then re-runs the resolved target.
|
|
5
|
-
*
|
|
6
|
-
* Detects the shell from `$SHELL`/`$ZDOTDIR` and writes in the
|
|
7
|
-
* shell-specific format. Never throws; silently returns when:
|
|
8
|
-
* - the platform is Windows (history formats vary by terminal host),
|
|
9
|
-
* - no recognizable shell is detected,
|
|
10
|
-
* - the history file can't be opened,
|
|
11
|
-
* - `VIS_NO_SHELL_HISTORY` is set (escape hatch).
|
|
12
|
-
*
|
|
13
|
-
* Scoped intentionally to the interactive-picker path. Explicit
|
|
14
|
-
* `vis run <target>` invocations already appear in history verbatim.
|
|
15
|
-
*/
|
|
16
|
-
export declare const appendToShellHistory: (commandLine: string) => Promise<void>;
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Socket.dev security helpers for package security intelligence.
|
|
3
|
-
*
|
|
4
|
-
* Ported from @vltpkg/security-archive and adapted to use the Socket.dev
|
|
5
|
-
* public API for fetching package security scores, alerts, and report data.
|
|
6
|
-
* Uses a file-based cache (following the ai-cache.ts pattern) with a 1-hour TTL.
|
|
7
|
-
* @see https://socket.dev
|
|
8
|
-
* @see https://github.com/vltpkg/vltpkg/tree/main/src/security-archive
|
|
9
|
-
*/
|
|
10
|
-
declare const DEFAULT_LOW_SCORE_THRESHOLD = 0.4;
|
|
11
|
-
/** Extra properties attached to a package alert. */
|
|
12
|
-
interface PackageAlertProps {
|
|
13
|
-
cveId?: `CVE-${string}`;
|
|
14
|
-
cwes?: {
|
|
15
|
-
id: `CWE-${string}`;
|
|
16
|
-
}[];
|
|
17
|
-
lastPublish: string;
|
|
18
|
-
}
|
|
19
|
-
/** A known security alert for a given package. */
|
|
20
|
-
interface PackageAlert {
|
|
21
|
-
category: string;
|
|
22
|
-
key: string;
|
|
23
|
-
props?: PackageAlertProps;
|
|
24
|
-
severity: "critical" | "high" | "low" | "medium";
|
|
25
|
-
type: string;
|
|
26
|
-
}
|
|
27
|
-
/** Security scores for a given package (each 0–1). */
|
|
28
|
-
interface PackageScore {
|
|
29
|
-
/** Score factors relating to package licensing. */
|
|
30
|
-
license: number;
|
|
31
|
-
/** Score factors relating to package maintenance. */
|
|
32
|
-
maintenance: number;
|
|
33
|
-
/** Average of all score factors. */
|
|
34
|
-
overall: number;
|
|
35
|
-
/** Score factors relating to code quality. */
|
|
36
|
-
quality: number;
|
|
37
|
-
/** Score factors relating to supply chain security. */
|
|
38
|
-
supplyChain: number;
|
|
39
|
-
/** Score factors relating to package vulnerabilities. */
|
|
40
|
-
vulnerability: number;
|
|
41
|
-
}
|
|
42
|
-
/** Full report data for a single package from Socket.dev. */
|
|
43
|
-
interface PackageReportData {
|
|
44
|
-
alerts: PackageAlert[];
|
|
45
|
-
author: string[];
|
|
46
|
-
id: string;
|
|
47
|
-
license: string;
|
|
48
|
-
name: string;
|
|
49
|
-
namespace?: `@${string}`;
|
|
50
|
-
score: PackageScore;
|
|
51
|
-
size: number;
|
|
52
|
-
type: "npm";
|
|
53
|
-
version: string;
|
|
54
|
-
}
|
|
55
|
-
/** Configuration options for the Socket.dev security client. */
|
|
56
|
-
interface SocketSecurityOptions {
|
|
57
|
-
/** Custom API token. Required — set via VIS_SOCKET_TOKEN env var or config. */
|
|
58
|
-
apiToken?: string;
|
|
59
|
-
/** Cache TTL in milliseconds. Defaults to 1 hour. */
|
|
60
|
-
cacheTtlMs?: number;
|
|
61
|
-
/** Minimum overall score (0–1) below which packages are flagged. Defaults to 0.4. */
|
|
62
|
-
minimumScore?: number;
|
|
63
|
-
/** Request timeout in milliseconds. Defaults to 15 seconds. */
|
|
64
|
-
timeoutMs?: number;
|
|
65
|
-
}
|
|
66
|
-
declare const isPackageReportData: (o: unknown) => o is PackageReportData;
|
|
67
|
-
declare const calculateOverallScore: (score: Omit<PackageScore, "overall">) => number;
|
|
68
|
-
/**
|
|
69
|
-
* Fetches security report data from the Socket.dev API for the given packages.
|
|
70
|
-
* Batches requests to stay within API limits.
|
|
71
|
-
* @param packages Array of { name, version } to look up.
|
|
72
|
-
* @param options Optional configuration.
|
|
73
|
-
* @returns Map of "name@version" to PackageReportData.
|
|
74
|
-
*/
|
|
75
|
-
declare const fetchSocketReports: (packages: {
|
|
76
|
-
name: string;
|
|
77
|
-
version: string;
|
|
78
|
-
}[], options?: SocketSecurityOptions) => Promise<Map<string, PackageReportData>>;
|
|
79
|
-
/** Returns the full package name including namespace scope if present. */
|
|
80
|
-
declare const getFullPackageName: (report: Pick<PackageReportData, "name" | "namespace">) => string;
|
|
81
|
-
/** Maps a 0–1 score to a human-readable label. */
|
|
82
|
-
declare const scoreLabel: (score: number) => string;
|
|
83
|
-
/** Maps a 0–1 score to a color name for terminal output. */
|
|
84
|
-
declare const scoreColor: (score: number) => "green" | "red" | "yellow";
|
|
85
|
-
/** Formats a PackageReportData into a compact one-line summary string. */
|
|
86
|
-
declare const formatReportSummary: (report: PackageReportData) => string;
|
|
87
|
-
/** Formats a detailed multi-line report for a single package. */
|
|
88
|
-
declare const formatReportDetailed: (report: PackageReportData) => string;
|
|
89
|
-
/**
|
|
90
|
-
* Formats a security summary for a list of packages.
|
|
91
|
-
* Suitable for displaying after install/update commands.
|
|
92
|
-
*/
|
|
93
|
-
declare const formatSecurityOverview: (reports: Map<string, PackageReportData>) => string;
|
|
94
|
-
declare const clearSocketCache: () => number;
|
|
95
|
-
/** Socket.dev config shape as it appears in VisConfig.security.socket. */
|
|
96
|
-
interface SocketConfigLike {
|
|
97
|
-
apiToken?: string;
|
|
98
|
-
cacheTtlMs?: number;
|
|
99
|
-
enabled?: boolean;
|
|
100
|
-
minimumScore?: number;
|
|
101
|
-
timeoutMs?: number;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Builds SocketSecurityOptions from the VisConfig socket config section.
|
|
105
|
-
* Returns undefined if Socket.dev is not enabled or no API token is available.
|
|
106
|
-
*/
|
|
107
|
-
declare const buildSocketOptions: (socketConfig: SocketConfigLike | undefined) => SocketSecurityOptions | undefined;
|
|
108
|
-
/** A persisted "accepted risk" entry from the vis config. */
|
|
109
|
-
interface AcceptedRisk {
|
|
110
|
-
/** ISO 8601 timestamp when the risk was accepted. */
|
|
111
|
-
acceptedAt: string;
|
|
112
|
-
/** The overall Socket.dev score at the time of acceptance. */
|
|
113
|
-
acceptedScore: number;
|
|
114
|
-
/** User-provided reason for accepting the risk. */
|
|
115
|
-
reason: string;
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Checks if a package has an accepted risk entry.
|
|
119
|
-
* Matches by exact name@version, unversioned name, or trailing glob patterns.
|
|
120
|
-
* Returns the matching AcceptedRisk if found, undefined otherwise.
|
|
121
|
-
*/
|
|
122
|
-
declare const findAcceptedRisk: (packageName: string, version: string, acceptedRisks: Record<string, AcceptedRisk> | undefined) => AcceptedRisk | undefined;
|
|
123
|
-
/**
|
|
124
|
-
* Formats a config snippet for the user to paste into vis.config.ts
|
|
125
|
-
* to persist an accepted risk decision.
|
|
126
|
-
*/
|
|
127
|
-
declare const formatAcceptedRiskSnippet: (packageName: string, _version: string, score: number, reason: string) => string;
|
|
128
|
-
export type { AcceptedRisk, PackageAlert, PackageAlertProps, PackageReportData, PackageScore, SocketSecurityOptions };
|
|
129
|
-
export { buildSocketOptions, calculateOverallScore, clearSocketCache, DEFAULT_LOW_SCORE_THRESHOLD, fetchSocketReports, findAcceptedRisk, formatAcceptedRiskSnippet, formatReportDetailed, formatReportSummary, formatSecurityOverview, getFullPackageName, isPackageReportData, scoreColor, scoreLabel, };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Small helpers shared between the CLI command and the programmatic
|
|
3
|
-
* surface when a value has to be coerced from a string (CLI flag, env
|
|
4
|
-
* variable, config file). Kept free of runtime deps so it can be unit
|
|
5
|
-
* tested in isolation.
|
|
6
|
-
*/
|
|
7
|
-
/** Env var read as the concurrency fallback when `--concurrent` isn't passed. */
|
|
8
|
-
export declare const CONCURRENT_ENV_VAR = "VIS_STAGED_CONCURRENT";
|
|
9
|
-
/**
|
|
10
|
-
* Parses a stringified concurrency value. Accepts the same shapes as the
|
|
11
|
-
* `--concurrent` CLI flag:
|
|
12
|
-
*
|
|
13
|
-
* - `"true"` or an empty string → `true` (unbounded, capped internally at CPU count)
|
|
14
|
-
* - `"false"` → `false` (serial)
|
|
15
|
-
* - an integer string → the parsed number
|
|
16
|
-
* - anything else (including NaN) → `true`, matching the CLI-flag fallback
|
|
17
|
-
*/
|
|
18
|
-
export declare const parseConcurrent: (value: string) => boolean | number;
|
package/dist/staged/config.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { RunOptions, StagedConfig, StagedTask } from "./types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Resolves the user's staged config. We deliberately do NOT auto-discover
|
|
4
|
-
* external `.lintstagedrc*` / `.vis-staged.*` files at runtime — that
|
|
5
|
-
* keeps the config surface to a single place (`vis.config.ts`) and means
|
|
6
|
-
* there's no ambiguity about which file drives a run.
|
|
7
|
-
*
|
|
8
|
-
* Users migrating from lint-staged or nano-staged go through
|
|
9
|
-
* `vis migrate lint-staged` / `vis migrate nano-staged`, which inline
|
|
10
|
-
* the old config into `vis.config.ts` and remove the external files.
|
|
11
|
-
*/
|
|
12
|
-
export declare const resolveConfig: (options: RunOptions) => Promise<StagedConfig>;
|
|
13
|
-
/** Validates that a resolved config has the right shape. */
|
|
14
|
-
export declare const validateConfig: (config: unknown) => Record<string, StagedTask>;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { StagedError } from "./staged-error.d.ts";
|
|
2
|
-
/** A git subprocess failed. Holds the stderr tail for surface-level reporting. */
|
|
3
|
-
export declare class GitError extends StagedError {
|
|
4
|
-
readonly stderr?: string;
|
|
5
|
-
constructor(message: string, stderr?: string, options?: ErrorOptions);
|
|
6
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Typed error classes surfaced by the staged workflow. Consumers can
|
|
3
|
-
* switch on `instanceof` to distinguish setup failures from task/git
|
|
4
|
-
* failures. Error names mirror lint-staged's where behavior overlaps.
|
|
5
|
-
*/
|
|
6
|
-
export { ApplyEmptyCommitError } from "./apply-empty-commit-error.d.ts";
|
|
7
|
-
export { ConfigError } from "./config-error.d.ts";
|
|
8
|
-
export { GetBackupStashError } from "./get-backup-stash-error.d.ts";
|
|
9
|
-
export { GitError } from "./git-error.d.ts";
|
|
10
|
-
export { RestoreOriginalStateError } from "./restore-original-state-error.d.ts";
|
|
11
|
-
export { StagedError } from "./staged-error.d.ts";
|
|
12
|
-
export { TaskError } from "./task-error.d.ts";
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base class for all staged-workflow errors. Consumers switch on
|
|
3
|
-
* `instanceof StagedError` to distinguish our failures from arbitrary
|
|
4
|
-
* task exceptions.
|
|
5
|
-
*/
|
|
6
|
-
export declare class StagedError extends Error {
|
|
7
|
-
constructor(message: string, options?: ErrorOptions);
|
|
8
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { StagedError } from "./staged-error.d.ts";
|
|
2
|
-
/** A user-provided task exited non-zero or threw. */
|
|
3
|
-
export declare class TaskError extends StagedError {
|
|
4
|
-
readonly commandTitle: string;
|
|
5
|
-
constructor(commandTitle: string, message: string, options?: ErrorOptions);
|
|
6
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
declare const DEFAULT_DIFF_FILTER = "ACMR";
|
|
2
|
-
/**
|
|
3
|
-
* Lists paths staged as "intent to add" (`git add -N`). These entries crash
|
|
4
|
-
* `git stash create` with `Entry 'path' not uptodate. Cannot merge.`
|
|
5
|
-
* We detect them via `git diff-files --raw`, which emits an all-zero new sha
|
|
6
|
-
* with status `A` for intent-to-add entries (regular worktree-vs-index diffs
|
|
7
|
-
* show a real blob sha for unstaged edits).
|
|
8
|
-
*
|
|
9
|
-
* The caller temporarily unstages them before the backup stash runs, and
|
|
10
|
-
* restores the intent-to-add state in cleanup. See lint-staged issue #990.
|
|
11
|
-
*/
|
|
12
|
-
export declare const getIntentToAddPaths: (cwd: string) => Promise<string[]>;
|
|
13
|
-
/**
|
|
14
|
-
* Lists untracked, non-ignored files in the working tree. Used by
|
|
15
|
-
* `--autoStage` to pick up files a task created during the run.
|
|
16
|
-
*/
|
|
17
|
-
export declare const getUntrackedFiles: (cwd: string) => Promise<string[]>;
|
|
18
|
-
/** Removes the listed paths from the index (`git rm --cached`), leaving the on-disk content alone. */
|
|
19
|
-
export declare const removeFromIndex: (paths: ReadonlyArray<string>, options: {
|
|
20
|
-
readonly cwd: string;
|
|
21
|
-
}) => Promise<void>;
|
|
22
|
-
/**
|
|
23
|
-
* Lists files captured by the current diff — by default, staged files
|
|
24
|
-
* matching the `ACMR` filter. When `diff` is set the range overrides
|
|
25
|
-
* `--staged` (matching lint-staged's `--diff` CLI flag).
|
|
26
|
-
*/
|
|
27
|
-
export declare const getFiles: (options: {
|
|
28
|
-
readonly cwd: string;
|
|
29
|
-
readonly diff?: string;
|
|
30
|
-
readonly diffFilter?: string;
|
|
31
|
-
readonly workTree?: string;
|
|
32
|
-
}) => Promise<string[]>;
|
|
33
|
-
/**
|
|
34
|
-
* Captures the unstaged delta for a list of paths as a git patch. The
|
|
35
|
-
* resulting buffer can be re-applied with `git apply` after tasks run.
|
|
36
|
-
* Returns `null` when there are no unstaged changes for any of the paths.
|
|
37
|
-
*
|
|
38
|
-
* Splits `paths` into batches to stay under `ARG_MAX` on large staged
|
|
39
|
-
* sets. Patch fragments from each batch concatenate cleanly because
|
|
40
|
-
* every fragment starts with its own `diff --git` header.
|
|
41
|
-
*
|
|
42
|
-
* Appends a trailing newline when git's stdout doesn't end in one —
|
|
43
|
-
* `git apply` rejects patches without a final newline as "corrupt patch
|
|
44
|
-
* at line N" even with `--recount --unidiff-zero`.
|
|
45
|
-
*/
|
|
46
|
-
export declare const capturePatch: (paths: ReadonlyArray<string>, options: {
|
|
47
|
-
readonly cwd: string;
|
|
48
|
-
}) => Promise<Buffer | null>;
|
|
49
|
-
/**
|
|
50
|
-
* Returns the worktree-relative paths that have both staged and unstaged modifications.
|
|
51
|
-
*
|
|
52
|
-
* `git status --porcelain=v1 -z` uses NUL record separators and splits rename/copy entries
|
|
53
|
-
* across two records: the status+new-path record, then a second record holding the old path.
|
|
54
|
-
* We walk the records, consuming the trailing old-path record for R/C statuses so they
|
|
55
|
-
* don't leak into the next iteration as a malformed status line.
|
|
56
|
-
*/
|
|
57
|
-
export declare const getPartiallyStagedFiles: (cwd: string) => Promise<string[]>;
|
|
58
|
-
/**
|
|
59
|
-
* Restores working-tree content for the given paths from the index.
|
|
60
|
-
* Uses `--pathspec-from-file` with NUL-separated stdin so huge lists
|
|
61
|
-
* don't blow past `ARG_MAX`.
|
|
62
|
-
*/
|
|
63
|
-
export declare const checkoutPaths: (paths: ReadonlyArray<string>, options: {
|
|
64
|
-
readonly cwd: string;
|
|
65
|
-
}) => Promise<void>;
|
|
66
|
-
/**
|
|
67
|
-
* Refreshes the index against the working tree. Runs `git update-index --again`
|
|
68
|
-
* first (lint-staged v17 behaviour — improves compatibility when the original
|
|
69
|
-
* commit used a pathspec instead of an explicit `git add`), then falls back
|
|
70
|
-
* to `git add -u` against the originally-staged paths to handle deletions
|
|
71
|
-
* that `update-index --again` can't express.
|
|
72
|
-
*/
|
|
73
|
-
export declare const updateIndexAgain: (paths: ReadonlyArray<string>, options: {
|
|
74
|
-
readonly cwd: string;
|
|
75
|
-
}) => Promise<void>;
|
|
76
|
-
export { DEFAULT_DIFF_FILTER };
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export interface GitExecOptions {
|
|
2
|
-
readonly cwd: string;
|
|
3
|
-
/** Environment overrides merged on top of `process.env`. */
|
|
4
|
-
readonly env?: Record<string, string>;
|
|
5
|
-
/** Pipe stdin as a Buffer (used for `git apply`). */
|
|
6
|
-
readonly input?: Buffer | string;
|
|
7
|
-
/** Ignore non-zero exit codes; useful for `rev-parse` checks. */
|
|
8
|
-
readonly lenient?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export interface GitExecResult {
|
|
11
|
-
readonly exitCode: number;
|
|
12
|
-
readonly stderr: string;
|
|
13
|
-
readonly stdout: string;
|
|
14
|
-
}
|
|
15
|
-
/** Runs `git` with the given args. Throws `GitError` on non-zero unless `lenient`. */
|
|
16
|
-
export declare const git: (args: ReadonlyArray<string>, options: GitExecOptions) => Promise<GitExecResult>;
|
|
17
|
-
/** Convenience: returns trimmed stdout from a successful git invocation. */
|
|
18
|
-
export declare const gitOut: (args: ReadonlyArray<string>, options: GitExecOptions) => Promise<string>;
|
|
19
|
-
/** Returns true if `cwd` is inside a git working tree. */
|
|
20
|
-
export declare const isGitRepo: (cwd: string) => Promise<boolean>;
|
|
21
|
-
/** Returns the absolute path to the repository's `.git` directory. */
|
|
22
|
-
export declare const getGitDirectory: (cwd: string) => Promise<string>;
|
|
23
|
-
/** Returns the absolute path to the working-tree root. */
|
|
24
|
-
export declare const getWorkTree: (cwd: string) => Promise<string>;
|
|
25
|
-
/** Returns the current index tree sha (via `git write-tree`). */
|
|
26
|
-
export declare const writeIndexTree: (cwd: string) => Promise<string>;
|
|
27
|
-
/** Returns the tree sha for `HEAD`. Empty string when there is no commit yet. */
|
|
28
|
-
export declare const headTreeSha: (cwd: string) => Promise<string>;
|
|
29
|
-
/** Minimum git version required by the staged workflow — matches lint-staged v17. */
|
|
30
|
-
export declare const MIN_GIT_VERSION: {
|
|
31
|
-
readonly major: 2;
|
|
32
|
-
readonly minor: 32;
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Parses `git --version` output (e.g. `git version 2.45.1.windows.2`) into a
|
|
36
|
-
* `{ major, minor }` tuple. Returns `null` when the shape isn't recognised.
|
|
37
|
-
*/
|
|
38
|
-
export declare const parseGitVersion: (output: string) => {
|
|
39
|
-
major: number;
|
|
40
|
-
minor: number;
|
|
41
|
-
} | null;
|
|
42
|
-
/** Throws `GitError` when the installed git is older than {@link MIN_GIT_VERSION}. */
|
|
43
|
-
export declare const assertGitVersion: (cwd: string) => Promise<void>;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import type { RunOptions } from "../types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Encapsulates the full git side-effect sequence around task execution:
|
|
4
|
-
* take a backup stash, hide unstaged deltas, run tasks, re-stage fixes,
|
|
5
|
-
* reapply hidden deltas, and revert on failure. Mirrors lint-staged's
|
|
6
|
-
* GitWorkflow state machine with equivalent flag behavior.
|
|
7
|
-
*/
|
|
8
|
-
export declare class GitWorkflow {
|
|
9
|
-
stagedFiles: string[];
|
|
10
|
-
partiallyStaged: string[];
|
|
11
|
-
workTree: string;
|
|
12
|
-
gitDir: string;
|
|
13
|
-
/** Index tree sha captured at the end of `prepare()`, before tasks run. */
|
|
14
|
-
preTaskIndexTree: string;
|
|
15
|
-
/** Index tree sha captured at the end of `applyModifications()`, after tasks' in-place edits are staged. */
|
|
16
|
-
postTaskIndexTree: string;
|
|
17
|
-
/** HEAD tree sha captured in `prepare()` — used to detect empty-after-revert commits. */
|
|
18
|
-
headTree: string;
|
|
19
|
-
/** Becomes true after a successful `revert()` so the caller can skip the unstaged-patch re-apply that would duplicate the restored deltas. */
|
|
20
|
-
revertApplied: boolean;
|
|
21
|
-
/** Emitted by `prepare()` when we skip the backup stash but still have partially-staged files — the caller can surface this to the user. */
|
|
22
|
-
warnings: string[];
|
|
23
|
-
private readonly cwd;
|
|
24
|
-
private readonly options;
|
|
25
|
-
private patch;
|
|
26
|
-
private backupStashSha;
|
|
27
|
-
private merge;
|
|
28
|
-
private readonly shouldStash;
|
|
29
|
-
private readonly shouldHidePartial;
|
|
30
|
-
private readonly shouldHideUnstaged;
|
|
31
|
-
private readonly shouldHideAll;
|
|
32
|
-
/** Sha of the hide-all push stash (if `--hide-all` is set), tracked separately from the create+store backup. */
|
|
33
|
-
private hideAllStashSha;
|
|
34
|
-
/** Paths that were `git add -N`'d (intent-to-add) — removed from the index before stashing, restored after. */
|
|
35
|
-
private intentToAddPaths;
|
|
36
|
-
/** Untracked files observed at the end of `prepare()`. Diffed post-run to detect task-created files for `--autoStage`. */
|
|
37
|
-
private preTaskUntracked;
|
|
38
|
-
constructor(options: RunOptions);
|
|
39
|
-
prepare(): Promise<void>;
|
|
40
|
-
/**
|
|
41
|
-
* Refreshes the index against the working tree, so task edits
|
|
42
|
-
* (including deletions of already-tracked files) are re-staged.
|
|
43
|
-
* Uses `git update-index --again` for parity with lint-staged v17,
|
|
44
|
-
* which behaves correctly when the original commit used a pathspec.
|
|
45
|
-
*/
|
|
46
|
-
applyModifications({ autoStage }?: {
|
|
47
|
-
readonly autoStage?: boolean;
|
|
48
|
-
}): Promise<void>;
|
|
49
|
-
/** True when tasks modified at least one staged file's content (index tree changed). */
|
|
50
|
-
indexTreeChanged(): boolean;
|
|
51
|
-
/** True when the post-task index tree matches HEAD — i.e. tasks reverted every staged change. */
|
|
52
|
-
postTaskIndexMatchesHead(): boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Re-applies the hidden unstaged patch. Falls back to 3-way on conflict.
|
|
55
|
-
* Skips silently when `revert()` already restored the working tree from the backup stash,
|
|
56
|
-
* since the stash already carries those deltas and re-applying would duplicate them.
|
|
57
|
-
* When `--hide-all` is active this is also a no-op — the `popHideAllStash()` call in
|
|
58
|
-
* `cleanup()` handles restore for that mode.
|
|
59
|
-
*/
|
|
60
|
-
restoreUnstagedChanges(): Promise<void>;
|
|
61
|
-
/** Restores index + working tree from the backup stash and drops it. */
|
|
62
|
-
revert(): Promise<void>;
|
|
63
|
-
/**
|
|
64
|
-
* On success, drops the backup stash and pops the hide-all stash (if any).
|
|
65
|
-
* On failure without --revert, leaves the backup stash in place so the
|
|
66
|
-
* user can recover manually.
|
|
67
|
-
*/
|
|
68
|
-
cleanup(success: boolean): Promise<void>;
|
|
69
|
-
/**
|
|
70
|
-
* Returns a user-facing hint that points at the backup stash when
|
|
71
|
-
* tasks failed and we kept it around (no --revert).
|
|
72
|
-
*/
|
|
73
|
-
recoveryHint(): string | null;
|
|
74
|
-
private hideUnstagedChanges;
|
|
75
|
-
private snapshotMergeState;
|
|
76
|
-
private restoreMergeState;
|
|
77
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/** Message prefix stored on the stash entry. A per-process suffix is appended at creation time so concurrent `vis staged` invocations don't collide. */
|
|
2
|
-
declare const STASH_MESSAGE_PREFIX = "vis_staged_automatic_backup";
|
|
3
|
-
/**
|
|
4
|
-
* Creates and stores a hidden backup stash. Uses `git stash create +
|
|
5
|
-
* store` instead of `git stash push` so the working tree and index are
|
|
6
|
-
* left untouched — pushing would mutate the worktree, which breaks
|
|
7
|
-
* concurrent editors and file watchers.
|
|
8
|
-
*
|
|
9
|
-
* Returns the stash commit sha, or `null` when there is nothing to
|
|
10
|
-
* stash (e.g. a fresh repo with only an initial commit).
|
|
11
|
-
*/
|
|
12
|
-
export declare const createBackupStash: (cwd: string) => Promise<string | null>;
|
|
13
|
-
/**
|
|
14
|
-
* Stashes every unstaged change and untracked file on top of the index,
|
|
15
|
-
* leaving only staged content in the working tree. Unlike
|
|
16
|
-
* {@link createBackupStash}, this uses `git stash push --include-untracked`
|
|
17
|
-
* because `git stash create` cannot capture untracked files.
|
|
18
|
-
*
|
|
19
|
-
* Returns the stash commit sha so the caller can drop or apply it later.
|
|
20
|
-
*/
|
|
21
|
-
export declare const createHideAllStash: (cwd: string) => Promise<string | null>;
|
|
22
|
-
/** Drops the stash entry that resolves to `sha`, if one is present. */
|
|
23
|
-
export declare const dropBackupStash: (cwd: string, sha: string | null) => Promise<void>;
|
|
24
|
-
/**
|
|
25
|
-
* Restores the working tree and index from the backup stash. Used by
|
|
26
|
-
* the revert path when tasks failed and we need to leave the repo in
|
|
27
|
-
* its pre-task state.
|
|
28
|
-
*/
|
|
29
|
-
export declare const applyBackupStash: (cwd: string, sha: string | null) => Promise<void>;
|
|
30
|
-
/**
|
|
31
|
-
* Pops the hide-all stash back onto the working tree — restoring
|
|
32
|
-
* previously-hidden unstaged edits and untracked files. The index is
|
|
33
|
-
* left untouched so task-driven edits that we already re-staged
|
|
34
|
-
* survive the restore.
|
|
35
|
-
*/
|
|
36
|
-
export declare const popHideAllStash: (cwd: string, sha: string | null) => Promise<void>;
|
|
37
|
-
export { STASH_MESSAGE_PREFIX };
|
package/dist/staged/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { RunOptions, RunResult } from "./types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Runs staged tasks end-to-end: backup, hide unstaged, match files,
|
|
4
|
-
* execute commands, re-stage fixes, reapply unstaged deltas, cleanup.
|
|
5
|
-
* Returns `{ success, ranTasks, failedCommands }`.
|
|
6
|
-
*
|
|
7
|
-
* Throws on setup-level failures (no git repo, invalid config). Task
|
|
8
|
-
* failures are reported via the return value when `continueOnError` is
|
|
9
|
-
* enabled, otherwise they end the run with `success: false`.
|
|
10
|
-
*/
|
|
11
|
-
export declare const runStaged: (options?: RunOptions) => Promise<RunResult>;
|
|
12
|
-
export { ApplyEmptyCommitError, ConfigError, GetBackupStashError, GitError, RestoreOriginalStateError, StagedError, TaskError } from "./index.d.ts";
|
|
13
|
-
export type { RunOptions, RunResult, StagedConfig } from "./types.d.ts";
|
package/dist/staged/match.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface MatchOptions {
|
|
2
|
-
readonly caseInsensitive?: boolean;
|
|
3
|
-
}
|
|
4
|
-
export declare const matchFiles: (pattern: string, files: ReadonlyArray<string>, cwd: string, options?: MatchOptions) => string[];
|
|
5
|
-
/**
|
|
6
|
-
* Filters a staged file list against a top-level ignore list. A file is
|
|
7
|
-
* dropped when any of the ignore patterns matches — basename-style for
|
|
8
|
-
* patterns without a path separator, path-style relative to `cwd`
|
|
9
|
-
* otherwise. Mirrors the `matchFiles` semantics (including `caseInsensitive`)
|
|
10
|
-
* so users don't have to think twice about the ignore syntax.
|
|
11
|
-
*/
|
|
12
|
-
export declare const applyIgnore: (files: ReadonlyArray<string>, ignore: ReadonlyArray<string> | undefined, cwd: string, options?: MatchOptions) => string[];
|