@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.
- package/dist/cli/src/api.js +21 -6
- package/package.json +1 -1
package/dist/cli/src/api.js
CHANGED
|
@@ -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
|
-
|
|
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:
|
|
122
|
-
aiDownload:
|
|
123
|
-
aiContribute:
|
|
124
|
-
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.
|
|
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`);
|