@rynx-ai/workspace 0.1.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.
@@ -0,0 +1,21 @@
1
+ const MAX_WORKSPACE_SKILL_NAME_LENGTH = 64;
2
+ /**
3
+ * Return the portable skill identity used by workspace, daemon, and runtimes.
4
+ * Runtime skill loaders expect a lowercase kebab-case directory/frontmatter
5
+ * name, so display names must never be used as the installation identity.
6
+ */
7
+ export function canonicalWorkspaceSkillName(value, fallback = "skill") {
8
+ const normalize = (input) => input
9
+ .normalize("NFKD")
10
+ .toLowerCase()
11
+ .replace(/[_\s]+/g, "-")
12
+ .replace(/[^a-z0-9-]+/g, "-")
13
+ .replace(/-+/g, "-")
14
+ .replace(/^-|-$/g, "");
15
+ const candidate = normalize(value) || normalize(fallback);
16
+ if (!candidate)
17
+ return "";
18
+ return candidate
19
+ .slice(0, MAX_WORKSPACE_SKILL_NAME_LENGTH)
20
+ .replace(/-+$/g, "");
21
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Produce the collision key used before an immutable Skill revision is stored
3
+ * or materialized. It models the common case-insensitive, Unicode-normalizing
4
+ * filesystem boundary and rejects Windows paths that cannot be represented
5
+ * exactly. The original path remains the content-hash input.
6
+ */
7
+ export declare function portableWorkspaceSkillPathKey(value: string): string;
@@ -0,0 +1,27 @@
1
+ const WINDOWS_RESERVED_SEGMENT = /^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\..*)?$/i;
2
+ const WINDOWS_INVALID_SEGMENT_CHARACTER = /[<>:"|?*\u0000-\u001f]/u;
3
+ /**
4
+ * Produce the collision key used before an immutable Skill revision is stored
5
+ * or materialized. It models the common case-insensitive, Unicode-normalizing
6
+ * filesystem boundary and rejects Windows paths that cannot be represented
7
+ * exactly. The original path remains the content-hash input.
8
+ */
9
+ export function portableWorkspaceSkillPathKey(value) {
10
+ const normalizedSeparators = value.replaceAll("\\", "/");
11
+ const segments = normalizedSeparators.split("/");
12
+ if (normalizedSeparators.startsWith("/") ||
13
+ segments.some((segment) => !segment || segment === "." || segment === "..")) {
14
+ throw new Error(`Invalid portable Skill file path: ${value}`);
15
+ }
16
+ return segments.map((segment) => {
17
+ const normalized = segment.normalize("NFC");
18
+ if (normalized !== segment ||
19
+ normalized.endsWith(".") ||
20
+ normalized.endsWith(" ") ||
21
+ WINDOWS_INVALID_SEGMENT_CHARACTER.test(normalized) ||
22
+ WINDOWS_RESERVED_SEGMENT.test(normalized)) {
23
+ throw new Error(`Invalid portable Skill file path: ${value}`);
24
+ }
25
+ return normalized.toLowerCase();
26
+ }).join("/");
27
+ }