@repokit/core 3.0.1 → 3.0.3

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 (44) hide show
  1. package/Cargo.lock +1056 -2
  2. package/Cargo.toml +4 -1
  3. package/dist/CommandParser.mjs +3 -3
  4. package/externals/CommandParser.ts +3 -3
  5. package/installation/install.sh +1 -1
  6. package/internals/configuration/configuration.rs +3 -2
  7. package/internals/configuration/mod.rs +2 -0
  8. package/internals/configuration/recovery.rs +42 -0
  9. package/internals/{internal_commands → configuration}/typescript_command.rs +20 -22
  10. package/internals/executables/internal_executable_definition.rs +1 -1
  11. package/internals/executables/mod.rs +1 -2
  12. package/internals/executor/executor.rs +13 -0
  13. package/internals/internal_commands/help.rs +5 -2
  14. package/internals/internal_commands/internal_registry.rs +6 -4
  15. package/internals/internal_commands/list_commands.rs +2 -2
  16. package/internals/internal_commands/list_owners.rs +2 -2
  17. package/internals/internal_commands/list_themes.rs +1 -1
  18. package/internals/internal_commands/list_version.rs +60 -0
  19. package/internals/internal_commands/locate_command.rs +5 -4
  20. package/internals/internal_commands/mod.rs +1 -1
  21. package/internals/internal_commands/onboarder.rs +1 -1
  22. package/internals/internal_commands/register_command.rs +3 -3
  23. package/internals/internal_commands/search_commands.rs +2 -2
  24. package/internals/internal_commands/upgrade_repokit.rs +37 -34
  25. package/internals/internal_filesystem/file_builder.rs +4 -0
  26. package/internals/internal_filesystem/internal_filesystem.rs +101 -9
  27. package/internals/logger/logger.rs +26 -14
  28. package/internals/main.rs +6 -3
  29. package/internals/post_processing/mod.rs +1 -0
  30. package/internals/post_processing/post_processor.rs +37 -0
  31. package/internals/repokit/command_definition.rs +11 -0
  32. package/internals/repokit/mod.rs +5 -1
  33. package/internals/repokit/repokit.rs +10 -14
  34. package/internals/repokit/repokit_command.rs +96 -0
  35. package/internals/repokit/repokit_config.rs +75 -0
  36. package/internals/repokit/repokit_construct_validator.rs +14 -0
  37. package/internals/repokit/runtime_compiler.rs +61 -0
  38. package/internals/themes/theme_inputs.rs +3 -2
  39. package/internals/themes/theme_registry.rs +23 -0
  40. package/internals/validations/command_validations.rs +4 -5
  41. package/package.json +1 -1
  42. package/internals/executables/external_executable.rs +0 -4
  43. package/internals/repokit/interfaces.rs +0 -48
  44. /package/internals/executables/{intenal_executable.rs → internal_executable.rs} +0 -0
@@ -46,6 +46,9 @@ impl ThemeRegistry {
46
46
  }
47
47
 
48
48
  pub fn register_user_theme(&mut self, theme: &RepoKitTheme) {
49
+ if self.themes.contains_key(&theme.name) {
50
+ self.on_naming_conflict(&theme.name);
51
+ }
49
52
  self.themes
50
53
  .insert(theme.name.clone(), Theme::from_configuration(theme));
51
54
  }
@@ -99,4 +102,24 @@ impl ThemeRegistry {
99
102
  highlightColor: None,
100
103
  })
101
104
  }
105
+
106
+ fn on_naming_conflict(&self, name: &str) {
107
+ if ThemeRegistry::built_in_color_schemes()
108
+ .1
109
+ .map(|t| t.0)
110
+ .contains(&name)
111
+ {
112
+ println!(
113
+ "{}: I've discovered a theme that conflicts with one of my iternals. Please rename your {} theme",
114
+ self.current_theme().error_prefix("RepoKit"),
115
+ self.current_theme().highlight(name)
116
+ )
117
+ } else {
118
+ println!(
119
+ "{}: I've discovered two themes with the name {}. Please rename one of them",
120
+ self.current_theme().error_prefix("RepoKit"),
121
+ self.current_theme().highlight(name)
122
+ )
123
+ }
124
+ }
102
125
  }
@@ -6,15 +6,14 @@ use std::{
6
6
  use ignore::WalkBuilder;
7
7
 
8
8
  use crate::{
9
+ configuration::typescript_command::TypescriptCommand,
9
10
  executables::{
10
- intenal_executable::InternalExecutable, internal_executable_definition::RepoKitScope,
11
+ internal_executable::InternalExecutable, internal_executable_definition::RepoKitScope,
11
12
  },
12
13
  file_walker::walker::TSFileVisitorBuilder,
13
- internal_commands::{
14
- internal_registry::InternalRegistry, typescript_command::TypescriptCommand,
15
- },
14
+ internal_commands::internal_registry::InternalRegistry,
16
15
  logger::logger::Logger,
17
- repokit::{interfaces::RepoKitCommand, repokit::RepoKit},
16
+ repokit::{repokit::RepoKit, repokit_command::RepoKitCommand},
18
17
  };
19
18
 
20
19
  pub struct CommandValidations {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@repokit/core",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "description": "A knowledgebase for your repository - wrapped in a CLI",
5
5
  "keywords": [
6
6
  "cli",
@@ -1,4 +0,0 @@
1
- trait ExternalExecutable {
2
- fn run(command: String, args: Vec<String>);
3
- fn help(&self);
4
- }
@@ -1,48 +0,0 @@
1
- use std::collections::HashMap;
2
-
3
- use serde::Deserialize;
4
-
5
- use crate::themes::theme_inputs::RepoKitTheme;
6
-
7
- #[derive(Debug, Deserialize, Clone)]
8
- pub struct CommandDefinition {
9
- pub command: String,
10
- pub description: String,
11
- pub args: Option<HashMap<String, String>>,
12
- }
13
-
14
- #[derive(Debug, Deserialize, Clone)]
15
- pub struct RootCommand {
16
- pub name: String,
17
- pub command: String,
18
- pub description: String,
19
- pub args: Option<HashMap<String, String>>,
20
- }
21
-
22
- impl RootCommand {
23
- pub fn from(name: &str, command: &CommandDefinition) -> RootCommand {
24
- RootCommand {
25
- name: name.to_string(),
26
- args: command.args.clone(),
27
- command: command.command.to_string(),
28
- description: command.description.to_string(),
29
- }
30
- }
31
- }
32
-
33
- #[derive(Debug, Deserialize, Clone)]
34
- pub struct RepoKitConfig {
35
- pub project: String,
36
- pub thirdParty: Vec<RepoKitCommand>,
37
- pub commands: HashMap<String, CommandDefinition>,
38
- pub themes: Vec<RepoKitTheme>,
39
- }
40
-
41
- #[derive(Debug, Deserialize, Clone)]
42
- pub struct RepoKitCommand {
43
- pub name: String,
44
- pub owner: String,
45
- pub location: String,
46
- pub description: String,
47
- pub commands: HashMap<String, CommandDefinition>,
48
- }