1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
//! TypeScript-specific CLI argument structs.
//!
//! Each struct flattens the shared `Common*Args` from core and adds
//! TypeScript-specific flags like `--build-command` and `--dep-repo`.
use clap::Args;
use semver_analyzer_core::cli::{CommonAnalyzeArgs, CommonExtractArgs, CommonKonveyorArgs};
use std::path::PathBuf;
/// TypeScript-specific arguments for the `analyze` command.
#[derive(Args, Debug)]
#[command(after_help = "\
EXAMPLES:
# Analyze breaking changes between two tags
semver-analyzer analyze typescript \\
--repo ./my-lib --from v1.0.0 --to v2.0.0 -o report.json
# With CSS dependency repo analysis
semver-analyzer analyze typescript \\
--repo ./my-lib --from v1.0.0 --to v2.0.0 \\
--dep-repo ./my-css --dep-from v1.0.0 --dep-to v2.0.0 \\
--dep-build-command 'npm install && npx gulp buildCSS'
# Use behavioral pipeline with LLM
semver-analyzer analyze typescript \\
--repo ./my-lib --from v1.0.0 --to v2.0.0 \\
--behavioral --llm-command 'goose run --no-session -q -t'")]
pub struct TsAnalyzeArgs {
#[command(flatten)]
pub common: CommonAnalyzeArgs,
/// Custom build command to run before API extraction.
/// If not set, the analyzer detects the package manager and runs tsc
/// with monorepo-aware fallbacks (solution tsconfig, project build script).
#[arg(long, help_heading = "Build")]
pub build_command: Option<String>,
/// Path to a dependency git repository (e.g., @patternfly/patternfly CSS repo).
/// When provided, the SD pipeline extracts CSS profiles from this repo
/// and uses them to enrich composition trees and generate CSS migration rules.
#[arg(long, help_heading = "Dependency Repo")]
pub dep_repo: Option<PathBuf>,
/// Git ref for the "old" version of the dependency repo.
#[arg(long, requires = "dep_repo", help_heading = "Dependency Repo")]
pub dep_from: Option<String>,
/// Git ref for the "new" version of the dependency repo.
#[arg(long, requires = "dep_repo", help_heading = "Dependency Repo")]
pub dep_to: Option<String>,
/// Build command for the dependency repo (e.g., "npm install && npx gulp compileSASS").
/// Runs in the worktree before CSS extraction.
#[arg(long, requires = "dep_repo", help_heading = "Dependency Repo")]
pub dep_build_command: Option<String>,
}
/// TypeScript-specific arguments for the `extract` command.
#[derive(Args, Debug)]
pub struct TsExtractArgs {
#[command(flatten)]
pub common: CommonExtractArgs,
/// Custom build command to run before API extraction.
/// If not set, the analyzer detects the package manager and runs tsc
/// with monorepo-aware fallbacks (solution tsconfig, project build script).
#[arg(long, help_heading = "Build")]
pub build_command: Option<String>,
}
/// TypeScript-specific arguments for the `konveyor` command.
#[derive(Args, Debug)]
#[command(after_help = "\
EXAMPLES:
# Generate rules from a pre-existing analysis report
semver-analyzer konveyor typescript \\
--from-report report.json --output-dir ./rules
# Run full analysis and generate rules in one step
semver-analyzer konveyor typescript \\
--repo ./my-lib --from v1.0.0 --to v2.0.0 \\
--output-dir ./rules
# With custom rename patterns and CSS dependency
semver-analyzer konveyor typescript \\
--repo ./my-lib --from v1.0.0 --to v2.0.0 \\
--output-dir ./rules \\
--rename-patterns renames.yaml \\
--dep-repo ./my-css --dep-from v1.0.0 --dep-to v2.0.0")]
pub struct TsKonveyorArgs {
#[command(flatten)]
pub common: CommonKonveyorArgs,
/// Custom build command to run before API extraction.
/// If not set, the analyzer detects the package manager and runs tsc
/// with monorepo-aware fallbacks (solution tsconfig, project build script).
#[arg(long, help_heading = "Build")]
pub build_command: Option<String>,
/// File glob pattern for filecontent rules.
/// Determines which files Konveyor will scan for violations.
#[arg(
long,
default_value = "*.{ts,tsx,js,jsx,mjs,cjs}",
help_heading = "Rule Generation"
)]
pub file_pattern: String,
/// Name for the generated ruleset.
#[arg(
long,
default_value = "semver-breaking-changes",
help_heading = "Rule Generation"
)]
pub ruleset_name: String,
/// Path to a dependency git repository (e.g., @patternfly/patternfly CSS repo).
/// When provided, the SD pipeline extracts CSS profiles from this repo
/// and uses them to enrich composition trees and generate CSS migration rules.
/// Only used in --repo mode.
#[arg(long, help_heading = "Dependency Repo")]
pub dep_repo: Option<PathBuf>,
/// Git ref for the "old" version of the dependency repo.
#[arg(long, requires = "dep_repo", help_heading = "Dependency Repo")]
pub dep_from: Option<String>,
/// Git ref for the "new" version of the dependency repo.
#[arg(long, requires = "dep_repo", help_heading = "Dependency Repo")]
pub dep_to: Option<String>,
/// Build command for the dependency repo.
/// Runs in the worktree before CSS extraction.
#[arg(long, requires = "dep_repo", help_heading = "Dependency Repo")]
pub dep_build_command: Option<String>,
}