Skip to content

feat(spo): add rule aliases for web alert commands#7221

Draft
mvanhorn wants to merge 3 commits into
pnp:mainfrom
mvanhorn:osc/7036-web-rule-aliases
Draft

feat(spo): add rule aliases for web alert commands#7221
mvanhorn wants to merge 3 commits into
pnp:mainfrom
mvanhorn:osc/7036-web-rule-aliases

Conversation

@mvanhorn
Copy link
Copy Markdown
Contributor

Summary

Adds spo web rule list as an alias for spo web alert list, and spo web rule remove as an alias for spo web alert remove, per #7036. Both names now resolve to the same underlying command, so scripts using either one keep working.

Why this matters

From the issue thread: SharePoint alerts are deprecated, and #7036 traces the user-visible confusion — alert doesn't reflect current terminology. The maintainer discussion (@waldekmastykarz, @Adam-it, @milanholemans all signed off) agreed that adding rule aliases is the forward path, with the alert names kept as the existing aliases on the command classes. The issue opens the door to a full rename later; this PR delivers the user-visible outcome (both names work) without renaming the files.

Changes

  • src/m365/spo/commands.ts — added WEB_RULE_LIST and WEB_RULE_REMOVE constants in alphabetical order (after WEB_ROLEINHERITANCE_RESET, before WEB_SET).
  • src/m365/spo/commands/web/web-alert-list.ts — added public alias() returning [commands.WEB_RULE_LIST], following the pattern in src/m365/spo/commands/file/file-remove.ts.
  • src/m365/spo/commands/web/web-alert-remove.ts — same pattern with WEB_RULE_REMOVE.
  • Corresponding spec files gained defines alias and defines correct alias tests, matching the style of file-remove.spec.ts.

Testing

  • npx tsc --noEmit passes on the full project.
  • Test runner (npm test) requires Node 24 via scripts/check-version.js; my local Node is 25, so I ran the typecheck phase alone and verified the new tests mirror the pattern in src/m365/spo/commands/file/file-remove.spec.ts. CI will exercise them on the supported Node.

Closes #7036

This contribution was developed with AI assistance (Codex).

Add 'spo web rule list' as alias for 'spo web alert list' and
'spo web rule remove' as alias for 'spo web alert remove'.

Closes pnp#7036
@Jwaegebaert
Copy link
Copy Markdown
Contributor

Hi @mvanhorn thanks for the PR.
Next time, can you please comment on an issue you want to work on so we can assign it to you?

@mvanhorn
Copy link
Copy Markdown
Contributor Author

Thanks @Jwaegebaert, noted - I'll claim issues before opening PRs going forward. Sorry for jumping the line.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces user-facing aliases for SharePoint Online web alert commands so users can use the newer “rule” terminology while continuing to support existing “alert” scripts.

Changes:

  • Added spo web rule list and spo web rule remove command constants.
  • Implemented alias() on spo web alert list/remove commands to expose the new “rule” aliases.
  • Added/updated tests to validate alias definitions and updated lazy-loading alias allowlist.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/m365/spo/commands/web/web-alert-remove.ts Adds alias() returning commands.WEB_RULE_REMOVE so spo web rule remove resolves to the existing remove implementation.
src/m365/spo/commands/web/web-alert-remove.spec.ts Adds tests asserting the alias exists and includes WEB_RULE_REMOVE.
src/m365/spo/commands/web/web-alert-list.ts Adds alias() returning commands.WEB_RULE_LIST so spo web rule list resolves to the existing list implementation.
src/m365/spo/commands/web/web-alert-list.spec.ts Adds tests asserting the alias exists and includes WEB_RULE_LIST.
src/m365/spo/commands.ts Introduces WEB_RULE_LIST and WEB_RULE_REMOVE command string constants.
src/index.spec.ts Adds the new alias command strings to the lazy-loading test’s alias allowlist.

Copy link
Copy Markdown
Member

@Adam-it Adam-it left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mvanhorn I think you missed the main goal of the related issue. The idea is to rename the entire command to spo web rule and add the current spo web alert name as alias. That way in near future the removal of the web alert commands will be easy and clean as we will just remove the alias.
Instead, your PR does not perform the rename but adds the web rule as an alias and also fails to add the ## Alias section in the documentation for those commands.

Unfortunately, this PR requires a rebuild from the very beginning. Please give this another shot before we proceed

@Adam-it Adam-it marked this pull request as draft May 3, 2026 22:04
Per @Adam-it's review on pnp#7221, inverts the alias direction:
- spo web rule list/remove are the canonical commands
- spo web alert list/remove remain available as aliases for
  backward compatibility, which makes the eventual removal of the
  alert names a single-line change.

Renames the four command files (web-alert-{list,remove}.{ts,spec.ts}
-> web-rule-{list,remove}.{ts,spec.ts}), updates the command name
constants in src/m365/spo/commands.ts, switches the alias() return
to the legacy WEB_ALERT_* constants, renames the two docs files and
adds the ## Alias section pointing at the legacy command, retargets
the docs sidebar entries, and updates the sample script + release
note to reference the canonical web-rule name.

Verification: clean build + lint + 35 focused specs pass. Full
npm test was blocked locally on the Node 24 version gate (this
shell is on Node 25) and could not fetch Node 24 from sandbox;
CI is the authority for the full matrix.
@mvanhorn
Copy link
Copy Markdown
Contributor Author

@Adam-it - rebuilt per your direction. Pushed c7c65db:

  • Renamed web-alert-{list,remove}.{ts,spec.ts} -> web-rule-{list,remove}.{ts,spec.ts} and the matching docs files. Class names + commands.WEB_RULE_* constants are canonical now.
  • alias() on each command returns [commands.WEB_ALERT_LIST] / [commands.WEB_ALERT_REMOVE] for backward compat, so removing the alert names later is a one-line drop.
  • Added the ## Alias section to both web-rule-list.mdx and web-rule-remove.mdx following the spo file file-remove.mdx template.
  • Retargeted the docs sidebar entries, the list-tenant-alert-usage sample script, and the release note line to the canonical web-rule name.

Build + lint + 35 focused specs pass locally; full npm test was blocked on the Node 24 version gate (my shell is on Node 25) so I'm leaning on CI for the full matrix.

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.

Add aliases for spo web alert commands

4 participants