agentblueprint 0.6.23 → 0.6.24
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/directives.d.ts +11 -0
- package/dist/directives.js +17 -0
- package/dist/directives.js.map +1 -0
- package/dist/download.js +17 -72
- package/dist/download.js.map +1 -1
- package/dist/fetch-blueprint.d.ts +21 -0
- package/dist/fetch-blueprint.js +74 -0
- package/dist/fetch-blueprint.js.map +1 -0
- package/dist/tools/download-blueprint.js +13 -70
- package/dist/tools/download-blueprint.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-download directives for the coding agent.
|
|
3
|
+
*
|
|
4
|
+
* SINGLE SOURCE OF TRUTH. Both the CLI (download.ts) and MCP tool
|
|
5
|
+
* (download-blueprint.ts) use these. If you need to change the
|
|
6
|
+
* directive text, change it here and both paths get it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getNextActionDirective(opts: {
|
|
9
|
+
hasImplementationState: boolean;
|
|
10
|
+
vendorSkillName?: string;
|
|
11
|
+
}): string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-download directives for the coding agent.
|
|
3
|
+
*
|
|
4
|
+
* SINGLE SOURCE OF TRUTH. Both the CLI (download.ts) and MCP tool
|
|
5
|
+
* (download-blueprint.ts) use these. If you need to change the
|
|
6
|
+
* directive text, change it here and both paths get it.
|
|
7
|
+
*/
|
|
8
|
+
export function getNextActionDirective(opts) {
|
|
9
|
+
if (opts.hasImplementationState) {
|
|
10
|
+
return 'ACTION REQUIRED NOW: Read CURRENT-STATE.md for where things stand, then RECOMMENDATIONS.md for what to do next. You are continuing an implementation. Do not ask the user what to do — read the files and resume working.';
|
|
11
|
+
}
|
|
12
|
+
if (opts.vendorSkillName) {
|
|
13
|
+
return `ACTION REQUIRED NOW: Read GETTING-STARTED.md immediately, then load the expert skill at .claude/skills/${opts.vendorSkillName}/SKILL.md. You are the implementer. Do not summarize these files to the user. Do not ask what to do next. Read them and start building.`;
|
|
14
|
+
}
|
|
15
|
+
return 'ACTION REQUIRED NOW: Read GETTING-STARTED.md immediately and start implementation. You are the implementer. Do not summarize the files to the user. Do not ask what to do next. Read and start building.';
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=directives.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directives.js","sourceRoot":"","sources":["../src/directives.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,UAAU,sBAAsB,CAAC,IAGtC;IACC,IAAI,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAChC,OAAO,2NAA2N,CAAC;IACrO,CAAC;IACD,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;QACzB,OAAO,0GAA0G,IAAI,CAAC,eAAe,yIAAyI,CAAC;IACjR,CAAC;IACD,OAAO,0MAA0M,CAAC;AACpN,CAAC"}
|
package/dist/download.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { mkdir, writeFile } from 'node:fs/promises';
|
|
2
2
|
import { join, dirname } from 'node:path';
|
|
3
3
|
import { AgentBlueprintClient } from './client.js';
|
|
4
|
-
import {
|
|
4
|
+
import { getNextActionDirective } from './directives.js';
|
|
5
|
+
import { fetchAndRenderBlueprint } from './fetch-blueprint.js';
|
|
5
6
|
export function parseDownloadArgs(args) {
|
|
6
7
|
const result = {
|
|
7
8
|
dir: '.agent-blueprint',
|
|
@@ -88,68 +89,14 @@ async function resolveId(client, input, customerOrgId) {
|
|
|
88
89
|
async function downloadBlueprint(client, blueprintId, baseDir, customerOrgId, platform) {
|
|
89
90
|
blueprintId = await resolveId(client, blueprintId, customerOrgId);
|
|
90
91
|
console.error(`Fetching blueprint ${blueprintId}...`);
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
client.getUseCase(blueprintId, customerOrgId).catch(() => null),
|
|
97
|
-
client.getBusinessProfile(customerOrgId).catch(() => null),
|
|
98
|
-
]);
|
|
99
|
-
// Fetch reality data for return visits (non-blocking)
|
|
100
|
-
const [implementationState, progress] = await Promise.all([
|
|
101
|
-
client.getImplementationState(blueprintId, customerOrgId).catch(() => null),
|
|
102
|
-
client.getProgress(blueprintId, customerOrgId).catch(() => null),
|
|
103
|
-
]);
|
|
104
|
-
const title = blueprint.data.title
|
|
105
|
-
|| blueprint.data.blueprintTitle
|
|
106
|
-
|| `Blueprint ${blueprintId.slice(0, 8)}`;
|
|
107
|
-
// Fetch vendor deployment guides and expert skills
|
|
108
|
-
const generalGuideData = await client.getVendorGuide('general');
|
|
109
|
-
let vendorGuideInput;
|
|
110
|
-
let vendorSkillInput;
|
|
111
|
-
if (platform && platform !== 'skip') {
|
|
112
|
-
// Try vendor skill first (replaces vendor guide when present)
|
|
113
|
-
const vendorSkillData = await client.getVendorSkill(platform);
|
|
114
|
-
if (vendorSkillData) {
|
|
115
|
-
vendorSkillInput = {
|
|
116
|
-
platform: vendorSkillData.platform,
|
|
117
|
-
skillName: vendorSkillData.skillName,
|
|
118
|
-
content: vendorSkillData.content,
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
// Fall back to vendor deployment guide
|
|
123
|
-
const vendorGuideData = await client.getVendorGuide(platform);
|
|
124
|
-
if (vendorGuideData) {
|
|
125
|
-
vendorGuideInput = { platform: vendorGuideData.platform, content: vendorGuideData.content };
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
console.error(`Warning: No vendor skill or guide found for platform "${platform}". Continuing without it.`);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
const input = {
|
|
133
|
-
blueprintTitle: title,
|
|
134
|
-
blueprintId,
|
|
135
|
-
blueprintData: blueprint.data,
|
|
136
|
-
businessCaseData: businessCase?.data,
|
|
137
|
-
implementationPlanData: implementationPlan?.data,
|
|
138
|
-
useCaseData: useCase,
|
|
139
|
-
businessProfileData: businessProfile ?? undefined,
|
|
140
|
-
generalGuide: generalGuideData?.content,
|
|
141
|
-
vendorGuide: vendorGuideInput,
|
|
142
|
-
vendorSkill: vendorSkillInput,
|
|
143
|
-
implementationState,
|
|
144
|
-
progress,
|
|
145
|
-
};
|
|
146
|
-
// Render
|
|
147
|
-
const files = renderSkillDirectory(input);
|
|
148
|
-
const slug = slugify(title) || 'blueprint';
|
|
149
|
-
const outDir = join(baseDir, slug);
|
|
92
|
+
const result = await fetchAndRenderBlueprint(client, blueprintId, {
|
|
93
|
+
customerOrgId,
|
|
94
|
+
platform,
|
|
95
|
+
});
|
|
96
|
+
const outDir = join(baseDir, result.slug);
|
|
150
97
|
// Write files
|
|
151
98
|
let totalSize = 0;
|
|
152
|
-
for (const [relativePath, content] of files) {
|
|
99
|
+
for (const [relativePath, content] of result.files) {
|
|
153
100
|
// Vendor skill files go to project root (not inside outDir)
|
|
154
101
|
const isSkillFile = relativePath.startsWith('.claude/skills/');
|
|
155
102
|
const fullPath = isSkillFile ? join(process.cwd(), relativePath) : join(outDir, relativePath);
|
|
@@ -160,11 +107,11 @@ async function downloadBlueprint(client, blueprintId, baseDir, customerOrgId, pl
|
|
|
160
107
|
}
|
|
161
108
|
// Summary
|
|
162
109
|
console.error('');
|
|
163
|
-
console.error(`Downloaded ${files.size} files to ${outDir}/`);
|
|
110
|
+
console.error(`Downloaded ${result.files.size} files to ${outDir}/`);
|
|
164
111
|
console.error(`Total size: ${(totalSize / 1024).toFixed(1)} KB`);
|
|
165
112
|
console.error('');
|
|
166
113
|
console.error('Files:');
|
|
167
|
-
for (const [path] of files) {
|
|
114
|
+
for (const [path] of result.files) {
|
|
168
115
|
if (path.startsWith('.claude/skills/')) {
|
|
169
116
|
console.error(` ${path} (project root)`);
|
|
170
117
|
}
|
|
@@ -172,21 +119,19 @@ async function downloadBlueprint(client, blueprintId, baseDir, customerOrgId, pl
|
|
|
172
119
|
console.error(` ${path}`);
|
|
173
120
|
}
|
|
174
121
|
}
|
|
175
|
-
if (
|
|
122
|
+
if (result.vendorSkillName) {
|
|
176
123
|
console.error('');
|
|
177
|
-
console.error(`Expert skill installed: .claude/skills/${
|
|
124
|
+
console.error(`Expert skill installed: .claude/skills/${result.vendorSkillName}/SKILL.md`);
|
|
178
125
|
console.error('Claude Code will auto-discover this skill in all future sessions.');
|
|
179
126
|
}
|
|
180
|
-
if (
|
|
127
|
+
if (result.hasImplementationState) {
|
|
181
128
|
console.error('');
|
|
182
129
|
console.error('Return visit detected: includes implementation state and/or metrics.');
|
|
183
130
|
}
|
|
184
131
|
console.error('');
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
console.error('Next: Read GETTING-STARTED.md and start implementation.');
|
|
190
|
-
}
|
|
132
|
+
console.error(getNextActionDirective({
|
|
133
|
+
hasImplementationState: result.hasImplementationState,
|
|
134
|
+
vendorSkillName: result.vendorSkillName,
|
|
135
|
+
}));
|
|
191
136
|
}
|
|
192
137
|
//# sourceMappingURL=download.js.map
|
package/dist/download.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download.js","sourceRoot":"","sources":["../src/download.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"download.js","sourceRoot":"","sources":["../src/download.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,sBAAsB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AC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACjE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAClB,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACxB,KAAK,MAAM,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QAClC,IAAI,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC;YACvC,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,iBAAiB,CAAC,CAAC;QAC5C,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IACD,IAAI,MAAM,CAAC,eAAe,EAAE,CAAC;QAC3B,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAClB,OAAO,CAAC,KAAK,CAAC,0CAA0C,MAAM,CAAC,eAAe,WAAW,CAAC,CAAC;QAC3F,OAAO,CAAC,KAAK,CAAC,mEAAmE,CAAC,CAAC;IACrF,CAAC;IACD,IAAI,MAAM,CAAC,sBAAsB,EAAE,CAAC;QAClC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAClB,OAAO,CAAC,KAAK,CAAC,sEAAsE,CAAC,CAAC;IACxF,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAClB,OAAO,CAAC,KAAK,CAAC,sBAAsB,CAAC;QACnC,sBAAsB,EAAE,MAAM,CAAC,sBAAsB;QACrD,eAAe,EAAE,MAAM,CAAC,eAAe;KACxC,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared blueprint data fetching and render input assembly.
|
|
3
|
+
*
|
|
4
|
+
* SINGLE SOURCE OF TRUTH. Both the CLI (download.ts) and MCP tool
|
|
5
|
+
* (download-blueprint.ts) use this. All data fetching, title extraction,
|
|
6
|
+
* vendor resolution, and SkillRenderInput assembly lives here.
|
|
7
|
+
*/
|
|
8
|
+
import type { AgentBlueprintClient } from './client.js';
|
|
9
|
+
import type { SkillRenderInput } from './renderers.js';
|
|
10
|
+
export interface BlueprintDownloadResult {
|
|
11
|
+
input: SkillRenderInput;
|
|
12
|
+
files: Map<string, string>;
|
|
13
|
+
slug: string;
|
|
14
|
+
title: string;
|
|
15
|
+
hasImplementationState: boolean;
|
|
16
|
+
vendorSkillName?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function fetchAndRenderBlueprint(client: AgentBlueprintClient, blueprintId: string, opts: {
|
|
19
|
+
customerOrgId?: string;
|
|
20
|
+
platform?: string;
|
|
21
|
+
}): Promise<BlueprintDownloadResult>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared blueprint data fetching and render input assembly.
|
|
3
|
+
*
|
|
4
|
+
* SINGLE SOURCE OF TRUTH. Both the CLI (download.ts) and MCP tool
|
|
5
|
+
* (download-blueprint.ts) use this. All data fetching, title extraction,
|
|
6
|
+
* vendor resolution, and SkillRenderInput assembly lives here.
|
|
7
|
+
*/
|
|
8
|
+
import { renderSkillDirectory, slugify } from './renderers.js';
|
|
9
|
+
export async function fetchAndRenderBlueprint(client, blueprintId, opts) {
|
|
10
|
+
const orgId = opts.customerOrgId;
|
|
11
|
+
// Fetch all data in parallel
|
|
12
|
+
const [blueprint, businessCase, implementationPlan, useCase, businessProfile] = await Promise.all([
|
|
13
|
+
client.getBlueprint(blueprintId, orgId),
|
|
14
|
+
client.getBusinessCase(blueprintId, orgId).catch(() => null),
|
|
15
|
+
client.getImplementationPlan(blueprintId, orgId).catch(() => null),
|
|
16
|
+
client.getUseCase(blueprintId, orgId).catch(() => null),
|
|
17
|
+
client.getBusinessProfile(orgId).catch(() => null),
|
|
18
|
+
]);
|
|
19
|
+
// Fetch reality data for return visits
|
|
20
|
+
const [implementationState, progress] = await Promise.all([
|
|
21
|
+
client.getImplementationState(blueprintId, orgId).catch(() => null),
|
|
22
|
+
client.getProgress(blueprintId, orgId).catch(() => null),
|
|
23
|
+
]);
|
|
24
|
+
// Extract title
|
|
25
|
+
const bpData = blueprint.data;
|
|
26
|
+
const title = bpData.title
|
|
27
|
+
|| bpData.blueprintTitle
|
|
28
|
+
|| `Blueprint ${blueprintId.slice(0, 8)}`;
|
|
29
|
+
// Resolve vendor deployment guides and expert skills
|
|
30
|
+
const generalGuideData = await client.getVendorGuide('general');
|
|
31
|
+
let vendorGuideInput;
|
|
32
|
+
let vendorSkillInput;
|
|
33
|
+
if (opts.platform && opts.platform !== 'skip') {
|
|
34
|
+
const vendorSkillData = await client.getVendorSkill(opts.platform);
|
|
35
|
+
if (vendorSkillData) {
|
|
36
|
+
vendorSkillInput = {
|
|
37
|
+
platform: vendorSkillData.platform,
|
|
38
|
+
skillName: vendorSkillData.skillName,
|
|
39
|
+
content: vendorSkillData.content,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
const vendorGuideData = await client.getVendorGuide(opts.platform);
|
|
44
|
+
if (vendorGuideData) {
|
|
45
|
+
vendorGuideInput = { platform: vendorGuideData.platform, content: vendorGuideData.content };
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const input = {
|
|
50
|
+
blueprintTitle: title,
|
|
51
|
+
blueprintId,
|
|
52
|
+
blueprintData: bpData,
|
|
53
|
+
businessCaseData: businessCase?.data,
|
|
54
|
+
implementationPlanData: implementationPlan?.data,
|
|
55
|
+
useCaseData: useCase,
|
|
56
|
+
businessProfileData: businessProfile ?? undefined,
|
|
57
|
+
generalGuide: generalGuideData?.content,
|
|
58
|
+
vendorGuide: vendorGuideInput,
|
|
59
|
+
vendorSkill: vendorSkillInput,
|
|
60
|
+
implementationState,
|
|
61
|
+
progress,
|
|
62
|
+
};
|
|
63
|
+
const files = renderSkillDirectory(input);
|
|
64
|
+
const slug = slugify(title) || 'blueprint';
|
|
65
|
+
return {
|
|
66
|
+
input,
|
|
67
|
+
files,
|
|
68
|
+
slug,
|
|
69
|
+
title,
|
|
70
|
+
hasImplementationState: !!implementationState,
|
|
71
|
+
vendorSkillName: vendorSkillInput?.skillName,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=fetch-blueprint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-blueprint.js","sourceRoot":"","sources":["../src/fetch-blueprint.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAY/D,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,MAA4B,EAC5B,WAAmB,EACnB,IAAmD;IAEnD,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC;IAEjC,6BAA6B;IAC7B,MAAM,CAAC,SAAS,EAAE,YAAY,EAAE,kBAAkB,EAAE,OAAO,EAAE,eAAe,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAChG,MAAM,CAAC,YAAY,CAAC,WAAW,EAAE,KAAK,CAAC;QACvC,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC;QAC5D,MAAM,CAAC,qBAAqB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC;QAClE,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC;QACvD,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC;KACnD,CAAC,CAAC;IAEH,uCAAuC;IACvC,MAAM,CAAC,mBAAmB,EAAE,QAAQ,CAAC,GAAG,MAAM,OAAO,CAAC,G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B;QAC9B,cAAc,EAAE,KAAK;QACrB,WAAW;QACX,aAAa,EAAE,MAAM;QACrB,gBAAgB,EAAE,YAAY,EAAE,IAAI;QACpC,sBAAsB,EAAE,kBAAkB,EAAE,IAAI;QAChD,WAAW,EAAE,OAA8C;QAC3D,mBAAmB,EAAG,eAAsD,IAAI,SAAS;QACzF,YAAY,EAAE,gBAAgB,EAAE,OAAO;QACvC,WAAW,EAAE,gBAAgB;QAC7B,WAAW,EAAE,gBAAgB;QAC7B,mBAAmB;QACnB,QAAQ;KACT,CAAC;IAEF,MAAM,KAAK,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC;IAE3C,OAAO;QACL,KAAK;QACL,KAAK;QACL,IAAI;QACJ,KAAK;QACL,sBAAsB,EAAE,CAAC,CAAC,mBAAmB;QAC7C,eAAe,EAAE,gBAAgB,EAAE,SAAS;KAC7C,CAAC;AACJ,CAAC"}
|
|
@@ -1,83 +1,26 @@
|
|
|
1
|
+
import { getNextActionDirective } from '../directives.js';
|
|
1
2
|
import { formatError } from '../errors.js';
|
|
2
|
-
import {
|
|
3
|
+
import { fetchAndRenderBlueprint } from '../fetch-blueprint.js';
|
|
3
4
|
export async function handleDownloadBlueprint(client, args) {
|
|
4
5
|
try {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
client.getBusinessCase(args.blueprintId, orgId).catch(() => null),
|
|
10
|
-
client.getImplementationPlan(args.blueprintId, orgId).catch(() => null),
|
|
11
|
-
client.getUseCase(args.blueprintId, orgId).catch(() => null),
|
|
12
|
-
client.getBusinessProfile(orgId).catch(() => null),
|
|
13
|
-
]);
|
|
14
|
-
// Fetch reality data for return visits (non-blocking)
|
|
15
|
-
const [implementationState, progress] = await Promise.all([
|
|
16
|
-
client.getImplementationState(args.blueprintId, orgId).catch(() => null),
|
|
17
|
-
client.getProgress(args.blueprintId, orgId).catch(() => null),
|
|
18
|
-
]);
|
|
19
|
-
const bpData = blueprint.data;
|
|
20
|
-
const title = bpData.title
|
|
21
|
-
|| bpData.blueprintTitle
|
|
22
|
-
|| `Blueprint ${args.blueprintId.slice(0, 8)}`;
|
|
23
|
-
// Fetch vendor deployment guides and expert skills
|
|
24
|
-
const generalGuideData = await client.getVendorGuide('general');
|
|
25
|
-
let vendorGuideInput;
|
|
26
|
-
let vendorSkillInput;
|
|
27
|
-
if (args.platform) {
|
|
28
|
-
// Try vendor skill first (replaces vendor guide when present)
|
|
29
|
-
const vendorSkillData = await client.getVendorSkill(args.platform);
|
|
30
|
-
if (vendorSkillData) {
|
|
31
|
-
vendorSkillInput = {
|
|
32
|
-
platform: vendorSkillData.platform,
|
|
33
|
-
skillName: vendorSkillData.skillName,
|
|
34
|
-
content: vendorSkillData.content,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
// Fall back to vendor deployment guide
|
|
39
|
-
const vendorGuideData = await client.getVendorGuide(args.platform);
|
|
40
|
-
if (vendorGuideData) {
|
|
41
|
-
vendorGuideInput = { platform: vendorGuideData.platform, content: vendorGuideData.content };
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
const input = {
|
|
46
|
-
blueprintTitle: title,
|
|
47
|
-
blueprintId: args.blueprintId,
|
|
48
|
-
blueprintData: bpData,
|
|
49
|
-
businessCaseData: businessCase?.data,
|
|
50
|
-
implementationPlanData: implementationPlan?.data,
|
|
51
|
-
useCaseData: useCase,
|
|
52
|
-
businessProfileData: businessProfile ?? undefined,
|
|
53
|
-
generalGuide: generalGuideData?.content,
|
|
54
|
-
vendorGuide: vendorGuideInput,
|
|
55
|
-
vendorSkill: vendorSkillInput,
|
|
56
|
-
implementationState,
|
|
57
|
-
progress,
|
|
58
|
-
};
|
|
59
|
-
const files = renderSkillDirectory(input);
|
|
60
|
-
const slug = slugify(title) || 'blueprint';
|
|
6
|
+
const result = await fetchAndRenderBlueprint(client, args.blueprintId, {
|
|
7
|
+
customerOrgId: args.customerOrgId,
|
|
8
|
+
platform: args.platform,
|
|
9
|
+
});
|
|
61
10
|
// Convert Map to JSON manifest
|
|
62
|
-
const fileList = Array.from(files.entries()).map(([path, content]) => ({
|
|
11
|
+
const fileList = Array.from(result.files.entries()).map(([path, content]) => ({
|
|
63
12
|
path,
|
|
64
13
|
content,
|
|
65
14
|
}));
|
|
66
15
|
const manifest = {
|
|
67
|
-
directory: slug,
|
|
16
|
+
directory: result.slug,
|
|
68
17
|
files: fileList,
|
|
69
|
-
installHint: `Write these files to .agent-blueprint/${slug}/ and any .claude/skills/ files to the project root.`,
|
|
18
|
+
installHint: `Write these files to .agent-blueprint/${result.slug}/ and any .claude/skills/ files to the project root.`,
|
|
70
19
|
};
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
else if (vendorSkillInput) {
|
|
76
|
-
nextAction = `ACTION REQUIRED NOW: Read GETTING-STARTED.md immediately, then load the expert skill at .claude/skills/${vendorSkillInput.skillName}/SKILL.md. You are the implementer. Do not summarize these files to the user. Do not ask what to do next. Read them and start building.`;
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
nextAction = 'ACTION REQUIRED NOW: Read GETTING-STARTED.md immediately and start implementation. You are the implementer. Do not summarize the files to the user. Do not ask what to do next. Read and start building.';
|
|
80
|
-
}
|
|
20
|
+
const nextAction = getNextActionDirective({
|
|
21
|
+
hasImplementationState: result.hasImplementationState,
|
|
22
|
+
vendorSkillName: result.vendorSkillName,
|
|
23
|
+
});
|
|
81
24
|
return {
|
|
82
25
|
content: [
|
|
83
26
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download-blueprint.js","sourceRoot":"","sources":["../../src/tools/download-blueprint.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"download-blueprint.js","sourceRoot":"","sources":["../../src/tools/download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