agentblueprint 0.4.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 +137 -0
- package/dist/__tests__/cli.test.d.ts +1 -0
- package/dist/__tests__/cli.test.js +136 -0
- package/dist/__tests__/cli.test.js.map +1 -0
- package/dist/__tests__/client.test.d.ts +1 -0
- package/dist/__tests__/client.test.js +99 -0
- package/dist/__tests__/client.test.js.map +1 -0
- package/dist/__tests__/config.test.d.ts +1 -0
- package/dist/__tests__/config.test.js +37 -0
- package/dist/__tests__/config.test.js.map +1 -0
- package/dist/__tests__/renderers.test.d.ts +1 -0
- package/dist/__tests__/renderers.test.js +471 -0
- package/dist/__tests__/renderers.test.js.map +1 -0
- package/dist/__tests__/token-store.test.d.ts +1 -0
- package/dist/__tests__/token-store.test.js +61 -0
- package/dist/__tests__/token-store.test.js.map +1 -0
- package/dist/__tests__/tools.test.d.ts +1 -0
- package/dist/__tests__/tools.test.js +379 -0
- package/dist/__tests__/tools.test.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +233 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.d.ts +80 -0
- package/dist/client.js +56 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +5 -0
- package/dist/config.js +11 -0
- package/dist/config.js.map +1 -0
- package/dist/download.d.ts +9 -0
- package/dist/download.js +113 -0
- package/dist/download.js.map +1 -0
- package/dist/errors.d.ts +5 -0
- package/dist/errors.js +18 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/renderers.d.ts +16 -0
- package/dist/renderers.js +1468 -0
- package/dist/renderers.js.map +1 -0
- package/dist/resources/blueprint.d.ts +14 -0
- package/dist/resources/blueprint.js +46 -0
- package/dist/resources/blueprint.js.map +1 -0
- package/dist/resources/blueprints.d.ts +14 -0
- package/dist/resources/blueprints.js +33 -0
- package/dist/resources/blueprints.js.map +1 -0
- package/dist/resources/business-profile.d.ts +14 -0
- package/dist/resources/business-profile.js +33 -0
- package/dist/resources/business-profile.js.map +1 -0
- package/dist/resources/spec.d.ts +14 -0
- package/dist/resources/spec.js +33 -0
- package/dist/resources/spec.js.map +1 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.js +47 -0
- package/dist/server.js.map +1 -0
- package/dist/token-store.d.ts +7 -0
- package/dist/token-store.js +34 -0
- package/dist/token-store.js.map +1 -0
- package/dist/tools/download-blueprint.d.ts +17 -0
- package/dist/tools/download-blueprint.js +55 -0
- package/dist/tools/download-blueprint.js.map +1 -0
- package/dist/tools/get-blueprint.d.ts +17 -0
- package/dist/tools/get-blueprint.js +65 -0
- package/dist/tools/get-blueprint.js.map +1 -0
- package/dist/tools/get-business-case.d.ts +17 -0
- package/dist/tools/get-business-case.js +66 -0
- package/dist/tools/get-business-case.js.map +1 -0
- package/dist/tools/get-business-profile.d.ts +14 -0
- package/dist/tools/get-business-profile.js +21 -0
- package/dist/tools/get-business-profile.js.map +1 -0
- package/dist/tools/get-implementation-plan.d.ts +17 -0
- package/dist/tools/get-implementation-plan.js +67 -0
- package/dist/tools/get-implementation-plan.js.map +1 -0
- package/dist/tools/get-implementation-spec.d.ts +31 -0
- package/dist/tools/get-implementation-spec.js +35 -0
- package/dist/tools/get-implementation-spec.js.map +1 -0
- package/dist/tools/get-use-case.d.ts +31 -0
- package/dist/tools/get-use-case.js +35 -0
- package/dist/tools/get-use-case.js.map +1 -0
- package/dist/tools/list-blueprints.d.ts +22 -0
- package/dist/tools/list-blueprints.js +29 -0
- package/dist/tools/list-blueprints.js.map +1 -0
- package/package.json +38 -0
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { Config } from './config.js';
|
|
2
|
+
export interface ApiResponse<T> {
|
|
3
|
+
success: boolean;
|
|
4
|
+
data: T;
|
|
5
|
+
timestamp: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class AgentBlueprintClient {
|
|
8
|
+
private config;
|
|
9
|
+
constructor(config: Config);
|
|
10
|
+
private request;
|
|
11
|
+
private orgQuery;
|
|
12
|
+
getBusinessProfile(customerOrgId?: string): Promise<BusinessProfile>;
|
|
13
|
+
listBlueprints(customerOrgId?: string): Promise<BlueprintSummary[]>;
|
|
14
|
+
getBlueprint(id: string, customerOrgId?: string): Promise<BlueprintDetail>;
|
|
15
|
+
getBusinessCase(blueprintId: string, customerOrgId?: string): Promise<ArtifactResponse>;
|
|
16
|
+
getImplementationPlan(blueprintId: string, customerOrgId?: string): Promise<ArtifactResponse>;
|
|
17
|
+
getUseCase(blueprintId: string, customerOrgId?: string): Promise<Record<string, unknown>>;
|
|
18
|
+
getImplementationSpec(blueprintId: string, customerOrgId?: string): Promise<ImplementationSpecResponse>;
|
|
19
|
+
}
|
|
20
|
+
export interface BlueprintSummary {
|
|
21
|
+
id: string;
|
|
22
|
+
title: string;
|
|
23
|
+
version: number;
|
|
24
|
+
platform: string;
|
|
25
|
+
agentCount: number;
|
|
26
|
+
lifecycleStatus: string;
|
|
27
|
+
useCaseId: string | null;
|
|
28
|
+
createdAt: string;
|
|
29
|
+
updatedAt: string;
|
|
30
|
+
}
|
|
31
|
+
export interface BlueprintDetail {
|
|
32
|
+
id: string;
|
|
33
|
+
version: number;
|
|
34
|
+
lifecycleStatus: string;
|
|
35
|
+
useCaseId: string | null;
|
|
36
|
+
createdAt: string;
|
|
37
|
+
updatedAt: string;
|
|
38
|
+
data: Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
export interface ArtifactResponse {
|
|
41
|
+
id: string;
|
|
42
|
+
version: number;
|
|
43
|
+
blueprintId: string;
|
|
44
|
+
createdAt: string;
|
|
45
|
+
updatedAt: string;
|
|
46
|
+
data: Record<string, unknown>;
|
|
47
|
+
}
|
|
48
|
+
export interface ImplementationSpecResponse {
|
|
49
|
+
blueprintId: string;
|
|
50
|
+
filename: string;
|
|
51
|
+
metadata: {
|
|
52
|
+
agentCount: number;
|
|
53
|
+
platform: string;
|
|
54
|
+
hasBusinessCase: boolean;
|
|
55
|
+
hasImplementationPlan: boolean;
|
|
56
|
+
hasUseCase: boolean;
|
|
57
|
+
hasBusinessProfile: boolean;
|
|
58
|
+
referenceFileCount: number;
|
|
59
|
+
totalFileCount: number;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export interface BusinessProfile {
|
|
63
|
+
id: string;
|
|
64
|
+
organizationId: string;
|
|
65
|
+
companyName: string;
|
|
66
|
+
industry: string | null;
|
|
67
|
+
size: string | null;
|
|
68
|
+
revenue: string | null;
|
|
69
|
+
currency: string;
|
|
70
|
+
description: string | null;
|
|
71
|
+
companyWebsite: string | null;
|
|
72
|
+
strategicInitiatives: unknown[];
|
|
73
|
+
technologyProfile: Record<string, unknown> | null;
|
|
74
|
+
organizationalCapabilities: Record<string, unknown> | null;
|
|
75
|
+
businessOperations: Record<string, unknown> | null;
|
|
76
|
+
constraintsProfile: Record<string, unknown> | null;
|
|
77
|
+
aiReadinessScore: number | null;
|
|
78
|
+
createdAt: string;
|
|
79
|
+
updatedAt: string;
|
|
80
|
+
}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ApiError } from './errors.js';
|
|
2
|
+
export class AgentBlueprintClient {
|
|
3
|
+
config;
|
|
4
|
+
constructor(config) {
|
|
5
|
+
this.config = config;
|
|
6
|
+
}
|
|
7
|
+
async request(path, query) {
|
|
8
|
+
const url = new URL(`${this.config.apiUrl}/api/v1${path}`);
|
|
9
|
+
if (query) {
|
|
10
|
+
for (const [k, v] of Object.entries(query)) {
|
|
11
|
+
url.searchParams.set(k, v);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const response = await fetch(url.toString(), {
|
|
15
|
+
method: 'GET',
|
|
16
|
+
headers: {
|
|
17
|
+
'Authorization': `Bearer ${this.config.apiKey}`,
|
|
18
|
+
'Accept': 'application/json',
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
if (!response.ok) {
|
|
22
|
+
const body = await response.json().catch(() => ({ error: response.statusText }));
|
|
23
|
+
throw new ApiError(response.status, body.error || `Request failed: ${response.status}`);
|
|
24
|
+
}
|
|
25
|
+
const json = (await response.json());
|
|
26
|
+
if (!json.success) {
|
|
27
|
+
throw new ApiError(400, 'API returned unsuccessful response');
|
|
28
|
+
}
|
|
29
|
+
return json.data;
|
|
30
|
+
}
|
|
31
|
+
orgQuery(customerOrgId) {
|
|
32
|
+
return customerOrgId ? { customerOrgId } : undefined;
|
|
33
|
+
}
|
|
34
|
+
async getBusinessProfile(customerOrgId) {
|
|
35
|
+
return this.request('/business-profile', this.orgQuery(customerOrgId));
|
|
36
|
+
}
|
|
37
|
+
async listBlueprints(customerOrgId) {
|
|
38
|
+
return this.request('/blueprints', this.orgQuery(customerOrgId));
|
|
39
|
+
}
|
|
40
|
+
async getBlueprint(id, customerOrgId) {
|
|
41
|
+
return this.request(`/blueprints/${encodeURIComponent(id)}`, this.orgQuery(customerOrgId));
|
|
42
|
+
}
|
|
43
|
+
async getBusinessCase(blueprintId, customerOrgId) {
|
|
44
|
+
return this.request(`/blueprints/${encodeURIComponent(blueprintId)}/business-case`, this.orgQuery(customerOrgId));
|
|
45
|
+
}
|
|
46
|
+
async getImplementationPlan(blueprintId, customerOrgId) {
|
|
47
|
+
return this.request(`/blueprints/${encodeURIComponent(blueprintId)}/implementation-plan`, this.orgQuery(customerOrgId));
|
|
48
|
+
}
|
|
49
|
+
async getUseCase(blueprintId, customerOrgId) {
|
|
50
|
+
return this.request(`/blueprints/${encodeURIComponent(blueprintId)}/use-case`, this.orgQuery(customerOrgId));
|
|
51
|
+
}
|
|
52
|
+
async getImplementationSpec(blueprintId, customerOrgId) {
|
|
53
|
+
return this.request(`/blueprints/${encodeURIComponent(blueprintId)}/implementation-spec`, this.orgQuery(customerOrgId));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 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,KAAK,CAAC,UAAU,CAAC,WAAmB,EAAE,aAAsB;QAC1D,OAAO,IAAI,CAAC,OAAO,CACjB,eAAe,kBAAkB,CAAC,WAAW,CAAC,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CACxF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,qBAAqB,CAAC,WAAmB,EAAE,aAAsB;QACrE,OAAO,IAAI,CAAC,OAAO,CACjB,eAAe,kBAAkB,CAAC,WAAW,CAAC,sBAAsB,EAAE,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CACnG,CAAC;IACJ,CAAC;CACF"}
|
package/dist/config.d.ts
ADDED
package/dist/config.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { loadToken } from './token-store.js';
|
|
2
|
+
export function loadConfig(tokenOverride) {
|
|
3
|
+
const stored = loadToken();
|
|
4
|
+
const apiKey = tokenOverride || process.env.AGENT_BLUEPRINT_API_KEY || stored?.apiKey || '';
|
|
5
|
+
const apiUrl = process.env.AGENT_BLUEPRINT_API_URL || stored?.apiUrl || 'https://app.agentblueprint.ai';
|
|
6
|
+
if (!apiKey) {
|
|
7
|
+
throw new Error('Missing API key. Set AGENT_BLUEPRINT_API_KEY environment variable, run `agentblueprint login`, or pass --token flag.');
|
|
8
|
+
}
|
|
9
|
+
return { apiKey, apiUrl };
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAO7C,MAAM,UAAU,UAAU,CAAC,aAAsB;IAC/C,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,MAAM,GAAG,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,MAAM,EAAE,MAAM,IAAI,EAAE,CAAC;IAC5F,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,MAAM,EAAE,MAAM,IAAI,+BAA+B,CAAC;IAExG,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,sHAAsH,CACvH,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Config } from './config.js';
|
|
2
|
+
export interface DownloadArgs {
|
|
3
|
+
blueprintId?: string;
|
|
4
|
+
dir: string;
|
|
5
|
+
list: boolean;
|
|
6
|
+
customerOrgId?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function parseDownloadArgs(args: string[]): DownloadArgs;
|
|
9
|
+
export declare function runDownload(config: Config, args: DownloadArgs): Promise<void>;
|
package/dist/download.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { AgentBlueprintClient } from './client.js';
|
|
4
|
+
import { renderSkillDirectory, slugify } from './renderers.js';
|
|
5
|
+
export function parseDownloadArgs(args) {
|
|
6
|
+
const result = {
|
|
7
|
+
dir: '.agent-blueprint',
|
|
8
|
+
list: false,
|
|
9
|
+
};
|
|
10
|
+
for (let i = 0; i < args.length; i++) {
|
|
11
|
+
const arg = args[i];
|
|
12
|
+
switch (arg) {
|
|
13
|
+
case '--blueprint':
|
|
14
|
+
result.blueprintId = args[++i];
|
|
15
|
+
break;
|
|
16
|
+
case '--dir':
|
|
17
|
+
result.dir = args[++i];
|
|
18
|
+
break;
|
|
19
|
+
case '--list':
|
|
20
|
+
result.list = true;
|
|
21
|
+
break;
|
|
22
|
+
case '--org':
|
|
23
|
+
result.customerOrgId = args[++i];
|
|
24
|
+
break;
|
|
25
|
+
default:
|
|
26
|
+
// Positional arg: treat as blueprint ID if it doesn't start with --
|
|
27
|
+
if (!arg.startsWith('--') && !result.blueprintId) {
|
|
28
|
+
result.blueprintId = arg;
|
|
29
|
+
}
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
export async function runDownload(config, args) {
|
|
36
|
+
const client = new AgentBlueprintClient(config);
|
|
37
|
+
if (args.list) {
|
|
38
|
+
await listBlueprints(client, args.customerOrgId);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (!args.blueprintId) {
|
|
42
|
+
console.error('Error: --blueprint <id> is required. Use --list to see available blueprints.');
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
await downloadBlueprint(client, args.blueprintId, args.dir, args.customerOrgId);
|
|
46
|
+
}
|
|
47
|
+
async function listBlueprints(client, customerOrgId) {
|
|
48
|
+
const blueprints = await client.listBlueprints(customerOrgId);
|
|
49
|
+
if (blueprints.length === 0) {
|
|
50
|
+
console.error('No blueprints found.');
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
console.error('Available blueprints:\n');
|
|
54
|
+
for (const bp of blueprints) {
|
|
55
|
+
console.error(` ${bp.id}`);
|
|
56
|
+
console.error(` Title: ${bp.title}`);
|
|
57
|
+
console.error(` Platform: ${bp.platform}`);
|
|
58
|
+
console.error(` Agents: ${bp.agentCount}`);
|
|
59
|
+
console.error(` Status: ${bp.lifecycleStatus}`);
|
|
60
|
+
console.error('');
|
|
61
|
+
}
|
|
62
|
+
console.error(`Use: agentblueprint download <id>`);
|
|
63
|
+
}
|
|
64
|
+
async function downloadBlueprint(client, blueprintId, baseDir, customerOrgId) {
|
|
65
|
+
console.error(`Fetching blueprint ${blueprintId}...`);
|
|
66
|
+
// Fetch all data in parallel
|
|
67
|
+
const [blueprint, businessCase, implementationPlan, useCase, businessProfile] = await Promise.all([
|
|
68
|
+
client.getBlueprint(blueprintId, customerOrgId),
|
|
69
|
+
client.getBusinessCase(blueprintId, customerOrgId).catch(() => null),
|
|
70
|
+
client.getImplementationPlan(blueprintId, customerOrgId).catch(() => null),
|
|
71
|
+
client.getUseCase(blueprintId, customerOrgId).catch(() => null),
|
|
72
|
+
client.getBusinessProfile(customerOrgId).catch(() => null),
|
|
73
|
+
]);
|
|
74
|
+
const title = blueprint.data.title
|
|
75
|
+
|| blueprint.data.blueprintTitle
|
|
76
|
+
|| `Blueprint ${blueprintId.slice(0, 8)}`;
|
|
77
|
+
const input = {
|
|
78
|
+
blueprintTitle: title,
|
|
79
|
+
blueprintId,
|
|
80
|
+
blueprintData: blueprint.data,
|
|
81
|
+
businessCaseData: businessCase?.data,
|
|
82
|
+
implementationPlanData: implementationPlan?.data,
|
|
83
|
+
useCaseData: useCase,
|
|
84
|
+
businessProfileData: businessProfile ?? undefined,
|
|
85
|
+
};
|
|
86
|
+
// Render
|
|
87
|
+
const files = renderSkillDirectory(input);
|
|
88
|
+
const slug = slugify(title) || 'blueprint';
|
|
89
|
+
const outDir = join(baseDir, slug);
|
|
90
|
+
// Write files
|
|
91
|
+
let totalSize = 0;
|
|
92
|
+
for (const [relativePath, content] of files) {
|
|
93
|
+
const fullPath = join(outDir, relativePath);
|
|
94
|
+
const dir = fullPath.substring(0, fullPath.lastIndexOf('/'));
|
|
95
|
+
await mkdir(dir, { recursive: true });
|
|
96
|
+
await writeFile(fullPath, content, 'utf-8');
|
|
97
|
+
totalSize += Buffer.byteLength(content, 'utf-8');
|
|
98
|
+
}
|
|
99
|
+
// Summary
|
|
100
|
+
console.error('');
|
|
101
|
+
console.error(`Downloaded ${files.size} files to ${outDir}/`);
|
|
102
|
+
console.error(`Total size: ${(totalSize / 1024).toFixed(1)} KB`);
|
|
103
|
+
console.error('');
|
|
104
|
+
console.error('Files:');
|
|
105
|
+
for (const [path] of files) {
|
|
106
|
+
console.error(` ${path}`);
|
|
107
|
+
}
|
|
108
|
+
console.error('');
|
|
109
|
+
console.error('Usage:');
|
|
110
|
+
console.error(` Claude Code: Reads SKILL.md automatically from ${outDir}/`);
|
|
111
|
+
console.error(` Other agents: Point your agent at ${outDir}/SKILL.md`);
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=download.js.map
|
|
@@ -0,0 +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,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAU/D,MAAM,UAAU,iBAAiB,CAAC,IAAc;IAC9C,MAAM,MAAM,GAAiB;QAC3B,GAAG,EAAE,kBAAkB;QACvB,IAAI,EAAE,KAAK;KACZ,CAAC;IAEF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,QAAQ,GAAG,EAAE,CAAC;YACZ,KAAK,aAAa;gBAChB,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC/B,MAAM;YACR,KAAK,OAAO;gBACV,MAAM,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;gBACvB,MAAM;YACR,KAAK,QAAQ;gBACX,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;gBACnB,MAAM;YACR,KAAK,OAAO;gBACV,MAAM,CAAC,aAAa,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;gBACjC,MAAM;YACR;gBACE,oEAAoE;gBACpE,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;o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AK,CAAC,EAAE,CAAC,CAAC;IAClB,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACxB,KAAK,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC;QAC3B,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAClB,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACxB,OAAO,CAAC,KAAK,CAAC,oDAAoD,MAAM,GAAG,CAAC,CAAC;IAC7E,OAAO,CAAC,KAAK,CAAC,uCAAuC,MAAM,WAAW,CAAC,CAAC;AAC1E,CAAC"}
|
package/dist/errors.d.ts
ADDED
package/dist/errors.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export class ApiError extends Error {
|
|
2
|
+
statusCode;
|
|
3
|
+
constructor(statusCode, message) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.statusCode = statusCode;
|
|
6
|
+
this.name = 'ApiError';
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export function formatError(err) {
|
|
10
|
+
if (err instanceof ApiError) {
|
|
11
|
+
return `API error (${err.statusCode}): ${err.message}`;
|
|
12
|
+
}
|
|
13
|
+
if (err instanceof Error) {
|
|
14
|
+
return err.message;
|
|
15
|
+
}
|
|
16
|
+
return String(err);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,QAAS,SAAQ,KAAK;IAEf;IADlB,YACkB,UAAkB,EAClC,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,eAAU,GAAV,UAAU,CAAQ;QAIlC,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACzB,CAAC;CACF;AAED,MAAM,UAAU,WAAW,CAAC,GAAY;IACtC,IAAI,GAAG,YAAY,QAAQ,EAAE,CAAC;QAC5B,OAAO,cAAc,GAAG,CAAC,UAAU,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC;IACzD,CAAC;IACD,IAAI,GAAG,YAAY,KAAK,EAAE,CAAC;QACzB,OAAO,GAAG,CAAC,OAAO,CAAC;IACrB,CAAC;IACD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,+DAA+D;AAC/D,OAAO,UAAU,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface SkillRenderInput {
|
|
2
|
+
blueprintTitle: string;
|
|
3
|
+
blueprintId: string;
|
|
4
|
+
organizationName?: string;
|
|
5
|
+
blueprintData: Record<string, unknown>;
|
|
6
|
+
businessCaseData?: Record<string, unknown>;
|
|
7
|
+
implementationPlanData?: Record<string, unknown>;
|
|
8
|
+
useCaseData?: Record<string, unknown>;
|
|
9
|
+
businessProfileData?: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
export declare function slugify(input: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Renders a complete Agent Skills directory from blueprint data.
|
|
14
|
+
* Returns a Map of { relativePath → fileContent }.
|
|
15
|
+
*/
|
|
16
|
+
export declare function renderSkillDirectory(input: SkillRenderInput): Map<string, string>;
|