@nseng-ai/branch-context 0.1.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/package.json +48 -0
- package/src/api/index.ts +43 -0
- package/src/api/prompt-assets.ts +4 -0
- package/src/core/attach.ts +455 -0
- package/src/core/attached-plan.ts +447 -0
- package/src/core/branch-context-creation.ts +495 -0
- package/src/core/branch-memory.ts +147 -0
- package/src/core/cli.ts +98 -0
- package/src/core/constants.ts +19 -0
- package/src/core/context.ts +45 -0
- package/src/core/existing-branch-reuse.ts +230 -0
- package/src/core/index.ts +47 -0
- package/src/core/operations.ts +590 -0
- package/src/core/plan-content-slug.ts +50 -0
- package/src/core/prompt-assets.ts +14 -0
- package/src/core/prompts/branch-context-impl.md +34 -0
- package/src/core/session-artifact.ts +114 -0
- package/src/ns/command.ts +33 -0
- package/src/ns/commands/attach.ts +19 -0
- package/src/ns/commands/check.ts +18 -0
- package/src/ns/commands/delete.ts +18 -0
- package/src/ns/commands/from-plan.ts +21 -0
- package/src/ns/commands/list.ts +17 -0
- package/src/ns/commands/load.ts +19 -0
- package/src/ns/repo-local-ns-extension.ts +32 -0
- package/src/pi/enriched-plan-save.ts +551 -0
- package/src/pi/extension.ts +154 -0
- package/src/pi/from-plan-commands.ts +1243 -0
- package/src/pi/gt/upstack-impl-launch.ts +154 -0
- package/src/pi/host-types.ts +135 -0
- package/src/pi/index.ts +16 -0
- package/src/pi/options.ts +32 -0
- package/src/pi/surfaces.ts +11 -0
- package/src/testing/index.ts +258 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IMPL_BRANCH_CONTEXT_COMMAND_NAME,
|
|
3
|
+
IMPL_CURRENT_SAVED_PLAN_COMMAND_NAME,
|
|
4
|
+
} from "./surfaces.ts";
|
|
5
|
+
import {
|
|
6
|
+
WRITE_GRILLED_PLAN_COMMAND_NAME,
|
|
7
|
+
WRITE_PLAN_COMMAND_NAME,
|
|
8
|
+
registerEnrichedPlanCommandsAndTools,
|
|
9
|
+
} from "./enriched-plan-save.ts";
|
|
10
|
+
import {
|
|
11
|
+
CREATE_BRANCH_CONTEXT_COMMAND_NAME,
|
|
12
|
+
GT_UPSTACK_IMPL_COMMAND_NAME,
|
|
13
|
+
registerBranchContextCommands,
|
|
14
|
+
} from "./from-plan-commands.ts";
|
|
15
|
+
import type { BranchContextExtensionOptions, ExtensionAPI } from "./host-types.ts";
|
|
16
|
+
import { definePiSurfaceParity } from "@nseng-ai/pi/parity/extension";
|
|
17
|
+
|
|
18
|
+
export const branchContextExtensionParity = definePiSurfaceParity([
|
|
19
|
+
{
|
|
20
|
+
kind: "command",
|
|
21
|
+
surface: WRITE_PLAN_COMMAND_NAME,
|
|
22
|
+
workflow: "Write and save a reviewed implementation plan in the local plan store",
|
|
23
|
+
parity: "FULL",
|
|
24
|
+
cli: "enriched-plan exec save",
|
|
25
|
+
skill: "enriched-plan-save",
|
|
26
|
+
ownerObjective: "cross-harness-parity",
|
|
27
|
+
sourcePackage: "@nseng-ai/branch-context/pi",
|
|
28
|
+
sourceModule: "branch-context-extension",
|
|
29
|
+
notes:
|
|
30
|
+
"Pi command expands the saved-plan prompt policy and drives the same typed saved-plan file tool.",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
kind: "command",
|
|
34
|
+
surface: WRITE_GRILLED_PLAN_COMMAND_NAME,
|
|
35
|
+
workflow: "Write and save a grilled implementation plan using structured requirements UI",
|
|
36
|
+
parity: "WAIVED",
|
|
37
|
+
fallback:
|
|
38
|
+
"Use grill-me or grill-with-docs to settle requirements, then use the enriched-plan-save workflow to write the reviewed plan.",
|
|
39
|
+
ownerObjective: "cross-harness-parity",
|
|
40
|
+
sourcePackage: "@nseng-ai/branch-context/pi",
|
|
41
|
+
sourceModule: "branch-context-extension",
|
|
42
|
+
notes:
|
|
43
|
+
"Structured grill UI is Pi-native; the saved-plan storage path is accounted by write_saved_plan_file.",
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
kind: "command",
|
|
47
|
+
surface: CREATE_BRANCH_CONTEXT_COMMAND_NAME,
|
|
48
|
+
workflow: "Create an implementation branch from a saved plan and attach branch context",
|
|
49
|
+
parity: "FULL",
|
|
50
|
+
cli: "ns branch-context exec from-plan",
|
|
51
|
+
skill: "from-plan",
|
|
52
|
+
ownerObjective: "cross-harness-parity",
|
|
53
|
+
sourcePackage: "@nseng-ai/branch-context/pi",
|
|
54
|
+
sourceModule: "branch-context-extension",
|
|
55
|
+
notes:
|
|
56
|
+
"Pi command delegates to branch-context helpers for source-branch plan selection, branch creation, and attachment.",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
kind: "command",
|
|
60
|
+
surface: GT_UPSTACK_IMPL_COMMAND_NAME,
|
|
61
|
+
workflow: "Create an upstack branch context and launch a fresh implementation session",
|
|
62
|
+
parity: "WAIVED",
|
|
63
|
+
fallback:
|
|
64
|
+
"Use the from-plan skill to create the branch context, then use branch-context-impl to implement the attached plan.",
|
|
65
|
+
ownerObjective: "cross-harness-parity",
|
|
66
|
+
sourcePackage: "@nseng-ai/branch-context/pi",
|
|
67
|
+
sourceModule: "branch-context-extension",
|
|
68
|
+
notes:
|
|
69
|
+
"Branch-context creation has CLI/skill parity, but the fresh Pi implementation-session launch is Pi-specific orchestration.",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
kind: "command",
|
|
73
|
+
surface: IMPL_CURRENT_SAVED_PLAN_COMMAND_NAME,
|
|
74
|
+
workflow: "Launch a fresh current-branch implementation session from a saved plan",
|
|
75
|
+
parity: "WAIVED",
|
|
76
|
+
fallback:
|
|
77
|
+
"Manually open /new on the current branch and paste/use the saved plan content, or pass an explicit saved plan path to the Pi command when available.",
|
|
78
|
+
ownerObjective: "cross-harness-parity",
|
|
79
|
+
sourcePackage: "@nseng-ai/branch-context/pi",
|
|
80
|
+
sourceModule: "branch-context-extension",
|
|
81
|
+
notes:
|
|
82
|
+
"Saved-plan selection has capability coverage, but the fresh Pi implementation-session launch is Pi-specific orchestration.",
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
kind: "command",
|
|
86
|
+
surface: IMPL_BRANCH_CONTEXT_COMMAND_NAME,
|
|
87
|
+
workflow: "Implement from the attached branch-context plan",
|
|
88
|
+
parity: "FULL",
|
|
89
|
+
cli: "ns branch-context exec load",
|
|
90
|
+
skill: "branch-context-impl",
|
|
91
|
+
ownerObjective: "cross-harness-parity",
|
|
92
|
+
sourcePackage: "@nseng-ai/branch-context/pi",
|
|
93
|
+
sourceModule: "branch-context-extension",
|
|
94
|
+
notes:
|
|
95
|
+
"Pi command loads the attached plan and expands the portable branch-context implementation skill prompt.",
|
|
96
|
+
},
|
|
97
|
+
] as const);
|
|
98
|
+
|
|
99
|
+
export {
|
|
100
|
+
DEFAULT_WRITE_PLAN_PROMPT_BODY,
|
|
101
|
+
WRITE_GRILLED_PLAN_COMMAND_NAME,
|
|
102
|
+
WRITE_PLAN_COMMAND_NAME,
|
|
103
|
+
buildWriteGrilledPlanPrompt,
|
|
104
|
+
buildWritePlanPrompt,
|
|
105
|
+
buildWriteSavedPlanFileTool,
|
|
106
|
+
handleWriteGrilledPlanCommand,
|
|
107
|
+
handleWritePlanCommand,
|
|
108
|
+
} from "./enriched-plan-save.ts";
|
|
109
|
+
export {
|
|
110
|
+
CREATE_BRANCH_CONTEXT_COMMAND_NAME,
|
|
111
|
+
CREATE_BRANCH_CONTEXT_USAGE,
|
|
112
|
+
GT_UPSTACK_IMPL_COMMAND_NAME,
|
|
113
|
+
GT_UPSTACK_IMPL_USAGE,
|
|
114
|
+
IMPL_CURRENT_SAVED_PLAN_COMMAND_NAME,
|
|
115
|
+
IMPL_CURRENT_SAVED_PLAN_USAGE,
|
|
116
|
+
buildImplCurrentSavedPlanPrompt,
|
|
117
|
+
deriveCreateBranchContextPreview,
|
|
118
|
+
deriveImplCurrentSavedPlanPreview,
|
|
119
|
+
formatCreateBranchContextPreview,
|
|
120
|
+
formatImplCurrentSavedPlanEvidence,
|
|
121
|
+
handleCreateBranchContextCommand,
|
|
122
|
+
handleImplBranchContextCommand,
|
|
123
|
+
handleGtUpstackImplCommand,
|
|
124
|
+
handleImplCurrentSavedPlanCommand,
|
|
125
|
+
parseCreateBranchContextArgs,
|
|
126
|
+
parseImplCurrentSavedPlanArgs,
|
|
127
|
+
resolveCreateBranchContextPlanFile,
|
|
128
|
+
resolveCreateBranchContextPreview,
|
|
129
|
+
type CreateBranchContextArgs,
|
|
130
|
+
type CreateBranchContextPreview,
|
|
131
|
+
type ImplCurrentSavedPlanArgs,
|
|
132
|
+
type ImplCurrentSavedPlanPreview,
|
|
133
|
+
} from "./from-plan-commands.ts";
|
|
134
|
+
export type {
|
|
135
|
+
BranchContextExtensionOptions,
|
|
136
|
+
BranchContextOperations,
|
|
137
|
+
CommandContext,
|
|
138
|
+
CustomMessage,
|
|
139
|
+
ExtensionAPI,
|
|
140
|
+
NotifyLevel,
|
|
141
|
+
ToolContext,
|
|
142
|
+
ToolDefinition,
|
|
143
|
+
ToolRenderResultOptions,
|
|
144
|
+
ToolResult,
|
|
145
|
+
ToolUpdateHandler,
|
|
146
|
+
} from "./host-types.ts";
|
|
147
|
+
|
|
148
|
+
export default function registerBranchContextExtension(
|
|
149
|
+
pi: ExtensionAPI,
|
|
150
|
+
options: BranchContextExtensionOptions = {},
|
|
151
|
+
): void {
|
|
152
|
+
registerEnrichedPlanCommandsAndTools(pi, options);
|
|
153
|
+
registerBranchContextCommands(pi, options);
|
|
154
|
+
}
|