MCPcopy Create free account
hub / github.com/dtormoen/tsk-tsk / warn_deprecated_dockerfiles

Function warn_deprecated_dockerfiles

src/assets/mod.rs:22–60  ·  view source on GitHub ↗

Check for deprecated filesystem-based dockerfile directories and warn the user. Previously, TSK loaded custom dockerfiles from `.tsk/dockerfiles/` and `~/.config/tsk/dockerfiles/`. These are now replaced by inline config fields (`setup`, `stack_config`, `agent_config`) in `tsk.toml`.

(project_root: Option<&Path>, tsk_env: &TskEnv)

Source from the content-addressed store, hash-verified

20/// `~/.config/tsk/dockerfiles/`. These are now replaced by inline config fields
21/// (`setup`, `stack_config`, `agent_config`) in `tsk.toml`.
22pub fn warn_deprecated_dockerfiles(project_root: Option<&Path>, tsk_env: &TskEnv) {
23 let paths: Vec<(&str, std::path::PathBuf)> = [
24 (
25 ".tsk/tsk.toml",
26 project_root.map(|r| r.join(".tsk").join("dockerfiles")),
27 ),
28 (
29 "~/.config/tsk/tsk.toml",
30 Some(tsk_env.config_dir().join("dockerfiles")),
31 ),
32 ]
33 .into_iter()
34 .filter_map(|(config, path)| path.map(|p| (config, p)))
35 .filter(|(_, path)| path.exists())
36 .collect();
37
38 for (config_location, path) in paths {
39 let mut layers = Vec::new();
40 if path.join("project").exists() {
41 layers.push(" - project/*.dockerfile → `setup` field");
42 }
43 if path.join("stack").exists() {
44 layers.push(" - stack/*.dockerfile → `[stack_config.<name>]` setup field");
45 }
46 if path.join("agent").exists() {
47 layers.push(" - agent/*.dockerfile → `[agent_config.<name>]` setup field");
48 }
49 eprintln!(
50 "\x1b[31mWarning: Found removed dockerfile directory: {}\x1b[0m\n\
51 Filesystem-based Docker layers have been removed and are no longer loaded.\n\
52 Migrate to inline config in {}:\n\
53 {}\n\
54 See the README for the new configuration format.",
55 path.display(),
56 config_location,
57 layers.join("\n"),
58 );
59 }
60}
61
62/// Find a template by name, checking project, user, and embedded sources in priority order.
63pub fn find_template(name: &str, project_root: Option<&Path>, tsk_env: &TskEnv) -> Result<String> {

Calls 1

config_dirMethod · 0.80