|
| 1 | +## ghcp-sp-95 |
| 2 | + |
| 3 | +### 10:44 Prompt |
| 4 | + |
| 5 | +In issue 95, you stated exactly this as the remedy for the branch protection problem. |
| 6 | + |
| 7 | +```bash |
| 8 | +gh api repos/github/copilot-sdk/rulesets \ |
| 9 | + -X POST \ |
| 10 | + --input - <<'EOF' |
| 11 | +{ |
| 12 | + "name": "ghcp-sp-95-java-branch-protection", |
| 13 | + "target": "branch", |
| 14 | + "enforcement": "active", |
| 15 | + "conditions": { |
| 16 | + "ref_name": { |
| 17 | + "include": ["refs/heads/main"], |
| 18 | + "exclude": [] |
| 19 | + } |
| 20 | + }, |
| 21 | + "bypass_actors": [ |
| 22 | + { |
| 23 | + "actor_id": 5, |
| 24 | + "actor_type": "RepositoryRole", |
| 25 | + "bypass_mode": "always" |
| 26 | + } |
| 27 | + ], |
| 28 | + "rules": [ |
| 29 | + { "type": "deletion" }, |
| 30 | + { |
| 31 | + "type": "pull_request", |
| 32 | + "parameters": { |
| 33 | + "required_approving_review_count": 1, |
| 34 | + "dismiss_stale_reviews_on_push": false, |
| 35 | + "require_code_owner_review": false, |
| 36 | + "require_last_push_approval": false, |
| 37 | + "required_review_thread_resolution": false, |
| 38 | + "allowed_merge_methods": ["merge", "squash", "rebase"] |
| 39 | + } |
| 40 | + }, |
| 41 | + { "type": "non_fast_forward" } |
| 42 | + ] |
| 43 | +} |
| 44 | +EOF |
| 45 | +``` |
| 46 | + |
| 47 | +I have approval from the stakeholders to do this. But because I'm very new to the repo and want to protect my reputation as a careful and risk-averse engineer, I want to know exactly how I can revert exactly this change, should problems arise. |
| 48 | + |
| 49 | +Can you give me the command that will effectively "undo" the operation? |
| 50 | + |
| 51 | +### 10:48 Response |
| 52 | + |
| 53 | +The POST will return a JSON response containing an `id` field. To undo, you delete that specific ruleset: |
| 54 | + |
| 55 | +```bash |
| 56 | +gh api repos/github/copilot-sdk/rulesets/<RULESET_ID> -X DELETE |
| 57 | +``` |
| 58 | + |
| 59 | +### Practical workflow: |
| 60 | + |
| 61 | +1. **When you create it**, capture the ID from the response: |
| 62 | + |
| 63 | + ```bash |
| 64 | + gh api repos/github/copilot-sdk/rulesets \ |
| 65 | + -X POST \ |
| 66 | + --input - <<'EOF' |
| 67 | + ... (your payload) ... |
| 68 | + EOF |
| 69 | + ``` |
| 70 | +
|
| 71 | + The response JSON will include `"id": 12345678`. Note that number. |
| 72 | +
|
| 73 | +2. **If you need to revert:** |
| 74 | +
|
| 75 | + ```bash |
| 76 | + gh api repos/github/copilot-sdk/rulesets/12345678 -X DELETE |
| 77 | + ``` |
| 78 | +
|
| 79 | +3. **If you lose the ID**, you can find it: |
| 80 | + ```bash |
| 81 | + gh api repos/github/copilot-sdk/rulesets --jq '.[] | select(.name == "Protect main") | .id' |
| 82 | + ``` |
| 83 | +
|
| 84 | +The DELETE removes the ruleset entirely — returning the repo to the state before you created it (assuming step 1 from the issue, deleting the classic branch protection, has already been done separately). There is no partial state; it's a clean removal. |
| 85 | +
|
| 86 | +### 10:50 Prompt |
| 87 | +
|
| 88 | +Here is the post again. I've changed the "name": |
| 89 | +
|
| 90 | +```bash |
| 91 | +gh api repos/github/copilot-sdk/rulesets \ |
| 92 | + -X POST \ |
| 93 | + --input - <<'EOF' |
| 94 | +{ |
| 95 | + "name": "ghcp-sp-95-java-branch-protection", |
| 96 | + "target": "branch", |
| 97 | + "enforcement": "active", |
| 98 | + "conditions": { |
| 99 | + "ref_name": { |
| 100 | + "include": ["refs/heads/main"], |
| 101 | + "exclude": [] |
| 102 | + } |
| 103 | + }, |
| 104 | + "bypass_actors": [ |
| 105 | + { |
| 106 | + "actor_id": 5, |
| 107 | + "actor_type": "RepositoryRole", |
| 108 | + "bypass_mode": "always" |
| 109 | + } |
| 110 | + ], |
| 111 | + "rules": [ |
| 112 | + { "type": "deletion" }, |
| 113 | + { |
| 114 | + "type": "pull_request", |
| 115 | + "parameters": { |
| 116 | + "required_approving_review_count": 1, |
| 117 | + "dismiss_stale_reviews_on_push": false, |
| 118 | + "require_code_owner_review": false, |
| 119 | + "require_last_push_approval": false, |
| 120 | + "required_review_thread_resolution": false, |
| 121 | + "allowed_merge_methods": ["merge", "squash", "rebase"] |
| 122 | + } |
| 123 | + }, |
| 124 | + { "type": "non_fast_forward" } |
| 125 | + ] |
| 126 | +} |
| 127 | +EOF |
| 128 | +``` |
| 129 | + |
| 130 | +Can you please write a PowerShell script I can execute that does the command and make s it so I can capture the necessary response? Write it to `temporary-prompts/ghcp-sp-95-enable-java-branch-protection.ps1`. |
| 131 | + |
| 132 | +### 10:55 Response |
| 133 | + |
| 134 | +Created [](file:///e%3A/workareas/copilot-sdk-java-00/temporary-prompts/ghcp-sp-95-enable-java-branch-protection.ps1) |
| 135 | + |
| 136 | +Created at ghcp-sp-95-enable-java-branch-protection.ps1. It pipes the JSON payload to `gh api`, parses the response to extract the ruleset ID, and prints the exact DELETE command you'd need to revert. |
| 137 | + |
| 138 | +Made changes. |
| 139 | + |
| 140 | +### 10:54 Prompt |
| 141 | + |
| 142 | +Here is the output |
| 143 | + |
| 144 | +``` |
| 145 | +Ruleset created successfully. |
| 146 | + Name: ghcp-sp-95-java-branch-protection |
| 147 | + ID: 16552308 |
| 148 | +
|
| 149 | +To revert this change: |
| 150 | + gh api repos/github/copilot-sdk/rulesets/16552308 -X DELETE |
| 151 | +``` |
| 152 | + |
| 153 | +### 20:00 Response |
| 154 | + |
| 155 | +Phase 1 is complete. Here's a summary: |
| 156 | + |
| 157 | +Phase 1 Complete ✅ |
| 158 | + |
| 159 | +Two commits made on edburns/80-java-monorepo-add-01: |
| 160 | + |
| 161 | +1. 446547c — Copied all Java SDK source files into java/ (src, pom.xml, config, scripts, docs, mvnw, etc.) |
| 162 | +2. f0aebe7 — Updated pom.xml to use local monorepo test harness instead of git clone: |
| 163 | + - Removed antrun git-clone plugin entirely |
| 164 | + - Changed copilot.sdk.clone.dir to ${project.basedir}/.. (monorepo root) |
| 165 | + - Updated <scm> URLs to github/copilot-sdk |
| 166 | + - Updated comments to reflect monorepo layout |
| 167 | + |
| 168 | +Verification: mvn clean verify passes — BUILD SUCCESS (9 min, all tests green). |
| 169 | + |
| 170 | +## dd-2989720-move-to-monorepo |
| 171 | + |
| 172 | +The file `80-java-monorepo-add-01-remove-before-merge\dd-2989727-move-java-to-monorepo-plan.md` is a high-level plan for migrating the code in `..\copilot-sdk-java-00` (source), which is a local clone of https://github.com/github/copilot-sdk-java , to reside in the `java` directory within `copilot-sdk-00` (dest), which is a local clone of https://github.com/github/copilot-sdk . |
| 173 | + |
| 174 | +Read the whole thing now. |
| 175 | + |
| 176 | +Next, I want the agent to handle "Phase 1: Copy Source Code (No Workflows Yet)". Note that the markdown strikethrough steps have already been completed. |
| 177 | + |
| 178 | +Next, write out a fully detailed prompt sufficient to feed to an agent with `copilot --yolo` to instruct the agent to do Phase 1. |
| 179 | + |
| 180 | +- ✅✅✅ Assume copilot will be invoked in `copilot-sdk-00` (dest) and that `..\copilot-sdk-java-00` is the correct relative path for the source. |
| 181 | +- ✅✅✅ Tell the agent about the paths. |
| 182 | +- ✅✅✅ Tell the agent it is safe to do the work in the current topic branch, making fine-grained commits with reasonable commit log messages. |
| 183 | +- Tell the agent to read `80-java-monorepo-add-01-remove-before-merge\dd-2989727-move-java-to-monorepo-plan.md` first. |
| 184 | +- ❌❌❌ Tell the agent to not do any other phases. |
| 185 | + |
| 186 | +Write the prompt to the file `80-java-monorepo-add-01-remove-before-merge\dd-2997995.md`. |
0 commit comments