@doki-land/nifty 0.0.5 → 0.0.6
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/locales/en-US/cli.json +6 -4
- package/package.json +4 -4
- package/src/cli/cli.ts +2 -2
- package/src/cli/{reword-cmd.ts → commit-cmd.ts} +56 -15
- package/src/cli/format.ts +14 -3
- package/src/cli/lint.ts +7 -1
- package/src/config/formatPresets.ts +55 -0
- package/src/config/index.ts +3 -0
- package/src/config/loadConfig.ts +1 -1
- package/src/config/types.ts +21 -0
- package/src/index.ts +4 -0
- package/src/native.ts +97 -6
package/locales/en-US/cli.json
CHANGED
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
"cli.cmd.bump": "Align workspace crate and package versions",
|
|
10
10
|
"cli.cmd.publish": "Publish workspace npm packages (OIDC or token + TOTP)",
|
|
11
11
|
"cli.cmd.trust": "Configure npm Trusted Publisher for workspace packages",
|
|
12
|
-
"cli.cmd.
|
|
13
|
-
"cli.cmd.
|
|
14
|
-
"cli.cmd.
|
|
12
|
+
"cli.cmd.commit": "Commit message export, apply, scan, and audit",
|
|
13
|
+
"cli.cmd.commit.export": "Export a JSON commit message map template",
|
|
14
|
+
"cli.cmd.commit.apply": "Apply commit message edits from a JSON map and update the branch ref",
|
|
15
|
+
"cli.cmd.commit.scan": "Scan commit messages for gitmoji and hygiene issues",
|
|
16
|
+
"cli.cmd.commit.audit": "Audit commit messages and fail on errors",
|
|
15
17
|
"cli.cmd.retime": "Spread commit timestamps across a date range on a new branch",
|
|
16
18
|
"cli.cmd.retime.root": "Retime all commits from repository root through tip",
|
|
17
19
|
"cli.cmd.change-logs": "Draft release reference changelogs from git tags",
|
|
@@ -51,7 +53,7 @@
|
|
|
51
53
|
"cli.opt.npm-token": "npm auth token (overrides NPM_TOKEN)",
|
|
52
54
|
"cli.opt.base": "Exclusive range start commit (e.g. 34e1e665^)",
|
|
53
55
|
"cli.opt.ref": "Branch ref to rewrite (default: HEAD)",
|
|
54
|
-
"cli.opt.path": "Path to
|
|
56
|
+
"cli.opt.path": "Path to commit JSON map (default: commit.pending.json)",
|
|
55
57
|
"cli.opt.start-date": "Random window start (YYYY-MM-DD or ISO datetime)",
|
|
56
58
|
"cli.opt.end-date": "Random window end",
|
|
57
59
|
"cli.opt.branch": "Output branch name (default: time-travel)",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doki-land/nifty",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Gitmoji-first commit conventions and release helpers (Node-API + TypeScript)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MPL-2.0",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"jiti": "^2.4.2"
|
|
25
25
|
},
|
|
26
26
|
"optionalDependencies": {
|
|
27
|
-
"@doki-land/nifty-win32-x64": "0.0.
|
|
28
|
-
"@doki-land/nifty-linux-x64": "0.0.
|
|
29
|
-
"@doki-land/nifty-darwin-arm64": "0.0.
|
|
27
|
+
"@doki-land/nifty-win32-x64": "0.0.6",
|
|
28
|
+
"@doki-land/nifty-linux-x64": "0.0.6",
|
|
29
|
+
"@doki-land/nifty-darwin-arm64": "0.0.6"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
package/src/cli/cli.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { registerInstallNativeCommand } from "./install-native-cmd.js";
|
|
|
10
10
|
import { registerLintCommands } from "./lint-cmd.js";
|
|
11
11
|
import { registerPublishCommand } from "./publish-cmd.js";
|
|
12
12
|
import { registerRetimeCommand } from "./retime-cmd.js";
|
|
13
|
-
import {
|
|
13
|
+
import { registerCommitCommand } from "./commit-cmd.js";
|
|
14
14
|
import { registerTrustCommand } from "./trust-cmd.js";
|
|
15
15
|
import { registerUpdateCommand } from "./update-cmd.js";
|
|
16
16
|
import { registerUploadCommand } from "./upload-cmd.js";
|
|
@@ -30,7 +30,7 @@ function buildNiftyCli() {
|
|
|
30
30
|
registerBumpCommand(cli);
|
|
31
31
|
registerPublishCommand(cli);
|
|
32
32
|
registerTrustCommand(cli);
|
|
33
|
-
|
|
33
|
+
registerCommitCommand(cli);
|
|
34
34
|
registerRetimeCommand(cli);
|
|
35
35
|
registerChangeLogsCommand(cli);
|
|
36
36
|
|
|
@@ -2,33 +2,48 @@ import type { Cli, ParsedOptions } from "@vmz/commander";
|
|
|
2
2
|
|
|
3
3
|
import { loadNiftyNative } from "../native.js";
|
|
4
4
|
import { bootstrapFromOptions } from "./context.js";
|
|
5
|
-
import {
|
|
5
|
+
import { lintCommits, type LintOptions } from "./lint.js";
|
|
6
|
+
import { cwdFrom, flag, str, strList } from "./options.js";
|
|
6
7
|
|
|
7
|
-
export function
|
|
8
|
-
const
|
|
8
|
+
export function registerCommitCommand(cli: Cli): void {
|
|
9
|
+
const commit = cli.command("commit", "cli.cmd.commit");
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
.command("export", "cli.cmd.
|
|
11
|
+
commit
|
|
12
|
+
.command("export", "cli.cmd.commit.export")
|
|
12
13
|
.option("--base <ref>", "cli.opt.base")
|
|
13
14
|
.option("--ref <ref>", "cli.opt.ref")
|
|
14
15
|
.option("--path <file>", "cli.opt.path")
|
|
15
|
-
.action(async (options) =>
|
|
16
|
+
.action(async (options) => cmdCommitExport(options));
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
.command("
|
|
18
|
+
commit
|
|
19
|
+
.command("apply", "cli.cmd.commit.apply")
|
|
19
20
|
.option("--base <ref>", "cli.opt.base")
|
|
20
21
|
.option("--ref <ref>", "cli.opt.ref")
|
|
21
22
|
.option("--path <file>", "cli.opt.path")
|
|
22
23
|
.option("--dry-run", "cli.opt.dry-run")
|
|
23
|
-
.action(async (options) =>
|
|
24
|
+
.action(async (options) => cmdCommitApply(options));
|
|
25
|
+
|
|
26
|
+
commit
|
|
27
|
+
.command("scan", "cli.cmd.commit.scan")
|
|
28
|
+
.option("--from <ref>", "cli.opt.from")
|
|
29
|
+
.option("--to <ref>", "cli.opt.to")
|
|
30
|
+
.option("-s, --subject <text>...", "cli.opt.subject")
|
|
31
|
+
.action(async (options) => cmdCommitScan(options));
|
|
32
|
+
|
|
33
|
+
commit
|
|
34
|
+
.command("audit", "cli.cmd.commit.audit")
|
|
35
|
+
.option("--from <ref>", "cli.opt.from")
|
|
36
|
+
.option("--to <ref>", "cli.opt.to")
|
|
37
|
+
.option("-s, --subject <text>...", "cli.opt.subject")
|
|
38
|
+
.action(async (options) => cmdCommitAudit(options));
|
|
24
39
|
}
|
|
25
40
|
|
|
26
|
-
export async function
|
|
41
|
+
export async function cmdCommitExport(options: ParsedOptions): Promise<number> {
|
|
27
42
|
await bootstrapFromOptions(options);
|
|
28
43
|
const base = requireStr(options, "base");
|
|
29
|
-
const path = str(options, "path") ?? "
|
|
44
|
+
const path = str(options, "path") ?? "commit.pending.json";
|
|
30
45
|
const native = loadNiftyNative();
|
|
31
|
-
const report = native.history["
|
|
46
|
+
const report = native.history["commit-export"]({
|
|
32
47
|
cwd: cwdFrom(options),
|
|
33
48
|
base,
|
|
34
49
|
ref: str(options, "ref"),
|
|
@@ -38,13 +53,13 @@ export async function cmdRewordExport(options: ParsedOptions): Promise<number> {
|
|
|
38
53
|
return 0;
|
|
39
54
|
}
|
|
40
55
|
|
|
41
|
-
export async function
|
|
56
|
+
export async function cmdCommitApply(options: ParsedOptions): Promise<number> {
|
|
42
57
|
await bootstrapFromOptions(options);
|
|
43
58
|
const base = requireStr(options, "base");
|
|
44
59
|
const path = requireStr(options, "path");
|
|
45
60
|
const dryRun = flag(options, "dry-run");
|
|
46
61
|
const native = loadNiftyNative();
|
|
47
|
-
const report = native.history["
|
|
62
|
+
const report = native.history["commit-apply"]({
|
|
48
63
|
cwd: cwdFrom(options),
|
|
49
64
|
base,
|
|
50
65
|
ref: str(options, "ref"),
|
|
@@ -70,7 +85,7 @@ export async function cmdRewordRewrite(options: ParsedOptions): Promise<number>
|
|
|
70
85
|
}
|
|
71
86
|
|
|
72
87
|
console.log(
|
|
73
|
-
`
|
|
88
|
+
`applied ${report.changes.length} commit object(s); ${report.oldTip} -> ${report.newTip ?? report.oldTip}`,
|
|
74
89
|
);
|
|
75
90
|
for (const change of report.changes) {
|
|
76
91
|
console.log(` ${change.oldOid} ${change.newSubject}`);
|
|
@@ -78,6 +93,32 @@ export async function cmdRewordRewrite(options: ParsedOptions): Promise<number>
|
|
|
78
93
|
return 0;
|
|
79
94
|
}
|
|
80
95
|
|
|
96
|
+
export async function cmdCommitScan(options: ParsedOptions): Promise<number> {
|
|
97
|
+
await bootstrapFromOptions(options);
|
|
98
|
+
await lintCommits(commitLintOptions(options), false, true);
|
|
99
|
+
return 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export async function cmdCommitAudit(options: ParsedOptions): Promise<number> {
|
|
103
|
+
await bootstrapFromOptions(options);
|
|
104
|
+
const errorCount = await lintCommits(commitLintOptions(options), true, true);
|
|
105
|
+
if (errorCount > 0) {
|
|
106
|
+
throw new Error(`found ${errorCount} commit audit error(s)`);
|
|
107
|
+
}
|
|
108
|
+
return 0;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function commitLintOptions(options: ParsedOptions): LintOptions {
|
|
112
|
+
return {
|
|
113
|
+
subjects: strList(options, "subject"),
|
|
114
|
+
from: str(options, "from"),
|
|
115
|
+
to: str(options, "to"),
|
|
116
|
+
cwd: cwdFrom(options),
|
|
117
|
+
scanCargo: false,
|
|
118
|
+
commitOnly: true,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
81
122
|
function requireStr(options: ParsedOptions, key: string): string {
|
|
82
123
|
const value = str(options, key);
|
|
83
124
|
if (!value) {
|
package/src/cli/format.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { loadConfig, resolveFormatConfig } from "../config/index.js";
|
|
1
2
|
import { loadNiftyNative } from "../native.js";
|
|
2
3
|
|
|
3
4
|
export type FormatOptions = {
|
|
@@ -6,10 +7,18 @@ export type FormatOptions = {
|
|
|
6
7
|
};
|
|
7
8
|
|
|
8
9
|
export async function formatWorkspace(options: FormatOptions): Promise<number> {
|
|
10
|
+
const cwd = options.cwd ?? process.cwd();
|
|
11
|
+
const { config } = await loadConfig({ cwd, createIfMissing: false, env: { command: "format" } });
|
|
12
|
+
const resolved = resolveFormatConfig(config.format);
|
|
9
13
|
const native = loadNiftyNative();
|
|
10
14
|
const report = native.formatter.run({
|
|
11
|
-
cwd
|
|
15
|
+
cwd,
|
|
12
16
|
check: options.check,
|
|
17
|
+
includes: resolved.includes,
|
|
18
|
+
excludes: resolved.excludes,
|
|
19
|
+
rust: resolved.rust,
|
|
20
|
+
javascript: resolved.javascript,
|
|
21
|
+
styleConfig: resolved.style,
|
|
13
22
|
});
|
|
14
23
|
|
|
15
24
|
if (report.errors.length > 0) {
|
|
@@ -19,9 +28,11 @@ export async function formatWorkspace(options: FormatOptions): Promise<number> {
|
|
|
19
28
|
}
|
|
20
29
|
|
|
21
30
|
if (report.formatted === 0 && report.unchanged > 0 && report.errors.length === 0) {
|
|
22
|
-
console.log(
|
|
31
|
+
console.log(`format: no changes needed (preset ${resolved.preset})`);
|
|
23
32
|
} else if (report.errors.length === 0) {
|
|
24
|
-
console.log(
|
|
33
|
+
console.log(
|
|
34
|
+
`format: ${report.formatted} file(s) updated, ${report.unchanged} unchanged (preset ${resolved.preset})`,
|
|
35
|
+
);
|
|
25
36
|
}
|
|
26
37
|
|
|
27
38
|
return report.errors.length > 0 ? 1 : 0;
|
package/src/cli/lint.ts
CHANGED
|
@@ -7,6 +7,7 @@ export type LintOptions = {
|
|
|
7
7
|
to?: string;
|
|
8
8
|
cwd?: string;
|
|
9
9
|
scanCargo?: boolean;
|
|
10
|
+
commitOnly?: boolean;
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
type LintDiagnostic = {
|
|
@@ -33,7 +34,11 @@ export async function runLint(argv: string[], check: boolean): Promise<void> {
|
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
export async function lintCommits(
|
|
37
|
+
export async function lintCommits(
|
|
38
|
+
options: LintOptions,
|
|
39
|
+
check: boolean,
|
|
40
|
+
commitOnly = options.commitOnly ?? false,
|
|
41
|
+
): Promise<number> {
|
|
37
42
|
const native = loadNiftyNative();
|
|
38
43
|
const cwd = options.cwd ?? process.cwd();
|
|
39
44
|
const { config } = await loadConfig({ cwd, createIfMissing: false });
|
|
@@ -51,6 +56,7 @@ export async function lintCommits(options: LintOptions, check: boolean): Promise
|
|
|
51
56
|
subjects: options.subjects.length > 0 ? options.subjects : undefined,
|
|
52
57
|
rules,
|
|
53
58
|
scanCargo: options.scanCargo,
|
|
59
|
+
commitOnly: commitOnly || options.commitOnly,
|
|
54
60
|
});
|
|
55
61
|
|
|
56
62
|
for (const item of report.diagnostics) {
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { NiftyFormatConfig, NiftyFormatPreset } from "./types.js";
|
|
2
|
+
|
|
3
|
+
export type ResolvedFormatOptions = {
|
|
4
|
+
preset: NiftyFormatPreset;
|
|
5
|
+
includes?: string[];
|
|
6
|
+
excludes?: string[];
|
|
7
|
+
rust?: boolean;
|
|
8
|
+
javascript?: boolean;
|
|
9
|
+
style?: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const NPM_TOOLS_INCLUDES = [
|
|
13
|
+
"scripts/**",
|
|
14
|
+
"projects/packages/**",
|
|
15
|
+
"projects/conformance/**",
|
|
16
|
+
"projects/dashboard/**",
|
|
17
|
+
"package.json",
|
|
18
|
+
"biome.json",
|
|
19
|
+
"nifty.config.ts",
|
|
20
|
+
] as const;
|
|
21
|
+
|
|
22
|
+
/** VMZ hybrid monorepo — JS/TS surfaces only, never whole-repo walk. */
|
|
23
|
+
const VMZ_INCLUDES = [
|
|
24
|
+
"scripts/**",
|
|
25
|
+
"packages/runtimes/**",
|
|
26
|
+
"packages/examples/**",
|
|
27
|
+
"packages/editors/**",
|
|
28
|
+
"packages/ui/**",
|
|
29
|
+
"packages/plugins/**",
|
|
30
|
+
"packages/content/**",
|
|
31
|
+
"packages/homepage/**",
|
|
32
|
+
"package.json",
|
|
33
|
+
"biome.json",
|
|
34
|
+
"nifty.config.ts",
|
|
35
|
+
] as const;
|
|
36
|
+
|
|
37
|
+
const PRESET_INCLUDES: Record<NiftyFormatPreset, readonly string[] | undefined> = {
|
|
38
|
+
default: undefined,
|
|
39
|
+
"npm-tools": NPM_TOOLS_INCLUDES,
|
|
40
|
+
vmz: VMZ_INCLUDES,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** Merge `nifty.config` `format` with built-in preset defaults. */
|
|
44
|
+
export function resolveFormatConfig(format: NiftyFormatConfig | undefined): ResolvedFormatOptions {
|
|
45
|
+
const preset = format?.preset ?? "default";
|
|
46
|
+
const presetIncludes = PRESET_INCLUDES[preset];
|
|
47
|
+
return {
|
|
48
|
+
preset,
|
|
49
|
+
includes: format?.includes ?? (presetIncludes ? [...presetIncludes] : undefined),
|
|
50
|
+
excludes: format?.excludes,
|
|
51
|
+
rust: format?.rust,
|
|
52
|
+
javascript: format?.javascript,
|
|
53
|
+
style: format?.style,
|
|
54
|
+
};
|
|
55
|
+
}
|
package/src/config/index.ts
CHANGED
|
@@ -16,10 +16,13 @@ export {
|
|
|
16
16
|
type LoadConfigOptions,
|
|
17
17
|
type LoadedNiftyConfig,
|
|
18
18
|
} from "./loadConfig.js";
|
|
19
|
+
export { resolveFormatConfig, type ResolvedFormatOptions } from "./formatPresets.js";
|
|
19
20
|
export {
|
|
20
21
|
CONFIG_FILE_NAMES,
|
|
21
22
|
type NiftyAuthorEntry,
|
|
22
23
|
type NiftyConfig,
|
|
23
24
|
type NiftyConfigEnv,
|
|
24
25
|
type NiftyConfigExport,
|
|
26
|
+
type NiftyFormatConfig,
|
|
27
|
+
type NiftyFormatPreset,
|
|
25
28
|
} from "./types.js";
|
package/src/config/loadConfig.ts
CHANGED
|
@@ -28,7 +28,7 @@ export type LoadedNiftyConfig = {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
const DEFAULT_CONFIG_TEMPLATE = `// Nifty project configuration.
|
|
31
|
-
// See @doki-land/nifty for defineConfig,
|
|
31
|
+
// See @doki-land/nifty for defineConfig, format presets, authorMap, and lint rules.
|
|
32
32
|
export default {};
|
|
33
33
|
`;
|
|
34
34
|
|
package/src/config/types.ts
CHANGED
|
@@ -4,6 +4,25 @@ export type NiftyAuthorEntry = {
|
|
|
4
4
|
login?: string;
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
+
/** Built-in workspace format presets (`nifty.config` `format.preset`). */
|
|
8
|
+
export type NiftyFormatPreset = "default" | "npm-tools" | "vmz";
|
|
9
|
+
|
|
10
|
+
/** Workspace format options (`nifty format` reads `nifty.config` `format`). */
|
|
11
|
+
export type NiftyFormatConfig = {
|
|
12
|
+
/** Select built-in include roots. Use `vmz` for the VMZ hybrid monorepo. */
|
|
13
|
+
preset?: NiftyFormatPreset;
|
|
14
|
+
/** Extra include globs (override preset list when set alone). */
|
|
15
|
+
includes?: string[];
|
|
16
|
+
/** Skip paths under these globs after includes expand. */
|
|
17
|
+
excludes?: string[];
|
|
18
|
+
/** Run `cargo fmt` (default: true when a Cargo workspace is detected). */
|
|
19
|
+
rust?: boolean;
|
|
20
|
+
/** Run `oxc_formatter` on JS/TS targets (default: true). */
|
|
21
|
+
javascript?: boolean;
|
|
22
|
+
/** Biome-style formatter config for oxc (default: `biome.json` at project root). */
|
|
23
|
+
style?: string;
|
|
24
|
+
};
|
|
25
|
+
|
|
7
26
|
/** Nifty project configuration (`nifty.config.ts` / `nifty.config.js`). */
|
|
8
27
|
export type NiftyConfig = {
|
|
9
28
|
/** GitHub personal access token for email search / profile fetch. */
|
|
@@ -38,6 +57,8 @@ export type NiftyConfig = {
|
|
|
38
57
|
severity?: "error" | "warning" | "info";
|
|
39
58
|
}>;
|
|
40
59
|
};
|
|
60
|
+
/** Workspace format targets and engines (`nifty format`). */
|
|
61
|
+
format?: NiftyFormatConfig;
|
|
41
62
|
};
|
|
42
63
|
|
|
43
64
|
export type NiftyConfigExport = NiftyConfig | ((env: NiftyConfigEnv) => NiftyConfig | Promise<NiftyConfig>);
|
package/src/index.ts
CHANGED
|
@@ -28,9 +28,13 @@ export {
|
|
|
28
28
|
findPackageManifest,
|
|
29
29
|
type LoadConfigOptions,
|
|
30
30
|
type LoadedNiftyConfig,
|
|
31
|
+
resolveFormatConfig,
|
|
31
32
|
type NiftyAuthorEntry,
|
|
32
33
|
type NiftyConfig,
|
|
33
34
|
type NiftyConfigEnv,
|
|
35
|
+
type NiftyFormatConfig,
|
|
36
|
+
type NiftyFormatPreset,
|
|
34
37
|
type ProjectKind,
|
|
35
38
|
type ProjectLayout,
|
|
39
|
+
type ResolvedFormatOptions,
|
|
36
40
|
} from "./config/index.js";
|
package/src/native.ts
CHANGED
|
@@ -85,12 +85,27 @@ export type RewordRewriteReport = {
|
|
|
85
85
|
};
|
|
86
86
|
|
|
87
87
|
export type HistoryExports = {
|
|
88
|
+
"commit-export": (options: {
|
|
89
|
+
cwd?: string;
|
|
90
|
+
base: string;
|
|
91
|
+
ref?: string;
|
|
92
|
+
path: string;
|
|
93
|
+
}) => { count: number; path: string };
|
|
94
|
+
"commit-apply": (options: {
|
|
95
|
+
cwd?: string;
|
|
96
|
+
base: string;
|
|
97
|
+
ref?: string;
|
|
98
|
+
path: string;
|
|
99
|
+
dryRun?: boolean;
|
|
100
|
+
}) => RewordRewriteReport;
|
|
101
|
+
/** @deprecated use `commit-export` */
|
|
88
102
|
"reword-export": (options: {
|
|
89
103
|
cwd?: string;
|
|
90
104
|
base: string;
|
|
91
105
|
ref?: string;
|
|
92
106
|
path: string;
|
|
93
107
|
}) => { count: number; path: string };
|
|
108
|
+
/** @deprecated use `commit-apply` */
|
|
94
109
|
"reword-rewrite": (options: {
|
|
95
110
|
cwd?: string;
|
|
96
111
|
base: string;
|
|
@@ -160,6 +175,7 @@ export type LintRunOptions = {
|
|
|
160
175
|
subjects?: string[];
|
|
161
176
|
rules?: Array<{ id: string; enabled?: boolean; severity?: "error" | "warning" | "info" }>;
|
|
162
177
|
scanCargo?: boolean;
|
|
178
|
+
commitOnly?: boolean;
|
|
163
179
|
};
|
|
164
180
|
|
|
165
181
|
export type LintReportRecord = {
|
|
@@ -183,8 +199,18 @@ export type FormatReportRecord = {
|
|
|
183
199
|
errors: string[];
|
|
184
200
|
};
|
|
185
201
|
|
|
202
|
+
export type FormatterRunOptions = {
|
|
203
|
+
cwd?: string;
|
|
204
|
+
check?: boolean;
|
|
205
|
+
includes?: string[];
|
|
206
|
+
excludes?: string[];
|
|
207
|
+
rust?: boolean;
|
|
208
|
+
javascript?: boolean;
|
|
209
|
+
styleConfig?: string;
|
|
210
|
+
};
|
|
211
|
+
|
|
186
212
|
export type FormatterExports = {
|
|
187
|
-
run: (options:
|
|
213
|
+
run: (options: FormatterRunOptions) => FormatReportRecord;
|
|
188
214
|
};
|
|
189
215
|
|
|
190
216
|
export type PublisherExports = {
|
|
@@ -280,6 +306,31 @@ type NativeBinding = {
|
|
|
280
306
|
totpSecret?: string | null;
|
|
281
307
|
token?: string | null;
|
|
282
308
|
}) => TrustReport;
|
|
309
|
+
gitToolsCommitExport: (options: {
|
|
310
|
+
cwd?: string | null;
|
|
311
|
+
base: string;
|
|
312
|
+
ref?: string | null;
|
|
313
|
+
path: string;
|
|
314
|
+
}) => { count: number; path: string };
|
|
315
|
+
gitToolsCommitApply: (options: {
|
|
316
|
+
cwd?: string | null;
|
|
317
|
+
base: string;
|
|
318
|
+
ref?: string | null;
|
|
319
|
+
path: string;
|
|
320
|
+
dryRun?: boolean | null;
|
|
321
|
+
}) => {
|
|
322
|
+
changes: Array<{
|
|
323
|
+
oldOid: string;
|
|
324
|
+
oldSubject: string;
|
|
325
|
+
newSubject: string;
|
|
326
|
+
parentsRelinked: boolean;
|
|
327
|
+
messageChanged: boolean;
|
|
328
|
+
}>;
|
|
329
|
+
oldTip: string;
|
|
330
|
+
newTip?: string | null;
|
|
331
|
+
refName: string;
|
|
332
|
+
dryRun: boolean;
|
|
333
|
+
};
|
|
283
334
|
gitToolsRewordExport: (options: {
|
|
284
335
|
cwd?: string | null;
|
|
285
336
|
base: string;
|
|
@@ -355,6 +406,7 @@ type NativeBinding = {
|
|
|
355
406
|
subjects?: string[] | null;
|
|
356
407
|
rules?: Array<{ id: string; enabled?: boolean | null; severity?: string | null }> | null;
|
|
357
408
|
scanCargo?: boolean | null;
|
|
409
|
+
commitOnly?: boolean | null;
|
|
358
410
|
check?: boolean | null;
|
|
359
411
|
}) => {
|
|
360
412
|
diagnostics: Array<{
|
|
@@ -376,6 +428,7 @@ type NativeBinding = {
|
|
|
376
428
|
subjects?: string[] | null;
|
|
377
429
|
rules?: Array<{ id: string; enabled?: boolean | null; severity?: string | null }> | null;
|
|
378
430
|
scanCargo?: boolean | null;
|
|
431
|
+
commitOnly?: boolean | null;
|
|
379
432
|
check?: boolean | null;
|
|
380
433
|
}) => {
|
|
381
434
|
diagnostics: Array<{
|
|
@@ -391,7 +444,15 @@ type NativeBinding = {
|
|
|
391
444
|
warningCount: number;
|
|
392
445
|
};
|
|
393
446
|
updaterRun: (options: { cwd?: string | null; interactive?: boolean | null }) => void;
|
|
394
|
-
formatterRun: (options: {
|
|
447
|
+
formatterRun: (options: {
|
|
448
|
+
cwd?: string | null;
|
|
449
|
+
check?: boolean | null;
|
|
450
|
+
includes?: string[] | null;
|
|
451
|
+
excludes?: string[] | null;
|
|
452
|
+
rust?: boolean | null;
|
|
453
|
+
javascript?: boolean | null;
|
|
454
|
+
styleConfig?: string | null;
|
|
455
|
+
}) => {
|
|
395
456
|
formatted: number;
|
|
396
457
|
unchanged: number;
|
|
397
458
|
errors: string[];
|
|
@@ -424,6 +485,7 @@ function mapLintOptions(options: LintRunOptions) {
|
|
|
424
485
|
...(options.subjects !== undefined ? { subjects: options.subjects } : {}),
|
|
425
486
|
...(options.rules !== undefined ? { rules: options.rules } : {}),
|
|
426
487
|
...(options.scanCargo !== undefined ? { scanCargo: options.scanCargo } : {}),
|
|
488
|
+
...(options.commitOnly !== undefined ? { commitOnly: options.commitOnly } : {}),
|
|
427
489
|
};
|
|
428
490
|
}
|
|
429
491
|
|
|
@@ -498,6 +560,29 @@ function wrapBinding(binding: NativeBinding): NiftyNative {
|
|
|
498
560
|
"parse-github-remote": (url) => binding.gitParseGithubRemote(url) ?? undefined,
|
|
499
561
|
},
|
|
500
562
|
history: {
|
|
563
|
+
"commit-export": (options) =>
|
|
564
|
+
binding.gitToolsCommitExport({
|
|
565
|
+
...(options.cwd !== undefined ? { cwd: options.cwd } : {}),
|
|
566
|
+
base: options.base,
|
|
567
|
+
...(options.ref !== undefined ? { ref: options.ref } : {}),
|
|
568
|
+
path: options.path,
|
|
569
|
+
}),
|
|
570
|
+
"commit-apply": (options) => {
|
|
571
|
+
const report = binding.gitToolsCommitApply({
|
|
572
|
+
...(options.cwd !== undefined ? { cwd: options.cwd } : {}),
|
|
573
|
+
base: options.base,
|
|
574
|
+
...(options.ref !== undefined ? { ref: options.ref } : {}),
|
|
575
|
+
path: options.path,
|
|
576
|
+
...(options.dryRun !== undefined ? { dryRun: options.dryRun } : {}),
|
|
577
|
+
});
|
|
578
|
+
return {
|
|
579
|
+
changes: report.changes,
|
|
580
|
+
oldTip: report.oldTip,
|
|
581
|
+
newTip: report.newTip ?? undefined,
|
|
582
|
+
refName: report.refName,
|
|
583
|
+
dryRun: report.dryRun,
|
|
584
|
+
};
|
|
585
|
+
},
|
|
501
586
|
"reword-export": (options) =>
|
|
502
587
|
binding.gitToolsRewordExport({
|
|
503
588
|
...(options.cwd !== undefined ? { cwd: options.cwd } : {}),
|
|
@@ -586,10 +671,16 @@ function wrapBinding(binding: NativeBinding): NiftyNative {
|
|
|
586
671
|
},
|
|
587
672
|
},
|
|
588
673
|
formatter: {
|
|
589
|
-
run: (options) =>
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
674
|
+
run: (options) =>
|
|
675
|
+
binding.formatterRun({
|
|
676
|
+
...(options.cwd !== undefined ? { cwd: options.cwd } : {}),
|
|
677
|
+
...(options.check !== undefined ? { check: options.check } : {}),
|
|
678
|
+
...(options.includes !== undefined ? { includes: options.includes } : {}),
|
|
679
|
+
...(options.excludes !== undefined ? { excludes: options.excludes } : {}),
|
|
680
|
+
...(options.rust !== undefined ? { rust: options.rust } : {}),
|
|
681
|
+
...(options.javascript !== undefined ? { javascript: options.javascript } : {}),
|
|
682
|
+
...(options.styleConfig !== undefined ? { styleConfig: options.styleConfig } : {}),
|
|
683
|
+
}),
|
|
593
684
|
},
|
|
594
685
|
publisher: {
|
|
595
686
|
"publish-workspace": (options) =>
|