@intranefr/superbackend 1.7.7 → 1.7.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.
Files changed (119) hide show
  1. package/.beads/.br_history/issues.20260314_212352_900045509.jsonl +0 -0
  2. package/.beads/.br_history/issues.20260314_212352_900045509.jsonl.meta.json +1 -0
  3. package/.beads/.br_history/issues.20260314_212353_087140743.jsonl +1 -0
  4. package/.beads/.br_history/issues.20260314_212353_087140743.jsonl.meta.json +1 -0
  5. package/.beads/.br_history/issues.20260314_212353_285881504.jsonl +2 -0
  6. package/.beads/.br_history/issues.20260314_212353_285881504.jsonl.meta.json +1 -0
  7. package/.beads/.br_history/issues.20260314_212353_473915419.jsonl +3 -0
  8. package/.beads/.br_history/issues.20260314_212353_473915419.jsonl.meta.json +1 -0
  9. package/.beads/.br_history/issues.20260314_212353_659476307.jsonl +4 -0
  10. package/.beads/.br_history/issues.20260314_212353_659476307.jsonl.meta.json +1 -0
  11. package/.beads/.br_history/issues.20260314_212353_869998925.jsonl +5 -0
  12. package/.beads/.br_history/issues.20260314_212353_869998925.jsonl.meta.json +1 -0
  13. package/.beads/.br_history/issues.20260314_212354_054785029.jsonl +6 -0
  14. package/.beads/.br_history/issues.20260314_212354_054785029.jsonl.meta.json +1 -0
  15. package/.beads/.br_history/issues.20260314_213336_175893691.jsonl +7 -0
  16. package/.beads/.br_history/issues.20260314_213336_175893691.jsonl.meta.json +1 -0
  17. package/.beads/.br_history/issues.20260314_213336_338509797.jsonl +7 -0
  18. package/.beads/.br_history/issues.20260314_213336_338509797.jsonl.meta.json +1 -0
  19. package/.beads/.br_history/issues.20260314_213336_515443192.jsonl +7 -0
  20. package/.beads/.br_history/issues.20260314_213336_515443192.jsonl.meta.json +1 -0
  21. package/.beads/.br_history/issues.20260314_213336_676417592.jsonl +7 -0
  22. package/.beads/.br_history/issues.20260314_213336_676417592.jsonl.meta.json +1 -0
  23. package/.beads/.br_history/issues.20260314_213336_839182422.jsonl +7 -0
  24. package/.beads/.br_history/issues.20260314_213336_839182422.jsonl.meta.json +1 -0
  25. package/.beads/.br_history/issues.20260314_213337_004349113.jsonl +7 -0
  26. package/.beads/.br_history/issues.20260314_213337_004349113.jsonl.meta.json +1 -0
  27. package/.beads/.br_history/issues.20260314_213337_179824080.jsonl +7 -0
  28. package/.beads/.br_history/issues.20260314_213337_179824080.jsonl.meta.json +1 -0
  29. package/.beads/.br_history/issues.20260314_213701_705075332.jsonl +7 -0
  30. package/.beads/.br_history/issues.20260314_213701_705075332.jsonl.meta.json +1 -0
  31. package/.beads/.br_history/issues.20260314_213706_783128702.jsonl +8 -0
  32. package/.beads/.br_history/issues.20260314_213706_783128702.jsonl.meta.json +1 -0
  33. package/.beads/config.yaml +4 -0
  34. package/.beads/issues.jsonl +8 -0
  35. package/.beads/metadata.json +4 -0
  36. package/.env.example +8 -0
  37. package/autochangelog/.env.example +36 -0
  38. package/autochangelog/README.md +412 -0
  39. package/autochangelog/config/database.js +27 -0
  40. package/autochangelog/package.json +47 -0
  41. package/autochangelog/public/landing.html +581 -0
  42. package/autochangelog/server.js +104 -0
  43. package/autochangelog/src/app.js +181 -0
  44. package/autochangelog/src/config/database.js +26 -0
  45. package/autochangelog/src/controllers/auth.js +488 -0
  46. package/autochangelog/src/controllers/changelog.js +682 -0
  47. package/autochangelog/src/controllers/project.js +580 -0
  48. package/autochangelog/src/controllers/repository.js +780 -0
  49. package/autochangelog/src/middleware/auth.js +386 -0
  50. package/autochangelog/src/models/Changelog.js +443 -0
  51. package/autochangelog/src/models/Project.js +226 -0
  52. package/autochangelog/src/models/Repository.js +366 -0
  53. package/autochangelog/src/models/User.js +223 -0
  54. package/autochangelog/src/routes/auth.routes.js +32 -0
  55. package/autochangelog/src/routes/changelog.routes.js +42 -0
  56. package/autochangelog/src/routes/github-auth.routes.js +102 -0
  57. package/autochangelog/src/routes/project.routes.js +50 -0
  58. package/autochangelog/src/routes/repository.routes.js +54 -0
  59. package/autochangelog/src/services/changelog.js +722 -0
  60. package/autochangelog/src/services/github.js +243 -0
  61. package/autochangelog/utils/logger.js +77 -0
  62. package/autochangelog/views/404.ejs +18 -0
  63. package/autochangelog/views/dashboard.ejs +596 -0
  64. package/autochangelog/views/index.ejs +231 -0
  65. package/autochangelog/views/layouts/main.ejs +44 -0
  66. package/autochangelog/views/login.ejs +104 -0
  67. package/autochangelog/views/partials/footer.ejs +20 -0
  68. package/autochangelog/views/partials/navbar.ejs +51 -0
  69. package/autochangelog/views/register.ejs +109 -0
  70. package/autochangelog-cli/README.md +266 -0
  71. package/autochangelog-cli/bin/autochangelog +120 -0
  72. package/autochangelog-cli/package.json +46 -0
  73. package/autochangelog-cli/src/cli/commands/auth.js +291 -0
  74. package/autochangelog-cli/src/cli/commands/changelog.js +619 -0
  75. package/autochangelog-cli/src/cli/commands/project.js +427 -0
  76. package/autochangelog-cli/src/cli/commands/repo.js +557 -0
  77. package/autochangelog-cli/src/cli/commands/stats.js +706 -0
  78. package/autochangelog-cli/src/cli/utils/config.js +277 -0
  79. package/autochangelog-cli/src/cli/utils/errors.js +307 -0
  80. package/autochangelog-cli/src/cli/utils/logger.js +75 -0
  81. package/autochangelog-cli/src/cli/utils/output.js +357 -0
  82. package/package.json +8 -3
  83. package/plugins/supercli/README.md +108 -0
  84. package/plugins/supercli/plugin.json +123 -0
  85. package/server.js +1 -1
  86. package/src/cli/api.js +380 -0
  87. package/src/cli/direct/agent-utils.js +61 -0
  88. package/src/cli/direct/cli-utils.js +112 -0
  89. package/src/cli/direct/data-seeding.js +307 -0
  90. package/src/cli/direct/db-admin.js +84 -0
  91. package/src/cli/direct/db-advanced.js +372 -0
  92. package/src/cli/direct/db-utils.js +558 -0
  93. package/src/cli/direct/help.js +195 -0
  94. package/src/cli/direct/migration.js +107 -0
  95. package/src/cli/direct/rbac-advanced.js +132 -0
  96. package/src/cli/direct/resources-additional.js +400 -0
  97. package/src/cli/direct/resources-cms-advanced.js +173 -0
  98. package/src/cli/direct/resources-cms.js +247 -0
  99. package/src/cli/direct/resources-core.js +253 -0
  100. package/src/cli/direct/resources-execution.js +367 -0
  101. package/src/cli/direct/resources-health.js +152 -0
  102. package/src/cli/direct/resources-integrations.js +182 -0
  103. package/src/cli/direct/resources-logs.js +204 -0
  104. package/src/cli/direct/resources-org-rbac.js +187 -0
  105. package/src/cli/direct/resources-system.js +236 -0
  106. package/src/cli/direct.js +556 -0
  107. package/src/controllers/admin.controller.js +4 -0
  108. package/src/controllers/auth.controller.js +148 -1
  109. package/src/controllers/waitingList.controller.js +130 -1
  110. package/src/models/RbacRole.js +1 -1
  111. package/src/models/User.js +39 -5
  112. package/src/routes/auth.routes.js +6 -0
  113. package/src/routes/waitingList.routes.js +12 -2
  114. package/src/routes/waitingListAdmin.routes.js +3 -0
  115. package/src/services/email.service.js +1 -0
  116. package/src/services/github.service.js +255 -0
  117. package/src/services/rateLimiter.service.js +29 -1
  118. package/src/services/waitingListJson.service.js +32 -3
  119. package/views/admin-waiting-list.ejs +386 -3
@@ -0,0 +1,102 @@
1
+ const express = require("express");
2
+ const router = express.Router();
3
+ const githubService = require("../services/github");
4
+ const User = require("../models/User"); // Will use SuperBackend's User model
5
+ const { generateToken } = require("../middleware/auth");
6
+ const logger = require("../../utils/logger");
7
+
8
+ // Redirect to GitHub OAuth
9
+ router.get("/github", (req, res) => {
10
+ try {
11
+ const authUrl = githubService.getAuthURL();
12
+ res.redirect(authUrl);
13
+ } catch (error) {
14
+ logger.error("GitHub OAuth redirect error:", error);
15
+ res
16
+ .status(500)
17
+ .json({ success: false, message: "Failed to initiate GitHub login" });
18
+ }
19
+ });
20
+
21
+ // GitHub OAuth callback
22
+ router.get("/github/callback", async (req, res) => {
23
+ try {
24
+ const { code, state } = req.query;
25
+
26
+ if (!code) {
27
+ return res
28
+ .status(400)
29
+ .json({ success: false, message: "Authorization code missing" });
30
+ }
31
+
32
+ // Exchange code for access token
33
+ const tokenResponse = await githubService.getAccessToken(code);
34
+ if (!tokenResponse.access_token) {
35
+ return res
36
+ .status(400)
37
+ .json({ success: false, message: "Failed to get access token" });
38
+ }
39
+
40
+ const accessToken = tokenResponse.access_token;
41
+
42
+ // Get user info from GitHub
43
+ const githubUser = await githubService.getUser(accessToken);
44
+
45
+ // Check if user exists with this GitHub ID
46
+ let user = await User.findOne({ githubId: githubUser.id });
47
+
48
+ if (!user) {
49
+ // Check if user exists with this email
50
+ user = await User.findOne({
51
+ email:
52
+ githubUser.email || `${githubUser.login}@users.noreply.github.com`,
53
+ });
54
+
55
+ if (user) {
56
+ // Link GitHub account to existing user
57
+ user.githubId = githubUser.id;
58
+ user.githubUsername = githubUser.login;
59
+ user.githubAccessToken = accessToken;
60
+ user.githubEmail = githubUser.email;
61
+ user.avatar = githubUser.avatar_url;
62
+ if (githubUser.name) user.name = githubUser.name;
63
+ await user.save();
64
+ } else {
65
+ // Create new user
66
+ user = new User({
67
+ email:
68
+ githubUser.email || `${githubUser.login}@users.noreply.github.com`,
69
+ name: githubUser.name || githubUser.login,
70
+ githubId: githubUser.id,
71
+ githubUsername: githubUser.login,
72
+ githubAccessToken: accessToken,
73
+ githubEmail: githubUser.email,
74
+ avatar: githubUser.avatar_url,
75
+ emailVerified: !!githubUser.email,
76
+ isActive: true,
77
+ });
78
+ await user.save();
79
+ }
80
+ } else {
81
+ // Update existing user's token and info
82
+ user.githubAccessToken = accessToken;
83
+ user.avatar = githubUser.avatar_url;
84
+ if (githubUser.name) user.name = githubUser.name;
85
+ await user.save();
86
+ }
87
+
88
+ // Generate JWT token
89
+ const token = generateToken(user._id);
90
+
91
+ // Redirect to dashboard with token in URL hash (frontend extracts it)
92
+ const redirectUrl = `${process.env.FRONTEND_URL || "http://localhost:3000"}/dashboard#token=${token}`;
93
+ res.redirect(redirectUrl);
94
+ } catch (error) {
95
+ logger.error("GitHub OAuth callback error:", error);
96
+ res
97
+ .status(500)
98
+ .json({ success: false, message: "GitHub authentication failed" });
99
+ }
100
+ });
101
+
102
+ module.exports = router;
@@ -0,0 +1,50 @@
1
+ const express = require("express");
2
+ const {
3
+ createProject,
4
+ getProjects,
5
+ getProject,
6
+ updateProject,
7
+ deleteProject,
8
+ archiveProject,
9
+ getProjectStatistics,
10
+ searchProjects,
11
+ getProjectRepositories,
12
+ getProjectChangelogs,
13
+ getUserStatistics,
14
+ } = require("../controllers/project");
15
+ const {
16
+ authenticate,
17
+ checkOwnership,
18
+ checkSubscription,
19
+ checkUsageLimits,
20
+ apiRateLimit,
21
+ } = require("../middleware/auth");
22
+
23
+ const router = express.Router();
24
+
25
+ // Protected routes - require authentication
26
+ router.use(authenticate);
27
+ router.use(apiRateLimit);
28
+
29
+ // Project statistics endpoint (user-level stats)
30
+ router.get("/stats", getUserStatistics); // Get aggregate stats for dashboard
31
+
32
+ // Project CRUD operations
33
+ router.post("/", checkUsageLimits, createProject);
34
+ router.get("/", getProjects);
35
+ router.get("/search", searchProjects);
36
+ router.get("/:id", getProject);
37
+ router.put("/:id", checkOwnership("Project"), updateProject);
38
+ router.delete("/:id", checkOwnership("Project"), deleteProject);
39
+ router.post("/:id/archive", checkOwnership("Project"), archiveProject);
40
+
41
+ // Project statistics and related data
42
+ router.get("/:id/statistics", checkOwnership("Project"), getProjectStatistics);
43
+ router.get(
44
+ "/:id/repositories",
45
+ checkOwnership("Project"),
46
+ getProjectRepositories,
47
+ );
48
+ router.get("/:id/changelogs", checkOwnership("Project"), getProjectChangelogs);
49
+
50
+ module.exports = router;
@@ -0,0 +1,54 @@
1
+ const express = require("express");
2
+ const {
3
+ createRepository,
4
+ getRepositories,
5
+ getRepository,
6
+ updateRepository,
7
+ deleteRepository,
8
+ syncRepository,
9
+ getAvailableMonths,
10
+ validateRepository,
11
+ getRepositoryStatistics,
12
+ getUserGithubRepositories,
13
+ connectGithubRepository,
14
+ } = require("../controllers/repository");
15
+ const {
16
+ authenticate,
17
+ checkOwnership,
18
+ checkSubscription,
19
+ checkUsageLimits,
20
+ apiRateLimit,
21
+ } = require("../middleware/auth");
22
+
23
+ const router = express.Router();
24
+
25
+ // Protected routes - require authentication
26
+ router.use(authenticate);
27
+ router.use(apiRateLimit);
28
+
29
+ // Repository CRUD operations
30
+ router.post("/", checkUsageLimits, createRepository);
31
+ router.get("/:projectId", getRepositories);
32
+ router.get("/detail/:id", getRepository);
33
+ router.put("/:id", checkOwnership("Repository"), updateRepository);
34
+ router.delete("/:id", checkOwnership("Repository"), deleteRepository);
35
+
36
+ // Repository management
37
+ router.post("/:id/sync", checkOwnership("Repository"), syncRepository);
38
+ router.get(
39
+ "/:id/available-months",
40
+ checkOwnership("Repository"),
41
+ getAvailableMonths,
42
+ );
43
+ router.get("/:id/validate", checkOwnership("Repository"), validateRepository);
44
+ router.get(
45
+ "/:id/statistics",
46
+ checkOwnership("Repository"),
47
+ getRepositoryStatistics,
48
+ );
49
+
50
+ // GitHub integration
51
+ router.get("/github/repos", getUserGithubRepositories);
52
+ router.post("/github/connect", connectGithubRepository);
53
+
54
+ module.exports = router;