@linxiraos/pi-utils 1.3.2 → 1.4.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.4.0] - 2026-10-21
4
+
5
+ - Version line moves to 1.4.0 with the rest of the suite; no user-visible change in this package.
6
+
3
7
  ## [1.3.2] - 2026-10-19
4
8
 
5
9
  - Version line moves to 1.3.2 with the rest of the suite; no user-visible change in this package.
@@ -16,6 +16,25 @@
16
16
  * assets are `<prefix><os>[-musl]-<arch>[.exe]`.
17
17
  */
18
18
  export declare const RELEASE_CLI_ASSET_PREFIX = "zeta-cli-";
19
+ /**
20
+ * CLI assets a release actually publishes — the `release_binary` matrix in
21
+ * `.github/workflows/ci.yml`. The build script can still produce a darwin or
22
+ * arm64 leg (`scripts/ci-release-build-binaries.ts` keeps those targets
23
+ * buildable), but a leg the matrix does not build has no asset: the updater
24
+ * must never compute its name, or `zetacode update` downloads a 404.
25
+ *
26
+ * `scripts/check-release-asset-names.ts` holds this set equal to the matrix's
27
+ * `binary_path` basenames, so a platform trim updates one list.
28
+ */
29
+ export declare const SHIPPED_CLI_ASSETS: readonly string[];
30
+ /**
31
+ * {@link releaseCliAssetName} restricted to the shipped matrix: undefined means
32
+ * this host has no standalone binary release, so the caller must not build a
33
+ * download URL at all.
34
+ */
35
+ export declare function shippedCliAssetName(platform: NodeJS.Platform, arch: string, options?: {
36
+ musl?: boolean;
37
+ }): string | undefined;
19
38
  /** Release asset for a CLI binary, e.g. `zeta-cli-windows-x64.exe`. */
20
39
  export declare function releaseCliAssetName(platform: NodeJS.Platform, arch: string, options?: {
21
40
  musl?: boolean;
@@ -1,2 +1,9 @@
1
+ /**
2
+ * Resolve a canonical `.yml` config path for reading: the canonical path wins
3
+ * when it exists, otherwise a present `.yaml` sibling is used. Writes must keep
4
+ * targeting the canonical path — the sibling is a read-only compatibility
5
+ * fallback, matching `ConfigFile`.
6
+ */
7
+ export declare function resolveYamlConfigReadPath(canonicalPath: string): string;
1
8
  /** Serialize config YAML without Bun's trailing space on block mapping headers. */
2
9
  export declare function stringifyYamlConfig(value: unknown): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linxiraos/pi-utils",
3
- "version": "1.3.2",
3
+ "version": "1.4.0",
4
4
  "description": "Shared utilities for pi packages",
5
5
  "keywords": [
6
6
  "utilities",
@@ -54,7 +54,7 @@
54
54
  "fmt": "oxfmt --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts'"
55
55
  },
56
56
  "dependencies": {
57
- "@linxiraos/pi-natives": "1.3.2"
57
+ "@linxiraos/pi-natives": "1.4.0"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/bun": "1.4.3"
@@ -27,6 +27,41 @@ const RELEASE_OS: Partial<Record<NodeJS.Platform, string>> = {
27
27
 
28
28
  const RELEASE_ARCH: Record<string, string> = { x64: "x64", arm64: "arm64" };
29
29
 
30
+ /**
31
+ * CLI assets a release actually publishes — the `release_binary` matrix in
32
+ * `.github/workflows/ci.yml`. The build script can still produce a darwin or
33
+ * arm64 leg (`scripts/ci-release-build-binaries.ts` keeps those targets
34
+ * buildable), but a leg the matrix does not build has no asset: the updater
35
+ * must never compute its name, or `zetacode update` downloads a 404.
36
+ *
37
+ * `scripts/check-release-asset-names.ts` holds this set equal to the matrix's
38
+ * `binary_path` basenames, so a platform trim updates one list.
39
+ */
40
+ export const SHIPPED_CLI_ASSETS: readonly string[] = [
41
+ "zeta-cli-linux-x64",
42
+ "zeta-cli-linux-musl-x64",
43
+ "zeta-cli-windows-x64.exe",
44
+ ];
45
+
46
+ /**
47
+ * {@link releaseCliAssetName} restricted to the shipped matrix: undefined means
48
+ * this host has no standalone binary release, so the caller must not build a
49
+ * download URL at all.
50
+ */
51
+ export function shippedCliAssetName(
52
+ platform: NodeJS.Platform,
53
+ arch: string,
54
+ options: { musl?: boolean } = {},
55
+ ): string | undefined {
56
+ let name: string;
57
+ try {
58
+ name = releaseCliAssetName(platform, arch, options);
59
+ } catch {
60
+ return undefined;
61
+ }
62
+ return SHIPPED_CLI_ASSETS.includes(name) ? name : undefined;
63
+ }
64
+
30
65
  /** Release asset for a CLI binary, e.g. `zeta-cli-windows-x64.exe`. */
31
66
  export function releaseCliAssetName(platform: NodeJS.Platform, arch: string, options: { musl?: boolean } = {}): string {
32
67
  const os = RELEASE_OS[platform];
@@ -1,7 +1,20 @@
1
+ import { existsSync } from "node:fs";
1
2
  import { YAML } from "bun";
2
3
 
3
4
  const YAML_MAPPING_HEADER_TRAILING_SPACE = /: +$/gm;
4
5
 
6
+ /**
7
+ * Resolve a canonical `.yml` config path for reading: the canonical path wins
8
+ * when it exists, otherwise a present `.yaml` sibling is used. Writes must keep
9
+ * targeting the canonical path — the sibling is a read-only compatibility
10
+ * fallback, matching `ConfigFile`.
11
+ */
12
+ export function resolveYamlConfigReadPath(canonicalPath: string): string {
13
+ if (!canonicalPath.endsWith(".yml")) return canonicalPath;
14
+ const sibling = `${canonicalPath.slice(0, -4)}.yaml`;
15
+ return existsSync(canonicalPath) || !existsSync(sibling) ? canonicalPath : sibling;
16
+ }
17
+
5
18
  /** Serialize config YAML without Bun's trailing space on block mapping headers. */
6
19
  export function stringifyYamlConfig(value: unknown): string {
7
20
  return YAML.stringify(value, null, 2).replace(YAML_MAPPING_HEADER_TRAILING_SPACE, ":");