@beignet/cli 0.0.27 → 0.0.29
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/CHANGELOG.md +19 -0
- package/README.md +31 -6
- package/dist/check.d.ts +61 -0
- package/dist/check.d.ts.map +1 -0
- package/dist/check.js +164 -0
- package/dist/check.js.map +1 -0
- package/dist/choices.d.ts +2 -2
- package/dist/choices.d.ts.map +1 -1
- package/dist/choices.js +1 -0
- package/dist/choices.js.map +1 -1
- package/dist/db.d.ts +8 -0
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +2 -2
- package/dist/db.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +47 -8
- package/dist/index.js.map +1 -1
- package/dist/inspect.d.ts.map +1 -1
- package/dist/inspect.js +70 -0
- package/dist/inspect.js.map +1 -1
- package/dist/make/shared.d.ts +17 -0
- package/dist/make/shared.d.ts.map +1 -1
- package/dist/make/shared.js +67 -0
- package/dist/make/shared.js.map +1 -1
- package/dist/make.d.ts.map +1 -1
- package/dist/make.js +11 -55
- package/dist/make.js.map +1 -1
- package/dist/mcp.js +1 -1
- package/dist/mcp.js.map +1 -1
- package/dist/provider-add.d.ts.map +1 -1
- package/dist/provider-add.js +50 -0
- package/dist/provider-add.js.map +1 -1
- package/dist/provider-audit.d.ts.map +1 -1
- package/dist/provider-audit.js +77 -1
- package/dist/provider-audit.js.map +1 -1
- package/dist/templates/agents.d.ts.map +1 -1
- package/dist/templates/agents.js +27 -9
- package/dist/templates/agents.js.map +1 -1
- package/dist/templates/base.d.ts.map +1 -1
- package/dist/templates/base.js +42 -12
- package/dist/templates/base.js.map +1 -1
- package/dist/templates/db/sqlite.d.ts.map +1 -1
- package/dist/templates/db/sqlite.js +7 -1
- package/dist/templates/db/sqlite.js.map +1 -1
- package/dist/templates/shared.d.ts +1 -0
- package/dist/templates/shared.d.ts.map +1 -1
- package/dist/templates/shared.js +1 -0
- package/dist/templates/shared.js.map +1 -1
- package/package.json +2 -2
- package/src/check.ts +246 -0
- package/src/choices.ts +3 -1
- package/src/db.ts +2 -2
- package/src/index.ts +62 -8
- package/src/inspect.ts +100 -0
- package/src/make/shared.ts +88 -0
- package/src/make.ts +10 -68
- package/src/mcp.ts +1 -1
- package/src/provider-add.ts +51 -0
- package/src/provider-audit.ts +95 -3
- package/src/templates/agents.ts +27 -9
- package/src/templates/base.ts +43 -12
- package/src/templates/db/sqlite.ts +7 -1
- package/src/templates/shared.ts +1 -0
package/dist/make.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make.d.ts","sourceRoot":"","sources":["../src/make.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EACL,KAAK,aAAa,EAKnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAyDL,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"make.d.ts","sourceRoot":"","sources":["../src/make.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EACL,KAAK,aAAa,EAKnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAyDL,KAAK,UAAU,EAqEhB,MAAM,kBAAkB,CAAC;AAU1B,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EACL,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,cAAc,CAAC;AACtB,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAElC,KAAK,mBAAmB,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAA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;AAED,wBAAsB,YAAY,CAChC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,kBAAkB,CAAC,CAkD7B;AAmDD,wBAAsB,YAAY,CAChC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,kBAAkB,CAAC,CAgE7B;AAucD,wBAAsB,UAAU,CAC9B,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,gBAAgB,CAAC,CAqD3B;AAED,wBAAsB,UAAU,CAC9B,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,gBAAgB,CAAC,CAiE3B"}
|
package/dist/make.js
CHANGED
|
@@ -2,8 +2,8 @@ import { randomBytes } from "node:crypto";
|
|
|
2
2
|
import { mkdir, readFile, stat, writeFile } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { clientIndexPath, loadBeignetConfig, resolveConfig, } from "./config.js";
|
|
5
|
-
import { adapterFilePath, addNamedImport, addNamedTypeImport, aliasModule, appendDeferredPortKey, appendPickStringLiteralMember, applyPortProviderWiring, assertAdapterApp, assertFeatureArtifactApp, assertFeatureUiApp, assertGeneratedIdentifiers, assertPersistenceArtifactApp, assertPolicyApp, assertPortApp, assertServerRuntimeApp, assertStandardApp, assertTestApp, assertUseCaseApp, beignetDependencyVersion, constantCase, defineUploadsInitializerInfo, detectResourceDatabase, detectResourcePersistence, drizzleDialects, drizzleRepositoriesPath, drizzleResourceRepositoryFilePath, drizzleSchemaIndexPath, eventBusPortWiring, eventFilePath, factoryFilePath, featureArtifactDir, featureArtifactIndexFile, featureArtifactNames, featureResourceNames, featureUiClientQueriesFilePath, featureUiComponentFilePath, featureUiIndexFilePath, featureUiNames, fileExists, hasTopLevelObjectProperty, identifierNames, infrastructureDir, insertTypeProperty, jobFilePath, listenerFilePath, mergeMakeResultInto, mergeMakeResults, missingCapabilityBuilderFiles, notificationFilePath, notificationPortWirings, planGeneratedFile, planGeneratedFiles, portFilePath, portNames, providersFilePath, readOptionalFile, relativeModule, resourceContractFilePath, resourceFeatureDir, resourceNames, resourcePortFilePath, resourceSharedErrorsPath, scheduleFilePath, seedEntrypointPath, seedFilePath, seedNames, singularize, storagePortWiring, tanstackReactQueryDependencyVersion, taskFilePath, typeBodySource, uniqueStrings, updateDrizzleRepositories, updateDrizzleSchemaIndex, updateFeatureArtifactIndex, updateInfrastructureAdapterWiring, updateInfrastructureDeferredPorts, updateInfrastructureGatePolicies, updateInfrastructurePortStub, updateInfrastructurePorts, updateOpenApiRoute, updatePackageDependencies, updatePackageJson, updatePackageScripts, updatePortIndex, updatePortsIndex, updateSeedEntrypoint, updateServerRoutes, updateServerTransactionPorts, updateSharedErrors, uploadFilePath, useCaseFeatureDir, useCaseFilePath, usesFeatureOwnedPolicies, usesFeatureOwnedTests, wirePortProviders, writeGeneratedFile, writePlannedGeneratedFile, } from "./make/shared.js";
|
|
6
|
-
import { appendToArrayExpression,
|
|
5
|
+
import { adapterFilePath, addNamedImport, addNamedTypeImport, aliasModule, appendDeferredPortKey, appendPickStringLiteralMember, applyPortProviderWiring, assertAdapterApp, assertFeatureArtifactApp, assertFeatureUiApp, assertGeneratedIdentifiers, assertPersistenceArtifactApp, assertPolicyApp, assertPortApp, assertServerRuntimeApp, assertStandardApp, assertTestApp, assertUseCaseApp, beignetDependencyVersion, constantCase, defineUploadsInitializerInfo, detectResourceDatabase, detectResourcePersistence, drizzleDialects, drizzleRepositoriesPath, drizzleResourceRepositoryFilePath, drizzleSchemaIndexPath, eventBusPortWiring, eventFilePath, factoryFilePath, featureArtifactDir, featureArtifactIndexFile, featureArtifactNames, featureResourceNames, featureUiClientQueriesFilePath, featureUiComponentFilePath, featureUiIndexFilePath, featureUiNames, fileExists, hasTopLevelObjectProperty, identifierNames, infrastructureDir, insertTypeProperty, jobFilePath, listenerFilePath, mergeMakeResultInto, mergeMakeResults, missingCapabilityBuilderFiles, notificationFilePath, notificationPortWirings, planGeneratedFile, planGeneratedFiles, portFilePath, portNames, providersFilePath, readOptionalFile, relativeModule, resourceContractFilePath, resourceFeatureDir, resourceNames, resourcePortFilePath, resourceSharedErrorsPath, scheduleFilePath, seedEntrypointPath, seedFilePath, seedNames, singularize, storagePortWiring, tanstackReactQueryDependencyVersion, taskFilePath, typeBodySource, uniqueStrings, updateDrizzleRepositories, updateDrizzleSchemaIndex, updateFeatureArtifactIndex, updateInfrastructureAdapterWiring, updateInfrastructureDeferredPorts, updateInfrastructureGatePolicies, updateInfrastructurePortStub, updateInfrastructurePorts, updateOpenApiRoute, updatePackageDependencies, updatePackageJson, updatePackageScripts, updatePortIndex, updatePortsIndex, updateSeedEntrypoint, updateServerRoutes, updateServerTransactionPorts, updateSharedErrors, uploadFilePath, useCaseFeatureDir, useCaseFilePath, usesFeatureOwnedPolicies, usesFeatureOwnedTests, wireListenersProviderSource, wirePortProviders, writeGeneratedFile, writePlannedGeneratedFile, } from "./make/shared.js";
|
|
6
|
+
import { appendToArrayExpression, appendToOutboxRegistryArray, arrayInitializerInfo, identifiersFromArrayExpression, insertAfterImports, } from "./registry-edits.js";
|
|
7
7
|
export { makeFeatureAddonChoices, makeFeatureRecipeChoices, } from "./choices.js";
|
|
8
8
|
export * from "./make/inbox.js";
|
|
9
9
|
export * from "./make/payments.js";
|
|
@@ -791,63 +791,19 @@ async function updateListenerProviderWiring(targetDir, names, config, options) {
|
|
|
791
791
|
throw new Error(`Could not find the generated providers file ${providersFile}. Register listeners manually with registerListeners(...), or restore the generated providers file before running make listener.`);
|
|
792
792
|
}
|
|
793
793
|
const listenerIndex = featureArtifactIndexFile("listener", names, config);
|
|
794
|
-
const
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
next = addNamedTypeImport(next, "AppPorts", aliasModule(config.paths.ports));
|
|
802
|
-
const listenerImport = `import { ${listenerIndex.registryName} } from "${aliasModule(listenerIndex.path)}";`;
|
|
803
|
-
if (!next.includes(listenerImport)) {
|
|
804
|
-
next = insertAfterImports(next, listenerImport);
|
|
805
|
-
}
|
|
806
|
-
if (!new RegExp(`\\bconst\\s+${providerName}\\b`).test(next)) {
|
|
807
|
-
const providerDefinition = `const ${providerName} = createProvider<
|
|
808
|
-
\tPick<AppPorts, "eventBus" | "logger">,
|
|
809
|
-
\tAppContext,
|
|
810
|
-
\tAppServiceContextInput
|
|
811
|
-
>()({
|
|
812
|
-
\tname: "${names.feature.kebab}-listeners",
|
|
813
|
-
\tsetup({ ports, createServiceContext }) {
|
|
814
|
-
\t\tconst unregister = registerListeners(ports.eventBus, ${listenerIndex.registryName}, {
|
|
815
|
-
\t\t\tctx: () =>
|
|
816
|
-
\t\t\t\tcreateServiceContext({
|
|
817
|
-
\t\t\t\t\tactor: createServiceActor("beignet-listener"),
|
|
818
|
-
\t\t\t\t}),
|
|
819
|
-
\t\t\tonError(error, listener) {
|
|
820
|
-
\t\t\t\tports.logger.error("Event listener failed", {
|
|
821
|
-
\t\t\t\t\terror,
|
|
822
|
-
\t\t\t\t\tlistenerName: listener.name,
|
|
823
|
-
\t\t\t\t});
|
|
824
|
-
\t\t\t},
|
|
825
|
-
\t\t});
|
|
826
|
-
|
|
827
|
-
\t\treturn {
|
|
828
|
-
\t\t\tstop() {
|
|
829
|
-
\t\t\t\tunregister();
|
|
830
|
-
\t\t\t},
|
|
831
|
-
\t\t};
|
|
832
|
-
\t},
|
|
833
|
-
});
|
|
834
|
-
`;
|
|
835
|
-
const withProvider = next.replace(/\nexport const providers = \[/, `\n${providerDefinition}\nexport const providers = [`);
|
|
836
|
-
if (withProvider === next) {
|
|
837
|
-
throw new Error(`Could not find the exported providers array in ${providersFile}. Register ${listenerIndex.registryName} manually with registerListeners(...), or restore the generated providers file before running make listener.`);
|
|
838
|
-
}
|
|
839
|
-
next = withProvider;
|
|
840
|
-
}
|
|
841
|
-
const appended = appendToNamedArray(next, "providers", providerName);
|
|
842
|
-
if (appended.kind === "missing") {
|
|
794
|
+
const result = wireListenersProviderSource(original, {
|
|
795
|
+
registryName: listenerIndex.registryName,
|
|
796
|
+
featureKebab: names.feature.kebab,
|
|
797
|
+
listenerModule: aliasModule(listenerIndex.path),
|
|
798
|
+
config,
|
|
799
|
+
});
|
|
800
|
+
if (result.kind === "missing") {
|
|
843
801
|
throw new Error(`Could not find the exported providers array in ${providersFile}. Register ${listenerIndex.registryName} manually with registerListeners(...), or restore the generated providers file before running make listener.`);
|
|
844
802
|
}
|
|
845
|
-
if (
|
|
846
|
-
next = appended.source;
|
|
847
|
-
if (next === original)
|
|
803
|
+
if (result.kind === "unchanged")
|
|
848
804
|
return "skipped";
|
|
849
805
|
if (!options.dryRun)
|
|
850
|
-
await writeFile(filePath,
|
|
806
|
+
await writeFile(filePath, result.source);
|
|
851
807
|
return "updated";
|
|
852
808
|
}
|
|
853
809
|
export async function makeSchedule(options) {
|