mycontext-cli 2.0.27 → 2.0.28
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 +35 -369
- package/dist/agents/implementations/CodeGenSubAgent.d.ts.map +1 -1
- package/dist/agents/implementations/CodeGenSubAgent.js +67 -14
- package/dist/agents/implementations/CodeGenSubAgent.js.map +1 -1
- package/dist/agents/implementations/DesignPipelineAgent.d.ts +80 -0
- package/dist/agents/implementations/DesignPipelineAgent.d.ts.map +1 -0
- package/dist/agents/implementations/DesignPipelineAgent.js +1406 -0
- package/dist/agents/implementations/DesignPipelineAgent.js.map +1 -0
- package/dist/agents/implementations/FeatureAssemblyAgent.d.ts +67 -0
- package/dist/agents/implementations/FeatureAssemblyAgent.d.ts.map +1 -0
- package/dist/agents/implementations/FeatureAssemblyAgent.js +564 -0
- package/dist/agents/implementations/FeatureAssemblyAgent.js.map +1 -0
- package/dist/agents/implementations/PromptConstructorAgent.d.ts +10 -0
- package/dist/agents/implementations/PromptConstructorAgent.d.ts.map +1 -1
- package/dist/agents/implementations/PromptConstructorAgent.js +172 -12
- package/dist/agents/implementations/PromptConstructorAgent.js.map +1 -1
- package/dist/agents/implementations/RoleBasedGenerator.d.ts +52 -0
- package/dist/agents/implementations/RoleBasedGenerator.d.ts.map +1 -0
- package/dist/agents/implementations/RoleBasedGenerator.js +370 -0
- package/dist/agents/implementations/RoleBasedGenerator.js.map +1 -0
- package/dist/cli.js +65 -0
- package/dist/cli.js.map +1 -1
- package/dist/clients/ClaudeSDKClient.d.ts +48 -0
- package/dist/clients/ClaudeSDKClient.d.ts.map +1 -0
- package/dist/clients/ClaudeSDKClient.js +158 -0
- package/dist/clients/ClaudeSDKClient.js.map +1 -0
- package/dist/clients/MyContextAIClient.d.ts +73 -0
- package/dist/clients/MyContextAIClient.d.ts.map +1 -0
- package/dist/clients/MyContextAIClient.js +280 -0
- package/dist/clients/MyContextAIClient.js.map +1 -0
- package/dist/clients/ProviderChain.d.ts +87 -0
- package/dist/clients/ProviderChain.d.ts.map +1 -0
- package/dist/clients/ProviderChain.js +246 -0
- package/dist/clients/ProviderChain.js.map +1 -0
- package/dist/clients/XAIClient.d.ts +48 -0
- package/dist/clients/XAIClient.d.ts.map +1 -0
- package/dist/clients/XAIClient.js +152 -0
- package/dist/clients/XAIClient.js.map +1 -0
- package/dist/commands/assemble-features.d.ts +40 -0
- package/dist/commands/assemble-features.d.ts.map +1 -0
- package/dist/commands/assemble-features.js +383 -0
- package/dist/commands/assemble-features.js.map +1 -0
- package/dist/commands/clone-starter.d.ts +32 -0
- package/dist/commands/clone-starter.d.ts.map +1 -0
- package/dist/commands/clone-starter.js +218 -0
- package/dist/commands/clone-starter.js.map +1 -0
- package/dist/commands/design-analyze.d.ts +46 -0
- package/dist/commands/design-analyze.d.ts.map +1 -0
- package/dist/commands/design-analyze.js +232 -0
- package/dist/commands/design-analyze.js.map +1 -0
- package/dist/commands/generate-components.d.ts +1 -0
- package/dist/commands/generate-components.d.ts.map +1 -1
- package/dist/commands/generate-components.js +42 -9
- package/dist/commands/generate-components.js.map +1 -1
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +34 -1
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/setup-complete.d.ts.map +1 -1
- package/dist/commands/setup-complete.js +38 -2
- package/dist/commands/setup-complete.js.map +1 -1
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +86 -7
- package/dist/commands/workflow.js.map +1 -1
- package/dist/config/intent-dictionary.json +3700 -0
- package/dist/package.json +3 -1
- package/dist/services/IntentEnricher.d.ts +61 -0
- package/dist/services/IntentEnricher.d.ts.map +1 -0
- package/dist/services/IntentEnricher.js +318 -0
- package/dist/services/IntentEnricher.js.map +1 -0
- package/dist/services/IntentValidator.d.ts +114 -0
- package/dist/services/IntentValidator.d.ts.map +1 -0
- package/dist/services/IntentValidator.js +680 -0
- package/dist/services/IntentValidator.js.map +1 -0
- package/dist/types/design-pipeline.d.ts +300 -0
- package/dist/types/design-pipeline.d.ts.map +1 -0
- package/dist/types/design-pipeline.js +9 -0
- package/dist/types/design-pipeline.js.map +1 -0
- package/dist/types/feature-bundle.d.ts +239 -0
- package/dist/types/feature-bundle.d.ts.map +1 -0
- package/dist/types/feature-bundle.js +9 -0
- package/dist/types/feature-bundle.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/intent-dictionary.d.ts +525 -0
- package/dist/types/intent-dictionary.d.ts.map +1 -0
- package/dist/types/intent-dictionary.js +11 -0
- package/dist/types/intent-dictionary.js.map +1 -0
- package/dist/types/role-permissions.d.ts +167 -0
- package/dist/types/role-permissions.d.ts.map +1 -0
- package/dist/types/role-permissions.js +9 -0
- package/dist/types/role-permissions.js.map +1 -0
- package/dist/utils/contextEnricher.d.ts +41 -0
- package/dist/utils/contextEnricher.d.ts.map +1 -0
- package/dist/utils/contextEnricher.js +327 -0
- package/dist/utils/contextEnricher.js.map +1 -0
- package/dist/utils/designFallbacks.d.ts +48 -0
- package/dist/utils/designFallbacks.d.ts.map +1 -0
- package/dist/utils/designFallbacks.js +885 -0
- package/dist/utils/designFallbacks.js.map +1 -0
- package/dist/utils/designManifestManager.d.ts +89 -0
- package/dist/utils/designManifestManager.d.ts.map +1 -0
- package/dist/utils/designManifestManager.js +533 -0
- package/dist/utils/designManifestManager.js.map +1 -0
- package/dist/utils/designPipelineStateManager.d.ts +63 -0
- package/dist/utils/designPipelineStateManager.d.ts.map +1 -0
- package/dist/utils/designPipelineStateManager.js +174 -0
- package/dist/utils/designPipelineStateManager.js.map +1 -0
- package/dist/utils/envExampleGenerator.d.ts.map +1 -1
- package/dist/utils/envExampleGenerator.js +35 -171
- package/dist/utils/envExampleGenerator.js.map +1 -1
- package/dist/utils/featureBundleManager.d.ts +90 -0
- package/dist/utils/featureBundleManager.d.ts.map +1 -0
- package/dist/utils/featureBundleManager.js +340 -0
- package/dist/utils/featureBundleManager.js.map +1 -0
- package/dist/utils/githubCloner.d.ts +93 -0
- package/dist/utils/githubCloner.d.ts.map +1 -0
- package/dist/utils/githubCloner.js +305 -0
- package/dist/utils/githubCloner.js.map +1 -0
- package/dist/utils/rolePermissionMapper.d.ts +89 -0
- package/dist/utils/rolePermissionMapper.d.ts.map +1 -0
- package/dist/utils/rolePermissionMapper.js +337 -0
- package/dist/utils/rolePermissionMapper.js.map +1 -0
- package/dist/utils/unifiedDesignContextLoader.d.ts +76 -0
- package/dist/utils/unifiedDesignContextLoader.d.ts.map +1 -0
- package/dist/utils/unifiedDesignContextLoader.js +344 -0
- package/dist/utils/unifiedDesignContextLoader.js.map +1 -0
- package/package.json +3 -1
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Role Permission Mapper
|
|
4
|
+
*
|
|
5
|
+
* Maps features, components, actions, and routes to role-based permissions
|
|
6
|
+
* for the Feature Assembly system.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.RolePermissionMapper = void 0;
|
|
10
|
+
class RolePermissionMapper {
|
|
11
|
+
constructor(roleHierarchy) {
|
|
12
|
+
this.roleHierarchy = roleHierarchy;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Map feature to role-based configuration
|
|
16
|
+
*/
|
|
17
|
+
mapFeatureToRoles(feature) {
|
|
18
|
+
const roleFeatures = new Map();
|
|
19
|
+
for (const role of this.roleHierarchy.roles) {
|
|
20
|
+
const roleFeature = this.createRoleFeature(feature, role.name);
|
|
21
|
+
roleFeatures.set(role.name, roleFeature);
|
|
22
|
+
}
|
|
23
|
+
return roleFeatures;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Map component to permissions for a specific role
|
|
27
|
+
*/
|
|
28
|
+
mapComponentToPermissions(component, role) {
|
|
29
|
+
const roleDefinition = this.getRoleDefinition(role);
|
|
30
|
+
if (!roleDefinition)
|
|
31
|
+
return [];
|
|
32
|
+
const permissions = [];
|
|
33
|
+
const componentName = component.toLowerCase();
|
|
34
|
+
// Map component to resource type
|
|
35
|
+
const resourceType = this.mapComponentToResource(componentName);
|
|
36
|
+
// Get permissions for this resource type and role
|
|
37
|
+
const rolePermissions = roleDefinition.permissions.filter((p) => p.resource === resourceType || p.resource === "all");
|
|
38
|
+
// Convert to component-specific permissions
|
|
39
|
+
for (const rolePermission of rolePermissions) {
|
|
40
|
+
permissions.push({
|
|
41
|
+
id: `${component}-${role}-${rolePermission.action}`,
|
|
42
|
+
resource: resourceType,
|
|
43
|
+
action: rolePermission.action,
|
|
44
|
+
conditions: rolePermission.conditions,
|
|
45
|
+
description: `${rolePermission.action} access to ${component} component`,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return permissions;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Map action to permissions for a specific role
|
|
52
|
+
*/
|
|
53
|
+
mapActionToPermissions(action, role) {
|
|
54
|
+
const roleDefinition = this.getRoleDefinition(role);
|
|
55
|
+
if (!roleDefinition)
|
|
56
|
+
return [];
|
|
57
|
+
const permissions = [];
|
|
58
|
+
const actionName = action.toLowerCase();
|
|
59
|
+
// Map action to resource type
|
|
60
|
+
const resourceType = this.mapActionToResource(actionName);
|
|
61
|
+
// Get permissions for this resource type and role
|
|
62
|
+
const rolePermissions = roleDefinition.permissions.filter((p) => p.resource === resourceType || p.resource === "all");
|
|
63
|
+
// Convert to action-specific permissions
|
|
64
|
+
for (const rolePermission of rolePermissions) {
|
|
65
|
+
permissions.push({
|
|
66
|
+
id: `${action}-${role}-${rolePermission.action}`,
|
|
67
|
+
resource: resourceType,
|
|
68
|
+
action: rolePermission.action,
|
|
69
|
+
conditions: rolePermission.conditions,
|
|
70
|
+
description: `${rolePermission.action} access to ${action} action`,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return permissions;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Map route to permissions for a specific role
|
|
77
|
+
*/
|
|
78
|
+
mapRouteToPermissions(route, role) {
|
|
79
|
+
const roleDefinition = this.getRoleDefinition(role);
|
|
80
|
+
if (!roleDefinition)
|
|
81
|
+
return [];
|
|
82
|
+
const permissions = [];
|
|
83
|
+
const routePath = route.toLowerCase();
|
|
84
|
+
// Map route to resource type
|
|
85
|
+
const resourceType = this.mapRouteToResource(routePath);
|
|
86
|
+
// Get permissions for this resource type and role
|
|
87
|
+
const rolePermissions = roleDefinition.permissions.filter((p) => p.resource === resourceType || p.resource === "all");
|
|
88
|
+
// Convert to route-specific permissions
|
|
89
|
+
for (const rolePermission of rolePermissions) {
|
|
90
|
+
permissions.push({
|
|
91
|
+
id: `${route}-${role}-${rolePermission.action}`,
|
|
92
|
+
resource: resourceType,
|
|
93
|
+
action: rolePermission.action,
|
|
94
|
+
conditions: rolePermission.conditions,
|
|
95
|
+
description: `${rolePermission.action} access to ${route} route`,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
return permissions;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Generate role-based code for a feature
|
|
102
|
+
*/
|
|
103
|
+
generateRoleBasedCode(feature, role, config) {
|
|
104
|
+
const roleDefinition = this.getRoleDefinition(role);
|
|
105
|
+
if (!roleDefinition)
|
|
106
|
+
return "";
|
|
107
|
+
const code = `
|
|
108
|
+
// Generated code for ${feature.name} - ${role} role
|
|
109
|
+
// Generated at: ${new Date().toISOString()}
|
|
110
|
+
|
|
111
|
+
import { Permission } from '../types/role-permissions';
|
|
112
|
+
|
|
113
|
+
export const ${feature.name}${role.charAt(0).toUpperCase() + role.slice(1)}Config = {
|
|
114
|
+
role: '${role}',
|
|
115
|
+
permissions: [
|
|
116
|
+
${this.generatePermissionCode(feature.permissions, role)}
|
|
117
|
+
],
|
|
118
|
+
components: [
|
|
119
|
+
${feature.components.map((comp) => ` '${comp}'`).join(",\n")}
|
|
120
|
+
],
|
|
121
|
+
actions: [
|
|
122
|
+
${feature.actions.map((action) => ` '${action.name}'`).join(",\n")}
|
|
123
|
+
],
|
|
124
|
+
routes: [
|
|
125
|
+
${feature.routes.map((route) => ` '${route.path}'`).join(",\n")}
|
|
126
|
+
]
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export const ${feature.name}${role.charAt(0).toUpperCase() + role.slice(1)}Permissions: Permission[] = [
|
|
130
|
+
${this.generatePermissionCode(feature.permissions, role)}
|
|
131
|
+
];
|
|
132
|
+
`;
|
|
133
|
+
return code;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Check if a role has permission for a specific action
|
|
137
|
+
*/
|
|
138
|
+
hasPermission(role, resource, action) {
|
|
139
|
+
const roleDefinition = this.getRoleDefinition(role);
|
|
140
|
+
if (!roleDefinition)
|
|
141
|
+
return false;
|
|
142
|
+
return roleDefinition.permissions.some((p) => (p.resource === resource || p.resource === "all") && p.action === action);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Get all permissions for a role
|
|
146
|
+
*/
|
|
147
|
+
getRolePermissions(role) {
|
|
148
|
+
const roleDefinition = this.getRoleDefinition(role);
|
|
149
|
+
if (!roleDefinition)
|
|
150
|
+
return [];
|
|
151
|
+
return roleDefinition.permissions;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Get inherited permissions for a role
|
|
155
|
+
*/
|
|
156
|
+
getInheritedPermissions(role) {
|
|
157
|
+
const roleDefinition = this.getRoleDefinition(role);
|
|
158
|
+
if (!roleDefinition || !roleDefinition.inherits)
|
|
159
|
+
return [];
|
|
160
|
+
const inheritedPermissions = [];
|
|
161
|
+
for (const parentRole of roleDefinition.inherits) {
|
|
162
|
+
const parentPermissions = this.getRolePermissions(parentRole);
|
|
163
|
+
inheritedPermissions.push(...parentPermissions);
|
|
164
|
+
}
|
|
165
|
+
return inheritedPermissions;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Create a role-specific feature from a base feature
|
|
169
|
+
*/
|
|
170
|
+
createRoleFeature(baseFeature, role) {
|
|
171
|
+
const roleDefinition = this.getRoleDefinition(role);
|
|
172
|
+
if (!roleDefinition)
|
|
173
|
+
return baseFeature;
|
|
174
|
+
// Create a copy of the base feature
|
|
175
|
+
const roleFeature = JSON.parse(JSON.stringify(baseFeature));
|
|
176
|
+
// Update role
|
|
177
|
+
roleFeature.role = role;
|
|
178
|
+
// Filter components based on role permissions
|
|
179
|
+
roleFeature.components = roleFeature.components.filter((component) => this.hasComponentPermission(component, role));
|
|
180
|
+
// Filter actions based on role permissions
|
|
181
|
+
roleFeature.actions = roleFeature.actions.filter((action) => this.hasActionPermission(action.name, role));
|
|
182
|
+
// Filter hooks based on role permissions
|
|
183
|
+
roleFeature.hooks = roleFeature.hooks.filter((hook) => this.hasHookPermission(hook.name, role));
|
|
184
|
+
// Filter routes based on role permissions
|
|
185
|
+
roleFeature.routes = roleFeature.routes.filter((route) => this.hasRoutePermission(route.path, role));
|
|
186
|
+
// Update permissions to match role
|
|
187
|
+
roleFeature.permissions = roleFeature.permissions.filter((permission) => this.hasPermission(role, permission.resource, permission.action));
|
|
188
|
+
// Add role-specific restrictions
|
|
189
|
+
roleFeature.permissions = this.applyRoleRestrictions(roleFeature.permissions, roleDefinition);
|
|
190
|
+
return roleFeature;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Map component name to resource type
|
|
194
|
+
*/
|
|
195
|
+
mapComponentToResource(component) {
|
|
196
|
+
if (component.includes("admin") || component.includes("manage"))
|
|
197
|
+
return "admin";
|
|
198
|
+
if (component.includes("user") || component.includes("profile"))
|
|
199
|
+
return "users";
|
|
200
|
+
if (component.includes("post") || component.includes("content"))
|
|
201
|
+
return "posts";
|
|
202
|
+
if (component.includes("comment"))
|
|
203
|
+
return "comments";
|
|
204
|
+
if (component.includes("setting"))
|
|
205
|
+
return "settings";
|
|
206
|
+
if (component.includes("analytics") || component.includes("dashboard"))
|
|
207
|
+
return "analytics";
|
|
208
|
+
if (component.includes("file"))
|
|
209
|
+
return "files";
|
|
210
|
+
if (component.includes("notification"))
|
|
211
|
+
return "notifications";
|
|
212
|
+
if (component.includes("report"))
|
|
213
|
+
return "reports";
|
|
214
|
+
if (component.includes("audit"))
|
|
215
|
+
return "audit-logs";
|
|
216
|
+
return "public";
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Map action name to resource type
|
|
220
|
+
*/
|
|
221
|
+
mapActionToResource(action) {
|
|
222
|
+
if (action.includes("user"))
|
|
223
|
+
return "users";
|
|
224
|
+
if (action.includes("post"))
|
|
225
|
+
return "posts";
|
|
226
|
+
if (action.includes("comment"))
|
|
227
|
+
return "comments";
|
|
228
|
+
if (action.includes("setting"))
|
|
229
|
+
return "settings";
|
|
230
|
+
if (action.includes("analytics"))
|
|
231
|
+
return "analytics";
|
|
232
|
+
if (action.includes("file"))
|
|
233
|
+
return "files";
|
|
234
|
+
if (action.includes("notification"))
|
|
235
|
+
return "notifications";
|
|
236
|
+
if (action.includes("report"))
|
|
237
|
+
return "reports";
|
|
238
|
+
if (action.includes("audit"))
|
|
239
|
+
return "audit-logs";
|
|
240
|
+
return "public";
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Map route path to resource type
|
|
244
|
+
*/
|
|
245
|
+
mapRouteToResource(route) {
|
|
246
|
+
if (route.includes("/users"))
|
|
247
|
+
return "users";
|
|
248
|
+
if (route.includes("/posts"))
|
|
249
|
+
return "posts";
|
|
250
|
+
if (route.includes("/comments"))
|
|
251
|
+
return "comments";
|
|
252
|
+
if (route.includes("/settings"))
|
|
253
|
+
return "settings";
|
|
254
|
+
if (route.includes("/analytics"))
|
|
255
|
+
return "analytics";
|
|
256
|
+
if (route.includes("/files"))
|
|
257
|
+
return "files";
|
|
258
|
+
if (route.includes("/notifications"))
|
|
259
|
+
return "notifications";
|
|
260
|
+
if (route.includes("/reports"))
|
|
261
|
+
return "reports";
|
|
262
|
+
if (route.includes("/audit"))
|
|
263
|
+
return "audit-logs";
|
|
264
|
+
return "public";
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Check if a role has permission for a component
|
|
268
|
+
*/
|
|
269
|
+
hasComponentPermission(component, role) {
|
|
270
|
+
const resourceType = this.mapComponentToResource(component.toLowerCase());
|
|
271
|
+
return this.hasPermission(role, resourceType, "read");
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Check if a role has permission for an action
|
|
275
|
+
*/
|
|
276
|
+
hasActionPermission(action, role) {
|
|
277
|
+
const resourceType = this.mapActionToResource(action.toLowerCase());
|
|
278
|
+
return (this.hasPermission(role, resourceType, "create") ||
|
|
279
|
+
this.hasPermission(role, resourceType, "update") ||
|
|
280
|
+
this.hasPermission(role, resourceType, "delete"));
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Check if a role has permission for a hook
|
|
284
|
+
*/
|
|
285
|
+
hasHookPermission(hook, role) {
|
|
286
|
+
const resourceType = this.mapActionToResource(hook.toLowerCase());
|
|
287
|
+
return this.hasPermission(role, resourceType, "read");
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Check if a role has permission for a route
|
|
291
|
+
*/
|
|
292
|
+
hasRoutePermission(route, role) {
|
|
293
|
+
const resourceType = this.mapRouteToResource(route.toLowerCase());
|
|
294
|
+
return (this.hasPermission(role, resourceType, "read") ||
|
|
295
|
+
this.hasPermission(role, resourceType, "create") ||
|
|
296
|
+
this.hasPermission(role, resourceType, "update") ||
|
|
297
|
+
this.hasPermission(role, resourceType, "delete"));
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Apply role-specific restrictions to permissions
|
|
301
|
+
*/
|
|
302
|
+
applyRoleRestrictions(permissions, roleDefinition) {
|
|
303
|
+
return permissions.map((permission) => {
|
|
304
|
+
const rolePermission = roleDefinition.permissions.find((p) => p.resource === permission.resource && p.action === permission.action);
|
|
305
|
+
if (rolePermission) {
|
|
306
|
+
return {
|
|
307
|
+
...permission,
|
|
308
|
+
conditions: rolePermission.conditions || permission.conditions,
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
return permission;
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Generate permission code for a role
|
|
316
|
+
*/
|
|
317
|
+
generatePermissionCode(permissions, role) {
|
|
318
|
+
return permissions
|
|
319
|
+
.filter((p) => this.hasPermission(role, p.resource, p.action))
|
|
320
|
+
.map((permission) => ` {
|
|
321
|
+
id: '${permission.id}',
|
|
322
|
+
resource: '${permission.resource}',
|
|
323
|
+
action: '${permission.action}',
|
|
324
|
+
conditions: ${JSON.stringify(permission.conditions || [])},
|
|
325
|
+
description: '${permission.description}'
|
|
326
|
+
}`)
|
|
327
|
+
.join(",\n");
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Get role definition by name
|
|
331
|
+
*/
|
|
332
|
+
getRoleDefinition(role) {
|
|
333
|
+
return this.roleHierarchy.roles.find((r) => r.name === role);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
exports.RolePermissionMapper = RolePermissionMapper;
|
|
337
|
+
//# sourceMappingURL=rolePermissionMapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rolePermissionMapper.js","sourceRoot":"","sources":["../../src/utils/rolePermissionMapper.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAUH,MAAa,oBAAoB;IAG/B,YAAY,aAA4B;QACtC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,iBAAiB,CAAC,OAAsB;QACtC,MAAM,YAAY,GAAG,IAAI,GAAG,EAAuB,CAAC;QAEpD,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;YAC5C,MAAM,WAAW,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,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AAE,EAAE,CAAC;aACX,UAAU,CAAC,EAAE;mBACP,UAAU,CAAC,QAAQ;iBACrB,UAAU,CAAC,MAAM;oBACd,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,UAAU,IAAI,EAAE,CAAC;sBACzC,UAAU,CAAC,WAAW;MACtC,CACC;aACA,IAAI,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAED;;OAEG;IACK,iBAAiB,CAAC,IAAU;QAClC,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IAC/D,CAAC;CACF;AAhZD,oDAgZC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { ContextEnricher } from "./contextEnricher";
|
|
2
|
+
import { EnrichedContext } from "../types/design-pipeline";
|
|
3
|
+
/**
|
|
4
|
+
* Unified Design Context Loader
|
|
5
|
+
*
|
|
6
|
+
* Treats ALL context files (PRD + Types + Brand + Component List + Architecture)
|
|
7
|
+
* as a unified design system foundation for component generation.
|
|
8
|
+
*
|
|
9
|
+
* This is the key insight from V0: context files ARE the design system.
|
|
10
|
+
*/
|
|
11
|
+
export declare class UnifiedDesignContextLoader {
|
|
12
|
+
private manifestManager;
|
|
13
|
+
private contextEnricher;
|
|
14
|
+
private designPipeline;
|
|
15
|
+
private stateManager;
|
|
16
|
+
private projectPath;
|
|
17
|
+
constructor(projectPath?: string);
|
|
18
|
+
getContextEnricher(): ContextEnricher;
|
|
19
|
+
/**
|
|
20
|
+
* Load and unify ALL context files as design system foundation
|
|
21
|
+
*/
|
|
22
|
+
loadUnifiedDesignContext(resumeFromState?: boolean): Promise<{
|
|
23
|
+
enrichedContext: EnrichedContext;
|
|
24
|
+
hasDesignManifest: boolean;
|
|
25
|
+
shouldGenerateManifest: boolean;
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* Load all context files as a unified design foundation
|
|
29
|
+
*/
|
|
30
|
+
private loadAllContextFiles;
|
|
31
|
+
/**
|
|
32
|
+
* Load brand context (CSS + Markdown combined)
|
|
33
|
+
*/
|
|
34
|
+
private loadBrandContext;
|
|
35
|
+
/**
|
|
36
|
+
* Load a single context file from multiple candidates
|
|
37
|
+
*/
|
|
38
|
+
private loadContextFile;
|
|
39
|
+
/**
|
|
40
|
+
* Get context summary for display
|
|
41
|
+
*/
|
|
42
|
+
getContextSummary(): Promise<string>;
|
|
43
|
+
/**
|
|
44
|
+
* Check if all required context files exist
|
|
45
|
+
*/
|
|
46
|
+
validateContextFiles(): Promise<{
|
|
47
|
+
valid: boolean;
|
|
48
|
+
missing: string[];
|
|
49
|
+
warnings: string[];
|
|
50
|
+
}>;
|
|
51
|
+
/**
|
|
52
|
+
* Get design manifest summary
|
|
53
|
+
*/
|
|
54
|
+
getDesignManifestSummary(): Promise<string>;
|
|
55
|
+
/**
|
|
56
|
+
* Force regenerate design manifest
|
|
57
|
+
*/
|
|
58
|
+
regenerateDesignManifest(): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Check if there's a resumable state
|
|
61
|
+
*/
|
|
62
|
+
canResume(): Promise<boolean>;
|
|
63
|
+
/**
|
|
64
|
+
* Load existing pipeline state
|
|
65
|
+
*/
|
|
66
|
+
loadState(): Promise<import("./designPipelineStateManager").DesignPipelineState | null>;
|
|
67
|
+
/**
|
|
68
|
+
* Check if state is stale
|
|
69
|
+
*/
|
|
70
|
+
isStateStale(): Promise<boolean>;
|
|
71
|
+
/**
|
|
72
|
+
* Get state summary
|
|
73
|
+
*/
|
|
74
|
+
getStateSummary(): Promise<string>;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=unifiedDesignContextLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unifiedDesignContextLoader.d.ts","sourceRoot":"","sources":["../../src/utils/unifiedDesignContextLoader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,E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