heyteam-cli 1.0.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.
@@ -0,0 +1,140 @@
1
+ # Ship to Integration
2
+
3
+ **Context**: Read the project configuration from `heyteam-instructions.md`.
4
+
5
+ ## Prerequisites
6
+
7
+ ### Required MCP Servers
8
+
9
+ This workflow requires **GitHub** and **Atlassian (Jira)** MCP servers to be configured.
10
+
11
+ > [!IMPORTANT]
12
+ > **For VSCode / VSCode Insiders:**
13
+ > Search `@mcp github` and `@mcp atlassian` in the chat panel to configure MCP servers.
14
+ >
15
+ > **For IntelliJ:**
16
+ > Add the GitHub and Atlassian MCP server configurations to your MCP settings.
17
+
18
+ ### Repository Access Check
19
+
20
+ Before proceeding, verify that the authenticated user has access to the `digicert/dtm` repository:
21
+ - Use GitHub MCP tools to check access to `digicert/dtm`
22
+ - **If access is denied, STOP execution immediately** and inform the user
23
+
24
+ ## Task
25
+
26
+ Create a Pull Request for integration deployment.
27
+
28
+ ## Steps
29
+
30
+ 1. **Check for uncommitted changes**
31
+ ```bash
32
+ git status --porcelain
33
+ ```
34
+
35
+ 2. **If there are staged or unstaged changes, generate commit message and commit**
36
+ - Get the diff of changes:
37
+ ```bash
38
+ git diff HEAD
39
+ ```
40
+ - Analyze the changes and generate a professional, meaningful commit message
41
+ - Use conventional commit format: `<type>: <description>`
42
+ - Types: feat, fix, docs, style, refactor, test, chore
43
+ - Example: "feat: add user authentication module"
44
+ - Commit the changes:
45
+ ```bash
46
+ # Add only tracked files (updates/deletions) - do NOT add untracked files unless explicitly asked
47
+ git add -u
48
+ git commit -m "GENERATED_MESSAGE"
49
+ ```
50
+
51
+ 3. **Push changes to remote**
52
+ ```bash
53
+ git push origin HEAD
54
+ ```
55
+
56
+ 4. **Identify repository**
57
+ - Check if current repo is `digicert/dtm` (UI) or `digicert/dtm-backend` (Backend)
58
+
59
+ 5. **Get current branch name**
60
+ ```bash
61
+ git branch --show-current
62
+ ```
63
+
64
+ 6. **Determine target branch and label**
65
+
66
+ **If Backend repo (dtm-backend):**
67
+ - If branch matches `deployment/int/**`:
68
+ - Target: `{current-branch}-trigger` (append `-trigger`)
69
+ - Label: `integration-deploy`
70
+ - If asked for "latest release branch":
71
+ - Use `list_branches` to find branches matching `release/*`
72
+ - Sort by creation date, use the most recent
73
+ - Label: `integration-deploy`
74
+ - Otherwise:
75
+ - Target: `develop`
76
+ - Label: `integration-deploy`
77
+
78
+ **If UI repo (dtm):**
79
+ - If branch matches `deployment/int/**`:
80
+ - Target: `{current-branch}-trigger` (append `-trigger`)
81
+ - Label: `integration-deploy-user-interface`
82
+ - If asked for "latest release branch":
83
+ - Use `list_branches` to find branches matching `release/*`
84
+ - Sort by creation date, use the most recent
85
+ - Label: `integration-deploy-user-interface`
86
+ - Otherwise:
87
+ - Target: `develop`
88
+ - Label: `integration-deploy-user-interface`
89
+
90
+ 7. **Check for existing PR**
91
+ - Use `list_pull_requests` to check if an open PR already exists
92
+
93
+ 8. **Create or Update PR**
94
+ - Use `create_pull_request` with:
95
+ - `owner`: `digicert`
96
+ - `repo`: `dtm` or `dtm-backend`
97
+ - `head`: current branch
98
+ - `base`: determined target branch
99
+ - `title`: Generate from branch name
100
+ - `body`: Summary of changes
101
+
102
+ 9. **Add Label**
103
+ - Use `add_issue_labels` to add the appropriate integration label
104
+
105
+ 10. **Get current GitHub username and add Assignees/Reviewers (filtered)**
106
+ - Get the authenticated user's GitHub username
107
+ - Define team lists based on repository:
108
+ - **If UI repo (dtm)**: priti-kumari-dc, surbhi-gupta-dc, shiva-burade-dc
109
+ - **If Backend repo (dtm-backend)**: jaydeep-raval-dc, swaraj-dhumale-dc, sharmajetesh, shiva-burade-dc
110
+ - **Filter out the PR creator** from both assignees and reviewers lists
111
+ - Use `assign_issue` for assignees
112
+ - Use `request_pull_request_review` for reviewers
113
+
114
+ 11. **Add Jira Comment**
115
+ - Extract Jira ticket ID from the current branch name
116
+ - Pattern: look for `DTM-XXXX` in the branch name (e.g., `feature/DTM-2494-some-description` → `DTM-2494`)
117
+ - If a Jira ticket ID is found, add a meaningful comment to the ticket summarizing:
118
+ - What changes were made (based on the diff)
119
+ - The PR URL
120
+ - The target environment (Integration)
121
+ - If no Jira ticket ID can be extracted, skip this step
122
+
123
+ 12. **Send Slack Notification**
124
+ ```bash
125
+ curl -X POST -H 'Content-type: application/json' \
126
+ --data '{"PR_LINK": "PR_URL_HERE"}' \
127
+ '{{SLACK_WEBHOOK_URL}}'
128
+ ```
129
+
130
+ ## Expected Output
131
+
132
+ Report back with:
133
+ - Commit message generated (if any)
134
+ - PR URL
135
+ - Target branch (including if release branch was used)
136
+ - Label added (`integration-deploy` or `integration-deploy-user-interface`)
137
+ - Assignees added (excluding PR creator)
138
+ - Reviewers requested (excluding PR creator)
139
+ - Jira comment status (added, skipped, or ticket not found)
140
+ - Slack notification status
@@ -0,0 +1,131 @@
1
+ # Ship to Production
2
+
3
+ **Context**: Read the project configuration from `heyteam-instructions.md`.
4
+
5
+ ## Prerequisites
6
+
7
+ ### Required MCP Servers
8
+
9
+ This workflow requires **GitHub** and **Atlassian (Jira)** MCP servers to be configured.
10
+
11
+ > [!IMPORTANT]
12
+ > **For VSCode / VSCode Insiders:**
13
+ > Search `@mcp github` and `@mcp atlassian` in the chat panel to configure MCP servers.
14
+ >
15
+ > **For IntelliJ:**
16
+ > Add the GitHub and Atlassian MCP server configurations to your MCP settings.
17
+
18
+ ### Repository Access Check
19
+
20
+ Before proceeding, verify that the authenticated user has access to the `digicert/dtm` repository:
21
+ - Use GitHub MCP tools to check access to `digicert/dtm`
22
+ - **If access is denied, STOP execution immediately** and inform the user
23
+
24
+ ## Task
25
+
26
+ Create a Pull Request for production deployment.
27
+
28
+ ⚠️ **PRODUCTION DEPLOYMENT** - Requires multiple approvals.
29
+
30
+ ## Steps
31
+
32
+ 1. **Check for uncommitted changes**
33
+ ```bash
34
+ git status --porcelain
35
+ ```
36
+
37
+ 2. **If there are staged or unstaged changes, generate commit message and commit**
38
+ - Get the diff of changes:
39
+ ```bash
40
+ git diff HEAD
41
+ ```
42
+ - Analyze the changes and generate a professional, meaningful commit message
43
+ - Use conventional commit format: `<type>: <description>`
44
+ - Types: feat, fix, docs, style, refactor, test, chore
45
+ - Example: "feat: add user authentication module"
46
+ - Commit the changes:
47
+ ```bash
48
+ # Add only tracked files (updates/deletions) - do NOT add untracked files unless explicitly asked
49
+ git add -u
50
+ git commit -m "GENERATED_MESSAGE"
51
+ ```
52
+
53
+ 3. **Push changes to remote**
54
+ ```bash
55
+ git push origin HEAD
56
+ ```
57
+
58
+ 4. **Identify repository**
59
+ - Check if current repo is `digicert/dtm` (UI) or `digicert/dtm-backend` (Backend)
60
+
61
+ 5. **Get current branch name**
62
+ ```bash
63
+ git branch --show-current
64
+ ```
65
+
66
+ 6. **Determine target branch and label**
67
+
68
+ **If Backend repo (dtm-backend):**
69
+ - Target: Production branch (typically `main` or as specified)
70
+ - Label: `prod-deploy`
71
+
72
+ **If UI repo (dtm):**
73
+ - Target: Production branch (typically `main` or as specified)
74
+ - Label: `integration-deploy-user-interface`
75
+
76
+ 7. **Pre-flight Checks**
77
+ - Verify source branch has passed all CI/CD checks
78
+ - List recent commits that will be included
79
+
80
+ 8. **Check for existing PR**
81
+ - Use `list_pull_requests` to check if an open PR already exists
82
+
83
+ 9. **Create or Update PR**
84
+ - Use `create_pull_request` with:
85
+ - `owner`: `digicert`
86
+ - `repo`: `dtm` or `dtm-backend`
87
+ - `head`: current branch or integration branch
88
+ - `base`: production branch
89
+ - `title`: "Production Release - [DATE/VERSION]"
90
+ - `body`: Include all changes being deployed
91
+
92
+ 10. **Add Label**
93
+ - Use `add_issue_labels` to add the appropriate production label
94
+
95
+ 11. **Get current GitHub username and add ALL team members as Assignees/Reviewers (filtered)**
96
+ - Get the authenticated user's GitHub username
97
+ - Define team lists based on repository:
98
+ - **If UI repo (dtm)**: priti-kumari-dc, surbhi-gupta-dc, shiva-burade-dc
99
+ - **If Backend repo (dtm-backend)**: jaydeep-raval-dc, swaraj-dhumale-dc, sharmajetesh, shiva-burade-dc
100
+ - **Filter out the PR creator** from both assignees and reviewers lists
101
+ - Use `assign_issue` for assignees
102
+ - Use `request_pull_request_review` for reviewers
103
+
104
+ 12. **Add Jira Comment**
105
+ - Extract Jira ticket ID from the current branch name
106
+ - Pattern: look for `DTM-XXXX` in the branch name (e.g., `feature/DTM-2494-some-description` → `DTM-2494`)
107
+ - If a Jira ticket ID is found, add a meaningful comment to the ticket summarizing:
108
+ - What changes were made (based on the diff)
109
+ - The PR URL
110
+ - The target environment (Production)
111
+ - If no Jira ticket ID can be extracted, skip this step
112
+
113
+ 13. **Send Slack Notification**
114
+ ```bash
115
+ curl -X POST -H 'Content-type: application/json' \
116
+ --data '{"PR_LINK": "PR_URL_HERE"}' \
117
+ '{{SLACK_WEBHOOK_URL}}'
118
+ ```
119
+
120
+ ## Expected Output
121
+
122
+ Report back with:
123
+ - Commit message generated (if any)
124
+ - PR URL
125
+ - Target branch
126
+ - Label added (`prod-deploy` or `integration-deploy-user-interface`)
127
+ - Assignees added
128
+ - Reviewers requested (should be ALL team members for production)
129
+ - Jira comment status (added, skipped, or ticket not found)
130
+ - Slack notification status
131
+ - Reminder: PR requires multiple approvals before merge
@@ -0,0 +1,126 @@
1
+ # Ship to Release
2
+
3
+ **Context**: Read the project configuration from `heyteam-instructions.md`.
4
+
5
+ ## Prerequisites
6
+
7
+ ### Required MCP Servers
8
+
9
+ This workflow requires **GitHub** and **Atlassian (Jira)** MCP servers to be configured.
10
+
11
+ > [!IMPORTANT]
12
+ > **For VSCode / VSCode Insiders:**
13
+ > Search `@mcp github` and `@mcp atlassian` in the chat panel to configure MCP servers.
14
+ >
15
+ > **For IntelliJ:**
16
+ > Add the GitHub and Atlassian MCP server configurations to your MCP settings.
17
+
18
+ ### Repository Access Check
19
+
20
+ Before proceeding, verify that the authenticated user has access to the `digicert/dtm` repository:
21
+ - Use GitHub MCP tools to check access to `digicert/dtm`
22
+ - **If access is denied, STOP execution immediately** and inform the user
23
+
24
+ ## Task
25
+
26
+ Create a Pull Request against the latest release branch with appropriate labels.
27
+
28
+ ## Steps
29
+
30
+ 1. **Check for uncommitted changes**
31
+ ```bash
32
+ git status --porcelain
33
+ ```
34
+
35
+ 2. **If there are staged or unstaged changes, generate commit message and commit**
36
+ - Get the diff of changes:
37
+ ```bash
38
+ git diff HEAD
39
+ ```
40
+ - Analyze the changes and generate a professional, meaningful commit message
41
+ - Use conventional commit format: `<type>: <description>`
42
+ - Types: feat, fix, docs, style, refactor, test, chore
43
+ - Example: "feat: add user authentication module"
44
+ - Commit the changes:
45
+ ```bash
46
+ # Add only tracked files (updates/deletions) - do NOT add untracked files unless explicitly asked
47
+ git add -u
48
+ git commit -m "GENERATED_MESSAGE"
49
+ ```
50
+
51
+ 3. **Push changes to remote**
52
+ ```bash
53
+ git push origin HEAD
54
+ ```
55
+
56
+ 4. **Identify repository**
57
+ - Check if current repo is `digicert/dtm` (UI) or `digicert/dtm-backend` (Backend)
58
+
59
+ 5. **Get current branch name**
60
+ ```bash
61
+ git branch --show-current
62
+ ```
63
+
64
+ 6. **Find latest release branch**
65
+ - Use `list_branches` to find branches matching `release/*`
66
+ - Sort by creation date, use the most recent
67
+
68
+ 7. **Determine label based on repository**
69
+
70
+ **If Backend repo (dtm-backend):**
71
+ - Label: `integration-deploy`
72
+
73
+ **If UI repo (dtm):**
74
+ - Label: `integration-deploy-user-interface`
75
+
76
+ 8. **Check for existing PR**
77
+ - Use `list_pull_requests` to check if an open PR already exists from current branch to the release branch
78
+
79
+ 9. **Create or Update PR**
80
+ - Use `create_pull_request` with:
81
+ - `owner`: `digicert`
82
+ - `repo`: `dtm` or `dtm-backend`
83
+ - `head`: current branch
84
+ - `base`: latest release branch from step 6
85
+ - `title`: Generate from branch name
86
+ - `body`: Summary of changes
87
+
88
+ 10. **Add Label**
89
+ - Use `add_issue_labels` to add the appropriate label from step 7
90
+
91
+ 11. **Get current GitHub username and add Assignees/Reviewers (filtered)**
92
+ - Get the authenticated user's GitHub username
93
+ - Define team lists based on repository:
94
+ - **If UI repo (dtm)**: priti-kumari-dc, surbhi-gupta-dc, shiva-burade-dc
95
+ - **If Backend repo (dtm-backend)**: jaydeep-raval-dc, swaraj-dhumale-dc, sharmajetesh, shiva-burade-dc
96
+ - **Filter out the PR creator** from both assignees and reviewers lists
97
+ - Use `assign_issue` for assignees
98
+ - Use `request_pull_request_review` for reviewers
99
+
100
+ 12. **Add Jira Comment**
101
+ - Extract Jira ticket ID from the current branch name
102
+ - Pattern: look for `DTM-XXXX` in the branch name (e.g., `feature/DTM-2494-some-description` → `DTM-2494`)
103
+ - If a Jira ticket ID is found, add a meaningful comment to the ticket summarizing:
104
+ - What changes were made (based on the diff)
105
+ - The PR URL
106
+ - The target environment (Release)
107
+ - If no Jira ticket ID can be extracted, skip this step
108
+
109
+ 13. **[MANDATORY] Send Slack Notification**
110
+ ```bash
111
+ curl -X POST -H 'Content-type: application/json' \
112
+ --data '{"PR_LINK": "PR_URL_HERE"}' \
113
+ '{{SLACK_WEBHOOK_URL}}'
114
+ ```
115
+
116
+ ## Expected Output
117
+
118
+ Report back with:
119
+ - Commit message generated (if any)
120
+ - PR URL
121
+ - Release branch used as target
122
+ - Label added (`integration-deploy` or `integration-deploy-user-interface`)
123
+ - Assignees added (excluding PR creator)
124
+ - Reviewers requested (excluding PR creator)
125
+ - Jira comment status (added, skipped, or ticket not found)
126
+ - Slack notification status
package/README.md ADDED
@@ -0,0 +1,158 @@
1
+ # HeyTeam Arch 2.0
2
+
3
+ A zero-dependency architecture for managing deployments using **GitHub MCP Server** and **Slack Webhooks**.
4
+
5
+ ## 🎯 Philosophy
6
+
7
+ No custom CLI code. No npm packages. Just:
8
+ - **AI Agent** (GitHub Copilot / Antigravity) as the orchestrator
9
+ - **GitHub MCP Server** for all GitHub operations
10
+ - **Slack Webhook + curl** for notifications
11
+ - **Markdown files** for configuration and prompts
12
+
13
+ ---
14
+
15
+ ## 📋 Configured Repositories
16
+
17
+ | Repository | Type | Team |
18
+ |------------|------|------|
19
+ | `digicert/dtm` | UI (Frontend) | priti-kumari-dc, surbhi-gupta-dc |
20
+ | `digicert/dtm-backend` | Backend | jaydeep-raval-dc, swaraj-dhumale-dc, sharmajetesh |
21
+
22
+ ---
23
+
24
+ ## 📁 Structure
25
+
26
+ ```
27
+ Arch2.0/
28
+ ├── heyteam-instructions.md # All project config & instructions
29
+ ├── .github/
30
+ │ └── prompts/ # GitHub Copilot prompt files
31
+ │ ├── ship-code.prompt.md # Commit & push only
32
+ │ ├── ship-dev.prompt.md # Dev deployment
33
+ │ ├── ship-int.prompt.md # Integration deployment
34
+ │ ├── ship-release.prompt.md # Release branch deployment
35
+ │ └── ship-prod.prompt.md # Production deployment
36
+ └── .agent/
37
+ └── workflows/ # Antigravity workflow files
38
+ ├── ship-code.md
39
+ ├── ship-dev.md
40
+ ├── ship-int.md
41
+ ├── ship-release.md
42
+ └── ship-prod.md
43
+ ```
44
+
45
+ ---
46
+
47
+ ## 🏷️ Labels by Environment
48
+
49
+ | Command | Backend Label | UI Label | Slack |
50
+ |---------|---------------|----------|-------|
51
+ | `ship-code` | *None (no PR)* | *None (no PR)* | No |
52
+ | `ship-dev` | `dev-deploy` | `dev-deploy-user-interface` | Optional (default OFF) |
53
+ | `ship-int` | `integration-deploy` | `integration-deploy-user-interface` | Mandatory |
54
+ | `ship-release` | `integration-deploy` | `integration-deploy-user-interface` | Mandatory |
55
+ | `ship-prod` | `prod-deploy` | `integration-deploy-user-interface` | Mandatory |
56
+
57
+ ---
58
+
59
+ ## 🌿 Branch Patterns
60
+
61
+ ### Deployment Branches
62
+ Special branch patterns trigger different target branches:
63
+
64
+ | Current Branch | Target Branch |
65
+ |----------------|---------------|
66
+ | `deployment/dev/**` | `deployment/dev/**-trigger` |
67
+ | `deployment/int/**` | `deployment/int/**-trigger` |
68
+
69
+ **Example:** `deployment/dev/feature-x` → PR to `deployment/dev/feature-x-trigger`
70
+
71
+ ### Release Branches
72
+ When shipping to "latest release":
73
+ - Search branches matching `release/*`
74
+ - Use the most recently created one as target
75
+
76
+ ---
77
+
78
+ ## 🚀 Usage
79
+
80
+ ### With GitHub Copilot
81
+ ```
82
+ @workspace /ship-code # Commit & push only (no PR)
83
+ @workspace /ship-dev # Ship to dev (Slack optional)
84
+ @workspace /ship-int # Ship to integration (Slack mandatory)
85
+ @workspace /ship-release # Ship to release branch (Slack mandatory)
86
+ @workspace /ship-prod # Ship to production (Slack mandatory)
87
+ ```
88
+
89
+ ### With Antigravity
90
+ ```
91
+ /ship-code # Commit & push only (no PR)
92
+ /ship-dev # Ship to dev (Slack optional)
93
+ /ship-int # Ship to integration (Slack mandatory)
94
+ /ship-release # Ship to release branch (Slack mandatory)
95
+ /ship-prod # Ship to production (Slack mandatory)
96
+ ```
97
+
98
+ ---
99
+
100
+ ## 🔔 Slack Integration
101
+
102
+ **Slack notifications are:**
103
+ - **Optional (default OFF)** for: `ship-code`, `ship-dev`
104
+ - **Mandatory** for: `ship-int`, `ship-release`, `ship-prod`
105
+
106
+ When enabled, notifications are sent using:
107
+
108
+ ```bash
109
+ curl -X POST -H 'Content-type: application/json' \
110
+ --data '{"PR_LINK": "https://github.com/..."}' \
111
+ 'https://hooks.slack.com/triggers/ssdasdasd******'
112
+ ```
113
+
114
+ ---
115
+
116
+ ## 🔄 How It Works
117
+
118
+ ```
119
+ ┌─────────────────┐
120
+ │ You (User) │
121
+ └────────┬────────┘
122
+ │ "/ship-dev"
123
+
124
+ ┌─────────────────┐
125
+ │ AI Agent │ ◄── Reads heyteam-instructions.md
126
+ │ (Copilot/etc) │ Detects repo (dtm vs dtm-backend)
127
+ └────────┬────────┘ Applies correct labels & team
128
+
129
+ ┌────┴────┐
130
+ ▼ ▼
131
+ ┌───────┐ ┌──────┐
132
+ │GitHub │ │ curl │
133
+ │ MCP │ │ │
134
+ └───┬───┘ └──┬───┘
135
+ │ │
136
+ ▼ ▼
137
+ ┌───────┐ ┌──────┐
138
+ │GitHub │ │Slack │
139
+ │ API │ │Webhook│
140
+ └───────┘ └──────┘
141
+ ```
142
+
143
+ ---
144
+
145
+ ## 📝 Quick Reference
146
+
147
+ | Feature | How It Works |
148
+ |---------|-------------|
149
+ | Create PR | `create_pull_request` MCP tool |
150
+ | Add Labels | `add_issue_labels` MCP tool |
151
+ | Add Assignees | `assign_issue` MCP tool + team from config |
152
+ | Request Reviewers | `request_pull_request_review` MCP tool |
153
+ | Find Release Branch | `list_branches` MCP tool with pattern `release/*` |
154
+ | Slack Notification | `curl` to webhook URL |
155
+
156
+ ---
157
+
158
+ *Arch 2.0 - Simpler. Leaner. AI-Native.*
package/dist/index.js ADDED
@@ -0,0 +1,144 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const commander_1 = require("commander");
8
+ const inquirer_1 = __importDefault(require("inquirer"));
9
+ const fs_extra_1 = __importDefault(require("fs-extra"));
10
+ const path_1 = __importDefault(require("path"));
11
+ const chalk_1 = __importDefault(require("chalk"));
12
+ const program = new commander_1.Command();
13
+ program
14
+ .name('heyteam')
15
+ .description('CLI to initialize HeyTeam configurations')
16
+ .version('1.0.0');
17
+ program
18
+ .command('init [slack_webhook_url]')
19
+ .description('Initialize HeyTeam configuration')
20
+ .action(async (slackWebhookUrl) => {
21
+ try {
22
+ const answers = await inquirer_1.default.prompt([
23
+ {
24
+ type: 'list',
25
+ name: 'agentType',
26
+ message: 'Select the AI agent you want to configure:',
27
+ choices: ['vscode', 'vscode-insider', 'antigravity'],
28
+ },
29
+ ]);
30
+ let webhookUrl = slackWebhookUrl;
31
+ if (!webhookUrl) {
32
+ const answer = await inquirer_1.default.prompt([
33
+ {
34
+ type: 'input',
35
+ name: 'webhook',
36
+ message: 'Enter Slack Webhook URL:',
37
+ },
38
+ ]);
39
+ webhookUrl = answer.webhook;
40
+ }
41
+ const currentDir = process.cwd();
42
+ const arch2Root = path_1.default.join(__dirname, '..');
43
+ console.log(chalk_1.default.blue(`Initializing for ${answers.agentType}...`));
44
+ let destPath = '';
45
+ if (answers.agentType === 'antigravity') {
46
+ const sourcePath = path_1.default.join(arch2Root, '.agent', 'workflows');
47
+ destPath = path_1.default.join(currentDir, '.agent', 'workflows');
48
+ if (await fs_extra_1.default.pathExists(sourcePath)) {
49
+ await fs_extra_1.default.copy(sourcePath, destPath);
50
+ console.log(chalk_1.default.green(`✓ Copied .agent/workflows to ${destPath}`));
51
+ await updateGitignore('.agent');
52
+ }
53
+ else {
54
+ console.error(chalk_1.default.red(`Error: Source directory ${sourcePath} not found.`));
55
+ return;
56
+ }
57
+ }
58
+ else if (answers.agentType === 'vscode' || answers.agentType === 'vscode-insider') {
59
+ const sourcePath = path_1.default.join(arch2Root, '.github', 'prompts');
60
+ destPath = path_1.default.join(currentDir, '.github', 'prompts');
61
+ if (await fs_extra_1.default.pathExists(sourcePath)) {
62
+ await fs_extra_1.default.copy(sourcePath, destPath);
63
+ console.log(chalk_1.default.green(`✓ Copied .github/prompts to ${destPath}`));
64
+ await updateGitignore('.github/prompts');
65
+ }
66
+ else {
67
+ console.error(chalk_1.default.red(`Error: Source directory ${sourcePath} not found.`));
68
+ return;
69
+ }
70
+ }
71
+ // Copy heyteam-instructions.md to the target project root
72
+ const instructionsSource = path_1.default.join(arch2Root, 'heyteam-instructions.md');
73
+ const instructionsDest = path_1.default.join(currentDir, 'heyteam-instructions.md');
74
+ if (await fs_extra_1.default.pathExists(instructionsSource)) {
75
+ await fs_extra_1.default.copy(instructionsSource, instructionsDest);
76
+ console.log(chalk_1.default.green('✓ Copied heyteam-instructions.md to project root'));
77
+ // Replace webhook URL placeholder in heyteam-instructions.md
78
+ if (webhookUrl) {
79
+ const content = await fs_extra_1.default.readFile(instructionsDest, 'utf8');
80
+ await fs_extra_1.default.writeFile(instructionsDest, content.replaceAll('WEBHOOK_URL_PLACEHOLDER', webhookUrl));
81
+ console.log(chalk_1.default.green('✓ Replaced webhook URL in heyteam-instructions.md'));
82
+ }
83
+ // Add heyteam-instructions.md to .gitignore (contains sensitive webhook URL)
84
+ await updateGitignore('heyteam-instructions.md');
85
+ }
86
+ else {
87
+ console.error(chalk_1.default.red(`Error: ${instructionsSource} not found.`));
88
+ return;
89
+ }
90
+ // Replace webhook URL in workflow files
91
+ if (webhookUrl && destPath) {
92
+ await replaceInDirectory(destPath, '{{SLACK_WEBHOOK_URL}}', webhookUrl);
93
+ console.log(chalk_1.default.green(`✓ Replaced webhook URL in workflow files`));
94
+ }
95
+ // Display MCP server configuration instructions
96
+ console.log(chalk_1.default.yellow('\n⚠️ MCP Servers Required'));
97
+ console.log(chalk_1.default.white('This setup requires GitHub and Atlassian (Jira) MCP servers to be configured.\n'));
98
+ if (answers.agentType === 'vscode' || answers.agentType === 'vscode-insider') {
99
+ console.log(chalk_1.default.cyan(' Search @mcp github and @mcp atlassian in the VSCode chat panel to configure.'));
100
+ }
101
+ else {
102
+ console.log(chalk_1.default.cyan(' Add GitHub and Atlassian MCP server configurations to your MCP settings.'));
103
+ }
104
+ console.log('');
105
+ }
106
+ catch (error) {
107
+ console.error(chalk_1.default.red('An error occurred:'), error);
108
+ }
109
+ });
110
+ async function updateGitignore(entry) {
111
+ const gitignorePath = path_1.default.join(process.cwd(), '.gitignore');
112
+ try {
113
+ await fs_extra_1.default.ensureFile(gitignorePath);
114
+ const content = await fs_extra_1.default.readFile(gitignorePath, 'utf8');
115
+ if (!content.includes(entry)) {
116
+ const prefix = content.length > 0 && !content.endsWith('\n') ? '\n' : '';
117
+ await fs_extra_1.default.appendFile(gitignorePath, `${prefix}${entry}\n`);
118
+ console.log(chalk_1.default.green(`✓ Added ${entry} to .gitignore`));
119
+ }
120
+ else {
121
+ console.log(chalk_1.default.yellow(`ℹ ${entry} already exists in .gitignore`));
122
+ }
123
+ }
124
+ catch (err) {
125
+ console.error(chalk_1.default.red(`Error updating .gitignore: ${err}`));
126
+ }
127
+ }
128
+ async function replaceInDirectory(dir, from, to) {
129
+ const files = await fs_extra_1.default.readdir(dir);
130
+ for (const file of files) {
131
+ const filePath = path_1.default.join(dir, file);
132
+ const stat = await fs_extra_1.default.stat(filePath);
133
+ if (stat.isDirectory()) {
134
+ await replaceInDirectory(filePath, from, to);
135
+ }
136
+ else if (stat.isFile()) {
137
+ const content = await fs_extra_1.default.readFile(filePath, 'utf8');
138
+ if (content.includes(from)) {
139
+ await fs_extra_1.default.writeFile(filePath, content.replaceAll(from, to));
140
+ }
141
+ }
142
+ }
143
+ }
144
+ program.parse(process.argv);
Binary file