Skip to content

feat: validate alias config keys against known workspaces - #701

Merged
nam-hle merged 2 commits into
mainfrom
feat/698-alias-validation
Jun 21, 2026
Merged

feat: validate alias config keys against known workspaces#701
nam-hle merged 2 commits into
mainfrom
feat/698-alias-validation

Conversation

@nam-hle

@nam-hle nam-hle commented Jun 20, 2026

Copy link
Copy Markdown
Member

Closes #698.

What

An object-map alias key must now match a known workspace path — the root path (.) or a sub-workspace's relative path. A key that matches no workspace was previously silently ignored; it now errors.

The other two cases #698 listed (duplicate label, label/id collision) were already handled by the existing validateWorkspaceLabels — but their messages were being swallowed because the top-level handler only prints NadleError. This PR surfaces all of them.

How

  • @nadle/kernel — new validateAliasKeys(aliasOption, workspaces) beside validateWorkspaceLabels. No-op for undefined/function aliases (a function only ever receives known paths). Throws a plain Error (kernel is zero-dep).
  • @nadle/project-resolverconfigureProject calls it before resolution, fail-fast on a typo'd key.
  • nadleoptions-resolver translates the kernel Error into a ConfigurationError so the message is printed with the config exit code (2). This also un-swallows the existing label/id-collision messages.

Tests

  • Kernel unit tests for validateAliasKeys (undefined/function no-op, all-valid no-op, unknown key throws).
  • Integration tests for the three rejection cases.
  • The new validation exposed a latent dead-alias typo in the workspaces-list fixtures (packages/minusOne — no such workspace; the intended target is minusOne). Fixed the key; the oneMinus alias now actually applies (1-line snapshot update).

Spec

spec/07-workspace.md gains the new alias rule; CHANGELOG + version bump to 4.1.0 (committed separately on this branch). Design doc in docs/superpowers/specs/.

Verification

  • nadle build (compile + typecheck + bundle) clean.
  • kernel suite 38 pass; nadle workspace suite 55 pass; eslint + prettier clean; pre-commit nadle check passes.
  • No public-API change (validateAliasKeys is kernel-internal, not re-exported from nadle).

🤖 Generated with Claude Code

nam-hle and others added 2 commits June 20, 2026 13:17
Add the rule that an object-map alias key must match a known workspace
path (root '.' or a sub-workspace relative path); an unmatched key is an
error. Function-form aliases are exempt. Bumps spec to 4.1.0.

Includes the brainstorming design doc.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add validateAliasKeys in @nadle/kernel: an object-map alias key must
match a known workspace path (root '.' or a sub-workspace relativePath);
an unmatched key now errors instead of being silently ignored. Wired
into configureProject, ahead of the existing post-resolution
validateWorkspaceLabels (which already covers duplicate-label and
label/id-collision cases).

Alias validation runs in the zero-dependency kernel and throws a plain
Error; options-resolver now translates it to a ConfigurationError so the
message is surfaced (the top-level handler only prints NadleError) with
the config exit code — this also fixes the previously-swallowed
validateWorkspaceLabels messages.

Tests: kernel unit tests for validateAliasKeys; integration tests for the
three rejection cases. Fixes a latent dead-alias typo in workspaces-list
fixtures that the new validation exposed (packages/minusOne -> minusOne).

Closes #698

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@netlify

netlify Bot commented Jun 20, 2026

Copy link
Copy Markdown

Deploy Preview for nadle ready!

Name Link
🔨 Latest commit 31ac97c
🔍 Latest deploy log https://app.netlify.com/projects/nadle/deploys/6a3633fec2673400085c042a
😎 Deploy Preview https://deploy-preview-701--nadle.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 94
Accessibility: 97
Best Practices: 100
SEO: 100
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@nam-hle
nam-hle enabled auto-merge (squash) June 20, 2026 06:32
@pkg-pr-new

pkg-pr-new Bot commented Jun 20, 2026

Copy link
Copy Markdown

Open in StackBlitz

create-nadle

npx https://pkg.pr.new/nadlejs/nadle/create-nadle@701

eslint-plugin-nadle

npx https://pkg.pr.new/nadlejs/nadle/eslint-plugin-nadle@701

@nadle/kernel

npx https://pkg.pr.new/nadlejs/nadle/@nadle/kernel@701

@nadle/language-server

npx https://pkg.pr.new/nadlejs/nadle/@nadle/language-server@701

nadle

npx https://pkg.pr.new/nadlejs/nadle@701

@nadle/project-resolver

npx https://pkg.pr.new/nadlejs/nadle/@nadle/project-resolver@701

nadle-vscode-extension

npx https://pkg.pr.new/nadlejs/nadle/nadle-vscode-extension@701

commit: 31ac97c

@nam-hle
nam-hle merged commit 6868b1d into main Jun 21, 2026
44 of 46 checks passed
@nam-hle
nam-hle deleted the feat/698-alias-validation branch June 21, 2026 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: validate alias configuration (duplicates, collisions, missing paths)

1 participant