@adrifer/winix 0.3.0-preview.5 → 0.3.0-preview.8
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/README.md +103 -0
- package/dist/backends/windows/fonts-runtime.d.ts +1 -0
- package/dist/backends/windows/fonts-runtime.js +206 -0
- package/dist/backends/windows/fonts.d.ts +32 -0
- package/dist/backends/windows/fonts.js +199 -0
- package/dist/backends/windows/index.js +16 -1
- package/dist/backends/windows/lockfile.d.ts +2 -0
- package/dist/backends/windows/lockfile.js +17 -0
- package/dist/backends/windows/npm.d.ts +2 -0
- package/dist/backends/windows/npm.js +60 -0
- package/dist/backends/windows/personalization.d.ts +4 -0
- package/dist/backends/windows/personalization.js +125 -0
- package/dist/cli/commands/apply.d.ts +2 -0
- package/dist/cli/commands/apply.js +13 -7
- package/dist/cli/commands/update.d.ts +2 -0
- package/dist/cli/commands/update.js +9 -0
- package/dist/cli/index.js +22 -0
- package/dist/helpers/windows-npm.d.ts +3 -0
- package/dist/helpers/windows-npm.js +52 -0
- package/dist/helpers/windows-personalization.d.ts +10 -0
- package/dist/helpers/windows-personalization.js +140 -0
- package/dist/helpers/windows.d.ts +14 -1
- package/dist/helpers/windows.js +39 -7
- package/dist/index.d.ts +1 -1
- package/dist/skill.js +38 -0
- package/dist/types/windows.d.ts +46 -0
- package/package.json +1 -1
package/dist/helpers/windows.js
CHANGED
|
@@ -7,6 +7,9 @@ import { resolve, win32, posix } from "node:path";
|
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
import { powerShellLiteral as psSingleQuoted } from "./utils.js";
|
|
9
9
|
import { validatePowerShellRepositoryPolicy } from "./windows-repositories.js";
|
|
10
|
+
import { validateFontSources, validateWallpaper, personalizationValues } from "./windows-personalization.js";
|
|
11
|
+
import { personalizationProperties } from "../backends/windows/personalization.js";
|
|
12
|
+
import { npmRegistryEntries } from "./windows-npm.js";
|
|
10
13
|
const KNOWN_FOLDERS = {
|
|
11
14
|
documents: "MyDocuments",
|
|
12
15
|
desktop: "Desktop",
|
|
@@ -502,7 +505,16 @@ export function resolveWindowsFileProperties(resource, configDir, sourcePath = (
|
|
|
502
505
|
const file = resource.winix;
|
|
503
506
|
if (file?.kind !== "file")
|
|
504
507
|
return resource.properties;
|
|
505
|
-
|
|
508
|
+
const source = file.source === undefined ? undefined : resolveWindowsSource(file.source, configDir, sourcePath);
|
|
509
|
+
switch (file.action) {
|
|
510
|
+
case "text": return buildFileTextScriptProperties({ ...file, content: file.content });
|
|
511
|
+
case "remove": return buildFileRemoveScriptProperties(file);
|
|
512
|
+
case "symlink": return buildFileSymlinkScriptProperties({ ...file, source: source });
|
|
513
|
+
case "copy": return buildFileCopyScriptProperties({ ...file, source: source });
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
export function resolveWindowsSource(original, configDir, sourcePath = (path) => path) {
|
|
517
|
+
let source = original;
|
|
506
518
|
if (source !== undefined && !/%[^%]+%/.test(source) &&
|
|
507
519
|
!win32.isAbsolute(source) && !posix.isAbsolute(source)) {
|
|
508
520
|
if (!configDir)
|
|
@@ -517,12 +529,7 @@ export function resolveWindowsFileProperties(resource, configDir, sourcePath = (
|
|
|
517
529
|
}
|
|
518
530
|
if (source !== undefined && !/%[^%]+%/.test(source))
|
|
519
531
|
source = sourcePath(source);
|
|
520
|
-
|
|
521
|
-
case "text": return buildFileTextScriptProperties({ ...file, content: file.content });
|
|
522
|
-
case "remove": return buildFileRemoveScriptProperties(file);
|
|
523
|
-
case "symlink": return buildFileSymlinkScriptProperties({ ...file, source: source });
|
|
524
|
-
case "copy": return buildFileCopyScriptProperties({ ...file, source: source });
|
|
525
|
-
}
|
|
532
|
+
return source;
|
|
526
533
|
}
|
|
527
534
|
function buildPathScriptProperties(opts) {
|
|
528
535
|
const registryPath = envRegistryPath(opts.scope);
|
|
@@ -1048,6 +1055,12 @@ export const windows = {
|
|
|
1048
1055
|
return dscHandle(resource);
|
|
1049
1056
|
},
|
|
1050
1057
|
},
|
|
1058
|
+
npm: {
|
|
1059
|
+
registries: (policy) => {
|
|
1060
|
+
npmRegistryEntries(policy);
|
|
1061
|
+
return { windows: { npm: { registries: policy } } };
|
|
1062
|
+
},
|
|
1063
|
+
},
|
|
1051
1064
|
package: (arg) => {
|
|
1052
1065
|
const pkg = normalizePackage(arg);
|
|
1053
1066
|
const fragment = { windows: { packages: { [pkg.id]: pkg } } };
|
|
@@ -1064,6 +1077,25 @@ export const windows = {
|
|
|
1064
1077
|
return asHandle(fragment, { kind: "dsc", token: resource.token });
|
|
1065
1078
|
},
|
|
1066
1079
|
setting: (settings, opts) => dscHandle(normalizeSetting(settings, opts)),
|
|
1080
|
+
fonts: (spec) => {
|
|
1081
|
+
validateFontSources(spec?.sources);
|
|
1082
|
+
return dscHandle(withDscMetadata(withDscToken({
|
|
1083
|
+
resourceType: POWERSHELL_SCRIPT_RESOURCE, name: "Windows fonts",
|
|
1084
|
+
dependsOn: resolveDependsOn(spec.dependsOn),
|
|
1085
|
+
}), { kind: "fonts", sources: spec.sources }));
|
|
1086
|
+
},
|
|
1087
|
+
wallpaper: (spec) => {
|
|
1088
|
+
validateWallpaper(spec);
|
|
1089
|
+
return dscHandle(withDscMetadata(withDscToken({
|
|
1090
|
+
resourceType: POWERSHELL_SCRIPT_RESOURCE, name: "Windows wallpaper",
|
|
1091
|
+
dependsOn: resolveDependsOn(spec.dependsOn),
|
|
1092
|
+
}), { kind: "wallpaper", wallpaper: { source: spec.source, style: spec.style } }));
|
|
1093
|
+
},
|
|
1094
|
+
personalization: (options, opts) => dscHandle(withDscToken({
|
|
1095
|
+
resourceType: POWERSHELL_SCRIPT_RESOURCE, name: "Windows personalization",
|
|
1096
|
+
properties: personalizationProperties(personalizationValues(options), options.taskbar?.autoHide),
|
|
1097
|
+
dependsOn: resolveDependsOn(opts?.dependsOn),
|
|
1098
|
+
})),
|
|
1067
1099
|
env: {
|
|
1068
1100
|
set: (name, value, opts) => dscHandle(normalizeEnv(name, "Present", value, opts)),
|
|
1069
1101
|
remove: (name, opts) => dscHandle(normalizeEnv(name, "Absent", undefined, opts)),
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { Fragment, ResourceHandle, FragmentFactory, PlatformFactory, ProfileFactory, LazyFragment, PlatformLazyFragment, FragmentEntry, FragmentResult, NixExpr, RawModuleRef, ImportRef, InputDef, InputWithOptions, WorkspaceDef, HostDef, EvalContext } from "./core/types.js";
|
|
2
|
-
export type { Attrs, BootOptions, DarwinNetworking, DarwinOptions, DarwinSecurity, DarwinDefaults, DarwinSystem, EnvironmentOptions, FirewallOptions, FontsOptions, FzfOptions, GitInclude, GitOptions, HomeActivation, HomebrewOptions, HomeConfig, HomeFile, HomeOptions, I18nOptions, LaunchdAgentOptions, LaunchdOptions, NeovimOptions, NetworkingOptions, NixConfig, NixGcOptions, NixHomebrewOptions, NixOptions, NixpkgsOptions, NixosSecurityOptions, NixosSystemOptions, NixPrimitive, NixSettings, NixValue, NixosOptions, OciContainerOptions, PackageRef, Script, ServicesOptions, StarshipOptions, SystemdOptions, SystemdService, SystemdTimer, TimeOptions, TmuxOptions, UserOptions, UsersOptions, VirtualisationOptions, WslOptions, XdgFile, XdgOptions, ZoxideOptions, ZshOptions, WindowsOptions, WinPackage, WinPackageSource, WinRawCommand, WinSettings, WinColorMode, WinStartFolder, WinTaskbarAlignment, WinTaskbarGroupingMode, WinTaskbarMultiMonMode, WinKnownFolder, WinKnownFolderName, WinFilePath, WinPowerShellModule, WinPowerShellRepositoryPolicy, WinStartupCommand, WinStartupWindowStyle, } from "./types/index.js";
|
|
2
|
+
export type { Attrs, BootOptions, DarwinNetworking, DarwinOptions, DarwinSecurity, DarwinDefaults, DarwinSystem, EnvironmentOptions, FirewallOptions, FontsOptions, FzfOptions, GitInclude, GitOptions, HomeActivation, HomebrewOptions, HomeConfig, HomeFile, HomeOptions, I18nOptions, LaunchdAgentOptions, LaunchdOptions, NeovimOptions, NetworkingOptions, NixConfig, NixGcOptions, NixHomebrewOptions, NixOptions, NixpkgsOptions, NixosSecurityOptions, NixosSystemOptions, NixPrimitive, NixSettings, NixValue, NixosOptions, OciContainerOptions, PackageRef, Script, ServicesOptions, StarshipOptions, SystemdOptions, SystemdService, SystemdTimer, TimeOptions, TmuxOptions, UserOptions, UsersOptions, VirtualisationOptions, WslOptions, XdgFile, XdgOptions, ZoxideOptions, ZshOptions, WindowsOptions, WinPackage, WinPackageSource, WinRawCommand, WinSettings, WinFontSource, WinWallpaper, WinPersonalization, WinColorMode, WinStartFolder, WinTaskbarAlignment, WinTaskbarGroupingMode, WinTaskbarMultiMonMode, WinKnownFolder, WinKnownFolderName, WinFilePath, WinPowerShellModule, WinPowerShellRepositoryPolicy, WinNpmRegistryPolicy, WinStartupCommand, WinStartupWindowStyle, } from "./types/index.js";
|
|
3
3
|
export { platform, feature, profile, host, workspace, input, defineInputs, rawModule, withContext } from "./sdk/index.js";
|
|
4
4
|
export type { WinixContext } from "./sdk/context.js";
|
|
5
5
|
export { evaluate } from "./evaluator/index.js";
|
package/dist/skill.js
CHANGED
|
@@ -257,6 +257,44 @@ Available helpers:
|
|
|
257
257
|
Windows hosts generate a DSC v3 configuration for \`winget configure\`.
|
|
258
258
|
Resources return handles that can be passed through \`dependsOn\`.
|
|
259
259
|
|
|
260
|
+
- \`windows.npm.registries({ registries: { work: {
|
|
261
|
+
uri: "https://packages.example.com/npm/" } }, default: "work",
|
|
262
|
+
scopes: { "@company": "work" } })\` configures current-user npm default/scoped
|
|
263
|
+
registries after host merging. HTTPS only, no credentials/query/fragments.
|
|
264
|
+
Manages only registry and declared @scope:registry keys in .npmrc or absolute
|
|
265
|
+
NPM_CONFIG_USERCONFIG; preserves auth/comments/unrelated settings, rejects
|
|
266
|
+
symlinked files and concurrent edits. Removing declarations doesn't clean up.
|
|
267
|
+
No npm installation, token management or package installation. No allowed-list
|
|
268
|
+
enforcement: project config/env/CLI can override it. Does not alter Winix
|
|
269
|
+
SDK/bootstrap downloads or Linux WSL setup. Dry generation never writes .npmrc.
|
|
270
|
+
|
|
271
|
+
- \`windows.wallpaper({ source: "../wallpapers/desktop.jpg", style: "Fill" })\`
|
|
272
|
+
manages the current-user desktop image; source is a local/config-relative or
|
|
273
|
+
known-folder path. Styles: Fill, Fit, Stretch, Tile, Center, Span. Source
|
|
274
|
+
hashes detect changed images; remote wallpapers and per-monitor assignments
|
|
275
|
+
are not supported.
|
|
276
|
+
- \`windows.personalization({ accentColor: "#336699", explorer: {
|
|
277
|
+
showExtensions: true, showHiddenFiles: false, openTo: "ThisPC" }, taskbar: {
|
|
278
|
+
autoHide: false, search: "Hidden", taskView: true, widgets: false } })\`
|
|
279
|
+
changes only declared current-user values. Accent disables automatic coloring;
|
|
280
|
+
do not contradict it with windows.setting AutoColorization. Explorer openTo is
|
|
281
|
+
ThisPC/Home; search is Hidden/Icon/IconAndLabel/Box. Some preferences require
|
|
282
|
+
signing out and depend on Windows version/policy; never restart Explorer.
|
|
283
|
+
- \`windows.fonts({ sources: ["../fonts/font.ttf", {
|
|
284
|
+
url: "https://example.com/fonts.zip", files: ["**/*.ttf"] }, {
|
|
285
|
+
provider: "nerd-fonts", family: "JetBrainsMono" }] })\` installs current-user
|
|
286
|
+
TTF/OTF fonts. URL sources require HTTPS without credentials, optionally sha256;
|
|
287
|
+
files selects exact ZIP members or **/*.ttf / **/*.otf. Nerd Fonts is the only
|
|
288
|
+
provider, with optional exact version vX.Y.Z. Discover IDs with
|
|
289
|
+
\`winix fonts search [query] --provider nerd-fonts\`; IDs are not installed family
|
|
290
|
+
names. Remote sources lock URL/version/checksum; first resolution trusts upstream
|
|
291
|
+
unless an independent sha256 is supplied. \`winix update --windows fonts\`
|
|
292
|
+
refreshes only font pins. Apply reuses pins; dry runs don't write/install.
|
|
293
|
+
Installation verifies hashes, bounds/safely extracts ZIPs, reports actual font
|
|
294
|
+
families and rejects differing existing files/registry entries. Identical
|
|
295
|
+
files are reused; no font removal or automatic app font selection. Native
|
|
296
|
+
desktop/font activation remains unverified; don't rehearse on a shared machine.
|
|
297
|
+
|
|
260
298
|
- \`windows.package()\` installs a winget or Microsoft Store package. A string
|
|
261
299
|
means a floating winget package ID. The object form accepts \`id\`,
|
|
262
300
|
\`source\`, \`version\`, and dependency options.
|
package/dist/types/windows.d.ts
CHANGED
|
@@ -6,6 +6,35 @@ export interface WinKnownFolder {
|
|
|
6
6
|
path: string;
|
|
7
7
|
}
|
|
8
8
|
export type WinFilePath = string | WinKnownFolder;
|
|
9
|
+
export type WinFontSource = string | {
|
|
10
|
+
url: string;
|
|
11
|
+
sha256?: string;
|
|
12
|
+
/** ZIP member names or recursive extension selectors; defaults to all TTF/OTF files. */
|
|
13
|
+
files?: string[];
|
|
14
|
+
} | {
|
|
15
|
+
provider: "nerd-fonts";
|
|
16
|
+
family: string;
|
|
17
|
+
/** Official release tag; omitted tags resolve latest once, then remain locked. */
|
|
18
|
+
version?: string;
|
|
19
|
+
};
|
|
20
|
+
export interface WinWallpaper {
|
|
21
|
+
source: WinFilePath;
|
|
22
|
+
style?: "Fill" | "Fit" | "Stretch" | "Tile" | "Center" | "Span";
|
|
23
|
+
}
|
|
24
|
+
export interface WinPersonalization {
|
|
25
|
+
accentColor?: string;
|
|
26
|
+
explorer?: {
|
|
27
|
+
showExtensions?: boolean;
|
|
28
|
+
showHiddenFiles?: boolean;
|
|
29
|
+
openTo?: "ThisPC" | "Home";
|
|
30
|
+
};
|
|
31
|
+
taskbar?: {
|
|
32
|
+
autoHide?: boolean;
|
|
33
|
+
search?: "Hidden" | "Icon" | "IconAndLabel" | "Box";
|
|
34
|
+
taskView?: boolean;
|
|
35
|
+
widgets?: boolean;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
9
38
|
export type WinStartupWindowStyle = "normal" | "minimized" | "maximized";
|
|
10
39
|
export interface WinStartupCommand {
|
|
11
40
|
/** Absolute/environment-variable path, known-folder path, or application name on PATH. */
|
|
@@ -32,6 +61,14 @@ export interface WinPowerShellRepositoryPolicy {
|
|
|
32
61
|
/** When specified, reject other repositories instead of falling back. */
|
|
33
62
|
allowed?: string[];
|
|
34
63
|
}
|
|
64
|
+
export interface WinNpmRegistryPolicy {
|
|
65
|
+
registries: Record<string, {
|
|
66
|
+
uri: string;
|
|
67
|
+
}>;
|
|
68
|
+
default: string;
|
|
69
|
+
/** npm scope (including @) mapped to a declared registry name. */
|
|
70
|
+
scopes?: Record<string, string>;
|
|
71
|
+
}
|
|
35
72
|
export interface WinWslDistro {
|
|
36
73
|
name: string;
|
|
37
74
|
source: "nixos-wsl";
|
|
@@ -186,6 +223,12 @@ export interface WinDscResource {
|
|
|
186
223
|
dependsOn?: ResourceRef[];
|
|
187
224
|
}
|
|
188
225
|
export type WinDscMetadata = {
|
|
226
|
+
kind: "fonts";
|
|
227
|
+
sources: WinFontSource[];
|
|
228
|
+
} | {
|
|
229
|
+
kind: "wallpaper";
|
|
230
|
+
wallpaper: WinWallpaper;
|
|
231
|
+
} | {
|
|
189
232
|
kind: "optional-features";
|
|
190
233
|
names: string[];
|
|
191
234
|
enabled: boolean;
|
|
@@ -275,6 +318,9 @@ export type WinDscProperties = {
|
|
|
275
318
|
* order controls apply order.
|
|
276
319
|
*/
|
|
277
320
|
export interface WindowsOptions extends Record<string, unknown> {
|
|
321
|
+
npm?: {
|
|
322
|
+
registries?: WinNpmRegistryPolicy;
|
|
323
|
+
};
|
|
278
324
|
powershell?: {
|
|
279
325
|
repositories?: WinPowerShellRepositoryPolicy;
|
|
280
326
|
};
|
package/package.json
CHANGED