@idea1/cli 1.10.4 → 1.11.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.
- package/README.md +29 -6
- package/dist/commands/help.d.ts.map +1 -1
- package/dist/commands/help.js +14 -2
- package/dist/commands/help.js.map +1 -1
- package/dist/commands/index.d.ts +3 -1
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +5 -1
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/login.d.ts +3 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +15 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +3 -0
- package/dist/commands/logout.d.ts.map +1 -0
- package/dist/commands/logout.js +17 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/release.d.ts +2 -1
- package/dist/commands/release.d.ts.map +1 -1
- package/dist/commands/release.js +2 -1
- package/dist/commands/release.js.map +1 -1
- package/dist/lib/project-item-url.d.ts +6 -0
- package/dist/lib/project-item-url.d.ts.map +1 -1
- package/dist/lib/project-item-url.js +11 -0
- package/dist/lib/project-item-url.js.map +1 -1
- package/dist/lib/settings.d.ts +10 -3
- package/dist/lib/settings.d.ts.map +1 -1
- package/dist/lib/settings.js +13 -1
- package/dist/lib/settings.js.map +1 -1
- package/dist/prompts/platform-prompts.d.ts +5 -30
- package/dist/prompts/platform-prompts.d.ts.map +1 -1
- package/dist/prompts/platform-prompts.js +5 -44
- package/dist/prompts/platform-prompts.js.map +1 -1
- package/dist/services/platform-auth.d.ts +43 -0
- package/dist/services/platform-auth.d.ts.map +1 -0
- package/dist/services/platform-auth.js +380 -0
- package/dist/services/platform-auth.js.map +1 -0
- package/dist/services/platform.d.ts +23 -16
- package/dist/services/platform.d.ts.map +1 -1
- package/dist/services/platform.js +188 -190
- package/dist/services/platform.js.map +1 -1
- package/dist/services/setup.d.ts.map +1 -1
- package/dist/services/setup.js +2 -1
- package/dist/services/setup.js.map +1 -1
- package/dist/types/index.d.ts +16 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/workflow/data/team-member.d.ts +9 -2
- package/dist/workflow/data/team-member.d.ts.map +1 -1
- package/dist/workflow/data/team-member.js +8 -1
- package/dist/workflow/data/team-member.js.map +1 -1
- package/dist/workflow/engine/branch-setup.d.ts +1 -1
- package/dist/workflow/engine/branch-setup.js +1 -1
- package/dist/workflow/engine/release-engine.d.ts +6 -2
- package/dist/workflow/engine/release-engine.d.ts.map +1 -1
- package/dist/workflow/engine/release-engine.js +16 -5
- package/dist/workflow/engine/release-engine.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,68 +1,182 @@
|
|
|
1
1
|
import { logger } from '../lib/logger.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { createProjectItemPrompt, generateBranchNamePrompt, getProjectItemSummaryForBranchPrompt, getProjectItemSummaryPrompt, listProjectsPrompt, listTeamMembersPrompt, setWorkflowStatusPrompt, upsertProjectItemWorkflowContextPrompt } from '../prompts/platform-prompts.js';
|
|
2
|
+
import { projectItemExternalId } from '../lib/project-item-url.js';
|
|
3
|
+
import { generateBranchNamePrompt } from '../prompts/platform-prompts.js';
|
|
5
4
|
import * as claude from './claude.js';
|
|
5
|
+
import { apiBaseUrl, authorizedFetch } from './platform-auth.js';
|
|
6
6
|
/**
|
|
7
7
|
* The CLI's access to the Idea1 cloud platform (app.idea1.ai / api.idea1.ai): reading a project
|
|
8
8
|
* item's summary (by item or by branch), recording the item's workflow context, setting its workflow
|
|
9
9
|
* status (with the teammate it is assigned to), creating items, listing the team's Projects and
|
|
10
|
-
* members, deriving a branch name from an item
|
|
11
|
-
* nothing about the transport.
|
|
10
|
+
* members, deriving a branch name from an item, and reading who is signed in. Callers use
|
|
11
|
+
* `platform.someFunction()` and know nothing about the transport.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* `src/prompts/platform-prompts.ts`; this module owns the output schemas their answers are read with.
|
|
13
|
+
* The transport is the platform's REST API, authorized with the user's OAuth credential or
|
|
14
|
+
* `IDEA1_TOKEN` (see `platform-auth.ts`), on the team that credential is bound to. Responses are the
|
|
15
|
+
* platform's `ApiDataResponse` envelope; a refused request surfaces as an Error carrying the
|
|
16
|
+
* platform's status and message. Claude is used only to name branches, on PLATFORM_CALL_RUN_OPTIONS.
|
|
18
17
|
*/
|
|
19
18
|
/**
|
|
20
|
-
* Model and effort for
|
|
21
|
-
*
|
|
19
|
+
* Model and effort for the Claude run that names a branch: a small, fast model at medium effort is
|
|
20
|
+
* all a one-line answer from a description needs, and pinning it keeps the run consistent and cheap.
|
|
22
21
|
*/
|
|
23
22
|
export const PLATFORM_CALL_RUN_OPTIONS = { model: 'sonnet', effort: 'medium' };
|
|
24
23
|
/**
|
|
25
|
-
*
|
|
24
|
+
* The platform's `ApiResultType`, the `result` of every response envelope.
|
|
26
25
|
*/
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
var ApiResultType;
|
|
27
|
+
(function (ApiResultType) {
|
|
28
|
+
ApiResultType[ApiResultType["Ok"] = 0] = "Ok";
|
|
29
|
+
ApiResultType[ApiResultType["Failed"] = 1] = "Failed";
|
|
30
|
+
ApiResultType[ApiResultType["NotFound"] = 2] = "NotFound";
|
|
31
|
+
ApiResultType[ApiResultType["Unauthorized"] = 3] = "Unauthorized";
|
|
32
|
+
ApiResultType[ApiResultType["InvalidRequest"] = 4] = "InvalidRequest";
|
|
33
|
+
ApiResultType[ApiResultType["QuotaLimit"] = 5] = "QuotaLimit";
|
|
34
|
+
})(ApiResultType || (ApiResultType = {}));
|
|
35
|
+
/**
|
|
36
|
+
* The platform's `ProjectStatus`.
|
|
37
|
+
*/
|
|
38
|
+
var ProjectStatus;
|
|
39
|
+
(function (ProjectStatus) {
|
|
40
|
+
ProjectStatus[ProjectStatus["Live"] = 0] = "Live";
|
|
41
|
+
ProjectStatus[ProjectStatus["Completed"] = 1] = "Completed";
|
|
42
|
+
ProjectStatus[ProjectStatus["Cancelled"] = 2] = "Cancelled";
|
|
43
|
+
})(ProjectStatus || (ProjectStatus = {}));
|
|
44
|
+
/**
|
|
45
|
+
* Send a request to the platform's API, at `path` relative to the API base URL.
|
|
46
|
+
*/
|
|
47
|
+
function send(method, path, body) {
|
|
48
|
+
return authorizedFetch(`${apiBaseUrl()}/${path}`, {
|
|
49
|
+
method,
|
|
50
|
+
headers: body === null ? { Accept: 'application/json' } : { Accept: 'application/json', 'Content-Type': 'application/json' },
|
|
51
|
+
body: body === null ? undefined : JSON.stringify(body)
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The `data` of a successful response; anything else throws an Error naming the request, the
|
|
56
|
+
* status and the platform's message.
|
|
57
|
+
*/
|
|
58
|
+
async function readData(method, path, response) {
|
|
59
|
+
const text = await response.text();
|
|
60
|
+
if (!response.ok) {
|
|
61
|
+
const message = serverMessage(text);
|
|
62
|
+
throw new Error(`idea1.ai refused ${method} /${path} (${response.status} ${response.statusText})${message.length > 0 ? `: ${message}` : ''}`);
|
|
63
|
+
}
|
|
64
|
+
const envelope = JSON.parse(text);
|
|
65
|
+
if (envelope.result !== ApiResultType.Ok) {
|
|
66
|
+
throw new Error(`idea1.ai could not complete ${method} /${path}: ${ApiResultType[envelope.result]}`);
|
|
67
|
+
}
|
|
68
|
+
return envelope.data;
|
|
69
|
+
}
|
|
70
|
+
async function call(method, path, body) {
|
|
71
|
+
return readData(method, path, await send(method, path, body));
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A branch name the platform returned, checked before it reaches git: the CLI passes branch names
|
|
75
|
+
* to git as arguments, so a name that is not a plain ref (one starting with `-` would read as an
|
|
76
|
+
* option) is refused.
|
|
77
|
+
*/
|
|
78
|
+
const SAFE_BRANCH_NAME = /^(?!-)(?!.*\.\.)[A-Za-z0-9._\/-]+$/;
|
|
79
|
+
function checkedBranchName(name) {
|
|
80
|
+
if (!SAFE_BRANCH_NAME.test(name)) {
|
|
81
|
+
throw new Error(`idea1.ai returned an invalid branch name: ${JSON.stringify(name)}`);
|
|
82
|
+
}
|
|
83
|
+
return name;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* A project item URL the platform returned, checked before it is stored in git config: it must be a
|
|
87
|
+
* plain idea1.ai project item URL.
|
|
88
|
+
*/
|
|
89
|
+
const SAFE_PROJECT_ITEM_URL = /^https?:\/\/(app\.idea1\.ai|localhost(:\d+)?)\/project\/items\/\d+\/?$/i;
|
|
90
|
+
function checkedProjectItemUrl(url) {
|
|
91
|
+
if (!SAFE_PROJECT_ITEM_URL.test(url)) {
|
|
92
|
+
throw new Error(`idea1.ai returned an invalid project item URL: ${JSON.stringify(url)}`);
|
|
93
|
+
}
|
|
94
|
+
return url;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* A workflow context the platform returned, with its branch names checked. Each field is copied by
|
|
98
|
+
* name, so nothing the platform sent reaches git without passing the check.
|
|
99
|
+
*/
|
|
100
|
+
function checkedContext(context) {
|
|
101
|
+
return {
|
|
102
|
+
workflowStatus: context.workflowStatus,
|
|
103
|
+
codingAgentUrl: context.codingAgentUrl,
|
|
104
|
+
pullRequestUrl: context.pullRequestUrl,
|
|
105
|
+
repositoryFullName: context.repositoryFullName,
|
|
106
|
+
branchName: checkedBranchName(context.branchName),
|
|
107
|
+
baseBranch: checkedBranchName(context.baseBranch),
|
|
108
|
+
devWorkflowType: context.devWorkflowType,
|
|
109
|
+
stackBranch: context.stackBranch === null ? null : checkedBranchName(context.stackBranch),
|
|
110
|
+
integrationBranch: context.integrationBranch === null ? null : checkedBranchName(context.integrationBranch),
|
|
111
|
+
branchState: context.branchState
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/** A project item summary the platform returned, with its URL and the branch names of its workflow context checked. */
|
|
115
|
+
function checkedSummary(summary) {
|
|
116
|
+
return {
|
|
117
|
+
url: checkedProjectItemUrl(summary.url),
|
|
118
|
+
externalId: summary.externalId,
|
|
119
|
+
title: summary.title,
|
|
120
|
+
epicId: summary.epicId,
|
|
121
|
+
completionDate: summary.completionDate,
|
|
122
|
+
legacyWorkflowStatus: summary.legacyWorkflowStatus,
|
|
123
|
+
projectId: summary.projectId,
|
|
124
|
+
assignedToUserId: summary.assignedToUserId,
|
|
125
|
+
workflowContext: summary.workflowContext === null ? null : checkedContext(summary.workflowContext)
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
async function callForSummary(method, path, body) {
|
|
129
|
+
return checkedSummary(await call(method, path, body));
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* The message an error response carries: the `message` (or OAuth `error_description`) of a JSON
|
|
133
|
+
* body, a JSON string, or the body's text; empty for an empty body.
|
|
134
|
+
*/
|
|
135
|
+
function serverMessage(text) {
|
|
136
|
+
const trimmed = text.trim();
|
|
137
|
+
try {
|
|
138
|
+
const body = JSON.parse(trimmed);
|
|
139
|
+
if (typeof body === 'string') {
|
|
140
|
+
return body;
|
|
141
|
+
}
|
|
142
|
+
if (typeof body === 'object' && body !== null) {
|
|
143
|
+
const fields = body;
|
|
144
|
+
const message = [fields.message, fields.error_description, fields.error, fields.detail, fields.title].find(value => typeof value === 'string');
|
|
145
|
+
if (typeof message === 'string') {
|
|
146
|
+
return message;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
catch {
|
|
151
|
+
// Not JSON: the text is the message.
|
|
152
|
+
}
|
|
153
|
+
return trimmed.slice(0, 500);
|
|
29
154
|
}
|
|
30
155
|
/**
|
|
31
|
-
*
|
|
156
|
+
* The path of a project item by its URL's external id.
|
|
32
157
|
*/
|
|
33
|
-
|
|
34
|
-
return
|
|
158
|
+
function projectItemPath(itemUrl) {
|
|
159
|
+
return `v1/teams/active/project-items/by-external-id/${projectItemExternalId(itemUrl)}`;
|
|
35
160
|
}
|
|
36
161
|
/**
|
|
37
162
|
* Record workflow context updates on an idea1.ai project item directly, with no side effects on the
|
|
38
163
|
* platform: the CLI has already run the transition's work locally. The item must be under workflow
|
|
39
164
|
* management (have a workflow context); the workflow engine is the only caller, as the persist step
|
|
40
165
|
* of a transition. `assignedToEmail` names the team member the item is assigned to along with the
|
|
41
|
-
* status; null leaves the assignment as it is.
|
|
42
|
-
*
|
|
43
|
-
* TODO: Direct workflow-context updates move from the update_item MCP tool to an authenticated
|
|
44
|
-
* platform API call; the CLI will authenticate a user and call the API for direct integrations
|
|
45
|
-
* like this, and MCP tools will be only operations that agents should run.
|
|
166
|
+
* status; null leaves the assignment as it is. Returns false, with a warning, when the platform did
|
|
167
|
+
* not record it.
|
|
46
168
|
*/
|
|
47
169
|
export async function setWorkflowStatus(itemUrl, status, pullRequestUrl, assignedToEmail) {
|
|
48
|
-
const hasClaude = await claude.ensureClaudeCli();
|
|
49
|
-
if (!hasClaude) {
|
|
50
|
-
logger.warning('Claude CLI not available, skipping workflow status update');
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
170
|
logger.step(assignedToEmail === null
|
|
54
171
|
? `Setting workflow status to "${status}"...`
|
|
55
172
|
: `Setting workflow status to "${status}", assigned to ${assignedToEmail}...`);
|
|
56
173
|
try {
|
|
57
|
-
await
|
|
174
|
+
await call('PUT', `${projectItemPath(itemUrl)}/workflow-status`, { workflowStatus: status, pullRequestUrl, assignedToEmail });
|
|
58
175
|
logger.success(`Workflow status updated to "${status}"`);
|
|
59
176
|
return true;
|
|
60
177
|
}
|
|
61
178
|
catch (error) {
|
|
62
|
-
|
|
63
|
-
? `Model could not update workflow status: ${error.message}`
|
|
64
|
-
: `Could not update workflow status: ${error.message}`;
|
|
65
|
-
logger.warning(message);
|
|
179
|
+
logger.warning(`Could not update workflow status: ${error.message}`);
|
|
66
180
|
return false;
|
|
67
181
|
}
|
|
68
182
|
}
|
|
@@ -71,30 +185,21 @@ export async function setWorkflowStatus(itemUrl, status, pullRequestUrl, assigne
|
|
|
71
185
|
* management. The repository is always named; nothing defaults it.
|
|
72
186
|
*/
|
|
73
187
|
export async function getProjectItemSummaryForBranch(query) {
|
|
74
|
-
const hasClaude = await claude.ensureClaudeCli();
|
|
75
|
-
if (!hasClaude) {
|
|
76
|
-
throw new Error('Claude CLI is required to read the project item of a branch from idea1.ai');
|
|
77
|
-
}
|
|
78
188
|
logger.step(`Reading the project item of ${query.branchName} from idea1.ai...`);
|
|
79
|
-
const
|
|
80
|
-
|
|
189
|
+
const path = `v1/teams/active/project-items/for-branch?${new URLSearchParams(query).toString()}`;
|
|
190
|
+
const response = await send('GET', path, null);
|
|
191
|
+
if (response.status === 404) {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
return checkedSummary(await readData('GET', path, response));
|
|
81
195
|
}
|
|
82
196
|
/**
|
|
83
197
|
* The summary of a project item: its `workflowContext` is null while the item is outside workflow
|
|
84
198
|
* management.
|
|
85
199
|
*/
|
|
86
200
|
export async function getProjectItemSummary(itemUrl) {
|
|
87
|
-
const hasClaude = await claude.ensureClaudeCli();
|
|
88
|
-
if (!hasClaude) {
|
|
89
|
-
throw new Error('Claude CLI is required to read a project item from idea1.ai');
|
|
90
|
-
}
|
|
91
201
|
logger.step(`Reading ${itemUrl} from idea1.ai...`);
|
|
92
|
-
|
|
93
|
-
const summary = readProjectItemSummaryOutput(output, () => false);
|
|
94
|
-
if (!summary) {
|
|
95
|
-
throw new Error(`idea1.ai returned no project item for ${itemUrl}`);
|
|
96
|
-
}
|
|
97
|
-
return summary;
|
|
202
|
+
return callForSummary('GET', `${projectItemPath(itemUrl)}/summary`, null);
|
|
98
203
|
}
|
|
99
204
|
/**
|
|
100
205
|
* Record a branch in a project item's workflow context as the one implementing the item, putting
|
|
@@ -104,120 +209,46 @@ export async function getProjectItemSummary(itemUrl) {
|
|
|
104
209
|
* refused by the platform, which surfaces here as an error.
|
|
105
210
|
*/
|
|
106
211
|
export async function upsertProjectItemWorkflowContext(input) {
|
|
107
|
-
const hasClaude = await claude.ensureClaudeCli();
|
|
108
|
-
if (!hasClaude) {
|
|
109
|
-
throw new Error('Claude CLI is required to record the workflow context on idea1.ai');
|
|
110
|
-
}
|
|
111
212
|
logger.step(`Recording ${input.branchName} as the branch of ${input.projectItemUrl} on idea1.ai...`);
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
213
|
+
const summary = await callForSummary('PUT', `${projectItemPath(input.projectItemUrl)}/workflow-context`, {
|
|
214
|
+
repositoryFullName: input.repositoryFullName,
|
|
215
|
+
branchName: input.branchName,
|
|
216
|
+
baseBranch: input.baseBranch,
|
|
217
|
+
devWorkflowType: input.devWorkflowType,
|
|
218
|
+
stackBranch: input.stackBranch,
|
|
219
|
+
integrationBranch: input.integrationBranch
|
|
220
|
+
});
|
|
221
|
+
if (summary.workflowContext === null) {
|
|
115
222
|
throw new Error('The platform returned no workflow context after recording the branch');
|
|
116
223
|
}
|
|
117
224
|
return summary;
|
|
118
225
|
}
|
|
119
226
|
/**
|
|
120
|
-
*
|
|
121
|
-
* item" yields null; any other error is thrown.
|
|
122
|
-
*/
|
|
123
|
-
function readProjectItemSummaryOutput(output, isAbsence) {
|
|
124
|
-
if (typeof output.error === 'string' && output.error.trim().length > 0) {
|
|
125
|
-
if (isAbsence(output.error)) {
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
throw new Error(`idea1.ai: ${output.error.trim()}`);
|
|
129
|
-
}
|
|
130
|
-
const summary = output.projectItemSummary;
|
|
131
|
-
if (!summary || typeof summary.url !== 'string' || !isProjectItemUrl(summary.url)) {
|
|
132
|
-
throw new Error(`Claude did not return a valid project item summary: ${JSON.stringify(output.projectItemSummary)}`);
|
|
133
|
-
}
|
|
134
|
-
return summary;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* JSON schema for the project-item-summary structured output (`ProjectItemSummary` or an error).
|
|
138
|
-
*/
|
|
139
|
-
const projectItemSummaryOutputSchema = {
|
|
140
|
-
type: 'object',
|
|
141
|
-
properties: {
|
|
142
|
-
projectItemSummary: {
|
|
143
|
-
type: ['object', 'null'],
|
|
144
|
-
description: 'The project item summary the tool returned, or null when it returned an error',
|
|
145
|
-
properties: {
|
|
146
|
-
url: { type: 'string' },
|
|
147
|
-
externalId: { type: 'integer' },
|
|
148
|
-
title: { type: 'string' },
|
|
149
|
-
epicId: { type: ['string', 'null'] },
|
|
150
|
-
completionDate: { type: ['string', 'null'] },
|
|
151
|
-
legacyWorkflowStatus: { type: 'string' },
|
|
152
|
-
projectId: { type: ['string', 'null'], description: 'The Project the item is planned in; null when it is out of scope' },
|
|
153
|
-
assignedToUserId: { type: ['string', 'null'], description: 'The team member the item is assigned to; null when unassigned' },
|
|
154
|
-
workflowContext: {
|
|
155
|
-
type: ['object', 'null'],
|
|
156
|
-
properties: {
|
|
157
|
-
workflowStatus: { type: 'string' },
|
|
158
|
-
codingAgentUrl: { type: 'string' },
|
|
159
|
-
pullRequestUrl: { type: 'string' },
|
|
160
|
-
repositoryFullName: { type: 'string' },
|
|
161
|
-
branchName: { type: 'string' },
|
|
162
|
-
baseBranch: { type: 'string' },
|
|
163
|
-
devWorkflowType: { type: 'string', enum: ['independent', 'integration'] },
|
|
164
|
-
stackBranch: { type: ['string', 'null'] },
|
|
165
|
-
integrationBranch: { type: ['string', 'null'] },
|
|
166
|
-
branchState: { type: 'integer', enum: [0, 1, 2], description: '0 Live, 1 Merged, 2 Deleted' }
|
|
167
|
-
},
|
|
168
|
-
required: ['workflowStatus', 'codingAgentUrl', 'pullRequestUrl', 'repositoryFullName', 'branchName', 'baseBranch', 'devWorkflowType', 'stackBranch', 'integrationBranch', 'branchState'],
|
|
169
|
-
additionalProperties: false
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
required: ['url', 'externalId', 'title', 'epicId', 'completionDate', 'legacyWorkflowStatus', 'projectId', 'assignedToUserId', 'workflowContext'],
|
|
173
|
-
additionalProperties: false
|
|
174
|
-
},
|
|
175
|
-
error: { type: ['string', 'null'], description: 'The error the tool returned, verbatim, or null on success' }
|
|
176
|
-
},
|
|
177
|
-
required: ['projectItemSummary', 'error'],
|
|
178
|
-
additionalProperties: false
|
|
179
|
-
};
|
|
180
|
-
/**
|
|
181
|
-
* Generate a branch name from a project item description
|
|
227
|
+
* Generate a branch name from a project item's description.
|
|
182
228
|
*/
|
|
183
229
|
export async function generateBranchName(itemUrl) {
|
|
184
|
-
const hasClaude = await claude.ensureClaudeCli();
|
|
185
|
-
if (!hasClaude) {
|
|
186
|
-
throw new Error('Claude CLI is required to generate branch names');
|
|
187
|
-
}
|
|
188
230
|
logger.step('Generating branch name from item description...');
|
|
189
|
-
const
|
|
231
|
+
const item = await call('GET', projectItemPath(itemUrl), null);
|
|
232
|
+
const branchName = await claude.runWithPrompt(generateBranchNamePrompt({ description: item.description }), PLATFORM_CALL_RUN_OPTIONS);
|
|
190
233
|
// Clean up any extra whitespace/newlines
|
|
191
234
|
const cleanedName = branchName.replace(/\n/g, '').trim();
|
|
192
235
|
logger.dim(`Generated branch name: ${cleanedName}`);
|
|
193
236
|
return cleanedName;
|
|
194
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* The team's live Projects, most recently created first.
|
|
240
|
+
*/
|
|
241
|
+
async function readLiveProjects() {
|
|
242
|
+
const projects = await call('GET', 'v1/teams/active/projects', null);
|
|
243
|
+
return projects.filter(project => project.status === ProjectStatus.Live);
|
|
244
|
+
}
|
|
195
245
|
/**
|
|
196
246
|
* The names of the team's live Projects, most recently created first.
|
|
197
247
|
*/
|
|
198
248
|
export async function listProjects() {
|
|
199
249
|
logger.step('Reading the team\'s projects from idea1.ai...');
|
|
200
|
-
|
|
201
|
-
const projects = Array.isArray(output.projects)
|
|
202
|
-
? output.projects.filter((name) => typeof name === 'string' && name.trim().length > 0).map(name => name.trim())
|
|
203
|
-
: [];
|
|
204
|
-
return projects;
|
|
250
|
+
return (await readLiveProjects()).map(project => project.name);
|
|
205
251
|
}
|
|
206
|
-
/**
|
|
207
|
-
* JSON schema for the list-projects structured output.
|
|
208
|
-
*/
|
|
209
|
-
const listProjectsSchema = {
|
|
210
|
-
type: 'object',
|
|
211
|
-
properties: {
|
|
212
|
-
projects: {
|
|
213
|
-
type: 'array',
|
|
214
|
-
description: 'The names of the live Idea1 projects, most recently created first',
|
|
215
|
-
items: { type: 'string' }
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
|
-
required: ['projects'],
|
|
219
|
-
additionalProperties: false
|
|
220
|
-
};
|
|
221
252
|
let teamMembers = null;
|
|
222
253
|
/**
|
|
223
254
|
* The members of the team, read once per process: the teammates a project item can be assigned
|
|
@@ -234,11 +265,8 @@ export function listTeamMembers() {
|
|
|
234
265
|
}
|
|
235
266
|
async function readTeamMembers() {
|
|
236
267
|
logger.step('Reading the team\'s members from idea1.ai...');
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
throw new Error(`Claude did not return the team's members: ${JSON.stringify(output.members)}`);
|
|
240
|
-
}
|
|
241
|
-
return output.members.map(member => ({
|
|
268
|
+
const members = await call('GET', 'v1/teams/active/members', null);
|
|
269
|
+
return members.map(member => ({
|
|
242
270
|
userId: member.userId,
|
|
243
271
|
email: member.email.trim(),
|
|
244
272
|
role: member.role,
|
|
@@ -260,55 +288,25 @@ export async function resolveTeammate(identity) {
|
|
|
260
288
|
return teammate;
|
|
261
289
|
}
|
|
262
290
|
/**
|
|
263
|
-
*
|
|
264
|
-
*/
|
|
265
|
-
const listTeamMembersSchema = {
|
|
266
|
-
type: 'object',
|
|
267
|
-
properties: {
|
|
268
|
-
members: {
|
|
269
|
-
type: 'array',
|
|
270
|
-
description: 'The team\'s members, in the order returned',
|
|
271
|
-
items: {
|
|
272
|
-
type: 'object',
|
|
273
|
-
properties: {
|
|
274
|
-
userId: { type: 'string' },
|
|
275
|
-
email: { type: 'string' },
|
|
276
|
-
role: { type: 'string' },
|
|
277
|
-
gitHubUsername: { type: ['string', 'null'], description: 'The member\'s linked GitHub login, or null when none is linked' }
|
|
278
|
-
},
|
|
279
|
-
required: ['userId', 'email', 'role', 'gitHubUsername'],
|
|
280
|
-
additionalProperties: false
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
},
|
|
284
|
-
required: ['members'],
|
|
285
|
-
additionalProperties: false
|
|
286
|
-
};
|
|
287
|
-
/**
|
|
288
|
-
* Create a new idea1 project item with the given title in the named Project.
|
|
291
|
+
* Create a new idea1 project item with the given title in the named live Project.
|
|
289
292
|
* The item is created with description `# <title>`.
|
|
290
293
|
* Returns the created item's URL.
|
|
291
294
|
*/
|
|
292
295
|
export async function createProjectItem(title, projectName) {
|
|
293
296
|
logger.step(`Creating project item "${title}" in project "${projectName}"...`);
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
throw new Error(`Claude did not return a valid project item URL: ${JSON.stringify(output.projectItemUrl)}`);
|
|
297
|
+
const project = (await readLiveProjects()).find(candidate => candidate.name.trim().toLowerCase() === projectName.trim().toLowerCase());
|
|
298
|
+
if (!project) {
|
|
299
|
+
throw new Error(`The team has no live project named "${projectName}".`);
|
|
298
300
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
+
const summary = await callForSummary('POST', `v1/teams/active/projects/${project.projectId}/project-items`, { description: `# ${title}` });
|
|
302
|
+
logger.success(`Created project item: ${summary.url}`);
|
|
303
|
+
return summary.url;
|
|
301
304
|
}
|
|
302
305
|
/**
|
|
303
|
-
*
|
|
306
|
+
* The user the platform credential signs in as, and the team its calls work on.
|
|
304
307
|
*/
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
error: { type: ['string', 'null'], description: 'The error returned by create_item, or null when the item was created' }
|
|
310
|
-
},
|
|
311
|
-
required: ['projectItemUrl', 'error'],
|
|
312
|
-
additionalProperties: false
|
|
313
|
-
};
|
|
308
|
+
export async function getSignedInUser() {
|
|
309
|
+
const context = await call('GET', 'v1/user/core-application-context', null);
|
|
310
|
+
return { emailAddress: context.userContext.emailAddress, teamName: context.activeTeam.teamName };
|
|
311
|
+
}
|
|
314
312
|
//# sourceMappingURL=platform.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../../src/services/platform.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../../src/services/platform.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEjE;;;;;;;;;;;GAWG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAA+B,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAE3G;;GAEG;AACH,IAAK,aAOJ;AAPD,WAAK,aAAa;IAChB,6CAAM,CAAA;IACN,qDAAU,CAAA;IACV,yDAAY,CAAA;IACZ,iEAAgB,CAAA;IAChB,qEAAkB,CAAA;IAClB,6DAAc,CAAA;AAChB,CAAC,EAPI,aAAa,KAAb,aAAa,QAOjB;AAUD;;GAEG;AACH,IAAK,aAIJ;AAJD,WAAK,aAAa;IAChB,iDAAQ,CAAA;IACR,2DAAa,CAAA;IACb,2DAAa,CAAA;AACf,CAAC,EAJI,aAAa,KAAb,aAAa,QAIjB;AAyCD;;GAEG;AACH,SAAS,IAAI,CAAC,MAAkB,EAAE,IAAY,EAAE,IAAmB;IACjE,OAAO,eAAe,CAAC,GAAG,UAAU,EAAE,IAAI,IAAI,EAAE,EAAE;QAChD,MAAM;QACN,OAAO,EAAE,IAAI,KAAK,I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sources":["../../src/services/setup.ts"],"names":[],"mappings":"AA0IA;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAmBnD;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBjE"}
|
package/dist/services/setup.js
CHANGED
|
@@ -87,7 +87,7 @@ A state's entries replace that state's built-in ones. Each entry has a \`name\`
|
|
|
87
87
|
|
|
88
88
|
### release (optional)
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
How changes may reach the release branch, and the packages \`idea1 release\` can version. Before the release PR is opened, every versioned
|
|
91
91
|
package whose folder changed since the last release (and whose version has not moved yet) gets
|
|
92
92
|
a version bump: its \`package.json\` version, and the lockfiles above it, are updated and
|
|
93
93
|
committed to the release branch by \`idea1 release\` itself (the Idea1 web app makes the same
|
|
@@ -95,6 +95,7 @@ bump). Without this section a release has no version bump step.
|
|
|
95
95
|
|
|
96
96
|
| Property | Description |
|
|
97
97
|
|----------|-------------|
|
|
98
|
+
| \`releaseBranchChanges\` | How changes may reach the release branch: \`approved-only\` (default; every change arrives through its own approved change, and a release carrying a direct commit is refused until a repository admin records why) or \`direct-allowed\` (direct commits are carried and listed in the release PR for its approver to review) |
|
|
98
99
|
| \`versionedPackages\` | The packages a release can bump: \`name\` (used by \`--bumps\`), \`label\` (shown in prompts) and \`path\` (the folder holding the package's \`package.json\`) |
|
|
99
100
|
|
|
100
101
|
\`\`\`json
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/services/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxF,OAAO,EAAE,IA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,CAAC;IAChE,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QAC/B,aAAa,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC;QAChD,MAAM,CAAC,IAAI,CAAC,WAAW,SAAS,IAAI,cAAc,8CAA8C,SAAS,+BAA+B,CAAC,CAAC;QAC1I,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,YAAY,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACrD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9D,MAAM,OAAO,GAAG,iBAAiB,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1E,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO;IACT,CAAC;IAED,cAAc,CAAC,aAAa,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,+BAA+B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1H,MAAM,CAAC,IAAI,CAAC,SAAS,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,SAAS,IAAI,cAAc,uBAAuB,CAAC,CAAC;AACpG,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -108,6 +108,20 @@ export interface VersionedPackage {
|
|
|
108
108
|
/** The package's folder, relative to the repo root; it holds the package's package.json. */
|
|
109
109
|
path: string;
|
|
110
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* How changes may reach the release branch (`defaults.baseBranch`), the branch a planned release is cut from.
|
|
113
|
+
* A workflow-level policy: it says what the workflow accepts, not which repository host feature enforces it.
|
|
114
|
+
*
|
|
115
|
+
* - `approved-only`: every change reaches the release branch through its own approved change. A commit
|
|
116
|
+
* made directly on the branch stops a release until a repository admin records why it was made there.
|
|
117
|
+
* - `direct-allowed`: a change may also be made directly on the release branch. A release carries such a
|
|
118
|
+
* commit and lists it for its approver to review, with no admin and no recorded reason.
|
|
119
|
+
*
|
|
120
|
+
* The release target branch (`defaults.releaseTargetBranch`) is not configurable: it only ever changes
|
|
121
|
+
* through a release, never directly.
|
|
122
|
+
*/
|
|
123
|
+
export type ReleaseBranchChanges = 'approved-only' | 'direct-allowed';
|
|
124
|
+
export declare const RELEASE_BRANCH_CHANGES: readonly ReleaseBranchChanges[];
|
|
111
125
|
/**
|
|
112
126
|
* Idea1 settings from .idea1/settings.json, overlaid with .idea1/settings.local.json
|
|
113
127
|
*/
|
|
@@ -145,6 +159,8 @@ export interface Idea1Settings {
|
|
|
145
159
|
* bumps those whose folder changed since the last release, before the release PR is opened.
|
|
146
160
|
*/
|
|
147
161
|
versionedPackages?: VersionedPackage[];
|
|
162
|
+
/** How changes may reach the release branch (default `approved-only`). */
|
|
163
|
+
releaseBranchChanges?: ReleaseBranchChanges;
|
|
148
164
|
};
|
|
149
165
|
}
|
|
150
166
|
/**
|