contensis-cli 1.0.0-beta.9 → 1.0.0-beta.90

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.
Files changed (125) hide show
  1. package/README.md +1146 -78
  2. package/cli.js +3 -0
  3. package/dist/commands/connect.js +3 -3
  4. package/dist/commands/connect.js.map +2 -2
  5. package/dist/commands/create.js +45 -10
  6. package/dist/commands/create.js.map +2 -2
  7. package/dist/commands/dev.js +75 -0
  8. package/dist/commands/dev.js.map +7 -0
  9. package/dist/commands/diff.js +57 -0
  10. package/dist/commands/diff.js.map +7 -0
  11. package/dist/commands/execute.js +103 -0
  12. package/dist/commands/execute.js.map +7 -0
  13. package/dist/commands/get.js +169 -32
  14. package/dist/commands/get.js.map +3 -3
  15. package/dist/commands/globalOptions.js +37 -12
  16. package/dist/commands/globalOptions.js.map +2 -2
  17. package/dist/commands/import.js +47 -12
  18. package/dist/commands/import.js.map +2 -2
  19. package/dist/commands/index.js +22 -2
  20. package/dist/commands/index.js.map +2 -2
  21. package/dist/commands/list.js +53 -10
  22. package/dist/commands/list.js.map +2 -2
  23. package/dist/commands/login.js +2 -2
  24. package/dist/commands/login.js.map +2 -2
  25. package/dist/commands/push.js +17 -13
  26. package/dist/commands/push.js.map +2 -2
  27. package/dist/commands/remove.js +51 -8
  28. package/dist/commands/remove.js.map +2 -2
  29. package/dist/commands/set.js +139 -12
  30. package/dist/commands/set.js.map +2 -2
  31. package/dist/index.js +1 -1
  32. package/dist/index.js.map +2 -2
  33. package/dist/localisation/en-GB.js +259 -49
  34. package/dist/localisation/en-GB.js.map +2 -2
  35. package/dist/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.js +56 -0
  36. package/dist/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.js.map +7 -0
  37. package/dist/mappers/DevInit-to-CIWorkflow.js +127 -0
  38. package/dist/mappers/DevInit-to-CIWorkflow.js.map +7 -0
  39. package/dist/mappers/DevInit-to-RolePermissions.js +54 -0
  40. package/dist/mappers/DevInit-to-RolePermissions.js.map +7 -0
  41. package/dist/mappers/DevRequests-to-RequestHanderSiteConfigYaml.js +56 -0
  42. package/dist/mappers/DevRequests-to-RequestHanderSiteConfigYaml.js.map +7 -0
  43. package/dist/models/CliService.d.js +17 -0
  44. package/dist/models/CliService.d.js.map +7 -0
  45. package/dist/models/DevService.d.js +17 -0
  46. package/dist/models/DevService.d.js.map +7 -0
  47. package/dist/providers/CredentialProvider.js +46 -14
  48. package/dist/providers/CredentialProvider.js.map +3 -3
  49. package/dist/providers/SessionCacheProvider.js +21 -1
  50. package/dist/providers/SessionCacheProvider.js.map +2 -2
  51. package/dist/providers/file-provider.js +12 -6
  52. package/dist/providers/file-provider.js.map +3 -3
  53. package/dist/services/ContensisCliService.js +1148 -421
  54. package/dist/services/ContensisCliService.js.map +3 -3
  55. package/dist/services/ContensisDevService.js +309 -0
  56. package/dist/services/ContensisDevService.js.map +7 -0
  57. package/dist/services/ContensisRoleService.js +87 -0
  58. package/dist/services/ContensisRoleService.js.map +7 -0
  59. package/dist/shell.js +58 -18
  60. package/dist/shell.js.map +3 -3
  61. package/dist/util/console.printer.js +171 -55
  62. package/dist/util/console.printer.js.map +2 -2
  63. package/dist/util/diff.js +102 -0
  64. package/dist/util/diff.js.map +7 -0
  65. package/dist/util/dotenv.js +57 -0
  66. package/dist/util/dotenv.js.map +7 -0
  67. package/dist/util/find.js +31 -0
  68. package/dist/util/find.js.map +7 -0
  69. package/dist/util/git.js +126 -0
  70. package/dist/util/git.js.map +7 -0
  71. package/dist/util/index.js +8 -2
  72. package/dist/util/index.js.map +3 -3
  73. package/dist/util/logger.js +90 -29
  74. package/dist/util/logger.js.map +3 -3
  75. package/dist/util/os.js +39 -0
  76. package/dist/util/os.js.map +7 -0
  77. package/dist/util/timers.js +49 -0
  78. package/dist/util/timers.js.map +7 -0
  79. package/dist/util/yaml.js +45 -0
  80. package/dist/util/yaml.js.map +7 -0
  81. package/dist/version.js +1 -1
  82. package/dist/version.js.map +1 -1
  83. package/esbuild.config.js +3 -1
  84. package/package.json +12 -3
  85. package/src/commands/connect.ts +3 -2
  86. package/src/commands/create.ts +61 -8
  87. package/src/commands/dev.ts +69 -0
  88. package/src/commands/diff.ts +41 -0
  89. package/src/commands/execute.ts +117 -0
  90. package/src/commands/get.ts +242 -28
  91. package/src/commands/globalOptions.ts +42 -12
  92. package/src/commands/import.ts +58 -8
  93. package/src/commands/index.ts +22 -1
  94. package/src/commands/list.ts +85 -11
  95. package/src/commands/login.ts +2 -1
  96. package/src/commands/push.ts +18 -11
  97. package/src/commands/remove.ts +66 -4
  98. package/src/commands/set.ts +189 -9
  99. package/src/index.ts +1 -4
  100. package/src/localisation/en-GB.ts +374 -66
  101. package/src/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.ts +44 -0
  102. package/src/mappers/DevInit-to-CIWorkflow.ts +150 -0
  103. package/src/mappers/DevInit-to-RolePermissions.ts +33 -0
  104. package/src/mappers/DevRequests-to-RequestHanderSiteConfigYaml.ts +44 -0
  105. package/src/models/CliService.d.ts +36 -0
  106. package/src/models/DevService.d.ts +5 -0
  107. package/src/models/JsModules.d.ts +1 -0
  108. package/src/providers/CredentialProvider.ts +51 -18
  109. package/src/providers/SessionCacheProvider.ts +29 -2
  110. package/src/providers/file-provider.ts +17 -6
  111. package/src/services/ContensisCliService.ts +1458 -518
  112. package/src/services/ContensisDevService.ts +365 -0
  113. package/src/services/ContensisRoleService.ts +76 -0
  114. package/src/shell.ts +68 -18
  115. package/src/util/console.printer.ts +240 -78
  116. package/src/util/diff.ts +113 -0
  117. package/src/util/dotenv.ts +37 -0
  118. package/src/util/find.ts +8 -0
  119. package/src/util/git.ts +130 -0
  120. package/src/util/index.ts +16 -7
  121. package/src/util/logger.ts +145 -31
  122. package/src/util/os.ts +7 -0
  123. package/src/util/timers.ts +24 -0
  124. package/src/util/yaml.ts +13 -0
  125. package/src/version.ts +1 -1
@@ -25,26 +25,153 @@ var import_commander = require("commander");
25
25
  var import_ContensisCliService = require("../services/ContensisCliService");
26
26
  var import_shell = require("../shell");
27
27
  const makeSetCommand = () => {
28
- const set = new import_commander.Command().command("set").showHelpAfterError(true).exitOverride();
29
- set.command("project").argument("<projectId>", "the project id to work with").usage("<projectId>").action(async (projectId) => {
30
- const project = await (0, import_ContensisCliService.cliCommand)([
28
+ const set = new import_commander.Command().command("set").description("set command").addHelpText("after", `
29
+ `).showHelpAfterError(true).exitOverride();
30
+ const project = set.command("project").description("set current working project").argument("<projectId>", "the project id to work with").usage("<projectId>").addHelpText(
31
+ "after",
32
+ `
33
+ Example call:
34
+ > set project website
35
+ `
36
+ ).action(async (projectId) => {
37
+ const nextProjectId = (0, import_ContensisCliService.cliCommand)([
31
38
  "set",
32
39
  "project",
33
40
  projectId
34
41
  ]).SetProject(projectId);
35
- if (project)
36
- await (0, import_shell.shell)().start();
42
+ if (nextProjectId)
43
+ await (0, import_shell.shell)().restart();
37
44
  });
38
- set.command("version").addArgument(
45
+ project.command("name").description("update project name").argument('<"Project name">', "update the current project name").usage('<"Project name">').addHelpText(
46
+ "after",
47
+ `
48
+ Example call:
49
+ > set project name "Project name"
50
+ `
51
+ ).action(async (name, opts) => {
52
+ await (0, import_ContensisCliService.cliCommand)(["set", "project", "name"], opts).UpdateProject({
53
+ name
54
+ });
55
+ });
56
+ project.command("description").description("update project description").argument(
57
+ '<"Project description">',
58
+ "update the current project description"
59
+ ).usage('<"Project description">').addHelpText(
60
+ "after",
61
+ `
62
+ Example call:
63
+ > set project description "Description of project"
64
+ `
65
+ ).action(async (description, opts) => {
66
+ await (0, import_ContensisCliService.cliCommand)(["set", "project", "description"], opts).UpdateProject({
67
+ description
68
+ });
69
+ });
70
+ const role = set.command("role").description("update a role");
71
+ role.command("name").description("update role name").argument('<"Role name">', "update the existing role name").argument('<"New name">', "the new name for the role").usage('<"Role name"> <"New name">').addHelpText(
72
+ "after",
73
+ `
74
+ Example call:
75
+ > set role name "Existing name" "New role name"
76
+ `
77
+ ).action(async (roleNameOrId, newName, opts) => {
78
+ await (0, import_ContensisCliService.cliCommand)(["set", "role", "name"], opts).UpdateRole(roleNameOrId, {
79
+ name: newName
80
+ });
81
+ });
82
+ role.command("description").description("update role description").argument('<"Role name" or id>', "the existing role name or id to update").argument('<"New description">', "the new description for the role").usage('<"Role name"> <"New description">').addHelpText(
83
+ "after",
84
+ `
85
+ Example call:
86
+ > set role description "Existing role" "New role description"
87
+ `
88
+ ).action(async (roleNameOrId, description, opts) => {
89
+ await (0, import_ContensisCliService.cliCommand)(["set", "role", "description"], opts).UpdateRole(
90
+ roleNameOrId,
91
+ {
92
+ description
93
+ }
94
+ );
95
+ });
96
+ role.command("enabled").description("enable or disable a role").argument('<"Role name" or id>', "the existing role name or id to update").usage('<"Role name"> --disabled').option("--disabled", "disable the role", false).addHelpText(
97
+ "after",
98
+ `
99
+ Example call:
100
+ > set role enabled "Existing role"
101
+
102
+ > set role enabled "Other role" --disabled
103
+ `
104
+ ).action(async (roleNameOrId, opts) => {
105
+ await (0, import_ContensisCliService.cliCommand)(
106
+ ["set", "role", opts.disabled ? "disabled" : "enabled"],
107
+ opts
108
+ ).UpdateRole(roleNameOrId, {
109
+ enabled: !opts.disabled
110
+ });
111
+ });
112
+ role.command("assignments").description("assign users, groups or keys to a role").argument('<"Role name" or id>', "the role name or id to update").option(
113
+ "-users --assign-users [assign-users...]",
114
+ "the user id(s) to assign"
115
+ ).option(
116
+ "-groups --assign-groups [assign-groups...]",
117
+ "the groups name(s) to assign"
118
+ ).option("-keys --assign-keys [assign-keys...]", "the key name(s) to assign").addHelpText(
119
+ "after",
120
+ `
121
+ Example call:
122
+ > set role assignments "My role" --assign-users admin
123
+ `
124
+ ).action(async (roleNameOrId, opts) => {
125
+ await (0, import_ContensisCliService.cliCommand)(["set", "role", "assignments"], opts).UpdateRole(
126
+ roleNameOrId,
127
+ {
128
+ assignments: {
129
+ apiKeys: opts.assignKeys || void 0,
130
+ groups: opts.assignGroups || void 0,
131
+ users: opts.assignUsers || void 0
132
+ }
133
+ }
134
+ );
135
+ });
136
+ role.command("permissions").description("add entry permissions to a role").argument('<"Role name" or id>', "the role name or id to update").option(
137
+ "-contenttypes --content-type-ids [content-type-id...]",
138
+ "any content type ids to add permissions for"
139
+ ).option(
140
+ "--entry-actions [entry-actions...]",
141
+ "the entry actions to add to the role permissions"
142
+ ).option(
143
+ "--entry-languages [entry-languages...]",
144
+ "the entry languages to add to the role permissions"
145
+ ).addHelpText(
146
+ "after",
147
+ `
148
+ Example call:
149
+ > set role permissions "My role" --content-type-id blogs --
150
+ `
151
+ ).action(async (roleNameOrId, opts) => {
152
+ var _a;
153
+ await (0, import_ContensisCliService.cliCommand)(["set", "role", "permissions"], opts).UpdateRole(
154
+ roleNameOrId,
155
+ {
156
+ permissions: {
157
+ entries: (_a = opts.contentTypeIds) == null ? void 0 : _a.map((id) => ({
158
+ id,
159
+ actions: opts.entryActions || [],
160
+ languages: opts.entryLanguages || []
161
+ }))
162
+ }
163
+ }
164
+ );
165
+ });
166
+ set.command("version").description("set content version").addArgument(
39
167
  new import_commander.Argument("<versionStatus>", "content version status").choices(["latest", "published"]).default("latest")
40
- ).usage("<latest/published>").action(async (versionStatus) => {
41
- const success = await (0, import_ContensisCliService.cliCommand)([
42
- "set",
43
- "version",
168
+ ).usage("<latest/published>").addHelpText("after", `
169
+ `).action(async (versionStatus) => {
170
+ const success = (0, import_ContensisCliService.cliCommand)(["set", "version", versionStatus]).SetVersion(
44
171
  versionStatus
45
- ]).SetVersion(versionStatus);
172
+ );
46
173
  if (success)
47
- await (0, import_shell.shell)().start();
174
+ await (0, import_shell.shell)().restart();
48
175
  });
49
176
  return set;
50
177
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/commands/set.ts"],
4
- "sourcesContent": ["import { Argument, Command } from 'commander';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport { shell } from '~/shell';\n\nexport const makeSetCommand = () => {\n const set = new Command()\n .command('set')\n .showHelpAfterError(true)\n .exitOverride();\n set\n .command('project')\n .argument('<projectId>', 'the project id to work with')\n .usage('<projectId>')\n .action(async projectId => {\n const project = await cliCommand([\n 'set',\n 'project',\n projectId,\n ]).SetProject(projectId);\n if (project) await shell().start();\n });\n set\n .command('version')\n .addArgument(\n new Argument('<versionStatus>', 'content version status')\n .choices(['latest', 'published'])\n .default('latest')\n )\n .usage('<latest/published>')\n .action(async versionStatus => {\n const success = await cliCommand([\n 'set',\n 'version',\n versionStatus,\n ]).SetVersion(versionStatus);\n if (success) await shell().start();\n });\n\n return set;\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAkC;AAClC,iCAA2B;AAC3B,mBAAsB;AAEf,MAAM,iBAAiB,MAAM;AAClC,QAAM,MAAM,IAAI,yBAAQ,EACrB,QAAQ,KAAK,EACb,mBAAmB,IAAI,EACvB,aAAa;AAChB,MACG,QAAQ,SAAS,EACjB,SAAS,eAAe,6BAA6B,EACrD,MAAM,aAAa,EACnB,OAAO,OAAM,cAAa;AACzB,UAAM,UAAU,UAAM,uCAAW;AAAA,MAC/B;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC,EAAE,WAAW,SAAS;AACvB,QAAI;AAAS,gBAAM,oBAAM,EAAE,MAAM;AAAA,EACnC,CAAC;AACH,MACG,QAAQ,SAAS,EACjB;AAAA,IACC,IAAI,0BAAS,mBAAmB,wBAAwB,EACrD,QAAQ,CAAC,UAAU,WAAW,CAAC,EAC/B,QAAQ,QAAQ;AAAA,EACrB,EACC,MAAM,oBAAoB,EAC1B,OAAO,OAAM,kBAAiB;AAC7B,UAAM,UAAU,UAAM,uCAAW;AAAA,MAC/B;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC,EAAE,WAAW,aAAa;AAC3B,QAAI;AAAS,gBAAM,oBAAM,EAAE,MAAM;AAAA,EACnC,CAAC;AAEH,SAAO;AACT;",
4
+ "sourcesContent": ["import { Argument, Command } from 'commander';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport { shell } from '~/shell';\n\nexport const makeSetCommand = () => {\n const set = new Command()\n .command('set')\n .description('set command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n const project = set\n .command('project')\n .description('set current working project')\n .argument('<projectId>', 'the project id to work with')\n .usage('<projectId>')\n .addHelpText(\n 'after',\n `\nExample call:\n > set project website\\n`\n )\n .action(async projectId => {\n const nextProjectId = cliCommand([\n 'set',\n 'project',\n projectId,\n ]).SetProject(projectId);\n if (nextProjectId) await shell().restart();\n });\n\n project\n .command('name')\n .description('update project name')\n .argument('<\"Project name\">', 'update the current project name')\n .usage('<\"Project name\">')\n .addHelpText(\n 'after',\n `\nExample call:\n > set project name \"Project name\"\\n`\n )\n .action(async (name: string, opts) => {\n await cliCommand(['set', 'project', 'name'], opts).UpdateProject({\n name,\n });\n });\n\n project\n .command('description')\n .description('update project description')\n .argument(\n '<\"Project description\">',\n 'update the current project description'\n )\n .usage('<\"Project description\">')\n .addHelpText(\n 'after',\n `\nExample call:\n > set project description \"Description of project\"\\n`\n )\n .action(async (description: string, opts) => {\n await cliCommand(['set', 'project', 'description'], opts).UpdateProject({\n description,\n });\n });\n\n const role = set.command('role').description('update a role');\n\n role\n .command('name')\n .description('update role name')\n .argument('<\"Role name\">', 'update the existing role name')\n .argument('<\"New name\">', 'the new name for the role')\n .usage('<\"Role name\"> <\"New name\">')\n .addHelpText(\n 'after',\n `\nExample call:\n > set role name \"Existing name\" \"New role name\"\\n`\n )\n .action(async (roleNameOrId: string, newName: string, opts) => {\n await cliCommand(['set', 'role', 'name'], opts).UpdateRole(roleNameOrId, {\n name: newName,\n });\n });\n\n role\n .command('description')\n .description('update role description')\n .argument('<\"Role name\" or id>', 'the existing role name or id to update')\n .argument('<\"New description\">', 'the new description for the role')\n .usage('<\"Role name\"> <\"New description\">')\n .addHelpText(\n 'after',\n `\nExample call:\n > set role description \"Existing role\" \"New role description\"\\n`\n )\n .action(async (roleNameOrId: string, description: string, opts) => {\n await cliCommand(['set', 'role', 'description'], opts).UpdateRole(\n roleNameOrId,\n {\n description,\n }\n );\n });\n\n role\n .command('enabled')\n .description('enable or disable a role')\n .argument('<\"Role name\" or id>', 'the existing role name or id to update')\n .usage('<\"Role name\"> --disabled')\n .option('--disabled', 'disable the role', false)\n .addHelpText(\n 'after',\n `\nExample call:\n > set role enabled \"Existing role\"\\n\n > set role enabled \"Other role\" --disabled\\n`\n )\n .action(async (roleNameOrId: string, opts) => {\n await cliCommand(\n ['set', 'role', opts.disabled ? 'disabled' : 'enabled'],\n opts\n ).UpdateRole(roleNameOrId, {\n enabled: !opts.disabled,\n });\n });\n\n role\n .command('assignments')\n .description('assign users, groups or keys to a role')\n .argument('<\"Role name\" or id>', 'the role name or id to update')\n .option(\n '-users --assign-users [assign-users...]',\n 'the user id(s) to assign'\n )\n .option(\n '-groups --assign-groups [assign-groups...]',\n 'the groups name(s) to assign'\n )\n .option('-keys --assign-keys [assign-keys...]', 'the key name(s) to assign')\n .addHelpText(\n 'after',\n `\nExample call:\n > set role assignments \"My role\" --assign-users admin \\n`\n )\n .action(async (roleNameOrId: string, opts) => {\n await cliCommand(['set', 'role', 'assignments'], opts).UpdateRole(\n roleNameOrId,\n {\n assignments: {\n apiKeys: opts.assignKeys || undefined,\n groups: opts.assignGroups || undefined,\n users: opts.assignUsers || undefined,\n },\n }\n );\n });\n\n role\n .command('permissions')\n .description('add entry permissions to a role')\n .argument('<\"Role name\" or id>', 'the role name or id to update')\n .option(\n '-contenttypes --content-type-ids [content-type-id...]',\n 'any content type ids to add permissions for'\n )\n .option(\n '--entry-actions [entry-actions...]',\n 'the entry actions to add to the role permissions'\n )\n .option(\n '--entry-languages [entry-languages...]',\n 'the entry languages to add to the role permissions'\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > set role permissions \"My role\" --content-type-id blogs -- \\n`\n )\n .action(async (roleNameOrId: string, opts) => {\n await cliCommand(['set', 'role', 'permissions'], opts).UpdateRole(\n roleNameOrId,\n {\n permissions: {\n entries: opts.contentTypeIds?.map((id: string) => ({\n id,\n actions: opts.entryActions || [],\n languages: opts.entryLanguages || [],\n })),\n },\n }\n );\n });\n\n set\n .command('version')\n .description('set content version')\n .addArgument(\n new Argument('<versionStatus>', 'content version status')\n .choices(['latest', 'published'])\n .default('latest')\n )\n .usage('<latest/published>')\n .addHelpText('after', `\\n`)\n .action(async versionStatus => {\n const success = cliCommand(['set', 'version', versionStatus]).SetVersion(\n versionStatus\n );\n if (success) await shell().restart();\n });\n\n return set;\n};\n"],
5
+ "mappings": "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",
6
6
  "names": []
7
7
  }
package/dist/index.js CHANGED
@@ -25,7 +25,7 @@ program.parseAsync(process.argv).then(() => {
25
25
  import_ContensisCliService.default.quit();
26
26
  }).catch((err) => {
27
27
  var _a;
28
- if (!((_a = err.name) == null ? void 0 : _a.includes("CommanderError")))
28
+ if (err && !((_a = err.name) == null ? void 0 : _a.includes("CommanderError")))
29
29
  (0, import_logger.logError)(err, `CLI ${err.toString()}`);
30
30
  import_ContensisCliService.default.quit(err);
31
31
  });
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["import commands from './commands';\nimport { logError } from './util/logger';\nimport ContensisCli from './services/ContensisCliService';\nimport { jsonFormatter } from './util/json.formatter';\n// new ContensisCli(process.argv).DoCommandTasksAsync();\n\n// This is the CLI part of the app\nconst program = commands();\nprogram\n .parseAsync(process.argv)\n .then(() => {\n ContensisCli.quit();\n })\n .catch((err: any) => {\n if (!err.name?.includes('CommanderError'))\n logError(err, `CLI ${err.toString()}`);\n ContensisCli.quit(err);\n });\n//.exitOverride(() => console.log('exit override!!!'));\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA,sBAAqB;AACrB,oBAAyB;AACzB,iCAAyB;AAKzB,MAAM,cAAU,gBAAAA,SAAS;AACzB,QACG,WAAW,QAAQ,IAAI,EACvB,KAAK,MAAM;AACV,6BAAAC,QAAa,KAAK;AACpB,CAAC,EACA,MAAM,CAAC,QAAa;AAbvB;AAcI,MAAI,GAAC,SAAI,SAAJ,mBAAU,SAAS;AACtB,gCAAS,KAAK,OAAO,IAAI,SAAS,GAAG;AACvC,6BAAAA,QAAa,KAAK,GAAG;AACvB,CAAC;",
4
+ "sourcesContent": ["import commands from './commands';\nimport { logError } from './util/logger';\nimport ContensisCli from './services/ContensisCliService';\n\n// This is the CLI part of the app\nconst program = commands();\nprogram\n .parseAsync(process.argv)\n .then(() => {\n ContensisCli.quit();\n })\n .catch((err: any) => {\n if (err && !err.name?.includes('CommanderError'))\n logError(err, `CLI ${err.toString()}`);\n ContensisCli.quit(err);\n });\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA,sBAAqB;AACrB,oBAAyB;AACzB,iCAAyB;AAGzB,MAAM,cAAU,gBAAAA,SAAS;AACzB,QACG,WAAW,QAAQ,IAAI,EACvB,KAAK,MAAM;AACV,6BAAAC,QAAa,KAAK;AACpB,CAAC,EACA,MAAM,CAAC,QAAa;AAXvB;AAYI,MAAI,OAAO,GAAC,SAAI,SAAJ,mBAAU,SAAS;AAC7B,gCAAS,KAAK,OAAO,IAAI,SAAS,GAAG;AACvC,6BAAAA,QAAa,KAAK,GAAG;AACvB,CAAC;",
6
6
  "names": ["commands", "ContensisCli"]
7
7
  }
@@ -22,12 +22,13 @@ __export(en_GB_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(en_GB_exports);
24
24
  var import_logger = require("../util/logger");
25
+ var import_os = require("../util/os");
25
26
  const LogMessages = {
26
27
  app: {
27
28
  contensis: () => "Contensis",
28
29
  quit: () => `Goodbye \u{1F44B}
29
30
  `,
30
- startup: () => `\xA9 2001-${new Date().getFullYear()} Zengenti \u{1F1EC}\u{1F1E7}.
31
+ startup: (version) => `v${version} \xA9 2001-${new Date().getFullYear()} Zengenti \u{1F1EC}\u{1F1E7}.
31
32
  - Creators of Contensis and purveyors of other fine software
32
33
 
33
34
  \u{1F44B} Welcome to the contensis-cli
@@ -94,7 +95,7 @@ ${import_logger.Logger.errorText(">>")} Available commands:`,
94
95
  description: () => "the shared secret to use when logging in with a client id"
95
96
  }
96
97
  },
97
- passwordPrompt: (env, userId) => `Enter password for ${userId}@${env}:`,
98
+ passwordPrompt: (env, userId) => userId ? `Enter password for ${userId}@${env}:` : `Please enter a password`,
98
99
  failed: (env, userId) => `Unable to login to ${env} as ${userId}`,
99
100
  success: (env, userId) => `User ${userId} connected to ${env} successfully
100
101
  `,
@@ -105,34 +106,29 @@ ${import_logger.Logger.errorText(">>")} Available commands:`,
105
106
  projects: {
106
107
  list: () => `Available projects:`,
107
108
  noList: () => `Cannot retrieve projects list`,
108
- set: (projectId) => `Current project is set to "${projectId}"`,
109
- failedSet: (projectId) => `Project "${projectId}" not found`
109
+ set: (projectId) => `Current project is set to ${import_logger.Logger.highlightText(projectId)}`,
110
+ failedSet: (projectId) => `Project ${import_logger.Logger.highlightText(projectId)} not found`,
111
+ tip: () => `You need to set your current working project with "set project {projectId}"`,
112
+ created: (env, id) => `[${env}] Created project ${import_logger.Logger.highlightText(id)}`,
113
+ failedCreate: (env, id) => `[${env}] Unable to create project ${import_logger.Logger.highlightText(id)}`,
114
+ updated: (env, id) => `[${env}] Updated project ${import_logger.Logger.highlightText(id)}`,
115
+ failedUpdate: (env, id) => `[${env}] Unable to update project ${import_logger.Logger.highlightText(id)}`
110
116
  },
111
- contenttypes: {
112
- list: (projectId) => `Content types in "${projectId}":`,
113
- noList: (projectId) => `[${projectId}] Cannot retrieve content types list`,
114
- get: (projectId, contentTypeId) => `[${projectId}] Content type "${contentTypeId}"`,
115
- failedGet: (projectId, contentTypeId) => `[${projectId}] Unable to get content type "${contentTypeId}"`,
116
- created: (projectId, componentId, status) => `[${projectId}] Content type ${status}d "${componentId}"`,
117
- removed: (env, id, commit) => `[${env}] ${commit ? `Deleted` : `Will delete`} content type "${id}"`,
118
- failedRemove: (env, id) => `[${env}] Unable to delete content type "${id}"`
119
- },
120
- components: {
121
- list: (projectId) => `Components in "${projectId}":`,
122
- noList: (projectId) => `[${projectId}] Cannot retrieve components list`,
123
- get: (projectId, componentId) => `[${projectId}] Component "${componentId}"`,
124
- failedGet: (projectId, componentId) => `[${projectId}] Unable to get component "${componentId}"`,
125
- created: (projectId, componentId, status) => `[${projectId}] Component ${status}d "${componentId}"`,
126
- removed: (env, id, commit) => `[${env}] ${commit ? `Deleted` : `Will delete`} component "${id}"`,
127
- failedRemove: (env, id) => `[${env}] Unable to delete component "${id}"`
128
- },
129
- version: {
130
- set: (env, versionStatus) => `[${env}] Content version status set to "${versionStatus}"`,
131
- invalid: (versionStatus) => `Content version status "${versionStatus}" is not valid, allowed values are "published" or "latest".`,
132
- noEnv: () => `No Contensis environment set, connect to your Contensis cloud instance using "contensis connect {cms alias}"`
133
- },
134
- entries: {
135
- migrateStatus: (status) => {
117
+ migrate: {
118
+ models: {
119
+ result: (status) => {
120
+ switch (status) {
121
+ case "created":
122
+ case "updated":
123
+ return import_logger.Logger.successText;
124
+ case "errors":
125
+ return import_logger.Logger.errorText;
126
+ default:
127
+ return import_logger.Logger.infoText;
128
+ }
129
+ }
130
+ },
131
+ status: (status) => {
136
132
  switch (status) {
137
133
  case "no change":
138
134
  return import_logger.Logger.successText;
@@ -147,19 +143,131 @@ ${import_logger.Logger.errorText(">>")} Available commands:`,
147
143
  default:
148
144
  return import_logger.Logger.infoText;
149
145
  }
150
- },
151
- removed: (env, id, commit) => `[${env}] ${commit ? `Deleted` : `Will delete`} entry "${id}"`,
152
- failedRemove: (env, id) => `[${env}] Unable to delete entry "${id}"`,
153
- notFound: (id) => `Entry "${id}" not found`,
154
- commitTip: () => ` Add --commit flag to commit the previewed changes`
146
+ }
147
+ },
148
+ models: {
149
+ list: (projectId) => `Content models in ${import_logger.Logger.highlightText(projectId)}:`,
150
+ noList: (projectId) => `[${projectId}] Cannot retrieve content models`,
151
+ get: (projectId, id) => `[${projectId}] Content models ${import_logger.Logger.infoText(`[ ${id} ]`)}`,
152
+ failedGet: (projectId, id) => `[${projectId}] Unable to get content models ${import_logger.Logger.highlightText(id)}`
153
+ },
154
+ nodes: {
155
+ failedGet: (projectId) => `[${projectId}] Cannot retrieve nodes from Site view`,
156
+ get: (projectId, root, depth) => `[${projectId}] Site view nodes at: ${import_logger.Logger.highlightText(root)}${depth ? ` to a depth of ${depth}` : ``}
157
+ `
158
+ },
159
+ contenttypes: {
160
+ list: (projectId) => `Content types in ${import_logger.Logger.highlightText(projectId)}:`,
161
+ get: (projectId, id) => `[${projectId}] Content type ${import_logger.Logger.highlightText(id)}`,
162
+ failedGet: (projectId, id) => `[${projectId}] Unable to get content type ${import_logger.Logger.highlightText(id)}`,
163
+ created: (projectId, id, status) => `[${projectId}] Content type ${status}d ${import_logger.Logger.highlightText(id)}`,
164
+ removed: (env, id, commit) => `[${env}] ${commit ? `Deleted` : `Will delete`} content type ${import_logger.Logger.highlightText(id)}`,
165
+ failedRemove: (env, id) => `[${env}] Unable to delete content type ${import_logger.Logger.highlightText(id)}`
166
+ },
167
+ components: {
168
+ list: (projectId) => `Components in ${import_logger.Logger.highlightText(projectId)}:`,
169
+ get: (projectId, id) => `[${projectId}] Component ${import_logger.Logger.highlightText(id)}`,
170
+ failedGet: (projectId, id) => `[${projectId}] Unable to get component ${import_logger.Logger.highlightText(id)}`,
171
+ created: (projectId, id, status) => `[${projectId}] Component ${status}d ${import_logger.Logger.highlightText(id)}`,
172
+ removed: (env, id, commit) => `[${env}] ${commit ? `Deleted` : `Will delete`} component ${import_logger.Logger.highlightText(id)}`,
173
+ failedRemove: (env, id) => `[${env}] Unable to delete component ${import_logger.Logger.highlightText(id)}`
174
+ },
175
+ version: {
176
+ set: (env, versionStatus) => `[${env}] Content version status set to "${versionStatus}"`,
177
+ invalid: (versionStatus) => `Content version status "${versionStatus}" is not valid, allowed values are "published" or "latest".`,
178
+ noEnv: () => `No Contensis environment set, connect to your Contensis cloud instance using "contensis connect {cms alias}"`
179
+ },
180
+ entries: {
181
+ imported: (env, commit, count) => `[${env}] ${commit ? `Imported` : `Will import`} ${count} entries`,
182
+ failedImport: (env) => `[${env}] Unable to import entries`,
183
+ removed: (env, commit) => `[${env}] ${commit ? `Deleted` : `Will delete`} entries`,
184
+ failedRemove: (env) => `[${env}] Unable to delete entries`,
185
+ notFound: (env) => `[${env}] Entries were not found`,
186
+ commitTip: () => `Add --commit flag to commit the previewed changes`
155
187
  },
156
188
  keys: {
157
189
  list: (env) => `[${env}] API keys:`,
158
- noList: (env) => `[${env}] Cannot retrieve API`,
159
- created: (env, name) => `[${env}] Created API key "${name}"`,
160
- failedCreate: (env, name) => `[${env}] Unable to create API key "${name}"`,
161
- removed: (env, id) => `[${env}] Deleted API key "${id}"`,
162
- failedRemove: (env, id) => `[${env}] Unable to delete API key "${id}"`
190
+ noList: (env) => `[${env}] Cannot retrieve API keys`,
191
+ created: (env, name) => `[${env}] Created API key ${import_logger.Logger.highlightText(name)}`,
192
+ tip: () => `Assign your new key to a role with "set role assignments", or create a new role with "create role"`,
193
+ failedCreate: (env, name) => `[${env}] Unable to create API key ${import_logger.Logger.highlightText(name)}`,
194
+ failedUpdate: (env, name) => `[${env}] Unable to update API key ${import_logger.Logger.highlightText(name)}`,
195
+ removed: (env, id) => `[${env}] Deleted API key ${import_logger.Logger.highlightText(id)}`,
196
+ failedRemove: (env, id) => `[${env}] Unable to delete API key ${import_logger.Logger.highlightText(id)}`
197
+ },
198
+ proxies: {
199
+ list: (env, projectId) => `[${env}] Retrieved proxies in project ${projectId}:`,
200
+ noList: (env, projectId) => `[${env}] Cannot retrieve proxies in project ${projectId}`,
201
+ failedGet: (env, name, projectId) => `[${env}] Unable to find proxy ${import_logger.Logger.highlightText(
202
+ name
203
+ )} in project ${projectId}`,
204
+ created: (env, name, projectId) => `[${env}] Created proxy ${import_logger.Logger.highlightText(
205
+ name
206
+ )} in project ${projectId}
207
+ `,
208
+ failedCreate: (env, name, projectId) => `[${env}] Unable to create proxy ${import_logger.Logger.highlightText(
209
+ name
210
+ )} in project ${projectId}`,
211
+ setPayload: () => `Updating proxy with details
212
+ `,
213
+ set: () => `Succesfully updated proxy
214
+ `,
215
+ failedSet: (env, name, projectId) => `[${env}] Unable to update proxy ${import_logger.Logger.highlightText(
216
+ name
217
+ )} in project ${projectId}`,
218
+ removed: (env, id, projectId) => `[${env}] Deleted proxy ${import_logger.Logger.highlightText(
219
+ id
220
+ )} in project ${projectId}
221
+ `,
222
+ failedRemove: (env, id, projectId) => `[${env}] Unable to delete proxy ${import_logger.Logger.highlightText(
223
+ id
224
+ )} in project ${projectId}`
225
+ },
226
+ renderers: {
227
+ list: (env, projectId) => `[${env}] Retrieved renderers in project ${projectId}:`,
228
+ noList: (env, projectId) => `[${env}] Cannot retrieve renderers in project ${projectId}`,
229
+ failedGet: (env, name, projectId) => `[${env}] Unable to find renderer ${import_logger.Logger.highlightText(
230
+ name
231
+ )} in project ${projectId}`,
232
+ created: (env, name, projectId) => `[${env}] Created renderer ${import_logger.Logger.highlightText(
233
+ name
234
+ )} in project ${projectId}
235
+ `,
236
+ failedCreate: (env, name, projectId) => `[${env}] Unable to create renderer ${import_logger.Logger.highlightText(
237
+ name
238
+ )} in project ${projectId}`,
239
+ setPayload: () => `Updating renderer with details
240
+ `,
241
+ set: () => `Succesfully updated renderer
242
+ `,
243
+ failedSet: (env, name, projectId) => `[${env}] Unable to update renderer ${import_logger.Logger.highlightText(
244
+ name
245
+ )} in project ${projectId}`,
246
+ removed: (env, id, projectId) => `[${env}] Deleted renderer ${import_logger.Logger.highlightText(
247
+ id
248
+ )} in project ${projectId}
249
+ `,
250
+ failedRemove: (env, id, projectId) => `[${env}] Unable to delete renderer ${import_logger.Logger.highlightText(
251
+ id
252
+ )} in project ${projectId}`
253
+ },
254
+ roles: {
255
+ list: (env) => `[${env}] Retrieved roles`,
256
+ noList: (env) => `[${env}] Cannot retrieve roles`,
257
+ noneExist: () => `Create a role with "create role"`,
258
+ failedGet: (env, name) => `[${env}] Unable to find role ${import_logger.Logger.highlightText(name)}`,
259
+ created: (env, name) => `[${env}] Created role ${import_logger.Logger.highlightText(name)}
260
+ `,
261
+ tip: () => `Give access to your role with "set role assignments", allow your role to do things with "set role permissions"`,
262
+ failedCreate: (env, name) => `[${env}] Unable to create role ${import_logger.Logger.highlightText(name)}`,
263
+ setPayload: () => `Updating role with details
264
+ `,
265
+ set: () => `Succesfully updated role
266
+ `,
267
+ failedSet: (env, name) => `[${env}] Unable to update role ${import_logger.Logger.highlightText(name)}`,
268
+ removed: (env, id) => `[${env}] Deleted role ${import_logger.Logger.highlightText(id)}
269
+ `,
270
+ failedRemove: (env, id) => `[${env}] Unable to delete role ${import_logger.Logger.highlightText(id)}`
163
271
  },
164
272
  blocks: {
165
273
  runningStatus: (status) => {
@@ -178,22 +286,124 @@ ${import_logger.Logger.errorText(">>")} Available commands:`,
178
286
  return import_logger.Logger.infoText(status);
179
287
  }
180
288
  },
181
- get: (env) => `[${env}] Block versions:`,
289
+ get: (id, env, projectId) => `[${env}] Block ${id} in project ${projectId}:`,
182
290
  list: (env, projectId) => `[${env}] Blocks in project ${projectId}:`,
183
291
  noList: (env, projectId) => `[${env}] Cannot retrieve blocks in project ${projectId}`,
184
- tryPush: (id, branch, env, projectId) => `[${env}] Request to push block "${id}" in branch ${branch} in project ${projectId}`,
185
- pushed: (id, branch, env, projectId) => `[${env}] Pushed block "${id}" in branch ${branch} in project ${projectId}`,
186
- failedPush: (id, env, projectId) => `[${env}] Unable to push block "${id}" in project ${projectId}`,
187
- deleted: (id, env, projectId) => `[${env}] Deleted block "${id}" in project ${projectId}`,
188
- failedDelete: (id, env, projectId) => `[${env}] Unable to delete block "${id}" in project ${projectId}`
292
+ getLogs: (id, branch, env, projectId) => `[${env}] Requesting logs from block ${import_logger.Logger.highlightText(
293
+ id
294
+ )} in branch ${branch} in project ${projectId}`,
295
+ failedGetLogs: (id, env, projectId) => `[${env}] Unable to fetch block logs for ${import_logger.Logger.highlightText(
296
+ id
297
+ )} in project ${projectId}`,
298
+ tryPush: (id, branch, env, projectId) => `[${env}] Request to push block ${import_logger.Logger.highlightText(
299
+ id
300
+ )} in branch ${branch} in project ${projectId}`,
301
+ pushed: (id, branch, env, projectId) => `[${env}] Pushed block ${import_logger.Logger.highlightText(
302
+ id
303
+ )} in branch ${branch} in project ${projectId}`,
304
+ failedPush: (id, env, projectId) => `[${env}] Unable to push block ${import_logger.Logger.highlightText(
305
+ id
306
+ )} in project ${projectId}`,
307
+ latestVersion: (version, id, env, projectId) => `[${env}] Found latest block version ${import_logger.Logger.highlightText(
308
+ id
309
+ )} in project ${projectId} ${import_logger.Logger.highlightText(version)}`,
310
+ failedParsingVersion: () => `Did not find a "version.versionNo" in response`,
311
+ actionComplete: (action, id, env, projectId) => `[${env}] Action ${import_logger.Logger.highlightText(
312
+ action
313
+ )} on ${import_logger.Logger.highlightText(
314
+ id
315
+ )} in project ${projectId} requested successfully`,
316
+ actionFailed: (action, id, env, projectId) => `[${env}] Problem executing ${action} on block ${import_logger.Logger.highlightText(
317
+ id
318
+ )} in project ${projectId}`,
319
+ deleted: (id, env, projectId) => `[${env}] Deleted block ${import_logger.Logger.highlightText(
320
+ id
321
+ )} in project ${projectId}`,
322
+ failedDelete: (id, env, projectId) => `[${env}] Unable to delete block ${import_logger.Logger.highlightText(
323
+ id
324
+ )} in project ${projectId}`,
325
+ stopFollow: (id, env, projectId) => `[${env}]
326
+
327
+ \u{1F44C} stop fetching new ${import_logger.Logger.highlightText(
328
+ id
329
+ )} logs in project ${projectId}`,
330
+ timeoutFollow: (id, env, projectId) => `[${env}]
331
+
332
+ \u{1F90F} pausing fetching new ${import_logger.Logger.highlightText(
333
+ id
334
+ )} logs in project ${projectId} due to too many requests`
189
335
  },
190
336
  webhooks: {
191
337
  list: (env) => `[${env}] Webhook subscriptions:`,
192
338
  noList: (env) => `[${env}] Cannot retrieve webhook subscriptions`,
193
- created: (env, name) => `[${env}] Created Webhook subscription "${name}"`,
194
- failedCreate: (env, name) => `[${env}] Unable to create Webhook subscription "${name}"`,
195
- deleted: (env, id) => `[${env}] Deleted Webhook subscription "${id}"`,
196
- failedDelete: (env, id) => `[${env}] Unable to delete Webhook subscription "${id}"`
339
+ noneExist: () => `No webhook subscriptions exist`,
340
+ created: (env, name) => `[${env}] Created Webhook subscription ${import_logger.Logger.highlightText(name)}`,
341
+ failedCreate: (env, name) => `[${env}] Unable to create Webhook subscription ${import_logger.Logger.highlightText(
342
+ name
343
+ )}`,
344
+ deleted: (env, id) => `[${env}] Deleted Webhook subscription ${import_logger.Logger.highlightText(id)}`,
345
+ failedDelete: (env, id) => `[${env}] Unable to delete Webhook subscription ${import_logger.Logger.highlightText(
346
+ id
347
+ )}`
348
+ },
349
+ devinit: {
350
+ intro: () => `Contensis developer environment initialisation`,
351
+ projectDetails: (name, env, projectId, git) => `Project: ${import_logger.Logger.highlightText(name)} set arg --name to override
352
+ - Home: ${import_logger.Logger.standardText(process.cwd())}
353
+ - Repository: ${git.home}
354
+
355
+ Connect to Contensis instance: ${import_logger.Logger.standardText(env)}
356
+ - Project id: ${import_logger.Logger.standardText(projectId)}`,
357
+ developmentKey: (name, existing) => ` - ${!existing ? "Create development API key" : "Development API key found"}: ${import_logger.Logger[!existing ? "highlightText" : "standardText"](name)}`,
358
+ deploymentKey: (name, existing) => ` - ${!existing ? "Create deployment API key" : "Deployment API key found"}: ${import_logger.Logger[!existing ? "highlightText" : "standardText"](name)}`,
359
+ ciIntro: (git) => `We will create API keys with permissions to use this project with Contensis, and add a job to your CI that will deploy a container build.
360
+
361
+ We will ask you to add secrets/variables to your git repository to give your workflow permission to push a Block to Contensis. ${import_logger.Logger.infoText(
362
+ `You could visit ${git.secretsUri} to check that you can see repository settings, a page not found generally indicates you need to ask the repo owner for permission to add repository secrets, or ask the repo owner to add these secrets for you.`
363
+ )}`,
364
+ ciDetails: (filename) => `Add push-block job to CI file: ${import_logger.Logger.highlightText(filename)}
365
+ `,
366
+ ciMultipleChoices: () => `Multiple GitHub workflow files found
367
+ ${import_logger.Logger.infoText(
368
+ `Tell us which GitHub workflow builds the container image after each push:`
369
+ )}`,
370
+ confirm: () => `Confirm these details are correct so we can make changes to your project`,
371
+ accessTokenPrompt: () => `Please supply the access token for the Delivery API (optional)`,
372
+ createDevKey: (keyName, existing) => `${!existing ? "Created" : "Checked permissions for"} development API key ${import_logger.Logger.standardText(keyName)}`,
373
+ createDeployKey: (keyName, existing) => `${!existing ? "Created" : "Checked permissions for"} deployment API key ${import_logger.Logger.standardText(keyName)}`,
374
+ createKeyFail: (keyName, existing) => `Failed to ${!existing ? "create" : "update"} API key ${import_logger.Logger.highlightText(keyName)}`,
375
+ writeEnvFile: () => `Written .env file to project home directory`,
376
+ useEnvFileTip: () => `You should alter existing project code that connects a Contensis client to use the variables from this file`,
377
+ writeCiFile: (ciFilePath) => `Updated CI file ${import_logger.Logger.standardText((0, import_os.winSlash)(ciFilePath))}`,
378
+ ciBlockTip: (blockId, env, projectId) => `A job is included to deploy your built container image to ${import_logger.Logger.standardText(
379
+ projectId
380
+ )} at ${import_logger.Logger.standardText(env)} in a block called ${import_logger.Logger.standardText(
381
+ blockId
382
+ )}`,
383
+ addGitSecretsIntro: () => `We have created an API key that allows you to deploy your app image to a Contensis Block but we need you to add these details to your GitLab repository.`,
384
+ addGitSecretsHelp: (git, id, secret) => `Add secrets or variables in your repository's settings page
385
+
386
+ Go to ${import_logger.Logger.highlightText(
387
+ git.secretsUri
388
+ )}
389
+
390
+ ${git.type === "github" ? `Add a "New repository secret"` : `Expand "Variables" and hit "Add variable"`}
391
+
392
+ ${git.type === "github" ? `Secret name:` : `Key:`} ${import_logger.Logger.highlightText(`CONTENSIS_CLIENT_ID`)}
393
+ ${git.type === "github" ? `Secret:` : `Value:`} ${import_logger.Logger.standardText(
394
+ id
395
+ )}
396
+
397
+ ${`Add one more secret/variable to the repository`}
398
+
399
+ ${git.type === "github" ? `Secret name:` : `Key:`} ${import_logger.Logger.highlightText(`CONTENSIS_SHARED_SECRET`)}
400
+ ${git.type === "github" ? `Secret:` : `Value:`} ${import_logger.Logger.standardText(secret)}`,
401
+ success: () => `Contensis developer environment initialisation complete`,
402
+ partialSuccess: () => `Contensis developer environment initialisation completed with errors`,
403
+ failed: () => `Contensis developer environment initialisation failed`,
404
+ dryRun: () => `Contensis developer environment initialisation dry run completed`,
405
+ noChanges: () => `No changes were made to your project - run the command again without the --dry-run flag to update your project with these changes`,
406
+ startProjectTip: () => `Start up your project in the normal way for development`
197
407
  }
198
408
  };
199
409
  // Annotate the CommonJS export names for ESM import in node: