@checkstack/command-frontend 0.0.5 → 0.1.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,82 @@
1
1
  # @checkstack/command-frontend
2
2
 
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 9faec1f: # Unified AccessRule Terminology Refactoring
8
+
9
+ This release completes a comprehensive terminology refactoring from "permission" to "accessRule" across the entire codebase, establishing a consistent and modern access control vocabulary.
10
+
11
+ ## Changes
12
+
13
+ ### Core Infrastructure (`@checkstack/common`)
14
+
15
+ - Introduced `AccessRule` interface as the primary access control type
16
+ - Added `accessPair()` helper for creating read/manage access rule pairs
17
+ - Added `access()` builder for individual access rules
18
+ - Replaced `Permission` type with `AccessRule` throughout
19
+
20
+ ### API Changes
21
+
22
+ - `env.registerPermissions()` → `env.registerAccessRules()`
23
+ - `meta.permissions` → `meta.access` in RPC contracts
24
+ - `usePermission()` → `useAccess()` in frontend hooks
25
+ - Route `permission:` field → `accessRule:` field
26
+
27
+ ### UI Changes
28
+
29
+ - "Roles & Permissions" tab → "Roles & Access Rules"
30
+ - "You don't have permission..." → "You don't have access..."
31
+ - All permission-related UI text updated
32
+
33
+ ### Documentation & Templates
34
+
35
+ - Updated 18 documentation files with AccessRule terminology
36
+ - Updated 7 scaffolding templates with `accessPair()` pattern
37
+ - All code examples use new AccessRule API
38
+
39
+ ## Migration Guide
40
+
41
+ ### Backend Plugins
42
+
43
+ ```diff
44
+ - import { permissionList } from "./permissions";
45
+ - env.registerPermissions(permissionList);
46
+ + import { accessRules } from "./access";
47
+ + env.registerAccessRules(accessRules);
48
+ ```
49
+
50
+ ### RPC Contracts
51
+
52
+ ```diff
53
+ - .meta({ userType: "user", permissions: [permissions.read.id] })
54
+ + .meta({ userType: "user", access: [access.read] })
55
+ ```
56
+
57
+ ### Frontend Hooks
58
+
59
+ ```diff
60
+ - const canRead = accessApi.usePermission(permissions.read.id);
61
+ + const canRead = accessApi.useAccess(access.read);
62
+ ```
63
+
64
+ ### Routes
65
+
66
+ ```diff
67
+ - permission: permissions.entityRead.id,
68
+ + accessRule: access.read,
69
+ ```
70
+
71
+ ### Patch Changes
72
+
73
+ - Updated dependencies [9faec1f]
74
+ - Updated dependencies [f533141]
75
+ - @checkstack/command-common@0.1.0
76
+ - @checkstack/common@0.2.0
77
+ - @checkstack/frontend-api@0.1.0
78
+ - @checkstack/ui@0.2.0
79
+
3
80
  ## 0.0.5
4
81
 
5
82
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/command-frontend",
3
- "version": "0.0.5",
3
+ "version": "0.1.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
package/src/index.tsx CHANGED
@@ -118,16 +118,16 @@ export function formatShortcut(shortcut: string, isMac: boolean): string {
118
118
  *
119
119
  * @param commands - Array of commands with shortcuts
120
120
  * @param navigate - Navigation function to call when a command is triggered
121
- * @param userPermissions - Array of permission IDs the user has
121
+ * @param userAccessRules - Array of access rule IDs the user has
122
122
  */
123
123
  export function useGlobalShortcuts(
124
124
  commands: SearchResult[],
125
125
  navigate: (route: string) => void,
126
- userPermissions: string[]
126
+ userAccessRules: string[]
127
127
  ): void {
128
128
  useEffect(() => {
129
- // Check if user has wildcard permission (admin)
130
- const hasWildcard = userPermissions.includes("*");
129
+ // Check if user has wildcard access rule (admin)
130
+ const hasWildcard = userAccessRules.includes("*");
131
131
 
132
132
  const handleKeyDown = (event: KeyboardEvent) => {
133
133
  // Don't trigger in input fields
@@ -144,12 +144,12 @@ export function useGlobalShortcuts(
144
144
  for (const command of commands) {
145
145
  if (!command.shortcuts || !command.route) continue;
146
146
 
147
- // Check permissions (skip if user has wildcard)
148
- if (!hasWildcard && command.requiredPermissions?.length) {
149
- const hasPermission = command.requiredPermissions.every((perm) =>
150
- userPermissions.includes(perm)
147
+ // Check access rules (skip if user has wildcard)
148
+ if (!hasWildcard && command.requiredAccessRules?.length) {
149
+ const hasAccess = command.requiredAccessRules.every((rule) =>
150
+ userAccessRules.includes(rule)
151
151
  );
152
- if (!hasPermission) continue;
152
+ if (!hasAccess) continue;
153
153
  }
154
154
 
155
155
  for (const shortcut of command.shortcuts) {
@@ -165,7 +165,7 @@ export function useGlobalShortcuts(
165
165
 
166
166
  globalThis.addEventListener("keydown", handleKeyDown);
167
167
  return () => globalThis.removeEventListener("keydown", handleKeyDown);
168
- }, [commands, navigate, userPermissions]);
168
+ }, [commands, navigate, userAccessRules]);
169
169
  }
170
170
 
171
171
  /**
@@ -359,7 +359,7 @@ export function GlobalShortcuts(): React.ReactNode {
359
359
  globalThis.location.href = route;
360
360
  }, []);
361
361
 
362
- // For now, pass "*" as permission since the backend already filters by permission
362
+ // For now, pass "*" as access rule since the backend already filters
363
363
  // The commands returned from getCommands are already filtered
364
364
  useGlobalShortcuts(commands, navigate, ["*"]);
365
365