hale-commenting-system 2.2.0 → 2.2.2
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/.claude/settings.local.json +7 -0
- package/.editorconfig +17 -0
- package/.eslintrc.js +75 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +23 -0
- package/.github/workflows/ci.yaml +51 -0
- package/.prettierignore +1 -0
- package/.prettierrc +4 -0
- package/GITHUB_OAUTH_ENV_TEMPLATE.md +53 -0
- package/LICENSE +21 -0
- package/README.md +92 -21
- package/package.json +74 -50
- package/scripts/README.md +42 -0
- package/scripts/integrate.js +472 -0
- package/src/app/AppLayout/AppLayout.tsx +248 -0
- package/src/app/Comments/Comments.tsx +273 -0
- package/src/app/Dashboard/Dashboard.tsx +10 -0
- package/src/app/NotFound/NotFound.tsx +35 -0
- package/src/app/Settings/General/GeneralSettings.tsx +16 -0
- package/src/app/Settings/Profile/ProfileSettings.tsx +18 -0
- package/src/app/Support/Support.tsx +50 -0
- package/src/app/__snapshots__/app.test.tsx.snap +524 -0
- package/src/app/app.css +11 -0
- package/src/app/app.test.tsx +55 -0
- package/src/app/bgimages/Patternfly-Logo.svg +28 -0
- package/src/app/commenting-system/components/CommentOverlay.tsx +93 -0
- package/src/app/commenting-system/components/CommentPanel.tsx +534 -0
- package/src/app/commenting-system/components/CommentPin.tsx +60 -0
- package/src/app/commenting-system/components/DetailsTab.tsx +516 -0
- package/src/app/commenting-system/components/FloatingWidget.tsx +130 -0
- package/src/app/commenting-system/components/JiraTab.tsx +696 -0
- package/src/app/commenting-system/contexts/CommentContext.tsx +1033 -0
- package/src/app/commenting-system/contexts/GitHubAuthContext.tsx +84 -0
- package/{dist/index.d.ts → src/app/commenting-system/index.ts} +5 -4
- package/src/app/commenting-system/services/githubAdapter.ts +359 -0
- package/src/app/commenting-system/types/index.ts +27 -0
- package/src/app/commenting-system/utils/version.ts +19 -0
- package/src/app/index.tsx +22 -0
- package/src/app/routes.tsx +81 -0
- package/src/app/utils/useDocumentTitle.ts +13 -0
- package/src/favicon.png +0 -0
- package/src/index.html +18 -0
- package/src/index.tsx +25 -0
- package/src/test/setup.ts +33 -0
- package/src/typings.d.ts +12 -0
- package/stylePaths.js +14 -0
- package/tsconfig.json +34 -0
- package/vitest.config.ts +19 -0
- package/webpack.common.js +139 -0
- package/webpack.dev.js +318 -0
- package/webpack.prod.js +38 -0
- package/bin/detect.d.ts +0 -10
- package/bin/detect.js +0 -134
- package/bin/generators.d.ts +0 -20
- package/bin/generators.js +0 -272
- package/bin/hale-commenting.js +0 -4
- package/bin/index.d.ts +0 -2
- package/bin/index.js +0 -61
- package/bin/onboarding.d.ts +0 -1
- package/bin/onboarding.js +0 -395
- package/bin/postinstall.d.ts +0 -2
- package/bin/postinstall.js +0 -65
- package/bin/validators.d.ts +0 -2
- package/bin/validators.js +0 -66
- package/dist/cli/detect.d.ts +0 -10
- package/dist/cli/detect.js +0 -134
- package/dist/cli/generators.d.ts +0 -20
- package/dist/cli/generators.js +0 -272
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.js +0 -61
- package/dist/cli/onboarding.d.ts +0 -1
- package/dist/cli/onboarding.js +0 -395
- package/dist/cli/postinstall.d.ts +0 -2
- package/dist/cli/postinstall.js +0 -65
- package/dist/cli/validators.d.ts +0 -2
- package/dist/cli/validators.js +0 -66
- package/dist/components/CommentOverlay.d.ts +0 -2
- package/dist/components/CommentOverlay.js +0 -101
- package/dist/components/CommentPanel.d.ts +0 -6
- package/dist/components/CommentPanel.js +0 -334
- package/dist/components/CommentPin.d.ts +0 -11
- package/dist/components/CommentPin.js +0 -64
- package/dist/components/DetailsTab.d.ts +0 -2
- package/dist/components/DetailsTab.js +0 -380
- package/dist/components/FloatingWidget.d.ts +0 -8
- package/dist/components/FloatingWidget.js +0 -128
- package/dist/components/JiraTab.d.ts +0 -2
- package/dist/components/JiraTab.js +0 -507
- package/dist/contexts/CommentContext.d.ts +0 -30
- package/dist/contexts/CommentContext.js +0 -891
- package/dist/contexts/GitHubAuthContext.d.ts +0 -13
- package/dist/contexts/GitHubAuthContext.js +0 -96
- package/dist/index.js +0 -27
- package/dist/services/githubAdapter.d.ts +0 -56
- package/dist/services/githubAdapter.js +0 -321
- package/dist/types/index.d.ts +0 -25
- package/dist/types/index.js +0 -2
- package/dist/utils/version.d.ts +0 -1
- package/dist/utils/version.js +0 -23
- package/templates/webpack-middleware.js +0 -226
package/dist/cli/onboarding.js
DELETED
|
@@ -1,395 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.runOnboarding = runOnboarding;
|
|
40
|
-
const inquirer_1 = __importDefault(require("inquirer"));
|
|
41
|
-
const validators = __importStar(require("./validators"));
|
|
42
|
-
const generators = __importStar(require("./generators"));
|
|
43
|
-
const detect_1 = require("./detect");
|
|
44
|
-
async function runOnboarding() {
|
|
45
|
-
// Welcome & Explanation
|
|
46
|
-
console.log('🚀 Welcome to Hale Commenting System!\n');
|
|
47
|
-
console.log('This commenting system allows you to:');
|
|
48
|
-
console.log(' • Add comments directly on your design pages');
|
|
49
|
-
console.log(' • Sync comments with GitHub Issues');
|
|
50
|
-
console.log(' • Link Jira tickets to pages');
|
|
51
|
-
console.log(' • Store design goals and context\n');
|
|
52
|
-
console.log('Why GitHub?');
|
|
53
|
-
console.log(' We use GitHub Issues to store and sync all comments. When you add a comment');
|
|
54
|
-
console.log(' on a page, it creates a GitHub Issue. This allows comments to persist, sync');
|
|
55
|
-
console.log(' across devices, and be managed like any other GitHub Issue.\n');
|
|
56
|
-
console.log('Why Jira?');
|
|
57
|
-
console.log(' You can link Jira tickets to specific pages or sections. This helps connect');
|
|
58
|
-
console.log(' design work to development tracking and provides context for reviewers.\n');
|
|
59
|
-
// Step 1: Project Status Check
|
|
60
|
-
console.log('📋 Step 1: Project Setup Check\n');
|
|
61
|
-
const hasProject = await inquirer_1.default.prompt([
|
|
62
|
-
{
|
|
63
|
-
type: 'list',
|
|
64
|
-
name: 'hasProject',
|
|
65
|
-
message: 'Do you have a PatternFly Seed project set up locally?',
|
|
66
|
-
choices: [
|
|
67
|
-
{ name: 'Yes, I have it set up', value: 'yes' },
|
|
68
|
-
{ name: 'No, I need help setting it up', value: 'no' }
|
|
69
|
-
]
|
|
70
|
-
}
|
|
71
|
-
]);
|
|
72
|
-
if (hasProject.hasProject === 'no') {
|
|
73
|
-
console.log('\n📚 Setting up PatternFly Seed:\n');
|
|
74
|
-
console.log('1. Fork the PatternFly Seed repository:');
|
|
75
|
-
console.log(' Visit: https://github.com/patternfly/patternfly-react-seed');
|
|
76
|
-
console.log(' Click "Fork" in the top right\n');
|
|
77
|
-
console.log('2. Clone your fork locally:');
|
|
78
|
-
console.log(' git clone https://github.com/YOUR_USERNAME/patternfly-react-seed.git');
|
|
79
|
-
console.log(' cd patternfly-react-seed\n');
|
|
80
|
-
console.log('3. Install dependencies:');
|
|
81
|
-
console.log(' npm install\n');
|
|
82
|
-
console.log('4. Run this setup again:');
|
|
83
|
-
console.log(' npx hale-commenting-system init\n');
|
|
84
|
-
process.exit(0);
|
|
85
|
-
}
|
|
86
|
-
// Check if it's actually a PF Seed project
|
|
87
|
-
if (!(0, detect_1.detectPatternFlySeed)()) {
|
|
88
|
-
console.error('❌ Error: This doesn\'t appear to be a PatternFly Seed project.');
|
|
89
|
-
console.error('Please run this command from a PatternFly Seed project directory.');
|
|
90
|
-
process.exit(1);
|
|
91
|
-
}
|
|
92
|
-
// Detect project setup type
|
|
93
|
-
const gitInfo = (0, detect_1.detectGitRemote)();
|
|
94
|
-
const setupType = (0, detect_1.detectProjectSetup)();
|
|
95
|
-
let projectSetup = 'unknown';
|
|
96
|
-
let owner = gitInfo?.owner;
|
|
97
|
-
let repo = gitInfo?.repo;
|
|
98
|
-
if (setupType === 'none' || !gitInfo) {
|
|
99
|
-
// No git remote - need to set up
|
|
100
|
-
const setupAnswer = await inquirer_1.default.prompt([
|
|
101
|
-
{
|
|
102
|
-
type: 'list',
|
|
103
|
-
name: 'setupType',
|
|
104
|
-
message: 'How did you set up your PatternFly Seed project?',
|
|
105
|
-
choices: [
|
|
106
|
-
{ name: 'I forked the PatternFly Seed repo on GitHub', value: 'forked' },
|
|
107
|
-
{ name: 'I cloned the PatternFly Seed repo locally', value: 'cloned' },
|
|
108
|
-
{ name: 'I\'m not sure', value: 'unknown' }
|
|
109
|
-
]
|
|
110
|
-
}
|
|
111
|
-
]);
|
|
112
|
-
projectSetup = setupAnswer.setupType;
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
projectSetup = setupType;
|
|
116
|
-
}
|
|
117
|
-
// Handle different setup types
|
|
118
|
-
if (projectSetup === 'forked') {
|
|
119
|
-
// Ask for owner/repo if not detected
|
|
120
|
-
if (!owner || !repo) {
|
|
121
|
-
const forkAnswers = await inquirer_1.default.prompt([
|
|
122
|
-
{
|
|
123
|
-
type: 'input',
|
|
124
|
-
name: 'owner',
|
|
125
|
-
message: 'What is your GitHub username or organization name?',
|
|
126
|
-
default: owner,
|
|
127
|
-
validate: (input) => {
|
|
128
|
-
if (!input.trim())
|
|
129
|
-
return 'Owner is required';
|
|
130
|
-
return true;
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
type: 'input',
|
|
135
|
-
name: 'repo',
|
|
136
|
-
message: 'What is the name of your forked repository?',
|
|
137
|
-
default: repo,
|
|
138
|
-
validate: (input) => {
|
|
139
|
-
if (!input.trim())
|
|
140
|
-
return 'Repository name is required';
|
|
141
|
-
return true;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
]);
|
|
145
|
-
owner = forkAnswers.owner;
|
|
146
|
-
repo = forkAnswers.repo;
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
console.log(`\n✅ Detected repository: ${owner}/${repo}\n`);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
else if (projectSetup === 'cloned') {
|
|
153
|
-
console.log('\n📝 Since you cloned the repo, you\'ll need to create your own GitHub repository.\n');
|
|
154
|
-
console.log('Steps:');
|
|
155
|
-
console.log('1. Create a new repository on GitHub');
|
|
156
|
-
console.log('2. Add it as a remote: git remote add origin <your-repo-url>');
|
|
157
|
-
console.log('3. Push your code: git push -u origin main\n');
|
|
158
|
-
const hasCreated = await inquirer_1.default.prompt([
|
|
159
|
-
{
|
|
160
|
-
type: 'confirm',
|
|
161
|
-
name: 'created',
|
|
162
|
-
message: 'Have you created and pushed to your GitHub repository?',
|
|
163
|
-
default: false
|
|
164
|
-
}
|
|
165
|
-
]);
|
|
166
|
-
if (!hasCreated.created) {
|
|
167
|
-
console.log('\nPlease complete the steps above and run this setup again.');
|
|
168
|
-
process.exit(0);
|
|
169
|
-
}
|
|
170
|
-
// Ask for owner/repo
|
|
171
|
-
const repoAnswers = await inquirer_1.default.prompt([
|
|
172
|
-
{
|
|
173
|
-
type: 'input',
|
|
174
|
-
name: 'owner',
|
|
175
|
-
message: 'What is your GitHub username or organization name?',
|
|
176
|
-
validate: (input) => {
|
|
177
|
-
if (!input.trim())
|
|
178
|
-
return 'Owner is required';
|
|
179
|
-
return true;
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
type: 'input',
|
|
184
|
-
name: 'repo',
|
|
185
|
-
message: 'What is the name of your GitHub repository?',
|
|
186
|
-
validate: (input) => {
|
|
187
|
-
if (!input.trim())
|
|
188
|
-
return 'Repository name is required';
|
|
189
|
-
return true;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
]);
|
|
193
|
-
owner = repoAnswers.owner;
|
|
194
|
-
repo = repoAnswers.repo;
|
|
195
|
-
}
|
|
196
|
-
else if (projectSetup === 'unknown') {
|
|
197
|
-
// Try to detect from git
|
|
198
|
-
if (gitInfo && gitInfo.owner && gitInfo.repo) {
|
|
199
|
-
console.log(`\n✅ Detected repository: ${gitInfo.owner}/${gitInfo.repo}\n`);
|
|
200
|
-
owner = gitInfo.owner;
|
|
201
|
-
repo = gitInfo.repo;
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
// Ask for owner/repo
|
|
205
|
-
const repoAnswers = await inquirer_1.default.prompt([
|
|
206
|
-
{
|
|
207
|
-
type: 'input',
|
|
208
|
-
name: 'owner',
|
|
209
|
-
message: 'What is your GitHub username or organization name?',
|
|
210
|
-
validate: (input) => {
|
|
211
|
-
if (!input.trim())
|
|
212
|
-
return 'Owner is required';
|
|
213
|
-
return true;
|
|
214
|
-
}
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
type: 'input',
|
|
218
|
-
name: 'repo',
|
|
219
|
-
message: 'What is the name of your GitHub repository?',
|
|
220
|
-
validate: (input) => {
|
|
221
|
-
if (!input.trim())
|
|
222
|
-
return 'Repository name is required';
|
|
223
|
-
return true;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
]);
|
|
227
|
-
owner = repoAnswers.owner;
|
|
228
|
-
repo = repoAnswers.repo;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
// Step 2: GitHub OAuth Setup (Optional)
|
|
232
|
-
console.log('\n📦 Step 2: GitHub Integration (Optional)\n');
|
|
233
|
-
console.log('GitHub integration allows comments to sync with GitHub Issues.');
|
|
234
|
-
console.log('You can set this up now or add it later.\n');
|
|
235
|
-
const setupGitHub = await inquirer_1.default.prompt([
|
|
236
|
-
{
|
|
237
|
-
type: 'confirm',
|
|
238
|
-
name: 'setup',
|
|
239
|
-
message: 'Do you want to set up GitHub integration now?',
|
|
240
|
-
default: true
|
|
241
|
-
}
|
|
242
|
-
]);
|
|
243
|
-
let githubConfig = null;
|
|
244
|
-
let githubValid = false;
|
|
245
|
-
if (setupGitHub.setup) {
|
|
246
|
-
console.log('\nTo sync comments with GitHub Issues, we need to authenticate with GitHub.');
|
|
247
|
-
console.log('This requires creating a GitHub OAuth App.\n');
|
|
248
|
-
console.log('Instructions:');
|
|
249
|
-
console.log('1. Visit: https://github.com/settings/developers');
|
|
250
|
-
console.log('2. Click "New OAuth App"');
|
|
251
|
-
console.log('3. Fill in the form:');
|
|
252
|
-
console.log(' - Application name: Your app name (e.g., "My Design Comments")');
|
|
253
|
-
console.log(' - Homepage URL: http://localhost:9000 (or your dev server URL)');
|
|
254
|
-
console.log(' - Authorization callback URL: http://localhost:9000/api/github-oauth-callback');
|
|
255
|
-
console.log('4. Click "Register application"');
|
|
256
|
-
console.log('5. Copy the Client ID and generate a Client Secret\n');
|
|
257
|
-
const githubAnswers = await inquirer_1.default.prompt([
|
|
258
|
-
{
|
|
259
|
-
type: 'input',
|
|
260
|
-
name: 'clientId',
|
|
261
|
-
message: 'GitHub OAuth Client ID:',
|
|
262
|
-
validate: (input) => {
|
|
263
|
-
if (!input.trim())
|
|
264
|
-
return 'Client ID is required';
|
|
265
|
-
return true;
|
|
266
|
-
}
|
|
267
|
-
},
|
|
268
|
-
{
|
|
269
|
-
type: 'password',
|
|
270
|
-
name: 'clientSecret',
|
|
271
|
-
message: 'GitHub OAuth Client Secret:',
|
|
272
|
-
mask: '*',
|
|
273
|
-
validate: (input) => {
|
|
274
|
-
if (!input.trim())
|
|
275
|
-
return 'Client Secret is required';
|
|
276
|
-
return true;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
]);
|
|
280
|
-
// Validate GitHub credentials
|
|
281
|
-
console.log('\n🔍 Validating GitHub credentials...');
|
|
282
|
-
githubValid = await validators.validateGitHubCredentials(githubAnswers.clientId, githubAnswers.clientSecret, owner, repo);
|
|
283
|
-
if (!githubValid) {
|
|
284
|
-
console.error('❌ GitHub validation failed. Please check your credentials and try again.');
|
|
285
|
-
process.exit(1);
|
|
286
|
-
}
|
|
287
|
-
console.log('✅ GitHub credentials validated!\n');
|
|
288
|
-
githubConfig = {
|
|
289
|
-
clientId: githubAnswers.clientId,
|
|
290
|
-
clientSecret: githubAnswers.clientSecret,
|
|
291
|
-
owner: owner,
|
|
292
|
-
repo: repo
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
else {
|
|
296
|
-
console.log('\n⏭️ Skipping GitHub setup. You can add it later by editing .env and .env.server files.\n');
|
|
297
|
-
}
|
|
298
|
-
// Step 3: Jira Setup (Optional)
|
|
299
|
-
console.log('🎫 Step 3: Jira Integration (Optional)\n');
|
|
300
|
-
console.log('Jira integration allows you to link Jira tickets to pages in your design.');
|
|
301
|
-
console.log('You can set this up now or add it later.\n');
|
|
302
|
-
const setupJira = await inquirer_1.default.prompt([
|
|
303
|
-
{
|
|
304
|
-
type: 'confirm',
|
|
305
|
-
name: 'setup',
|
|
306
|
-
message: 'Do you want to set up Jira integration now?',
|
|
307
|
-
default: true
|
|
308
|
-
}
|
|
309
|
-
]);
|
|
310
|
-
let jiraConfig = null;
|
|
311
|
-
let jiraValid = false;
|
|
312
|
-
if (setupJira.setup) {
|
|
313
|
-
console.log('\nFor Red Hat Jira, generate a Personal Access Token:');
|
|
314
|
-
console.log('1. Visit: https://issues.redhat.com/secure/ViewProfile.jspa');
|
|
315
|
-
console.log('2. Click "Personal Access Tokens" in the left sidebar');
|
|
316
|
-
console.log('3. Click "Create token"');
|
|
317
|
-
console.log('4. Give it a name (e.g., "Hale Commenting System")');
|
|
318
|
-
console.log('5. Remove expiration (or set a long expiration)');
|
|
319
|
-
console.log('6. Click "Create" and copy the token\n');
|
|
320
|
-
console.log('Note: We use Bearer token authentication (no email required for Red Hat Jira).\n');
|
|
321
|
-
const jiraAnswers = await inquirer_1.default.prompt([
|
|
322
|
-
{
|
|
323
|
-
type: 'input',
|
|
324
|
-
name: 'baseUrl',
|
|
325
|
-
message: 'Jira Base URL (press Enter for Red Hat Jira):',
|
|
326
|
-
default: 'https://issues.redhat.com',
|
|
327
|
-
validate: (input) => {
|
|
328
|
-
if (!input.trim())
|
|
329
|
-
return 'Base URL is required';
|
|
330
|
-
try {
|
|
331
|
-
new URL(input);
|
|
332
|
-
return true;
|
|
333
|
-
}
|
|
334
|
-
catch {
|
|
335
|
-
return 'Please enter a valid URL';
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
},
|
|
339
|
-
{
|
|
340
|
-
type: 'password',
|
|
341
|
-
name: 'apiToken',
|
|
342
|
-
message: 'Jira API Token:',
|
|
343
|
-
mask: '*',
|
|
344
|
-
validate: (input) => {
|
|
345
|
-
if (!input.trim())
|
|
346
|
-
return 'API Token is required';
|
|
347
|
-
return true;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
]);
|
|
351
|
-
// Validate Jira credentials
|
|
352
|
-
console.log('\n🔍 Validating Jira credentials...');
|
|
353
|
-
jiraValid = await validators.validateJiraCredentials(jiraAnswers.baseUrl, jiraAnswers.apiToken, undefined // No email for Bearer token
|
|
354
|
-
);
|
|
355
|
-
if (!jiraValid) {
|
|
356
|
-
console.error('❌ Jira validation failed. Please check your credentials and try again.');
|
|
357
|
-
process.exit(1);
|
|
358
|
-
}
|
|
359
|
-
console.log('✅ Jira credentials validated!\n');
|
|
360
|
-
jiraConfig = {
|
|
361
|
-
baseUrl: jiraAnswers.baseUrl,
|
|
362
|
-
apiToken: jiraAnswers.apiToken,
|
|
363
|
-
email: undefined
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
else {
|
|
367
|
-
console.log('\n⏭️ Skipping Jira setup. You can add it later by editing .env and .env.server files.\n');
|
|
368
|
-
}
|
|
369
|
-
// Step 4: Generate files
|
|
370
|
-
console.log('📝 Step 4: Generating configuration files...\n');
|
|
371
|
-
await generators.generateFiles({
|
|
372
|
-
github: githubConfig,
|
|
373
|
-
jira: jiraConfig,
|
|
374
|
-
owner: owner,
|
|
375
|
-
repo: repo
|
|
376
|
-
});
|
|
377
|
-
// Step 5: Integrate into project
|
|
378
|
-
console.log('🔧 Step 5: Integrating into PatternFly Seed project...\n');
|
|
379
|
-
await generators.integrateIntoProject();
|
|
380
|
-
console.log('\n✅ Setup complete!');
|
|
381
|
-
console.log('\nNext steps:');
|
|
382
|
-
console.log('1. Start your dev server: npm run start:dev');
|
|
383
|
-
console.log(' (If it\'s already running, restart it to load the new configuration)');
|
|
384
|
-
console.log('2. The commenting system will be available in your app!\n');
|
|
385
|
-
if (!githubConfig || !jiraConfig) {
|
|
386
|
-
console.log('📝 To add integrations later:');
|
|
387
|
-
if (!githubConfig) {
|
|
388
|
-
console.log(' • GitHub: Edit .env and .env.server files (see comments in files for instructions)');
|
|
389
|
-
}
|
|
390
|
-
if (!jiraConfig) {
|
|
391
|
-
console.log(' • Jira: Edit .env and .env.server files (see comments in files for instructions)');
|
|
392
|
-
}
|
|
393
|
-
console.log(' • Then restart your dev server\n');
|
|
394
|
-
}
|
|
395
|
-
}
|
package/dist/cli/postinstall.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
const fs = __importStar(require("fs"));
|
|
38
|
-
const path = __importStar(require("path"));
|
|
39
|
-
const detect = __importStar(require("./detect"));
|
|
40
|
-
const onboarding = __importStar(require("./onboarding"));
|
|
41
|
-
async function main() {
|
|
42
|
-
const cwd = process.cwd();
|
|
43
|
-
const envPath = path.join(cwd, '.env');
|
|
44
|
-
// Check if already configured (has GitHub client ID in .env)
|
|
45
|
-
if (fs.existsSync(envPath)) {
|
|
46
|
-
const envContent = fs.readFileSync(envPath, 'utf-8');
|
|
47
|
-
if (envContent.includes('VITE_GITHUB_CLIENT_ID')) {
|
|
48
|
-
// Already configured, skip onboarding
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
// Check if we're in a PatternFly Seed project
|
|
53
|
-
const isPFSeed = detect.detectPatternFlySeed();
|
|
54
|
-
if (!isPFSeed) {
|
|
55
|
-
// Not a PF Seed project, skip silently (might be installing in a different context)
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
// Run onboarding
|
|
59
|
-
console.log('🚀 Hale Commenting System - First-time setup\n');
|
|
60
|
-
await onboarding.runOnboarding();
|
|
61
|
-
}
|
|
62
|
-
main().catch((error) => {
|
|
63
|
-
// Don't fail the install if onboarding has issues
|
|
64
|
-
console.error('⚠️ Onboarding error (non-fatal):', error.message);
|
|
65
|
-
});
|
package/dist/cli/validators.d.ts
DELETED
package/dist/cli/validators.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.validateGitHubCredentials = validateGitHubCredentials;
|
|
7
|
-
exports.validateJiraCredentials = validateJiraCredentials;
|
|
8
|
-
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
9
|
-
async function validateGitHubCredentials(clientId, clientSecret, owner, repo) {
|
|
10
|
-
try {
|
|
11
|
-
// Test OAuth app credentials by attempting token exchange (we'll use a dummy code)
|
|
12
|
-
// Actually, we can't test OAuth without a real callback, so we'll just check repo access
|
|
13
|
-
// For a real validation, we'd need the user to complete OAuth flow, but for onboarding
|
|
14
|
-
// we'll just verify the repo exists and is accessible
|
|
15
|
-
const repoUrl = `https://api.github.com/repos/${owner}/${repo}`;
|
|
16
|
-
const response = await (0, node_fetch_1.default)(repoUrl, {
|
|
17
|
-
headers: {
|
|
18
|
-
'Accept': 'application/vnd.github+json',
|
|
19
|
-
'User-Agent': 'hale-commenting-system'
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
if (response.ok) {
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
if (response.status === 404) {
|
|
26
|
-
console.error(` Repository ${owner}/${repo} not found or not accessible`);
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
console.error(` GitHub API error: ${response.status}`);
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
console.error(` Error validating GitHub: ${error.message}`);
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
async function validateJiraCredentials(baseUrl, apiToken, email) {
|
|
38
|
-
try {
|
|
39
|
-
const url = `${baseUrl.replace(/\/+$/, '')}/rest/api/2/myself`;
|
|
40
|
-
const authHeader = email
|
|
41
|
-
? `Basic ${Buffer.from(`${email}:${apiToken}`).toString('base64')}`
|
|
42
|
-
: `Bearer ${apiToken}`;
|
|
43
|
-
const response = await (0, node_fetch_1.default)(url, {
|
|
44
|
-
headers: {
|
|
45
|
-
'Accept': 'application/json',
|
|
46
|
-
'Authorization': authHeader,
|
|
47
|
-
'User-Agent': 'hale-commenting-system'
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
if (response.ok) {
|
|
51
|
-
const data = await response.json();
|
|
52
|
-
console.log(` ✅ Authenticated as: ${data.displayName || data.name || 'User'}`);
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
if (response.status === 401 || response.status === 403) {
|
|
56
|
-
console.error(` Authentication failed. Check your token and email (if required).`);
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
console.error(` Jira API error: ${response.status}`);
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
console.error(` Error validating Jira: ${error.message}`);
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.CommentOverlay = void 0;
|
|
37
|
-
const React = __importStar(require("react"));
|
|
38
|
-
const react_router_dom_1 = require("react-router-dom");
|
|
39
|
-
const CommentContext_1 = require("../contexts/CommentContext");
|
|
40
|
-
const CommentPin_1 = require("./CommentPin");
|
|
41
|
-
const version_1 = require("../utils/version");
|
|
42
|
-
const CommentOverlay = () => {
|
|
43
|
-
const location = (0, react_router_dom_1.useLocation)();
|
|
44
|
-
const { commentsEnabled, addThread, selectedThreadId, setSelectedThreadId, syncFromGitHub, getThreadsForRoute } = (0, CommentContext_1.useComments)();
|
|
45
|
-
const detectedVersion = (0, version_1.getVersionFromPathOrQuery)(location.pathname, location.search);
|
|
46
|
-
const overlayRef = React.useRef(null);
|
|
47
|
-
// Show both open and closed threads as pins (GitHub-style: closed issues still exist)
|
|
48
|
-
const currentThreads = getThreadsForRoute(location.pathname, detectedVersion);
|
|
49
|
-
const handlePageClick = (e) => {
|
|
50
|
-
if (!commentsEnabled)
|
|
51
|
-
return;
|
|
52
|
-
// Check if clicking on a pin or any interactive element
|
|
53
|
-
const target = e.target;
|
|
54
|
-
if (target.closest('button') ||
|
|
55
|
-
target.closest('a') ||
|
|
56
|
-
target.closest('input') ||
|
|
57
|
-
target.closest('select') ||
|
|
58
|
-
target.closest('textarea') ||
|
|
59
|
-
target.closest('[role="button"]') ||
|
|
60
|
-
target.closest('[data-comment-controls]') ||
|
|
61
|
-
target.closest('[data-comment-pin]')) {
|
|
62
|
-
return; // Don't create pin if clicking interactive elements
|
|
63
|
-
}
|
|
64
|
-
// Get the overlay container dimensions (accounts for drawer being open)
|
|
65
|
-
if (!overlayRef.current)
|
|
66
|
-
return;
|
|
67
|
-
const rect = overlayRef.current.getBoundingClientRect();
|
|
68
|
-
// Calculate percentage based on the content area, not the full window
|
|
69
|
-
const xPercent = ((e.clientX - rect.left) / rect.width) * 100;
|
|
70
|
-
const yPercent = ((e.clientY - rect.top) / rect.height) * 100;
|
|
71
|
-
const threadId = addThread(xPercent, yPercent, location.pathname, detectedVersion);
|
|
72
|
-
setSelectedThreadId(threadId);
|
|
73
|
-
};
|
|
74
|
-
React.useEffect(() => {
|
|
75
|
-
console.log('🔄 CommentOverlay useEffect triggered', { commentsEnabled, pathname: location.pathname, detectedVersion });
|
|
76
|
-
if (commentsEnabled) {
|
|
77
|
-
document.addEventListener('click', handlePageClick);
|
|
78
|
-
// Pull latest changes from GitHub when entering comment mode or switching routes
|
|
79
|
-
console.log('🔄 CommentOverlay calling syncFromGitHub...');
|
|
80
|
-
syncFromGitHub(location.pathname, detectedVersion).catch(() => undefined);
|
|
81
|
-
}
|
|
82
|
-
return () => {
|
|
83
|
-
document.removeEventListener('click', handlePageClick);
|
|
84
|
-
};
|
|
85
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
86
|
-
}, [commentsEnabled, location.pathname, detectedVersion]);
|
|
87
|
-
// Only show pins when commenting is enabled
|
|
88
|
-
if (!commentsEnabled) {
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
return (React.createElement("div", { ref: overlayRef, style: {
|
|
92
|
-
position: 'absolute',
|
|
93
|
-
top: 0,
|
|
94
|
-
left: 0,
|
|
95
|
-
width: '100%',
|
|
96
|
-
height: '100%',
|
|
97
|
-
pointerEvents: 'none',
|
|
98
|
-
zIndex: 999,
|
|
99
|
-
} }, currentThreads.map((thread) => (React.createElement(CommentPin_1.CommentPin, { key: thread.id, xPercent: thread.xPercent, yPercent: thread.yPercent, commentCount: thread.comments.length, isClosed: thread.status === 'closed', isSelected: selectedThreadId === thread.id, onClick: () => setSelectedThreadId(thread.id) })))));
|
|
100
|
-
};
|
|
101
|
-
exports.CommentOverlay = CommentOverlay;
|