MCPcopy Index your code
hub / github.com/CopilotKit/CopilotKit / main

Function main

showcase/scripts/create-integration/index.ts:1593–1870  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1591] as const;
1592
1593async function main() {
1594 const args = parseArgs();
1595
1596 if (
1597 !(FULLY_SUPPORTED_LANGUAGES as readonly string[]).includes(args.language)
1598 ) {
1599 console.error(
1600 `Error: Language '${args.language}' is not yet supported by this generator. ` +
1601 `Supported: ${FULLY_SUPPORTED_LANGUAGES.join(", ")}.`,
1602 );
1603 process.exit(1);
1604 }
1605
1606 const features = loadFeatureRegistry();
1607
1608 // Fail fast on unknown feature ids. Without this check, a typo in the
1609 // --features flag silently produces manifest/demo entries with TODO
1610 // placeholder text (the default branch of getDemoInteraction etc.),
1611 // which then drift into PRs. Enumerate the valid ids so the user can
1612 // copy the correct value.
1613 const knownFeatureIds = new Set(features.map((f) => f.id));
1614 const unknownFeatures = args.features.filter(
1615 (id) => !knownFeatureIds.has(id),
1616 );
1617 if (unknownFeatures.length > 0) {
1618 const known = [...knownFeatureIds].sort().join(", ");
1619 console.error(
1620 `Error: Unknown feature id(s): ${unknownFeatures.join(", ")}.\nKnown ids: ${known}`,
1621 );
1622 process.exit(1);
1623 }
1624
1625 const packageDir = path.join(PACKAGES_DIR, args.slug);
1626
1627 const packageDirState = probePath(packageDir);
1628 if (packageDirState === "unreadable") {
1629 console.error(
1630 `Error: Package directory exists but is unreadable: ${packageDir}`,
1631 );
1632 process.exit(1);
1633 }
1634 if (packageDirState === "exists") {
1635 console.error(`Error: Package directory already exists: ${packageDir}`);
1636 process.exit(1);
1637 }
1638
1639 console.log(`\nCreating integration package: ${args.name}\n`);
1640 console.log(` Slug: ${args.slug}`);
1641 console.log(` Category: ${args.category}`);
1642 console.log(` Language: ${args.language}`);
1643 console.log(` Features: ${args.features.join(", ")}`);
1644 console.log("");
1645
1646 // Validate CI workflows BEFORE writing the package tree so a regex
1647 // mismatch (layout drift in showcase_deploy.yml / test_smoke-starter.yml)
1648 // throws early rather than leaving a half-scaffolded package on disk that
1649 // the next run rejects via the packageDirState === "exists" guard above.
1650 // updateWorkflows() is self-contained — it reads only args and mutates

Callers 1

index.tsFile · 0.70

Calls 15

probePathFunction · 0.85
updateWorkflowsFunction · 0.85
generateManifestFunction · 0.85
generatePackageJsonFunction · 0.85
generateDockerfileFunction · 0.85
generateEntrypointFunction · 0.85
generateEnvExampleFunction · 0.85
generateGitignoreFunction · 0.85
generateNextConfigFunction · 0.85
generateTsConfigFunction · 0.85
generatePostcssConfigFunction · 0.85
generatePlaywrightConfigFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…