@cimplify/cli 0.2.3 → 0.2.5
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/{add-YJDP63WM.mjs → add-HUQP6GG4.mjs} +1 -1
- package/dist/{chunk-SN6E73KY.mjs → chunk-CGHNZCC5.mjs} +138 -6
- package/dist/{chunk-WTFQ3B5E.mjs → chunk-YF2CTZZA.mjs} +1 -1
- package/dist/dispatcher.mjs +6 -6
- package/dist/{list-DS4C3JRB.mjs → list-6LEDLIFX.mjs} +1 -1
- package/dist/{update-DBU2HAYG.mjs → update-ILYTYAZW.mjs} +1 -1
- package/package.json +1 -1
- package/templates/storefront-bakery/.env.example +6 -0
- package/templates/storefront-bakery/app/.well-known/ucp/route.ts +65 -0
- package/templates/storefront-bakery/package.json +1 -1
- package/templates/storefront-fashion/.env.example +6 -0
- package/templates/storefront-fashion/app/.well-known/ucp/route.ts +65 -0
- package/templates/storefront-fashion/package.json +1 -1
- package/templates/storefront-grocery/.env.example +6 -0
- package/templates/storefront-grocery/app/.well-known/ucp/route.ts +65 -0
- package/templates/storefront-grocery/package.json +1 -1
- package/templates/storefront-restaurant/.env.example +6 -0
- package/templates/storefront-restaurant/app/.well-known/ucp/route.ts +65 -0
- package/templates/storefront-restaurant/package.json +1 -1
- package/templates/storefront-retail/.env.example +6 -0
- package/templates/storefront-retail/app/.well-known/ucp/route.ts +65 -0
- package/templates/storefront-retail/package.json +1 -1
- package/templates/storefront-services/.env.example +6 -0
- package/templates/storefront-services/app/.well-known/ucp/route.ts +65 -0
- package/templates/storefront-services/package.json +1 -1
package/dist/dispatcher.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { package_default } from './chunk-
|
|
3
|
-
import { TEMPLATES } from './chunk-
|
|
2
|
+
import { package_default } from './chunk-YF2CTZZA.mjs';
|
|
3
|
+
import { TEMPLATES } from './chunk-CGHNZCC5.mjs';
|
|
4
4
|
|
|
5
5
|
// src/dispatcher.ts
|
|
6
6
|
var VERSION = package_default.version ?? "unknown";
|
|
@@ -129,10 +129,10 @@ var COMMANDS = {
|
|
|
129
129
|
status: () => import('./status-6AT4HF63.mjs'),
|
|
130
130
|
dev: () => import('./dev-AQP6TMYK.mjs'),
|
|
131
131
|
repo: () => import('./repo-XMMLZHLC.mjs'),
|
|
132
|
-
list: () => import('./list-
|
|
133
|
-
add: () => import('./add-
|
|
134
|
-
update: () => import('./update-
|
|
135
|
-
upgrade: () => import('./update-
|
|
132
|
+
list: () => import('./list-6LEDLIFX.mjs'),
|
|
133
|
+
add: () => import('./add-HUQP6GG4.mjs'),
|
|
134
|
+
update: () => import('./update-ILYTYAZW.mjs'),
|
|
135
|
+
upgrade: () => import('./update-ILYTYAZW.mjs')
|
|
136
136
|
};
|
|
137
137
|
var GLOBAL_FLAGS = /* @__PURE__ */ new Set(["--json", "--yes", "-y"]);
|
|
138
138
|
function extractGlobalFlags(argv) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { REGISTRY_INDEX } from './chunk-
|
|
2
|
+
import { REGISTRY_INDEX } from './chunk-CGHNZCC5.mjs';
|
|
3
3
|
import { parseArgs, flagBool } from './chunk-4SBJVRGM.mjs';
|
|
4
4
|
import { CliError, CLI_ERROR_CODE, info, bold, dim, green, result } from './chunk-NZ4RG62Z.mjs';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { package_default } from './chunk-
|
|
2
|
+
import { package_default } from './chunk-YF2CTZZA.mjs';
|
|
3
3
|
import { promptYesNo } from './chunk-L6474RPL.mjs';
|
|
4
4
|
import { parseArgs, flagBool, flagString } from './chunk-4SBJVRGM.mjs';
|
|
5
5
|
import { success, bold, info, dim, result, failure, CliError, CLI_ERROR_CODE, step, isJsonMode } from './chunk-NZ4RG62Z.mjs';
|
package/package.json
CHANGED
|
@@ -14,3 +14,9 @@ NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID=bus_default_akua_bakery
|
|
|
14
14
|
# and OpenGraph metadata. Set this on production deploys (Vercel auto-injects
|
|
15
15
|
# via VERCEL_URL but Next prefers an explicit value).
|
|
16
16
|
NEXT_PUBLIC_SITE_URL=https://example.com
|
|
17
|
+
|
|
18
|
+
# Business handle (human-readable slug, e.g. "akua-bakery"). Used by the
|
|
19
|
+
# UCP manifest endpoint at /.well-known/ucp so AI agents (Claude / ChatGPT /
|
|
20
|
+
# Gemini) can discover this storefront's commerce capabilities. Set this
|
|
21
|
+
# on production deploys; leave empty in dev unless you're testing UCP.
|
|
22
|
+
NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE=
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { NextResponse } from "next/server";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* UCP (Universal Commerce Protocol) manifest discovery endpoint.
|
|
5
|
+
*
|
|
6
|
+
* Agents — Claude, ChatGPT, Gemini, MCP clients — probe
|
|
7
|
+
* `https://<your-domain>/.well-known/ucp` to learn what commerce
|
|
8
|
+
* capabilities your storefront supports. We forward the request to
|
|
9
|
+
* Cimplify, which returns the canonical manifest; the response body
|
|
10
|
+
* tells agents to make subsequent UCP calls directly to
|
|
11
|
+
* `api.cimplify.io/ucp/v1/<handle>/*` (no per-request proxy here).
|
|
12
|
+
*
|
|
13
|
+
* Edge-cached for an hour because capabilities change rarely.
|
|
14
|
+
*/
|
|
15
|
+
const UCP_API_BASE =
|
|
16
|
+
process.env.NEXT_PUBLIC_CIMPLIFY_API_URL || "https://api.cimplify.io";
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export async function GET() {
|
|
20
|
+
const businessHandle = process.env.NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE;
|
|
21
|
+
|
|
22
|
+
if (!businessHandle) {
|
|
23
|
+
return NextResponse.json(
|
|
24
|
+
{
|
|
25
|
+
error: "NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE not set",
|
|
26
|
+
remediation:
|
|
27
|
+
"Set NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE in .env.local (and your deployment env) to your business handle.",
|
|
28
|
+
},
|
|
29
|
+
{ status: 500 },
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
const response = await fetch(
|
|
35
|
+
`${UCP_API_BASE}/ucp/v1/${businessHandle}/manifest`,
|
|
36
|
+
{
|
|
37
|
+
headers: { "Content-Type": "application/json" },
|
|
38
|
+
next: { revalidate: 3600 },
|
|
39
|
+
},
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
if (!response.ok) {
|
|
43
|
+
return NextResponse.json(
|
|
44
|
+
{ error: `Upstream UCP manifest fetch failed: ${response.status}` },
|
|
45
|
+
{ status: response.status },
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const manifest = await response.json();
|
|
50
|
+
return NextResponse.json(manifest, {
|
|
51
|
+
headers: {
|
|
52
|
+
"Content-Type": "application/json",
|
|
53
|
+
"Cache-Control": "public, max-age=3600, s-maxage=3600",
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
} catch (error) {
|
|
57
|
+
return NextResponse.json(
|
|
58
|
+
{
|
|
59
|
+
error: "Failed to fetch UCP manifest",
|
|
60
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
61
|
+
},
|
|
62
|
+
{ status: 500 },
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -14,3 +14,9 @@ NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID=bus_studio_frx
|
|
|
14
14
|
# and OpenGraph metadata. Set this on production deploys (Vercel auto-injects
|
|
15
15
|
# via VERCEL_URL but Next prefers an explicit value).
|
|
16
16
|
NEXT_PUBLIC_SITE_URL=https://example.com
|
|
17
|
+
|
|
18
|
+
# Business handle (human-readable slug, e.g. "akua-bakery"). Used by the
|
|
19
|
+
# UCP manifest endpoint at /.well-known/ucp so AI agents (Claude / ChatGPT /
|
|
20
|
+
# Gemini) can discover this storefront's commerce capabilities. Set this
|
|
21
|
+
# on production deploys; leave empty in dev unless you're testing UCP.
|
|
22
|
+
NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE=
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { NextResponse } from "next/server";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* UCP (Universal Commerce Protocol) manifest discovery endpoint.
|
|
5
|
+
*
|
|
6
|
+
* Agents — Claude, ChatGPT, Gemini, MCP clients — probe
|
|
7
|
+
* `https://<your-domain>/.well-known/ucp` to learn what commerce
|
|
8
|
+
* capabilities your storefront supports. We forward the request to
|
|
9
|
+
* Cimplify, which returns the canonical manifest; the response body
|
|
10
|
+
* tells agents to make subsequent UCP calls directly to
|
|
11
|
+
* `api.cimplify.io/ucp/v1/<handle>/*` (no per-request proxy here).
|
|
12
|
+
*
|
|
13
|
+
* Edge-cached for an hour because capabilities change rarely.
|
|
14
|
+
*/
|
|
15
|
+
const UCP_API_BASE =
|
|
16
|
+
process.env.NEXT_PUBLIC_CIMPLIFY_API_URL || "https://api.cimplify.io";
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export async function GET() {
|
|
20
|
+
const businessHandle = process.env.NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE;
|
|
21
|
+
|
|
22
|
+
if (!businessHandle) {
|
|
23
|
+
return NextResponse.json(
|
|
24
|
+
{
|
|
25
|
+
error: "NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE not set",
|
|
26
|
+
remediation:
|
|
27
|
+
"Set NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE in .env.local (and your deployment env) to your business handle.",
|
|
28
|
+
},
|
|
29
|
+
{ status: 500 },
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
const response = await fetch(
|
|
35
|
+
`${UCP_API_BASE}/ucp/v1/${businessHandle}/manifest`,
|
|
36
|
+
{
|
|
37
|
+
headers: { "Content-Type": "application/json" },
|
|
38
|
+
next: { revalidate: 3600 },
|
|
39
|
+
},
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
if (!response.ok) {
|
|
43
|
+
return NextResponse.json(
|
|
44
|
+
{ error: `Upstream UCP manifest fetch failed: ${response.status}` },
|
|
45
|
+
{ status: response.status },
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const manifest = await response.json();
|
|
50
|
+
return NextResponse.json(manifest, {
|
|
51
|
+
headers: {
|
|
52
|
+
"Content-Type": "application/json",
|
|
53
|
+
"Cache-Control": "public, max-age=3600, s-maxage=3600",
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
} catch (error) {
|
|
57
|
+
return NextResponse.json(
|
|
58
|
+
{
|
|
59
|
+
error: "Failed to fetch UCP manifest",
|
|
60
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
61
|
+
},
|
|
62
|
+
{ status: 500 },
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -14,3 +14,9 @@ NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID=bus_freshmart
|
|
|
14
14
|
# and OpenGraph metadata. Set this on production deploys (Vercel auto-injects
|
|
15
15
|
# via VERCEL_URL but Next prefers an explicit value).
|
|
16
16
|
NEXT_PUBLIC_SITE_URL=https://example.com
|
|
17
|
+
|
|
18
|
+
# Business handle (human-readable slug, e.g. "akua-bakery"). Used by the
|
|
19
|
+
# UCP manifest endpoint at /.well-known/ucp so AI agents (Claude / ChatGPT /
|
|
20
|
+
# Gemini) can discover this storefront's commerce capabilities. Set this
|
|
21
|
+
# on production deploys; leave empty in dev unless you're testing UCP.
|
|
22
|
+
NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE=
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { NextResponse } from "next/server";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* UCP (Universal Commerce Protocol) manifest discovery endpoint.
|
|
5
|
+
*
|
|
6
|
+
* Agents — Claude, ChatGPT, Gemini, MCP clients — probe
|
|
7
|
+
* `https://<your-domain>/.well-known/ucp` to learn what commerce
|
|
8
|
+
* capabilities your storefront supports. We forward the request to
|
|
9
|
+
* Cimplify, which returns the canonical manifest; the response body
|
|
10
|
+
* tells agents to make subsequent UCP calls directly to
|
|
11
|
+
* `api.cimplify.io/ucp/v1/<handle>/*` (no per-request proxy here).
|
|
12
|
+
*
|
|
13
|
+
* Edge-cached for an hour because capabilities change rarely.
|
|
14
|
+
*/
|
|
15
|
+
const UCP_API_BASE =
|
|
16
|
+
process.env.NEXT_PUBLIC_CIMPLIFY_API_URL || "https://api.cimplify.io";
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export async function GET() {
|
|
20
|
+
const businessHandle = process.env.NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE;
|
|
21
|
+
|
|
22
|
+
if (!businessHandle) {
|
|
23
|
+
return NextResponse.json(
|
|
24
|
+
{
|
|
25
|
+
error: "NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE not set",
|
|
26
|
+
remediation:
|
|
27
|
+
"Set NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE in .env.local (and your deployment env) to your business handle.",
|
|
28
|
+
},
|
|
29
|
+
{ status: 500 },
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
const response = await fetch(
|
|
35
|
+
`${UCP_API_BASE}/ucp/v1/${businessHandle}/manifest`,
|
|
36
|
+
{
|
|
37
|
+
headers: { "Content-Type": "application/json" },
|
|
38
|
+
next: { revalidate: 3600 },
|
|
39
|
+
},
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
if (!response.ok) {
|
|
43
|
+
return NextResponse.json(
|
|
44
|
+
{ error: `Upstream UCP manifest fetch failed: ${response.status}` },
|
|
45
|
+
{ status: response.status },
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const manifest = await response.json();
|
|
50
|
+
return NextResponse.json(manifest, {
|
|
51
|
+
headers: {
|
|
52
|
+
"Content-Type": "application/json",
|
|
53
|
+
"Cache-Control": "public, max-age=3600, s-maxage=3600",
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
} catch (error) {
|
|
57
|
+
return NextResponse.json(
|
|
58
|
+
{
|
|
59
|
+
error: "Failed to fetch UCP manifest",
|
|
60
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
61
|
+
},
|
|
62
|
+
{ status: 500 },
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -14,3 +14,9 @@ NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID=bus_mamas_kitchen
|
|
|
14
14
|
# and OpenGraph metadata. Set this on production deploys (Vercel auto-injects
|
|
15
15
|
# via VERCEL_URL but Next prefers an explicit value).
|
|
16
16
|
NEXT_PUBLIC_SITE_URL=https://example.com
|
|
17
|
+
|
|
18
|
+
# Business handle (human-readable slug, e.g. "akua-bakery"). Used by the
|
|
19
|
+
# UCP manifest endpoint at /.well-known/ucp so AI agents (Claude / ChatGPT /
|
|
20
|
+
# Gemini) can discover this storefront's commerce capabilities. Set this
|
|
21
|
+
# on production deploys; leave empty in dev unless you're testing UCP.
|
|
22
|
+
NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE=
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { NextResponse } from "next/server";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* UCP (Universal Commerce Protocol) manifest discovery endpoint.
|
|
5
|
+
*
|
|
6
|
+
* Agents — Claude, ChatGPT, Gemini, MCP clients — probe
|
|
7
|
+
* `https://<your-domain>/.well-known/ucp` to learn what commerce
|
|
8
|
+
* capabilities your storefront supports. We forward the request to
|
|
9
|
+
* Cimplify, which returns the canonical manifest; the response body
|
|
10
|
+
* tells agents to make subsequent UCP calls directly to
|
|
11
|
+
* `api.cimplify.io/ucp/v1/<handle>/*` (no per-request proxy here).
|
|
12
|
+
*
|
|
13
|
+
* Edge-cached for an hour because capabilities change rarely.
|
|
14
|
+
*/
|
|
15
|
+
const UCP_API_BASE =
|
|
16
|
+
process.env.NEXT_PUBLIC_CIMPLIFY_API_URL || "https://api.cimplify.io";
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export async function GET() {
|
|
20
|
+
const businessHandle = process.env.NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE;
|
|
21
|
+
|
|
22
|
+
if (!businessHandle) {
|
|
23
|
+
return NextResponse.json(
|
|
24
|
+
{
|
|
25
|
+
error: "NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE not set",
|
|
26
|
+
remediation:
|
|
27
|
+
"Set NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE in .env.local (and your deployment env) to your business handle.",
|
|
28
|
+
},
|
|
29
|
+
{ status: 500 },
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
const response = await fetch(
|
|
35
|
+
`${UCP_API_BASE}/ucp/v1/${businessHandle}/manifest`,
|
|
36
|
+
{
|
|
37
|
+
headers: { "Content-Type": "application/json" },
|
|
38
|
+
next: { revalidate: 3600 },
|
|
39
|
+
},
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
if (!response.ok) {
|
|
43
|
+
return NextResponse.json(
|
|
44
|
+
{ error: `Upstream UCP manifest fetch failed: ${response.status}` },
|
|
45
|
+
{ status: response.status },
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const manifest = await response.json();
|
|
50
|
+
return NextResponse.json(manifest, {
|
|
51
|
+
headers: {
|
|
52
|
+
"Content-Type": "application/json",
|
|
53
|
+
"Cache-Control": "public, max-age=3600, s-maxage=3600",
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
} catch (error) {
|
|
57
|
+
return NextResponse.json(
|
|
58
|
+
{
|
|
59
|
+
error: "Failed to fetch UCP manifest",
|
|
60
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
61
|
+
},
|
|
62
|
+
{ status: 500 },
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -14,3 +14,9 @@ NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID=bus_currents_electronics
|
|
|
14
14
|
# and OpenGraph metadata. Set this on production deploys (Vercel auto-injects
|
|
15
15
|
# via VERCEL_URL but Next prefers an explicit value).
|
|
16
16
|
NEXT_PUBLIC_SITE_URL=https://example.com
|
|
17
|
+
|
|
18
|
+
# Business handle (human-readable slug, e.g. "akua-bakery"). Used by the
|
|
19
|
+
# UCP manifest endpoint at /.well-known/ucp so AI agents (Claude / ChatGPT /
|
|
20
|
+
# Gemini) can discover this storefront's commerce capabilities. Set this
|
|
21
|
+
# on production deploys; leave empty in dev unless you're testing UCP.
|
|
22
|
+
NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE=
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { NextResponse } from "next/server";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* UCP (Universal Commerce Protocol) manifest discovery endpoint.
|
|
5
|
+
*
|
|
6
|
+
* Agents — Claude, ChatGPT, Gemini, MCP clients — probe
|
|
7
|
+
* `https://<your-domain>/.well-known/ucp` to learn what commerce
|
|
8
|
+
* capabilities your storefront supports. We forward the request to
|
|
9
|
+
* Cimplify, which returns the canonical manifest; the response body
|
|
10
|
+
* tells agents to make subsequent UCP calls directly to
|
|
11
|
+
* `api.cimplify.io/ucp/v1/<handle>/*` (no per-request proxy here).
|
|
12
|
+
*
|
|
13
|
+
* Edge-cached for an hour because capabilities change rarely.
|
|
14
|
+
*/
|
|
15
|
+
const UCP_API_BASE =
|
|
16
|
+
process.env.NEXT_PUBLIC_CIMPLIFY_API_URL || "https://api.cimplify.io";
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export async function GET() {
|
|
20
|
+
const businessHandle = process.env.NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE;
|
|
21
|
+
|
|
22
|
+
if (!businessHandle) {
|
|
23
|
+
return NextResponse.json(
|
|
24
|
+
{
|
|
25
|
+
error: "NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE not set",
|
|
26
|
+
remediation:
|
|
27
|
+
"Set NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE in .env.local (and your deployment env) to your business handle.",
|
|
28
|
+
},
|
|
29
|
+
{ status: 500 },
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
const response = await fetch(
|
|
35
|
+
`${UCP_API_BASE}/ucp/v1/${businessHandle}/manifest`,
|
|
36
|
+
{
|
|
37
|
+
headers: { "Content-Type": "application/json" },
|
|
38
|
+
next: { revalidate: 3600 },
|
|
39
|
+
},
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
if (!response.ok) {
|
|
43
|
+
return NextResponse.json(
|
|
44
|
+
{ error: `Upstream UCP manifest fetch failed: ${response.status}` },
|
|
45
|
+
{ status: response.status },
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const manifest = await response.json();
|
|
50
|
+
return NextResponse.json(manifest, {
|
|
51
|
+
headers: {
|
|
52
|
+
"Content-Type": "application/json",
|
|
53
|
+
"Cache-Control": "public, max-age=3600, s-maxage=3600",
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
} catch (error) {
|
|
57
|
+
return NextResponse.json(
|
|
58
|
+
{
|
|
59
|
+
error: "Failed to fetch UCP manifest",
|
|
60
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
61
|
+
},
|
|
62
|
+
{ status: 500 },
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -14,3 +14,9 @@ NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID=bus_serene_spa
|
|
|
14
14
|
# and OpenGraph metadata. Set this on production deploys (Vercel auto-injects
|
|
15
15
|
# via VERCEL_URL but Next prefers an explicit value).
|
|
16
16
|
NEXT_PUBLIC_SITE_URL=https://example.com
|
|
17
|
+
|
|
18
|
+
# Business handle (human-readable slug, e.g. "akua-bakery"). Used by the
|
|
19
|
+
# UCP manifest endpoint at /.well-known/ucp so AI agents (Claude / ChatGPT /
|
|
20
|
+
# Gemini) can discover this storefront's commerce capabilities. Set this
|
|
21
|
+
# on production deploys; leave empty in dev unless you're testing UCP.
|
|
22
|
+
NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE=
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { NextResponse } from "next/server";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* UCP (Universal Commerce Protocol) manifest discovery endpoint.
|
|
5
|
+
*
|
|
6
|
+
* Agents — Claude, ChatGPT, Gemini, MCP clients — probe
|
|
7
|
+
* `https://<your-domain>/.well-known/ucp` to learn what commerce
|
|
8
|
+
* capabilities your storefront supports. We forward the request to
|
|
9
|
+
* Cimplify, which returns the canonical manifest; the response body
|
|
10
|
+
* tells agents to make subsequent UCP calls directly to
|
|
11
|
+
* `api.cimplify.io/ucp/v1/<handle>/*` (no per-request proxy here).
|
|
12
|
+
*
|
|
13
|
+
* Edge-cached for an hour because capabilities change rarely.
|
|
14
|
+
*/
|
|
15
|
+
const UCP_API_BASE =
|
|
16
|
+
process.env.NEXT_PUBLIC_CIMPLIFY_API_URL || "https://api.cimplify.io";
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export async function GET() {
|
|
20
|
+
const businessHandle = process.env.NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE;
|
|
21
|
+
|
|
22
|
+
if (!businessHandle) {
|
|
23
|
+
return NextResponse.json(
|
|
24
|
+
{
|
|
25
|
+
error: "NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE not set",
|
|
26
|
+
remediation:
|
|
27
|
+
"Set NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE in .env.local (and your deployment env) to your business handle.",
|
|
28
|
+
},
|
|
29
|
+
{ status: 500 },
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
const response = await fetch(
|
|
35
|
+
`${UCP_API_BASE}/ucp/v1/${businessHandle}/manifest`,
|
|
36
|
+
{
|
|
37
|
+
headers: { "Content-Type": "application/json" },
|
|
38
|
+
next: { revalidate: 3600 },
|
|
39
|
+
},
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
if (!response.ok) {
|
|
43
|
+
return NextResponse.json(
|
|
44
|
+
{ error: `Upstream UCP manifest fetch failed: ${response.status}` },
|
|
45
|
+
{ status: response.status },
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const manifest = await response.json();
|
|
50
|
+
return NextResponse.json(manifest, {
|
|
51
|
+
headers: {
|
|
52
|
+
"Content-Type": "application/json",
|
|
53
|
+
"Cache-Control": "public, max-age=3600, s-maxage=3600",
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
} catch (error) {
|
|
57
|
+
return NextResponse.json(
|
|
58
|
+
{
|
|
59
|
+
error: "Failed to fetch UCP manifest",
|
|
60
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
61
|
+
},
|
|
62
|
+
{ status: 500 },
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
}
|