@doki-land/nifty 0.0.12 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "cli.intro": "nifty — gitmoji-first release tooling for hybrid cargo + npm workspaces",
3
3
  "cli.cmd.update": "Update Cargo and npm/pnpm dependencies",
4
- "cli.cmd.format": "Format Rust with cargo fmt and JS/TS/JSON with oxc_formatter",
4
+ "cli.cmd.format": "Format Rust with cargo fmt and JS/TS through Oak",
5
5
  "cli.cmd.lint": "Lint commit subjects and cargo workspace hygiene",
6
6
  "cli.cmd.check": "Lint commit subjects, cargo workspace hygiene, and fail on errors",
7
7
  "cli.cmd.upload": "Upload generic assets to GitHub Release or GitHub Pages",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doki-land/nifty",
3
- "version": "0.0.12",
3
+ "version": "0.1.0",
4
4
  "description": "Gitmoji-first commit conventions and release helpers (Node-API + TypeScript)",
5
5
  "type": "module",
6
6
  "license": "MPL-2.0",
@@ -24,11 +24,11 @@
24
24
  "jiti": "^2.4.2"
25
25
  },
26
26
  "optionalDependencies": {
27
- "@doki-land/nifty-win32-x64": "0.0.12",
28
- "@doki-land/nifty-linux-x64": "0.0.12",
29
- "@doki-land/nifty-linux-arm64": "0.0.12",
30
- "@doki-land/nifty-darwin-arm64": "0.0.12",
31
- "@doki-land/nifty-darwin-x64": "0.0.12"
27
+ "@doki-land/nifty-win32-x64": "0.1.0",
28
+ "@doki-land/nifty-linux-x64": "0.1.0",
29
+ "@doki-land/nifty-linux-arm64": "0.1.0",
30
+ "@doki-land/nifty-darwin-arm64": "0.1.0",
31
+ "@doki-land/nifty-darwin-x64": "0.1.0"
32
32
  },
33
33
  "publishConfig": {
34
34
  "access": "public"
@@ -64,7 +64,7 @@ export async function cmdCommitExport(options: ParsedOptions): Promise<number> {
64
64
  path,
65
65
  from: base,
66
66
  to: str(options, "ref") ?? "HEAD",
67
- cwd: cwdFrom(options),
67
+ cwd: cwdFrom(options) ?? process.cwd(),
68
68
  json: flag(options, "json"),
69
69
  errorsOnly: flag(options, "errors-only"),
70
70
  reportTitle: "commit export lint",
@@ -3,6 +3,7 @@ import type { Cli, ParsedOptions } from "@vmz/commander";
3
3
  import { loadNiftyNative } from "../native.js";
4
4
  import { authPayload } from "./authArgs.js";
5
5
  import { loadConfig } from "../config/loadConfig.js";
6
+ import { trustPayloadFromConfig } from "../config/trustPayload.js";
6
7
  import { bootstrapFromOptions } from "./context.js";
7
8
  import { printPublishReport } from "./publish.js";
8
9
  import { authFromOptions, cwdFrom, flag, str, strList } from "./options.js";
@@ -41,6 +42,7 @@ export async function cmdPublish(options: ParsedOptions): Promise<number> {
41
42
  : fromConfig.length > 0
42
43
  ? { packages: fromConfig }
43
44
  : {}),
45
+ ...trustPayloadFromConfig(config),
44
46
  ...authPayload(authFromOptions(options)),
45
47
  });
46
48
  printPublishReport(report, flag(options, "dry-run"));
@@ -3,6 +3,7 @@ import type { Cli, ParsedOptions } from "@vmz/commander";
3
3
  import { loadNiftyNative } from "../native.js";
4
4
  import { authPayload } from "./authArgs.js";
5
5
  import { loadConfig } from "../config/loadConfig.js";
6
+ import { trustPayloadFromConfig } from "../config/trustPayload.js";
6
7
  import { bootstrapFromOptions } from "./context.js";
7
8
  import { printTrustReport } from "./trust.js";
8
9
  import { authFromOptions, cwdFrom, flag, str } from "./options.js";
@@ -22,12 +23,14 @@ export async function cmdTrust(options: ParsedOptions): Promise<number> {
22
23
  await bootstrapFromOptions(options);
23
24
  const { config } = await loadConfig({ cwd: cwdFrom(options), createIfMissing: false });
24
25
  const native = loadNiftyNative();
26
+ const fromConfig = config.publish?.packages ?? [];
25
27
  const report = native.publisher["trust-workspace"]({
26
28
  cwd: cwdFrom(options),
27
29
  dryRun: flag(options, "dry-run"),
28
30
  refresh: flag(options, "refresh"),
29
31
  only: str(options, "only"),
30
- packages: config.publish?.packages,
32
+ ...(fromConfig.length > 0 ? { packages: fromConfig } : {}),
33
+ ...trustPayloadFromConfig(config),
31
34
  ...authPayload(authFromOptions(options)),
32
35
  });
33
36
  printTrustReport(report);
package/src/cli/trust.ts CHANGED
@@ -68,8 +68,11 @@ export function printTrustReport(report: TrustReport): void {
68
68
  function printTrustHelp(): void {
69
69
  console.log(`nifty trust — configure npm Trusted Publisher for workspace packages
70
70
 
71
- Reads NPM_TOTP_SECRET / NPM_OTP / NPM_TOKEN from env or .env.placeholder.local.
71
+ Reads trust.npm from nifty.config.ts (repo / file / environment).
72
+ Auth: NPM_TOKEN from env or .env.placeholder.local, or npm login token in project .npmrc / ~/.npmrc.
73
+ Optional NPM_TOTP_SECRET / NPM_OTP for 2FA accounts (npm-otp header).
72
74
  Trust list cache lives in .cache/npm-placeholder.json.
75
+ Uses the npm registry API (/-/package/*/trust), not npm trust CLI.
73
76
 
74
77
  Usage:
75
78
  nifty trust
@@ -21,6 +21,7 @@ export {
21
21
  type LoadedNiftyConfig,
22
22
  } from "./loadConfig.js";
23
23
  export { resolveFormatConfig, type ResolvedFormatOptions } from "./formatPresets.js";
24
+ export { trustPayloadFromConfig } from "./trustPayload.js";
24
25
  export {
25
26
  CONFIG_FILE_NAMES,
26
27
  type NiftyAuthorEntry,
@@ -30,4 +31,6 @@ export {
30
31
  type NiftyFormatConfig,
31
32
  type NiftyFormatPreset,
32
33
  type NiftyFormatStyleConfig,
34
+ type NiftyTrustConfig,
35
+ type NiftyTrustNpmConfig,
33
36
  } from "./types.js";
@@ -0,0 +1,14 @@
1
+ import type { NiftyConfig } from "./types.js";
2
+
3
+ /** Map `nifty.config` `trust.npm` into native publisher options. */
4
+ export function trustPayloadFromConfig(config: NiftyConfig) {
5
+ const npm = config.trust?.npm;
6
+ if (!npm) {
7
+ return {};
8
+ }
9
+ return {
10
+ ...(npm.repo ? { trustRepo: npm.repo } : {}),
11
+ ...(npm.file ? { trustFile: npm.file } : {}),
12
+ ...(npm.environment ? { trustEnvironment: npm.environment } : {}),
13
+ };
14
+ }
@@ -7,7 +7,7 @@ export type NiftyAuthorEntry = {
7
7
  /** Built-in workspace format presets (`nifty.config` `format.preset`). */
8
8
  export type NiftyFormatPreset = "default" | "nifty" | "npm-tools" | "vmz";
9
9
 
10
- /** `oxc_formatter` style knobs (`nifty.config` `format.style`). */
10
+ /** Oak formatter style knobs (`nifty.config` `format.style`). */
11
11
  export type NiftyFormatStyleConfig = {
12
12
  /** Indent with spaces or tabs (default: `space`). */
13
13
  indentStyle?: "space" | "tab";
@@ -19,6 +19,21 @@ export type NiftyFormatStyleConfig = {
19
19
  quoteStyle?: "single" | "double";
20
20
  };
21
21
 
22
+ /** npm Trusted Publisher target for `nifty trust` (GitHub Actions OIDC). */
23
+ export type NiftyTrustNpmConfig = {
24
+ /** GitHub `owner/repo` for the publishing workflow. */
25
+ repo?: string;
26
+ /** Workflow filename, e.g. `release-npm.yml`. */
27
+ file?: string;
28
+ /** GitHub Environment name, e.g. `NPM_PUBLISH`. */
29
+ environment?: string;
30
+ };
31
+
32
+ /** Trusted publisher wiring (`nifty trust`). Only `npm` is supported today. */
33
+ export type NiftyTrustConfig = {
34
+ npm?: NiftyTrustNpmConfig;
35
+ };
36
+
22
37
  /** Workspace format options (`nifty format` reads `nifty.config` `format`). */
23
38
  export type NiftyFormatConfig = {
24
39
  /** Select built-in include roots for Nifty hybrid monorepos. */
@@ -29,9 +44,9 @@ export type NiftyFormatConfig = {
29
44
  excludes?: string[];
30
45
  /** Run `cargo fmt` (default: true when a Cargo workspace is detected). */
31
46
  rust?: boolean;
32
- /** Run `oxc_formatter` on JS/TS targets (default: true). */
47
+ /** Run Oak formatting on JS/TS targets (default: true). */
33
48
  javascript?: boolean;
34
- /** Inline oxc formatter style (not an external config file path). */
49
+ /** Inline Oak formatter style (not an external config file path). */
35
50
  style?: NiftyFormatStyleConfig;
36
51
  };
37
52
 
@@ -49,9 +64,17 @@ export type NiftyConfig = {
49
64
  npmRoot?: string;
50
65
  /** npm publish / Trusted Publisher (CI uses publish-npm.yml). */
51
66
  publish?: {
52
- /** Package names to trust (includes registry-only native sidecars). */
67
+ /**
68
+ * Optional narrow subset for `nifty publish` / `nifty trust`.
69
+ * Default: every workspace package that is not `private: true` (and not blocked by a private dep).
70
+ */
53
71
  packages?: string[];
54
72
  };
73
+ /**
74
+ * Trusted publisher wiring for `nifty trust`.
75
+ * Prefer `trust.npm` over `NIFTY_TRUST_*` env vars. `nifty trust` uses the npm registry API.
76
+ */
77
+ trust?: NiftyTrustConfig;
55
78
  /** Release reference changelog defaults (`nifty change-logs`). */
56
79
  changelog?: {
57
80
  /** GitHub `owner/repo` for contrib.rocks (default: parse `origin`). */
package/src/index.ts CHANGED
@@ -37,6 +37,9 @@ export {
37
37
  type NiftyFormatConfig,
38
38
  type NiftyFormatPreset,
39
39
  type NiftyFormatStyleConfig,
40
+ type NiftyTrustConfig,
41
+ type NiftyTrustNpmConfig,
42
+ trustPayloadFromConfig,
40
43
  type ProjectKind,
41
44
  type ProjectLayout,
42
45
  type ResolvedFormatOptions,
package/src/native.ts CHANGED
@@ -40,19 +40,13 @@ export type GitExports = {
40
40
  repoRoot: string,
41
41
  fromRef: string | undefined,
42
42
  toRef: string,
43
- ) => Array<{
44
- hash: string;
45
- email: string;
46
- author: string;
47
- subject: string;
48
- body: string;
49
- gitmoji?: string;
50
- section: string;
51
- }>;
43
+ ) => NativeCommitRecord[];
52
44
  "detect-github-repo": (repoRoot: string) => string | undefined;
53
45
  "parse-github-remote": (url: string) => string | undefined;
54
46
  };
55
47
 
48
+ type NativeCommitRecord = Omit<CommitRecord, "section"> & { section: string };
49
+
56
50
  export type PublishReport = {
57
51
  root: string;
58
52
  order: string[];
@@ -234,6 +228,9 @@ export type PublisherExports = {
234
228
  otp?: string;
235
229
  totpSecret?: string;
236
230
  token?: string;
231
+ trustRepo?: string;
232
+ trustFile?: string;
233
+ trustEnvironment?: string;
237
234
  }) => PublishReport;
238
235
  "trust-workspace": (options: {
239
236
  cwd?: string;
@@ -245,6 +242,9 @@ export type PublisherExports = {
245
242
  otp?: string;
246
243
  totpSecret?: string;
247
244
  token?: string;
245
+ trustRepo?: string;
246
+ trustFile?: string;
247
+ trustEnvironment?: string;
248
248
  }) => TrustReport;
249
249
  };
250
250
 
@@ -706,6 +706,11 @@ function wrapBinding(binding: NativeBinding): NiftyNative {
706
706
  ...(options.otp !== undefined ? { otp: options.otp } : {}),
707
707
  ...(options.totpSecret !== undefined ? { totpSecret: options.totpSecret } : {}),
708
708
  ...(options.token !== undefined ? { token: options.token } : {}),
709
+ ...(options.trustRepo !== undefined ? { trustRepo: options.trustRepo } : {}),
710
+ ...(options.trustFile !== undefined ? { trustFile: options.trustFile } : {}),
711
+ ...(options.trustEnvironment !== undefined
712
+ ? { trustEnvironment: options.trustEnvironment }
713
+ : {}),
709
714
  }),
710
715
  "trust-workspace": (options) =>
711
716
  binding.publisherTrustWorkspace({
@@ -718,6 +723,11 @@ function wrapBinding(binding: NativeBinding): NiftyNative {
718
723
  ...(options.otp !== undefined ? { otp: options.otp } : {}),
719
724
  ...(options.totpSecret !== undefined ? { totpSecret: options.totpSecret } : {}),
720
725
  ...(options.token !== undefined ? { token: options.token } : {}),
726
+ ...(options.trustRepo !== undefined ? { trustRepo: options.trustRepo } : {}),
727
+ ...(options.trustFile !== undefined ? { trustFile: options.trustFile } : {}),
728
+ ...(options.trustEnvironment !== undefined
729
+ ? { trustEnvironment: options.trustEnvironment }
730
+ : {}),
721
731
  }),
722
732
  },
723
733
  };
@@ -753,7 +763,7 @@ export function mapRangeInfo(raw: { version: string; "from-ref"?: string; "to-re
753
763
  };
754
764
  }
755
765
 
756
- export function mapCommitRecord(raw: CommitRecord): CommitRecord {
766
+ export function mapCommitRecord(raw: NativeCommitRecord): CommitRecord {
757
767
  return {
758
768
  hash: raw.hash,
759
769
  email: raw.email,