@sprucelabs/spruce-cli 28.2.3 → 29.0.1
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 +24 -0
- package/build/.spruce/errors/errors.types.d.ts +23 -2
- package/build/.spruce/errors/options.types.d.ts +4 -1
- package/build/.spruce/errors/spruceCli/directoryNotGoModule.schema.d.ts +3 -0
- package/build/.spruce/errors/spruceCli/directoryNotGoModule.schema.js +20 -0
- package/build/.spruce/errors/spruceCli/directoryNotGoModule.schema.js.map +1 -0
- package/build/__tests__/behavioral/OverridingCommandsInPackageJson.test.d.ts +7 -2
- package/build/__tests__/behavioral/OverridingCommandsInPackageJson.test.js +36 -13
- package/build/__tests__/behavioral/OverridingCommandsInPackageJson.test.js.map +1 -1
- package/build/__tests__/behavioral/events/DifferentEventOptions.test.d.ts +16 -0
- package/build/__tests__/behavioral/events/DifferentEventOptions.test.js +105 -0
- package/build/__tests__/behavioral/events/DifferentEventOptions.test.js.map +1 -0
- package/build/__tests__/behavioral/events/KeepingEventsInSync.test.js.map +1 -1
- package/build/__tests__/behavioral/features/InstallFeaturesInGo.test.d.ts +5 -0
- package/build/__tests__/behavioral/features/InstallFeaturesInGo.test.js +32 -0
- package/build/__tests__/behavioral/features/InstallFeaturesInGo.test.js.map +1 -0
- package/build/__tests__/behavioral/organization/CreatingAnOrg.test.d.ts +5 -0
- package/build/__tests__/behavioral/organization/CreatingAnOrg.test.js +21 -13
- package/build/__tests__/behavioral/organization/CreatingAnOrg.test.js.map +1 -1
- package/build/__tests__/behavioral/schemas/KeepingSchemasInSync.test.d.ts +1 -1
- package/build/__tests__/behavioral/schemas/KeepingSchemasInSync.test.js +7 -7
- package/build/__tests__/behavioral/schemas/KeepingSchemasInSync.test.js.map +1 -1
- package/build/__tests__/behavioral/schemas/SyncingCoreSchemasInGo.test.d.ts +39 -0
- package/build/__tests__/behavioral/schemas/SyncingCoreSchemasInGo.test.js +289 -0
- package/build/__tests__/behavioral/schemas/SyncingCoreSchemasInGo.test.js.map +1 -0
- package/build/__tests__/behavioral/schemas/SyncingSchemasInChildDirInGo.test.d.ts +7 -0
- package/build/__tests__/behavioral/schemas/SyncingSchemasInChildDirInGo.test.js +46 -0
- package/build/__tests__/behavioral/schemas/SyncingSchemasInChildDirInGo.test.js.map +1 -0
- package/build/__tests__/behavioral/schemas/SyncingSchemasInGo.test.d.ts +5 -0
- package/build/__tests__/behavioral/schemas/SyncingSchemasInGo.test.js +31 -0
- package/build/__tests__/behavioral/schemas/SyncingSchemasInGo.test.js.map +1 -0
- package/build/__tests__/behavioral/tests/SelectingAnAbstractTestClass.test.js +1 -1
- package/build/__tests__/behavioral/tests/SelectingAnAbstractTestClass.test.js.map +1 -1
- package/build/__tests__/behavioral/upgrading/UpdatingDependencies2.test.js +10 -1
- package/build/__tests__/behavioral/upgrading/UpdatingDependencies2.test.js.map +1 -1
- package/build/__tests__/implementation/SkillStore.test.d.ts +5 -0
- package/build/__tests__/implementation/SkillStore.test.js +37 -0
- package/build/__tests__/implementation/SkillStore.test.js.map +1 -1
- package/build/__tests__/support/EventFaker.d.ts +7 -0
- package/build/__tests__/support/EventFaker.js +43 -0
- package/build/__tests__/support/EventFaker.js.map +1 -1
- package/build/cli/Cli.js +12 -9
- package/build/cli/Cli.js.map +1 -1
- package/build/errors/SpruceError.js +3 -0
- package/build/errors/SpruceError.js.map +1 -1
- package/build/errors/directoryNotGoModule.builder.d.ts +12 -0
- package/build/errors/directoryNotGoModule.builder.js +15 -0
- package/build/errors/directoryNotGoModule.builder.js.map +1 -0
- package/build/features/AbstractAction.d.ts +1 -0
- package/build/features/AbstractAction.js +5 -1
- package/build/features/AbstractAction.js.map +1 -1
- package/build/features/AbstractFeature.d.ts +8 -1
- package/build/features/AbstractFeature.js +12 -1
- package/build/features/AbstractFeature.js.map +1 -1
- package/build/features/ActionFactory.js +1 -2
- package/build/features/ActionFactory.js.map +1 -1
- package/build/features/ActionQuestionAsker.js +0 -1
- package/build/features/ActionQuestionAsker.js.map +1 -1
- package/build/features/FeatureInstaller.d.ts +1 -0
- package/build/features/FeatureInstaller.js +21 -7
- package/build/features/FeatureInstaller.js.map +1 -1
- package/build/features/FeatureInstallerFactory.d.ts +1 -0
- package/build/features/FeatureInstallerFactory.js +7 -0
- package/build/features/FeatureInstallerFactory.js.map +1 -1
- package/build/features/OverrideActionDecorator.js +1 -1
- package/build/features/OverrideActionDecorator.js.map +1 -1
- package/build/features/VersionResolver.js +1 -1
- package/build/features/VersionResolver.js.map +1 -1
- package/build/features/agent/AgentFeature.d.ts +1 -1
- package/build/features/agent/AgentFeature.js +1 -1
- package/build/features/agent/AgentFeature.js.map +1 -1
- package/build/features/conversation/ConversationFeature.d.ts +1 -1
- package/build/features/conversation/ConversationFeature.js +1 -1
- package/build/features/conversation/ConversationFeature.js.map +1 -1
- package/build/features/dependencies/DependencyFeature.d.ts +0 -1
- package/build/features/dependencies/DependencyFeature.js +0 -1
- package/build/features/dependencies/DependencyFeature.js.map +1 -1
- package/build/features/deploy/DeployFeature.d.ts +1 -1
- package/build/features/deploy/DeployFeature.js +1 -1
- package/build/features/deploy/DeployFeature.js.map +1 -1
- package/build/features/error/ErrorFeature.d.ts +1 -1
- package/build/features/error/ErrorFeature.js +1 -1
- package/build/features/error/ErrorFeature.js.map +1 -1
- package/build/features/event/EventFeature.d.ts +1 -1
- package/build/features/event/EventFeature.js +1 -1
- package/build/features/event/EventFeature.js.map +1 -1
- package/build/features/eventContract/EventContractFeature.d.ts +1 -3
- package/build/features/eventContract/EventContractFeature.js +0 -2
- package/build/features/eventContract/EventContractFeature.js.map +1 -1
- package/build/features/node/NodeFeature.d.ts +1 -1
- package/build/features/node/NodeFeature.js +1 -1
- package/build/features/node/NodeFeature.js.map +1 -1
- package/build/features/onboard/OnboardFeature.d.ts +1 -3
- package/build/features/onboard/OnboardFeature.js +0 -2
- package/build/features/onboard/OnboardFeature.js.map +1 -1
- package/build/features/organization/OrganizationFeature.d.ts +0 -1
- package/build/features/organization/OrganizationFeature.js +0 -1
- package/build/features/organization/OrganizationFeature.js.map +1 -1
- package/build/features/permission/PermissionFeature.d.ts +2 -3
- package/build/features/permission/PermissionFeature.js +1 -2
- package/build/features/permission/PermissionFeature.js.map +1 -1
- package/build/features/person/PersonFeature.d.ts +1 -3
- package/build/features/person/PersonFeature.js +0 -2
- package/build/features/person/PersonFeature.js.map +1 -1
- package/build/features/polish/PolishFeature.d.ts +1 -1
- package/build/features/polish/PolishFeature.js +1 -1
- package/build/features/polish/PolishFeature.js.map +1 -1
- package/build/features/sandbox/SandboxFeature.d.ts +0 -1
- package/build/features/sandbox/SandboxFeature.js +0 -1
- package/build/features/sandbox/SandboxFeature.js.map +1 -1
- package/build/features/schema/SchemaFeature.d.ts +2 -3
- package/build/features/schema/SchemaFeature.js +6 -1
- package/build/features/schema/SchemaFeature.js.map +1 -1
- package/build/features/schema/actions/SyncAction.d.ts +5 -2
- package/build/features/schema/actions/SyncAction.js +50 -16
- package/build/features/schema/actions/SyncAction.js.map +1 -1
- package/build/features/schema/utilities/schemaDisk.utility.d.ts +7 -0
- package/build/features/schema/utilities/schemaDisk.utility.js +22 -4
- package/build/features/schema/utilities/schemaDisk.utility.js.map +1 -1
- package/build/features/schema/utilities/schemaGenerator.utility.d.ts +1 -0
- package/build/features/schema/utilities/schemaGenerator.utility.js +18 -10
- package/build/features/schema/utilities/schemaGenerator.utility.js.map +1 -1
- package/build/features/schema/writers/SchemaWriter.d.ts +9 -9
- package/build/features/schema/writers/SchemaWriter.js +38 -17
- package/build/features/schema/writers/SchemaWriter.js.map +1 -1
- package/build/features/skill/SkillFeature.d.ts +1 -1
- package/build/features/skill/SkillFeature.js +1 -1
- package/build/features/skill/SkillFeature.js.map +1 -1
- package/build/features/skill/stores/SkillStore.d.ts +5 -0
- package/build/features/skill/stores/SkillStore.js +40 -3
- package/build/features/skill/stores/SkillStore.js.map +1 -1
- package/build/features/store/StoreFeature.d.ts +1 -1
- package/build/features/store/StoreFeature.js +1 -1
- package/build/features/store/StoreFeature.js.map +1 -1
- package/build/features/test/TestFeature.d.ts +1 -1
- package/build/features/test/TestFeature.js +1 -1
- package/build/features/test/TestFeature.js.map +1 -1
- package/build/features/test/TestReporter.js +1 -1
- package/build/features/test/TestReporter.js.map +1 -1
- package/build/features/view/ViewFeature.d.ts +1 -1
- package/build/features/view/ViewFeature.js +1 -1
- package/build/features/view/ViewFeature.js.map +1 -1
- package/build/migration/EsLint9Migrator.d.ts +1 -0
- package/build/packageManager/NodePackageManager.d.ts +14 -0
- package/build/packageManager/NodePackageManager.js +88 -0
- package/build/packageManager/NodePackageManager.js.map +1 -0
- package/build/packageManager/packageManager.types.d.ts +16 -0
- package/build/packageManager/packageManager.types.js +3 -0
- package/build/packageManager/packageManager.types.js.map +1 -0
- package/build/services/GoPackageManager.d.ts +10 -0
- package/build/services/GoPackageManager.js +39 -0
- package/build/services/GoPackageManager.js.map +1 -0
- package/build/services/PkgService.d.ts +3 -7
- package/build/services/PkgService.js +13 -68
- package/build/services/PkgService.js.map +1 -1
- package/build/templateItemBuilders/SchemaTemplateItemBuilder.js.map +1 -1
- package/build/tests/AbstractCliTest.d.ts +5 -1
- package/build/tests/AbstractCliTest.js +15 -3
- package/build/tests/AbstractCliTest.js.map +1 -1
- package/build/tests/fixtures/FeatureFixture.js +4 -1
- package/build/tests/fixtures/FeatureFixture.js.map +1 -1
- package/build/tests/fixtures/GoFixture.d.ts +12 -0
- package/build/tests/fixtures/GoFixture.js +39 -0
- package/build/tests/fixtures/GoFixture.js.map +1 -0
- package/build/tests/staticToInstanceMigration/StaticToInstanceMigrator.d.ts +1 -0
- package/build/widgets/terminalKit/TkTextWidget.js +3 -2
- package/build/widgets/terminalKit/TkTextWidget.js.map +1 -1
- package/build/writers/AbstractWriter.js +7 -6
- package/build/writers/AbstractWriter.js.map +1 -1
- package/package.json +30 -30
- package/src/.spruce/errors/errors.types.ts +32 -2
- package/src/.spruce/errors/options.types.ts +4 -1
- package/src/.spruce/errors/spruceCli/directoryNotGoModule.schema.ts +23 -0
- package/src/__tests__/behavioral/OverridingCommandsInPackageJson.test.ts +60 -13
- package/src/__tests__/behavioral/events/DifferentEventOptions.test.ts +134 -0
- package/src/__tests__/behavioral/events/KeepingEventsInSync.test.ts +0 -1
- package/src/__tests__/behavioral/features/InstallFeaturesInGo.test.ts +17 -0
- package/src/__tests__/behavioral/organization/CreatingAnOrg.test.ts +29 -22
- package/src/__tests__/behavioral/schemas/KeepingSchemasInSync.test.ts +6 -9
- package/src/__tests__/behavioral/schemas/SyncingCoreSchemasInGo.test.ts +376 -0
- package/src/__tests__/behavioral/schemas/SyncingSchemasInChildDirInGo.test.ts +46 -0
- package/src/__tests__/behavioral/schemas/SyncingSchemasInGo.test.ts +23 -0
- package/src/__tests__/behavioral/tests/SelectingAnAbstractTestClass.test.ts +1 -1
- package/src/__tests__/behavioral/upgrading/UpdatingDependencies2.test.ts +15 -2
- package/src/__tests__/implementation/SkillStore.test.ts +44 -1
- package/src/__tests__/support/EventFaker.ts +56 -0
- package/src/cli/Cli.ts +20 -12
- package/src/errors/SpruceError.ts +4 -0
- package/src/errors/directoryNotGoModule.builder.ts +13 -0
- package/src/features/AbstractAction.ts +6 -4
- package/src/features/AbstractFeature.ts +20 -1
- package/src/features/ActionFactory.ts +2 -2
- package/src/features/ActionQuestionAsker.ts +0 -1
- package/src/features/FeatureInstaller.ts +30 -6
- package/src/features/FeatureInstallerFactory.ts +9 -0
- package/src/features/OverrideActionDecorator.ts +1 -1
- package/src/features/VersionResolver.ts +2 -1
- package/src/features/agent/AgentFeature.ts +1 -1
- package/src/features/conversation/ConversationFeature.ts +1 -1
- package/src/features/dependencies/DependencyFeature.ts +0 -1
- package/src/features/deploy/DeployFeature.ts +1 -1
- package/src/features/error/ErrorFeature.ts +1 -1
- package/src/features/event/EventFeature.ts +1 -1
- package/src/features/eventContract/EventContractFeature.ts +1 -3
- package/src/features/node/NodeFeature.ts +1 -1
- package/src/features/onboard/OnboardFeature.ts +1 -7
- package/src/features/organization/OrganizationFeature.ts +0 -1
- package/src/features/permission/PermissionFeature.ts +1 -3
- package/src/features/person/PersonFeature.ts +1 -4
- package/src/features/polish/PolishFeature.ts +1 -1
- package/src/features/sandbox/SandboxFeature.ts +0 -1
- package/src/features/schema/SchemaFeature.ts +8 -2
- package/src/features/schema/actions/SyncAction.ts +68 -26
- package/src/features/schema/utilities/schemaDisk.utility.ts +43 -11
- package/src/features/schema/utilities/schemaGenerator.utility.ts +33 -13
- package/src/features/schema/writers/SchemaWriter.ts +71 -25
- package/src/features/skill/SkillFeature.ts +1 -1
- package/src/features/skill/stores/SkillStore.ts +51 -5
- package/src/features/store/StoreFeature.ts +1 -1
- package/src/features/test/TestFeature.ts +1 -1
- package/src/features/test/TestReporter.ts +1 -1
- package/src/features/view/ViewFeature.ts +1 -1
- package/src/packageManager/NodePackageManager.ts +115 -0
- package/src/packageManager/packageManager.types.ts +21 -0
- package/src/services/GoPackageManager.ts +45 -0
- package/src/services/PkgService.ts +17 -92
- package/src/templateItemBuilders/SchemaTemplateItemBuilder.ts +6 -6
- package/src/tests/AbstractCliTest.ts +19 -5
- package/src/tests/fixtures/FeatureFixture.ts +3 -1
- package/src/tests/fixtures/GoFixture.ts +39 -0
- package/src/widgets/terminalKit/TkTextWidget.ts +3 -2
- package/src/writers/AbstractWriter.ts +15 -6
|
@@ -48,6 +48,7 @@ import AbstractSpruceError from '@sprucelabs/error'
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
|
|
51
|
+
|
|
51
52
|
|
|
52
53
|
|
|
53
54
|
export declare namespace SpruceErrors.SpruceCli {
|
|
@@ -291,7 +292,7 @@ export declare namespace SpruceErrors.SpruceCli {
|
|
|
291
292
|
|
|
292
293
|
'fieldName': string
|
|
293
294
|
|
|
294
|
-
'fieldOptions':
|
|
295
|
+
'fieldOptions': Record<string, any>
|
|
295
296
|
}
|
|
296
297
|
|
|
297
298
|
export interface SchemaTemplateItemBuildingFailedSchema extends SpruceSchema.Schema {
|
|
@@ -551,7 +552,7 @@ export declare namespace SpruceErrors.SpruceCli {
|
|
|
551
552
|
export interface MercuryResponseError {
|
|
552
553
|
|
|
553
554
|
|
|
554
|
-
'responseErrors':
|
|
555
|
+
'responseErrors': AbstractSpruceError<any>[]
|
|
555
556
|
}
|
|
556
557
|
|
|
557
558
|
export interface MercuryResponseErrorSchema extends SpruceSchema.Schema {
|
|
@@ -949,6 +950,35 @@ export declare namespace SpruceErrors.SpruceCli {
|
|
|
949
950
|
}
|
|
950
951
|
|
|
951
952
|
|
|
953
|
+
export declare namespace SpruceErrors.SpruceCli {
|
|
954
|
+
|
|
955
|
+
|
|
956
|
+
export interface DirectoryNotGoModule {
|
|
957
|
+
|
|
958
|
+
/** Current Working Directory. */
|
|
959
|
+
'cwd': string
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
export interface DirectoryNotGoModuleSchema extends SpruceSchema.Schema {
|
|
963
|
+
id: 'directoryNotGoModule',
|
|
964
|
+
namespace: 'SpruceCli',
|
|
965
|
+
name: 'Directory not go module',
|
|
966
|
+
fields: {
|
|
967
|
+
/** Current Working Directory. */
|
|
968
|
+
'cwd': {
|
|
969
|
+
label: 'Current Working Directory',
|
|
970
|
+
type: 'text',
|
|
971
|
+
isRequired: true,
|
|
972
|
+
options: undefined
|
|
973
|
+
},
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
export type DirectoryNotGoModuleEntity = SchemaEntity<SpruceErrors.SpruceCli.DirectoryNotGoModuleSchema>
|
|
978
|
+
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
|
|
952
982
|
export declare namespace SpruceErrors.SpruceCli {
|
|
953
983
|
|
|
954
984
|
|
|
@@ -91,6 +91,9 @@ export interface DockerNotStartedErrorOptions extends SpruceErrors.SpruceCli.Doc
|
|
|
91
91
|
export interface DirectoryNotSkillErrorOptions extends SpruceErrors.SpruceCli.DirectoryNotSkill, ISpruceErrorOptions {
|
|
92
92
|
code: 'DIRECTORY_NOT_SKILL'
|
|
93
93
|
}
|
|
94
|
+
export interface DirectoryNotGoModuleErrorOptions extends SpruceErrors.SpruceCli.DirectoryNotGoModule, ISpruceErrorOptions {
|
|
95
|
+
code: 'DIRECTORY_NOT_GO_MODULE'
|
|
96
|
+
}
|
|
94
97
|
export interface DirectoryEmptyErrorOptions extends SpruceErrors.SpruceCli.DirectoryEmpty, ISpruceErrorOptions {
|
|
95
98
|
code: 'DIRECTORY_EMPTY'
|
|
96
99
|
}
|
|
@@ -134,6 +137,6 @@ export interface ActionCancelledErrorOptions extends SpruceErrors.SpruceCli.Acti
|
|
|
134
137
|
code: 'ACTION_CANCELLED'
|
|
135
138
|
}
|
|
136
139
|
|
|
137
|
-
type ErrorOptions = | VscodeNotInstalledErrorOptions | ViewPluginAlreadyExistsErrorOptions | TransportAlreadyExistsErrorOptions | ThemeExistsErrorOptions | TestFailedErrorOptions | StoreExistsErrorOptions | SkillViewExistsErrorOptions | SkillNotRegisteredErrorOptions | SkillNotFoundErrorOptions | SchemaTemplateItemBuildingFailedErrorOptions | SchemaFailedToImportErrorOptions | SchemaExistsErrorOptions | NotLoggedInErrorOptions | NotImplementedErrorOptions | NoSkillsRegisteredErrorOptions | NoOrganizationsFoundErrorOptions | MissingDependenciesErrorOptions | MercuryResponseErrorErrorOptions | LintFailedErrorOptions | InvalidTestDirectoryErrorOptions | InvalidFeatureCodeErrorOptions | InvalidEventContractErrorOptions | InvalidCommandErrorOptions | GenericErrorOptions | FileExistsErrorOptions | FeatureNotInstalledErrorOptions | FailedToImportErrorOptions | ExecutingCommandFailedErrorOptions | DockerNotStartedErrorOptions | DirectoryNotSkillErrorOptions | DirectoryEmptyErrorOptions | DeployFailedErrorOptions | DependencyExistsErrorOptions | CreateAutoloaderFailedErrorOptions | CommandNotImplementedErrorOptions | CommandBlockedErrorOptions | CommandAbortedErrorOptions | CannotPromptInCiErrorOptions | CacheNotEnabledErrorOptions | BuildFailedErrorOptions | BootErrorErrorOptions | AppControllerAlreadyExistsErrorOptions | AgentAlreadyRegisteredErrorOptions | ActionCancelledErrorOptions
|
|
140
|
+
type ErrorOptions = | VscodeNotInstalledErrorOptions | ViewPluginAlreadyExistsErrorOptions | TransportAlreadyExistsErrorOptions | ThemeExistsErrorOptions | TestFailedErrorOptions | StoreExistsErrorOptions | SkillViewExistsErrorOptions | SkillNotRegisteredErrorOptions | SkillNotFoundErrorOptions | SchemaTemplateItemBuildingFailedErrorOptions | SchemaFailedToImportErrorOptions | SchemaExistsErrorOptions | NotLoggedInErrorOptions | NotImplementedErrorOptions | NoSkillsRegisteredErrorOptions | NoOrganizationsFoundErrorOptions | MissingDependenciesErrorOptions | MercuryResponseErrorErrorOptions | LintFailedErrorOptions | InvalidTestDirectoryErrorOptions | InvalidFeatureCodeErrorOptions | InvalidEventContractErrorOptions | InvalidCommandErrorOptions | GenericErrorOptions | FileExistsErrorOptions | FeatureNotInstalledErrorOptions | FailedToImportErrorOptions | ExecutingCommandFailedErrorOptions | DockerNotStartedErrorOptions | DirectoryNotSkillErrorOptions | DirectoryNotGoModuleErrorOptions | DirectoryEmptyErrorOptions | DeployFailedErrorOptions | DependencyExistsErrorOptions | CreateAutoloaderFailedErrorOptions | CommandNotImplementedErrorOptions | CommandBlockedErrorOptions | CommandAbortedErrorOptions | CannotPromptInCiErrorOptions | CacheNotEnabledErrorOptions | BuildFailedErrorOptions | BootErrorErrorOptions | AppControllerAlreadyExistsErrorOptions | AgentAlreadyRegisteredErrorOptions | ActionCancelledErrorOptions
|
|
138
141
|
|
|
139
142
|
export default ErrorOptions
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SchemaRegistry } from '@sprucelabs/schema'
|
|
2
|
+
import { SpruceErrors } from '../errors.types'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const directoryNotGoModuleSchema: SpruceErrors.SpruceCli.DirectoryNotGoModuleSchema = {
|
|
7
|
+
id: 'directoryNotGoModule',
|
|
8
|
+
namespace: 'SpruceCli',
|
|
9
|
+
name: 'Directory not go module',
|
|
10
|
+
fields: {
|
|
11
|
+
/** Current Working Directory. */
|
|
12
|
+
'cwd': {
|
|
13
|
+
label: 'Current Working Directory',
|
|
14
|
+
type: 'text',
|
|
15
|
+
isRequired: true,
|
|
16
|
+
options: undefined
|
|
17
|
+
},
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
SchemaRegistry.getInstance().trackSchema(directoryNotGoModuleSchema)
|
|
22
|
+
|
|
23
|
+
export default directoryNotGoModuleSchema
|
|
@@ -5,10 +5,36 @@ import MockProgramFactory from '../../tests/MockProgramFactory'
|
|
|
5
5
|
|
|
6
6
|
export default class OverridingCommandsInPackageJsonTest extends AbstractSkillTest {
|
|
7
7
|
protected static skillCacheKey = 'schemas'
|
|
8
|
+
private static originalPackageJson: string
|
|
9
|
+
private static originalSettingsJson: string
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this.
|
|
11
|
+
protected static async beforeEach() {
|
|
12
|
+
await super.beforeEach()
|
|
13
|
+
if (!this.originalPackageJson) {
|
|
14
|
+
this.originalPackageJson = diskUtil.readFile(
|
|
15
|
+
this.resolvePath('package.json')
|
|
16
|
+
)
|
|
17
|
+
this.originalSettingsJson = diskUtil.readFile(
|
|
18
|
+
this.resolveHashSprucePath('settings.json')
|
|
19
|
+
)
|
|
20
|
+
} else {
|
|
21
|
+
diskUtil.writeFile(
|
|
22
|
+
this.resolvePath('package.json'),
|
|
23
|
+
this.originalPackageJson
|
|
24
|
+
)
|
|
25
|
+
diskUtil.writeFile(
|
|
26
|
+
this.resolveHashSprucePath('settings.json'),
|
|
27
|
+
this.originalSettingsJson
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@test('running honors overrides in package.json', 'package.json')
|
|
33
|
+
@test('running honors overrides in settings.json', 'settings.json')
|
|
34
|
+
protected static async runningCommandHonorsOverrides(
|
|
35
|
+
override: OverrideFile
|
|
36
|
+
) {
|
|
37
|
+
this.overrideOptions(override)
|
|
12
38
|
|
|
13
39
|
const cli = await this.FeatureFixture().Cli({
|
|
14
40
|
program: MockProgramFactory.Program(),
|
|
@@ -21,9 +47,18 @@ export default class OverridingCommandsInPackageJsonTest extends AbstractSkillTe
|
|
|
21
47
|
this.assertCoreSchemasDidNotSync()
|
|
22
48
|
}
|
|
23
49
|
|
|
24
|
-
@test(
|
|
25
|
-
|
|
26
|
-
|
|
50
|
+
@test(
|
|
51
|
+
'running honors overrides in package.json when command is forwarded',
|
|
52
|
+
'package.json'
|
|
53
|
+
)
|
|
54
|
+
@test(
|
|
55
|
+
'running honors overrides in settings.json when command is forwarded',
|
|
56
|
+
'settings.json'
|
|
57
|
+
)
|
|
58
|
+
protected static async runningCommandHonorsOverridesWhenCommandIsForwarded(
|
|
59
|
+
override: OverrideFile
|
|
60
|
+
) {
|
|
61
|
+
this.overrideOptions(override)
|
|
27
62
|
|
|
28
63
|
const cli = await this.FeatureFixture().Cli({
|
|
29
64
|
program: MockProgramFactory.Program(),
|
|
@@ -49,14 +84,26 @@ export default class OverridingCommandsInPackageJsonTest extends AbstractSkillTe
|
|
|
49
84
|
'person.schema.ts'
|
|
50
85
|
)
|
|
51
86
|
|
|
52
|
-
assert.isFalse(
|
|
87
|
+
assert.isFalse(
|
|
88
|
+
diskUtil.doesFileExist(personPath),
|
|
89
|
+
'did not expect to find person.schema.ts'
|
|
90
|
+
)
|
|
53
91
|
}
|
|
54
92
|
|
|
55
|
-
private static overrideOptions() {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
93
|
+
private static overrideOptions(override: OverrideFile) {
|
|
94
|
+
if (override === 'settings.json') {
|
|
95
|
+
const settings = this.Service('settings')
|
|
96
|
+
settings.set('commandOverrides', {
|
|
97
|
+
'sync.schemas': '--shouldFetchCoreSchemas false',
|
|
98
|
+
})
|
|
99
|
+
} else {
|
|
100
|
+
const pkg = this.Service('pkg')
|
|
101
|
+
pkg.set({
|
|
102
|
+
path: ['skill', 'commandOverrides', 'sync.schemas'],
|
|
103
|
+
value: '--shouldFetchCoreSchemas false',
|
|
104
|
+
})
|
|
105
|
+
}
|
|
61
106
|
}
|
|
62
107
|
}
|
|
108
|
+
|
|
109
|
+
type OverrideFile = 'package.json' | 'settings.json'
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { SpruceSchemas } from '@sprucelabs/mercury-types'
|
|
2
|
+
import { diskUtil } from '@sprucelabs/spruce-skill-utils'
|
|
3
|
+
import { test, assert, generateId } from '@sprucelabs/test-utils'
|
|
4
|
+
import AbstractSkillTest from '../../../tests/AbstractSkillTest'
|
|
5
|
+
import testUtil from '../../../tests/utilities/test.utility'
|
|
6
|
+
import { RegisteredSkill } from '../../../types/cli.types'
|
|
7
|
+
|
|
8
|
+
export default class EventsWithFeedTemplatesTest extends AbstractSkillTest {
|
|
9
|
+
protected static skillCacheKey = 'events'
|
|
10
|
+
private static eventOptionsFile: string
|
|
11
|
+
private static skill: RegisteredSkill
|
|
12
|
+
|
|
13
|
+
@test()
|
|
14
|
+
protected static async feedIsPassedToRegistration() {
|
|
15
|
+
this.skill = await this.registerSkill()
|
|
16
|
+
|
|
17
|
+
await this.createEvent()
|
|
18
|
+
|
|
19
|
+
const feedTemplate: FeedOptions = {
|
|
20
|
+
template: generateId(),
|
|
21
|
+
}
|
|
22
|
+
this.dropIntoEventOptions(`feed: ${JSON.stringify(feedTemplate)},`)
|
|
23
|
+
|
|
24
|
+
const signature = await this.syncAndFetchSignature()
|
|
25
|
+
|
|
26
|
+
assert.isEqualDeep(
|
|
27
|
+
signature.feed,
|
|
28
|
+
feedTemplate,
|
|
29
|
+
'Feed template should match.'
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@test()
|
|
34
|
+
protected static async canHandleBackticksInAiInstructions() {
|
|
35
|
+
const aiInstructions = 'Here `there` be dragons'
|
|
36
|
+
this.dropIntoEventOptions(`aiInstructions: '${aiInstructions}',`)
|
|
37
|
+
|
|
38
|
+
const signature = await this.syncAndFetchSignature()
|
|
39
|
+
|
|
40
|
+
assert.isEqual(
|
|
41
|
+
signature.aiInstructions,
|
|
42
|
+
aiInstructions,
|
|
43
|
+
'AI instructions should match.'
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@test()
|
|
48
|
+
protected static async canHandleBackticksInDescription() {
|
|
49
|
+
const description = 'This event `describes` something'
|
|
50
|
+
this.dropIntoEventOptions(`description: '${description}',`)
|
|
51
|
+
|
|
52
|
+
const signature = await this.syncAndFetchSignature()
|
|
53
|
+
|
|
54
|
+
assert.isEqual(
|
|
55
|
+
signature.description,
|
|
56
|
+
description,
|
|
57
|
+
'Description should match.'
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private static async syncAndFetchSignature() {
|
|
62
|
+
await this.syncEvents()
|
|
63
|
+
await this.lintBuildAndBoot()
|
|
64
|
+
const signature = await this.fetchCreatedEventSignature()
|
|
65
|
+
return signature
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private static dropIntoEventOptions(dropIn: string) {
|
|
69
|
+
const contents = diskUtil.readFile(this.eventOptionsFile)
|
|
70
|
+
const updated = contents.replace(
|
|
71
|
+
'isGlobal: false,',
|
|
72
|
+
`isGlobal: false, ${dropIn}`
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
diskUtil.writeFile(this.eventOptionsFile, updated)
|
|
76
|
+
return updated
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
private static async fetchCreatedEventSignature() {
|
|
80
|
+
const client = await this.connectToApi({
|
|
81
|
+
shouldAuthAsCurrentSkill: true,
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
const [{ contracts }] = await client.emitAndFlattenResponses(
|
|
85
|
+
'get-event-contracts::v2020_12_25',
|
|
86
|
+
{
|
|
87
|
+
target: {
|
|
88
|
+
namespaces: [this.skill.slug],
|
|
89
|
+
},
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
const first = contracts[0]
|
|
93
|
+
const { eventSignatures } = first
|
|
94
|
+
const fqen = Object.keys(eventSignatures)[0]
|
|
95
|
+
const signature = eventSignatures[fqen]
|
|
96
|
+
return signature
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
private static async lintBuildAndBoot() {
|
|
100
|
+
await this.Service('command').execute('yarn fix.lint')
|
|
101
|
+
await this.Service('command').execute('yarn build.dev')
|
|
102
|
+
const boot = await this.Action('skill', 'boot').execute({})
|
|
103
|
+
assert.isFalsy(boot.errors, 'Should not have boot errors.')
|
|
104
|
+
boot.meta?.kill()
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
private static async createEvent() {
|
|
108
|
+
const results = await this.Action('event', 'create').execute({
|
|
109
|
+
nameReadable: 'a new event',
|
|
110
|
+
nameKebab: 'my-new-event',
|
|
111
|
+
nameCamel: 'myNewEvent',
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
assert.isFalsy(results.errors, 'Should not have errors.')
|
|
115
|
+
|
|
116
|
+
this.eventOptionsFile = testUtil.assertFileByNameInGeneratedFiles(
|
|
117
|
+
'event.options.ts',
|
|
118
|
+
results.files
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
private static async registerSkill() {
|
|
123
|
+
return await this.getSkillFixture().registerCurrentSkill({
|
|
124
|
+
name: 'current skill',
|
|
125
|
+
})
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
private static async syncEvents() {
|
|
129
|
+
const syncResults = await this.Action('event', 'sync').execute({})
|
|
130
|
+
assert.isFalsy(syncResults.errors, 'Should not have sync errors.')
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
type FeedOptions = SpruceSchemas.Mercury.v2020_12_25.FeedOptions
|
|
@@ -198,7 +198,6 @@ export function buildPermissionContract(..._: any[]):any { return _[0] }
|
|
|
198
198
|
|
|
199
199
|
private static async assertGlobalEventsAreTyped(eventName: string) {
|
|
200
200
|
const contents = diskUtil.readFile(this.eventContractPath)
|
|
201
|
-
|
|
202
201
|
assert.doesInclude(contents, `'${eventName}':`)
|
|
203
202
|
}
|
|
204
203
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { fake } from '@sprucelabs/spruce-test-fixtures'
|
|
2
|
+
import { test, assert } from '@sprucelabs/test-utils'
|
|
3
|
+
import AbstractCliTest from '../../../tests/AbstractCliTest'
|
|
4
|
+
|
|
5
|
+
@fake.login()
|
|
6
|
+
export default class InstallFeaturesInGoTest extends AbstractCliTest {
|
|
7
|
+
protected static async beforeEach(): Promise<void> {
|
|
8
|
+
await super.beforeEach()
|
|
9
|
+
await this.go.initGoProject()
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@test()
|
|
13
|
+
protected static async schemaFeatureNotInstalledToStart() {
|
|
14
|
+
const isInstalled = await this.featureInstaller.isInstalled('schema')
|
|
15
|
+
assert.isFalse(isInstalled, 'Schema feature should not be installed')
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,8 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { MercuryClientFactory } from '@sprucelabs/mercury-client'
|
|
2
|
+
import { Organization } from '@sprucelabs/spruce-core-schemas'
|
|
3
|
+
import { test, assert, generateId } from '@sprucelabs/test-utils'
|
|
3
4
|
import AbstractCliTest from '../../../tests/AbstractCliTest'
|
|
5
|
+
import { CreateOrganizationTargetAndPayload } from '../../support/EventFaker'
|
|
4
6
|
|
|
5
7
|
export default class CreatingAnOrgTest extends AbstractCliTest {
|
|
8
|
+
private static organization: Organization
|
|
9
|
+
private static slug = generateId()
|
|
10
|
+
private static nameReadable = generateId()
|
|
11
|
+
private static lastCreateOrgTargetAndPayload: CreateOrganizationTargetAndPayload
|
|
12
|
+
|
|
13
|
+
protected static async beforeEach(): Promise<void> {
|
|
14
|
+
await super.beforeEach()
|
|
15
|
+
|
|
16
|
+
MercuryClientFactory.setIsTestMode(true)
|
|
17
|
+
|
|
18
|
+
this.organization = this.eventFaker.generateOrganizationValues()
|
|
19
|
+
|
|
20
|
+
await this.eventFaker.fakeRequestPin()
|
|
21
|
+
await this.eventFaker.fakeConfirmPin()
|
|
22
|
+
await this.eventFaker.fakeCreateOrganization((targetAndPayload) => {
|
|
23
|
+
this.lastCreateOrgTargetAndPayload = targetAndPayload
|
|
24
|
+
return this.organization
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
|
|
6
28
|
@test()
|
|
7
29
|
protected static async hasCreateAction() {
|
|
8
30
|
await this.Cli()
|
|
@@ -11,33 +33,18 @@ export default class CreatingAnOrgTest extends AbstractCliTest {
|
|
|
11
33
|
|
|
12
34
|
@test()
|
|
13
35
|
protected static async createsAnOrg() {
|
|
14
|
-
const slug = `my-org-${new Date().getTime()}`
|
|
15
|
-
|
|
16
36
|
await this.FeatureFixture().installCachedFeatures('organizations')
|
|
17
37
|
await this.people.loginAsDemoPerson()
|
|
18
38
|
|
|
19
39
|
const results = await this.Action('organization', 'create').execute({
|
|
20
|
-
nameReadable:
|
|
21
|
-
nameKebab: slug,
|
|
40
|
+
nameReadable: this.nameReadable,
|
|
41
|
+
nameKebab: this.slug,
|
|
22
42
|
})
|
|
23
43
|
|
|
24
44
|
assert.isFalsy(results.errors)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
assert.isTruthy(organization)
|
|
29
|
-
|
|
30
|
-
const client = await this.connectToApi()
|
|
31
|
-
|
|
32
|
-
const orgResults = await client.emit('get-organization::v2020_12_25', {
|
|
33
|
-
target: {
|
|
34
|
-
organizationId: organization.id,
|
|
35
|
-
},
|
|
45
|
+
assert.isEqualDeep(this.lastCreateOrgTargetAndPayload.payload, {
|
|
46
|
+
name: this.nameReadable,
|
|
47
|
+
slug: this.slug,
|
|
36
48
|
})
|
|
37
|
-
|
|
38
|
-
const { organization: getOrganization } =
|
|
39
|
-
eventResponseUtil.getFirstResponseOrThrow(orgResults)
|
|
40
|
-
|
|
41
|
-
assert.isEqual(getOrganization.slug, slug)
|
|
42
49
|
}
|
|
43
50
|
}
|
|
@@ -156,7 +156,6 @@ export default class KeepsSchemasInSyncTest extends AbstractSchemaTest {
|
|
|
156
156
|
@test()
|
|
157
157
|
protected static async shouldGenerateCoreSchemaTypesGeneratesValidFiles() {
|
|
158
158
|
await this.installSchemaFeature('schemas')
|
|
159
|
-
|
|
160
159
|
await this.copyMockCoreSchemas()
|
|
161
160
|
|
|
162
161
|
const results = await this.Action('schema', 'sync').execute(
|
|
@@ -192,18 +191,16 @@ export default class KeepsSchemasInSyncTest extends AbstractSchemaTest {
|
|
|
192
191
|
}
|
|
193
192
|
|
|
194
193
|
@test()
|
|
195
|
-
protected static async
|
|
194
|
+
protected static async generateCoreSchemasWithShouldGenerateCoreSchemaTypes() {
|
|
196
195
|
await this.installSchemaFeature('schemas')
|
|
197
|
-
|
|
198
|
-
const pkg = this.Service('pkg')
|
|
199
|
-
pkg.set({ path: 'name', value: '@sprucelabs/spruce-core-schemas' })
|
|
200
|
-
|
|
201
196
|
await this.copyMockCoreSchemas()
|
|
202
197
|
|
|
203
|
-
const results = await this.Action('schema', 'sync').execute({
|
|
198
|
+
const results = await this.Action('schema', 'sync').execute({
|
|
199
|
+
shouldGenerateCoreSchemaTypes: true,
|
|
200
|
+
})
|
|
204
201
|
|
|
205
|
-
assert.isFalsy(results.errors)
|
|
206
|
-
assert.isTruthy(results.files)
|
|
202
|
+
assert.isFalsy(results.errors, 'sync schemas had errors')
|
|
203
|
+
assert.isTruthy(results.files, 'sync should have generated files')
|
|
207
204
|
|
|
208
205
|
const typesContents = diskUtil.readFile(this.coreSchemaTypesFile)
|
|
209
206
|
|