Skip to content

Commit 605eb9a

Browse files
committed
fix(cli): stabilize registry dependency lifecycle and output
1 parent be001a9 commit 605eb9a

13 files changed

Lines changed: 525 additions & 102 deletions

‎include/vix/cli/Style.hpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ namespace vix::cli::style
3434
inline constexpr const char *PATH = ACCENT;
3535
inline constexpr const char *CODE = RESET;
3636
inline constexpr const char *LINE_NUMBER = RESET;
37-
inline constexpr const char *LABEL = BOLD;
37+
inline constexpr const char *LABEL = RESET;
3838

3939
// Compatibility aliases for existing callers. New diagnostic code should
4040
// prefer the semantic names above.

‎include/vix/cli/commands/InstallCommand.hpp‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ namespace vix::commands
2323
{
2424
static int run(const std::vector<std::string> &args);
2525
static int help();
26+
27+
// Renders the same project dependency loader written by `vix install`
28+
// from already-resolved lockfile contents. No dependency is resolved or
29+
// materialized by this helper.
30+
static bool render_project_cmake_from_lock(
31+
const std::string &lockContents,
32+
std::string &cmakeContents,
33+
std::string &error);
2634
};
2735
}
2836

‎include/vix/cli/util/Lockfile.hpp‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ namespace vix::cli::util::lockfile
3232
int hashVersion{0};
3333
};
3434

35+
std::string serialize_lockfile(
36+
const std::vector<LockedDependency> &dependencies);
37+
38+
std::vector<LockedDependency> preserve_valid_resolutions(
39+
const std::vector<LockedDependency> &resolved,
40+
const std::vector<LockedDependency> &existing);
41+
3542
void write_lockfile_replace_all_or_throw(
3643
const std::filesystem::path &lockPath,
3744
const std::vector<LockedDependency> &dependencies);

‎include/vix/cli/util/Ui.hpp‎

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ namespace vix::cli::util
4141
os << " " << ACCENT << "•" << RESET << " "
4242
<< LABEL << k << RESET
4343
<< ": "
44-
<< WARNING << value << RESET << "\n";
44+
<< value << "\n";
4545
}
4646

4747
inline void section(std::ostream &os, std::string_view title)
@@ -92,7 +92,7 @@ namespace vix::cli::util
9292

9393
inline std::string faint_sep()
9494
{
95-
return std::string(GRAY) + "────────────────────────────────────────" + RESET;
95+
return std::string(MUTED) + "────────────────────────────────────────" + RESET;
9696
}
9797

9898
inline void one_line_spacer(std::ostream &os)
@@ -107,29 +107,24 @@ namespace vix::cli::util
107107
std::string_view desc,
108108
std::string_view repo)
109109
{
110-
os << " " << CYAN << BOLD << id << RESET;
110+
os << " " << LABEL << id << RESET;
111111

112112
if (!latest.empty())
113113
{
114-
os << " "
115-
<< GRAY << "(" << RESET
116-
<< YELLOW << "latest" << RESET
117-
<< GRAY << ": " << RESET
118-
<< YELLOW << BOLD << latest << RESET
119-
<< GRAY << ")" << RESET;
114+
os << " ("
115+
<< LABEL << "latest" << RESET
116+
<< ": " << latest << ")";
120117
}
121118

122119
os << "\n";
123120

124121
if (!desc.empty())
125-
os << " " << GRAY << desc << RESET << "\n";
122+
os << " " << MUTED << desc << RESET << "\n";
126123

127124
if (!repo.empty())
128125
{
129-
os << " "
130-
<< GRAY << "repo: " << RESET
131-
<< CYAN << UNDERLINE << repo << RESET
132-
<< "\n";
126+
os << " " << LABEL << "repo" << RESET << ": "
127+
<< link(std::string(repo)) << "\n";
133128
}
134129
}
135130

@@ -140,31 +135,28 @@ namespace vix::cli::util
140135
std::string_view commit,
141136
std::string_view repo)
142137
{
143-
os << " " << CYAN << BOLD << id << RESET;
138+
os << " " << LABEL << id << RESET;
144139

145140
// Secondary: version
146141
if (!version.empty())
147142
{
148-
os << " "
149-
<< GRAY << "(" << RESET
150-
<< YELLOW << "version" << RESET
151-
<< GRAY << ": " << RESET
152-
<< YELLOW << BOLD << version << RESET
153-
<< GRAY << ")" << RESET;
143+
os << " ("
144+
<< LABEL << "version" << RESET
145+
<< ": " << version << ")";
154146
}
155147

156148
os << "\n";
157149

158150
if (!commit.empty())
159151
{
160-
os << " " << GRAY << "commit: " << RESET
161-
<< YELLOW << commit << RESET << "\n";
152+
os << " " << LABEL << "commit" << RESET << ": "
153+
<< commit << "\n";
162154
}
163155

164156
if (!repo.empty())
165157
{
166-
os << " " << GRAY << "repo: " << RESET
167-
<< CYAN << UNDERLINE << repo << RESET << "\n";
158+
os << " " << LABEL << "repo" << RESET << ": "
159+
<< link(std::string(repo)) << "\n";
168160
}
169161
}
170162

‎src/app/AppCMakeGenerator.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1439,7 +1439,7 @@ namespace vix::cli::app
14391439
// targets are available to target_link_libraries.
14401440
emit_packages(out, manifest.packages);
14411441

1442-
// Registry dependencies are generated by `vix deps` into
1442+
// Registry dependencies are generated by `vix install` into
14431443
// .vix/vix_deps.cmake and must be loaded before target linking.
14441444
emit_registry_deps_loader(out, manifest, projectDir, ownership);
14451445

‎src/commands/AddCommand.cpp‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,11 +1312,7 @@ namespace vix::commands
13121312
vix::cli::util::section(std::cout, "Available versions");
13131313
for (const auto &version : allVersions)
13141314
{
1315-
std::cout
1316-
<< " "
1317-
<< GRAY << "• " << RESET
1318-
<< BOLD << version << RESET
1319-
<< "\n";
1315+
vix::cli::util::info_line(std::cout, version);
13201316
}
13211317
std::cout << "\n";
13221318
}

0 commit comments

Comments
 (0)