agentblueprint 0.7.8 → 0.7.10

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/mcp-setup.js CHANGED
@@ -5,108 +5,138 @@ import { createInterface } from 'node:readline';
5
5
  import { join } from 'node:path';
6
6
  const execFileAsync = promisify(execFile);
7
7
  /**
8
- * Interactive setup for the ServiceNow MCP server.
8
+ * Resolve credentials from flags, env vars, or interactive prompts.
9
+ * Priority: explicit option > env var > interactive prompt.
10
+ */
11
+ function resolveCredential(option, envVar, fallback) {
12
+ return option || process.env[envVar] || fallback;
13
+ }
14
+ /**
15
+ * Setup for the ServiceNow MCP server.
16
+ *
17
+ * When credentials are provided via options or env vars (SN_INSTANCE,
18
+ * SN_USER, SN_PASS), runs non-interactively. Otherwise falls back to
19
+ * interactive prompts.
9
20
  *
10
21
  * Installs the `servicenow-mcp-server` npm package globally if needed,
11
22
  * writes instance credentials, and prints the MCP config snippet for
12
23
  * the user to add to their coding agent of choice.
13
24
  */
14
- export async function setupServiceNowMcp() {
25
+ export async function setupServiceNowMcp(credentials) {
15
26
  console.error('\n--- ServiceNow MCP Server Setup ---\n');
16
- const rl = createInterface({ input: process.stdin, output: process.stderr });
17
- const ask = (prompt) => new Promise((resolve) => {
18
- rl.question(prompt, (answer) => resolve(answer.trim()));
19
- });
20
- try {
21
- // 1. Prompt for credentials
22
- const instanceName = await ask('ServiceNow instance name (press enter to skip): ');
23
- if (!instanceName) {
24
- console.error('Skipping ServiceNow MCP setup.');
25
- return;
26
- }
27
- const username = (await ask('Username [admin]: ')) || 'admin';
28
- const password = await ask('Password: ');
29
- if (!password) {
30
- console.error('Error: Password is required. Aborting MCP setup.');
31
- return;
32
- }
33
- // 2. Check if servicenow-mcp-server is installed
34
- let installed = false;
27
+ // Resolve from flags/env first
28
+ let instanceName = resolveCredential(credentials?.instance, 'SN_INSTANCE');
29
+ let username = resolveCredential(credentials?.username, 'SN_USER', 'admin');
30
+ let password = resolveCredential(credentials?.password, 'SN_PASS');
31
+ // If all resolved non-interactively, skip prompts entirely
32
+ const nonInteractive = !!(instanceName && password);
33
+ if (!nonInteractive) {
34
+ // Fall back to interactive prompts
35
+ const rl = createInterface({ input: process.stdin, output: process.stderr });
36
+ const ask = (prompt) => new Promise((resolve) => {
37
+ rl.question(prompt, (answer) => resolve(answer.trim()));
38
+ });
35
39
  try {
36
- await execFileAsync('which', ['servicenow-mcp-server']);
37
- installed = true;
38
- }
39
- catch {
40
- installed = false;
41
- }
42
- if (!installed) {
43
- console.error('Installing servicenow-mcp-server globally...');
44
- try {
45
- await execFileAsync('npm', ['install', '-g', 'servicenow-mcp-server']);
40
+ if (!instanceName) {
41
+ instanceName = await ask('ServiceNow instance name (press enter to skip): ');
42
+ if (!instanceName) {
43
+ console.error('Skipping ServiceNow MCP setup.');
44
+ return;
45
+ }
46
46
  }
47
- catch {
48
- console.error(`Failed to install servicenow-mcp-server globally. Install manually with:\n npm install -g servicenow-mcp-server`);
49
- return;
47
+ if (!username || username === 'admin') {
48
+ const prompted = await ask('Username [admin]: ');
49
+ if (prompted)
50
+ username = prompted;
51
+ }
52
+ if (!password) {
53
+ password = await ask('Password: ');
54
+ if (!password) {
55
+ console.error('Error: Password is required. Aborting MCP setup.');
56
+ return;
57
+ }
50
58
  }
51
59
  }
52
- // 3. Resolve absolute binary path (avoids nvm/fnm/volta PATH issues)
53
- let binaryPath;
54
- try {
55
- const { stdout } = await execFileAsync('which', ['servicenow-mcp-server']);
56
- binaryPath = stdout.trim();
57
- }
58
- catch {
59
- console.error('Error: Could not resolve servicenow-mcp-server binary path.');
60
- return;
60
+ finally {
61
+ rl.close();
61
62
  }
62
- // 4. Resolve global package directory
63
- let pkgDir;
63
+ }
64
+ if (nonInteractive) {
65
+ console.error('Using credentials from flags/environment (non-interactive mode).');
66
+ }
67
+ // 2. Check if servicenow-mcp-server is installed
68
+ let installed = false;
69
+ try {
70
+ await execFileAsync('which', ['servicenow-mcp-server']);
71
+ installed = true;
72
+ }
73
+ catch {
74
+ installed = false;
75
+ }
76
+ if (!installed) {
77
+ console.error('Installing servicenow-mcp-server globally...');
64
78
  try {
65
- const { stdout } = await execFileAsync('npm', ['root', '-g']);
66
- pkgDir = join(stdout.trim(), 'servicenow-mcp-server');
79
+ await execFileAsync('npm', ['install', '-g', 'servicenow-mcp-server']);
67
80
  }
68
81
  catch {
69
- console.error('Error: Could not resolve global npm root.');
82
+ console.error(`Failed to install servicenow-mcp-server globally. Install manually with:\n npm install -g servicenow-mcp-server`);
70
83
  return;
71
84
  }
72
- // 5. Write config file with instance credentials
73
- const configDir = join(pkgDir, 'config');
74
- await mkdir(configDir, { recursive: true });
75
- const configContent = JSON.stringify({
76
- instances: [
77
- {
78
- name: instanceName,
79
- url: `https://${instanceName}.service-now.com`,
80
- username,
81
- password,
82
- default: true,
83
- },
84
- ],
85
- }, null, 2);
86
- const configPath = join(configDir, 'servicenow-instances.json');
87
- await writeFile(configPath, configContent, { encoding: 'utf-8', mode: 0o600 });
88
- // 6. Print success and MCP config snippet
89
- console.error('');
90
- console.error('ServiceNow MCP server configured:');
91
- console.error(` Instance: ${instanceName}`);
92
- console.error(` Config: ${configPath}`);
93
- console.error(` Binary: ${binaryPath}`);
94
- console.error('');
95
- console.error('Add this to your coding agent\'s MCP config:');
96
- console.error('');
97
- console.error(JSON.stringify({
98
- mcpServers: {
99
- servicenow: {
100
- command: binaryPath,
101
- args: [],
102
- },
103
- },
104
- }, null, 2));
105
- console.error('');
106
- console.error('Add to your coding agent\'s MCP config and restart to connect.');
107
85
  }
108
- finally {
109
- rl.close();
86
+ // 3. Resolve absolute binary path (avoids nvm/fnm/volta PATH issues)
87
+ let binaryPath;
88
+ try {
89
+ const { stdout } = await execFileAsync('which', ['servicenow-mcp-server']);
90
+ binaryPath = stdout.trim();
91
+ }
92
+ catch {
93
+ console.error('Error: Could not resolve servicenow-mcp-server binary path.');
94
+ return;
95
+ }
96
+ // 4. Resolve global package directory
97
+ let pkgDir;
98
+ try {
99
+ const { stdout } = await execFileAsync('npm', ['root', '-g']);
100
+ pkgDir = join(stdout.trim(), 'servicenow-mcp-server');
110
101
  }
102
+ catch {
103
+ console.error('Error: Could not resolve global npm root.');
104
+ return;
105
+ }
106
+ // 5. Write config file with instance credentials
107
+ const configDir = join(pkgDir, 'config');
108
+ await mkdir(configDir, { recursive: true });
109
+ const configContent = JSON.stringify({
110
+ instances: [
111
+ {
112
+ name: instanceName,
113
+ url: `https://${instanceName}.service-now.com`,
114
+ username,
115
+ password,
116
+ default: true,
117
+ },
118
+ ],
119
+ }, null, 2);
120
+ const configPath = join(configDir, 'servicenow-instances.json');
121
+ await writeFile(configPath, configContent, { encoding: 'utf-8', mode: 0o600 });
122
+ // 6. Print success and MCP config snippet
123
+ console.error('');
124
+ console.error('ServiceNow MCP server configured:');
125
+ console.error(` Instance: ${instanceName}`);
126
+ console.error(` Config: ${configPath}`);
127
+ console.error(` Binary: ${binaryPath}`);
128
+ console.error('');
129
+ console.error('Add this to your coding agent\'s MCP config:');
130
+ console.error('');
131
+ console.error(JSON.stringify({
132
+ mcpServers: {
133
+ servicenow: {
134
+ command: binaryPath,
135
+ args: [],
136
+ },
137
+ },
138
+ }, null, 2));
139
+ console.error('');
140
+ console.error('Add to your coding agent\'s MCP config and restart to connect.');
111
141
  }
112
142
  //# sourceMappingURL=mcp-setup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-setup.js","sourceRoot":"","sources":["../src/mcp-setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ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AQ;gBACR,OAAO,EAAE,IAAI;aACd;SACF;KACF,EACD,IAAI,EACJ,CAAC,CACF,CAAC;IAEF,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,2BAA2B,CAAC,CAAC;IAChE,MAAM,SAAS,CAAC,UAAU,EAAE,aAAa,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAE/E,0CAA0C;IAC1C,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAClB,OAAO,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACnD,OAAO,CAAC,KAAK,CAAC,kBAAkB,YAAY,EAAE,CAAC,CAAC;IAChD,OAAO,CAAC,KAAK,CAAC,kBAAkB,UAAU,EAAE,CAAC,CAAC;IAC9C,OAAO,CAAC,KAAK,CAAC,kBAAkB,UAAU,EAAE,CAAC,CAAC;IAC9C,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAClB,OAAO,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAC9D,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAClB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;QAC3B,UAAU,EAAE;YACV,UAAU,EAAE;gBACV,OAAO,EAAE,UAAU;gBACnB,IAAI,EAAE,EAAE;aACT;SACF;KACF,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACb,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAClB,OAAO,CAAC,KAAK,CAAC,gEAAgE,CAAC,CAAC;AAClF,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { ImplementationStateResponse, ProgressResponse } from './types.js';
1
+ import type { ImplementationStateResponse, ProgressResponse, StrategicRecommendationsResponse } from './types.js';
2
2
  export interface SkillFile {
3
3
  path: string;
4
4
  content: string;
@@ -33,6 +33,7 @@ export interface SkillRenderInput {
33
33
  };
34
34
  implementationState?: ImplementationStateResponse | null;
35
35
  progress?: ProgressResponse | null;
36
+ recommendations?: StrategicRecommendationsResponse | null;
36
37
  staleness?: StalenessInfo;
37
38
  }
38
39
  export declare function slugify(input: string): string;
package/dist/renderers.js CHANGED
@@ -2066,6 +2066,10 @@ function buildImplementationState(input) {
2066
2066
  lines.push(' name: "" # e.g., "ServiceNow", "Salesforce", "Custom Node.js"');
2067
2067
  lines.push(' version: "" # e.g., "Australia", "Spring \'26"');
2068
2068
  lines.push(' environment: "" # e.g., "dev", "staging", "production"');
2069
+ lines.push(' # Add any instance-specific details (extra fields are preserved):');
2070
+ lines.push(' # instance_url: "https://dev12345.service-now.com"');
2071
+ lines.push(' # instance_id: "dev12345"');
2072
+ lines.push(' # scope: "x_abc_my_app"');
2069
2073
  lines.push('');
2070
2074
  // Agents
2071
2075
  if (team.length === 0) {
@@ -2085,14 +2089,27 @@ function buildImplementationState(input) {
2085
2089
  if (i === 0) {
2086
2090
  lines.push(' status: not_started # not_started | in_progress | implemented | modified | skipped');
2087
2091
  lines.push(' platform_artifact: "" # sys_id, function name, service URL, etc.');
2092
+ lines.push(' deviations: []');
2093
+ lines.push(' integrations_connected: []');
2094
+ lines.push(' notes: ""');
2095
+ lines.push(' # Extra fields are preserved. Examples of what agents typically add:');
2096
+ lines.push(' # tools:');
2097
+ lines.push(' # - name: "lookup_employee"');
2098
+ lines.push(' # type: "REST API"');
2099
+ lines.push(' # table: "sys_user"');
2100
+ lines.push(' # - name: "create_ticket"');
2101
+ lines.push(' # type: "Flow Action"');
2102
+ lines.push(' # flow: "Create Incident"');
2103
+ lines.push(' # topic: "HR Service Delivery"');
2104
+ lines.push(' # sys_id: "abc123def456"');
2088
2105
  }
2089
2106
  else {
2090
2107
  lines.push(' status: not_started');
2091
2108
  lines.push(' platform_artifact: ""');
2109
+ lines.push(' deviations: []');
2110
+ lines.push(' integrations_connected: []');
2111
+ lines.push(' notes: ""');
2092
2112
  }
2093
- lines.push(' deviations: []');
2094
- lines.push(' integrations_connected: []');
2095
- lines.push(' notes: ""');
2096
2113
  if (i < team.length - 1)
2097
2114
  lines.push('');
2098
2115
  }
@@ -2101,8 +2118,12 @@ function buildImplementationState(input) {
2101
2118
  // Architecture
2102
2119
  lines.push('architecture:');
2103
2120
  lines.push(` pattern: "" # actual pattern used (spec recommends: ${pattern})`);
2104
- lines.push(' deviations: []');
2121
+ lines.push(' deviations: [] # e.g., ["Switched from multi-agent to single orchestrator"]');
2105
2122
  lines.push(' additional_components: []');
2123
+ lines.push(' # Add any implementation-specific details:');
2124
+ lines.push(' # update_set: "AI Agent Deployment"');
2125
+ lines.push(' # app_scope: "x_abc_ai_agents"');
2126
+ lines.push(' # team_sys_id: "abc123"');
2106
2127
  lines.push('');
2107
2128
  // Metrics -- collect and deduplicate from all agents
2108
2129
  const seenMetrics = new Set();
@@ -2442,6 +2463,72 @@ function buildClaudeCodeHooksConfig(input) {
2442
2463
  return JSON.stringify(config, null, 2) + '\n';
2443
2464
  }
2444
2465
  // =============================================================================
2466
+ // STRATEGIC RECOMMENDATIONS (Phase 5 — Living Blueprint)
2467
+ // =============================================================================
2468
+ function buildRecommendations(input) {
2469
+ const recs = input.recommendations.recommendations;
2470
+ const lines = [];
2471
+ lines.push('# Strategic Recommendations');
2472
+ lines.push('');
2473
+ lines.push(`> Generated: ${recs.generatedAt}`);
2474
+ lines.push('');
2475
+ lines.push(recs.summary);
2476
+ lines.push('');
2477
+ // Group by priority
2478
+ const priorityOrder = ['critical', 'high', 'medium', 'low'];
2479
+ const priorityLabels = {
2480
+ critical: 'Critical',
2481
+ high: 'High Priority',
2482
+ medium: 'Medium Priority',
2483
+ low: 'Lower Priority',
2484
+ };
2485
+ for (const priority of priorityOrder) {
2486
+ const group = recs.recommendations.filter(r => r.priority === priority);
2487
+ if (group.length === 0)
2488
+ continue;
2489
+ lines.push(`## ${priorityLabels[priority]}`);
2490
+ lines.push('');
2491
+ for (const rec of group) {
2492
+ lines.push(`### ${rec.id}: ${rec.title}`);
2493
+ lines.push('');
2494
+ lines.push(`**Category:** ${rec.category.replace(/_/g, ' ')}`);
2495
+ lines.push(`**Confidence:** ${rec.confidence}`);
2496
+ lines.push('');
2497
+ lines.push(`**What:** ${rec.what}`);
2498
+ lines.push('');
2499
+ lines.push(`**Why:** ${rec.why}`);
2500
+ lines.push('');
2501
+ lines.push(`**Expected Impact:** ${rec.expectedImpact}`);
2502
+ if (rec.financialImpact) {
2503
+ const fi = rec.financialImpact;
2504
+ const value = fi.estimatedValue ? ` (${fi.estimatedValue})` : '';
2505
+ lines.push('');
2506
+ lines.push(`**Financial Impact:** ${fi.type.replace(/_/g, ' ')}${value} -- ${fi.basis}`);
2507
+ }
2508
+ if (rec.relatedAgents?.length) {
2509
+ lines.push('');
2510
+ lines.push(`**Related Agents:** ${rec.relatedAgents.join(', ')}`);
2511
+ }
2512
+ if (rec.relatedMetrics?.length) {
2513
+ lines.push('');
2514
+ lines.push(`**Related Metrics:** ${rec.relatedMetrics.join(', ')}`);
2515
+ }
2516
+ lines.push('');
2517
+ }
2518
+ }
2519
+ // Context snapshot footer
2520
+ const ctx = recs.contextSnapshot;
2521
+ lines.push('---');
2522
+ lines.push('');
2523
+ lines.push(`Implementation: ${ctx.implementationProgress}`);
2524
+ lines.push(`Performance: ${ctx.performanceStatus}`);
2525
+ if (ctx.daysInImplementation > 0) {
2526
+ lines.push(`Days in implementation: ${ctx.daysInImplementation}`);
2527
+ }
2528
+ lines.push('');
2529
+ return lines.join('\n');
2530
+ }
2531
+ // =============================================================================
2445
2532
  // MAIN RENDER FUNCTION
2446
2533
  // =============================================================================
2447
2534
  /**
@@ -2501,6 +2588,10 @@ export function renderSkillDirectory(input) {
2501
2588
  if (hasImplementationData(input)) {
2502
2589
  files.set('CURRENT-STATE.md', buildCurrentState(input));
2503
2590
  }
2591
+ // Strategic recommendations (return visits -- Living Blueprint Phase 5)
2592
+ if (hasImplementationData(input) && input.recommendations?.recommendations) {
2593
+ files.set('RECOMMENDATIONS.md', buildRecommendations(input));
2594
+ }
2504
2595
  return files;
2505
2596
  }
2506
2597
  //# sourceMappingURL=renderers.js.map