Skip to content

Commit 7f30623

Browse files
authored
chore(release): publish v0.7.0 (#26)
Co-authored-by: ct-sdks[bot] <153784748+ct-sdks[bot]@users.noreply.github.com>
1 parent 73d16d3 commit 7f30623

35 files changed

Lines changed: 1557 additions & 1745 deletions

File tree

.agents/plugins/commercetools/.codex-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "commercetools",
33
"displayName": "commercetools",
4-
"version": "0.6.0",
4+
"version": "0.7.0",
55
"description": "Build commercetools solutions faster",
66
"author": {
77
"name": "commercetools",

.agents/plugins/commercetools/skills/commercetools-checkout/SKILL.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ Three modes — choose based on how much of the checkout flow Checkout should ow
3030

3131
When this skill is invoked, always follow these steps:
3232

33-
1. **Gather context (required, run first)** — Always begin by gathering context for this skill. This is the mandatory grounding step: it gathers the latest verified documentation as context for you (the agent). **Do not skip it, and do not replace it with another tool** (such as an MCP documentation-search tool) — run this command:
33+
1. **Docs search (required, run first)** — Always begin by searching docs for this skill. This is the mandatory grounding step: it gathers the latest verified documentation as context for you (the agent). **Do not skip it, and do not replace it with another tool** (such as an MCP documentation-search tool) This script optimizes for tuned search results — run this command:
3434
```bash
35-
node scripts/gather-context.mjs \
35+
node scripts/docs-search.mjs \
3636
--query "<extract key terms from user's question>" \
37-
--client-name "<current-client>" \
37+
--app-name "<current-app ex: claude, copilot, codex>" \
3838
--model "<current-model>" \
3939
--skill-name "commercetools-checkout" \
40-
--limit 3
40+
--limit 20
4141
```
4242
Use its output as your primary grounding. You *may additionally* use other tools (such as the commercetools documentation MCP) for deeper, follow-up search.
4343

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* Search docs for the agent
5+
*
6+
* Gathers relevant commercetools documentation as grounding context for the agent, with instrumentation headers.
7+
* Results are written to stdout for consumption by AI agents.
8+
*
9+
* Usage:
10+
* node scripts/docs-search.mjs --query "how to create payment" --app-name <name> --model <model> --skill-name <skill> [options]
11+
*
12+
* Required:
13+
* --query <string> Search query
14+
* --app-name <string> App identifier (e.g., vscode-copilot, claude-desktop)
15+
* --model <string> Model name (e.g., claude-sonnet-4.5, gpt-4)
16+
* --skill-name <string> Skill identifier (e.g., commercetools-checkout)
17+
*
18+
* Optional:
19+
* --limit <number> Number of results (default: 3)
20+
* --content-types <string> Comma-separated content types
21+
*/
22+
23+
import { parseArgs } from 'util';
24+
25+
const CONTEXT_URL = 'https://docs.commercetools.com/apis/rest/tools/documentation-search';
26+
27+
// Parse command line arguments
28+
const { values } = parseArgs({
29+
options: {
30+
query: { type: 'string' },
31+
limit: { type: 'string', default: '3' },
32+
'app-name': { type: 'string' },
33+
model: { type: 'string' },
34+
'skill-name': { type: 'string' },
35+
'content-types': { type: 'string' },
36+
},
37+
});
38+
39+
// Validate required parameters
40+
const missingParams = [];
41+
if (!values.query) missingParams.push('--query');
42+
if (!values['app-name']) missingParams.push('--app-name');
43+
if (!values.model) missingParams.push('--model');
44+
if (!values['skill-name']) missingParams.push('--skill-name');
45+
46+
if (missingParams.length > 0) {
47+
console.error(`Error: Missing required parameters: ${missingParams.join(', ')}`);
48+
console.error('Usage: node scripts/docs-search.mjs --query "search" --app-name "app" --model "model" --skill-name "skill"');
49+
process.exit(1);
50+
}
51+
52+
const normalizedLimit = Math.min(parseInt(values.limit, 10), 20)
53+
54+
// Build request body
55+
const requestBody = {
56+
query: values.query,
57+
limit: normalizedLimit,
58+
products: ['Composable Commerce', 'Checkout', 'Connect', 'AI Hub']
59+
};
60+
61+
// Add optional content types filter
62+
if (values['content-types']) {
63+
requestBody.contentTypes = values['content-types'].split(',').map(t => t.trim());
64+
}
65+
66+
const requestData = JSON.stringify(requestBody);
67+
68+
async function main() {
69+
const controller = new AbortController();
70+
const timeoutId = setTimeout(() => controller.abort(), 60000);
71+
72+
try {
73+
const res = await fetch(CONTEXT_URL, {
74+
method: 'POST',
75+
headers: {
76+
'Content-Type': 'application/json',
77+
'Content-Length': Buffer.byteLength(requestData),
78+
'User-Agent': `${values['app-name']}/1.0 (${values.model})`,
79+
'X-Model': values.model,
80+
'X-Client-Type': values['app-name'],
81+
'X-Skill-Name': values['skill-name'],
82+
},
83+
body: requestData,
84+
signal: controller.signal,
85+
});
86+
87+
if (res.status !== 200) {
88+
process.exit(0);
89+
}
90+
91+
let response;
92+
try {
93+
response = await res.json();
94+
} catch (err) {
95+
process.exit(0);
96+
}
97+
98+
if (response.error) {
99+
process.exit(0);
100+
}
101+
102+
// Format results for AI agent consumption
103+
if (response.result && Array.isArray(response.result)) {
104+
const results = response.result;
105+
106+
if (results.length === 0) {
107+
process.stdout.write('No results found. Try broadening your search query or adjusting filters.\n');
108+
process.exit(0);
109+
}
110+
111+
// Write results in markdown format
112+
process.stdout.write(`# Documentation Search Results\n\n`);
113+
process.stdout.write(`Query: "${values.query}"\n`);
114+
process.stdout.write(`Found ${results.length} result(s)\n\n`);
115+
process.stdout.write('---\n\n');
116+
117+
results.forEach((item, index) => {
118+
process.stdout.write(`## Result ${index + 1}\n\n`);
119+
120+
if (item.metadata) {
121+
if (item.metadata.title) {
122+
process.stdout.write(`**Title:** ${item.metadata.title}\n\n`);
123+
}
124+
if (item.metadata.url) {
125+
const url = item.metadata.url.split('#')[0];
126+
process.stdout.write(`**URL:** ${url}\n\n`);
127+
}
128+
if (item.metadata.contentType) {
129+
process.stdout.write(`**Type:** ${item.metadata.contentType}\n\n`);
130+
}
131+
}
132+
133+
if (item.content) {
134+
process.stdout.write(`**Content:**\n\n${item.content}\n\n`);
135+
}
136+
137+
process.stdout.write('---\n\n');
138+
});
139+
} else {
140+
// Fallback: output raw response
141+
process.stdout.write(JSON.stringify(response, null, 2));
142+
process.stdout.write('\n');
143+
}
144+
} catch (err) {
145+
process.exit(0);
146+
} finally {
147+
clearTimeout(timeoutId);
148+
}
149+
}
150+
151+
main();

.agents/plugins/commercetools/skills/commercetools-checkout/scripts/gather-context.mjs

Lines changed: 0 additions & 170 deletions
This file was deleted.

.agents/plugins/commercetools/skills/commercetools-commerce-patterns/SKILL.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ metadata:
2424

2525
When this skill is invoked, always follow these steps:
2626

27-
1. **Gather context (required, run first)** — Always begin by gathering context for this skill. This is the mandatory grounding step: it gathers the latest verified documentation as context for you (the agent). **Do not skip it, and do not replace it with another tool** (such as an MCP documentation-search tool) — run this command:
27+
1. **Docs search (required, run first)** — Always begin by searching docs for this skill. This is the mandatory grounding step: it gathers the latest verified documentation as context for you (the agent). **Do not skip it, and do not replace it with another tool** (such as an MCP documentation-search tool) This script optimizes for tuned search results — run this command:
2828
```bash
29-
node scripts/gather-context.mjs \
29+
node scripts/docs-search.mjs \
3030
--query "<extract key terms from user's question>" \
31-
--client-name "<current-client>" \
31+
--app-name "<current-app ex: claude, copilot, codex>" \
3232
--model "<current-model>" \
3333
--skill-name "commercetools-commerce-patterns" \
34-
--limit 3
34+
--limit 10
3535
```
3636
Use its output as your primary grounding. You *may additionally* use other tools (such as the commercetools documentation MCP) for deeper, follow-up search.
3737

0 commit comments

Comments
 (0)