@coderook/cli 0.10.0 → 0.10.1

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.
@@ -116,12 +116,21 @@ async function cancelMerge(mergeTrackId) {
116
116
  async function aiAccess(repositoryId) {
117
117
  const body = await call(`/v1/repositories/${encodeURIComponent(repositoryId)}`);
118
118
  const project = (body.repository ?? body);
119
- const read = (key) => project[key] !== false;
119
+ /*
120
+ Read from the nested object the service actually sends, not from flat
121
+ fields beside it. Writing uses `aiRead`; reading returns `ai.read`, and
122
+ binding to the write shape made every setting report as allowed — a
123
+ missing field is not false, so a project with reading switched off said
124
+ it was on. The asymmetry is the API's; the mistake was assuming it away
125
+ rather than looking.
126
+ */
127
+ const ai = (project.ai ?? {});
128
+ const allowed = (key) => ai[key] !== false;
120
129
  return {
121
- aiRead: read("aiRead"),
122
- aiDownload: read("aiDownload"),
123
- aiContribute: read("aiContribute"),
124
- aiRequest: read("aiRequest"),
130
+ aiRead: allowed("read"),
131
+ aiDownload: allowed("download"),
132
+ aiContribute: allowed("contribute"),
133
+ aiRequest: allowed("request"),
125
134
  };
126
135
  }
127
136
  /**
@@ -165,8 +174,14 @@ async function issues(repositoryId) {
165
174
  };
166
175
  }
167
176
  async function createIssue(repositoryId, input) {
177
+ /*
178
+ The number comes back at the top level, not nested under an `issue` key.
179
+ Reading the wrong shape reported every new issue as #0 — harmless in
180
+ itself, and exactly the kind of small wrongness that makes somebody stop
181
+ trusting the rest of the output.
182
+ */
168
183
  const created = await call(`/v1/repositories/${encodeURIComponent(repositoryId)}/issues`, { method: "POST", body: { title: input.title, body: input.body ?? "" } });
169
- return { number: Number(created.issue?.number ?? 0) };
184
+ return { number: Number(created.number ?? 0) };
170
185
  }
171
186
  async function releases(repositoryId) {
172
187
  const body = await call(`/v1/repositories/${encodeURIComponent(repositoryId)}/releases`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coderook/cli",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "CodeRook from the command line, on any operating system",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "homepage": "https://coderook.com",