@idea1/cli 1.9.1 → 1.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/README.md +123 -66
- package/dist/cli/named-lists.d.ts +1 -1
- package/dist/cli/named-lists.d.ts.map +1 -1
- package/dist/cli/named-lists.js +18 -2
- package/dist/cli/named-lists.js.map +1 -1
- package/dist/cli/parser.d.ts +3 -2
- package/dist/cli/parser.d.ts.map +1 -1
- package/dist/cli/parser.js +4 -3
- package/dist/cli/parser.js.map +1 -1
- package/dist/cli/resolver.d.ts +3 -0
- package/dist/cli/resolver.d.ts.map +1 -1
- package/dist/cli/resolver.js +41 -36
- package/dist/cli/resolver.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +15 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/approve-pr.d.ts.map +1 -1
- package/dist/commands/approve-pr.js +2 -54
- package/dist/commands/approve-pr.js.map +1 -1
- package/dist/commands/help.d.ts.map +1 -1
- package/dist/commands/help.js +11 -6
- package/dist/commands/help.js.map +1 -1
- package/dist/commands/index.d.ts +2 -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/join-project-item.d.ts.map +1 -1
- package/dist/commands/join-project-item.js +31 -12
- package/dist/commands/join-project-item.js.map +1 -1
- package/dist/commands/next-workflow-step.d.ts.map +1 -1
- package/dist/commands/next-workflow-step.js +1 -0
- package/dist/commands/next-workflow-step.js.map +1 -1
- package/dist/commands/ready-for-approval.d.ts.map +1 -1
- package/dist/commands/ready-for-approval.js +7 -67
- package/dist/commands/ready-for-approval.js.map +1 -1
- package/dist/commands/release.d.ts.map +1 -1
- package/dist/commands/release.js +7 -9
- package/dist/commands/release.js.map +1 -1
- package/dist/commands/ship-local-changes.d.ts +2 -0
- package/dist/commands/ship-local-changes.d.ts.map +1 -1
- package/dist/commands/ship-local-changes.js +30 -5
- package/dist/commands/ship-local-changes.js.map +1 -1
- package/dist/commands/start-agent-implementation.d.ts.map +1 -1
- package/dist/commands/start-agent-implementation.js +4 -1
- package/dist/commands/start-agent-implementation.js.map +1 -1
- package/dist/commands/start-dev-implementation.d.ts.map +1 -1
- package/dist/commands/start-dev-implementation.js +1 -0
- package/dist/commands/start-dev-implementation.js.map +1 -1
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +6 -3
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/url-handler.d.ts +5 -0
- package/dist/commands/url-handler.d.ts.map +1 -0
- package/dist/commands/url-handler.js +38 -0
- package/dist/commands/url-handler.js.map +1 -0
- package/dist/jobs/targets.d.ts +6 -1
- package/dist/jobs/targets.d.ts.map +1 -1
- package/dist/jobs/targets.js +12 -8
- package/dist/jobs/targets.js.map +1 -1
- package/dist/lib/claude-options.d.ts +47 -34
- package/dist/lib/claude-options.d.ts.map +1 -1
- package/dist/lib/claude-options.js +95 -82
- package/dist/lib/claude-options.js.map +1 -1
- package/dist/lib/claude-sessions.generated.d.ts +25 -0
- package/dist/lib/claude-sessions.generated.d.ts.map +1 -0
- package/dist/lib/claude-sessions.generated.js +16 -0
- package/dist/lib/claude-sessions.generated.js.map +1 -0
- package/dist/lib/settings.d.ts +10 -4
- package/dist/lib/settings.d.ts.map +1 -1
- package/dist/lib/settings.js +45 -15
- package/dist/lib/settings.js.map +1 -1
- package/dist/prompts/platform-prompts.d.ts +2 -0
- package/dist/prompts/platform-prompts.d.ts.map +1 -1
- package/dist/prompts/platform-prompts.js +9 -4
- package/dist/prompts/platform-prompts.js.map +1 -1
- package/dist/prompts/project-item-prompts.d.ts +3 -12
- package/dist/prompts/project-item-prompts.d.ts.map +1 -1
- package/dist/prompts/project-item-prompts.js +3 -18
- package/dist/prompts/project-item-prompts.js.map +1 -1
- package/dist/services/claude.d.ts +12 -7
- package/dist/services/claude.d.ts.map +1 -1
- package/dist/services/claude.js +7 -4
- package/dist/services/claude.js.map +1 -1
- package/dist/services/config.d.ts +5 -0
- package/dist/services/config.d.ts.map +1 -1
- package/dist/services/config.js +9 -0
- package/dist/services/config.js.map +1 -1
- package/dist/services/git.d.ts +5 -0
- package/dist/services/git.d.ts.map +1 -1
- package/dist/services/git.js +15 -3
- package/dist/services/git.js.map +1 -1
- package/dist/services/github.d.ts +25 -7
- package/dist/services/github.d.ts.map +1 -1
- package/dist/services/github.js +23 -9
- package/dist/services/github.js.map +1 -1
- package/dist/services/os-launcher.d.ts +29 -0
- package/dist/services/os-launcher.d.ts.map +1 -0
- package/dist/services/os-launcher.js +104 -0
- package/dist/services/os-launcher.js.map +1 -0
- package/dist/services/platform.d.ts +17 -3
- package/dist/services/platform.d.ts.map +1 -1
- package/dist/services/platform.js +79 -7
- package/dist/services/platform.js.map +1 -1
- package/dist/services/repository-registry.d.ts +11 -0
- package/dist/services/repository-registry.d.ts.map +1 -0
- package/dist/services/repository-registry.js +43 -0
- package/dist/services/repository-registry.js.map +1 -0
- package/dist/services/setup.d.ts.map +1 -1
- package/dist/services/setup.js +21 -1
- package/dist/services/setup.js.map +1 -1
- package/dist/services/url-handler.d.ts +23 -0
- package/dist/services/url-handler.d.ts.map +1 -0
- package/dist/services/url-handler.js +236 -0
- package/dist/services/url-handler.js.map +1 -0
- package/dist/services/worktree.d.ts +1 -19
- package/dist/services/worktree.d.ts.map +1 -1
- package/dist/services/worktree.js +0 -34
- package/dist/services/worktree.js.map +1 -1
- package/dist/types/index.d.ts +27 -25
- package/dist/types/index.d.ts.map +1 -1
- package/dist/workflow/data/project-item.d.ts +4 -0
- package/dist/workflow/data/project-item.d.ts.map +1 -1
- package/dist/workflow/data/team-member.d.ts +14 -0
- package/dist/workflow/data/team-member.d.ts.map +1 -0
- package/dist/workflow/data/team-member.js +2 -0
- package/dist/workflow/data/team-member.js.map +1 -0
- package/dist/workflow/data/workflow-context.d.ts +1 -1
- package/dist/workflow/data/workflow-states.d.ts +11 -2
- package/dist/workflow/data/workflow-states.d.ts.map +1 -1
- package/dist/workflow/data/workflow-states.generated.d.ts +17 -0
- package/dist/workflow/data/workflow-states.generated.d.ts.map +1 -1
- package/dist/workflow/data/workflow-states.generated.js +41 -0
- package/dist/workflow/data/workflow-states.generated.js.map +1 -1
- package/dist/workflow/data/workflow-states.js +21 -1
- package/dist/workflow/data/workflow-states.js.map +1 -1
- package/dist/workflow/engine/agent-session.d.ts +16 -0
- package/dist/workflow/engine/agent-session.d.ts.map +1 -0
- package/dist/workflow/engine/agent-session.js +109 -0
- package/dist/workflow/engine/agent-session.js.map +1 -0
- package/dist/workflow/engine/approval-flow.d.ts +39 -5
- package/dist/workflow/engine/approval-flow.d.ts.map +1 -1
- package/dist/workflow/engine/approval-flow.js +156 -2
- package/dist/workflow/engine/approval-flow.js.map +1 -1
- package/dist/workflow/engine/handlers/agent-implementation.d.ts +5 -4
- package/dist/workflow/engine/handlers/agent-implementation.d.ts.map +1 -1
- package/dist/workflow/engine/handlers/agent-implementation.js +13 -19
- package/dist/workflow/engine/handlers/agent-implementation.js.map +1 -1
- package/dist/workflow/engine/handlers/dev-implementation.js +1 -1
- package/dist/workflow/engine/handlers/dev-implementation.js.map +1 -1
- package/dist/workflow/engine/handlers/ready-for-approval.d.ts +7 -6
- package/dist/workflow/engine/handlers/ready-for-approval.d.ts.map +1 -1
- package/dist/workflow/engine/handlers/ready-for-approval.js +17 -19
- package/dist/workflow/engine/handlers/ready-for-approval.js.map +1 -1
- package/dist/workflow/engine/release-engine.d.ts +16 -5
- package/dist/workflow/engine/release-engine.d.ts.map +1 -1
- package/dist/workflow/engine/release-engine.js +81 -9
- package/dist/workflow/engine/release-engine.js.map +1 -1
- package/dist/workflow/engine/ship-flow.d.ts +15 -4
- package/dist/workflow/engine/ship-flow.d.ts.map +1 -1
- package/dist/workflow/engine/ship-flow.js +80 -21
- package/dist/workflow/engine/ship-flow.js.map +1 -1
- package/dist/workflow/engine/workflow-engine.d.ts +52 -16
- package/dist/workflow/engine/workflow-engine.d.ts.map +1 -1
- package/dist/workflow/engine/workflow-engine.js +146 -31
- package/dist/workflow/engine/workflow-engine.js.map +1 -1
- package/package.json +1 -1
|
@@ -31,4 +31,45 @@ export const LEGACY_WORKFLOW_STATE_ALIASES = {
|
|
|
31
31
|
'pr needs approval': 'Needs Approval for Release',
|
|
32
32
|
'complete': 'Approved and Merged',
|
|
33
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* The entry point prompts an agent session can start with in each workflow state, used for a
|
|
36
|
+
* state the repository's .idea1/settings.json configures no entry points for.
|
|
37
|
+
*/
|
|
38
|
+
export const DEFAULT_ENTRY_POINTS = {
|
|
39
|
+
'Build Spec in Progress': [
|
|
40
|
+
{ name: "Write the spec", template: "Help me write the spec for the Idea1 project item {{projectItemUrl}}, which is in its \"{{workflowStatus}}\" step. Read its context with get_item_context_for_workflow_state." },
|
|
41
|
+
],
|
|
42
|
+
'Refinement - Build Spec': [
|
|
43
|
+
{ name: "Refine the spec", template: "Refine the spec of the Idea1 project item {{projectItemUrl}}, which is in its \"{{workflowStatus}}\" step. Read its context with get_item_context_for_workflow_state." },
|
|
44
|
+
],
|
|
45
|
+
'Refinement - Implementation': [
|
|
46
|
+
{ name: "Refine the implementation", template: "Refine the implementation of the Idea1 project item {{projectItemUrl}}, which is in its \"{{workflowStatus}}\" step. Read its context with get_item_context_for_workflow_state." },
|
|
47
|
+
],
|
|
48
|
+
'Ready for Agent Implementation': [
|
|
49
|
+
{ name: "Implement", template: "Implement the Idea1 project item {{projectItemUrl}}. Read its context with get_item_context_for_workflow_state." },
|
|
50
|
+
],
|
|
51
|
+
'Agent Implementation': [
|
|
52
|
+
{ name: "Implement", template: "Implement the Idea1 project item {{projectItemUrl}}. Read its context with get_item_context_for_workflow_state." },
|
|
53
|
+
],
|
|
54
|
+
'Dev Implementation': [
|
|
55
|
+
{ name: "Continue the implementation", template: "Continue implementing the Idea1 project item {{projectItemUrl}} on this branch. Read its context with get_item_context_for_workflow_state." },
|
|
56
|
+
],
|
|
57
|
+
'Needs Approval for Release': [
|
|
58
|
+
{ name: "Review the PR", template: "Review the pull request for the Idea1 project item {{projectItemUrl}} against its spec. Read its context with get_item_context_for_workflow_state." },
|
|
59
|
+
{ name: "Address PR feedback", template: "Address the review feedback on the pull request for the Idea1 project item {{projectItemUrl}}. Read its context with get_item_context_for_workflow_state." },
|
|
60
|
+
],
|
|
61
|
+
'Approved and Merged': [
|
|
62
|
+
{ name: "Follow up", template: "Follow up on the Idea1 project item {{projectItemUrl}}, which is merged. Read its context with get_item_context_for_workflow_state." },
|
|
63
|
+
],
|
|
64
|
+
'Released': [
|
|
65
|
+
{ name: "Follow up", template: "Follow up on the Idea1 project item {{projectItemUrl}}, which is released. Read its context with get_item_context_for_workflow_state." },
|
|
66
|
+
],
|
|
67
|
+
};
|
|
68
|
+
/** Whether entering a state takes a teammate assignment for the item; a state not listed takes none. */
|
|
69
|
+
export const WORKFLOW_ASSIGNMENT_ON_ENTRY = {
|
|
70
|
+
'Build Spec in Progress': 'optional',
|
|
71
|
+
'Refinement - Implementation': 'optional',
|
|
72
|
+
'Ready for Agent Implementation': 'optional',
|
|
73
|
+
'Needs Approval for Release': 'required',
|
|
74
|
+
};
|
|
34
75
|
//# sourceMappingURL=workflow-states.generated.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-states.generated.js","sourceRoot":"","sources":["../../../src/workflow/data/workflow-states.generated.ts"],"names":[],"mappings":"AAAA,mFAAmF;AAEnF,+CAA+C;AAC/C,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,wBAAwB;IACxB,yBAAyB;IACzB,6BAA6B;IAC7B,gCAAgC;IAChC,sBAAsB;IACtB,oBAAoB;IACpB,4BAA4B;IAC5B,qBAAqB;IACrB,UAAU;CACF,CAAC;AAIX,8CAA8C;AAC9C,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,mBAAmB,EAAE,wBAAwB;IAC7C,mBAAmB,EAAE,yBAAyB;IAC9C,wBAAwB,EAAE,6BAA6B;IACvD,2BAA2B,EAAE,gCAAgC;IAC7D,mBAAmB,EAAE,sBAAsB;IAC3C,iBAAiB,EAAE,oBAAoB;IACvC,uBAAuB,EAAE,4BAA4B;IACrD,iBAAiB,EAAE,qBAAqB;IACxC,QAAQ,EAAE,UAAU;CACZ,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAA4C;IACpF,mBAAmB,EAAE,4BAA4B;IACjD,UAAU,EAAE,qBAAqB;CAClC,CAAC"}
|
|
1
|
+
{"version":3,"file":"workflow-states.generated.js","sourceRoot":"","sources":["../../../src/workflow/data/workflow-states.generated.ts"],"names":[],"mappings":"AAAA,mFAAmF;AAEnF,+CAA+C;AAC/C,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,wBAAwB;IACxB,yBAAyB;IACzB,6BAA6B;IAC7B,gCAAgC;IAChC,sBAAsB;IACtB,oBAAoB;IACpB,4BAA4B;IAC5B,qBAAqB;IACrB,UAAU;CACF,CAAC;AAIX,8CAA8C;AAC9C,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,mBAAmB,EAAE,wBAAwB;IAC7C,mBAAmB,EAAE,yBAAyB;IAC9C,wBAAwB,EAAE,6BAA6B;IACvD,2BAA2B,EAAE,gCAAgC;IAC7D,mBAAmB,EAAE,sBAAsB;IAC3C,iBAAiB,EAAE,oBAAoB;IACvC,uBAAuB,EAAE,4BAA4B;IACrD,iBAAiB,EAAE,qBAAqB;IACxC,QAAQ,EAAE,UAAU;CACZ,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAA4C;IACpF,mBAAmB,EAAE,4BAA4B;IACjD,UAAU,EAAE,qBAAqB;CAClC,CAAC;AAQF;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAiE;IAChG,wBAAwB,EAAE;QACxB,EAAE,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,+KAA+K,EAAE;KACtN;IACD,yBAAyB,EAAE;QACzB,EAAE,IAAI,EAAE,iBAAiB,EAAE,QAAQ,EAAE,uKAAuK,EAAE;KAC/M;IACD,6BAA6B,EAAE;QAC7B,EAAE,IAAI,EAAE,2BAA2B,EAAE,QAAQ,EAAE,iLAAiL,EAAE;KACnO;IACD,gCAAgC,EAAE;QAChC,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,iHAAiH,EAAE;KACnJ;IACD,sBAAsB,EAAE;QACtB,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,iHAAiH,EAAE;KACnJ;IACD,oBAAoB,EAAE;QACpB,EAAE,IAAI,EAAE,6BAA6B,EAAE,QAAQ,EAAE,4IAA4I,EAAE;KAChM;IACD,4BAA4B,EAAE;QAC5B,EAAE,IAAI,EAAE,eAAe,EAAE,QAAQ,EAAE,oJAAoJ,EAAE;QACzL,EAAE,IAAI,EAAE,qBAAqB,EAAE,QAAQ,EAAE,2JAA2J,EAAE;KACvM;IACD,qBAAqB,EAAE;QACrB,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,qIAAqI,EAAE;KACvK;IACD,UAAU,EAAE;QACV,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,uIAAuI,EAAE;KACzK;CACF,CAAC;AAQF,wGAAwG;AACxG,MAAM,CAAC,MAAM,4BAA4B,GAA6F;IACpI,wBAAwB,EAAE,UAAU;IACpC,6BAA6B,EAAE,UAAU;IACzC,gCAAgC,EAAE,UAAU;IAC5C,4BAA4B,EAAE,UAAU;CACzC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WORKFLOW_STATES, LEGACY_WORKFLOW_STATE_ALIASES } from './workflow-states.generated.js';
|
|
1
|
+
import { WORKFLOW_STATES, LEGACY_WORKFLOW_STATE_ALIASES, WORKFLOW_ASSIGNMENT_ON_ENTRY } from './workflow-states.generated.js';
|
|
2
2
|
export { WORKFLOW_STATES, WorkflowStates, LEGACY_WORKFLOW_STATE_ALIASES } from './workflow-states.generated.js';
|
|
3
3
|
/**
|
|
4
4
|
* Workflow states in the order they are reached
|
|
@@ -57,4 +57,24 @@ export function getWorkflowStatesBetween(from, to) {
|
|
|
57
57
|
export function isStateAtOrAfter(state, targetState) {
|
|
58
58
|
return WORKFLOW_STATE_ORDER.indexOf(state) >= WORKFLOW_STATE_ORDER.indexOf(targetState);
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Whether entering a state takes a teammate assignment for the item.
|
|
62
|
+
*/
|
|
63
|
+
export function getStateAssignmentRequirement(state) {
|
|
64
|
+
return WORKFLOW_ASSIGNMENT_ON_ENTRY[state] ?? 'none';
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Whether moving from `from` to `to` takes a teammate assignment: the strongest requirement among the
|
|
68
|
+
* states entered on the way. Moving back or staying takes none.
|
|
69
|
+
*/
|
|
70
|
+
export function getAssignmentRequirement(from, to) {
|
|
71
|
+
if (from !== null && isStateAtOrAfter(from, to)) {
|
|
72
|
+
return 'none';
|
|
73
|
+
}
|
|
74
|
+
const requirements = getWorkflowStatesBetween(from, to).map(getStateAssignmentRequirement);
|
|
75
|
+
if (requirements.includes('required')) {
|
|
76
|
+
return 'required';
|
|
77
|
+
}
|
|
78
|
+
return requirements.includes('optional') ? 'optional' : 'none';
|
|
79
|
+
}
|
|
60
80
|
//# sourceMappingURL=workflow-states.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-states.js","sourceRoot":"","sources":["../../../src/workflow/data/workflow-states.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,6BAA6B,
|
|
1
|
+
{"version":3,"file":"workflow-states.js","sourceRoot":"","sources":["../../../src/workflow/data/workflow-states.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,6BAA6B,EAC7B,4BAA4B,EAG7B,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,C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js';
|
|
2
|
+
import type { WorkflowContext } from '../data/workflow-context.js';
|
|
3
|
+
import type { WorkflowState } from '../data/workflow-states.js';
|
|
4
|
+
/**
|
|
5
|
+
* Start a Claude session for the project item whose branch is checked out at `workingPath`, in
|
|
6
|
+
* workflow state `state`, then print the directory and next-step hints.
|
|
7
|
+
*/
|
|
8
|
+
export declare function startAgentSession(projectItemUrl: string, context: WorkflowContext, state: WorkflowState, workingPath: string, session: ClaudeSessionSettings): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* The entry points a session in `state` can start from, as choices: each by name, then none.
|
|
11
|
+
*/
|
|
12
|
+
export declare function entryPointChoices(state: WorkflowState): Promise<Array<{
|
|
13
|
+
label: string;
|
|
14
|
+
value: string;
|
|
15
|
+
}>>;
|
|
16
|
+
//# sourceMappingURL=agent-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-session.d.ts","sourceRoot":"","sources":["../../../src/workflow/engine/agent-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,qBAAqB,EAA4B,MAAM,6BAA6B,CAAC;AAOnH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAehE;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,aAAa,EACpB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAsBf;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAM9G"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { NO_ENTRY_POINT } from '../../lib/claude-options.js';
|
|
2
|
+
import { getEntryPointPrompts } from '../../lib/settings.js';
|
|
3
|
+
import { projectItemPromptModel, renderEntryPointPrompt } from '../../prompts/project-item-prompts.js';
|
|
4
|
+
import * as claude from '../../services/claude.js';
|
|
5
|
+
import * as git from '../../services/git.js';
|
|
6
|
+
import * as osLauncher from '../../services/os-launcher.js';
|
|
7
|
+
import { printWorkingDirectoryHints } from '../../services/worktree.js';
|
|
8
|
+
/**
|
|
9
|
+
* Starting a Claude session on a project item's branch: the one place the CLI starts a session that
|
|
10
|
+
* works on an item's code, whether the item just entered Agent Implementation or someone joins it
|
|
11
|
+
* in whatever state it is in. The session starts from one of the state's entry point prompts (the
|
|
12
|
+
* repository's, else the built-in ones), from a template given for the session, or from no prompt;
|
|
13
|
+
* a prompt is rendered against the item's branch context. The entry point mode says where the
|
|
14
|
+
* session runs: in this terminal, in Claude Desktop, as a prompt handed to the Claude session that
|
|
15
|
+
* ran the CLI, or nowhere.
|
|
16
|
+
*/
|
|
17
|
+
/** Per-session Claude settings that make a terminal session visible in Claude Desktop. */
|
|
18
|
+
const DESKTOP_REMOTE_CONTROL_SETTINGS = JSON.stringify({ remoteControlAtStartup: true });
|
|
19
|
+
/**
|
|
20
|
+
* Start a Claude session for the project item whose branch is checked out at `workingPath`, in
|
|
21
|
+
* workflow state `state`, then print the directory and next-step hints.
|
|
22
|
+
*/
|
|
23
|
+
export async function startAgentSession(projectItemUrl, context, state, workingPath, session) {
|
|
24
|
+
if (session.claudeEntryPointMode !== 'none') {
|
|
25
|
+
const template = await entryPointTemplate(state, session.entryPoint);
|
|
26
|
+
const prompt = template === null
|
|
27
|
+
? null
|
|
28
|
+
: renderEntryPointPrompt(projectItemPromptModel(projectItemUrl, context, workingPath), template);
|
|
29
|
+
if (session.claudeEntryPointMode === 'inline') {
|
|
30
|
+
outputInlinePrompt(projectItemUrl, workingPath, prompt);
|
|
31
|
+
}
|
|
32
|
+
else if (session.claudeEntryPointMode === 'desktop') {
|
|
33
|
+
await startInDesktop(workingPath, prompt, session);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
await claude.runInteractive(prompt ?? undefined, {
|
|
37
|
+
cwd: workingPath,
|
|
38
|
+
permissionMode: session.permissionMode,
|
|
39
|
+
model: session.model,
|
|
40
|
+
effort: session.effort
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
printWorkingDirectoryHints(workingPath);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The entry points a session in `state` can start from, as choices: each by name, then none.
|
|
48
|
+
*/
|
|
49
|
+
export async function entryPointChoices(state) {
|
|
50
|
+
const entryPoints = await getEntryPointPrompts(await git.getMainRepoRoot(), state);
|
|
51
|
+
return [
|
|
52
|
+
...entryPoints.map(entryPoint => ({ label: entryPoint.name, value: entryPoint.name })),
|
|
53
|
+
{ label: 'None - start Claude with no prompt', value: NO_ENTRY_POINT }
|
|
54
|
+
];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The template a session starts from; null for no prompt. Settings are read from the main
|
|
58
|
+
* repository, where `settings.local.json` lives, so a developer's override applies in worktrees too.
|
|
59
|
+
*/
|
|
60
|
+
async function entryPointTemplate(state, selection) {
|
|
61
|
+
if (selection.kind === 'none') {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
if (selection.kind === 'template') {
|
|
65
|
+
return selection.template;
|
|
66
|
+
}
|
|
67
|
+
const entryPoints = await getEntryPointPrompts(await git.getMainRepoRoot(), state);
|
|
68
|
+
const entryPoint = entryPoints.find(candidate => candidate.name === selection.name);
|
|
69
|
+
if (!entryPoint) {
|
|
70
|
+
const names = entryPoints.map(candidate => `"${candidate.name}"`).join(', ');
|
|
71
|
+
throw new Error(`"${state}" has no entry point named "${selection.name}". Its entry points are ${names}, or ${NO_ENTRY_POINT}.`);
|
|
72
|
+
}
|
|
73
|
+
return entryPoint.template;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Start the session in Claude Desktop. Desktop has no per-session model or effort: with neither
|
|
77
|
+
* chosen, Desktop opens a new local session on the working directory with the prompt; with either
|
|
78
|
+
* chosen, Desktop is brought up and the session runs in this terminal with that model and effort,
|
|
79
|
+
* set to show in Desktop.
|
|
80
|
+
*/
|
|
81
|
+
async function startInDesktop(workingPath, prompt, session) {
|
|
82
|
+
if (session.model === null && session.effort === null) {
|
|
83
|
+
const query = prompt === null ? '' : `&q=${encodeURIComponent(prompt)}`;
|
|
84
|
+
await osLauncher.openUrl(`claude://code/new?folder=${encodeURIComponent(workingPath)}${query}`);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
await osLauncher.openUrl('claude://');
|
|
88
|
+
await claude.runInteractive(prompt ?? undefined, {
|
|
89
|
+
cwd: workingPath,
|
|
90
|
+
model: session.model,
|
|
91
|
+
effort: session.effort,
|
|
92
|
+
settings: DESKTOP_REMOTE_CONTROL_SETTINGS
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Output the entry point prompt as structured output for an already-running Claude session.
|
|
97
|
+
*/
|
|
98
|
+
function outputInlinePrompt(projectItemUrl, workingPath, prompt) {
|
|
99
|
+
const output = {
|
|
100
|
+
type: 'idea1-cli-prompt',
|
|
101
|
+
projectItemUrl,
|
|
102
|
+
worktreePath: workingPath,
|
|
103
|
+
prompt,
|
|
104
|
+
instructions: 'Work on the project item in the worktree at the specified path, starting from the prompt above when there is one.'
|
|
105
|
+
};
|
|
106
|
+
// Output as JSON for Claude to parse from the tool result
|
|
107
|
+
console.log(JSON.stringify(output, null, 2));
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=agent-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-session.js","sourceRoot":"","sources":["../../../src/workflow/engine/agent-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAwD,MAAM,6BAA6B,CAAC;AACnH,OAAO,EAAE,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AC,CAAC;AAC/C,CAAC"}
|
|
@@ -1,17 +1,33 @@
|
|
|
1
1
|
import type { CommandOption, PrInfo } from '../../types/index.js';
|
|
2
|
+
import type { TeamMember } from '../data/team-member.js';
|
|
2
3
|
/**
|
|
3
4
|
* Stage 1 of change management as it applies to a branch and its PR
|
|
4
5
|
* (change-management-policy.md clause 2): the PR gets its assignee - the approver of record -
|
|
5
|
-
* and the assignee approves by merging it once the required CI/CD checks pass.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* and the assignee approves by merging it once the required CI/CD checks pass. The approver is a
|
|
7
|
+
* teammate, named by email: the team member a project item is assigned to, whose linked GitHub
|
|
8
|
+
* account is the PR's assignee. Used by the workflow handlers for a project item's branch and by
|
|
9
|
+
* `ready-for-approval` / `approve-pr` for a branch with no project item (an integration branch,
|
|
10
|
+
* for instance). Nothing here reads or writes the item's workflow context on idea1.ai; that stays
|
|
11
|
+
* with the workflow engine.
|
|
9
12
|
*/
|
|
13
|
+
/**
|
|
14
|
+
* The teammate a project item is assigned to by a transition that takes an assignment, named by
|
|
15
|
+
* their email address or their linked GitHub login. Never asked by the option resolver: the engine asks for it when the transition
|
|
16
|
+
* enters a state that takes one, offering "none" where the assignment is optional and defaulting to
|
|
17
|
+
* the item's current assignee. On the way into Needs Approval for Release the teammate is also the
|
|
18
|
+
* pull request's assignee, through their linked GitHub account.
|
|
19
|
+
*/
|
|
20
|
+
export declare const assigneeOption: CommandOption;
|
|
21
|
+
/**
|
|
22
|
+
* The GitHub login of the teammate who approves a change, for assigning the pull request: their
|
|
23
|
+
* linked GitHub account, which an approver needs.
|
|
24
|
+
*/
|
|
25
|
+
export declare function approverGitHubLogin(approver: TeamMember): string;
|
|
10
26
|
export interface ReadyForApprovalInput {
|
|
11
27
|
branchName: string;
|
|
12
28
|
/** The branch the PR targets. */
|
|
13
29
|
baseBranch: string;
|
|
14
|
-
/** The approver of record. A PR with no assignee has no approver (clause 2). */
|
|
30
|
+
/** The approver of record, as a GitHub login. A PR with no assignee has no approver (clause 2). */
|
|
15
31
|
assignee: string;
|
|
16
32
|
/** The raw `--reviewers` value: comma separated, possibly empty. */
|
|
17
33
|
reviewers: string;
|
|
@@ -58,4 +74,22 @@ export interface CleanUpMergedBranchInput {
|
|
|
58
74
|
* brought up to date with the merge wherever it is.
|
|
59
75
|
*/
|
|
60
76
|
export declare function cleanUpMergedBranch(input: CleanUpMergedBranchInput): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* The teammate who approves a branch with no project item, as the `assignee` option (their email or
|
|
79
|
+
* GitHub login): asked from the team's members when not supplied. There is no item to assign; the
|
|
80
|
+
* teammate's linked GitHub account becomes the PR's assignee.
|
|
81
|
+
*/
|
|
82
|
+
export declare function resolveApproverForBranch(options: Record<string, string>): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Stage 1 for a branch with no project item - an integration branch carrying approved work items,
|
|
85
|
+
* for instance: the PR into the base branch is opened when the branch has none, with the approval
|
|
86
|
+
* chain of what it carries as its body, and gets its assignee. No workflow status is recorded.
|
|
87
|
+
*/
|
|
88
|
+
export declare function readyForApprovalOnBranchWithNoItem(branchName: string, resolved: Record<string, string>): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Stage 1 approval for a branch with no project item: the assignee merges the branch's PR once
|
|
91
|
+
* the required checks pass (no override), then the branch is cleaned up. No workflow status is
|
|
92
|
+
* recorded. The branch need not be checked out - the assignee can approve from anywhere.
|
|
93
|
+
*/
|
|
94
|
+
export declare function approvePrOnBranchWithNoItem(branchName: string, confirmed: boolean): Promise<void>;
|
|
61
95
|
//# sourceMappingURL=approval-flow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approval-flow.d.ts","sourceRoot":"","sources":["../../../src/workflow/engine/approval-flow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3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IG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAIxF;AAwED;;;;GAIG;AACH,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAS7F;AAED;;;;GAIG;AACH,wBAAsB,kCAAkC,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAmD5H;AAcD;;;;GAIG;AACH,wBAAsB,2BAA2B,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAqDvG"}
|
|
@@ -1,9 +1,46 @@
|
|
|
1
1
|
import { logger } from '../../lib/logger.js';
|
|
2
|
-
import { promptConfirm } from '../../lib/prompt.js';
|
|
2
|
+
import { promptConfirm, promptInput, promptSelect } from '../../lib/prompt.js';
|
|
3
|
+
import { readBranchSettings } from '../../lib/settings.js';
|
|
3
4
|
import * as git from '../../services/git.js';
|
|
4
5
|
import * as github from '../../services/github.js';
|
|
6
|
+
import * as platform from '../../services/platform.js';
|
|
7
|
+
import * as worktree from '../../services/worktree.js';
|
|
5
8
|
import { removeCurrentWorktree, resolveBaseBranch } from '../../services/worktree.js';
|
|
6
|
-
import { CHANGE_KIND, createGatedPr } from './release-engine.js';
|
|
9
|
+
import { CHANGE_KIND, confirmApproverIdentity, createGatedPr, validateSourceBranch } from './release-engine.js';
|
|
10
|
+
/**
|
|
11
|
+
* Stage 1 of change management as it applies to a branch and its PR
|
|
12
|
+
* (change-management-policy.md clause 2): the PR gets its assignee - the approver of record -
|
|
13
|
+
* and the assignee approves by merging it once the required CI/CD checks pass. The approver is a
|
|
14
|
+
* teammate, named by email: the team member a project item is assigned to, whose linked GitHub
|
|
15
|
+
* account is the PR's assignee. Used by the workflow handlers for a project item's branch and by
|
|
16
|
+
* `ready-for-approval` / `approve-pr` for a branch with no project item (an integration branch,
|
|
17
|
+
* for instance). Nothing here reads or writes the item's workflow context on idea1.ai; that stays
|
|
18
|
+
* with the workflow engine.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* The teammate a project item is assigned to by a transition that takes an assignment, named by
|
|
22
|
+
* their email address or their linked GitHub login. Never asked by the option resolver: the engine asks for it when the transition
|
|
23
|
+
* enters a state that takes one, offering "none" where the assignment is optional and defaulting to
|
|
24
|
+
* the item's current assignee. On the way into Needs Approval for Release the teammate is also the
|
|
25
|
+
* pull request's assignee, through their linked GitHub account.
|
|
26
|
+
*/
|
|
27
|
+
export const assigneeOption = {
|
|
28
|
+
longName: 'assignee',
|
|
29
|
+
shortName: 'a',
|
|
30
|
+
description: 'Teammate to assign the item to, by email or GitHub login - entering Needs Approval for Release, the assignee approves the PR by merging it',
|
|
31
|
+
choices: 'team-members',
|
|
32
|
+
dependsOn: () => false
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* The GitHub login of the teammate who approves a change, for assigning the pull request: their
|
|
36
|
+
* linked GitHub account, which an approver needs.
|
|
37
|
+
*/
|
|
38
|
+
export function approverGitHubLogin(approver) {
|
|
39
|
+
if (!approver.gitHubUsername) {
|
|
40
|
+
throw new Error(`${approver.email} has no linked GitHub account; link it in Idea1 to be assigned pull requests.`);
|
|
41
|
+
}
|
|
42
|
+
return approver.gitHubUsername;
|
|
43
|
+
}
|
|
7
44
|
/**
|
|
8
45
|
* The PR that carries the change, with its assignee and any requested reviewers set. A PR that has
|
|
9
46
|
* to be created gets the approval chain of what the branch carries as its body.
|
|
@@ -157,4 +194,121 @@ async function deleteBranchQuietly(branchName, deleteRemote) {
|
|
|
157
194
|
logger.dim(`Note: Branch ${branchName} may have been automatically deleted after merge`);
|
|
158
195
|
}
|
|
159
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* The teammate who approves a branch with no project item, as the `assignee` option (their email or
|
|
199
|
+
* GitHub login): asked from the team's members when not supplied. There is no item to assign; the
|
|
200
|
+
* teammate's linked GitHub account becomes the PR's assignee.
|
|
201
|
+
*/
|
|
202
|
+
export async function resolveApproverForBranch(options) {
|
|
203
|
+
if ((options[assigneeOption.longName] ?? '').trim().length > 0) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
const members = await platform.listTeamMembers();
|
|
207
|
+
options[assigneeOption.longName] = await promptSelect('Assign to a teammate (the assignee approves the pull request)', members.map(member => ({ label: member.email, value: member.email })));
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Stage 1 for a branch with no project item - an integration branch carrying approved work items,
|
|
211
|
+
* for instance: the PR into the base branch is opened when the branch has none, with the approval
|
|
212
|
+
* chain of what it carries as its body, and gets its assignee. No workflow status is recorded.
|
|
213
|
+
*/
|
|
214
|
+
export async function readyForApprovalOnBranchWithNoItem(branchName, resolved) {
|
|
215
|
+
await github.ensureGitHubCli();
|
|
216
|
+
await resolveApproverForBranch(resolved);
|
|
217
|
+
const approver = approverGitHubLogin(await platform.resolveTeammate(resolved[assigneeOption.longName]));
|
|
218
|
+
const existingPr = await github.getPrInfo(branchName);
|
|
219
|
+
const openPr = existingPr && existingPr.state.toUpperCase() === 'OPEN' ? existingPr : null;
|
|
220
|
+
const requestedBase = resolved['base-branch'] || null;
|
|
221
|
+
const targetBranch = openPr?.baseRefName ?? requestedBase ?? await worktree.resolveBaseBranch();
|
|
222
|
+
if (openPr?.baseRefName && requestedBase && openPr.baseRefName !== requestedBase) {
|
|
223
|
+
logger.warning(`PR #${openPr.number} targets ${openPr.baseRefName}; --base-branch ${requestedBase} is ignored. Retarget the PR in GitHub if that is wrong.`);
|
|
224
|
+
}
|
|
225
|
+
if (branchName === targetBranch) {
|
|
226
|
+
throw new Error(`${targetBranch} is the branch changes are approved into, not a change to approve. Pass --target <the branch, item or PR to approve>.`);
|
|
227
|
+
}
|
|
228
|
+
const releaseTargetBranch = (await readBranchSettings(await git.getRepoRoot())).releaseTargetBranch;
|
|
229
|
+
if (targetBranch === releaseTargetBranch) {
|
|
230
|
+
throw new Error(`A change is approved into ${await worktree.resolveBaseBranch()}, never straight into ${releaseTargetBranch}; ` +
|
|
231
|
+
'use idea1 release for that (change-management-policy.md clause 2).');
|
|
232
|
+
}
|
|
233
|
+
logger.header(`Ready for approval: ${branchName} -> ${targetBranch}`);
|
|
234
|
+
logger.info('This branch has no project item, so no workflow status is recorded.');
|
|
235
|
+
logger.newline();
|
|
236
|
+
if (!await git.fetchRemoteBranch(branchName)) {
|
|
237
|
+
throw new Error(`Branch ${branchName} is not on origin. Push it first: git push -u origin ${branchName}`);
|
|
238
|
+
}
|
|
239
|
+
// A local checkout of the branch (the working directory, once the target is resolved) must
|
|
240
|
+
// carry exactly what origin has; a branch with no checkout here is what origin has.
|
|
241
|
+
if (await git.getCheckoutPathForBranch(branchName)) {
|
|
242
|
+
await validateSourceBranch(branchName);
|
|
243
|
+
}
|
|
244
|
+
const title = openPr ? '' : (resolved['title'] || await promptPrTitle(branchName));
|
|
245
|
+
await ensurePrReadyForApproval({
|
|
246
|
+
branchName,
|
|
247
|
+
baseBranch: targetBranch,
|
|
248
|
+
assignee: approver,
|
|
249
|
+
reviewers: resolved['reviewers'] ?? '',
|
|
250
|
+
createWhenMissing: openPr ? null : { title }
|
|
251
|
+
});
|
|
252
|
+
logger.newline();
|
|
253
|
+
logger.success('PR is ready for approval');
|
|
254
|
+
logger.hint(`The assignee approves it by running: idea1 approve-pr --target ${branchName} (which merges it)`);
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* The PR title, defaulting to `Integration <name> <date>` for an integration branch and to the
|
|
258
|
+
* branch name otherwise.
|
|
259
|
+
*/
|
|
260
|
+
async function promptPrTitle(branchName) {
|
|
261
|
+
const integrationBranches = await worktree.listExistingIntegrationBranches();
|
|
262
|
+
const defaultTitle = integrationBranches.includes(branchName)
|
|
263
|
+
? `Integration ${await worktree.extractIntegrationName(branchName)} ${new Date().toISOString().split('T')[0]}`
|
|
264
|
+
: branchName;
|
|
265
|
+
return promptInput('Enter PR title:', { default: defaultTitle });
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Stage 1 approval for a branch with no project item: the assignee merges the branch's PR once
|
|
269
|
+
* the required checks pass (no override), then the branch is cleaned up. No workflow status is
|
|
270
|
+
* recorded. The branch need not be checked out - the assignee can approve from anywhere.
|
|
271
|
+
*/
|
|
272
|
+
export async function approvePrOnBranchWithNoItem(branchName, confirmed) {
|
|
273
|
+
await github.ensureGitHubCli();
|
|
274
|
+
// Captured before anything moves: cleanup may switch branches or remove a worktree.
|
|
275
|
+
const workingPath = await git.getCheckoutPathForBranch(branchName);
|
|
276
|
+
const prInfo = await github.getPrInfo(branchName);
|
|
277
|
+
if (!prInfo) {
|
|
278
|
+
throw new Error(`No PR found for ${branchName}. Run idea1 ready-for-approval --target ${branchName} first to open it and name its approver.`);
|
|
279
|
+
}
|
|
280
|
+
logger.info(`PR #${prInfo.number} found`);
|
|
281
|
+
const state = prInfo.state.toUpperCase();
|
|
282
|
+
if (state === 'CLOSED') {
|
|
283
|
+
throw new Error(`PR #${prInfo.number} is closed without being merged; there is nothing to approve.`);
|
|
284
|
+
}
|
|
285
|
+
const baseBranch = prInfo.baseRefName ?? await worktree.resolveBaseBranch();
|
|
286
|
+
const releaseTargetBranch = (await readBranchSettings(await git.getRepoRoot())).releaseTargetBranch;
|
|
287
|
+
if (baseBranch === releaseTargetBranch) {
|
|
288
|
+
throw new Error(`PR #${prInfo.number} targets ${releaseTargetBranch}: that is a release, not a change to approve. ` +
|
|
289
|
+
'Use idea1 release for it (change-management-policy.md clause 2).');
|
|
290
|
+
}
|
|
291
|
+
logger.header(`Approve: ${branchName} -> ${baseBranch}`);
|
|
292
|
+
logger.info('This branch has no project item, so no workflow status is recorded.');
|
|
293
|
+
logger.newline();
|
|
294
|
+
if (state === 'MERGED') {
|
|
295
|
+
logger.dim(`PR #${prInfo.number} is already merged; cleaning up the branch.`);
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
if (workingPath) {
|
|
299
|
+
await git.ensureBranchUpToDate();
|
|
300
|
+
}
|
|
301
|
+
// Merging retires the branch, which would orphan any PR still targeting it.
|
|
302
|
+
const openPrsInto = await github.listOpenPrsInto(branchName);
|
|
303
|
+
if (openPrsInto.length > 0) {
|
|
304
|
+
const list = openPrsInto.map(pr => ` #${pr.number} ${pr.headRefName} ${pr.title}`).join('\n');
|
|
305
|
+
throw new Error(`${openPrsInto.length} open PR(s) still target ${branchName}; approve or close them before approving this branch:\n${list}`);
|
|
306
|
+
}
|
|
307
|
+
await confirmApproverIdentity(branchName);
|
|
308
|
+
await mergeAsApprover({ branchName, baseBranch, prNumber: prInfo.number, confirmed });
|
|
309
|
+
}
|
|
310
|
+
await cleanUpMergedBranch({ branchName, baseBranch, workingPath });
|
|
311
|
+
logger.newline();
|
|
312
|
+
logger.success(`PR merged into ${baseBranch} - the merge is the recorded approval`);
|
|
313
|
+
}
|
|
160
314
|
//# sourceMappingURL=approval-flow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approval-flow.js","sourceRoot":"","sources":["../../../src/workflow/engine/approval-flow.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,GAAG,MAAM,uBAAuB,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AA0BjE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,KAA4B;IACzE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,KA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AC,CAAC;IAEnE,MAAM,CAAC,OAAO,EAAE,CAAC;IACjB,MAAM,CAAC,OAAO,CAAC,kBAAkB,UAAU,uCAAuC,CAAC,CAAC;AACtF,CAAC"}
|
|
@@ -2,10 +2,11 @@ import { type WorkflowStateHandler } from '../workflow-engine.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* Entering "Agent Implementation": make sure the branch is checked out locally
|
|
4
4
|
* (worktree or main repo, per the isolation mode), then — once the state is
|
|
5
|
-
* recorded —
|
|
6
|
-
*
|
|
7
|
-
* transition that starts code-writing automation. Work that is
|
|
8
|
-
* has no branch to implement on, so re-entering the state then
|
|
5
|
+
* recorded — start a Claude session to implement the item from one of the
|
|
6
|
+
* state's entry point prompts, rendered against the item's branch context. This
|
|
7
|
+
* is the only transition that starts code-writing automation. Work that is
|
|
8
|
+
* already merged has no branch to implement on, so re-entering the state then
|
|
9
|
+
* does nothing.
|
|
9
10
|
*/
|
|
10
11
|
export declare const agentImplementationHandler: WorkflowStateHandler;
|
|
11
12
|
//# sourceMappingURL=agent-implementation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-implementation.d.ts","sourceRoot":"","sources":["../../../../src/workflow/engine/handlers/agent-implementation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agent-implementation.d.ts","sourceRoot":"","sources":["../../../../src/workflow/engine/handlers/agent-implementation.ts"],"names":[],"mappings":"AAKA,OAAO,EAA2E,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE3I;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,EAAE,oBA+BxC,CAAC"}
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import { isolationModeOption } from '../../../lib/isolation.js';
|
|
2
2
|
import { claudeEntryPointOption, claudeEntryPointPromptOptions, claudeSessionOptions, resolveClaudeSessionOptions } from '../../../lib/claude-options.js';
|
|
3
|
-
import { projectItemPromptModel, renderAgentImplementationPrompt } from '../../../prompts/project-item-prompts.js';
|
|
4
|
-
import * as worktree from '../../../services/worktree.js';
|
|
5
3
|
import { WorkflowStates } from '../../data/workflow-states.js';
|
|
6
4
|
import { logger } from '../../../lib/logger.js';
|
|
5
|
+
import { startAgentSession } from '../agent-session.js';
|
|
7
6
|
import { ensureWorkingPath, isWorkMerged, requireLiveContext, requireWorkingPath } from '../workflow-engine.js';
|
|
8
7
|
/**
|
|
9
8
|
* Entering "Agent Implementation": make sure the branch is checked out locally
|
|
10
9
|
* (worktree or main repo, per the isolation mode), then — once the state is
|
|
11
|
-
* recorded —
|
|
12
|
-
*
|
|
13
|
-
* transition that starts code-writing automation. Work that is
|
|
14
|
-
* has no branch to implement on, so re-entering the state then
|
|
10
|
+
* recorded — start a Claude session to implement the item from one of the
|
|
11
|
+
* state's entry point prompts, rendered against the item's branch context. This
|
|
12
|
+
* is the only transition that starts code-writing automation. Work that is
|
|
13
|
+
* already merged has no branch to implement on, so re-entering the state then
|
|
14
|
+
* does nothing.
|
|
15
15
|
*/
|
|
16
16
|
export const agentImplementationHandler = {
|
|
17
17
|
state: WorkflowStates.AgentImplementation,
|
|
18
|
-
options: [
|
|
18
|
+
options: [
|
|
19
|
+
isolationModeOption,
|
|
20
|
+
claudeEntryPointOption('launch'),
|
|
21
|
+
...claudeSessionOptions,
|
|
22
|
+
...claudeEntryPointPromptOptions('agent-implementation-entry-points')
|
|
23
|
+
],
|
|
19
24
|
async prepare(transition) {
|
|
20
25
|
if (isWorkMerged(transition)) {
|
|
21
26
|
logger.dim('The item\'s work is already merged; nothing to do.');
|
|
@@ -27,18 +32,7 @@ export const agentImplementationHandler = {
|
|
|
27
32
|
if (isWorkMerged(transition)) {
|
|
28
33
|
return;
|
|
29
34
|
}
|
|
30
|
-
|
|
31
|
-
const workingPath = requireWorkingPath(transition, 'run the implementation session');
|
|
32
|
-
const { permissionMode, model, effort, claudeEntryPointMode, entryPointPrompt } = resolveClaudeSessionOptions(transition.options);
|
|
33
|
-
const prompt = await renderAgentImplementationPrompt(projectItemPromptModel(transition.projectItemUrl, context, workingPath), entryPointPrompt);
|
|
34
|
-
await worktree.launchClaudeForBranch(workingPath, {
|
|
35
|
-
projectItemUrl: transition.projectItemUrl,
|
|
36
|
-
prompt,
|
|
37
|
-
permissionMode,
|
|
38
|
-
model,
|
|
39
|
-
effort,
|
|
40
|
-
claudeEntryPointMode
|
|
41
|
-
});
|
|
35
|
+
await startAgentSession(transition.projectItemUrl, requireLiveContext(transition), WorkflowStates.AgentImplementation, requireWorkingPath(transition, 'run the implementation session'), resolveClaudeSessionOptions(transition.options));
|
|
42
36
|
}
|
|
43
37
|
};
|
|
44
38
|
//# sourceMappingURL=agent-implementation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-implementation.js","sourceRoot":"","sources":["../../../../src/workflow/engine/handlers/agent-implementation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC1J,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"agent-implementation.js","sourceRoot":"","sources":["../../../../src/workflow/engine/handlers/agent-implementation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC1J,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAA6B,MAAM,uBAAuB,CAAC;AAE3I;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAyB;IAC9D,KAAK,EAAE,cAAc,CAAC,mBAAmB;IACzC,OAAO,EAAE;QACP,mBAAmB;QACnB,sBAAsB,CAAC,QAAQ,CAAC;QAChC,GAAG,oBAAoB;QACvB,GAAG,6BAA6B,CAAC,mCAAmC,CAAC;KACtE;IAED,KAAK,CAAC,OAAO,CAAC,UAAU;QACtB,IAAI,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC;YAC7B,MAAM,CAAC,GAAG,CAAC,oDAAoD,CAAC,CAAC;YACjE,OAAO;QACT,CAAC;QAED,MAAM,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,UAAU;QACvB,IAAI,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC;YAC7B,OAAO;QACT,CAAC;QAED,MAAM,iBAAiB,CACrB,UAAU,CAAC,cAAc,EACzB,kBAAkB,CAAC,UAAU,CAAC,EAC9B,cAAc,CAAC,mBAAmB,EAClC,kBAAkB,CAAC,UAAU,EAAE,gCAAgC,CAAC,EAChE,2BAA2B,CAAC,UAAU,CAAC,OAAO,CAAC,CAChD,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -44,7 +44,7 @@ export const devImplementationHandler = {
|
|
|
44
44
|
await removeWorktreeForWorkflowState(WorkflowStates.DevImplementation, branchName, transition.projectItemUrl, { checkoutBranchInMainRepo: false });
|
|
45
45
|
logger.newline();
|
|
46
46
|
logger.success('Transitioned to Dev Implementation');
|
|
47
|
-
logger.hint('When ready for review, run: idea1 ready-for-approval [--assignee <
|
|
47
|
+
logger.hint('When ready for review, run: idea1 ready-for-approval [--assignee <teammate email>] [--reviewers <user1,user2>]');
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
//# sourceMappingURL=dev-implementation.js.map
|